vfio-ccw: start updating vfio-ccw.txt
Subsystems (3)
cover vfio-ccw: start updating vfio-ccw.txt
Hi,
I started to look at vfio-ccw more closely again last week, and as there will likely be some changes in the near future, I thought I'd send out this doc patch at least (the file certainly can take more updates, and I have some minor-but-not-yet-tested code changes locally).
Also pushed out to my vfio-ccw branch for people to rebase on top.
Cornelia Huck (1):
vfio-ccw: update documentation
Documentation/s390/vfio-ccw.txt | 78 +++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 41 deletions(-)
Signature · 1 line
2.13.6
PATCH 1/1 vfio-ccw: update documentation
The vfio-ccw documentation comes from the cover letter of the original patch submission, which shows in some parts. Give it some love; in particular:
- Remove/rework statements that make sense in a cover letter, but not in regular documentation.
- Fix some typos.
- Describe the current limitations in more detail.
--- Documentation/s390/vfio-ccw.txt | 78 +++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 41 deletions(-)
Documentation/s390/vfio-ccw.txt +37 -41
@@ -28,7 +28,7 @@ every detail. More information/reference could be found here: https://en.wikipedia.org/wiki/Channel_I/O - s390 architecture: s390 Principles of Operation manual (IBM Form. No. SA22-7832) -- The existing Qemu code which implements a simple emulated channel +- The existing QEMU code which implements a simple emulated channel subsystem could also be a good reference. It makes it easier to follow the flow. qemu/hw/s390x/css.c
@@ -39,22 +39,21 @@ For vfio mediated device framework: Motivation of vfio-ccw ---------------------- -Currently, a guest virtualized via qemu/kvm on s390 only sees +Typically, a guest virtualized via qemu/kvm on s390 only sees paravirtualized virtio devices via the "Virtio Over Channel I/O (virtio-ccw)" transport. This makes virtio devices discoverable via standard operating system algorithms for handling channel devices. However this is not enough. On s390 for the majority of devices, which use the standard Channel I/O based mechanism, we also need to provide -the functionality of passing through them to a Qemu virtual machine. +the functionality of passing through them to a QEMU virtual machine. This includes devices that don't have a virtio counterpart (e.g. tape drives) or that have specific characteristics which guests want to exploit. For passing a device to a guest, we want to use the same interface as -everybody else, namely vfio. Thus, we would like to introduce vfio -support for channel devices. And we would like to name this new vfio -device "vfio-ccw". +everybody else, namely vfio. We implement this vfio support for channel +devices via the vfio device "vfio-ccw". Access patterns of CCW devices ------------------------------
@@ -99,7 +98,7 @@ As mentioned above, we realize vfio-ccw with a mdev implementation. Channel I/O does not have IOMMU hardware support, so the physical vfio-ccw device does not have an IOMMU level translation or isolation. -Sub-channel I/O instructions are all privileged instructions, When +Subchannel I/O instructions are all privileged instructions. When handling the I/O instruction interception, vfio-ccw has the software policing and translation how the channel program is programmed before it gets sent to hardware.
@@ -121,7 +120,7 @@ devices: - The vfio_mdev driver for the mediated vfio ccw device. This is provided by the mdev framework. It is a vfio device driver for the mdev that created by vfio_ccw. - It realize a group of vfio device driver callbacks, adds itself to a + It realizes a group of vfio device driver callbacks, adds itself to a vfio group, and registers itself to the mdev framework as a mdev driver. It uses a vfio iommu backend that uses the existing map and unmap
@@ -178,7 +177,7 @@ vfio-ccw I/O region An I/O region is used to accept channel program request from user space and store I/O interrupt result for user space to retrieve. The -defination of the region is: +definition of the region is: struct ccw_io_region { #define ORB_AREA_SIZE 12
@@ -198,30 +197,23 @@ irb_area stores the I/O result. ret_code stores a return code for each access of the region. -vfio-ccw patches overview -------------------------- +vfio-ccw operation details +-------------------------- -For now, our patches are rebased on the latest mdev implementation. -vfio-ccw follows what vfio-pci did on the s390 paltform and uses -vfio-iommu-type1 as the vfio iommu backend. It's a good start to launch -the code review for vfio-ccw. Note that the implementation is far from -complete yet; but we'd like to get feedback for the general -architecture. +vfio-ccw follows what vfio-pci did on the s390 platform and uses +vfio-iommu-type1 as the vfio iommu backend. * CCW translation APIs -- Description: - These introduce a group of APIs (start with 'cp_') to do CCW - translation. The CCWs passed in by a user space program are - organized with their guest physical memory addresses. These APIs - will copy the CCWs into the kernel space, and assemble a runnable - kernel channel program by updating the guest physical addresses with - their corresponding host physical addresses. -- Patches: - vfio: ccw: introduce channel program interfaces + A group of APIs (start with 'cp_') to do CCW translation. The CCWs + passed in by a user space program are organized with their guest + physical memory addresses. These APIs will copy the CCWs into kernel + space, and assemble a runnable kernel channel program by updating the + guest physical addresses with their corresponding host physical addresses. + Note that we have to use IDALs even for direct-access CCWs, as the + referenced memory can be located anywhere, including above 2G. * vfio_ccw device driver -- Description: - The following patches utilizes the CCW translation APIs and introduce + This driver utilizes the CCW translation APIs and introduces vfio_ccw, which is the driver for the I/O subchannel devices you want to pass through. vfio_ccw implements the following vfio ioctls:
@@ -236,20 +228,14 @@ architecture. This also provides the SET_IRQ ioctl to setup an event notifier to notify the user space program the I/O completion in an asynchronous way. -- Patches: - vfio: ccw: basic implementation for vfio_ccw driver - vfio: ccw: introduce ccw_io_region - vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl - vfio: ccw: realize VFIO_DEVICE_RESET ioctl - vfio: ccw: realize VFIO_DEVICE_G(S)ET_IRQ_INFO ioctls - -The user of vfio-ccw is not limited to Qemu, while Qemu is definitely a + +The use of vfio-ccw is not limited to QEMU, while QEMU is definitely a good example to get understand how these patches work. Here is a little -bit more detail how an I/O request triggered by the Qemu guest will be +bit more detail how an I/O request triggered by the QEMU guest will be handled (without error handling). Explanation: -Q1-Q7: Qemu side process. +Q1-Q7: QEMU side process. K1-K5: Kernel side process. Q1. Get I/O region info during initialization.
@@ -263,7 +249,7 @@ Q4. Write the guest channel program and ORB to the I/O region. K2. Translate the guest channel program to a host kernel space channel program, which becomes runnable for a real device. K3. With the necessary information contained in the orb passed in - by Qemu, issue the ccwchain to the device. + by QEMU, issue the ccwchain to the device. K4. Return the ssch CC code. Q5. Return the CC code to the guest.
@@ -271,7 +257,7 @@ Q5. Return the CC code to the guest. K5. Interrupt handler gets the I/O result and write the result to the I/O region. - K6. Signal Qemu to retrieve the result. + K6. Signal QEMU to retrieve the result. Q6. Get the signal and event handler reads out the result from the I/O region. Q7. Update the irb for the guest.
@@ -289,10 +275,20 @@ More information for DASD and ECKD could be found here: https://en.wikipedia.org/wiki/Direct-access_storage_device https://en.wikipedia.org/wiki/Count_key_data -Together with the corresponding work in Qemu, we can bring the passed +Together with the corresponding work in QEMU, we can bring the passed through DASD/ECKD device online in a guest now and use it as a block device. +While the current code allows the guest to start channel programs via +START SUBCHANNEL, support for HALT SUBCHANNEL or CLEAR SUBCHANNEL is +not yet implemented. + +vfio-ccw supports classic (command mode) channel I/O only. Transport +mode (HPF) is not supported. + +QDIO subchannels are currently not supported. Classic devices other than +DASD/ECKD might work, but have not been tested. + Reference --------- 1. ESA/s390 Principles of Operation manual (IBM Form. No. SA22-7832)
Signature · 1 line
2.13.6
Re: [PATCH 1/1] vfio-ccw: update documentation
In reply to a message not in the archiveQuoted 35 lines · On Tue, 16 Jan 2018 14:57:03 +0800 Dong Jia Shi <[email protected]>…
Quoted 8 lines · Cornelia Huck
The vfio-ccw documentation comes from the cover letter of the original patch submission, which shows in some parts. Give it some love; in particular:
- Remove/rework statements that make sense in a cover letter, but not in regular documentation.
- Fix some typos.
- Describe the current limitations in more detail.Nice.
Quoted 23 lines
Signed-off-by Cornelia Huck <[email protected]>--- Documentation/s390/vfio-ccw.txt | 78 +++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 41 deletions(-)Documentation/s390/vfio-ccw.txt +1
-1@@ -28,7 +28,7 @@ every detail. More information/reference could be found here: https://en.wikipedia.org/wiki/Channel_I/O - s390 architecture: s390 Principles of Operation manual (IBM Form. No. SA22-7832) -- The existing Qemu code which implements a simple emulated channel +- The existing QEMU code which implements a simple emulated channel subsystem could also be a good reference. It makes it easier to follow the flow. qemu/hw/s390x/css.c@@ -39,22 +39,21 @@ For vfio mediated device framework: Motivation of vfio-ccw ----------------------
Quoted 3 lines
Documentation/s390/vfio-ccw.txt For vfio mediated device framework: · line 42
Quoted 2 lines
Documentation/s390/vfio-ccw.txt +1
-1-Currently, a guest virtualized via qemu/kvm on s390 only sees +Typically, a guest virtualized via qemu/kvm on s390 only seesNo need to s/qemu/QEMU/ here?
Ah, I looked only for Qemu, not qemu. I'll make that QEMU/KVM.
Quoted 13 lines
Quoted 13 lines
Documentation/s390/vfio-ccw.txt +1
-1paravirtualized virtio devices via the "Virtio Over Channel I/O (virtio-ccw)" transport. This makes virtio devices discoverable via standard operating system algorithms for handling channel devices. However this is not enough. On s390 for the majority of devices, which use the standard Channel I/O based mechanism, we also need to provide -the functionality of passing through them to a Qemu virtual machine. +the functionality of passing through them to a QEMU virtual machine. This includes devices that don't have a virtio counterpart (e.g. tape drives) or that have specific characteristics which guests want to exploit.
Quoted 11 lines
Documentation/s390/vfio-ccw.txt For vfio mediated device framework: · line 56
Quoted 6 lines
Documentation/s390/vfio-ccw.txt +2
-3For passing a device to a guest, we want to use the same interface as -everybody else, namely vfio. Thus, we would like to introduce vfio -support for channel devices. And we would like to name this new vfio -device "vfio-ccw". +everybody else, namely vfio. We implement this vfio support for channel +devices via the vfio device "vfio-ccw".The vfio-ccw device implementation was used in one iteration in the passed. We now implement via the mediated device stuff, and vfio-ccw subchannel device driver. So, how about changing the above line to:
devices via the vfio mediated device framework and the new added subchannel device driver "vfio_ccw".
OK, will change that.
Quoted 2 lines
Otherwise, LGTM.
Thanks for looking!
Re: [PATCH 1/1] vfio-ccw: update documentation
In reply to Cornelia HuckQuoted 10 lines · Cornelia Huck
The vfio-ccw documentation comes from the cover letter of the original patch submission, which shows in some parts. Give it some love; in particular:
- Remove/rework statements that make sense in a cover letter, but not in regular documentation.
- Fix some typos.
- Describe the current limitations in more detail.Signed-off-by Cornelia Huck <[email protected]>
The changes look sane and definitively improve on what we have right now. Acked by me if you like.
When we are at the limitations, the prefetch story seems to be still missing. IMHO it's the most important limitation.
Regards,
Halil
Re: [PATCH 1/1] vfio-ccw: update documentation
Quoted 10 lines · On Tue, 16 Jan 2018 17:17:08 +0100 Halil Pasic <[email protected]> wrote:
Quoted 9 lines · Cornelia Huck
The vfio-ccw documentation comes from the cover letter of the original patch submission, which shows in some parts. Give it some love; in particular:
- Remove/rework statements that make sense in a cover letter, but not in regular documentation.
- Fix some typos.
- Describe the current limitations in more detail.
Quoted 4 lines
Quoted 1 line
Signed-off-by Cornelia Huck <[email protected]>The changes look sane and definitively improve on what we have right now. Acked by me if you like.
Can you please give your explicit A-b on v2?
Quoted 3 lines
When we are at the limitations, the prefetch story seems to be still missing. IMHO it's the most important limitation.
Yeah, that's just a start. I'm happy to take further patches :)