On 2018-05-04 22:56, Giovani Gracioli wrote: > Thanks Jan. > > By changing the bar_mask and having the two vpci devices mapped in different > pages, I was able to run it. > > Can you please explain how the bar mask is used to define the address in > which the device is mapped to?
That's mostly PCI magic: The mask defines the unmodifiable bits in the BARs (each set bit in the mask makes the corresponding BAR bit modifiable). The OS uses that to explore the size of the region that the BAR locates: It writes all-1s into the BAR and reads the result back. Now, size = ~result + 1. BTW, I have https://github.com/siemens/jailhouse/commit/0c8611329f11f6ff508d1eb08e6ffc9490bbfe6c pending in https://github.com/siemens/jailhouse/commits/wip/ivshmem2 that allows to map some of the IVSHMEM registers to userspace without compromising the guest. That patch has some incompatible register layout changes as dependency, so it's not upstream yet. Jan > > Giovani > >> On 2018-05-04 16:59, Giovani Gracioli wrote: >>> Maybe the problem is with the Linux side and/or UIO driver, because when I >>> start both cell, I can see that both send interrupts to Linux and they are >>> received. However, Linux can only send interrupts to cell 1. >> >> The UIO setup is not mature on ARM yet, that's why I was pointing to the >> ivshmem-net scenario. There might be issues remaining. >> >>> >>> I also did an user space program that maps the PCI regions using mmap and >>> sends interrupts through the mapped addresses. I can map region 1 >>> (0xfc100000) with size 0x100 without program, but for region 2 (0xfc100100) >>> I can only map using size 4096. With size 0x100, I get an invalid mapping >>> from mmap (maybe some align problem?). Using 4096 in region 2, I can issue >>> an interrupt, but it is sent to cell 1, instead of cell 2. >> >> Memory mappings have to be page-aligned, /wrt the size and start >> address. In order to make Linux reserve a full page for an MMIO resource >> of some device (so that it can be handed out to userspace separately), >> tune the bar_mask for the respective region. 0xfffff000, 0xffffffff, ... >> should do the trick here. >> >> Jan >> >> -- >> Siemens AG, Corporate Technology, CT RDA IOT SES-DE >> Corporate Competence Center Embedded Linux > -- 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.
