QEMU for iMX8QM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QEMU for iMX8QM

4,120 Views
lchen
Contributor III

Hi,

We have iMX8QM MEK boards, but still need emulator for it. Is QEMU supported for this board?

 

Thanks,

Lijun

0 Kudos
Reply
7 Replies

3,306 Views
jsah
Contributor I

A bit long post so bare with me.

I've managed to pass through the ethernet adapter of imx8qm but the adater is not yet fully functional in guest. The problem has been identified to ethernet device interrupts not firing. The device is detected correctly by our qemu KVM guest with correct MAC address and so on. The link can be turned on/off and link speed can be changed with ifconfig & ethtool so somethings are working.

On the host device tree i've setup fec1, fec2, enet0_lpcg enet1_lpcg and lsio_mu2 devices to a same vfio group for passthrough. The device driver was removed from host to prevent it from loading and the fec device compatible was set to "fsl,dummy". The device status was set "okay" to allow the device to be seen and passed trough by host. Some of the properties (power-domains, clocks, clock-names, assigned-clocks, assigned-clock-rates, pinctrl-0, phy-supply) were deleted from host devicetree to prevent uboot from changing the device configuration on the fly.

Also the lsio_mu2 device needed to be activated on host devicetree similar as was done in xen config adding "IMX_SC_R_MU_2A" tag to init_on_rsrcs list to get lsio_mu2 activated. The passed through device identifiers "IMX_SC_R_MU_2A", "IMX_SC_R_ENET_0" and "IMX_SC_R_ENET_1" need to be passed to rsrcs list to get the devices reserved to guest VM.

See: https://community.nxp.com/t5/i-MX-Processors/imx8qm-enable-lsio-mu2/td-p/1469782


As for the guest VM device tree the SCU device needs to use lsio_mu2 instead of the default (mu1). The passed through devices along with their requirements (some clock devices and most of scu content) needs to be added to the default QEMU KVM device trees platform bus path (platform@c000000 by default). The interrupts need to be updated to match the ones which are used in QEMU passthroug (starting from 0x70...). The order of the interrupts is a bit unclear for me but I'm assuming the order is based on in which order the devices are passed through to QEMU on command line.

In my current setup the lsio_mu2 does get a few interrupts but the ethernet devices do not get any and the ethernet connection remains unresponsive. However the link can be turned on/off and link speed can be changed with ifconfig & ethtool so somethings are working.

I think the interrupts are missing because I have been unable to disable ethernet from uboot which causes Uboot to take over and activate the ethernet adapter at boot.

Any hints how to conpletely disable network from or even before uboot?
Also the driver/device does not seem to support device reset which may have an effect on the device not being in the initial state when the driver is loaded at guest. Is there a way to force the ethernet device to reset?

0 Kudos
Reply

4,114 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Ichen,

If QEMU support armv8 architecture then it support the MX8QM.

Regards

0 Kudos
Reply

4,112 Views
lchen
Contributor III

Thanks, that is a good news.

When I search around I found a similar question raised 3 years ago:

https://community.nxp.com/t5/i-MX-Processors/QEMU-for-imx8/td-p/745356

The answer is qemu is not supported for i.MX platforms. I assume things have changed, now QEMU is supported for imx8 family?

Thanks,

Lijun

0 Kudos
Reply

4,104 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Not officially supported but  i.MX8QM GPU could be passed through to a VM using XEN. We have internally not tried KVM VFIO, but technically it should be ok to passthrough GPU to a KVM VM.

Regards

0 Kudos
Reply

3,735 Views
kaartine
Contributor I

Has anyone been able to do passthrough with ethernet device or gpu?

KVM starts fine.

I'm trying to do vfio-platform passthrough for enternet device. Has anyone been able to do it?

I'm able to bind driver and create the /dev/vfio/<device> but I don't know what to put into the guesVM/host device tree(s) so that the fec driver would be able to use the device.

0 Kudos
Reply

3,929 Views
lorenzo_giraudi
Contributor III

Hello, I am also interested in this topic. 

What you have said here is not clear to me. Are there any instructions?

0 Kudos
Reply

3,733 Views
kaartine
Contributor I

I have disabled the 5b040000.ethernet from the device-tree of the host.

Then I'm binding vfio-platform driver for this device like this:

echo 1 > /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts
echo vfio-platform > /sys/bus/platform/devices/5b040000.ethernet/driver_override
echo 5b040000.ethernet > /sys/bus/platform/drivers/vfio-platform/bind


This will create the /dev/vfio/<#> in my case /dev/vfio/3 device that 
qemu option

-device vfio-platform,host=5b040000.ethernet

will use.

This is not enough since I also need to pass custom dtb because kernel lacks of support dynamically creating device node for this device. But I don't know how to make correct dtb  

0 Kudos
Reply