Skip to content

RFC Introduce MMIO/PIO dispatch file descriptors (ioregionfd)

Elena Afanasova kvm 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest5 patches 24 repliesIn review
  2. v2 RFC4 patches 23 repliesSuperseded
  3. v1 RFC2 patches 25 repliesSuperseded

Changes in v3 from the cover letter

- add FAST_MMIO bus support
- add KVM_IOREGION_DEASSIGN flag
- rename kvm_ioregion read/write file descriptors
- split ioregionfd signal handling support into two patches
- move ioregion_interrupted flag to ioregion_ctx
- reorder ioregion_ctx fields
- rework complete_ioregion operations
- add signal handling support for crossing a page boundary case
- change wire protocol license
- fix ioregionfd state machine
- remove ioregionfd_cmd info and drop appropriate macros
- add comment on ioregionfd cmds/replies serialization
- drop kvm_io_bus_finish/prepare()

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: add initial support for KVM_SET_IOREGIONarch/x86/kvm/Kconfig arch/x86/kvm/Makefile arch/x86/kvm/x86.c +8 more+379 -04 replies
2/5KVM: x86: add support for ioregionfd signal handlingarch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c include/linux/kvm_host.h +1 more+317 -214 replies
3/5KVM: implement wire protocolinclude/uapi/linux/ioregion.h virt/kvm/ioregion.c+190 -25 replies
4/5KVM: add ioregionfd contextvirt/kvm/ioregion.c+135 -298 replies
5/5KVM: enforce NR_IOBUS_DEVS limit if kmemcg is disabledvirt/kvm/kvm_main.c+6 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [RFC v3 0/5] Introduce MMIO/PIO dispatch file descriptors (ioregionfd)

This patchset introduces a KVM dispatch mechanism which can be used for handling MMIO/PIO accesses over file descriptors without returning from ioctl(KVM_RUN). This allows device emulation to run in another task separate from the vCPU task.

This is achieved through KVM vm ioctl for registering MMIO/PIO regions and a wire protocol that KVM uses to communicate with a task handling an MMIO/PIO access.

TODOs:
* Implement KVM_EXIT_IOREGIONFD_FAILURE
* Add non-x86 arch support
* Add kvm-unittests
* Flush waiters if ioregion is deleted

v3:
- add FAST_MMIO bus support
- add KVM_IOREGION_DEASSIGN flag
- rename kvm_ioregion read/write file descriptors
- split ioregionfd signal handling support into two patches
- move ioregion_interrupted flag to ioregion_ctx
- reorder ioregion_ctx fields
- rework complete_ioregion operations
- add signal handling support for crossing a page boundary case
- change wire protocol license
- fix ioregionfd state machine
- remove ioregionfd_cmd info and drop appropriate macros
- add comment on ioregionfd cmds/replies serialization
- drop kvm_io_bus_finish/prepare()

Elena Afanasova (5):
KVM: add initial support for KVM_SET_IOREGION
KVM: x86: add support for ioregionfd signal handling
KVM: implement wire protocol
KVM: add ioregionfd context
KVM: enforce NR_IOBUS_DEVS limit if kmemcg is disabled

 arch/x86/kvm/Kconfig          |   1 +
 arch/x86/kvm/Makefile         |   1 +
 arch/x86/kvm/vmx/vmx.c        |  40 ++-
 arch/x86/kvm/x86.c            | 273 +++++++++++++++++-
 include/linux/kvm_host.h      |  28 ++
 include/uapi/linux/ioregion.h |  30 ++
 include/uapi/linux/kvm.h      |  25 ++
 virt/kvm/Kconfig              |   3 +
 virt/kvm/eventfd.c            |  25 ++
 virt/kvm/eventfd.h            |  14 +
 virt/kvm/ioregion.c           | 529 ++++++++++++++++++++++++++++++++++
 virt/kvm/ioregion.h           |  15 +
 virt/kvm/kvm_main.c           |  36 ++-
 13 files changed, 996 insertions(+), 24 deletions(-)
 create mode 100644 include/uapi/linux/ioregion.h
 create mode 100644 virt/kvm/eventfd.h
 create mode 100644 virt/kvm/ioregion.c
 create mode 100644 virt/kvm/ioregion.h
Signature · 1 line
2.25.1