Hi Gustavo, I understood difference between the two patchsets. thanks for the ivshmem-flat. i will try to get info from QNX side how to access the memory location in QNX. with the ivshmem-flat enabled, i am able to see shmem in "info qtree" as below (qemu) info qtree bus: main-system-bus type System dev: ivshmem-flat, id "" gpio-out "sysbus-irq" 1 chardev = "ivshmem_flat" shmem-size = 4194304 (0x400000) x-irq-qompath = "/machine/unattached/device[4]/gic/unnamed-gpio-in[0]" x-bus-address-iomem = 1074786304 (0x400ff000) x-bus-address-shmem = 1074790400 (0x40100000) mmio 00000000400ff000/0000000000000010 mmio 0000000040100000/0000000000400000
now need to explore in guest os(QNX) on how to read this memory location. On Thu, May 16, 2024 at 11:35 PM Sanjeev Kumar <reachsanje...@gmail.com> wrote: > Hi Gustavo, > Thanks for your reply. Will try it out. > But i see two set of patches. > > https://lore.kernel.org/qemu-devel/20240222222218.2261956-1-gustavo.rom...@linaro.org/ > > And > > > https://lore.kernel.org/qemu-devel/20231127052024.435743-2-gustavo.rom...@linaro.org/ > > First one looks latest. But when i use them, it is throwing error of > property is missing > > x-bus-qompath > > Please check and let me know which is correct patchset to use. > > Thanks & Regards > > On Thu, 16 May 2024 at 3:59 PM, Gustavo Romero <gustavo.rom...@linaro.org> > wrote: > >> 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 >> >