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/vhost fixes from Michael Tsirkin:
"Random fixes and cleanups that accumulated over the time"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
virtio/s390: virtio: constify virtio_config_ops structures
virtio/s390: add missing \n to end of dev_err message
virtio/s390: support READ_STATUS command for virtio-ccw
tools/virtio/ringtest: tweaks for s390
tools/virtio/ringtest: fix run-on-all.sh for offline cpus
virtio_console: fix a crash in config_work_handler
vhost/scsi: silence uninitialized variable warning
vhost: scsi: constify target_core_fabric_ops structures

+45 -7
+1 -1
drivers/char/virtio_console.c
··· 1862 1862 { 1863 1863 struct ports_device *portdev; 1864 1864 1865 - portdev = container_of(work, struct ports_device, control_work); 1865 + portdev = container_of(work, struct ports_device, config_work); 1866 1866 if (!use_multiport(portdev)) { 1867 1867 struct virtio_device *vdev; 1868 1868 struct port *port;
+27 -2
drivers/s390/virtio/virtio_ccw.c
··· 145 145 #define CCW_CMD_WRITE_CONF 0x21 146 146 #define CCW_CMD_WRITE_STATUS 0x31 147 147 #define CCW_CMD_READ_VQ_CONF 0x32 148 + #define CCW_CMD_READ_STATUS 0x72 148 149 #define CCW_CMD_SET_IND_ADAPTER 0x73 149 150 #define CCW_CMD_SET_VIRTIO_REV 0x83 150 151 ··· 161 160 #define VIRTIO_CCW_DOING_SET_CONF_IND 0x04000000 162 161 #define VIRTIO_CCW_DOING_SET_IND_ADAPTER 0x08000000 163 162 #define VIRTIO_CCW_DOING_SET_VIRTIO_REV 0x10000000 163 + #define VIRTIO_CCW_DOING_READ_STATUS 0x20000000 164 164 #define VIRTIO_CCW_INTPARM_MASK 0xffff0000 165 165 166 166 static struct virtio_ccw_device *to_vc_device(struct virtio_device *vdev) ··· 454 452 * This may happen on device detach. 455 453 */ 456 454 if (ret && (ret != -ENODEV)) 457 - dev_warn(&vq->vdev->dev, "Error %d while deleting queue %d", 455 + dev_warn(&vq->vdev->dev, "Error %d while deleting queue %d\n", 458 456 ret, index); 459 457 460 458 vring_del_virtqueue(vq); ··· 894 892 static u8 virtio_ccw_get_status(struct virtio_device *vdev) 895 893 { 896 894 struct virtio_ccw_device *vcdev = to_vc_device(vdev); 895 + u8 old_status = *vcdev->status; 896 + struct ccw1 *ccw; 897 + 898 + if (vcdev->revision < 1) 899 + return *vcdev->status; 900 + 901 + ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); 902 + if (!ccw) 903 + return old_status; 904 + 905 + ccw->cmd_code = CCW_CMD_READ_STATUS; 906 + ccw->flags = 0; 907 + ccw->count = sizeof(*vcdev->status); 908 + ccw->cda = (__u32)(unsigned long)vcdev->status; 909 + ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_STATUS); 910 + /* 911 + * If the channel program failed (should only happen if the device 912 + * was hotunplugged, and then we clean up via the machine check 913 + * handler anyway), vcdev->status was not overwritten and we just 914 + * return the old status, which is fine. 915 + */ 916 + kfree(ccw); 897 917 898 918 return *vcdev->status; 899 919 } ··· 944 920 kfree(ccw); 945 921 } 946 922 947 - static struct virtio_config_ops virtio_ccw_config_ops = { 923 + static const struct virtio_config_ops virtio_ccw_config_ops = { 948 924 .get_features = virtio_ccw_get_features, 949 925 .finalize_features = virtio_ccw_finalize_features, 950 926 .get = virtio_ccw_get_config, ··· 1011 987 case VIRTIO_CCW_DOING_READ_CONFIG: 1012 988 case VIRTIO_CCW_DOING_WRITE_CONFIG: 1013 989 case VIRTIO_CCW_DOING_WRITE_STATUS: 990 + case VIRTIO_CCW_DOING_READ_STATUS: 1014 991 case VIRTIO_CCW_DOING_SET_VQ: 1015 992 case VIRTIO_CCW_DOING_SET_IND: 1016 993 case VIRTIO_CCW_DOING_SET_CONF_IND:
+2 -2
drivers/vhost/scsi.c
··· 843 843 struct iov_iter out_iter, in_iter, prot_iter, data_iter; 844 844 u64 tag; 845 845 u32 exp_data_len, data_direction; 846 - unsigned out, in; 846 + unsigned int out = 0, in = 0; 847 847 int head, ret, prot_bytes; 848 848 size_t req_size, rsp_size = sizeof(struct virtio_scsi_cmd_resp); 849 849 size_t out_size, in_size; ··· 2087 2087 NULL, 2088 2088 }; 2089 2089 2090 - static struct target_core_fabric_ops vhost_scsi_ops = { 2090 + static const struct target_core_fabric_ops vhost_scsi_ops = { 2091 2091 .module = THIS_MODULE, 2092 2092 .name = "vhost", 2093 2093 .get_fabric_name = vhost_scsi_get_fabric_name,
+12
tools/virtio/ringtest/main.h
··· 26 26 #define VMEXIT_CYCLES 500 27 27 #define VMENTRY_CYCLES 500 28 28 29 + #elif defined(__s390x__) 30 + static inline void wait_cycles(unsigned long long cycles) 31 + { 32 + asm volatile("0: brctg %0,0b" : : "d" (cycles)); 33 + } 34 + 35 + /* tweak me */ 36 + #define VMEXIT_CYCLES 200 37 + #define VMENTRY_CYCLES 200 38 + 29 39 #else 30 40 static inline void wait_cycles(unsigned long long cycles) 31 41 { ··· 91 81 /* Is there a portable way to do this? */ 92 82 #if defined(__x86_64__) || defined(__i386__) 93 83 #define cpu_relax() asm ("rep; nop" ::: "memory") 84 + #elif defined(__s390x__) 85 + #define cpu_relax() barrier() 94 86 #else 95 87 #define cpu_relax() assert(0) 96 88 #endif
+3 -2
tools/virtio/ringtest/run-on-all.sh
··· 1 1 #!/bin/sh 2 2 3 + CPUS_ONLINE=$(lscpu --online -p=cpu|grep -v -e '#') 3 4 #use last CPU for host. Why not the first? 4 5 #many devices tend to use cpu0 by default so 5 6 #it tends to be busier 6 - HOST_AFFINITY=$(lscpu -p=cpu | tail -1) 7 + HOST_AFFINITY=$(echo "${CPUS_ONLINE}"|tail -n 1) 7 8 8 9 #run command on all cpus 9 - for cpu in $(seq 0 $HOST_AFFINITY) 10 + for cpu in $CPUS_ONLINE 10 11 do 11 12 #Don't run guest and host on same CPU 12 13 #It actually works ok if using signalling