Hi Sanjeev,

On 5/16/24 11:22 AM, Sanjeev Kumar wrote:
Hi Philippe,
I have taken patches from the link you provided
and built QEMU and started appending below line to QEMU

-chardev socket,path=/tmp/ivshmem_socket,id=ivshmem_flat -device 
ivshmem-flat,chardev=ivshmem_flat,x-irq-qompath='/machine/unattached/device[4]/gic/unnamed-gpio-in[0]',x-bus-qompath='/sysbus'

and QEMU boots without any error

I would like to get some help regarding data writing and reading from shared 
memory.

when using ivshmem-plain, i used to write data from host like
echo "hello" > /dev/shm/shm1 and in guest i was reading from pci bus BAR and i 
was able to get data.

similarly can you please help me with ivshmem-flat like where is the location 
to write/read the data from host and in guest.

Writing/reading from the host must work the same way as in ivshmem PCI. It's
ultimately the ivshmem-server's duty to create, map, and distribute the file
descriptors to the VMs (guests), so nothing changes. I haven't tried it tho,
I testes it directly writing it from the other guest running Linux with ivshmem
PCI attached. But, it should work the same, yep.

I don't know anything about QNX, but if you have access to real addresses, this
would work the same as in Zephyr (where I tested it). You just need to pass to
the ivshmem-flat driver the address where you want to map the shm and the MMRs
using the x-bus-address-shmem and the x-bus-address-iomem, respectively, like,
for instance:

x-bus-address-iomem=0x400FF000,x-bus-address-shmem=0x40100000

then you can read/write directly from/to the address specified in by
x-bus-address-shmem that data will appear in the other peers (guests)
and also should be able to get accessed from the host as well.

For instance, in Zephyr I used the following test to exercise ivshmem-flat
from the Cortex-M guest, which has the addresses hardcoded and uses them
directly:

https://github.com/gromero/zephyr/commit/73fbd481e352b25ae5483ba5048a2182b90b7f00#diff-16fa1f481a49b995d0d1a62da37b9f33033f5ee477035e73465e7208521ddbe0R9-R96


HTH,
Gustavo

Reply via email to