qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] IOMMU and custom PCIe Device in non-nested VMs


From: Maxim Levitsky
Subject: Re: [Qemu-discuss] IOMMU and custom PCIe Device in non-nested VMs
Date: Thu, 22 Aug 2019 00:09:14 +0300

On Wed, 2019-08-21 at 13:37 -0700, Paul Lancaster wrote:
> I’m writing a custom NVMe device model and I need to test ATS functionality. 
> For that, I need to enable the IOMMU.
> 
> I start QEMU with the following command line, using a stock Ubuntu 16.04 
> image:
> 
> % emu-system-x86_64 -M q35,accel=kvm,kernel_irqchip=off -m 8K -device 
> intel-iommu,intremap=on,device-iotlb=on -device myNVMe,addr=10.0
> 
> It boots just fine and I see the /dev/nvme* device files, but the addresses 
> provided for DMA transfers are the same as without a IOMMU.
> 
> I see there are no iommu groups defined, and thus my device is obviously not 
> assigned to any one of them.
> 
> DMAR-related syslog messages:
> 
> ACPI: DMAR 0x000000007FFE20C5 000050 (v01 BOCHS. BXPCDMAR 00000001 BXPC 
> 00000001)
> DMAR: Host address width 39
> DMAR: DRHD base: 0x000000fed90000 flags: 0x1
> DMAR: dmar0: reg_base_addr fed90000 ver 1.0 cap 12008c22260206 cap f00f4e
> DMAR: ATSR flash: 0x1
> DMAR-IR: IOAPIC id 0 under DRHD base. 0xfed90000 IOMMU 0
> DMAR-IR: Enabled IRQ remapping in Salic mode
> 
> How can I get the DMA buffers use virtual addresses?
> 
> 

Did you enable the iommu in the guest?
You need intel_iommu=on on guest't command line to enable the virtual IOMMU.

And you might need iommu=on (usually this is the default, can be changed by 
Kconfig option)
(it can be 'on' or 'pt', and later makes kernel driver use passthrough mode in 
which too as you say 
the addresses provided for DMA transfers would be the same as without a IOMMU)

Best regards,
        Maxim Levitsky





reply via email to

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