Re: [RFC PATCH 0/5] qemu: Route hostdevs to multiple nested SMMUs

2025-01-30 Thread Nathan Chen via Devel
Hi Daniel, Top level libvirt device representation in XML is based on the device *class*, not the specific device impl. Adding a device type XML element in libvirt is totally inappropriate. Any configuration must be done beneath the element. Would keeping track of PXB <=> host SMMU nodes b

Re: [RFC PATCH 3/5] qemu: Create PXBs and auto-assign VFIO devs and nested SMMUs

2025-01-30 Thread Nathan Chen via Devel
Add a pcie-expander-bus controller to the VM definition for each "nestedSmmuv3" device that is generated when the "nestedSmmuv3" IOMMU model is parsed from the VM definition. Assign each "nestedSmmuv3" device to one PXB controller, and route any unmanaged "hostdev" VFIO devices with associated

[RFC PATCH 2/5] qemu: Implement and auto-add a nestedSmmuv3 device type

2024-12-11 Thread Nathan Chen via Devel
Add support for parsing "nestedSmmuv3" devices from the VM definition. When a "nestedSmmuv3" IOMMU model is parsed from the VM definition, add a "nestedSmmuv3" device to the VM definition for each host SMMU node detected from sysfs. Specify the associated host SMMU sysfs filename as the "name" attr

[RFC PATCH 5/5] qemu: Add test case for specifying multiple nested SMMUs

2024-12-11 Thread Nathan Chen via Devel
Implement a sub-test in qemuxmlconftest that mocks the scanning of sysfs to determine how many "nestedSmmuv3" devices to assign to the VM when "nestedSmmuv3" IOMMU model is parsed from the VM definition. Add a VM definition example with an associated qemu command line that exercises the detection o

[RFC PATCH 0/5] qemu: Route hostdevs to multiple nested SMMUs

2024-12-11 Thread Nathan Chen via Devel
Hi, This is a draft solution for supporting multiple vSMMU instances in a qemu VM. Based on discussions/suggestions received for a previous RFC by Nicolin here[0], the association of vSMMUs to VFIO devices in VM PCIe topology should be moved out of qemu into libvirt. In addition, the nested SMMU

[RFC PATCH 3/5] qemu: Create PXBs and auto-assign VFIO devs and nested SMMUs

2024-12-11 Thread Nathan Chen via Devel
Add a pcie-expander-bus controller to the VM definition for each "nestedSmmuv3" device that is generated when the "nestedSmmuv3" IOMMU model is parsed from the VM definition. Assign each "nestedSmmuv3" device to one PXB controller, and route any unmanaged "hostdev" VFIO devices with associated host

[RFC PATCH 4/5] qemu: Update PXB busNr for nestedSmmuv3 controllers

2024-12-11 Thread Nathan Chen via Devel
Update the PXB controller busNrs to account for devices we attached in the previous commit, ensuring there are enough VM bus numbers to be assigned for each device attached downstream from each PXB controller. Signed-off-by: Nathan Chen --- src/qemu/qemu_domain_address.c | 52 +++

[RFC PATCH 1/5] conf: Add a nestedSmmuv3 IOMMU model

2024-12-11 Thread Nathan Chen via Devel
Add support for specifying "nestedSmmuv3" as the IOMMU model. In the following commits, when the "nestedSmmuv3" IOMMU model is parsed from the VM definition, PXB controllers and "nestedSmmuv3" devices will be auto-added to the VM definition and VFIO devices will be routed to PXB controllers based o

Re: [RFC PATCH 0/5] qemu: Route hostdevs to multiple nested SMMUs

2024-12-15 Thread Nathan Chen via Devel
Hi Daniel, >Top level libvirt device representation in XML is based on the device >*class*, not the specific device impl. Adding a device >type XML element in libvirt is totally inappropriate. Any configuration >must be done beneath the element. Would keeping track of PXB <=> host SMMU nodes b

Re: [RFC PATCH 0/5] qemu: Route hostdevs to multiple nested SMMUs

2024-12-24 Thread Nathan Chen via Devel
Hi Daniel, Top level libvirt device representation in XML is based on the device *class*, not the specific device impl. Adding a device type XML element in libvirt is totally inappropriate. Any configuration must be done beneath the element. Would keeping track of PXB <=> host SMMU nodes be

Re: [RFC PATCH 0/5] qemu: Route hostdevs to multiple nested SMMUs

2025-01-14 Thread Nathan Chen via Devel
Hi Daniel, Top level libvirt device representation in XML is based on the device *class*, not the specific device impl. Adding a device type XML element in libvirt is totally inappropriate. Any configuration must be done beneath the element. 1. Adding a attribute for PXB controller. 2. Havin

Re: [RFC PATCH 0/5] qemu: Implement support for iommufd and multiple vSMMUs

2025-05-27 Thread Nathan Chen via Devel
On 5/16/2025 3:19 AM, Shameerali Kolothum Thodi wrote: Hi, This is a follow up to the first RFC patchset [0] for supporting multiple vSMMU instances in a qemu VM. This patchset also introduces support for using iommufd to propagate DMA mappings to kernel for assigned devices. This patchset i

Re: [RFC PATCH 1/5] conf: Support multiple smmuv3Dev IOMMU devices

2025-05-27 Thread Nathan Chen via Devel
On 5/20/2025 4:20 AM, Daniel P. Berrangé wrote: Add support for "smmuv3Dev" IOMMU model, and add support for parsing multiple IOMMU devices from the VM definition when "smmuv3Dev" is the IOMMU model. Enable plugging smmuv3Dev into pcie-root and pcie-expander-bus. Signed-off-by: Nathan Chen --

Re: [RFC PATCH 2/5] conf: Add an iommufd member struct to virDomainIOMMUDef

2025-05-27 Thread Nathan Chen via Devel
On 5/20/2025 6:01 AM, Daniel P. Berrangé wrote: Add support for an "iommufd" virDomainIOMMUDef member that will be translated to a qemu "-object iommufd" command line argument. This iommufd struct has an "id" member to specify the iommufd object id that can be associated with a passthrough dev

Re: [RFC PATCH 0/5] qemu: Implement support for iommufd and multiple vSMMUs

2025-05-27 Thread Nathan Chen via Devel
Hi Daniel, On 5/20/2025 5:51 AM, Daniel P. Berrangé wrote: Hi, This is a follow up to the first RFC patchset [0] for supporting multiple vSMMU instances in a qemu VM. This patchset also introduces support for using iommufd to propagate DMA mappings to kernel for assigned devices. This patchset

Re: [RFC PATCH 3/5] qemu: Implement support for associating iommufd to hostdev

2025-05-27 Thread Nathan Chen via Devel
On 5/20/2025 6:05 AM, Daniel P. Berrangé wrote: Implement "iommufdId" and "iommufdFd" attributes for "hostdev" devices that can be used to specify associated iommufd object and fd for externally opening the /dev/iommu and VFIO cdev, when launching a qemu VM. What does it mean if we enable iom

[RFC PATCH 0/5] qemu: Implement support for iommufd and multiple vSMMUs

2025-05-15 Thread Nathan Chen via Devel
Hi, This is a follow up to the first RFC patchset [0] for supporting multiple vSMMU instances in a qemu VM. This patchset also introduces support for using iommufd to propagate DMA mappings to kernel for assigned devices. This patchset implements support for specifying multiple devices within th

[RFC PATCH 2/5] conf: Add an iommufd member struct to virDomainIOMMUDef

2025-05-15 Thread Nathan Chen via Devel
Add support for an "iommufd" virDomainIOMMUDef member that will be translated to a qemu "-object iommufd" command line argument. This iommufd struct has an "id" member to specify the iommufd object id that can be associated with a passthrough device, and an "fd" member to specify the fd for externa

[RFC PATCH 3/5] qemu: Implement support for associating iommufd to hostdev

2025-05-15 Thread Nathan Chen via Devel
Implement "iommufdId" and "iommufdFd" attributes for "hostdev" devices that can be used to specify associated iommufd object and fd for externally opening the /dev/iommu and VFIO cdev, when launching a qemu VM. Signed-off-by: Nathan Chen --- src/conf/domain_conf.c| 31 +++

[RFC PATCH 1/5] conf: Support multiple smmuv3Dev IOMMU devices

2025-05-15 Thread Nathan Chen via Devel
Add support for "smmuv3Dev" IOMMU model, and add support for parsing multiple IOMMU devices from the VM definition when "smmuv3Dev" is the IOMMU model. Enable plugging smmuv3Dev into pcie-root and pcie-expander-bus. Signed-off-by: Nathan Chen --- docs/formatdomain.rst | 5 +- src/c

[RFC PATCH 4/5] qemu: Update Cgroup and namespace for qemu to access iommufd paths

2025-05-15 Thread Nathan Chen via Devel
Allow access to /dev/iommu and /dev/vfio/devices/vfio* when launching a qemu VM with iommufd feature enabled. Signed-off-by: Nathan Chen --- src/qemu/qemu_cgroup.c| 47 +++ src/qemu/qemu_cgroup.h| 1 + src/qemu/qemu_namespace.c | 36 ++

[RFC PATCH 5/5] qemu: Add test case for specifying iommufd

2025-05-15 Thread Nathan Chen via Devel
Implement a sub-test in qemuxmlconftest that takes an iommufd attribute from the iommu device stanza, and iommufdId and iommufdFd hostdev attributes in a VM definition. Translate the VM definition to a qemu command line that associates the hostdev withan iommufd object, as well as a fd for external

Re: [RFC PATCH 0/5] qemu: Implement support for iommufd and multiple vSMMUs

2025-05-30 Thread Nathan Chen via Devel
On 5/30/2025 8:05 AM, Daniel P. Berrangé wrote: Hi Daniel, On 5/20/2025 5:51 AM, Daniel P. Berrangé wrote: Hi, This is a follow up to the first RFC patchset [0] for supporting multiple vSMMU instances in a qemu VM. This patchset also introduces support for using iommufd to propagate DMA map

Re: [RFC PATCH 2/5] conf: Add an iommufd member struct to virDomainIOMMUDef

2025-05-30 Thread Nathan Chen via Devel
On 5/30/2025 6:47 AM, Daniel P. Berrangé wrote: On 5/20/2025 6:01 AM, Daniel P. Berrangé wrote: Add support for an "iommufd" virDomainIOMMUDef member that will be translated to a qemu "-object iommufd" command line argument. This iommufd struct has an "id" member to specify the iommufd objec