On Sun, 2017-08-06 at 07:58 -0400, Jan Kiszka wrote:
> On 2017-08-05 02:59, Pontes, Otavio wrote:
> > Hi,
> >
> > I am using jailhouse in an Intel x86 hardware and I am having some
> > problems to start ivshmem-net driver in a root cell, in order to
> > communicate with a Linux inmate cell.
> > I have successfully use this driver to stablish a communication
> > between
> > two Linux inmate cells, but the driver fails when I load it in the
> > root
> > cell.
> > Can anyone help me in understanding this issue and debbuging the
> > problem?
> >
> > In the root cell configuration file I have addeded the following:
> >
> > mem_regions:
> > /* IVSHMEM shared memory region (networking) */
> > {
> > .phys_start = 0x3f100000,
> > .virt_start = 0x3f100000,
> > .size = 0xff000,
> > .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
> > JAILHOUSE_MEM_ROOTSHARED,
> > },
> >
> > pci_devices:
> > /* IVSHMEM (networking) */
> > {
> > .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
> > .domain = 0x0000,
> > .bdf = 0x0f << 3, //This doesn't conflict with other bdf
> > .bar_mask = {
> > 0xffffff00, 0xffffffff, 0x00000000,
> > 0x00000000, 0xffffffe0, 0xffffffff,
> > },
> > .num_msix_vectors = 1,
> > .shmem_region = 0, //This is pointing to the mem_region
> > above
> > .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
> > },
> >
> > And when I run:
> > $ ./tools/jailhouse enable configs/root.cell
> >
> > The driver ivshmem-net is loaded and the following message is
> > printed
> > in the kernel log
> > [ 20.956367] ivshmem-net 0000:00:0f.0: invalid IVPosition -1
> >
> > I noticed when I was debbuging this issue that the function
> > ivshmem_register_mmio is not called when ivshmem-net driver tries
> > to
> > get the ivpos value. I suspected then that value of bar0_address
> > and
> > bar4_address may be wrong. Is there an way to know what would be
> > the
> > expected value for this addresses? Or is there any other thing I
> > should
> > check to try to debug this?
>
> If that function isn't called, the guest may not have enabled the
> virtual PCI device properly (trapped by ivshmem_write_command), or
> the
> address it programmed into that BARs is not trapped by the Jailhouse
> configuration for that cell - IOW, the config maps it to something
> real.
Hi,
Thank you for your answer. I found what was the problem in my tests and
I could have ivshmem-net working fine. The address programmed in the
BAR was not being trapped by jailhouse because of one problem in the
generated configuration file for the root cell.
The jailhouse-config-create script always assume that memregions are
aligned in one page, so it rounds up the memregion size to 0x1000. The
problem I am facing is that I have one PCI device that was being mapped
in a region with size 0x800 and the ivshmem pci device was mapped to
use a memory just after the end of this device. So jailhouse was
assuming that the memory region used by ivshmem was being used by a
physical pci device and it was not handling the IO. If I change the
root cell config file to use the correct size for the physical PCI
device, everything works perfectly.
I took a look at the kernel code and it is not necessarily aligning the
PCI resource memory from 2 different devices that are in the same bus
in different pages. So rounding the memregion size in config-create
doesn't look correct to me. But I imagine that not having this would
cause performance issues.
Isn't this a possible problem for other PCI devices that have small
resources that are not aligned in a page? Do you have any suggestion on
how to fix this? I couldn't find a way to force the ivshmem pci device
to have its resources to be page aligned, but if there is a way, it is
a possible solution.
Thanks,
Otavio
--
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.