|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v5 09/13] xen/arm: mm: Use generic variable/function names for extendability
Hi, On 14/08/2023 05:25, Henry Wang wrote: From: Penny Zheng <penny.zheng@xxxxxxx> As preparation for MPU support, which will use some variables/functions for both MMU and MPU system, We rename the affected variable/function to more generic names: - init_ttbr -> init_mm, You moved init_ttbr to mm/mmu.c. So why does this need to be renamed?And if you really planned to use it for the MPU code. Then init_ttbr should not have been moved. - mmu_init_secondary_cpu() -> mm_init_secondary_cpu() - init_secondary_pagetables() -> init_secondary_mm() The original naming were not great but the new one are a lot more confusing as they seem to just be a reshuffle of word. mm_init_secondary_cpu() is only setting the WxN bit. For the MMU, I think it can be done much earlier. Do you have anything to add in it? If not, then I would consider to get rid of it. For init_secondary_mm(), I would renamed it to prepare_secondary_mm().
Why not simply renaming this function to update_mm_mapping()? But... ... the new name it quite confusing. What is the mapping it is referring to?If you don't want to keep update_identity_mapping(), then I would consider to simply wrap...
... with #ifdef CONFIG_MMU here...
rc = smp_enable_ops[cpu].prepare_cpu(cpu);
... here and ... return rc;}void arch_cpu_up_finish(void) ... here. }/*diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h index e0bd23a6ed..7a389c4b21 100644 --- a/xen/arch/arm/include/asm/arm64/mm.h +++ b/xen/arch/arm/include/asm/arm64/mm.h @@ -15,13 +15,14 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr) void arch_setup_page_tables(void);/*- * Enable/disable the identity mapping in the live page-tables (i.e. - * the one pointed by TTBR_EL2). + * In MMU system, enable/disable the identity mapping in the live + * page-tables (i.e. the one pointed by TTBR_EL2) through + * update_identity_mapping(). * * Note that nested call (e.g. enable=true, enable=true) is not * supported. */ -void update_identity_mapping(bool enable); +void update_mm_mapping(bool enable);#endif /* __ARM_ARM64_MM_H__ */ diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.hindex dc1458b047..8084c62c01 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -170,7 +170,7 @@ struct page_info #define PGC_need_scrub PGC_allocated/* Non-boot CPUs use this to find the correct pagetables. */-extern uint64_t init_ttbr; +extern uint64_t init_mm;#ifdef CONFIG_ARM_32#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) @@ -205,11 +205,13 @@ extern void setup_pagetables(unsigned long boot_phys_offset); extern void *early_fdt_map(paddr_t fdt_paddr); /* Remove early mappings */ extern void remove_early_mappings(void); -/* Allocate and initialise pagetables for a secondary CPU. Sets init_ttbr to the - * new page table */ -extern int init_secondary_pagetables(int cpu); +/* + * Allocate and initialise pagetables for a secondary CPU. Sets init_mm to the + * new page table + */ +extern int init_secondary_mm(int cpu); /* Switch secondary CPUS to its own pagetables and finalise MMU setup */ Regardless what I wrote above, this comment is not accurate anymore as we don't switch the page tables for the secondary CPUs. We are only enable WxN. In any case, this comment would need to be reworded to be more generic. Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |