aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCornelia Huck <cohuck@redhat.com>2018-01-11 11:58:43 -0500
committerCornelia Huck <cohuck@redhat.com>2018-03-01 11:32:14 -0500
commit69cfd92ea4289b16be6e77960f5d0ab2ddc540a7 (patch)
tree1f9fa58e3e342de365ce41cc7d5b60c4e5e78c97
parent5628683cf77bc8dad3336a9b254e55f728f7c70e (diff)
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. Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-rw-r--r--Documentation/s390/vfio-ccw.txt79
1 files changed, 38 insertions, 41 deletions
diff --git a/Documentation/s390/vfio-ccw.txt b/Documentation/s390/vfio-ccw.txt
index 90b3dfead81b..2be11ad864ff 100644
--- a/Documentation/s390/vfio-ccw.txt
+++ b/Documentation/s390/vfio-ccw.txt
@@ -28,7 +28,7 @@ every detail. More information/reference could be found here:
28 https://en.wikipedia.org/wiki/Channel_I/O 28 https://en.wikipedia.org/wiki/Channel_I/O
29- s390 architecture: 29- s390 architecture:
30 s390 Principles of Operation manual (IBM Form. No. SA22-7832) 30 s390 Principles of Operation manual (IBM Form. No. SA22-7832)
31- The existing Qemu code which implements a simple emulated channel 31- The existing QEMU code which implements a simple emulated channel
32 subsystem could also be a good reference. It makes it easier to follow 32 subsystem could also be a good reference. It makes it easier to follow
33 the flow. 33 the flow.
34 qemu/hw/s390x/css.c 34 qemu/hw/s390x/css.c
@@ -39,22 +39,22 @@ For vfio mediated device framework:
39Motivation of vfio-ccw 39Motivation of vfio-ccw
40---------------------- 40----------------------
41 41
42Currently, a guest virtualized via qemu/kvm on s390 only sees 42Typically, a guest virtualized via QEMU/KVM on s390 only sees
43paravirtualized virtio devices via the "Virtio Over Channel I/O 43paravirtualized virtio devices via the "Virtio Over Channel I/O
44(virtio-ccw)" transport. This makes virtio devices discoverable via 44(virtio-ccw)" transport. This makes virtio devices discoverable via
45standard operating system algorithms for handling channel devices. 45standard operating system algorithms for handling channel devices.
46 46
47However this is not enough. On s390 for the majority of devices, which 47However this is not enough. On s390 for the majority of devices, which
48use the standard Channel I/O based mechanism, we also need to provide 48use the standard Channel I/O based mechanism, we also need to provide
49the functionality of passing through them to a Qemu virtual machine. 49the functionality of passing through them to a QEMU virtual machine.
50This includes devices that don't have a virtio counterpart (e.g. tape 50This includes devices that don't have a virtio counterpart (e.g. tape
51drives) or that have specific characteristics which guests want to 51drives) or that have specific characteristics which guests want to
52exploit. 52exploit.
53 53
54For passing a device to a guest, we want to use the same interface as 54For passing a device to a guest, we want to use the same interface as
55everybody else, namely vfio. Thus, we would like to introduce vfio 55everybody else, namely vfio. We implement this vfio support for channel
56support for channel devices. And we would like to name this new vfio 56devices via the vfio mediated device framework and the subchannel device
57device "vfio-ccw". 57driver "vfio_ccw".
58 58
59Access patterns of CCW devices 59Access patterns of CCW devices
60------------------------------ 60------------------------------
@@ -99,7 +99,7 @@ As mentioned above, we realize vfio-ccw with a mdev implementation.
99Channel I/O does not have IOMMU hardware support, so the physical 99Channel I/O does not have IOMMU hardware support, so the physical
100vfio-ccw device does not have an IOMMU level translation or isolation. 100vfio-ccw device does not have an IOMMU level translation or isolation.
101 101
102Sub-channel I/O instructions are all privileged instructions, When 102Subchannel I/O instructions are all privileged instructions. When
103handling the I/O instruction interception, vfio-ccw has the software 103handling the I/O instruction interception, vfio-ccw has the software
104policing and translation how the channel program is programmed before 104policing and translation how the channel program is programmed before
105it gets sent to hardware. 105it gets sent to hardware.
@@ -121,7 +121,7 @@ devices:
121- The vfio_mdev driver for the mediated vfio ccw device. 121- The vfio_mdev driver for the mediated vfio ccw device.
122 This is provided by the mdev framework. It is a vfio device driver for 122 This is provided by the mdev framework. It is a vfio device driver for
123 the mdev that created by vfio_ccw. 123 the mdev that created by vfio_ccw.
124 It realize a group of vfio device driver callbacks, adds itself to a 124 It realizes a group of vfio device driver callbacks, adds itself to a
125 vfio group, and registers itself to the mdev framework as a mdev 125 vfio group, and registers itself to the mdev framework as a mdev
126 driver. 126 driver.
127 It uses a vfio iommu backend that uses the existing map and unmap 127 It uses a vfio iommu backend that uses the existing map and unmap
@@ -178,7 +178,7 @@ vfio-ccw I/O region
178 178
179An I/O region is used to accept channel program request from user 179An I/O region is used to accept channel program request from user
180space and store I/O interrupt result for user space to retrieve. The 180space and store I/O interrupt result for user space to retrieve. The
181defination of the region is: 181definition of the region is:
182 182
183struct ccw_io_region { 183struct ccw_io_region {
184#define ORB_AREA_SIZE 12 184#define ORB_AREA_SIZE 12
@@ -198,30 +198,23 @@ irb_area stores the I/O result.
198 198
199ret_code stores a return code for each access of the region. 199ret_code stores a return code for each access of the region.
200 200
201vfio-ccw patches overview 201vfio-ccw operation details
202------------------------- 202--------------------------
203 203
204For now, our patches are rebased on the latest mdev implementation. 204vfio-ccw follows what vfio-pci did on the s390 platform and uses
205vfio-ccw follows what vfio-pci did on the s390 paltform and uses 205vfio-iommu-type1 as the vfio iommu backend.
206vfio-iommu-type1 as the vfio iommu backend. It's a good start to launch
207the code review for vfio-ccw. Note that the implementation is far from
208complete yet; but we'd like to get feedback for the general
209architecture.
210 206
211* CCW translation APIs 207* CCW translation APIs
212- Description: 208 A group of APIs (start with 'cp_') to do CCW translation. The CCWs
213 These introduce a group of APIs (start with 'cp_') to do CCW 209 passed in by a user space program are organized with their guest
214 translation. The CCWs passed in by a user space program are 210 physical memory addresses. These APIs will copy the CCWs into kernel
215 organized with their guest physical memory addresses. These APIs 211 space, and assemble a runnable kernel channel program by updating the
216 will copy the CCWs into the kernel space, and assemble a runnable 212 guest physical addresses with their corresponding host physical addresses.
217 kernel channel program by updating the guest physical addresses with 213 Note that we have to use IDALs even for direct-access CCWs, as the
218 their corresponding host physical addresses. 214 referenced memory can be located anywhere, including above 2G.
219- Patches:
220 vfio: ccw: introduce channel program interfaces
221 215
222* vfio_ccw device driver 216* vfio_ccw device driver
223- Description: 217 This driver utilizes the CCW translation APIs and introduces
224 The following patches utilizes the CCW translation APIs and introduce
225 vfio_ccw, which is the driver for the I/O subchannel devices you want 218 vfio_ccw, which is the driver for the I/O subchannel devices you want
226 to pass through. 219 to pass through.
227 vfio_ccw implements the following vfio ioctls: 220 vfio_ccw implements the following vfio ioctls:
@@ -236,20 +229,14 @@ architecture.
236 This also provides the SET_IRQ ioctl to setup an event notifier to 229 This also provides the SET_IRQ ioctl to setup an event notifier to
237 notify the user space program the I/O completion in an asynchronous 230 notify the user space program the I/O completion in an asynchronous
238 way. 231 way.
239- Patches: 232
240 vfio: ccw: basic implementation for vfio_ccw driver 233The use of vfio-ccw is not limited to QEMU, while QEMU is definitely a
241 vfio: ccw: introduce ccw_io_region
242 vfio: ccw: realize VFIO_DEVICE_GET_REGION_INFO ioctl
243 vfio: ccw: realize VFIO_DEVICE_RESET ioctl
244 vfio: ccw: realize VFIO_DEVICE_G(S)ET_IRQ_INFO ioctls
245
246The user of vfio-ccw is not limited to Qemu, while Qemu is definitely a
247good example to get understand how these patches work. Here is a little 234good example to get understand how these patches work. Here is a little
248bit more detail how an I/O request triggered by the Qemu guest will be 235bit more detail how an I/O request triggered by the QEMU guest will be
249handled (without error handling). 236handled (without error handling).
250 237
251Explanation: 238Explanation:
252Q1-Q7: Qemu side process. 239Q1-Q7: QEMU side process.
253K1-K5: Kernel side process. 240K1-K5: Kernel side process.
254 241
255Q1. Get I/O region info during initialization. 242Q1. Get I/O region info during initialization.
@@ -263,7 +250,7 @@ Q4. Write the guest channel program and ORB to the I/O region.
263 K2. Translate the guest channel program to a host kernel space 250 K2. Translate the guest channel program to a host kernel space
264 channel program, which becomes runnable for a real device. 251 channel program, which becomes runnable for a real device.
265 K3. With the necessary information contained in the orb passed in 252 K3. With the necessary information contained in the orb passed in
266 by Qemu, issue the ccwchain to the device. 253 by QEMU, issue the ccwchain to the device.
267 K4. Return the ssch CC code. 254 K4. Return the ssch CC code.
268Q5. Return the CC code to the guest. 255Q5. Return the CC code to the guest.
269 256
@@ -271,7 +258,7 @@ Q5. Return the CC code to the guest.
271 258
272 K5. Interrupt handler gets the I/O result and write the result to 259 K5. Interrupt handler gets the I/O result and write the result to
273 the I/O region. 260 the I/O region.
274 K6. Signal Qemu to retrieve the result. 261 K6. Signal QEMU to retrieve the result.
275Q6. Get the signal and event handler reads out the result from the I/O 262Q6. Get the signal and event handler reads out the result from the I/O
276 region. 263 region.
277Q7. Update the irb for the guest. 264Q7. Update the irb for the guest.
@@ -289,10 +276,20 @@ More information for DASD and ECKD could be found here:
289https://en.wikipedia.org/wiki/Direct-access_storage_device 276https://en.wikipedia.org/wiki/Direct-access_storage_device
290https://en.wikipedia.org/wiki/Count_key_data 277https://en.wikipedia.org/wiki/Count_key_data
291 278
292Together with the corresponding work in Qemu, we can bring the passed 279Together with the corresponding work in QEMU, we can bring the passed
293through DASD/ECKD device online in a guest now and use it as a block 280through DASD/ECKD device online in a guest now and use it as a block
294device. 281device.
295 282
283While the current code allows the guest to start channel programs via
284START SUBCHANNEL, support for HALT SUBCHANNEL or CLEAR SUBCHANNEL is
285not yet implemented.
286
287vfio-ccw supports classic (command mode) channel I/O only. Transport
288mode (HPF) is not supported.
289
290QDIO subchannels are currently not supported. Classic devices other than
291DASD/ECKD might work, but have not been tested.
292
296Reference 293Reference
297--------- 294---------
2981. ESA/s390 Principles of Operation manual (IBM Form. No. SA22-7832) 2951. ESA/s390 Principles of Operation manual (IBM Form. No. SA22-7832)