Thread (1 message) 1 message, 1 author, 2015-07-31
DORMANTno replies

[PATCH] iommu/arm-smmu-v2: ThunderX(errata-23399) mis-extends 64bit registers

From: Russell King - ARM Linux <hidden>
Date: 2015-07-31 11:48:00
Also in: linux-iommu

On Thu, Jul 30, 2015 at 08:54:04PM +0000, Chalamarla, Tirumalesh wrote:
is some thing like this looks good

+#ifdef CONFIG_64BIT
+#define smmu_writeq(reg64, addr)       writeq_relaxed((reg64), (addr))
+#else
+#define smmu_writeq(reg64, addr)                       \
+               writel_relaxed(((reg64) >> 32), ((addr) + 4));  \
+               writel_relaxed((reg64), (addr))
It's missing a #endif.

This also suffers from multiple argument evaluation, and it hides that
there's two expressions here - which makes future maintanence harder.

#define smmu_writeq(reg64, addr)					\
	do {								\
		u64 __val = (reg64);					\
		volatile void __iomem *__addr = (addr);			\
		writel_relaxed(__val >> 32, __addr + 4);		\
		writel_relaxed(__val, __addr);				\
	} while (0)

is longer but is much preferred as it won't suffer side effects from
stuff like:

	if (...)
		smmu_writeq(val++, addr);

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help