Message ID | 20230109052043.55473-5-hchauhan@ventanamicro.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> 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=<UNKNOWN>) 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=0QU7O/jK; 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=Y5CQ6IA/; 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 4Nr2P72zLHz23g7 for <incoming@patchwork.ozlabs.org>; Mon, 9 Jan 2023 16:21:47 +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=ySPEUfaNJLSpqK5C6Ovt0hyKMf6P9/KqXMJOlxtv9kE=; b=0QU7O/jK2PO+Oe 4qiCdenQ0z0n4vrl5UBBnBsUpJHqroDb076FvQ24Cfg35ikBNv6t5dfqTE7pyGauOrQmNA/Qg4Ep/ CPGEQxHsXEeVB2Pnb+BC1eqj+vZErsKnuHw4u7fHuauEWpwOf7YOu7oWw5TivRdS3ASnF6heNCsQp V6chKEevv4/nvcH00M/qYgQI04cew9ZxbUtyYnKP6q9ZLFru8qoC7lD1TBeE+0DMytSKoA+3kqHkA vpK98Kx/zgydiBR0Uc4jaymsIh3Dsc+OPGC/NDmPMdNv/5zLbSGT+f64XnoQlutyix+ou+B9ciTCi dl2Z49QvDhaGOBD7bPwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkbE-00HQkz-Dq; Mon, 09 Jan 2023 05:21:32 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkbA-00HQic-S4 for opensbi@lists.infradead.org; Mon, 09 Jan 2023 05:21:30 +0000 Received: by mail-pj1-x102f.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so11637298pjj.2 for <opensbi@lists.infradead.org>; Sun, 08 Jan 2023 21:21:28 -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=gnKYglGRg4qomoVfm4W6Di1efQu3UzI0LOVpU2LZDlQ=; b=Y5CQ6IA/NRQUBWvgCrOY0xQRgmsLYTIi7aYp618HPgs5p1Gn803NmMUEVEJEHUOWnm g1a0tzUeACI8Vp1uv0mhRj83u840xZzLwrY3qcK1DIGNTVEDngvxBZUDJ81OT3IDx9w/ 4k/m47CmVh7q0UNTEzSDkmGxY8dIXJr/RBh5aNgu61uxlmVGs/kI32c9GnPqy+Mk37lM 7o09HPBXvmdVu/fCPNHRoOf3OTy+ELhLwD5OpCmJ+FnCmxG78r+ZTSvva6DjgiwERv+h taJ2Vi6hIb2pehvFoE+V4M6Y9dQsx7C+mvqKVLem93RaXSimL1jdfJDGBq7fTOKOfIij +zNQ== 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=gnKYglGRg4qomoVfm4W6Di1efQu3UzI0LOVpU2LZDlQ=; b=EaHpmSuYnbcOCa4ugofxJSpOKBqW1x9o18ltUh2zNTZ7Idc1OgLCgaXewJ7s4saIqT ktkAF95PLHKDeumjY4Stc0b5TIY6+n3w7WxGJPcNLfl9DeOR0XJ3YpmvCaavSEOBsHBe Cd3Qaoe5ngnvuTsya+hy5TpJ67GJtdnZC9EPEjkJksmU1ulNyp62Mhr++u6B3K3KnzLZ LR/QdzlWBsVAgln6GMnERwz/w3LRNqwqJ/NYobgDZ38kOtSJgRlKAk86z49DrqA7w42g MOcYuigHb8b5/RU1V+V7k+GXhXUXG7ytKwet7VDSiBOJ3ybUCR1sDOGETvRkK0GeNxT4 tWmA== X-Gm-Message-State: AFqh2koHU4RnRteRV4vt2oPkyqt0fFM4Z/K9PAl5JrgPvZ5ZrjxjrXQK Xzwrug9QL637pJzgVWBUBKFubG76JeKTiZljO7U= X-Google-Smtp-Source: AMrXdXs9RcM2TUSB5jSFllLZLQPs6PUncWc9E+XVWsGkCgDGG3nFjkffl/zBrew/oCvjxOHRzeb/NQ== X-Received: by 2002:a17:902:7c07:b0:193:bec:2122 with SMTP id x7-20020a1709027c0700b001930bec2122mr10245131pll.32.1673241687447; Sun, 08 Jan 2023 21:21:27 -0800 (PST) Received: from localhost.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id e6-20020a17090301c600b00192dda430ddsm4992027plh.123.2023.01.08.21.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 21:21:27 -0800 (PST) From: Himanshu Chauhan <hchauhan@ventanamicro.com> To: opensbi@lists.infradead.org Cc: Himanshu Chauhan <hchauhan@ventanamicro.com>, Anup Patel <anup@brainfault.org> Subject: [PATCH v2 4/9] lib: sbi: Use finer permission sematics to decide on PMP bits Date: Mon, 9 Jan 2023 05:20:38 +0000 Message-Id: <20230109052043.55473-5-hchauhan@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109052043.55473-1-hchauhan@ventanamicro.com> References: <20230109052043.55473-1-hchauhan@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230108_212128_928804_B1EB2D92 X-CRM114-Status: GOOD ( 11.00 ) 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: Use the fine grained permission bits to decide if the region permissions are to be enforced on all modes. Also use the new permission bits for deciding on R/W/X bits in pmpcfg register. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org> --- lib/sbi/sbi_hart.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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 [2607:f8b0:4864:20:0:0:0:102f 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: <opensbi.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/opensbi>, <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/opensbi/> List-Post: <mailto:opensbi@lists.infradead.org> List-Help: <mailto:opensbi-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/opensbi>, <mailto:opensbi-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "opensbi" <opensbi-bounces@lists.infradead.org> Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
Split region permissions into M-mode and SU-mode
|
expand
|
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 5447c52..2ded55b 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -303,14 +303,20 @@ int sbi_hart_pmp_configure(struct sbi_scratch *scratch) break; pmp_flags = 0; - if (reg->flags & SBI_DOMAIN_MEMREGION_READABLE) + + /* + * If permissions are to be enforced for all modes on this region, + * the lock bit should be set. + */ + if (reg->flags & SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS) + pmp_flags |= PMP_L; + + if (reg->flags & SBI_DOMAIN_MEMREGION_SU_READABLE) pmp_flags |= PMP_R; - if (reg->flags & SBI_DOMAIN_MEMREGION_WRITEABLE) + if (reg->flags & SBI_DOMAIN_MEMREGION_SU_WRITABLE) pmp_flags |= PMP_W; - if (reg->flags & SBI_DOMAIN_MEMREGION_EXECUTABLE) + if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE) pmp_flags |= PMP_X; - if (reg->flags & SBI_DOMAIN_MEMREGION_MMODE) - pmp_flags |= PMP_L; pmp_addr = reg->base >> PMP_SHIFT; if (pmp_gran_log2 <= reg->order && pmp_addr < pmp_addr_max)