Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfio-v6.11-rc1' of https://github.com/awilliam/linux-vfio

Pull VFIO updates from Alex Williamson:

- Add support for 8-byte accesses when using read/write through the
device regions. This fills a gap for userspace drivers that might
not be able to use access through mmap to perform native register
width accesses (Gerd Bayer)

- Add missing MODULE_DESCRIPTION to vfio-mdev sample drivers and
replace a non-standard MODULE_INFO usage (Jeff Johnson)

* tag 'vfio-v6.11-rc1' of https://github.com/awilliam/linux-vfio:
vfio-mdev: add missing MODULE_DESCRIPTION() macros
vfio/pci: Fix typo in macro to declare accessors
vfio/pci: Support 8-byte PCI loads and stores
vfio/pci: Extract duplicated code into macro

+78 -70
+62 -60
drivers/vfio/pci/vfio_pci_rdwr.c
··· 89 89 VFIO_IOREAD(8) 90 90 VFIO_IOREAD(16) 91 91 VFIO_IOREAD(32) 92 + #ifdef ioread64 93 + VFIO_IOREAD(64) 94 + #endif 95 + 96 + #define VFIO_IORDWR(size) \ 97 + static int vfio_pci_iordwr##size(struct vfio_pci_core_device *vdev,\ 98 + bool iswrite, bool test_mem, \ 99 + void __iomem *io, char __user *buf, \ 100 + loff_t off, size_t *filled) \ 101 + { \ 102 + u##size val; \ 103 + int ret; \ 104 + \ 105 + if (iswrite) { \ 106 + if (copy_from_user(&val, buf, sizeof(val))) \ 107 + return -EFAULT; \ 108 + \ 109 + ret = vfio_pci_core_iowrite##size(vdev, test_mem, \ 110 + val, io + off); \ 111 + if (ret) \ 112 + return ret; \ 113 + } else { \ 114 + ret = vfio_pci_core_ioread##size(vdev, test_mem, \ 115 + &val, io + off); \ 116 + if (ret) \ 117 + return ret; \ 118 + \ 119 + if (copy_to_user(buf, &val, sizeof(val))) \ 120 + return -EFAULT; \ 121 + } \ 122 + \ 123 + *filled = sizeof(val); \ 124 + return 0; \ 125 + } \ 126 + 127 + VFIO_IORDWR(8) 128 + VFIO_IORDWR(16) 129 + VFIO_IORDWR(32) 130 + #if defined(ioread64) && defined(iowrite64) 131 + VFIO_IORDWR(64) 132 + #endif 92 133 93 134 /* 94 135 * Read or write from an __iomem region (MMIO or I/O port) with an excluded ··· 155 114 else 156 115 fillable = 0; 157 116 117 + #if defined(ioread64) && defined(iowrite64) 118 + if (fillable >= 8 && !(off % 8)) { 119 + ret = vfio_pci_iordwr64(vdev, iswrite, test_mem, 120 + io, buf, off, &filled); 121 + if (ret) 122 + return ret; 123 + 124 + } else 125 + #endif 158 126 if (fillable >= 4 && !(off % 4)) { 159 - u32 val; 127 + ret = vfio_pci_iordwr32(vdev, iswrite, test_mem, 128 + io, buf, off, &filled); 129 + if (ret) 130 + return ret; 160 131 161 - if (iswrite) { 162 - if (copy_from_user(&val, buf, 4)) 163 - return -EFAULT; 164 - 165 - ret = vfio_pci_core_iowrite32(vdev, test_mem, 166 - val, io + off); 167 - if (ret) 168 - return ret; 169 - } else { 170 - ret = vfio_pci_core_ioread32(vdev, test_mem, 171 - &val, io + off); 172 - if (ret) 173 - return ret; 174 - 175 - if (copy_to_user(buf, &val, 4)) 176 - return -EFAULT; 177 - } 178 - 179 - filled = 4; 180 132 } else if (fillable >= 2 && !(off % 2)) { 181 - u16 val; 133 + ret = vfio_pci_iordwr16(vdev, iswrite, test_mem, 134 + io, buf, off, &filled); 135 + if (ret) 136 + return ret; 182 137 183 - if (iswrite) { 184 - if (copy_from_user(&val, buf, 2)) 185 - return -EFAULT; 186 - 187 - ret = vfio_pci_core_iowrite16(vdev, test_mem, 188 - val, io + off); 189 - if (ret) 190 - return ret; 191 - } else { 192 - ret = vfio_pci_core_ioread16(vdev, test_mem, 193 - &val, io + off); 194 - if (ret) 195 - return ret; 196 - 197 - if (copy_to_user(buf, &val, 2)) 198 - return -EFAULT; 199 - } 200 - 201 - filled = 2; 202 138 } else if (fillable) { 203 - u8 val; 139 + ret = vfio_pci_iordwr8(vdev, iswrite, test_mem, 140 + io, buf, off, &filled); 141 + if (ret) 142 + return ret; 204 143 205 - if (iswrite) { 206 - if (copy_from_user(&val, buf, 1)) 207 - return -EFAULT; 208 - 209 - ret = vfio_pci_core_iowrite8(vdev, test_mem, 210 - val, io + off); 211 - if (ret) 212 - return ret; 213 - } else { 214 - ret = vfio_pci_core_ioread8(vdev, test_mem, 215 - &val, io + off); 216 - if (ret) 217 - return ret; 218 - 219 - if (copy_to_user(buf, &val, 1)) 220 - return -EFAULT; 221 - } 222 - 223 - filled = 1; 224 144 } else { 225 145 /* Fill reads with -1, drop writes */ 226 146 filled = min(count, (size_t)(x_end - off));
+12 -9
include/linux/vfio_pci_core.h
··· 137 137 loff_t *buf_offset, 138 138 size_t *intersect_count, 139 139 size_t *register_offset); 140 - #define VFIO_IOWRITE_DECLATION(size) \ 140 + #define VFIO_IOWRITE_DECLARATION(size) \ 141 141 int vfio_pci_core_iowrite##size(struct vfio_pci_core_device *vdev, \ 142 142 bool test_mem, u##size val, void __iomem *io); 143 143 144 - VFIO_IOWRITE_DECLATION(8) 145 - VFIO_IOWRITE_DECLATION(16) 146 - VFIO_IOWRITE_DECLATION(32) 144 + VFIO_IOWRITE_DECLARATION(8) 145 + VFIO_IOWRITE_DECLARATION(16) 146 + VFIO_IOWRITE_DECLARATION(32) 147 147 #ifdef iowrite64 148 - VFIO_IOWRITE_DECLATION(64) 148 + VFIO_IOWRITE_DECLARATION(64) 149 149 #endif 150 150 151 - #define VFIO_IOREAD_DECLATION(size) \ 151 + #define VFIO_IOREAD_DECLARATION(size) \ 152 152 int vfio_pci_core_ioread##size(struct vfio_pci_core_device *vdev, \ 153 153 bool test_mem, u##size *val, void __iomem *io); 154 154 155 - VFIO_IOREAD_DECLATION(8) 156 - VFIO_IOREAD_DECLATION(16) 157 - VFIO_IOREAD_DECLATION(32) 155 + VFIO_IOREAD_DECLARATION(8) 156 + VFIO_IOREAD_DECLARATION(16) 157 + VFIO_IOREAD_DECLARATION(32) 158 + #ifdef ioread64 159 + VFIO_IOREAD_DECLARATION(64) 160 + #endif 158 161 159 162 #endif /* VFIO_PCI_CORE_H */
+1
samples/vfio-mdev/mbochs.c
··· 88 88 #define STORE_LE32(addr, val) (*(u32 *)addr = val) 89 89 90 90 91 + MODULE_DESCRIPTION("Mediated virtual PCI display host device driver"); 91 92 MODULE_LICENSE("GPL v2"); 92 93 93 94 static int max_mbytes = 256;
+1
samples/vfio-mdev/mdpy-fb.c
··· 229 229 module_init(mdpy_fb_init); 230 230 231 231 MODULE_DEVICE_TABLE(pci, mdpy_fb_pci_table); 232 + MODULE_DESCRIPTION("Framebuffer driver for mdpy (mediated virtual pci display device)"); 232 233 MODULE_LICENSE("GPL v2");
+1
samples/vfio-mdev/mdpy.c
··· 40 40 #define STORE_LE32(addr, val) (*(u32 *)addr = val) 41 41 42 42 43 + MODULE_DESCRIPTION("Mediated virtual PCI display host device driver"); 43 44 MODULE_LICENSE("GPL v2"); 44 45 45 46 #define MDPY_TYPE_1 "vga"
+1 -1
samples/vfio-mdev/mtty.c
··· 2058 2058 module_exit(mtty_dev_exit) 2059 2059 2060 2060 MODULE_LICENSE("GPL v2"); 2061 - MODULE_INFO(supported, "Test driver that simulate serial port over PCI"); 2061 + MODULE_DESCRIPTION("Test driver that simulate serial port over PCI"); 2062 2062 MODULE_VERSION(VERSION_STRING); 2063 2063 MODULE_AUTHOR(DRIVER_AUTHOR);