qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Host-PCI-Device mapping


From: Ajay Garg
Subject: Host-PCI-Device mapping
Date: Fri, 15 Oct 2021 21:36:31 +0530

Hello everyone.

I have a x86_64 L1 guest, running on a x86_64 host, with a
host-pci-device attached to the guest.
The host runs with IOMMU enabled, and passthrough enabled.

Following are the addresses of the bar0-region of the pci-device, as
per the output of lspci -v :

* On host (hpa) => e2c20000
* On guest (gpa) => fc078000


Now, if /proc/<qemu-pid>/maps is dumped on the host, following line of
interest is seen :

#############################################################################
7f0b5c5f4000-7f0b5c5f5000 rw-s e2c20000 00:0e 13653
  anon_inode:[vfio-device]
#############################################################################

Above indicates that the hva for the pci-device starts from 0x7f0b5c5f4000.


Also, upon attaching gdb to the qemu process, and using a slightly
modified qemugdb/mtree.py (that prints only the information for
0000:0a:00.0 name) to dump the memory-regions, following is obtained :

#############################################################################
(gdb) source qemu-gdb.py
(gdb) qemu mtree
    00000000fc078000-00000000fc07c095 0000:0a:00.0 base BAR 0 (I/O) (@
0x56540d8c8da0)
      00000000fc078000-00000000fc07c095 0000:0a:00.0 BAR 0 (I/O) (@
0x56540d8c76b0)
        00000000fc078000-00000000fc07c095 0000:0a:00.0 BAR 0 mmaps[0]
(I/O) (@ 0x56540d8c7c30)
(gdb)
#############################################################################

Above indicates that the hva for the pci-device starts from 0x56540d8c7c30.

As seen, there is a discrepancy in the two results.


What am I missing?
Looking for pointers, will be grateful.


Thanks and Regards,
Ajay



reply via email to

[Prev in Thread] Current Thread [Next in Thread]