Hi Ayan,

>>> + */
>>> +FUNC_LOCAL(enable_mpu)
>>> +    mrs   x0, SCTLR_EL2
>>> +    bic   x0, x0, #SCTLR_ELx_BR       /* Disable Background region */
>>> +    orr   x0, x0, #SCTLR_Axx_ELx_M    /* Enable MPU */
>>> +    orr   x0, x0, #SCTLR_Axx_ELx_C    /* Enable D-cache */
>>> +    orr   x0, x0, #SCTLR_Axx_ELx_WXN  /* Enable WXN */
>> 
>> NIT: Can't we have a single "orr" instruction to set all the flags?
> Yes, I will change this.
>> 
>>> +    dsb   sy
>> 
>> I still question this use of "dsb sy"...
> 
> Actually I kept this to ensure that all outstanding memory access are 
> completed before MPU is enabled.
> 
> However, prepare_xen_region() is invoked before this and it has a 'dsb sy' at 
> the end.
> 
> So we can drop this barrier.

I suggest to keep the barrier here and drop the one in prepare_xen_region 
instead,
have a look in my branch: 
https://gitlab.com/xen-project/xen/-/merge_requests/7/diffs?commit_id=f42a2816f9bd95f2f6957887be910cb9acd140b5

During my testing I was having trouble without this barrier.

Cheers,
Luca


Reply via email to