On 08.06.20 16:35, Nikhil Devshatwar wrote:
> 
> 
> On 08/06/20 7:54 pm, Jan Kiszka wrote:
>> On 08.06.20 13:43, Nikhil Devshatwar wrote:
>>> On 08/06/20 4:51 pm, Jan Kiszka wrote:
>>>> 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.
>>> j721e has only two A72 cores. So max two cells can be created.
>>> linux-demo and inmate-demo are mutually exclusive.
>> Oh, sorry, missed that completely. I was expecting a quad-core at least.
>>
>>> That's why I have given the same id to both because I can never launch
>>> it in parallel.
>>>
>>> Do you recommend to still give a separate id for these cells?
>> Nope, that's fine then.
>>
>> But now I wonder why we need to patch any of the demo code. If both do
>> respect the max-peers value and send to (my-id + 1) % max-peers, they
>> should "just work", no?
> Same reason as before.
> To be able to choose whom exactly you want to send interrupt.
> Triangle is only for demo, but this way, you can send interrupts to any
> device.

If there can only be two cells at the same time, root cell always in,
it's about root cell sending ID 1, and ID-1 cell sending root cell. Now
both demos encode hard that max-peers is 3. That can be fixed (i.e. read
the related ivshmem register), and then things will just work (TM). No
command line switched needed. They would only be needed if you had a
setup with less than max-peers, but that is not the issue here.

Jan

-- 
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/efc83a49-18e2-14b9-e581-7eef91766d80%40siemens.com.

Reply via email to