|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 10/11] xen/arm64: introduce helpers for MPU enable/disable
Hi Wei, On 04/11/2022 10:07, Wei Chen wrote: From: Penny Zheng <penny.zheng@xxxxxxx> We need some helpers for Xen to enable/disable MPU in boot-time and runtime. For MPU enable helper, we know that it's an essential requirement of MPU system. But for MPU disable, we need to use it for some special situations. For example, in the progress of tranferring from boot-time to runtime, we need to update the MPU protection regions configuration, but we can't modify an MPU protection region if there is some data accessed by Xen. But in boot-time all of Xen text, data and BSS are in one MPU protection region, if Xen want to update this protection region, above restriction will be triggered. This raises the following question: Why can't we create the split regions right now? In particular, disabling the MMU/Cache is fairly risky because you need to ensure that anything in the cache you care about have been written back to the RAM).
I was under the impression that all access would be treated as Device Memory when the MMU is off. Isn't it the case for the MPU? Also, I think the correct wording is "device memory" rather than "IO memory". The access to IO memory will bypass Ditto. + * the cache, even you have enabled the C bit in SCTLR. + * To avoid this implicit behavior, we disable cache with MPU + * explicitly to tell user that when MPU is disabled, the memory + * access is uncacheable. + */ +ENTRY(enable_mm) + mrs x0, SCTLR_EL2 + mov x1, #(SCTLR_Axx_ELx_M | SCTLR_Axx_ELx_C) + /* Enable EL2 MPU and D-cache */ + orr x0, x0, x1 + dsb sy + msr SCTLR_EL2, x0 + isb + ret +ENDPROC(enable_mm) + +/* Disable MPU system, including data cache. */ +ENTRY(disable_mm) I would rather not introduce this function until there is a caller. This is because, I believe, there are some assumptions on the state of the cache before we can turn off the MMU. So I would like to see the caller in order to assess whether this function makes sense. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |