* Host-PCI-Device mapping
@ 2021-10-15 16:06 Ajay Garg
2021-10-16 5:58 ` Ajay Garg
0 siblings, 1 reply; 2+ messages in thread
From: Ajay Garg @ 2021-10-15 16:06 UTC (permalink / raw)
To: QEMU Developers, iommu, linux-pci
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Host-PCI-Device mapping
2021-10-15 16:06 Host-PCI-Device mapping Ajay Garg
@ 2021-10-16 5:58 ` Ajay Garg
0 siblings, 0 replies; 2+ messages in thread
From: Ajay Garg @ 2021-10-16 5:58 UTC (permalink / raw)
To: QEMU Developers, iommu, linux-pci
Never mind, found the answers in kvm_set_user_memory :)
On Fri, Oct 15, 2021 at 9:36 PM Ajay Garg <ajaygargnsit@gmail.com> wrote:
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-16 5:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 16:06 Host-PCI-Device mapping Ajay Garg
2021-10-16 5:58 ` Ajay Garg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).