Re: [Intel-gfx] question about i915 GPU driver in VM

2019-06-03 Thread Micah Morton
On Sun, Jun 2, 2019 at 6:52 PM Zhang, Xiong Y  wrote:
>
> > Hi,
> >
> > I'm trying to get iGPU passthrough working in a VM running on a Chrome OS
> > "7th Generation (Kaby Lake) Intel Core i5-7Y57 with HD Graphics 615" device.
> > I'm able to pass the iGPU through to the VM and execute the i915 driver, but
> > the driver doesn't succeed in getting the system to the point where the
> > screen works.
> >
> > With physical access to the iGPU from inside the guest, is it reasonable to
> > just run the same kernel/driver that works on the host and expect it to 
> > work?
> > Or are there often extra hoops to jump through even with
> > physical/unemulated access to the host GPU and CPU?
> [Zhang, Xiong Y] yes, both host and guest use the same kernel/driver.
> >
> > On a higher level, it would help if anyone had an idea from the logs below 
> > if
> > I'm "close" to getting this to work? Or maybe its hard to say?
> [Zhang, Xiong Y] it is close to work.
> >
> > NOTE: I totally avoid touching the GPU in the host, and have verified that 
> > the
> > i915 driver in the guest should have all the info (e.g.
> > OpRegion tables) it needs to drive the GPU. Interestingly, running
> > i915 in the VM causes the VM kernel to crash at random code paths unless I
> > wait until after system startup to modprobe i915. The VM doesn't crash at 
> > all
> > if I disable i915. These crashes happen well after i915 is done trying to
> > initialize the GPU, so not sure if i915 is touching memory it shouldn't be 
> > or
> > what..
> [Zhang, Xiong Y] Please check whether intel_iommu is enabled on host or not. 
> If it isn't , please add intel_iommu=on to host grub.

IOMMUs are enabled and working in the host i.e.

localhost ~ # dmesg | grep -i iommu
[0.109311] iommu: Adding device :00:00.0 to group 0
[0.109319] iommu: Adding device :00:02.0 to group 1
[0.109327] iommu: Adding device :00:04.0 to group 2
[0.109336] iommu: Adding device :00:08.0 to group 3
[0.109350] iommu: Adding device :00:14.0 to group 4
[0.109357] iommu: Adding device :00:14.2 to group 4
[0.109374] iommu: Adding device :00:15.0 to group 5
[0.109382] iommu: Adding device :00:15.1 to group 5
[0.109389] iommu: Adding device :00:15.2 to group 5
[0.109403] iommu: Adding device :00:19.0 to group 6
[0.109412] iommu: Adding device :00:19.2 to group 6
[0.109429] iommu: Adding device :00:1c.0 to group 7
[0.109446] iommu: Adding device :00:1e.0 to group 8
[0.109455] iommu: Adding device :00:1e.2 to group 8
[0.109464] iommu: Adding device :00:1e.4 to group 8
[0.109487] iommu: Adding device :00:1f.0 to group 9
[0.109496] iommu: Adding device :00:1f.2 to group 9
[0.109505] iommu: Adding device :00:1f.3 to group 9
[0.109514] iommu: Adding device :00:1f.4 to group 9
[0.109523] iommu: Adding device :00:1f.5 to group 9
[0.109542] iommu: Adding device :01:00.0 to group 10

>
> is the dmesg from host or guest ?

guest

> If it is guest, this message shouldn't appear according to your qemu boot 
> parameter.
> > [0.475961] [drm:i915_ggtt_probe_hw] GTT stolen size = 64M
> > [0.476927] [drm:i915_gem_init_stolen] Memory reserved for graphics
> > device: 65536K, usable: 64512K
> Please paste qemu output.

Not sure what you mean by the boot parameter or qemu output comments.
Do you want to see guest SeaBIOS output or kernel console output? Or
messages logged by qemu in the host?

>
> thanks
> >
> > Thanks,
> > Micah
> >
> > KERNEL CONSOLE (modified for brevity):
> > localhost ~ # qemu-system-x86_64 -serial mon:stdio -m 2G -smp 2 -M pc -vga
> > none -usbdevice tablet -cpu host,-invpcid,-tsc-deadline,check -drive
> > 'file=/mnt/stateful_partition/chromiumos_test_image.bin,index=0,media=dis
> > k,cache=unsafe,format=raw'
> > -enable-kvm -device
> > vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,ro
> > mbar=0
> > -device 'virtio-net,netdev=eth0' -netdev
> > 'user,id=eth0,net=10.0.2.0/27,hostfwd=tcp:127.0.0.1:9222-:22'
> > qemu-system-x86_64: -usbdevice tablet: '-usbdevice' is deprecated, please
> > use '-device usb-...' instead
> > qemu-system-x86_64: -device
> > vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,ro
> > mbar=0:
> > IGD device :00:02.0 has no ROM, legacy mode disabled VNC server
> > running on 127.0.0.1:5900
> > [0.00] Linux version 4.14.114
> > (mort...@mortonm2.mtv.corp.google.com) (Chromium OS
> > 9.0_pre353983_p20190325-r11 clang version 9.0.0
> > (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git
> > 171531e31716e2db2c372cf8b57220ddf9e721d8)
> > (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git
> > 5077597e0d5b86d9f9c27286d8b28f8b3645a74c) (based on LLVM 9.0.0svn))
> > #14 SMP PREEMPT Fri May 31 09:50:35 PDT 2019
> > [0.00] Command line: BOOT_IMAGE=vmlinuz.A init=/sbin/init
> > boot=local rootwait ro noresume noswap 

Re: [Intel-gfx] question about i915 GPU driver in VM

2019-06-02 Thread Zhang, Xiong Y
> Hi,
> 
> I'm trying to get iGPU passthrough working in a VM running on a Chrome OS
> "7th Generation (Kaby Lake) Intel Core i5-7Y57 with HD Graphics 615" device.
> I'm able to pass the iGPU through to the VM and execute the i915 driver, but
> the driver doesn't succeed in getting the system to the point where the
> screen works.
> 
> With physical access to the iGPU from inside the guest, is it reasonable to
> just run the same kernel/driver that works on the host and expect it to work?
> Or are there often extra hoops to jump through even with
> physical/unemulated access to the host GPU and CPU?
[Zhang, Xiong Y] yes, both host and guest use the same kernel/driver.
> 
> On a higher level, it would help if anyone had an idea from the logs below if
> I'm "close" to getting this to work? Or maybe its hard to say?
[Zhang, Xiong Y] it is close to work.
> 
> NOTE: I totally avoid touching the GPU in the host, and have verified that the
> i915 driver in the guest should have all the info (e.g.
> OpRegion tables) it needs to drive the GPU. Interestingly, running
> i915 in the VM causes the VM kernel to crash at random code paths unless I
> wait until after system startup to modprobe i915. The VM doesn't crash at all
> if I disable i915. These crashes happen well after i915 is done trying to
> initialize the GPU, so not sure if i915 is touching memory it shouldn't be or
> what..
[Zhang, Xiong Y] Please check whether intel_iommu is enabled on host or not. If 
it isn't , please add intel_iommu=on to host grub.

is the dmesg from host or guest ?
If it is guest, this message shouldn't appear according to your qemu boot 
parameter.
> [0.475961] [drm:i915_ggtt_probe_hw] GTT stolen size = 64M
> [0.476927] [drm:i915_gem_init_stolen] Memory reserved for graphics
> device: 65536K, usable: 64512K
Please paste qemu output.

thanks
> 
> Thanks,
> Micah
> 
> KERNEL CONSOLE (modified for brevity):
> localhost ~ # qemu-system-x86_64 -serial mon:stdio -m 2G -smp 2 -M pc -vga
> none -usbdevice tablet -cpu host,-invpcid,-tsc-deadline,check -drive
> 'file=/mnt/stateful_partition/chromiumos_test_image.bin,index=0,media=dis
> k,cache=unsafe,format=raw'
> -enable-kvm -device
> vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,ro
> mbar=0
> -device 'virtio-net,netdev=eth0' -netdev
> 'user,id=eth0,net=10.0.2.0/27,hostfwd=tcp:127.0.0.1:9222-:22'
> qemu-system-x86_64: -usbdevice tablet: '-usbdevice' is deprecated, please
> use '-device usb-...' instead
> qemu-system-x86_64: -device
> vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,ro
> mbar=0:
> IGD device :00:02.0 has no ROM, legacy mode disabled VNC server
> running on 127.0.0.1:5900
> [0.00] Linux version 4.14.114
> (mort...@mortonm2.mtv.corp.google.com) (Chromium OS
> 9.0_pre353983_p20190325-r11 clang version 9.0.0
> (/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git
> 171531e31716e2db2c372cf8b57220ddf9e721d8)
> (/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git
> 5077597e0d5b86d9f9c27286d8b28f8b3645a74c) (based on LLVM 9.0.0svn))
> #14 SMP PREEMPT Fri May 31 09:50:35 PDT 2019
> [0.00] Command line: BOOT_IMAGE=vmlinuz.A init=/sbin/init
> boot=local rootwait ro noresume noswap loglevel=7 noinitrd
> console=ttyS0 disablevmx=off
> root=PARTUUID=60B83A78-8581-014B-8942-6128789234C3 i915.modeset=1
> cros_legacy cros_debug
> 
> [snip]
> 
> [0.00] Reserving Intel graphics memory at [mem
> 0x7c00-0x7fff]
> 
> [snip]
> 
> [0.415534] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
> [0.416418] [drm:i915_driver_load] Assuming SunrisePoint PCH
> [0.417296] [drm:intel_power_domains_init] Allowed DC state mask 03
> [0.418290] [drm:intel_device_info_dump] i915 device info:
> platform=KABYLAKE gen=9 pciid=0x591e rev=0x02
> [0.418292] [drm:intel_device_info_dump] i915 device info: is_mobile:
> no
> [0.419684] [drm:intel_device_info_dump] i915 device info: is_lp: no
> [0.420740] [drm:intel_device_info_dump] i915 device info:
> is_alpha_support: no
> [0.421712] [drm:intel_device_info_dump] i915 device info:
> has_64bit_reloc: yes
> [0.422806] [drm:intel_device_info_dump] i915 device info:
> has_aliasing_ppgtt: yes
> [0.423900] [drm:intel_device_info_dump] i915 device info: has_csr: yes
> [0.425036] [drm:intel_device_info_dump] i915 device info: has_ddi: yes
> [0.426033] [drm:intel_device_info_dump] i915 device info: has_dp_mst:
> yes
> [0.427040] [drm:intel_device_info_dump] i915 device info:
> has_reset_engine: yes
> [0.428076] [drm:intel_device_info_dump] i915 device info: has_fbc: yes
> [0.429180] [drm:intel_device_info_dump] i915 device info:
> has_fpga_dbg: yes
> [0.430181] [drm:intel_device_info_dump] i915 device info:
> has_full_ppgtt: yes
> [0.431726] [drm:intel_device_info_dump] i915 device info:
> has_full_48bit_ppgtt: yes
> [0.432810] [drm:intel_device_info_dump] i915 device info:
> has_gmch_display: no
> [

[Intel-gfx] question about i915 GPU driver in VM

2019-05-31 Thread Micah Morton
Hi,

I'm trying to get iGPU passthrough working in a VM running on a Chrome
OS "7th Generation (Kaby Lake) Intel Core i5-7Y57 with HD Graphics
615" device. I'm able to pass the iGPU through to the VM and execute
the i915 driver, but the driver doesn't succeed in getting the system
to the point where the screen works.

With physical access to the iGPU from inside the guest, is it
reasonable to just run the same kernel/driver that works on the host
and expect it to work? Or are there often extra hoops to jump through
even with physical/unemulated access to the host GPU and CPU?

On a higher level, it would help if anyone had an idea from the logs
below if I'm "close" to getting this to work? Or maybe its hard to
say?

NOTE: I totally avoid touching the GPU in the host, and have verified
that the i915 driver in the guest should have all the info (e.g.
OpRegion tables) it needs to drive the GPU. Interestingly, running
i915 in the VM causes the VM kernel to crash at random code paths
unless I wait until after system startup to modprobe i915. The VM
doesn't crash at all if I disable i915. These crashes happen well
after i915 is done trying to initialize the GPU, so not sure if i915
is touching memory it shouldn't be or what..

Thanks,
Micah

KERNEL CONSOLE (modified for brevity):
localhost ~ # qemu-system-x86_64 -serial mon:stdio -m 2G -smp 2 -M pc
-vga none -usbdevice tablet -cpu host,-invpcid,-tsc-deadline,check
-drive 
'file=/mnt/stateful_partition/chromiumos_test_image.bin,index=0,media=disk,cache=unsafe,format=raw'
-enable-kvm -device
vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,rombar=0
-device 'virtio-net,netdev=eth0' -netdev
'user,id=eth0,net=10.0.2.0/27,hostfwd=tcp:127.0.0.1:9222-:22'
qemu-system-x86_64: -usbdevice tablet: '-usbdevice' is deprecated,
please use '-device usb-...' instead
qemu-system-x86_64: -device
vfio-pci,x-igd-opregion=on,host=00:02.0,id=hostdev0,bus=pci.0,addr=0x2,rombar=0:
IGD device :00:02.0 has no ROM, legacy mode disabled
VNC server running on 127.0.0.1:5900
[0.00] Linux version 4.14.114
(mort...@mortonm2.mtv.corp.google.com) (Chromium OS
9.0_pre353983_p20190325-r11 clang version 9.0.0
(/var/cache/chromeos-cache/distfiles/host/egit-src/clang.git
171531e31716e2db2c372cf8b57220ddf9e721d8)
(/var/cache/chromeos-cache/distfiles/host/egit-src/llvm.git
5077597e0d5b86d9f9c27286d8b28f8b3645a74c) (based on LLVM 9.0.0svn))
#14 SMP PREEMPT Fri May 31 09:50:35 PDT 2019
[0.00] Command line: BOOT_IMAGE=vmlinuz.A init=/sbin/init
boot=local rootwait ro noresume noswap loglevel=7 noinitrd
console=ttyS0 disablevmx=off
root=PARTUUID=60B83A78-8581-014B-8942-6128789234C3 i915.modeset=1
cros_legacy cros_debug

[snip]

[0.00] Reserving Intel graphics memory at [mem 0x7c00-0x7fff]

[snip]

[0.415534] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
[0.416418] [drm:i915_driver_load] Assuming SunrisePoint PCH
[0.417296] [drm:intel_power_domains_init] Allowed DC state mask 03
[0.418290] [drm:intel_device_info_dump] i915 device info:
platform=KABYLAKE gen=9 pciid=0x591e rev=0x02
[0.418292] [drm:intel_device_info_dump] i915 device info: is_mobile: no
[0.419684] [drm:intel_device_info_dump] i915 device info: is_lp: no
[0.420740] [drm:intel_device_info_dump] i915 device info:
is_alpha_support: no
[0.421712] [drm:intel_device_info_dump] i915 device info:
has_64bit_reloc: yes
[0.422806] [drm:intel_device_info_dump] i915 device info:
has_aliasing_ppgtt: yes
[0.423900] [drm:intel_device_info_dump] i915 device info: has_csr: yes
[0.425036] [drm:intel_device_info_dump] i915 device info: has_ddi: yes
[0.426033] [drm:intel_device_info_dump] i915 device info: has_dp_mst: yes
[0.427040] [drm:intel_device_info_dump] i915 device info:
has_reset_engine: yes
[0.428076] [drm:intel_device_info_dump] i915 device info: has_fbc: yes
[0.429180] [drm:intel_device_info_dump] i915 device info: has_fpga_dbg: yes
[0.430181] [drm:intel_device_info_dump] i915 device info:
has_full_ppgtt: yes
[0.431726] [drm:intel_device_info_dump] i915 device info:
has_full_48bit_ppgtt: yes
[0.432810] [drm:intel_device_info_dump] i915 device info:
has_gmch_display: no
[0.433963] [drm:intel_device_info_dump] i915 device info: has_guc: yes
[0.435059] [drm:intel_device_info_dump] i915 device info: has_guc_ct: no
[0.436061] [drm:intel_device_info_dump] i915 device info: has_hotplug: yes
[0.437087] [drm:intel_device_info_dump] i915 device info: has_l3_dpf: no
[0.438136] [drm:intel_device_info_dump] i915 device info: has_llc: yes
[0.439159] [drm:intel_device_info_dump] i915 device info:
has_logical_ring_contexts: yes
[0.440158] [drm:intel_device_info_dump] i915 device info:
has_logical_ring_preemption: yes
[0.441370] [drm:intel_device_info_dump] i915 device info: has_overlay: no
[0.442604] [drm:intel_device_info_dump] i915 device info: has_pipe_cxsr: no
[0.443636]