Skip to content

Commit e901724

Browse files
chris-ooAllen Pais
authored andcommitted
vfio/pci: hack to fix broken 64 bit detection on x86-64
On x86-64 the detection vfio uses for 64 bit accesses is incorrect. Until a fix is proposed upstream, workaround it.
1 parent f9f6f31 commit e901724

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

include/linux/vfio_pci_core.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@
1919
#ifndef VFIO_PCI_CORE_H
2020
#define VFIO_PCI_CORE_H
2121

22+
#ifdef CONFIG_64BIT
23+
#ifndef ioread64
24+
#define ioread64 ioread64_pci
25+
static inline u64 ioread64_pci(const volatile void __iomem *addr)
26+
{
27+
return readq(addr);
28+
}
29+
#endif
30+
#endif /* CONFIG_64BIT */
31+
32+
#ifdef CONFIG_64BIT
33+
#ifndef iowrite64
34+
#define iowrite64 iowrite64_pci
35+
static inline void iowrite64_pci(u64 value, volatile void __iomem *addr)
36+
{
37+
writeq(value, addr);
38+
}
39+
#endif
40+
#endif /* CONFIG_64BIT */
41+
2242
#define VFIO_PCI_OFFSET_SHIFT 40
2343
#define VFIO_PCI_OFFSET_TO_INDEX(off) (off >> VFIO_PCI_OFFSET_SHIFT)
2444
#define VFIO_PCI_INDEX_TO_OFFSET(index) ((u64)(index) << VFIO_PCI_OFFSET_SHIFT)

0 commit comments

Comments
 (0)