Am Wed, 29 Aug 2018 17:10:29 -0700 schrieb <[email protected]>:
> Hi Jailhouse team, > > I have been working with getting memory sharing working on the TX2, > and I am facing a strange issue. I am working with the > ivshmem-guest-code. I am able to get send and receive interrupts on > both the root and the non-root cell, as well as write in the shared > memory region without issue from the non-root cell. However, I am > having trouble reading from the shared memory using the shmem_test.py > example from the ivshmem-guest-code > (https://github.com/henning-schild-work/ivshmem-guest-code/blob/jailhouse/tests/shmem_test.py). > > > I am writing "Hello From IVSHMEM " in the cell, and incrementing the > last character, as done in the x86 example. There are also some old but unfished patches around, that bring the ivshmem demo to arm and arm64. You can find them in the archive. > If I use the cell as it is now, with the default m.read(30), I get a > core dump. If I call m.read(16), I get "Hello from IVSHM", but if I > call any more than 16, I get a core dump. If I read any less > characters, it just truncates the string to that number of characters. The python scripts are not tested and potentially not working. The two supported tools are mentioned in README.jailhouse. They are written in C. The python code could not work on x86 and older versions of jailhouse, but for you it could work. > Also, from the script, I am not sure where the 4096 offset came from, > but it seems to be working fine. That is because the shared memory is the second ressouce in the uio-file. The first one (registers) is not 4096 long but there is some page alignment happening. But as far as i remember that changed some day, either with Linux or python changing major versions. So you could try 256 instead or python2/3 > Can you please explain briefly the correct process for reading and > writing to the shared memory region? I have tried to learn from > forum posts and examples, but I just can't seem to find a solid > resource for the subject. The most solid resource is the network driver in the jailhouse kernel tree: http://git.kiszka.org/?p=linux.git;a=shortlog;h=refs/heads/queues/jailhouse Look for ivshmem-net The ivshmem-demo shows all the features in a raw cell. And the ivshmem-guest-code repo contains a lot of stuff that distacts and should not be there. Cleaning up in the jailhouse branch would be another todo. > I have been able to just read the shared memory addresses directly > and use the interrupts to determine when the addresses are not being > used by the other cell, but this does not seem like the optimal way > to do it. The Python code seems to access it through the virtual PCI > device, but gives very little documentation as to how that process > works. The uio driver takes the pci device and makes it accessable in userspace. To figure out how that works, read up on uio and have a look at the driver to see which pci ressources are put where in the file. Henning -- 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.
