From patchwork Tue Mar 19 14:59:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1913617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=KKK/QyuJ; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=idUY8eW/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TzZdW3WKZz23sG for ; Wed, 20 Mar 2024 01:59:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fO9w2QkKlvVaZjdKZUc3pjjMVNk0gsg6dB9UFUpI51w=; b=KKK/QyuJAdOhXP ivplISOgUQzFNWVF81OyxKkveO2TrXAnEXlkXJ/1q2rmuspjeM2eywyFsK71II3elCI+ecE53Ivzu TErNXldT4j5/z6hVKb8nMbpskP9ImfG1pOAqFz9Qeic9bIn2kw09MtGQbAFq1bsLiZgb5whFPo9Mw /GpsQyEj6Tg//JYO27gJpQtd23WeITIJBIzuGQLhn8/u5kuA6vMdsg0vbmZoVb5FyY5SELxEfUO3X JH2uDH8jeDCwMMvzWxUaZ1LAnvM4sNRjCDWQ8I9a7iZnszGS83pbLhVpEk/1yxA/ECaN/15gcxj4j Y4othTahR8qn1EhQyLpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmawR-0000000D3lK-1qVW; Tue, 19 Mar 2024 14:59:51 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmawN-0000000D3jX-2k9w for opensbi@lists.infradead.org; Tue, 19 Mar 2024 14:59:50 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5a4789684abso2753110eaf.0 for ; Tue, 19 Mar 2024 07:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1710860386; x=1711465186; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xwVVmu4J/Rtx0OTNb6hsTJ02gMEr32wbw4T8Jw6i8Tc=; b=idUY8eW/8o6rMTEv5Tv81M3sQd6E92eCE/bEYst0l76OIOHaZWdkdR+vnnoV5c7+z7 0OQ++Cmp1Jzlk6Hwi4DL2YYkLCYAi3kRQfk2VAIB6XiSl+aU0EPYFBqpFZgoOMZouI/y lO7Bocj0D3B4Tl9V1bLdPg4untaVuJy2B8ltqvfYVTjaQbzp97iz9Dq87To2ddZUe85X Q0O3F0hfYy3NNUnXt9yrHPaCUmyyjpNJawQzVR+sQmz7KLnHYdywUuXnIlHMg2snCWz7 XH4jJHIqx35k8+DmxaU2zYWK/PmwRoLLFKklbor5++LofkEPTsFNA0+CUKUNA9zfquu7 IMSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710860386; x=1711465186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xwVVmu4J/Rtx0OTNb6hsTJ02gMEr32wbw4T8Jw6i8Tc=; b=hOBVSX9am4rxE9kay78C2jHkmszBIb/CSCNdxUpW/S0IkJe1YoJolpH3Hzm/t+HfNG HBlziZWi15M73ueJuAOtlODmH3/nMiMvS/cvsblEblhIvwtMa+j/19TGt7jMIDPwjfWs 96CnCY8gtzHH3YrdsqXwqCEDe6AvfMSvQQhXFbrCHGRHwM0u3uICQpRShahPqyB86uIl OwAwZ6d2esGis+Yo6PoUqYrjjOgNqQPMLtlRvfuZKq6dSVdZ9RZj15GkLi4ZrwbM8UCu cbrZthpZb5TtLRzcEdSowhSN99iIZeNi+m+E4wdAvM8NUWUB1BjrTUSvspnaxi2DRBZB 9EkQ== X-Forwarded-Encrypted: i=1; AJvYcCV3NrjjiIhBC9Ti7h/ERH19FCmPqPSxTYEVKAfA9Nc25sUcw2FhnhoyzFPffaLRqloK4xlZjE+Cui18ij36/2q4ELZiHfjpPY09G6k= X-Gm-Message-State: AOJu0YzkdG3CQxEdds/zx7LOSAlC3SP0+emlVb5lGc3onBafXDpB7w16 EWKQLgRr7bNuDSsmWOChm0Q82yGgKQo6H5eTQIJyoMzIYaIQa0Apw8QWS3juTZbHPITqUSGeo41 modM= X-Google-Smtp-Source: AGHT+IE8o8ma06psyvabQqRb5Pb0vefzEbokAnfwCXWXbyovuA/zOo4VNHCEidjORjyE1O8+BwzvdQ== X-Received: by 2002:a05:6820:98c:b0:5a4:97f0:ca44 with SMTP id cg12-20020a056820098c00b005a497f0ca44mr3085922oob.5.1710860386209; Tue, 19 Mar 2024 07:59:46 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id cz8-20020a056820268800b005a4bb400a0fsm720113oob.4.2024.03.19.07.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 07:59:45 -0700 (PDT) From: Anup Patel To: Atish Patra Cc: Andrew Jones , Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 2/2] lib: sbi: Wakeup non-coldboot HARTs early in the coldboot path Date: Tue, 19 Mar 2024 20:29:30 +0530 Message-Id: <20240319145930.1827176-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240319145930.1827176-1-apatel@ventanamicro.com> References: <20240319145930.1827176-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240319_075948_087827_8CB164F7 X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Currently, all non-coldboot HARTs busy spin in wait_for_coldboot() until the entire coldboot init sequence is completed. This means: 1) On QEMU, all non-coldboot HARTs will eat host CPU time and also slow down the coldboot HART until the entire coldboot init sequence is completed. 2) On real HW, all non-coldboot HARTs w [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:c36 listed in] [list.dnswl.org] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently, all non-coldboot HARTs busy spin in wait_for_coldboot() until the entire coldboot init sequence is completed. This means: 1) On QEMU, all non-coldboot HARTs will eat host CPU time and also slow down the coldboot HART until the entire coldboot init sequence is completed. 2) On real HW, all non-coldboot HARTs will consume more CPU power until the entire coldboot init sequence is completed. To address this, wake up all non-coldboot HARTs as early as possible in the coldboot init sequence. Signed-off-by: Anup Patel --- lib/sbi/sbi_init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index b3f3e38..8fdc8de 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -243,6 +243,14 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) if (rc) sbi_hart_hang(); + /* + * All non-coldboot HARTs do HSM initialization (i.e. enter HSM state + * machine) at the start of the warmboot path so it is wasteful to + * have these HARTs busy spin in wait_for_coldboot() until coldboot + * path is completed. + */ + wake_coldboot_harts(scratch, hartid); + rc = sbi_platform_early_init(plat, true); if (rc) sbi_hart_hang(); @@ -348,8 +356,6 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid) sbi_hart_hang(); } - wake_coldboot_harts(scratch, hartid); - count = sbi_scratch_offset_ptr(scratch, init_count_offset); (*count)++; @@ -369,6 +375,7 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch, count = sbi_scratch_offset_ptr(scratch, entry_count_offset); (*count)++; + /* Note: This has to be first thing in warmboot init sequence */ rc = sbi_hsm_init(scratch, hartid, false); if (rc) sbi_hart_hang();