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: <20240503135455.966-8-ansuelsmth@gmail.com>
Date: Fri,  3 May 2024 15:54:07 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Hauke Mehrtens <hauke@...ke-m.de>,
	Rafał Miłecki <zajec5@...il.com>,
	Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Christian Marangi <ansuelsmth@...il.com>,
	Álvaro Fernández Rojas <noltari@...il.com>,
	linux-mips@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Daniel González Cabanelas <dgcbueu@...il.com>
Subject: [PATCH 6/6] mips: bmips: dma: drop redundant boot_cpu_type in arch_dma_sync

Drop redundant boot_cpu_type in arch_sync_dma_for_cpu_all. These needs
to be parsed only once and we can make use of bmips_rac_flush_disable to
disable RAC flush on unsupported CPU.

Set this value in bmips_cpu_setup for unsupported CPU to skip this
redundant check every time DMA needs to be synced.

Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
 arch/mips/bmips/dma.c         | 5 -----
 arch/mips/bmips/setup.c       | 1 -
 arch/mips/include/asm/bmips.h | 1 +
 arch/mips/kernel/smp-bmips.c  | 7 +++++++
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/mips/bmips/dma.c b/arch/mips/bmips/dma.c
index 799cc3e12fc3..e9af34f82dcd 100644
--- a/arch/mips/bmips/dma.c
+++ b/arch/mips/bmips/dma.c
@@ -11,11 +11,6 @@ void arch_sync_dma_for_cpu_all(void)
 {
 	u32 cfg;
 
-	if (boot_cpu_type() != CPU_BMIPS3300 &&
-	    boot_cpu_type() != CPU_BMIPS4350 &&
-	    boot_cpu_type() != CPU_BMIPS4380)
-		return;
-
 	if (unlikely(bmips_rac_flush_disable))
 		return;
 
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index bef84677248e..d27043b10405 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -40,7 +40,6 @@
  * with "mips-cbr-reg" in the "cpus" node.
  */
 void __iomem *bmips_cbr_addr;
-extern bool bmips_rac_flush_disable;
 
 static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
 
diff --git a/arch/mips/include/asm/bmips.h b/arch/mips/include/asm/bmips.h
index 3a1cdfddb987..4a48c8f1077e 100644
--- a/arch/mips/include/asm/bmips.h
+++ b/arch/mips/include/asm/bmips.h
@@ -82,6 +82,7 @@ extern char bmips_smp_int_vec[];
 extern char bmips_smp_int_vec_end[];
 
 extern void __iomem *bmips_cbr_addr;
+extern bool bmips_rac_flush_disable;
 extern int bmips_smp_enabled;
 extern int bmips_cpu_offset;
 extern cpumask_t bmips_booted_mask;
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 7bde6bbaa41f..63534af367c7 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -681,6 +681,13 @@ void bmips_cpu_setup(void)
 		"	or	$8, $9\n"
 		"	.word	0x4088b008\n"	/* mtc0 $8, $22, 8 */
 		: : : "$8", "$9");
+
+		/* Disable RAC flush as not supported */
+		bmips_rac_flush_disable = true;
 		break;
+
+	default:
+		/* Disable RAC flush as not supported */
+		bmips_rac_flush_disable = true;
 	}
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ