Hi,

On 09/11/2020 00:04, Jan Kiszka wrote:
> On 04.11.20 16:36, Andrea Bastoni wrote:
>> I.MX8QM fixed mask is factored-in into the stream_ids.
>>
>> Signed-off-by: Andrea Bastoni <[email protected]>
>> ---
>>  configs/arm64/imx8qm.c          | 6 ++++--
>>  hypervisor/arch/arm64/smmu.c    | 3 ---
>>  include/jailhouse/cell-config.h | 4 ----
>>  3 files changed, 4 insertions(+), 9 deletions(-)
>>
>> diff --git a/configs/arm64/imx8qm.c b/configs/arm64/imx8qm.c
>> index d63c73cf..566fd0ad 100644
>> --- a/configs/arm64/imx8qm.c
>> +++ b/configs/arm64/imx8qm.c
>> @@ -54,7 +54,6 @@ struct {
>>                                      .type = JAILHOUSE_IOMMU_ARM_MMU500,
>>                                      .base = 0x51400000,
>>                                      .size = 0x40000,
>> -                                    .arm_mmu500.sid_mask = 0x7f80,
>>                              },
>>                      },
>>  
>> @@ -209,6 +208,9 @@ struct {
>>      },
>>  
>>      .stream_ids = {
>> -            0x11, 0x12, 0x13,
>> +            /* bits 30 - 16: SMR MASK
>> +             * bits 14 - 0 : SMR ID
>> +             */
>> +            0x7f80011, 0x7f80012, 0x7f80013,
>>      },
>>  };
>> diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c
>> index 191ff154..d2824985 100644
>> --- a/hypervisor/arch/arm64/smmu.c
>> +++ b/hypervisor/arch/arm64/smmu.c
>> @@ -157,7 +157,6 @@ struct arm_smmu_device {
>>      unsigned long                   pgshift;
>>      u32                             num_context_banks;
>>      u32                             num_mapping_groups;
>> -    u16                             arm_sid_mask;
>>      struct arm_smmu_smr             *smrs;
>>  };
>>  
>> @@ -564,8 +563,6 @@ static int arm_smmu_init(void)
>>                      continue;
>>  
>>              smmu = &smmu_device[num_smmu_devices];
>> -            smmu->arm_sid_mask = iommu->arm_mmu500.sid_mask;
>> -
>>              smmu->base = paging_map_device(iommu->base, iommu->size);
>>              if (!smmu->base) {
>>                      err = -ENOMEM;
>> diff --git a/include/jailhouse/cell-config.h 
>> b/include/jailhouse/cell-config.h
>> index 472cb4bb..d6315489 100644
>> --- a/include/jailhouse/cell-config.h
>> +++ b/include/jailhouse/cell-config.h
>> @@ -279,10 +279,6 @@ struct jailhouse_iommu {
>>                      __u64 tlb_base;
>>                      __u32 tlb_size;
>>              } __attribute__((packed)) tipvu;
>> -
>> -            struct {
>> -                    __u32 sid_mask;
>> -            } __attribute__((packed)) arm_mmu500;
>>      };
>>  } __attribute__((packed));
>>  
>>
> 
> This concept of masking it SMMUv2-specific? Or would it be worth to
> introduce it generically, e.g. by using a 32-bit mask?

To my understanding this is a specialty of the SMMUv2, but I couldn't find many
details on the PVU.

> If not, then we should model a stream ID entry via a union, something
> like this:
> 
> union jailhouse_stream_id {
>       u32 long_id;
>       struct {
>               u16 id;
>               u16 mask;
>       } __attribute__((packed)) mmu500;
> } __attribute__((packed));

This makes the SMMUv2 specification clearer, but it makes somehow longer the
configuration for v3 and PVU. (I assume you want to convert all u32 stream_ids[]
into union jailhouse_stream_id stream_ids[].)

The alternative struct jailhouse_mmu500_stream_id is even worse for maintenance
in the long term.

-- 
Thanks,
Andrea Bastoni

-- 
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/96d07bef-e970-c199-50fc-c9541790f1c3%40tum.de.

Reply via email to