s390-diag.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. The s390 DIAGNOSE call on KVM
  2. =============================
  3. KVM on s390 supports the DIAGNOSE call for making hypercalls, both for
  4. native hypercalls and for selected hypercalls found on other s390
  5. hypervisors.
  6. Note that bits are numbered as by the usual s390 convention (most significant
  7. bit on the left).
  8. General remarks
  9. ---------------
  10. DIAGNOSE calls by the guest cause a mandatory intercept. This implies
  11. all supported DIAGNOSE calls need to be handled by either KVM or its
  12. userspace.
  13. All DIAGNOSE calls supported by KVM use the RS-a format:
  14. --------------------------------------
  15. | '83' | R1 | R3 | B2 | D2 |
  16. --------------------------------------
  17. 0 8 12 16 20 31
  18. The second-operand address (obtained by the base/displacement calculation)
  19. is not used to address data. Instead, bits 48-63 of this address specify
  20. the function code, and bits 0-47 are ignored.
  21. The supported DIAGNOSE function codes vary by the userspace used. For
  22. DIAGNOSE function codes not specific to KVM, please refer to the
  23. documentation for the s390 hypervisors defining them.
  24. DIAGNOSE function code 'X'500' - KVM virtio functions
  25. -----------------------------------------------------
  26. If the function code specifies 0x500, various virtio-related functions
  27. are performed.
  28. General register 1 contains the virtio subfunction code. Supported
  29. virtio subfunctions depend on KVM's userspace. Generally, userspace
  30. provides either s390-virtio (subcodes 0-2) or virtio-ccw (subcode 3).
  31. Upon completion of the DIAGNOSE instruction, general register 2 contains
  32. the function's return code, which is either a return code or a subcode
  33. specific value.
  34. Subcode 0 - s390-virtio notification and early console printk
  35. Handled by userspace.
  36. Subcode 1 - s390-virtio reset
  37. Handled by userspace.
  38. Subcode 2 - s390-virtio set status
  39. Handled by userspace.
  40. Subcode 3 - virtio-ccw notification
  41. Handled by either userspace or KVM (ioeventfd case).
  42. General register 2 contains a subchannel-identification word denoting
  43. the subchannel of the virtio-ccw proxy device to be notified.
  44. General register 3 contains the number of the virtqueue to be notified.
  45. General register 4 contains a 64bit identifier for KVM usage (the
  46. kvm_io_bus cookie). If general register 4 does not contain a valid
  47. identifier, it is ignored.
  48. After completion of the DIAGNOSE call, general register 2 may contain
  49. a 64bit identifier (in the kvm_io_bus cookie case).
  50. See also the virtio standard for a discussion of this hypercall.
  51. DIAGNOSE function code 'X'501 - KVM breakpoint
  52. ----------------------------------------------
  53. If the function code specifies 0x501, breakpoint functions may be performed.
  54. This function code is handled by userspace.
  55. This diagnose function code has no subfunctions and uses no parameters.