On 02.10.20 12:04, Jan Kiszka wrote:
> On 28.09.20 08:20, Jan Kiszka wrote:
>> On 28.09.20 07:57, Jan Kiszka wrote:
>>>>>>
>>>>>> You could try to not bypass SMMU transition in smmu driver, then the
>>>>>> system might not work well.
>>>>>
>>>>> Where is this bypass controlled? In the SMMU settings? Or is that
>>>>> platform-specific?
>>>>
>>>> S2CR_TYPE_BYPASS, smmu settings currently.
>>>
>>> Just flipping the type does not seem to be enough. Could you tell me
>>> what is needed to switch to "block what is is not permitted"?
>>
>> Looking at the kernel, these two changes are apparently needed:
>>
>> diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c
>> index 69374b28..ea58340d 100644
>> --- a/hypervisor/arch/arm64/smmu.c
>> +++ b/hypervisor/arch/arm64/smmu.c
>> @@ -534,7 +534,7 @@ static int arm_smmu_device_reset(struct arm_smmu_device 
>> *smmu)
>>
>>      /* Enable client access, handling unmatched streams as appropriate */
>>      reg &= ~sCR0_CLIENTPD;
>> -    reg &= ~sCR0_USFCFG;
>> +    reg |= sCR0_USFCFG;
>>
>>      /* Disable forced broadcasting */
>>      reg &= ~sCR0_FB;
>> @@ -637,9 +637,8 @@ static int arm_smmu_device_cfg_probe(struct 
>> arm_smmu_device *smmu)
>>
>>      smmu->cfgs = (struct arm_smmu_cfg *)(smmu->s2crs + size);
>>
>> -    /* Configure to Bypass mode */
>>      for (i = 0; i < size; i++)
>> -            smmu->s2crs[i] = s2cr_init_val;
>> +            smmu->s2crs[i].type = S2CR_TYPE_FAULT;
>>
>>      smmu->num_mapping_groups = size;
>>
>>
>> However, only if I remove all sids from the root cell config of the
>> zynqmp (num_stream_ids = 0), blocking starts to work. As soon as I have
>> /any/ sid listed, /all/ transfers pass. I'm using 0x3fff as sid_mask
>> which covers all 14 bits that are used by that SOC.
>>
>
> Could you comment on this? Is this behavior different, more consistent
> on the i.MX8?
>

Ah!! Mask bit set means "ignore", not "match". If I clear sid_mask,
actually just like in the Linux DT, everything starts to behave as
expected, and I can selectively block devices (streams). Will write some
config patches for the zynqmp targets.

BTW, it seems we are missing shutdown logic, thus will leave the SMMU
active on jailhouse disable (and will not properly disable it on errors
half-way through init). Also, SID transfer between the root cell and a
newly created/destroyed one is not available. Both properties are
apparently shared with the SMMUv3 implementation...

Jan

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/db19391a-ffbf-ce89-9e4e-f811e501c993%40web.de.

Reply via email to