lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241022123240.GGZxebaKRONhSThUCC@fat_crate.local>
Date: Tue, 22 Oct 2024 14:32:40 +0200
From: Borislav Petkov <bp@...en8.de>
To: David Thompson <davthompson@...dia.com>
Cc: shravankr@...dia.com, tony.luck@...el.com, james.morse@....com,
	mchehab@...nel.org, rric@...nel.org, linux-edac@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] EDAC/bluefield: Use Arm SMC for EMI access on
 BlueField-2

On Mon, Oct 21, 2024 at 07:30:13PM -0400, David Thompson wrote:
>  drivers/edac/bluefield_edac.c | 169 ++++++++++++++++++++++++++++++----
>  1 file changed, 150 insertions(+), 19 deletions(-)

Some trivial simplifications ontop along with moving the struct member
comments above them (not sideways) as requested.

I'll queue it with them ontop unless you see issues.

---
diff --git a/drivers/edac/bluefield_edac.c b/drivers/edac/bluefield_edac.c
index 126efb96deee..739132e5ed8a 100644
--- a/drivers/edac/bluefield_edac.c
+++ b/drivers/edac/bluefield_edac.c
@@ -89,7 +89,7 @@ struct bluefield_edac_priv {
 	/* access to secure regs supported */
 	bool svc_sreg_support;
 	/* SMC table# for secure regs access */
-	u32 sreg_tbl_edac;
+	u32 sreg_tbl;
 };
 
 static u64 smc_call1(u64 smc_op, u64 smc_arg)
@@ -138,15 +138,13 @@ static int secure_writel(void __iomem *addr, u32 data, u32 sreg_tbl)
 
 static int bluefield_edac_readl(struct bluefield_edac_priv *priv, u32 offset, u32 *result)
 {
-	bool sreg_support = priv->svc_sreg_support;
-	u32 sreg_tbl = priv->sreg_tbl_edac;
 	void __iomem *addr;
 	int err = 0;
 
 	addr = priv->emi_base + offset;
 
-	if (sreg_support)
-		err = secure_readl(addr, result, sreg_tbl);
+	if (priv->svc_sreg_support)
+		err = secure_readl(addr, result, priv->sreg_tbl);
 	else
 		*result = readl(addr);
 
@@ -155,15 +153,13 @@ static int bluefield_edac_readl(struct bluefield_edac_priv *priv, u32 offset, u3
 
 static int bluefield_edac_writel(struct bluefield_edac_priv *priv, u32 offset, u32 data)
 {
-	bool sreg_support = priv->svc_sreg_support;
-	u32 sreg_tbl = priv->sreg_tbl_edac;
 	void __iomem *addr;
 	int err = 0;
 
 	addr = priv->emi_base + offset;
 
-	if (sreg_support)
-		err = secure_writel(addr, data, sreg_tbl);
+	if (priv->svc_sreg_support)
+		err = secure_writel(addr, data, priv->sreg_tbl);
 	else
 		writel(data, addr);
 
@@ -393,7 +389,7 @@ static int bluefield_edac_mc_probe(struct platform_device *pdev)
 	 * b) property is present - indirectly access registers via SMC calls
 	 *    (assuming required Silicon Provider service version found)
 	 */
-	if (device_property_read_u32(dev, "sec_reg_block", &priv->sreg_tbl_edac)) {
+	if (device_property_read_u32(dev, "sec_reg_block", &priv->sreg_tbl)) {
 		priv->svc_sreg_support = false;
 	} else {
 		/*

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ