On 25.01.19 05:23, [email protected] wrote:
> Hello,
> 
> I've properly built Jailhouse Images and got Jailhouse running in QEMU with 
> qemu-x86.cell running as the root cell and ivshmem-demo.cell running as the 
> inmate. I'm able to establish a shared memory connection over PCI, like so:
> 
> Shared memory connection established: "ivshmem-demo" <--> "QEMU-VM" Created 
> cell "ivshmem-demo" Page pool usage after cell creation: mem 291/974, remap 
> 65543/131072 Cell "ivshmem-demo" can be loaded Started cell "ivshmem-demo" 
> CPU 2 received SIPI, vector 100 IVSHMEM: Found 1af4:1110 at 00:0f.0 IVSHMEM: 
> shmem is at 0x000000003f1ff000 IVSHMEM: bar0 is at 0x000000003f200000 
> IVSHMEM: bar2 is at 0x000000003f201000 IVSHMEM: mapped the bars got position 
> 1 IVSHMEM: 00:0f.0 sending IRQ IVSHMEM: 00:0f.0 sending IRQ IVSHMEM: 00:0f.0 
> sending IRQ ...
> 
> So now, it's just a matter of loading a device driver kernel module in the 
> QEMU root cell that can read from the vshmem PCI device, right? Then will I 
> be able to see the "Hello From IVSHMEM " output from the vshmem-demo inmate?
> 
> I've read Documentation/inter-cell-communication.txt and tried building the 
> uio_vshmem.c kernel module from 
> https://github.com/henning-schild-work/ivshmem-guest-code. However, I am 
> getting these errors:
> 
> `WARNING: "__uio_register_device" 
> [/root/ivshmem-guest-code/kernel_module/uio/uio_ivshmem.ko] undefined!` 
> `WARNING: "uio_unregister_device" 
> [/root/ivshmem-guest-code/kernel_module/uio/uio_ivshmem.ko] undefined!`
> 
> So naturally, this also fails:
> 
> $ insmod uio_ivshmem.ko $ insmod: ERROR: could not insert module 
> uio_ivshmem.ko: Uknown symbol in module
> 
> Now, I already have the kernel headers installed from the Jailhouse Images 
> output, so that I can properly build Jailhouse and other kernel modules 
> inside the QEMU image (see 
> https://groups.google.com/d/msg/jailhouse-dev/hV-5AkuZqbg/0s6IvAFoGgAJ).
> 
> Make seems to find the linux headers just fine (they are at 4.14.73). But
> I'm confused: why won't it build? Shouldn't the UIO stuff be there? Do the
> kernel configs need to be altered? I see this:
> 
> $ zcat /proc/config.gz | grep -i uio # CONFIG_UIO is not set

If you are on jailhouse-images, there is actually CONFIG_UIO=y or =m
missing. We should improve that:

diff --git a/recipes-kernel/linux/files/x86-64_defconfig_4.19
b/recipes-kernel/linux/files/x86-64_defconfig_4.19
index f15d0a4..acb8b78 100644
--- a/recipes-kernel/linux/files/x86-64_defconfig_4.19
+++ b/recipes-kernel/linux/files/x86-64_defconfig_4.19
@@ -3367,7 +3367,7 @@ CONFIG_RTC_MC146818_LIB=y
 CONFIG_SYNC_FILE=y
 # CONFIG_SW_SYNC is not set
 # CONFIG_AUXDISPLAY is not set
-# CONFIG_UIO is not set
+CONFIG_UIO=m
 # CONFIG_VFIO is not set
 CONFIG_VIRT_DRIVERS=y
 CONFIG_JAILHOUSE_DBGCON=y

> 
> However, this builds fine on my Kubuntu 18.04 machine, and I see:
> 
> $ less /boot/config-4.15.0-29-generic | grep -i uio CONFIG_UIO=m 
> CONFIG_UIO_CIF=m CONFIG_UIO_PDRV_GENIRQ=m CONFIG_UIO_DMEM_GENIRQ=m 
> CONFIG_UIO_AEC=m CONFIG_UIO_SERCOS3=m CONFIG_UIO_PCI_GENERIC=m 
> CONFIG_UIO_NETX=m CONFIG_UIO_PRUSS=m CONFIG_UIO_MF624=m 
> CONFIG_UIO_HV_GENERIC=m CONFIG_COMEDI_PCMUIO=m
> 
> At this point, it almost seems easier to figure out how to create an actual 
> simple PCI driver from scratch than to get this to work with the UIO 
> framework, since I can't find hardly any documentation on UIO... Also, I'm 
> not very excited about rebuilding the Linux kernel. But if there is a quick 
> fix, I'm all ears.

I would recommend to invest that 10 or 15 minutes to rebuild your image with a
kernel that support UIO and can also run the reference ivshmem demos. As the
current ivshmem interface is still subject to be evolved / changed, I was
reluctant to integrate the related demos into our demo images, but we could
reconsider that.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to