qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alok Prasad <prasadalok77@gmail.com>
To: qemu-devel@nongnu.org
Subject: Fwd: Enable IOMMU Inside QEMU
Date: Tue, 6 Oct 2020 23:26:08 +0530	[thread overview]
Message-ID: <CAJPzGv0bFatmLJ_dy83KgZbyMS5zM0_pAqTynkSAHXNUST_JHg@mail.gmail.com> (raw)
In-Reply-To: <CAJPzGv1Vd1V2a_7n2GW4RBUDgpsdyAH-8NMvW+368gigtYWd0g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4433 bytes --]

How Can i i enable vIOMMU inside QEMU
Have run the qemu with below parameters.

root@beta-hp-p70:/home/fastlinq/alok/KVM-VM# ps -ef | grep qemu
root     20347     1  2 06:06 ?        00:00:36 /usr/bin/qemu-system-x86_64
-name guest=centos7_8_vm,debug-threads=on -S -object
secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-15-centos7_8_vm/master-key.aes
-machine
pc-q35-4.2,accel=kvm,usb=off,dump-guest-core=off,kernel_irqchip=split -cpu
SandyBridge,vmx=on -m 4096 -realtime mlock=off -smp
1,sockets=1,cores=1,threads=1 -uuid f8ee6a5e-6253-453c-8304-7eca50fa7b94
-no-user-config -nodefaults -chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-15-centos7_8_vm/monitor.sock,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown
-no-acpi -boot strict=on -device intel-iommu,intremap=on,caching-mode=on
-device
pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2
-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1
-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2
-device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3
-device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4
-device pcie-root-port,port=0x15,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5
-device pcie-root-port,port=0x16,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6
-device pcie-root-port,port=0x17,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7
-device qemu-xhci,id=usb,bus=pci.5,addr=0x0 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 -drive
file=/home/fastlinq/centos-7.8.qcow2,format=qcow2,if=none,id=drive-virtio-disk0
-device
virtio-blk-pci,scsi=off,bus=pci.4,addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
-drive
file=/home/fastlinq/dev.img,format=raw,if=none,id=drive-virtio-disk2,cache=none,aio=native
-device
virtio-blk-pci,scsi=off,bus=pci.8,addr=0x0,drive=drive-virtio-disk2,id=virtio-disk2
-netdev tap,fd=26,id=hostnet0 -device
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:b8:d3:f8,bus=pci.2,addr=0x0
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -vnc 127.0.0.1:0 -device
cirrus-vga,id=video0,bus=pcie.0,addr=0x1 -device
virtio-balloon-pci,id=balloon0,bus=pci.6,addr=0x0 -msg timestamp=on

XML of the same ( ony relevant part)
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-4.2'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <kvm>
      <hidden state='off'/>
    </kvm>
    <ioapic driver='qemu'/>
  </features>
  <cpu mode='custom' match='exact' check='partial'>
    <model fallback='allow'>SandyBridge</model>
    <feature policy='require' name='vmx'/>
  </cpu>
...
....
 <iommu model='intel'>
      <driver intremap='on' caching_mode='on'/>
    </iommu>

and in Guest VM

[root@centos-8 ~]# dmesg | grep DMAR
[    0.000000] DMAR: IOMMU enabled

[root@centos-8 ~]# cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt2)/vmlinuz-4.18.0-193.6.3.el8_2.x86_64
root=UUID=4fd120e4-1f6d-46b3-a404-5569ef6af1f9 ro console=tty0
rd_NO_PLYMOUTH crashkernel=auto
resume=UUID=40f14688-2619-4046-a9eb-b7333fff1b84 console=ttyS0,115200
intel_iommu=on

I don't see other Prints related to IOMMU which seems that its not present
in guest VM. " DMAR: IOMMU enabled " just means its enabled in kernel
paramter.

ideally i should see some other prints e.g below

dmesg | grep -e DMAR -e IOMMU
[ 0.000000] ACPI: DMAR 0x000000003E86C000 000048 (v01 BOCHS BXPCDMAR
00000001
BXPC 00000001)
[ 0.000000] DMAR: IOMMU enabled ---> only shows that its enabled in OS/GRUB
[ 0.145746] DMAR: Host address width 39
[ 0.145747] DMAR: DRHD base: 0x000000fed90000 flags: 0x1
[ 0.145769] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 12008c22260286
ecap
f00f5a
[ 0.145776] DMAR: No RMRR found
[ 0.145776] DMAR: No ATSR found
[ 0.145825] DMAR: dmar0: Using Queued invalidation
[ 0.218192] DMAR: Setting RMRR:
[ 0.218193] DMAR: Prepare 0-16MiB unity mapping for LPC
[ 0.219038] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 -
0xffffff]
[ 0.257194] DMAR: Intel(R) Virtualization Technology for Directed I/O

root@beta-hp-p70:/home/fastlinq/alok/KVM-VM# /usr/bin/qemu-system-x86_64
--version
QEMU emulator version 4.2.1
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers



I am missing here something,? Is there seperate Branch for the same in qemu.

Thanks,
Alok

[-- Attachment #2: Type: text/html, Size: 5438 bytes --]

       reply	other threads:[~2020-10-06 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAJPzGv1Vd1V2a_7n2GW4RBUDgpsdyAH-8NMvW+368gigtYWd0g@mail.gmail.com>
2020-10-06 17:56 ` Alok Prasad [this message]
2020-10-06 20:23   ` Fwd: Enable IOMMU Inside QEMU Peter Xu
2020-10-07 11:20     ` Alok Prasad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJPzGv0bFatmLJ_dy83KgZbyMS5zM0_pAqTynkSAHXNUST_JHg@mail.gmail.com \
    --to=prasadalok77@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).