[PATCH] iommu/arm-smmu-v2: ThunderX(errata-23399) mis-extends 64bit registers
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Jul 31 04:48:00 PDT 2015
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.
More information about the linux-arm-kernel
mailing list