From patchwork Mon Feb 27 10:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1748594 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=KBkteTYi; 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=gvTyvDBm; 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 4PQGy46zvKz1yWw for ; Mon, 27 Feb 2023 21:31:40 +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=ViyO5Me9v9tpc33LZDGvxaaxBBHfMJmHw6lungxAXPM=; b=KBkteTYiJMRvLP EHBEOoRpuXJruZ9x0UB7fGN3ttDpJ5ONcdJpBvyQfmwj2DbypnfqtXWZJLP3/ksu2gpzQ+Es5mQWz qRSR8koaLug+ixMDePUVU40JcM9RRYND5hfT9JHni6lNa51mYb9ae7/Alhrej+jZK3HFgpz509nhX hWA9qVoyO+8JRggspBUh3WYKnHM+xFDtzmmBKAbCAYOWnNMIvrWJdZTsXMZhPwuaH2CI3upIWdTXV pJDmGyfeRGCKgMCqv/yamLysWt9Tu/JPXQHK9NPdDHcCSn0hCeE0YjTWMCXrSc0DR4WuIaPVN5hyS WWZN4dMQw/Vaduc2kyog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWan0-009EVp-Bh; Mon, 27 Feb 2023 10:31:26 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWamv-009ESd-0G for opensbi@lists.infradead.org; Mon, 27 Feb 2023 10:31:22 +0000 Received: by mail-wm1-x331.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso6315349wmi.4 for ; Mon, 27 Feb 2023 02:31:20 -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=xzHODErJ2E0zNFIVq46+IZjfgCC/LkfKFtws9NyQeCM=; b=gvTyvDBmUCrSWYJelD09mbGLelE8846bXOk4kgRS0gR5tmns773DzqE0Bx4/ycB+jU jjWVeS4Ekos1BShewO+2lgEHY9TFBVa1pkyAe3hPpW6ijVEP9m6V/wehfRiPEwB9okfb HyiJ+tTZlrLgxzL/UQXEYdyZGO9ZQJ27/5C2h3i41j+GGs1KtxOKbcGEEF4ln1vGb7td BmaG+KEc8ANNoExgfWDt/JfxDwQVz4nnmIyZjE+ZHJ/S7df+y+oqaGuBZLqvkerY6Ud6 24mnMHcVxnxLHGzVuAR8MkPMemWyWQp34KnyfWmjg8NYzBc4WV6ntVmN2Bem2slP+GIM kYjQ== 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=xzHODErJ2E0zNFIVq46+IZjfgCC/LkfKFtws9NyQeCM=; b=Lqf6p4MbaeqsBiCQJ745UowcAQedFXpX8GwmlSbIjPan1eYohP3yD0O2gYLAr5OKAo ZEDzjf8VVxmkU2f6ij2MvSmkfRYKmYvPl6JTLg4ghwpEAAPJ0QJ4vtba+LnJMC1g4jf8 ju5ImtlXU86ELCR09x7uDrmPUGPhg6PiDE4vGA8Rd50ZzzVtg5Njvr/ZefHFYhpcbFg+ D2F25JHflna0u7Qm2gQ3bziUjMhAUJjz400T+lqqvBiLTFj1jS4oN70RvoJEw5qJFUyX usZtRMvpsUBoDKUXOTX1b8vApKiKJqbqq6siIotxeU0+H9luexdeYzXkMzUMknkE9OzC hvLw== X-Gm-Message-State: AO0yUKXqKWfFKDeZiFflArL+OMhigycOBGL454y6PauzR3ZvLTyBIkWF abJ10ptvf3K0Cq6OWiLckve9jA76a4gFCG4+ X-Google-Smtp-Source: AK7set/SIwdnRf6vZTilRqt6yRy1mBZzcUAD5VbJBqq2T9k5iv1fCaLA1TVCF9+DU6cDaT6fynYF7g== X-Received: by 2002:a1c:ed1a:0:b0:3ea:f6c4:305e with SMTP id l26-20020a1ced1a000000b003eaf6c4305emr9448094wmh.38.1677493880447; Mon, 27 Feb 2023 02:31:20 -0800 (PST) Received: from localhost (cst2-173-16.cust.vodafone.cz. [31.30.173.16]) by smtp.gmail.com with ESMTPSA id f5-20020a1c6a05000000b003d9aa76dc6asm12153121wmc.0.2023.02.27.02.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 02:31:20 -0800 (PST) From: Andrew Jones To: opensbi@lists.infradead.org Cc: 'Ley Foon Tan ' , 'Atish Patra ' , 'Anup Patel ' , 'Sia Jee Heng ' , Anup Patel Subject: [PATCH v2 04/11] lib: sbi_hsm: Move misplaced comment Date: Mon, 27 Feb 2023 11:30:59 +0100 Message-Id: <20230227103106.137995-5-ajones@ventanamicro.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230227103106.137995-1-ajones@ventanamicro.com> References: <20230227103106.137995-1-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230227_023121_097828_6505EB9F X-CRM114-Status: GOOD ( 10.76 ) 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:331 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 3455520b8a94..294156a9a7bd 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -398,8 +398,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; @@ -414,6 +412,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,