basic channel IO passthrough infrastructure based on vfio
cover basic channel IO passthrough infrastructure based on vfio
The patch series introduce a basic channel I/O passthrough infrastructure based on vfio.
- Focus on supporting dasd-eckd(cu_type/dev_type = 0x3990/0x3390) as the target device.
- Support new qemu parameters in the style of:
"-machine s390-ccw-virtio(,s390-map-css=on|off) ...
-device vfio-ccw,id=xx,hostid=xx(,guestid=xx)".
We want to support real (i.e. not virtual) channel devices even for guests that do not support MCSS-E (where guests may see devices from any channel subsystem image at once). As all virtio-ccw devices are in css 0xfe (and show up in the default css 0 for guests not activating MCSS-E), we need an option to map e.g. passed-through channel devices from their real css (0-3, or 0 for hosts not activating MCSS-E) into the default css, that is what the new machine option s390-map-css is added.
- According to the user-space ccw format, which was introduced by the vfio-ccw patches of the kernel part, assemble the ccw program in qemu. This 'ccw program' would then be transported to the kernel via a dedicated ioctl for further processing(e.g. translation in kernel space), and issuing it to the real device.
Overview of the user-space ccw translation(translate 'guest ccw program' to 'user-space ccw program'):
1. Allocate a 4K memory buffer in user-space to store all of the ccw program information.
* Lower 2k of the buffer are used to store a maximum of 256 ccws. These ccws are copied from 'guest ccw program' and placed one after another.
* Upper 2k of the buffer are used to store a maximum of 256 corresponding cda data sets, each having a length of 8 bytes.
2. For TIC ccw.
* Locate the TIC target ccw inside the ccw area, and calculate its offset.
* Store the offset to ccw.cda.
3. For Direct ccw.
* Find the cda entry with the same index as the ccw.
* Store the user virtual address of the original ccw.cda to the cda entry.
* Store the offset of the cda entry to ccw.cda.
4. For IDAL ccw.
* Find the cda entry with the same index as the ccw.
* Prepare the user-space idaws. Store the virtual address of the idaws to the cda entry.
* Store the offset of the cda entry to ccw.cda.
5. Append a NOOP to the chain end.
6. Expectations for the user-space ccw program I/O result:
CPA of SCSW should be set to the offset of the ccw area of the current ccw.
Xiao Feng Ren (9):
vfio: linux-headers update for vfio-ccw
vfio: No-IOMMU mode support
s390x/css: introduce ccw chain interfaces s390x/css: add s390-map-css machine option s390x/css: realize css_sch_build_schib s390x/css: device and bus support for s390-ccw passthrough vfio/ccw: vfio based ccw passthrough driver s390x/css: introduce and realize ccw-request callback s390x/css: ccws translation infrastructure
default-configs/s390x-softmmu.mak | 1 + hw/s390x/Makefile.objs | 1 + hw/s390x/css.c | 283 ++++++++++++++++++++++-- hw/s390x/css.h | 12 + hw/s390x/s390-ccw-bus.c | 114 ++++++++++ hw/s390x/s390-ccw-bus.h | 30 +++ hw/s390x/s390-ccw.c | 189 ++++++++++++++++ hw/s390x/s390-ccw.h | 41 ++++ hw/s390x/s390-ccwchain.c | 441 +++++++++++++++++++++++++++++++++++++ hw/s390x/s390-ccwchain.h | 28 +++ hw/s390x/s390-virtio-ccw.c | 26 +++ hw/s390x/virtio-ccw.c | 1 + hw/s390x/virtio-ccw.h | 2 - hw/vfio/Makefile.objs | 1 + hw/vfio/ccw.c | 230 +++++++++++++++++++ hw/vfio/common.c | 66 ++++-- include/hw/s390x/s390-virtio-ccw.h | 1 + include/hw/vfio/vfio-common.h | 3 + linux-headers/linux/vfio.h | 32 +++ qemu-options.hx | 6 +- target-s390x/cpu.h | 10 + target-s390x/ioinst.c | 9 + 22 files changed, 1493 insertions(+), 34 deletions(-) create mode 100644 hw/s390x/s390-ccw-bus.c create mode 100644 hw/s390x/s390-ccw-bus.h create mode 100644 hw/s390x/s390-ccw.c create mode 100644 hw/s390x/s390-ccw.h create mode 100644 hw/s390x/s390-ccwchain.c create mode 100644 hw/s390x/s390-ccwchain.h create mode 100644 hw/vfio/ccw.c
Signature · 1 line
2.6.6
RFC PATCH 1/9 vfio: linux-headers update for vfio-ccw
This is a placeholder for a linux-headers update.
--- linux-headers/linux/vfio.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
linux-headers/linux/vfio.h +32 -0
@@ -198,6 +198,7 @@ struct vfio_device_info {#define VFIO_DEVICE_FLAGS_PCI (1 << 1)/* vfio-pci device */ #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2)/* vfio-platform device */ #define VFIO_DEVICE_FLAGS_AMBA (1 << 3)/* vfio-amba device */ +#define VFIO_DEVICE_FLAGS_CCW (1 << 4)/* vfio-ccw device */ __u32 num_regions;/* Max region index + 1 */ __u32 num_irqs;/* Max IRQ index + 1 */ };
@@ -686,6 +687,37 @@ struct vfio_iommu_spapr_tce_remove { };#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) +/** +* VFIO_DEVICE_CCW_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 21) +* +* Hot reset the channel I/O device. All state of the subchannel will be +* cleared. +*/ +#define VFIO_DEVICE_CCW_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 21) + +/** +* VFIO_DEVICE_CCW_CMD_REQUEST - _IOWR(VFIO_TYPE, VFIO_BASE + 22, +* struct vfio_ccw_cmd) +* +* Issue a user-space ccw program for translation and performing channel I/O +* operations. +*/ +struct vfio_ccw_cmd { +__u32 argsz; +__u8 cssid; +__u8 ssid; +__u16 devno; +#define ORB_AREA_SIZE 12 +__u8 orb_area[ORB_AREA_SIZE ]; +#define SCSW_AREA_SIZE 12 +__u8 scsw_area[SCSW_AREA_SIZE ]; +#define IRB_AREA_SIZE 96 +__u8 irb_area[IRB_AREA_SIZE ]; +__u32 ccwchain_nr; +__u64 ccwchain_buf; +} __attribute__((packed)); +#define VFIO_DEVICE_CCW_CMD_REQUEST _IO(VFIO_TYPE, VFIO_BASE + 22) +/* ***************************************************************** */ #endif /* VFIO_H */
Signature · 1 line
2.6.6
RFC PATCH 2/9 vfio: No-IOMMU mode support
In reply to Xiao Feng RenAdd qemu support for the newly introduced VFIO No-IOMMU driver.
We need to add special handling for:
- Group character device is /dev/vfio/noiommu-$GROUP.
- No-IOMMU does not rely on a memory listener.
- No IOMMU will be set for its group, so no need to call vfio_kvm_device_add_group.
--- hw/vfio/common.c | 66 ++++++++++++++++++++++++++++++++++--------- include/hw/vfio/vfio-common.h | 2 ++ 2 files changed, 55 insertions(+), 13 deletions(-)
hw/vfio/common.c +53 -13
@@ -789,6 +789,33 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) container =g_malloc0 (sizeof (*container)); container->space = space; container->fd = fd; + container->noiommu = group->noiommu; + +if (container->noiommu) { + ret =ioctl (group->fd,VFIO_GROUP_SET_CONTAINER , &fd); +if (ret) { +error_report ("vfio: failed to set group container: %m" ); + ret = -errno; + goto free_container_exit; + } + + ret =ioctl (fd,VFIO_CHECK_EXTENSION ,VFIO_NOIOMMU_IOMMU ); +if (!ret) { +error_report ("vfio: No available IOMMU models" ); + ret = -EINVAL ; + goto free_container_exit; + } + + ret =ioctl (fd,VFIO_SET_IOMMU ,VFIO_NOIOMMU_IOMMU ); +if (ret) { +error_report ("vfio: failed to set iommu for container: %m" ); + ret = -errno; + goto free_container_exit; + } + + goto listener_register; + } +if (ioctl (fd,VFIO_CHECK_EXTENSION ,VFIO_TYPE1_IOMMU ) ||ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU)) {bool v2 = !!ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU);
@@ -878,14 +905,16 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) goto free_container_exit; } - container->listener = vfio_memory_listener; - -memory_listener_register (&container->listener, container->space->as); - -if (container->error) { - ret = container->error; -error_report ("vfio: memory listener initialization failed for container" ); - goto listener_release_exit; +listener_register: +if (!container->noiommu) { + container->listener = vfio_memory_listener; +memory_listener_register (&container->listener, container->space->as); +if (container->error) { + ret = container->error; +error_report ("vfio: memory listener initialization failed for " +"container" ); + goto listener_release_exit; + } } container->initialized = true;
@@ -898,7 +927,9 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)return 0 ; listener_release_exit: -vfio_listener_release (container); +if (!container->noiommu) { +vfio_listener_release (container); + } free_container_exit:g_free (container);
@@ -928,7 +959,9 @@ static void vfio_disconnect_container(VFIOGroup *group)VFIOAddressSpace *space = container->space;VFIOGuestIOMMU *giommu, *tmp; -vfio_listener_release (container); +if (!container->noiommu) { +vfio_listener_release (container); + }QLIST_REMOVE (container, next); QLIST_FOREACH_SAFE(giommu, &container->giommu_list, giommu_next, tmp) {
@@ -969,8 +1002,13 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as)snprintf (path,sizeof (path),"/dev/vfio/%d" , groupid); group->fd =qemu_open (path,O_RDWR );if (group->fd <0 ) { -error_report ("vfio: error opening %s: %m" , path); - goto free_group_exit; +snprintf (path,sizeof (path),"/dev/vfio/noiommu-%d" , groupid); + group->fd =qemu_open (path,O_RDWR ); +if (group->fd <0 ) { +error_report ("vfio: error opening %s: %m" , path); + goto free_group_exit; + } + group->noiommu =1 ; }if (ioctl (group->fd,VFIO_GROUP_GET_STATUS , &status)) {
@@ -999,7 +1037,9 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as)QLIST_INSERT_HEAD (&vfio_group_list, group, next); -vfio_kvm_device_add_group (group); +if (!group->noiommu) { +vfio_kvm_device_add_group (group); + }return group;
include/hw/vfio/vfio-common.h +2 -0
@@ -72,6 +72,7 @@ struct VFIOGroup; typedef struct VFIOContainer { VFIOAddressSpace *space; int fd; /* /dev/vfio/vfio, empowered by the attached groups */ + bool noiommu; MemoryListener listener; int error; bool initialized;
@@ -121,6 +122,7 @@ struct VFIODeviceOps { typedef struct VFIOGroup { int fd; int groupid; + bool noiommu; VFIOContainer *container; QLIST_HEAD(, VFIODevice) device_list; QLIST_ENTRY(VFIOGroup) next;
Signature · 1 line
2.6.6
Re: [PATCH RFC 2/9] vfio: No-IOMMU mode support
Quoted 102 lines · On Fri, 29 Apr 2016 14:13:16 +0200 Xiao Feng Ren <[email protected]>…
Add qemu support for the newly introduced VFIO No-IOMMU driver.
We need to add special handling for:
- Group character device is/dev/vfio/noiommu-$GROUP.
- No-IOMMU does not rely on a memory listener.
- No IOMMU will be set for its group, so no need to callvfio_kvm_device_add_group.Signed-off-by Xiao Feng Ren <[email protected]>--- hw/vfio/common.c | 66 ++++++++++++++++++++++++++++++++++--------- include/hw/vfio/vfio-common.h | 2 ++ 2 files changed, 55 insertions(+), 13 deletions(-)hw/vfio/common.c +43
-10@@ -789,6 +789,33 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) container =g_malloc0 (sizeof (*container)); container->space = space; container->fd = fd; + container->noiommu = group->noiommu; + +if (container->noiommu) { + ret =ioctl (group->fd,VFIO_GROUP_SET_CONTAINER , &fd); +if (ret) { +error_report ("vfio: failed to set group container: %m" ); + ret = -errno; + goto free_container_exit; + } + + ret =ioctl (fd,VFIO_CHECK_EXTENSION ,VFIO_NOIOMMU_IOMMU ); +if (!ret) { +error_report ("vfio: No available IOMMU models" ); + ret = -EINVAL ; + goto free_container_exit; + } + + ret =ioctl (fd,VFIO_SET_IOMMU ,VFIO_NOIOMMU_IOMMU ); +if (ret) { +error_report ("vfio: failed to set iommu for container: %m" ); + ret = -errno; + goto free_container_exit; + } + + goto listener_register; + } +if (ioctl (fd,VFIO_CHECK_EXTENSION ,VFIO_TYPE1_IOMMU ) ||ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU)) {bool v2 = !!ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU);@@ -878,14 +905,16 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) goto free_container_exit; } - container->listener = vfio_memory_listener; - -memory_listener_register (&container->listener, container->space->as); - -if (container->error) { - ret = container->error; -error_report ("vfio: memory listener initialization failed for container" ); - goto listener_release_exit; +listener_register: +if (!container->noiommu) { + container->listener = vfio_memory_listener; +memory_listener_register (&container->listener, container->space->as); +if (container->error) { + ret = container->error; +error_report ("vfio: memory listener initialization failed for " +"container" ); + goto listener_release_exit; + } } container->initialized = true;@@ -898,7 +927,9 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)return 0 ; listener_release_exit: -vfio_listener_release (container); +if (!container->noiommu) { +vfio_listener_release (container); + } free_container_exit:g_free (container);@@ -928,7 +959,9 @@ static void vfio_disconnect_container(VFIOGroup *group)VFIOAddressSpace *space = container->space;VFIOGuestIOMMU *giommu, *tmp; -vfio_listener_release (container); +if (!container->noiommu) { +vfio_listener_release (container); + }QLIST_REMOVE (container, next); QLIST_FOREACH_SAFE(giommu, &container->giommu_list, giommu_next, tmp) {@@ -969,8 +1002,13 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as)snprintf (path,sizeof (path),"/dev/vfio/%d" , groupid); group->fd =qemu_open (path,O_RDWR );
hw/vfio/common.c VFIOGroup *vfio_get_group(int groupid, AddressSpace *as) · line 1011
Quoted 10 lines
hw/vfio/common.c +7
-2if (group->fd <0 ) { -error_report ("vfio: error opening %s: %m" , path); - goto free_group_exit; +snprintf (path,sizeof (path),"/dev/vfio/noiommu-%d" , groupid); + group->fd =qemu_open (path,O_RDWR ); +if (group->fd <0 ) { +error_report ("vfio: error opening %s: %m" , path); + goto free_group_exit; + } + group->noiommu =1 ;
No, this just can't happen. There is absolutely no way that falling back to a noiommu interface is the correct thing to do in most situations. It cannot be automatic or I will have vfio-pci users lined up trying to do PCI device assignment with this code.
hw/vfio/common.c VFIOGroup *vfio_get_group(int groupid, AddressSpace *as) · line 1042
Quoted 11 lines
hw/vfio/common.c +3
-1}if (ioctl (group->fd,VFIO_GROUP_GET_STATUS , &status)) {@@ -999,7 +1037,9 @@ VFIOGroup *vfio_get_group(int groupid, AddressSpace *as)QLIST_INSERT_HEAD (&vfio_group_list, group, next); -vfio_kvm_device_add_group (group); +if (!group->noiommu) { +vfio_kvm_device_add_group (group); + }
Why? Notifying KVM of an assigned device doesn't necessarily imply some connection to the IOMMU.
Quoted 23 lines
hw/vfio/common.c +0
-0return group;include/hw/vfio/vfio-common.h +2
-0@@ -72,6 +72,7 @@ struct VFIOGroup; typedef struct VFIOContainer { VFIOAddressSpace *space; int fd; /* /dev/vfio/vfio, empowered by the attached groups */ + bool noiommu; MemoryListener listener; int error; bool initialized;@@ -121,6 +122,7 @@ struct VFIODeviceOps { typedef struct VFIOGroup { int fd; int groupid; + bool noiommu; VFIOContainer *container; QLIST_HEAD(, VFIODevice) device_list; QLIST_ENTRY(VFIOGroup) next;
RFC PATCH 3/9 s390x/css: introduce ccw chain interfaces
In reply to Xiao Feng RenIntroduce CcwChain structures and helper functions that can be used to translate a guest ccw program to a user-space ccw program. The following limitations apply:
1. Support only prefetch enable mode.
2. Support chain for idal(c64) ccws.
3. Detect chain end only by CC and DC flags.
This work prepares a user-space ccw program according to the rules below:
1. Alloc a 4K memory buffer to store all of the ccw program information.
* Lower 2k of the buffer are used to store a maximum of 256 ccws, these ccws are copied from 'guest ccw program' and placed one after another.
* Upper 2k of the buffer are used to store a maximum of 256 corresponding cda data sets, each having a length of 8 bytes.
2. For TIC ccw.
* Locate the TIC target ccw inside the ccw area, and calculate its offset.
* Store the offset to ccw.cda.
3. For Direct ccw.
* Find the cda entry with the same index as the ccw.
* Store the user virtual address of the original ccw.cda to the cda entry.
* Store the offset of the cda entry to ccw.cda.
4. For IDAL ccw.
* Find the cda entry with the same index as the ccw.
* Prepare the user-space idaws. Store the virtual address of the idaws to the cda entry.
* Store the offset of the cda entry to ccw.cda.
5. Append a NOOP to the chain end.
6. Expectations for the user-space ccw program I/O result:
CPA of SCSW should be set to the offset of the ccw area of the current ccw.
--- hw/s390x/Makefile.objs | 1 + hw/s390x/s390-ccwchain.c | 441 +++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-ccwchain.h | 28 +++ 3 files changed, 470 insertions(+) create mode 100644 hw/s390x/s390-ccwchain.c create mode 100644 hw/s390x/s390-ccwchain.h
hw/s390x/Makefile.objs +1 -0
@@ -11,3 +11,4 @@ obj-y += virtio-ccw.o obj-y += s390-pci-bus.o s390-pci-inst.o obj-y += s390-skeys.o obj-$(CONFIG_KVM) += s390-skeys-kvm.o +obj-y += s390-ccwchain.o
hw/s390x/s390-ccwchain.c new file +441 -0
441 lines not on this page · raw message
hw/s390x/s390-ccwchain.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* ccwchain interfaces +* +* Copyright IBM Corp. 2016 +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License (version 2 only) +* as published by the Free Software Foundation. +* +* Author(s): Dong Jia Shi <[email protected]> +* Xiao Feng Ren <[email protected]> +*/ + +#ifndef S390_CCWCHAIN_H +#define S390_CCWCHAIN_H + +typedef struct TransChainData { +hwaddr cpa_gpa; +uint64_t ccwchain_list; +uint64_t ccwchain_buf; +uint32_t ccwchain_nr; +}TransChainData ; + +int ccwchain_translate_to_userspace (TransChainData *chain_data); +void ccwchain_update_scsw (SCSW *scsw,TransChainData *chain_data); +void ccwchain_list_free (TransChainData *chain_data); + +#endif
Signature · 1 line
2.6.6
RFC PATCH 4/9 s390x/css: add s390-map-css machine option
In reply to Xiao Feng RenWe want to support real (i.e. not virtual) channel devices even for guests that do not support MCSS-E (where guests may see devices from any channel subsystem image at once). As all virtio-ccw devices are in css 0xfe (and show up in the default css 0 for guests not activating MCSS-E), we need an option to map e.g. passed-through channel devices from their real css (0-3, or 0 for hosts not activating MCSS-E) into the default css. This will be exploited in a later patch.
--- hw/s390x/s390-virtio-ccw.c | 23 +++++++++++++++++++++++ include/hw/s390x/s390-virtio-ccw.h | 1 + qemu-options.hx | 6 +++++- target-s390x/cpu.h | 10 ++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +23 -0
@@ -237,6 +237,21 @@ static inline void machine_set_dea_key_wrap(Object *obj, bool value, ms->dea_key_wrap = value; } +static inline bool machine_get_map_css (Object *obj,Error **errp) +{ +S390CcwMachineState *ms =S390_CCW_MACHINE (obj); + +return ms->s390_map_css; +} + +static inline void machine_set_map_css (Object *obj,bool value, +Error **errp) +{ +S390CcwMachineState *ms =S390_CCW_MACHINE (obj); + + ms->s390_map_css = value; +} +static inline void s390_machine_initfn (Object *obj) { object_property_add_bool(obj, "aes-key-wrap",
@@ -254,6 +269,14 @@ static inline void s390_machine_initfn(Object *obj)"enable/disable DEA key wrapping using the CPACF wrapping key" , NULL);object_property_set_bool (obj, true,"dea-key-wrap" ,NULL ); + +object_property_add_bool (obj,"s390-map-css" , + machine_get_map_css, + machine_set_map_css,NULL ); +object_property_set_description (obj,"s390-map-css" , +"enable/disable mapping passed-through ccw devices into the " +"virtual css" ,NULL ); +object_property_set_bool (obj, false,"s390-map-css" ,NULL ); }static const TypeInfo ccw_machine_info = {
include/hw/s390x/s390-virtio-ccw.h +1 -0
@@ -28,6 +28,7 @@ typedef struct S390CcwMachineState {/*< public >*/ bool aes_key_wrap;bool dea_key_wrap; +bool s390_map_css; } S390CcwMachineState; typedef struct S390CcwMachineClass {
qemu-options.hx +5 -1
@@ -44,7 +44,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n" " suppress-vmdesc=on|off disables self-describing migration (default=off)\n" " nvdimm=on|off controls NVDIMM support (default=off)\n" - " enforce-config-section=on|off enforce configuration section migration (default=off)\n", + " enforce-config-section=on|off enforce configuration section migration (default=off)\n" + " s390-map-css=on|off controls support for mapping into virtual css (default=off)\n", QEMU_ARCH_ALL) STEXI @item -machine [type=]@var{name}[,prop=@var{value}[,...]]
@@ -85,6 +86,9 @@ controls whether DEA wrapping keys will be created to allow execution of DEA cryptographic functions. The default is on. @item nvdimm=on|off Enables or disables NVDIMM support. The default is off. +@item s390-map-css=on|off +Enables or disables mapping passed-through ccw devices into the virtual css. +The default is off. @end table ETEXI
target-s390x/cpu.h +10 -0
@@ -1279,6 +1279,16 @@ static inline bool vregs_needed(void *opaque) }#endif +static inline bool s390_get_map_css (void ) +{ +if (object_property_get_bool (OBJECT (qdev_get_machine ()),"s390-map-css" , +NULL )) { +return true; + } + +return false; +} +/* machine check interruption code */ /* subclasses */
Signature · 1 line
2.6.6
RFC PATCH 5/9 s390x/css: realize css_sch_build_schib
In reply to Xiao Feng RenThe S390 virtual css support already has a mechanism to build virtual schib and provide virtual subchannels to the guest. However, to pass-through ccw device to a guest, we need to introduce a new mechanism to build its schib according to the real device information. Thus we realize a new css_sch_build_schib function to do this. And to reuse the existing code, we refactor css_add_virtual_chpid to css_add_chpid.
--- hw/s390x/css.c | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- hw/s390x/css.h | 1 + 2 files changed, 151 insertions(+), 3 deletions(-)
hw/s390x/css.c +150 -3
@@ -11,6 +11,7 @@#include "qemu/osdep.h" #include <hw/qdev.h> +#include "qemu/error-report.h" #include "qemu/bitops.h" #include "exec/address-spaces.h" #include "cpu.h"
@@ -1236,7 +1237,8 @@ bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid) (MAX_SCHID + 1) / sizeof(unsigned long)); } -static int css_add_virtual_chpid (uint8_t cssid,uint8_t chpid,uint8_t type) +static int css_add_chpid (uint8_t cssid,uint8_t chpid,uint8_t type, +bool is_virt) {CssImage *css;
@@ -1253,7 +1255,7 @@ static int css_add_virtual_chpid(uint8_t cssid, uint8_t chpid, uint8_t type) } css->chpids[chpid].in_use =1 ; css->chpids[chpid].type = type; - css->chpids[chpid].is_virtual =1 ; + css->chpids[chpid].is_virtual = is_virt;css_generate_chp_crws (cssid, chpid);
@@ -1277,7 +1279,7 @@ void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type) p->pam =0x80 ; p->chpid[0 ] = chpid;if (!css->chpids[chpid].in_use) { -css_add_virtual_chpid (sch->cssid, chpid, type); +css_add_chpid (sch->cssid, chpid, type, true); }memset (s,0 ,sizeof (SCSW ));
@@ -1644,3 +1646,148 @@ void css_reset(void) channel_subsys.max_cssid =0 ; channel_subsys.max_ssid =0 ; } + +static int css_sch_get_chpids (SubchDev *sch,const char *hschid,uint32_t cssid) +{ +char *fid_path; +FILE *fd; +uint32_t chpid[8 ]; +int i; +PMCW *p = &sch->curr_status.pmcw; + + fid_path =g_strdup_printf ("/sys/devices/css%x/%s/chpids" , + cssid, hschid); + fd =fopen (fid_path,"r" ); +if (fd ==NULL ) { +error_report ("%s: open %s failed" , __func__, fid_path); +g_free (fid_path); +return -EINVAL ; + } + +if (fscanf (fd,"%x %x %x %x %x %x %x %x" , + &chpid[0 ], &chpid[1 ], &chpid[2 ], &chpid[3 ], + &chpid[4 ], &chpid[5 ], &chpid[6 ], &chpid[7 ]) !=8 ) { +fclose (fd); +g_free (fid_path); +return -EINVAL ; + } + +for (i =0 ; i <ARRAY_SIZE (p->chpid); i++) { + p->chpid[i] = chpid[i]; + } + +fclose (fd); +g_free (fid_path); + +return 0 ; +} + +static int css_sch_get_path_masks (SubchDev *sch,const char *hschid, +uint32_t cssid) +{ +char *fid_path; +FILE *fd; +uint32_t pim, pam, pom; +PMCW *p = &sch->curr_status.pmcw; + + fid_path =g_strdup_printf ("/sys/devices/css%x/%s/pimpampom" , + cssid, hschid); + fd =fopen (fid_path,"r" ); +if (fd ==NULL ) { +error_report ("%s: open %s failed" , __func__, fid_path); +g_free (fid_path); +return -EINVAL ; + } + +if (fscanf (fd,"%x %x %x" , &pim, &pam, &pom) !=3 ) { +fclose (fd); +g_free (fid_path); +return -EINVAL ; + } + + p->pim = pim; + p->pam = pam; + p->pom = pom; +fclose (fd); +g_free (fid_path); + +return 0 ; +} + +static int css_sch_get_chpid_type (uint8_t chpid,uint32_t *type,uint32_t cssid) +{ +char *fid_path; +FILE *fd; + + fid_path =g_strdup_printf ("/sys/devices/css%x/chp0.%02x/type" , + cssid, chpid); + fd =fopen (fid_path,"r" ); +if (fd ==NULL ) { +error_report ("%s: open %s failed" , __func__, fid_path); +g_free (fid_path); +return -EINVAL ; + } + +if (fscanf (fd,"%x" , type) !=1 ) { +fclose (fd); +g_free (fid_path); +return -EINVAL ; + } + +fclose (fd); +g_free (fid_path); + +return 0 ; +} + +int css_sch_build_schib (SubchDev *sch,const char *hschid) +{ +PMCW *p = &sch->curr_status.pmcw; +SCSW *s = &sch->curr_status.scsw; +int i, ret; +uint32_t type, cssid; +CssImage *css = channel_subsys.css[sch->cssid]; + +/* We are dealing with I/O subchannels only. */ +assert (css !=NULL ); +memset (p,0 ,sizeof (PMCW )); + p->flags |=PMCW_FLAGS_MASK_DNV ; + p->devno = sch->devno; + + ret =sscanf (hschid,"%1x" , &cssid); +if (ret !=1 ) { +error_report ("%s: Get cssid from host schid %s failed" , + __func__, hschid); + } + +/* Grab path mask from sysfs. */ + ret =css_sch_get_path_masks (sch, hschid, cssid); +if (ret) { +return ret; + } + +/* Grab chpids from sysfs. */ + ret =css_sch_get_chpids (sch, hschid, cssid); +if (ret) { +return ret; + } + +/* Build chpid type. */ +for (i =0 ; i <ARRAY_SIZE (p->chpid); i++) { +if (p->chpid[i] && !css->chpids[p->chpid[i]].in_use) { + ret =css_sch_get_chpid_type (p->chpid[i], &type, cssid); +if (ret) { +return ret; + } +css_add_chpid (sch->cssid, p->chpid[i], type, false); + } + } + +memset (s,0 ,sizeof (SCSW )); + sch->curr_status.mba =0 ; +for (i =0 ; i <ARRAY_SIZE (sch->curr_status.mda); i++) { + sch->curr_status.mda[i] =0 ; + } + +return 0 ; +}
hw/s390x/css.h +1 -0
@@ -119,6 +119,7 @@ void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);void css_generate_css_crws (uint8_t cssid);void css_clear_sei_pending (void );void css_adapter_interrupt (uint8_t isc); +int css_sch_build_schib (SubchDev *sch,const char *hschid);#define CSS_IO_ADAPTER_VIRTIO 1 int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap,
Signature · 1 line
2.6.6
RFC PATCH 6/9 s390x/css: device and bus support for s390-ccw passthrough
In reply to Xiao Feng RenIn order to support ccw device pass-through, we introduce a s390 ccw device called "s390-ccw" to hold the real device info. As the existing virtual-css-bridge and virtual-css-bus are designed to support virtio_ccw devices for S390x virtio machine. We want to put passthroughed devices on a different bus, so we implement a css bridge called "s390-ccw-bridge", and a css bus called "s390-ccw-bus", which is the groundwork of the passed-through vfio_ccw devices.
--- hw/s390x/Makefile.objs | 2 +- hw/s390x/css.h | 3 + hw/s390x/s390-ccw-bus.c | 114 +++++++++++++++++++++++++++++ hw/s390x/s390-ccw-bus.h | 30 ++++++++ hw/s390x/s390-ccw.c | 177 +++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-ccw.h | 40 ++++++++++ hw/s390x/s390-virtio-ccw.c | 3 + hw/s390x/virtio-ccw.h | 2 - 8 files changed, 368 insertions(+), 3 deletions(-) create mode 100644 hw/s390x/s390-ccw-bus.c create mode 100644 hw/s390x/s390-ccw-bus.h create mode 100644 hw/s390x/s390-ccw.c create mode 100644 hw/s390x/s390-ccw.h
hw/s390x/Makefile.objs +1 -1
@@ -11,4 +11,4 @@ obj-y += virtio-ccw.o obj-y += s390-pci-bus.o s390-pci-inst.o obj-y += s390-skeys.o obj-$(CONFIG_KVM) += s390-skeys-kvm.o -obj-y += s390-ccwchain.o +obj-y += s390-ccwchain.o s390-ccw-bus.o s390-ccw.o
hw/s390x/css.h +3 -0
@@ -15,6 +15,7 @@#include "hw/s390x/adapter.h" #include "hw/s390x/s390_flic.h" #include "ioinst.h" +#include "hw/hw.h" /* Channel subsystem constants. */ #define MAX_SCHID 65535
@@ -24,6 +25,8 @@#define MAX_CIWS 62 +#define VIRTUAL_CSSID 0xfe + typedef struct CIW { uint8_t type; uint8_t command;
hw/s390x/s390-ccw-bus.c new file +114 -0
114 lines not on this page · raw message
hw/s390x/s390-ccw-bus.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* s390 CCW Bus and Bridge definitions +* +* Copyright 2016 IBM Corp. +* Author(s): Dong Jia Shi <[email protected]> +* Xiao Feng Ren <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or (at +* your option) any later version. See the COPYING file in the top-level +* directory. +*/ + +#ifndef HW_S390_CCW_BUS_H +#define HW_S390_CCW_BUS_H + +/* s390 CCW Bus Type. */ +typedef struct S390CCWBus { +BusState parent_obj; +bool map_vir_css; +}S390CCWBus ; + +#define TYPE_S390_CCW_BUS "s390-ccw-bus" +#define S390_CCW_BUS (obj) \ + OBJECT_CHECK(S390CCWBus, (obj), TYPE_S390_CCW_BUS) + +/* s390 CCW Bridge Type. */ +#define TYPE_S390_CCW_BRIDGE "s390-ccw-bridge" + +S390CCWBus *s390_ccw_bus_init (void ); +#endif
hw/s390x/s390-ccw.c new file +177 -0
177 lines not on this page · raw message
hw/s390x/s390-ccw.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* s390 CCW Assignment Support +* +* Copyright 2016 IBM Corp. +* Author(s): Dong Jia Shi <[email protected]> +* Xiao Feng Ren <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or (at +* your option) any later version. See the COPYING file in the top-level +* directory. +*/ + +#ifndef HW_S390_CCW_H +#define HW_S390_CCW_H + +#define TYPE_S390_CCW "s390-ccw" +#define S390_CCW_DEVICE (obj) \ + OBJECT_CHECK(S390CCWDevice, (obj), TYPE_S390_CCW) +#define S390_CCW_DEVICE_CLASS (klass) \ + OBJECT_CLASS_CHECK(S390CCWDeviceClass, (klass), TYPE_S390_CCW) +#define S390_CCW_DEVICE_GET_CLASS (obj) \ + OBJECT_GET_CLASS(S390CCWDeviceClass, (obj), TYPE_S390_CCW) + +typedef struct S390CCWDevice { +DeviceState parent; +SubchDev *sch; +char *hostid; +char *guestid; +unsigned int hcssid; +unsigned int hssid; +unsigned int hdevno; +}S390CCWDevice ; + +typedef struct S390CCWDeviceClass { +DeviceClass parent_class; +void (*realize)(S390CCWDevice *dev,Error **errp); +void (*unrealize)(S390CCWDevice *dev,Error **errp); +}S390CCWDeviceClass ; + +#endif
hw/s390x/s390-virtio-ccw.c +3 -0
@@ -23,6 +23,7 @@#include "virtio-ccw.h" #include "qemu/config-file.h" #include "s390-pci-bus.h" +#include "s390-ccw-bus.h" #include "hw/s390x/storage-keys.h" #include "hw/compat.h" #include "hw/s390x/s390-virtio-ccw.h"
@@ -117,6 +118,8 @@ static void ccw_init(MachineState *machine) machine->initrd_filename, "s390-ccw.img", true);s390_flic_init (); +s390_ccw_bus_init (); + dev =qdev_create (NULL ,TYPE_S390_PCI_HOST_BRIDGE );object_property_add_child (qdev_get_machine (),TYPE_S390_PCI_HOST_BRIDGE ,OBJECT (dev),NULL );
hw/s390x/virtio-ccw.h +0 -2
@@ -26,8 +26,6 @@#include "css.h" -#define VIRTUAL_CSSID 0xfe -#define VIRTIO_CCW_CU_TYPE 0x3832#define VIRTIO_CCW_CHPID_TYPE 0x32
Signature · 1 line
2.6.6
RFC PATCH 7/9 vfio/ccw: vfio based ccw passthrough driver
In reply to Xiao Feng RenWe use the No-IOMMU mode of VFIO to realize the ccw device passthrough, implement a vfio based ccw passthrough driver called "vfio-ccw".
Support qemu parameters in the style of:
"-device vfio-ccw,id=xx,hostid=xx(,guestid=xx)"
--- default-configs/s390x-softmmu.mak | 1 + hw/vfio/Makefile.objs | 1 + hw/vfio/ccw.c | 188 ++++++++++++++++++++++++++++++++++++++ include/hw/vfio/vfio-common.h | 1 + 4 files changed, 191 insertions(+) create mode 100644 hw/vfio/ccw.c
default-configs/s390x-softmmu.mak +1 -0
@@ -4,4 +4,5 @@ CONFIG_VIRTIO=y CONFIG_SCLPCONSOLE=y CONFIG_S390_FLIC=y CONFIG_S390_FLIC_KVM=$(CONFIG_KVM) +CONFIG_VFIO_CCW=$(CONFIG_LINUX) CONFIG_WDT_DIAG288=y
hw/vfio/Makefile.objs +1 -0
@@ -1,6 +1,7 @@ ifeq ($(CONFIG_LINUX), y) obj-$(CONFIG_SOFTMMU) += common.o obj-$(CONFIG_PCI) += pci.o pci-quirks.o +obj-$(CONFIG_VFIO_CCW) += ccw.o obj-$(CONFIG_SOFTMMU) += platform.o obj-$(CONFIG_SOFTMMU) += calxeda-xgmac.o obj-$(CONFIG_SOFTMMU) += amd-xgbe.o
hw/vfio/ccw.c new file +188 -0
188 lines not on this page · raw message
include/hw/vfio/vfio-common.h +1 -0
@@ -41,6 +41,7 @@enum {VFIO_DEVICE_TYPE_PCI =0 ,VFIO_DEVICE_TYPE_PLATFORM =1 , +VFIO_DEVICE_TYPE_CCW =2 , }; typedef struct VFIOMmap {
Signature · 1 line
2.6.6
RFC PATCH 8/9 s390x/css: introduce and realize ccw-request callback
In reply to Xiao Feng RenIntroduce a new callback on ccw device to handle ccw-request. Realize the callback in vfio-ccw device.
--- hw/s390x/s390-ccw.h | 1 + hw/vfio/ccw.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+)
hw/s390x/s390-ccw.h +1 -0
@@ -29,6 +29,7 @@ typedef struct S390CCWDevice {unsigned int hcssid;unsigned int hssid;unsigned int hdevno; +int (*handle_request) (ORB *,IRB *,SCSW *,void *); } S390CCWDevice; typedef struct S390CCWDeviceClass {
hw/vfio/ccw.c +42 -0
60 lines not on this page · raw message
Signature · 1 line
2.6.6
RFC PATCH 9/9 s390x/css: ccws translation infrastructure
In reply to Xiao Feng RenImplement a basic infrastructure of handling channel I/O instruction interception for passed through devices:
1. Branch the code path of instruction interception handling by SubChannel type.
2. For a passed through device, issue the ORB to do ccw translation and perform an I/O operation.
3. Inject an I/O interrupt to notify guest the I/O result.
4. Assign different condition code based on the I/O result, or trigger a program check.
--- hw/s390x/css.c | 130 ++++++++++++++++++++++++++++++++++++++++++++------ hw/s390x/css.h | 8 ++++ hw/s390x/s390-ccw.c | 12 +++++ hw/s390x/virtio-ccw.c | 1 + target-s390x/ioinst.c | 9 ++++ 5 files changed, 145 insertions(+), 15 deletions(-)
hw/s390x/css.c +115 -15
@@ -463,7 +463,7 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,return ret; } -static void sch_handle_start_func (SubchDev *sch,ORB *orb) +static void sch_handle_start_func_virtual (SubchDev *sch,ORB *orb) {PMCW *p = &sch->curr_status.pmcw;
@@ -558,13 +558,79 @@ static void sch_handle_start_func(SubchDev *sch, ORB *orb) } +static void copy_scsw_to_guest (SCSW *dest,const SCSW *src) +{ + dest->flags =cpu_to_be16 (src->flags); + dest->ctrl =cpu_to_be16 (src->ctrl); + dest->cpa =cpu_to_be32 (src->cpa); + dest->dstat = src->dstat; + dest->cstat = src->cstat; + dest->count =cpu_to_be16 (src->count); +} + +static int sch_handle_start_func_passthrough (SubchDev *sch,ORB *orb) +{ + +PMCW *p = &sch->curr_status.pmcw; +SCSW *s = &sch->curr_status.scsw; +int ret; + +if (!(s->ctrl &SCSW_ACTL_SUSP )) { +assert (orb !=NULL ); + p->intparm = orb->intparm; + } + +/* Prepare the irb for the guest. */ +memset (&sch->irb,0 ,sizeof (IRB )); + +/* +* TODO: +* Only support prefetch enable mode. +* Only support 64bit addressing idal. +*/ +if (!(orb->ctrl0 &ORB_CTRL0_MASK_PFCH ) || + !(orb->ctrl0 &ORB_CTRL0_MASK_C64 )) { +return -EINVAL ; + } + + ret =s390_ccw_cmd_request (orb, &sch->irb, s, sch->driver_data); +switch (ret) { +case 0 : +/* Update control block via irb. */ +copy_scsw_to_guest (s, &sch->irb.scsw); +break ; +case -EBUSY : +break ; +case -ENODEV : +break ; +case -EACCES : +/* Let's reflect an inaccessible host device by cc 3. */ + ret = -ENODEV ; +break ; +case -ENOMEM : +/* No memory, generate deferred cc 1. */ + s->flags &= ~SCSW_FLAGS_MASK_CC ; + s->flags |= (1 <<8 ); + s->ctrl &= ~SCSW_CTRL_MASK_STCTL ; + s->ctrl |=SCSW_STCTL_ALERT |SCSW_STCTL_STATUS_PEND ; +break ; +default : +/* All other return codes will trigger a program check, +* or set cc to 1. +*/ +break ; + }; + +return ret; +} +/* * On real machines, this would run asynchronously to the main vcpus. * We might want to make some parts of the ssch handling (interpreting * read/writes) asynchronous later on if we start supporting more than * our current very simple devices. */ -static void do_subchannel_work (SubchDev *sch,ORB *orb) +static void do_subchannel_work_virtual (SubchDev *sch,ORB *orb) {SCSW *s = &sch->curr_status.scsw;
@@ -574,7 +640,7 @@ static void do_subchannel_work(SubchDev *sch, ORB *orb) }else if (s->ctrl &SCSW_FCTL_HALT_FUNC ) {sch_handle_halt_func (sch); }else if (s->ctrl &SCSW_FCTL_START_FUNC ) { -sch_handle_start_func (sch, orb); +sch_handle_start_func_virtual (sch, orb); }else {/* Cannot happen. */ return ;
@@ -582,6 +648,51 @@ static void do_subchannel_work(SubchDev *sch, ORB *orb)css_inject_io_interrupt (sch); } +static int do_subchannel_work_passthrough (SubchDev *sch,ORB *orb) +{ +int ret; +SCSW *s = &sch->curr_status.scsw; + +if (s->ctrl &SCSW_FCTL_CLEAR_FUNC ) { +/* TODO: Clear handling */ +sch_handle_clear_func (sch); + ret =0 ; + }else if (s->ctrl &SCSW_FCTL_HALT_FUNC ) { +/* TODO: Halt handling */ +sch_handle_halt_func (sch); + ret =0 ; + }else if (s->ctrl &SCSW_FCTL_START_FUNC ) { + ret =sch_handle_start_func_passthrough (sch, orb); + }else { +/* Cannot happen. */ +return -ENODEV ; + } + +css_inject_io_interrupt (sch); + +return ret; +} + +static int do_subchannel_work (SubchDev *sch,ORB *orb) +{ +int ret; + +switch (sch->type) { +case SUBCH_TYPE_VIRTUAL : +do_subchannel_work_virtual (sch, orb); + ret =0 ; +break ; +case SUBCH_TYPE_PASSTHROUGH : + ret =do_subchannel_work_passthrough (sch, orb); +break ; +default : +assert (false); + ret = -EINVAL ; + }; + +return ret; +} +static void copy_pmcw_to_guest (PMCW *dest,const PMCW *src) {int i;
@@ -602,16 +713,6 @@ static void copy_pmcw_to_guest(PMCW *dest, const PMCW *src) dest->chars =cpu_to_be32 (src->chars); } -static void copy_scsw_to_guest (SCSW *dest,const SCSW *src) -{ - dest->flags =cpu_to_be16 (src->flags); - dest->ctrl =cpu_to_be16 (src->ctrl); - dest->cpa =cpu_to_be32 (src->cpa); - dest->dstat = src->dstat; - dest->cstat = src->cstat; - dest->count =cpu_to_be16 (src->count); -} -static void copy_schib_to_guest (SCHIB *dest,const SCHIB *src) {int i;
@@ -898,8 +999,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb) s->ctrl |= (SCSW_FCTL_START_FUNC |SCSW_ACTL_START_PEND ); s->flags &= ~SCSW_FLAGS_MASK_PNO ; -do_subchannel_work (sch, orb); - ret =0 ; + ret =do_subchannel_work (sch, orb); out:return ret;
hw/s390x/css.h +8 -0
@@ -76,6 +76,8 @@ struct SubchDev {uint8_t ssid;uint16_t schid;uint16_t devno; +uint8_t type; +IRB irb;SCHIB curr_status;uint8_t sense_data[32 ];hwaddr channel_prog;
@@ -99,6 +101,11 @@ typedef struct IndAddr {QTAILQ_ENTRY (IndAddr) sibling; } IndAddr; +enum { +SUBCH_TYPE_VIRTUAL =0 , +SUBCH_TYPE_PASSTHROUGH =1 , +}; +IndAddr *get_indicator (hwaddr ind_addr,int len);void release_indicator (AdapterInfo *adapter,IndAddr *indicator);int map_indicator (AdapterInfo *adapter,IndAddr *indicator);
@@ -123,6 +130,7 @@ void css_generate_css_crws(uint8_t cssid);void css_clear_sei_pending (void );void css_adapter_interrupt (uint8_t isc);int css_sch_build_schib (SubchDev *sch,const char *hschid); +int s390_ccw_cmd_request (ORB *orb,IRB *irb,SCSW *scsw,void *data);#define CSS_IO_ADAPTER_VIRTIO 1 int css_register_io_adapter(uint8_t type, uint8_t isc, bool swap,
hw/s390x/s390-ccw.c +12 -0
@@ -18,6 +18,17 @@#include "s390-ccw-bus.h" #include "s390-ccw.h" +int s390_ccw_cmd_request (ORB *orb,IRB *irb,SCSW *scsw,void *data) +{ +S390CCWDevice *cdev = data; + +if (cdev->handle_request) { +return cdev->handle_request (orb, irb, scsw, data); + }else { +return -ENOSYS ; + } +} +static void s390_ccw_realize (S390CCWDevice *cdev,Error **errp) {unsigned int cssid, ssid, devno, schid;
@@ -89,6 +100,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, Error **errp) sch->cssid = cssid; sch->ssid = ssid; sch->devno = devno; + sch->type =SUBCH_TYPE_PASSTHROUGH ; cdev->sch =NULL ;
hw/s390x/virtio-ccw.c +1 -0
@@ -758,6 +758,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->channel_prog =0x0 ; sch->last_cmd_valid = false; sch->thinint_active = false; + sch->type =SUBCH_TYPE_VIRTUAL ;/* * Use a device number if provided. Otherwise, fall back to subchannel * number.
target-s390x/ioinst.c +9 -0
@@ -244,6 +244,15 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb)case -EBUSY : cc =2 ;break ; +case -EFAULT : +/* +* TODO: +* I'm wondering whether there is something better +* to do for us here (like setting some device or +* subchannel status). +*/ +program_interrupt (env,PGM_ADDRESSING ,4 ); +return ;case 0 : cc =0 ;break ;
Signature · 1 line
2.6.6