All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mostafa Saleh <smostafa@google.com>
To: kvm@vger.kernel.org
Cc: will@kernel.org, julien.thierry.kdev@gmail.com, praan@google.com,
	 eric.auger@redhat.com, alex@shazbot.org,
	Mostafa Saleh <smostafa@google.com>
Subject: [PATCH kvmtool 0/9] vfio: Add support for platform devices
Date: Sat, 24 Oct 2026 16:18:53 +0000	[thread overview]
Message-ID: <20261024161902.2093581-1-smostafa@google.com> (raw)

This patch series extend VFIO support to platform devices by using
VFIO-platform.

One of the main difference is how the guest discover the device, which
is done through the device tree.
kvmtool can only describe:
- regs
- interrupts

However, the guest still needs a compatible string and other per device
bindings.
To avoid having any hardcoded DT nodes in the source code, kvmtool will
accept a dtb argument with each assigned device that will be copied to
the guest node.

Patches
=======
1-4: Fixes, code refactoring and improving interrupt support.
5: DT common function.
6-8: VFIO-platform support.
9: Custom device tree support.

Patch 2 is better viewed with --color-moved

Testing
=======
Tested on Lenovo Mini-x Gen 10 (Snapdragon-X) by assigning 2 devices,
QCE and BAM as follows:

echo 1dfa000.crypto > /sys/bus/platform/drivers/qcrypto/unbind
echo 1dc4000.dma-controller > /sys/bus/platform/drivers/bam-dma-engine/unbind

echo "vfio-platform" > /sys/bus/platform/devices/1dfa000.crypto/driver_override
echo "vfio-platform" > /sys/bus/platform/devices/1dc4000.dma-controller/driver_override

echo 1dc4000.dma-controller > /sys/bus/platform/drivers/vfio-platform/bind
echo 1dfa000.crypto > /sys/bus/platform/drivers/vfio-platform/bind

./lkvm-static run --irqchip gicv3 -k Image -p "nokaslr" -d rootfs.ext2 --force-pci -c 1  --debug --vfio-
platform 1dc4000.dma-controller,purwa-cryptobam.dtb --vfio-platform 1dfa000.crypto,purwa-qce.dtb

There are some fixes on the list that are needed to be able to unbind
the bam device [1]

Mostafa Saleh (9):
  vfio: Fix fd leak in vfio_group_get_for_dev()
  vfio: Factor out wired IRQ setup and teardown
  vfio: Support edge-triggered wired IRQs
  fdt: Allow fdt_irq_fn to generate multiple interrupts
  fdt: Add helper to copy an FDT node
  vfio: Reserve guest address space for VFIO platform
  vfio: Add basic support for vfio-platform
  vfio: platform: Add interrupts support
  vfio: platform: Take the guest node from a device tree template

 Makefile                       |   1 +
 arm64/fdt.c                    |  36 ++--
 arm64/include/kvm/kvm-arch.h   |  10 +-
 builtin-run.c                  |   3 +
 hw/cfi_flash.c                 |   4 +-
 hw/rtc.c                       |   4 +-
 hw/serial.c                    |   3 +-
 include/kvm/fdt.h              |  32 +++-
 include/kvm/vfio.h             |  41 ++++-
 mips/include/kvm/kvm-arch.h    |   2 +
 powerpc/include/kvm/kvm-arch.h |   2 +
 riscv/fdt.c                    |   2 +-
 riscv/include/kvm/kvm-arch.h   |   7 +-
 riscv/irq.c                    |  27 ++-
 vfio/core.c                    | 152 +++++++++++++++-
 vfio/pci.c                     | 111 +-----------
 vfio/platform.c                | 317 +++++++++++++++++++++++++++++++++
 virtio/mmio.c                  |  10 +-
 x86/include/kvm/kvm-arch.h     |   2 +
 19 files changed, 619 insertions(+), 147 deletions(-)
 create mode 100644 vfio/platform.c

-- 
2.56.0.307.g5fe7bd680c-goog


             reply	other threads:[~2026-10-24 16:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 16:18 Mostafa Saleh [this message]
2026-10-24 16:18 ` [PATCH kvmtool 1/9] vfio: Fix fd leak in vfio_group_get_for_dev() Mostafa Saleh
2026-10-24 16:18 ` [PATCH kvmtool 2/9] vfio: Factor out wired IRQ setup and teardown Mostafa Saleh
2026-10-24 16:18 ` [PATCH kvmtool 3/9] vfio: Support edge-triggered wired IRQs Mostafa Saleh
2026-10-24 16:18 ` [PATCH kvmtool 4/9] fdt: Allow fdt_irq_fn to generate multiple interrupts Mostafa Saleh
2026-10-24 16:18 ` [PATCH kvmtool 5/9] fdt: Add helper to copy an FDT node Mostafa Saleh
2026-10-24 16:18 ` [PATCH kvmtool 6/9] vfio: Reserve guest address space for VFIO platform Mostafa Saleh
2026-10-24 16:19 ` [PATCH kvmtool 7/9] vfio: Add basic support for vfio-platform Mostafa Saleh
2026-10-24 16:19 ` [PATCH kvmtool 8/9] vfio: platform: Add interrupts support Mostafa Saleh
2026-10-24 16:19 ` [PATCH kvmtool 9/9] vfio: platform: Take the guest node from a device tree template Mostafa Saleh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261024161902.2093581-1-smostafa@google.com \
    --to=smostafa@google.com \
    --cc=alex@shazbot.org \
    --cc=eric.auger@redhat.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=praan@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.