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 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio/qemu fixes from Michael S Tsirkin:
"A couple of fixes for virtio and for the new QEMU fw cfg driver"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
virtio: add VIRTIO_CONFIG_S_NEEDS_RESET device status bit
MAINTAINERS: add entry for QEMU
firmware: qemu_fw_cfg.c: hold ACPI global lock during device access
virtio: virtio 1.0 cs04 spec compliance for reset
qemu_fw_cfg: don't leak kobj on init error

+40 -4
+7
MAINTAINERS
··· 9142 9142 S: Supported 9143 9143 F: drivers/net/wireless/ath/wcn36xx/ 9144 9144 9145 + QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT 9146 + M: Gabriel Somlo <somlo@cmu.edu> 9147 + M: "Michael S. Tsirkin" <mst@redhat.com> 9148 + L: qemu-devel@nongnu.org 9149 + S: Maintained 9150 + F: drivers/firmware/qemu_fw_cfg.c 9151 + 9145 9152 RADOS BLOCK DEVICE (RBD) 9146 9153 M: Ilya Dryomov <idryomov@gmail.com> 9147 9154 M: Sage Weil <sage@redhat.com>
+23 -1
drivers/firmware/qemu_fw_cfg.c
··· 77 77 static inline void fw_cfg_read_blob(u16 key, 78 78 void *buf, loff_t pos, size_t count) 79 79 { 80 + u32 glk; 81 + acpi_status status; 82 + 83 + /* If we have ACPI, ensure mutual exclusion against any potential 84 + * device access by the firmware, e.g. via AML methods: 85 + */ 86 + status = acpi_acquire_global_lock(ACPI_WAIT_FOREVER, &glk); 87 + if (ACPI_FAILURE(status) && status != AE_NOT_CONFIGURED) { 88 + /* Should never get here */ 89 + WARN(1, "fw_cfg_read_blob: Failed to lock ACPI!\n"); 90 + memset(buf, 0, count); 91 + return; 92 + } 93 + 80 94 mutex_lock(&fw_cfg_dev_lock); 81 95 iowrite16(fw_cfg_sel_endianness(key), fw_cfg_reg_ctrl); 82 96 while (pos-- > 0) 83 97 ioread8(fw_cfg_reg_data); 84 98 ioread8_rep(fw_cfg_reg_data, buf, count); 85 99 mutex_unlock(&fw_cfg_dev_lock); 100 + 101 + acpi_release_global_lock(glk); 86 102 } 87 103 88 104 /* clean up fw_cfg device i/o */ ··· 743 727 744 728 static int __init fw_cfg_sysfs_init(void) 745 729 { 730 + int ret; 731 + 746 732 /* create /sys/firmware/qemu_fw_cfg/ top level directory */ 747 733 fw_cfg_top_ko = kobject_create_and_add("qemu_fw_cfg", firmware_kobj); 748 734 if (!fw_cfg_top_ko) 749 735 return -ENOMEM; 750 736 751 - return platform_driver_register(&fw_cfg_sysfs_driver); 737 + ret = platform_driver_register(&fw_cfg_sysfs_driver); 738 + if (ret) 739 + fw_cfg_kobj_cleanup(fw_cfg_top_ko); 740 + 741 + return ret; 752 742 } 753 743 754 744 static void __exit fw_cfg_sysfs_exit(void)
+8 -3
drivers/virtio/virtio_pci_modern.c
··· 17 17 * 18 18 */ 19 19 20 + #include <linux/delay.h> 20 21 #define VIRTIO_PCI_NO_LEGACY 21 22 #include "virtio_pci_common.h" 22 23 ··· 272 271 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 273 272 /* 0 status means a reset. */ 274 273 vp_iowrite8(0, &vp_dev->common->device_status); 275 - /* Flush out the status write, and flush in device writes, 276 - * including MSI-X interrupts, if any. */ 277 - vp_ioread8(&vp_dev->common->device_status); 274 + /* After writing 0 to device_status, the driver MUST wait for a read of 275 + * device_status to return 0 before reinitializing the device. 276 + * This will flush out the status write, and flush in device writes, 277 + * including MSI-X interrupts, if any. 278 + */ 279 + while (vp_ioread8(&vp_dev->common->device_status)) 280 + msleep(1); 278 281 /* Flush pending VQ/configuration callbacks. */ 279 282 vp_synchronize_vectors(vdev); 280 283 }
+2
include/uapi/linux/virtio_config.h
··· 40 40 #define VIRTIO_CONFIG_S_DRIVER_OK 4 41 41 /* Driver has finished configuring features */ 42 42 #define VIRTIO_CONFIG_S_FEATURES_OK 8 43 + /* Device entered invalid state, driver must reset it */ 44 + #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40 43 45 /* We've given up on this device. */ 44 46 #define VIRTIO_CONFIG_S_FAILED 0x80 45 47