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

Merge git://github.com/rustyrussell/linux

* git://github.com/rustyrussell/linux:
virtio-pci: make reset operation safer
virtio-mmio: Correct the name of the guest features selector
virtio: add HAS_IOMEM dependency to MMIO platform bus driver

+23 -3
+1 -1
drivers/virtio/Kconfig
··· 37 37 38 38 config VIRTIO_MMIO 39 39 tristate "Platform bus driver for memory mapped virtio devices (EXPERIMENTAL)" 40 - depends on EXPERIMENTAL 40 + depends on HAS_IOMEM && EXPERIMENTAL 41 41 select VIRTIO 42 42 select VIRTIO_RING 43 43 ---help---
+1 -1
drivers/virtio/virtio_mmio.c
··· 118 118 vring_transport_features(vdev); 119 119 120 120 for (i = 0; i < ARRAY_SIZE(vdev->features); i++) { 121 - writel(i, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SET); 121 + writel(i, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SEL); 122 122 writel(vdev->features[i], 123 123 vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES); 124 124 }
+18
drivers/virtio/virtio_pci.c
··· 169 169 iowrite8(status, vp_dev->ioaddr + VIRTIO_PCI_STATUS); 170 170 } 171 171 172 + /* wait for pending irq handlers */ 173 + static void vp_synchronize_vectors(struct virtio_device *vdev) 174 + { 175 + struct virtio_pci_device *vp_dev = to_vp_device(vdev); 176 + int i; 177 + 178 + if (vp_dev->intx_enabled) 179 + synchronize_irq(vp_dev->pci_dev->irq); 180 + 181 + for (i = 0; i < vp_dev->msix_vectors; ++i) 182 + synchronize_irq(vp_dev->msix_entries[i].vector); 183 + } 184 + 172 185 static void vp_reset(struct virtio_device *vdev) 173 186 { 174 187 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 175 188 /* 0 status means a reset. */ 176 189 iowrite8(0, vp_dev->ioaddr + VIRTIO_PCI_STATUS); 190 + /* Flush out the status write, and flush in device writes, 191 + * including MSi-X interrupts, if any. */ 192 + ioread8(vp_dev->ioaddr + VIRTIO_PCI_STATUS); 193 + /* Flush pending VQ/configuration callbacks. */ 194 + vp_synchronize_vectors(vdev); 177 195 } 178 196 179 197 /* the notify function used when creating a virt queue */
+2
include/linux/virtio_config.h
··· 85 85 * @reset: reset the device 86 86 * vdev: the virtio device 87 87 * After this, status and feature negotiation must be done again 88 + * Device must not be reset from its vq/config callbacks, or in 89 + * parallel with being added/removed. 88 90 * @find_vqs: find virtqueues and instantiate them. 89 91 * vdev: the virtio_device 90 92 * nvqs: the number of virtqueues to find
+1 -1
include/linux/virtio_mmio.h
··· 63 63 #define VIRTIO_MMIO_GUEST_FEATURES 0x020 64 64 65 65 /* Activated features set selector - Write Only */ 66 - #define VIRTIO_MMIO_GUEST_FEATURES_SET 0x024 66 + #define VIRTIO_MMIO_GUEST_FEATURES_SEL 0x024 67 67 68 68 /* Guest's memory page size in bytes - Write Only */ 69 69 #define VIRTIO_MMIO_GUEST_PAGE_SIZE 0x028