From patchwork Wed Jan 18 14:42:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1728273 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=t0uNqp9y; 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=FmJGtlUg; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NxpR33fdCz23fT for ; Thu, 19 Jan 2023 01:43:27 +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=GpQ/dDtaabKQqxGV+wKY78EuXEerNP1u77OZLZG6uWQ=; b=t0uNqp9yLwVdCw VAhntSCJGR7axwI/ixuKrgmvGTbW0AXYB7LQULVYY8/7nDsbD9B3XsT8BdfDuWAWx9OwHHuUAR2p9 00CCb++XE6Fzyhf7NBGBWXazBJLljVvwx2+JJl7XuxRMe3mT1LgcyX6nDCntF0pqLzIUXzTrFab9C kzDaglhHfl1pO5Dmpw5u40tY8BEYAAMvT1U6wUlD6cP3sedluShD0d+wJQOlgNrH3phojEnaJzmen btQx/nRZcie0kvH5J3VDDDHDT4vqOksRZl7mp8hoZHhhShb/MyQ6fEPjKZRS2sfYAhxREEdOtDz6e ormlVVQ4u8LKUYVsbXkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI9ef-001OS8-9s; Wed, 18 Jan 2023 14:43:09 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI9eE-001OBt-6W for opensbi@lists.infradead.org; Wed, 18 Jan 2023 14:42:44 +0000 Received: by mail-wm1-x32d.google.com with SMTP id c10-20020a05600c0a4a00b003db0636ff84so1711045wmq.0 for ; Wed, 18 Jan 2023 06:42:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; 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=X+EBugxzeKNWZupWsJP5OujkhZilHWmGsp4G7F1TAk4=; b=FmJGtlUg4IJFwoD/vTc53/K8XYDNoAaJSi/mQPqMqtTfo+WjLXVuRsw4fDHXWWmsdK k/kGVVoexbAJVzxJARRVmkSaFjZWq7xhloYA0/tNnLNuvY6Zlx4xALYjHLjgxFD6E5Q3 cHlK1HUahBGq0DZ5pAD0/rY+D65iLp/o2jKwC1T5NOJWisp3qJ9Tl2QlMAygQlfFftYh mm/6neMn5J884Nn1MxcshYHf/puSOs1F6bMgMduO+LXJZ0edVQscdl2G8ELUxRbrplbu MvgYG0iurwVj980Ci3MRaqYQ0UVkeywwuHxVf/SFdNzFp891xYKo1PEd1s2u0rdJv7AW BqjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=X+EBugxzeKNWZupWsJP5OujkhZilHWmGsp4G7F1TAk4=; b=u9PiiWpCA34AC+DTyO6k0T8lpHbBE/8D8E5HgNYMN+TVnuwhMp0/D9pFR0M9gkKzu7 0+ICVgJ0I/i2o2WBuCgUuCoqi4bMhzzg6OB0RHHTFMta4NShKQ8qv9E2ginvc6XXFIVA oc4NuViTfbuhCfkdSzKl1mRrJK4a+dPhI1ma7OhFECbeGe1HZ4wEEbW3eyGVCRXsImph FjhuF9JLaMgiG+wnywEjMGP6VR9EMZ1eSM8MB5ZJdYtLONkBovLuPLGHern7uuHXF/Qp mnFk0gwMVCqSaBMbb4/OAeyazHXklg/9sPzODuj5aClbwtX88/rJEsLunZgMhQAyTxcH RQtw== X-Gm-Message-State: AFqh2kprhxmfUvuQvsZhXB14NKjDUPLGFYqKOi4GR6Uk34E9+NlMtomy OAtUG9iflsYhw3TpVSdGFog31Jgl5HR+sjfd X-Google-Smtp-Source: AMrXdXuHJRpRbYB7zSXBARd7HookTcjhZT3nVTYhXFqvGMdWHx4NfOzNpOyHggtj2FJh42q/o6IBeg== X-Received: by 2002:a05:600c:4f92:b0:3cf:88c3:d008 with SMTP id n18-20020a05600c4f9200b003cf88c3d008mr15553749wmq.28.1674052960586; Wed, 18 Jan 2023 06:42:40 -0800 (PST) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c35c100b003db06493ee7sm2244150wmq.47.2023.01.18.06.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 06:42:40 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Atish Patra ' , 'Anup Patel ' , 'Ley Foon Tan ' , 'Sia Jee Heng ' , Anup Patel Subject: [PATCH 04/11] lib: sbi_hsm: Move misplaced comment Date: Wed, 18 Jan 2023 15:42:27 +0100 Message-Id: <20230118144234.79263-5-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118144234.79263-1-ajones@ventanamicro.com> References: <20230118144234.79263-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_064242_307309_047515FF X-CRM114-Status: GOOD ( 10.29 ) 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: While non-retentive suspend is not allowed for M-mode, the comment at the top of sbi_hsm_hart_suspend() implied suspend wasn't allowed for M-mode at all. Move the comment above the mode check which is [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32d listed in] [list.dnswl.org] -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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 While non-retentive suspend is not allowed for M-mode, the comment at the top of sbi_hsm_hart_suspend() implied suspend wasn't allowed for M-mode at all. Move the comment above the mode check which is inside a suspend type is non-retentive check. Signed-off-by: Andrew Jones Reviewed-by: Anup Patel --- lib/sbi/sbi_hsm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 2fbb0d0afc7e..2eb189a9d7f3 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -399,8 +399,6 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, struct sbi_hsm_data *hdata = sbi_scratch_offset_ptr(scratch, hart_data_offset); - /* For now, we only allow suspend from S-mode or U-mode. */ - /* Sanity check on domain assigned to current HART */ if (!dom) return SBI_EFAIL; @@ -415,6 +413,10 @@ int sbi_hsm_hart_suspend(struct sbi_scratch *scratch, u32 suspend_type, /* Additional sanity check for non-retentive suspend */ if (suspend_type & SBI_HSM_SUSP_NON_RET_BIT) { + /* + * For now, we only allow non-retentive suspend from + * S-mode or U-mode. + */ if (rmode != PRV_S && rmode != PRV_U) return SBI_EFAIL; if (dom && !sbi_domain_check_addr(dom, raddr, rmode,