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 1452072 - RFE: Add support for listing mediated devices to libvirt's node device driver
Summary: RFE: Add support for listing mediated devices to libvirt's node device driver
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Erik Skultety
QA Contact: zhe peng
URL:
Whiteboard:
: 1376907 (view as bug list)
Depends On: 1376907 1463285
Blocks: 1422276 1454174
TreeView+ depends on / blocked
 
Reported: 2017-05-18 09:42 UTC by Erik Skultety
Modified: 2018-02-14 17:04 UTC (History)
9 users (show)

Fixed In Version: libvirt-3.2.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1454174 (view as bug list)
Environment:
Last Closed: 2017-08-02 00:08:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Erik Skultety 2017-05-18 09:42:13 UTC
Description of problem:
libvirt supports mediated devices' framework since 3.2.0 but lacks the capability to list both pre-created mediated devices and their physical parent devices capable of creating mediated devices in virsh's nodedev-list output. The same goes for querying the XML definition of such devices.

Version-Release number of selected component (if applicable):
3.2.0

How reproducible:

Steps to Reproduce:
1.
2.
3.

Actual results:
libvirt doesn't support mediated devices within it's node device driver

Expected results:
As the first stage of support, show the pre-created devices in the list of host devices as well as enable filtering of the host device list using flags (virsh nodedev-list --cap) both by mediated devices and devices capable of creating them.

Additional info:

Comment 2 Erik Skultety 2017-05-18 12:05:02 UTC
Fixed upstream by commits:

commit 4385df97fed24279fa8595a1a49c9f9b3eba5be1
Refs: v3.3.0-92-g4385df97f
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Mar 6 17:20:00 2017 +0100
Commit:     Erik Skultety <eskultet>
CommitDate: Thu May 18 12:20:15 2017 +0200

    nodedev: Introduce new mdev_types and mdev nodedev capabilities

    The reason for introducing two capabilities, one for the device itself
    (cap 'mdev') and one for the parent device listing the available types
    ('mdev_types'), is that we should be able to do
    'virsh nodedev-list --cap' not only for existing mdev devices but also
    for devices that support creation of mdev devices, since one day libvirt
    might be actually able to create the mdev devices in an automated way
    (just like we do for NPIV/vHBA).

    https://bugzilla.redhat.com/show_bug.cgi?id=1452072

    Signed-off-by: Erik Skultety <eskultet>


commit 500cbc066a5362834462c4eefb260b7c96a8554f
Refs: v3.3.0-93-g500cbc066
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Mar 6 17:17:34 2017 +0100
Commit:     Erik Skultety <eskultet>
CommitDate: Thu May 18 12:21:33 2017 +0200

    nodedev: Introduce the mdev capability to a PCI parent device

    The parent device needs to report the generic stuff about the supported
    mediated devices types, like device API, available instances, type name,
    etc. Therefore this patch introduces a new nested capability element of
    type 'mdev_types' with the resulting XML of the following format:

    <device>
      ...
      <capability type='pci'>
        ...
	<capability type='mdev_types'>
          <type id='vendor_supplied_id'>
            <name>optional_vendor_supplied_codename</name>
            <deviceAPI>vfio-pci</deviceAPI>
            <availableInstances>NUM</availableInstances>
          </type>
            ...
          <type>
            ...
          </type>
        </capability>
      </capability>
      ...
    </device>

    https://bugzilla.redhat.com/show_bug.cgi?id=1452072

    Signed-off-by: Erik Skultety <eskultet>


commit 88ef73e13cddc8c0ff01dfe7a914342f8720c517
Refs: v3.3.0-94-g88ef73e13
Author:     Erik Skultety <eskultet>
AuthorDate: Mon Mar 6 17:18:48 2017 +0100
Commit:     Erik Skultety <eskultet>
CommitDate: Thu May 18 12:21:45 2017 +0200

    nodedev: Introduce mdev capability for mediated devices

    Start discovering the mediated devices on the host system and format the
    attributes for the mediated device into the XML. Compared to the parent
    device which reports generic information about the abstract mediated
    devices types, a child device only reports the type name it has been
    instantiated from and the IOMMU group number, since that's device
    specific compared to the rest of the info that can be gathered about
    mediated devices at the moment.
    This patch introduces both the formatting and parsing routines, updates
    nodedev.rng schema, adding a testcase as well.

    The resulting mdev child device XML:
    <device>
      <name>mdev_4b20d080_1b54_4048_85b3_a6a62d165c01</name>
      <path>/sys/devices/.../4b20d080-1b54-4048-85b3-a6a62d165c01</path>
      <parent>pci_0000_06_00_0</parent>
      <driver>
        <name>vfio_mdev</name>
      </driver>
      <capability type='mdev'>
        <type id='vendor_supplied_type_id'/>
        <iommuGroup number='NUM'/>
      <capability/>
    <device/>

    https://bugzilla.redhat.com/show_bug.cgi?id=1452072

    Signed-off-by: Erik Skultety <eskultet>


commit a0a0b3cf71cbee1df40dd0fdebd7bb6a84682f09
Refs: [master], [mdev-nodedev-next], {origin/master}, {origin/HEAD}, v3.3.0-95-ga0a0b3cf7
Author:     Erik Skultety <eskultet>
AuthorDate: Wed Mar 29 12:36:31 2017 +0200
Commit:     Erik Skultety <eskultet>
CommitDate: Thu May 18 12:21:55 2017 +0200

    docs: Document the mediated devices within the nodedev driver

    https://bugzilla.redhat.com/show_bug.cgi?id=1452072

    Signed-off-by: Erik Skultety <eskultet>

Comment 5 zhe peng 2017-05-25 03:25:12 UTC
test with build:
libvirt-3.2.0-6.virtcov.el7.x86_64
qemu-kvm-rhev-2.9.0-6.el7.x86_64
kernel-3.10.0-663.el7.x86_64

step:
1. create mdev.
#lspci
00:02.0 VGA compatible controller: Intel Corporation HD Graphics P530 (rev 06)
# ll /sys/class/mdev_bus/0000\:00\:02.0/mdev_supported_types/i915-GVTg_V5_4/devices
total 0
lrwxrwxrwx. 1 root root 0 May 25 10:32 9ea4eb07-c4a8-41d1-bd4a-850d1b0bef74 -> ../../../9ea4eb07-c4a8-41d1-bd4a-850d1b0bef74

2.check virsh man page
#man virsh
nodedev-list cap --tree
           List all of the devices available on the node that are known by libvirt.  cap is used to filter the list by capability types, the types must be separated by comma, e.g.
           --cap pci,scsi. Valid capability types include 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host', 'vports',
           'scsi_generic', 'drm', 'mdev', 'mdev_types'.  If --tree is used, the output is formatted in a tree representing parents of each node.  cap and --tree are mutually
           exclusive.
3.check cap
# virsh nodedev-list --cap mdev
mdev_9ea4eb07_c4a8_41d1_bd4a_850d1b0bef74

# virsh nodedev-list --cap mdev_types
pci_0000_00_02_0

3.check capability
# virsh nodedev-list --tree
computer
  |
 ...
  +- pci_0000_00_00_0
  +- pci_0000_00_02_0
  |   |
  |   +- drm_card0
  |   +- drm_renderD128
  |   +- mdev_9ea4eb07_c4a8_41d1_bd4a_850d1b0bef74

# virsh nodedev-dumpxml pci_0000_00_02_0
<device>
  <name>pci_0000_00_02_0</name>
  <path>/sys/devices/pci0000:00/0000:00:02.0</path>
  <parent>computer</parent>
  <driver>
    <name>i915</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>0</bus>
    <slot>2</slot>
    <function>0</function>
    <product id='0x191d'>HD Graphics P530</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='mdev_types'>
      <type id='i915-GVTg_V5_4'>
        <deviceAPI>vfio-pci</deviceAPI>
        <availableInstances>0</availableInstances>
      </type>
      <type id='i915-GVTg_V5_8'>
        <deviceAPI>vfio-pci</deviceAPI>
        <availableInstances>0</availableInstances>
      </type>
    </capability>
    <iommuGroup number='1'>
      <address domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </iommuGroup>
    <pci-express/>
  </capability>
</device>

# virsh nodedev-dumpxml mdev_9ea4eb07_c4a8_41d1_bd4a_850d1b0bef74
<device>
  <name>mdev_9ea4eb07_c4a8_41d1_bd4a_850d1b0bef74</name>
  <path>/sys/devices/pci0000:00/0000:00:02.0/9ea4eb07-c4a8-41d1-bd4a-850d1b0bef74</path>
  <parent>pci_0000_00_02_0</parent>
  <driver>
    <name>vfio_mdev</name>
  </driver>
  <capability type='mdev'>
    <type id='i915-GVTg_V5_4'/>
    <iommuGroup number='7'/>
  </capability>
</device>

I will do more functional testing about this, after that, i will move this
bug to verified.

Comment 6 zhe peng 2017-06-13 03:40:38 UTC
i retest this on build:
libvirt-3.2.0-9.virtcov.el7.x86_64

does not found any issues, move to verified.

Comment 13 Jaroslav Suchanek 2017-06-16 10:58:08 UTC
I have marked the kernel bug 1376907 as a blocker for this.

Comment 15 errata-xmlrpc 2017-08-02 00:08:25 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, 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/RHEA-2017:1846

Comment 16 errata-xmlrpc 2017-08-02 01:32:35 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, 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/RHEA-2017:1846

Comment 17 Erik Skultety 2018-02-14 17:04:51 UTC
*** Bug 1376907 has been marked as a duplicate of this bug. ***


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