RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2108483 - Add alias support for virtio-iommu
Summary: Add alias support for virtio-iommu
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Andrea Bolognani
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-19 07:47 UTC by Han Han
Modified: 2023-05-09 08:07 UTC (History)
12 users (show)

Fixed In Version: libvirt-8.7.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:26:34 UTC
Type: Bug
Target Upstream Version: 8.6.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker LIBVIRTAT-13621 0 None None None 2022-10-27 02:13:48 UTC
Red Hat Issue Tracker RHELPLAN-128124 0 None None None 2022-07-19 07:57:24 UTC
Red Hat Product Errata RHBA-2023:2171 0 None None None 2023-05-09 07:27:25 UTC

Description Han Han 2022-07-19 07:47:24 UTC
Description of problem:
virtio-iommu device cannot generate alias element and customized alias will not work for virtio-iommu

Version-Release number of selected component (if applicable):
libvirt-8.5.0-2.el9.x86_64
qemu-kvm-7.0.0-9.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
Test1: Check the auto-assigned alias for virtio-iommu:
1. Start a q35 VM with virtio-iommu:
...
    <iommu model="virtio"/>
...

2. Check the live XML and qemu command line of iommu:
➜  ~ virsh dumpxml rhel --xpath //iommu
<iommu model="virtio">
  <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
</iommu>


➜  ~ ps aux|grep iommu
... -device {"driver":"virtio-iommu","bus":"pcie.0","addr":"0x3"}

No <alias/> in live XML. No id in the properties of virtio-iommu.


Test2: Set customized alias for virtio-iommu:
1. Start a q35 VM with customized alias for virtio-iommu
...
<iommu model="virtio">
  <alias name="ua-xx"/>
</iommu>
...

2. Check the live XML and qemu command line of iommu. Validate the live XML
➜  ~ virsh dumpxml rhel --xpath //iommu
<iommu model="virtio">
  <alias name="ua-xx"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
</iommu>

➜  ~ ps aux|grep iommu
... -device {"driver":"virtio-iommu","bus":"pcie.0","addr":"0x3"}

No id property for virtio-iommu.

➜  ~ virsh dumpxml rhel|virt-xml-validate -
Relax-NG validity error : Extra element devices in interleave
-:64: element devices: Relax-NG validity error : Element domain failed to validate content
- fails to validate

Validation failed.


Actual results:
As above

Expected results:
If no customized alias, libvirt will generate one for iommu and works for live XML and qemu command line. And customized alias of iommu will works. The XML validation will pass for virtio-iommu with alias.

Additional info:

Comment 1 jinl 2022-07-19 08:37:05 UTC
try with intel_iommu can also hit this issue

steps to reproduce: same with the above Description
just change the model from "virtio" to "intel" 
<iommu model="intel">

get the same error message:
Extra element devices in interleave
Element domain failed to validate content

Comment 2 Andrea Bolognani 2022-07-21 09:33:41 UTC
Patches posted upstream.

https://listman.redhat.com/archives/libvir-list/2022-July/233042.html

Comment 3 Andrea Bolognani 2022-07-22 15:53:14 UTC
Patches merged upstream.

  commit 510540961417288a24d0870f0226f8255420c463
  Author: Andrea Bolognani <abologna>
  Date:   Thu Jul 21 11:14:21 2022 +0200

    qemu: Add IOMMU device alias to command line
    
    Note that we can only do this for intel-iommu and virtio-iommu,
    which are configured using -device; smmuv3 is configured using
    a machine type property, so there's no room on the command line
    for an alias in that case.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=2108483
    
    Signed-off-by: Andrea Bolognani <abologna>
    Reviewed-by: Michal Privoznik <mprivozn>

  v8.5.0-172-g5105409614

Comment 4 yalzhang@redhat.com 2022-09-16 01:51:26 UTC
Test on libvirt-8.7.0-1.el9.x86_64, the result is as expected, intel iommu also works fine.

1. start vm with a virtio iommu device

2. # virsh dumpxml rhel --xpath //iommu
<iommu model="virtio">
  <alias name="iommu0"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
</iommu>

3. # virsh dumpxml rhel|virt-xml-validate -
- validates

4. Try with customized alias:
# virsh dumpxml rhel --xpath //iommu
<iommu model="virtio">
  <alias name="ua-b52d2352-5650-4546-9a22-9d685cf6ce23"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
</iommu>

# virsh start rhel 
Domain 'rhel' started

# virsh dumpxml rhel|virt-xml-validate -
- validates

Comment 8 errata-xmlrpc 2023-05-09 07:26:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (libvirt bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2171


Note You need to log in before you can comment on or make changes to this bug.