Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2037612

Summary: [Win11][tpm][QL41112 PF] vfio_listener_region_add received unaligned region
Product: Red Hat Enterprise Linux 9 Reporter: Yanghang Liu <yanghliu>
Component: qemu-kvmAssignee: Eric Auger <eric.auger>
qemu-kvm sub component: Devices QA Contact: Yanghang Liu <yanghliu>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: chayang, eric.auger, jinzhao, juzhang, marcandre.lureau, virt-maint, yanghliu
Version: 9.0Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: qemu-kvm-7.0.0-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:53:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yanghang Liu 2022-01-06 05:35:43 UTC
Description of problem:
When start a win11 domain only with 2 QL41112 PF, the qemu-kvm will throw " vfio_listener_region_add received unaligned region"

Version-Release number of selected component (if applicable):
host:
5.14.0-39.el9.x86_64
qemu-kvm-6.2.0-1.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1. check the QL41112 PF info

# virsh nodedev-dumpxml pci_0000_3b_00_0
<device>
  <name>pci_0000_3b_00_0</name>
  <path>/sys/devices/pci0000:3a/0000:3a:00.0/0000:3b:00.0</path>
  <parent>pci_0000_3a_00_0</parent>
  <driver>
    <name>vfio-pci</name>
  </driver>
  <capability type='pci'>
    <class>0x020000</class>
    <domain>0</domain>
    <bus>59</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x8070'>FastLinQ QL41000 Series 10/25/40/50GbE Controller</product>
    <vendor id='0x1077'>QLogic Corp.</vendor>
    <capability type='virt_functions' maxCount='96'/>
    <capability type='vpd'>
      <name>QLogic 10GE 2P QL41112HxCU-DE Adapter</name>
      <fields access='readonly'>
        <manufacture_id>1028</manufacture_id>
        <part_number>QL41112HxCU-DE</part_number>
        <serial_number>REE1950F80562</serial_number>
        <vendor_field index='0'>FFV14.07.07</vendor_field>
        <vendor_field index='1'>DSV1028VPDR.VER2.1</vendor_field>
        <vendor_field index='2'>NPY2</vendor_field>
        <vendor_field index='3'>PMTD</vendor_field>
        <vendor_field index='4'>NMVQLogic</vendor_field>
        <vendor_field index='5'>DTINIC</vendor_field>
        <vendor_field index='6'>DCM1001FFFFFF1202FFFFFF1403FFFFFF1604FFFFFF1805FFFFFF1A06FFFFFF1C07FFFFFF1E08FFFFFF2101FFFFFF2302FFFFFF2503FFFFFF2704FFFFFF2905FFFFFF2B06FFFFFF2D07FFFFFF2F08FFFFFF</vendor_field>
      </fields>
    </capability>
    <iommuGroup number='58'>  <--- The two QL41112 PFs are in the same IOMMU group
      <address domain='0x0000' bus='0x3b' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x3b' slot='0x00' function='0x1'/>
    </iommuGroup>
    <numa node='0'/>
    <pci-express>
      <link validity='cap' port='0' speed='8' width='8'/>
      <link validity='sta' speed='8' width='8'/>
    </pci-express>
  </capability>
</device>


2. start a win11 domain with two QL41112 PF
# virt-install --machine=q35 --noreboot --name=win11 --memory=4096 --vcpus=4 --graphics type=vnc,port=5911,listen=0.0.0.0 --import --noautoconsole  --network bridge=switch,model=virtio,mac=52:54:00:01:11:11 --disk path=/home/images/win11.qcow2,bus=virtio,cache=none,format=qcow2,io=threads,size=20  --boot=uefi --boot nvram.template=/usr/share/edk2/ovmf/OVMF_VARS.fd --tpm model=tpm-crb,backend.type=emulator --hostdev 0000:3b:00.0 --hostdev 0000:3b:00.1

3. check the QL41112 PF info in the Win11 vm
These two devices are working properly

4. check the qemu-kvm info

2022-01-06T03:55:08.533447Z qemu-kvm: 
-device {"driver":"vfio-pci","host":"0000:3b:00.0","id":"hostdev0","bus":"pci.3","addr":"0x0"}: vfio_listener_region_add received unaligned region


Actual results:
vfio_listener_region_add received unaligned region

Expected results:
The qemu-kvm will not throw any suspicious information

Additional info:
(1)When start a win11 domain only with 2 QL41112 PF but *without tpm device*, the qemu-kvm will not throw any suspicious info.


(2)Use MT2892 to repeat step 1 - step 4 , this problem can not be reproduced.

Comment 1 Alex Williamson 2022-01-06 14:18:35 UTC
Eric, I see you've touched the TPM driver previously, should it be using ram_device memory regions rather than just ram memory regions?  We expect ram memory regions to be mappable to the IOMMU and therefore be page aligned.  If TPM uses sub-pages, I would expect it could generate such errors.  Also TPM is a device and not just memory, so it seems it should be using ram_device regardless.  If this is accurate, would you mind taking this bz?  Thanks

Comment 2 Eric Auger 2022-01-06 15:15:41 UTC
I see the TPM_PPI region uses such ram_device mem type instead indeed. I was just curious about the migration case but it seems we can add a vmstate_register_ram() to ensure it.

I can take the BZ. Adding Marc-André in CC too.

Comment 3 Eric Auger 2022-01-11 15:16:40 UTC
As expected I can reproduce it on linux too.

Comment 4 Eric Auger 2022-01-18 21:01:25 UTC
Posted "[PATCH v2 0/2] TPM-CRB: Remove spurious error report when used with VFIO" upstream

Comment 5 Yanghang Liu 2022-02-14 07:35:20 UTC
Hi Eric,

This problem can be reproduced in qemu-kvm-6.2.0-6.module+el8.6.0+14167+61b0e671.x86_64.

May I ask if we need to clone the same bug for RHEL.8.6 ?

Comment 8 Eric Auger 2022-03-29 07:31:29 UTC
"[PATCH v3 for-7.1] vfio/common: remove spurious tpm-crb-cmd misalignment warning" collected R-bs and A-bs on the ML and should land into 7.1. I will backport the patch when it lands.

Comment 10 Yanan Fu 2022-05-13 05:57:35 UTC
QE bot(pre verify): Set 'Verified:Tested,SanityOnly' as gating/tier1 test pass.

Comment 11 Yanghang Liu 2022-05-13 07:25:03 UTC
This bug can still be reproduced in qemu-kvm-7.0.0-2.el9.x86_64

related info : qemu-kvm: -device {"driver":"vfio-pci","host":"0000:3b:00.0","id":"hostdev0","bus":"pci.4","addr":"0x0"}: vfio_listener_region_add received unaligned region

Comment 12 Yanghang Liu 2022-05-13 09:31:01 UTC
Test with qemu-kvm-7.0.0-3.el9.x86_64:

> Steps to Reproduce:
> 1. check the QL41112 PF info
> 2. start a win11 domain with two QL41112 PF
> 3. check the QL41112 PF info in the Win11 vm
> 4. check the qemu-kvm info

The qemu-kvm does not throw the warning information "vfio_listener_region_add received unaligned region"

Comment 13 Yanghang Liu 2022-05-13 09:40:11 UTC
Hi Eric,

Could you please help check the following test scenario ?


  (1) start the same Win11 vm with tpm and a QL41112 PF

  (2) hot-unplug the PF from the Win11 vm

  (3) check the qemu-kvm info

  2022-05-13T09:33:14.767684Z qemu-kvm: vfio_listener_region_del received unaligned region


It seems to me that this should be a similar problem with this bug, but it is not fixed in the qemu-kvm-7.0.0-3.el9.


Do I need to open a new bug for tracking this problem ?

Comment 14 Eric Auger 2022-05-14 10:21:53 UTC
Hi Yanghang,

yeah that's the same kind of stuff. Please enter a new BZ then.

Eric

Comment 15 Yanghang Liu 2022-05-15 07:51:09 UTC
(In reply to Eric Auger from comment #14)
> Hi Yanghang,
> 
> yeah that's the same kind of stuff. Please enter a new BZ then.
> 
> Eric

A new bug: Bug 2086262 - [Win11][tpm]vfio_listener_region_del received unaligned region

Comment 18 Yanghang Liu 2022-05-23 10:11:59 UTC
Verify this bug based on the Comment 12.

Comment 21 errata-xmlrpc 2022-11-15 09:53:29 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 (Moderate: qemu-kvm security, 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/RHSA-2022:7967