On 08.06.20 13:16, Jan Kiszka wrote:
> On 08.06.20 12:42, [email protected] wrote:
>> From: Nikhil Devshatwar <[email protected]>
>>
>> Add a new IVSHMEM PCIe virtual device for a 2 peer
>> IVSHMEM demo communication.
>>  (0 = root cell, 1 = baremetal / linux-demo)
>> Also add the corresponding memory regions for state and output
>> aligned at 64k boundary.
>>
>> Update the bdf numbers for consistency across all platforms.
>> Assign domain = 4 since the platform already has 4 physical
>> controllers.
>>
>> Signed-off-by: Nikhil Devshatwar <[email protected]>
>> ---
>>  configs/arm64/k3-j721e-evm-linux-demo.c | 52 ++++++++++++++++++++----
>>  configs/arm64/k3-j721e-evm.c            | 53 ++++++++++++++++++++-----
>>  2 files changed, 89 insertions(+), 16 deletions(-)
>>
>> diff --git a/configs/arm64/k3-j721e-evm-linux-demo.c 
>> b/configs/arm64/k3-j721e-evm-linux-demo.c
>> index cda1614a..05517751 100644
>> --- a/configs/arm64/k3-j721e-evm-linux-demo.c
>> +++ b/configs/arm64/k3-j721e-evm-linux-demo.c
>> @@ -24,9 +24,9 @@
>>  struct {
>>      struct jailhouse_cell_desc cell;
>>      __u64 cpus[1];
>> -    struct jailhouse_memory mem_regions[18];
>> +    struct jailhouse_memory mem_regions[22];
>>      struct jailhouse_irqchip irqchips[4];
>> -    struct jailhouse_pci_device pci_devices[1];
>> +    struct jailhouse_pci_device pci_devices[2];
>>      __u32 stream_ids[2];
>>  } __attribute__((packed)) config = {
>>      .cell = {
>> @@ -56,8 +56,35 @@ struct {
>>      },
>>  
>>      .mem_regions = {
>> -            /* IVSHMEM shared memory region for 00:01.0 */
>> -            JAILHOUSE_SHMEM_NET_REGIONS(0x89fe00000, 1),
>> +            /* IVSHMEM shared memory regions for 00:00.0 (demo) */
>> +            {
>> +                    .phys_start = 0x89fe00000,
>> +                    .virt_start = 0x89fe00000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe10000,
>> +                    .virt_start = 0x89fe10000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED |
>> +                             JAILHOUSE_MEM_WRITE ,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe20000,
>> +                    .virt_start = 0x89fe20000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe30000,
>> +                    .virt_start = 0x89fe30000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED |
>> +                             JAILHOUSE_MEM_WRITE ,
>> +            },
> 
> You are missing the state table. Was this tested?

Ah, it's there, just 64K large due to the different page size.

> 
> Please derive from existing examples, using the same patterns and sizes.
> Reference is qemu-arm64.

Still, please follow the default pattern (with adjusted page size),
which means triangle by default, 3 peers. That may eventually become
part of an automated test, and then all boards should better have the
same pattern ready.

Jan

> 
> Jan
> 
>> +            /* IVSHMEM shared memory regions for 00:01.0 (networking) */
>> +            JAILHOUSE_SHMEM_NET_REGIONS(0x89fe40000, 1),
>>              /* ctrl mmr */ {
>>                      .phys_start = 0x00100000,
>>                      .virt_start = 0x00100000,
>> @@ -210,13 +237,24 @@ struct {
>>      },
>>  
>>      .pci_devices = {
>> -            /* 00:01.0 */ {
>> +            /* 00:00.0 (demo) */ {
>>                      .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
>> -                    .bdf = 1 << 3,
>> -                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
>> +                    .domain = 4,
>> +                    .bdf = 0 << 3,
>> +                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K,
>>                      .shmem_regions_start = 0,
>>                      .shmem_dev_id = 1,
>>                      .shmem_peers = 2,
>> +                    .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
>> +            },
>> +            /* 00:01.0 (networking) */ {
>> +                    .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
>> +                    .domain = 4,
>> +                    .bdf = 1 << 3,
>> +                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K,
>> +                    .shmem_regions_start = 4,
>> +                    .shmem_dev_id = 1,
>> +                    .shmem_peers = 2,
>>                      .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
>>              },
>>      },
>> diff --git a/configs/arm64/k3-j721e-evm.c b/configs/arm64/k3-j721e-evm.c
>> index 3ac0b57e..41f4c456 100644
>> --- a/configs/arm64/k3-j721e-evm.c
>> +++ b/configs/arm64/k3-j721e-evm.c
>> @@ -19,9 +19,9 @@
>>  struct {
>>      struct jailhouse_system header;
>>      __u64 cpus[1];
>> -    struct jailhouse_memory mem_regions[36];
>> +    struct jailhouse_memory mem_regions[40];
>>      struct jailhouse_irqchip irqchips[6];
>> -    struct jailhouse_pci_device pci_devices[1];
>> +    struct jailhouse_pci_device pci_devices[2];
>>      __u32 stream_ids[30];
>>  } __attribute__((packed)) config = {
>>      .header = {
>> @@ -44,7 +44,7 @@ struct {
>>                      .pci_mmconfig_base = 0x76000000,
>>                      .pci_mmconfig_end_bus = 0,
>>                      .pci_is_virtual = 1,
>> -                    .pci_domain = 3,
>> +                    .pci_domain = 4,
>>                      .iommu_units= {
>>                              {
>>                                      .type = JAILHOUSE_IOMMU_SMMUV3,
>> @@ -97,8 +97,33 @@ struct {
>>      },
>>  
>>      .mem_regions = {
>> -            /* IVSHMEM shared memory region for 00:01.0 */
>> -            JAILHOUSE_SHMEM_NET_REGIONS(0x89fe00000, 0),
>> +            /* IVSHMEM shared memory regions for 00:00.0 (demo) */
>> +            {
>> +                    .phys_start = 0x89fe00000,
>> +                    .virt_start = 0x89fe00000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe10000,
>> +                    .virt_start = 0x89fe10000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe20000,
>> +                    .virt_start = 0x89fe20000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
>> +            },
>> +            {
>> +                    .phys_start = 0x89fe30000,
>> +                    .virt_start = 0x89fe30000,
>> +                    .size = 0x10000,
>> +                    .flags = JAILHOUSE_MEM_READ,
>> +            },
>> +            /* IVSHMEM shared memory regions for 00:01.0 (networking) */
>> +            JAILHOUSE_SHMEM_NET_REGIONS(0x89fe40000, 0),
>>              /* ctrl mmr */ {
>>                      .phys_start = 0x00100000,
>>                      .virt_start = 0x00100000,
>> @@ -374,14 +399,24 @@ struct {
>>      },
>>  
>>      .pci_devices = {
>> -            /* 0003:00:01.0 */ {
>> +            /* 00:00.0 (demo) */ {
>>                      .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
>> -                    .domain = 3,
>> -                    .bdf = 1 << 3,
>> -                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
>> +                    .domain = 4,
>> +                    .bdf = 0 << 3,
>> +                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K,
>>                      .shmem_regions_start = 0,
>>                      .shmem_dev_id = 0,
>>                      .shmem_peers = 2,
>> +                    .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
>> +            },
>> +            /* 00:01.0 (networking) */ {
>> +                    .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
>> +                    .domain = 4,
>> +                    .bdf = 1 << 3,
>> +                    .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K,
>> +                    .shmem_regions_start = 4,
>> +                    .shmem_dev_id = 0,
>> +                    .shmem_peers = 2,
>>                      .shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
>>              },
>>      },
>>
> 


-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/7c48aaa9-a5e1-4f1f-8947-a0f297d07354%40siemens.com.

Reply via email to