On Tue, Nov 08, 2016 at 06:40:35PM +0100, Alexander Gordeev wrote: [...] > > Looks like Linux is using memory barrior and volatile keywords to do > > the protection (build_mmio_read() for x86). I think at least I can add > > volatile here for each read/write to make it safer. Do you think > > that'll suffice here? E.g.: > > > > static inline uint64_t vtd_readq(unsigned int reg) > > { > > return *(volatile uint64_t *)(Q35_HOST_BRIDGE_IOMMU_ADDR + reg); > > } > > Yeah, I think with volatile it is better. But I am still missing > why not just use read/write which already exist and use volatile: > > static inline u64 __raw_readq(const volatile void *addr) > { > assert(sizeof(unsigned long) == sizeof(u64)); > return *(const volatile u64 *)addr; > } That's nice! I'll use it. Thanks, -- peterx -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html