xen: arm: Split MMU code in preparation for MPU work (part 2)
cover xen: arm: Split MMU code in preparation for MPU work (part 2)
Hi,
In https://patchew.org/Xen/[email protected]/, Henry has reorganized some of the code between the MMU specific and generic files.
In this patch serie, we address the remaining code reorg so that MMU specific code is cleanly separated and we have added stubs wherever necessary to avoid introducing if-def.
Ayan Kumar Halder (4):
xen: arm: Add an empty stub for update_identity_mapping()
xen: arm: make VMAP only support in MMU system
xen: arm: Move the functions of domain_page to MMU specific
xen: arm: Enclose access to EL2 MMU specific registers under
CONFIG_MMU
xen/arch/arm/Kconfig | 6 +- xen/arch/arm/Makefile | 2 +- xen/arch/arm/domain_page.c | 161 +---------------------- xen/arch/arm/include/asm/arm32/mm.h | 12 ++ xen/arch/arm/include/asm/arm64/mm.h | 6 + xen/arch/arm/mmu/Makefile | 1 + xen/arch/arm/mmu/domain_page.c | 194 ++++++++++++++++++++++++++++ xen/arch/arm/setup.c | 4 + xen/arch/arm/smpboot.c | 2 + xen/arch/arm/traps.c | 6 +- xen/include/xen/vmap.h | 6 + 11 files changed, 242 insertions(+), 158 deletions(-) create mode 100644 xen/arch/arm/mmu/domain_page.c
Signature · 1 line
2.25.1
PATCH 1/4 xen: arm: Add an empty stub for update_identity_mapping()
This is in continuation to commitf661a20aa880: "Extract MMU-specific MM code".
update_identity_mapping() is defined for MMU specific logic. It is invoked from smpboot.c. Thus, we add an empty stub to avoid if-defery.
--- xen/arch/arm/include/asm/arm64/mm.h | 6 ++++++ 1 file changed, 6 insertions(+)
xen/arch/arm/include/asm/arm64/mm.h +6 -0
@@ -14,6 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)void arch_setup_page_tables (void ); +#ifdef CONFIG_MMU /* * Enable/disable the identity mapping in the live page-tables (i.e. * the one pointed by TTBR_EL2).
@@ -22,6 +23,11 @@ void arch_setup_page_tables(void);* supported. */ void update_identity_mapping (bool enable); +#else /* CONFIG_MMU */ +static inline void update_identity_mapping (bool enable) +{ +} +#endif /* CONFIG_MMU */ #endif /* __ARM_ARM64_MM_H__ */
Signature · 1 line
2.25.1
Re: [PATCH v1 1/4] xen: arm: Add an empty stub for update_identity_mapping()
Hi Ayan,
Quoted 25 lines · Ayan Kumar Halder
This is in continuation to commit
f661a20aa880: "Extract MMU-specific MM code".
update_identity_mapping()is defined for MMU specific logic. It is invoked fromsmpboot.c. Thus, we add an empty stub to avoid if-defery.Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/include/asm/arm64/mm.h | 6 ++++++ 1 file changed, 6 insertions(+)xen/arch/arm/include/asm/arm64/mm.h +1
-0@@ -14,6 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)void arch_setup_page_tables (void ); +#ifdef CONFIG_MMU /* * Enable/disable the identity mapping in the live page-tables (i.e. * the one pointed by TTBR_EL2).
xen/arch/arm/include/asm/arm64/mm.h void arch_setup_page_tables(void); · line 30
Quoted 8 lines
xen/arch/arm/include/asm/arm64/mm.h +5
-0@@ -22,6 +23,11 @@ void arch_setup_page_tables(void);* supported. */ void update_identity_mapping (bool enable); +#else /* CONFIG_MMU */ +static inline void update_identity_mapping (bool enable) +{ +} +#endif /* CONFIG_MMU */
The name of the function reads a bit odd in the context of the MPU. How about providing a new helper called update_boot_mapping()? For MPU, it would still be empty (assuming this is the right approach) whereas for the MMU it would call update_identity_mapping().
Cheers,
Signature · 1 line
Julien Grall
PATCH 2/4 xen: arm: make VMAP only support in MMU system
In reply to Ayan Kumar HalderFrom: Penny Zheng <[email protected]>
VMAP is widely used in ALTERNATIVE feature, CPUERRATA feature, etc to remap a range of memory with new memory attributes. Since this is highly dependent on virtual address translation, we choose to fold VMAP in MMU system.
In this patch, we introduce a new Kconfig CONFIG_HAS_VMAP, and make it only support in MMU system on ARM architecture. And we make features like ALTERNATIVE, CPUERRATA, etc, now depend on VMAP.
Split "https://patchwork.kernel.org/project/xen-devel/patch/[email protected]/" into Arm specific
--- xen/arch/arm/Kconfig | 6 +++++- xen/arch/arm/Makefile | 2 +- xen/arch/arm/setup.c | 4 ++++ xen/arch/arm/smpboot.c | 2 ++ xen/include/xen/vmap.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-)
xen/arch/arm/Kconfig +5 -1
@@ -12,7 +12,7 @@ config ARM_64 config ARM def_bool y select FUNCTION_ALIGNMENT_4B - select HAS_ALTERNATIVE + select HAS_ALTERNATIVE if HAS_VMAP select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN
@@ -58,9 +58,13 @@ config PADDR_BITS default 40 if ARM_PA_BITS_40 default 48 if ARM_64 +config HAS_VMAP + def_bool y + config MMU def_bool y select HAS_PMAP + select HAS_VMAP source "arch/Kconfig"
xen/arch/arm/Makefile +1 -1
@@ -11,7 +11,7 @@ obj-$(CONFIG_HAS_VPCI) += vpci.o obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o obj-y += bootfdt.init.o -obj-y += cpuerrata.o +obj-$(CONFIG_HAS_VMAP) += cpuerrata.o obj-y += cpufeature.o obj-y += decode.o obj-y += device.o
xen/arch/arm/setup.c +4 -0
@@ -804,11 +804,13 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset, nr_cpu_ids =smp_get_max_cpus ();printk (XENLOG_INFO "SMP: Allowing %u CPUs\n" , nr_cpu_ids); +#ifdef CONFIG_HAS_VMAP /* * Some errata relies on SMCCC version which is detected by psci_init() * (called from smp_init_cpus()). */ check_local_cpu_errata (); +#endif check_local_cpu_features ();
@@ -879,8 +881,10 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset,* It needs to be called after do_initcalls to be able to use * stop_machine (tasklets initialized via an initcall). */ +#ifdef CONFIG_HAS_VMAP apply_alternatives_all ();enable_errata_workarounds (); +#endif enable_cpu_features ();/* Create initial domain 0. */
xen/arch/arm/smpboot.c +2 -0
@@ -406,7 +406,9 @@ void asmlinkage start_secondary(void)local_abort_enable (); +#ifdef CONFIG_HAS_VMAP check_local_cpu_errata (); +#endif check_local_cpu_features ();printk (XENLOG_DEBUG "CPU %u booted.\n" ,smp_processor_id ());
xen/include/xen/vmap.h +6 -0
@@ -138,10 +138,16 @@ static inline void iounmap(void __iomem *va)/* Pointer to 1 octet past the end of the VMAP_DEFAULT virtual area */ void *arch_vmap_virt_end (void ); +#ifdef CONFIG_MMU /* Initialises the VMAP_DEFAULT virtual range */ static inline void vm_init (void ) {vm_init_type (VMAP_DEFAULT , (void *)VMAP_VIRT_START ,arch_vmap_virt_end ()); } +#else +static inline void vm_init (void ) +{ +} +#endif #endif /* __XEN_VMAP_H__ */
Signature · 1 line
2.25.1
Re: [PATCH v1 2/4] xen: arm: make VMAP only support in MMU system
On 02.08.2024 14:14, Ayan Kumar Halder wrote:> --- a/xen/include/xen/vmap.h
Quoted 6 lines
+++
b/xen/include/xen/vmap.hxen/include/xen/vmap.h +1
-0@@ -138,10 +138,16 @@ static inline void iounmap(void __iomem *va)/* Pointer to 1 octet past the end of the VMAP_DEFAULT virtual area */ void *arch_vmap_virt_end (void ); +#ifdef CONFIG_MMU
xen/include/xen/vmap.h static inline void iounmap(void __iomem *va) · line 151
Quoted 10 lines
xen/include/xen/vmap.h +5
-0/* Initialises the VMAP_DEFAULT virtual range */ static inline void vm_init (void ) {vm_init_type (VMAP_DEFAULT , (void *)VMAP_VIRT_START ,arch_vmap_virt_end ()); } +#else +static inline void vm_init (void ) +{ +} +#endif
Imo in such a case the #ifdef wants to be put inside the existing function, avoiding the need for a 2nd instance.
Jan
Re: [PATCH v1 2/4] xen: arm: make VMAP only support in MMU system
In reply to Ayan Kumar HalderHi,
Quoted 10 lines · Ayan Kumar Halder
From: Penny Zheng <[email protected]>
VMAP is widely used in ALTERNATIVE feature, CPUERRATA feature, etc to remap a range of memory with new memory attributes. Since this is highly dependent on virtual address translation, we choose to fold VMAP in MMU system.
In this patch, we introduce a new
KconfigCONFIG_HAS_VMAP, and make it only support in MMU system on ARM architecture. And we make features like ALTERNATIVE, CPUERRATA, etc, now depend on VMAP.
While I agree that alternative should depend on VMAP (for now), I feel this is incorrect for CPUERRATA. Very likely, you will need to deal with them on the MPU.
Before making any suggestion, would you be able to clarify how you envision to deal with errata? Will they be selected at built time or boot time?
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v1 2/4] xen: arm: make VMAP only support in MMU system
Quoted 1 line · Julien Grall
Hi,
Hi Julien,
Quoted 9 lines · Ayan Kumar Halder
Quoted 7 lines
From: Penny Zheng <[email protected]>
VMAP is widely used in ALTERNATIVE feature, CPUERRATA feature, etc to remap a range of memory with new memory attributes. Since this is highly dependent on virtual address translation, we choose to fold VMAP in MMU system.
Quoted 7 lines
Quoted 3 lines
In this patch, we introduce a new
KconfigCONFIG_HAS_VMAP, and make it only support in MMU system on ARM architecture. And we make features like ALTERNATIVE, CPUERRATA, etc, now depend on VMAP.While I agree that alternative should depend on VMAP (for now), I feel this is incorrect for CPUERRATA. Very likely, you will need to deal with them on the MPU.
Before making any suggestion, would you be able to clarify how you envision to deal with errata? Will they be selected at built time or boot time?
TBH, I hadn't thought that through. I am thinking about selecting them at built time (like it is been done for Arm64 cpus).
However given that there are lesser number of MPU cpus (only R52 and R82) compared to MMU ones, could there be a simpler approach.
I am open to any suggestions you have.
Also, can we disable the CPUERRATA on MPU until we add support for the first errata ?
- Ayan
Quoted 3 lines
Cheers,
Re: [PATCH v1 2/4] xen: arm: make VMAP only support in MMU system
Hi Ayan,
Quoted 17 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall
Hi,
Hi Julien,
Quoted 13 lines · Ayan Kumar Halder
Quoted 10 lines
From: Penny Zheng <[email protected]>
VMAP is widely used in ALTERNATIVE feature, CPUERRATA feature, etc to remap a range of memory with new memory attributes. Since this is highly dependent on virtual address translation, we choose to fold VMAP in MMU system.
In this patch, we introduce a new
KconfigCONFIG_HAS_VMAP, and make it only support in MMU system on ARM architecture. And we make features like ALTERNATIVE, CPUERRATA, etc, now depend on VMAP.
Quoted 5 lines
Quoted 3 lines
While I agree that alternative should depend on VMAP (for now), I feel this is incorrect for CPUERRATA. Very likely, you will need to deal with them on the MPU.
Before making any suggestion, would you be able to clarify how you envision to deal with errata? Will they be selected at built time or boot time?
TBH, I hadn't thought that through. I am thinking about selecting them at built time (like it is been done for Arm64 cpus).
To clarify, on arm64, the decision to enable the bulk of mitigation is done at runtime. The Kconfig is just to remove it from the binary if you you are not targeting such HW. With that in mind...
Quoted 2 lines
However given that there are lesser number of MPU cpus (only R52 and R82) compared to MMU ones, could there be a simpler approach.
... do you mean always an errata enabled in the Kconfig would be always mitigate (IOW no runtime selection)?
Quoted 4 lines
I am open to any suggestions you have.
Also, can we disable the CPUERRATA on MPU until we add support for the first errata ?
So I have looked at the code and it is rather unclear why you actually need to disable CPU Errata. Can you clarify what would happen if cpuerrata is always built *and* CONFIG_ARM64_HARDEN_BRANCH_PREDICATOR is gated by HAS_VMAP? I am assuming we will not need the branch predictor hardening on Cortex-R (at least this is the implication from [1]).
Now regarding alternative, at least for arm64 this is used outside of the errata. Not critical right now, but at some point you will want to re-enable alternatives.
Cheers,
[1] https://developer.arm.com/Arm%20Security%20Center/Speculative%20Processor%20Vulnerability
Signature · 1 line
Julien Grall
PATCH 3/4 xen: arm: Move the functions of domain_page to MMU specific
In reply to Ayan Kumar HalderMoved init_domheap_mappings(), map_domain_page_global(), unmap_domain_page_global(), map_domain_page(), unmap_domain_page(), domain_page_map_to_mfn() to MMU specific folder.
On the top level, we have added stubs which will invoke the MMU specific equivalent of these functions.
--- xen/arch/arm/domain_page.c | 161 +---------------------- xen/arch/arm/include/asm/arm32/mm.h | 12 ++ xen/arch/arm/mmu/Makefile | 1 + xen/arch/arm/mmu/domain_page.c | 194 ++++++++++++++++++++++++++++ 4 files changed, 213 insertions(+), 155 deletions(-) create mode 100644 xen/arch/arm/mmu/domain_page.c
xen/arch/arm/domain_page.c +6 -155
@@ -3,185 +3,36 @@#include <xen/pmap.h> #include <xen/vmap.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef virt_to_mfn -#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) - -/* cpu0's domheap page tables */ -static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES); - -/* -* xen_dommap == pages used by map_domain_page, these pages contain -* the second level pagetables which map the domheap region -* starting at DOMHEAP_VIRT_START in 2MB chunks. -*/ -static DEFINE_PER_CPU(lpae_t *, xen_dommap); - -/* -* Prepare the area that will be used to map domheap pages. They are -* mapped in 2MB chunks, so we need to allocate the page-tables up to -* the 2nd level. -* -* The caller should make sure the root page-table for @cpu has been -* allocated. -*/ bool init_domheap_mappings (unsigned int cpu) { -unsigned int order =get_order_from_pages (DOMHEAP_SECOND_PAGES ); -lpae_t *root =per_cpu (xen_pgtable, cpu); -unsigned int i, first_idx; -lpae_t *domheap; -mfn_t mfn; - -ASSERT (root); -ASSERT (!per_cpu (xen_dommap, cpu)); - -/* -* The domheap for cpu0 is initialized before the heap is initialized. -* So we need to use pre-allocated pages. -*/ -if ( !cpu ) - domheap = cpu0_dommap; -else - domheap =alloc_xenheap_pages (order,0 ); - -if ( !domheap ) -return false; - -/* Ensure the domheap has no stray mappings */ -memset (domheap,0 ,DOMHEAP_SECOND_PAGES *PAGE_SIZE ); - -/* -* Update the first level mapping to reference the local CPUs -* domheap mapping pages. -*/ - mfn =virt_to_mfn (domheap); - first_idx =first_table_offset (DOMHEAP_VIRT_START ); -for ( i =0 ; i <DOMHEAP_SECOND_PAGES ; i++ ) - { -lpae_t pte =mfn_to_xen_entry (mfn_add (mfn, i),MT_NORMAL ); - pte.pt.table =1 ; -write_pte (&root[first_idx + i], pte); - } - -per_cpu (xen_dommap, cpu) = domheap; - -return true; +return init_domheap_mappings_mm (cpu); }void *map_domain_page_global (mfn_t mfn) { -return vmap (&mfn,1 ); +return map_domain_page_global_mm (mfn); }void unmap_domain_page_global (const void *ptr) { -vunmap (ptr); +return unmap_domain_page_global_mm (ptr); }/* Map a page of domheap memory */ void *map_domain_page (mfn_t mfn) { -unsigned long flags; -lpae_t *map =this_cpu (xen_dommap); -unsigned long slot_mfn =mfn_x (mfn) & ~XEN_PT_LPAE_ENTRY_MASK ; -vaddr_t va; -lpae_t pte; -int i, slot; - -local_irq_save (flags); - -/* The map is laid out as an open-addressed hash table where each -* entry is a 2MB superpage pte. We use the available bits of each -* PTE as a reference count; when the refcount is zero the slot can -* be reused. */ -for ( slot = (slot_mfn >>XEN_PT_LPAE_SHIFT ) %DOMHEAP_ENTRIES , i =0 ; - i <DOMHEAP_ENTRIES ; - slot = (slot +1 ) %DOMHEAP_ENTRIES , i++ ) - { -if ( map[slot].pt.avail <0xf && - map[slot].pt.base == slot_mfn && - map[slot].pt.valid ) - { -/* This slot already points to the right place; reuse it */ - map[slot].pt.avail++; -break ; - } -else if ( map[slot].pt.avail ==0 ) - { -/* Commandeer this 2MB slot */ - pte =mfn_to_xen_entry (_mfn (slot_mfn),MT_NORMAL ); - pte.pt.avail =1 ; -write_pte (map + slot, pte); -break ; - } - - } -/* If the map fills up, the callers have misbehaved. */ -BUG_ON (i ==DOMHEAP_ENTRIES ); - -#ifndef NDEBUG -/* Searching the hash could get slow if the map starts filling up. -* Cross that bridge when we come to it */ - { -static int max_tries =32 ; -if ( i >= max_tries ) - { -dprintk (XENLOG_WARNING ,"Domheap map is filling: %i tries\n" , i); - max_tries *=2 ; - } - } -#endif - -local_irq_restore (flags); - - va = (DOMHEAP_VIRT_START - + (slot <<SECOND_SHIFT ) - + ((mfn_x (mfn) &XEN_PT_LPAE_ENTRY_MASK ) <<THIRD_SHIFT )); - -/* -* We may not have flushed this specific subpage at map time, -* since we only flush the 4k page not the superpage -*/ -flush_xen_tlb_range_va_local (va,PAGE_SIZE ); - -return (void *)va; +return map_domain_page_mm (mfn); }/* Release a mapping taken with map_domain_page() */ void unmap_domain_page (const void *ptr) { -unsigned long flags; -lpae_t *map =this_cpu (xen_dommap); -int slot = ((unsigned long )ptr -DOMHEAP_VIRT_START ) >>SECOND_SHIFT ; - -if ( !ptr ) -return ; - -local_irq_save (flags); - -ASSERT (slot >=0 && slot <DOMHEAP_ENTRIES ); -ASSERT (map[slot].pt.avail !=0 ); - - map[slot].pt.avail--; - -local_irq_restore (flags); +return unmap_domain_page_mm (ptr); }mfn_t domain_page_map_to_mfn (const void *ptr) { -unsigned long va = (unsigned long )ptr; -lpae_t *map =this_cpu (xen_dommap); -int slot = (va -DOMHEAP_VIRT_START ) >>SECOND_SHIFT ; -unsigned long offset = (va>>THIRD_SHIFT ) &XEN_PT_LPAE_ENTRY_MASK ; - -if ( (va >=VMAP_VIRT_START ) && ((va -VMAP_VIRT_START ) <VMAP_VIRT_SIZE ) ) -return virt_to_mfn (va); - -ASSERT (slot >=0 && slot <DOMHEAP_ENTRIES ); -ASSERT (map[slot].pt.avail !=0 ); - -return mfn_add (lpae_get_mfn (map[slot]), offset); +return domain_page_map_to_mfn_mm (ptr); }/*
xen/arch/arm/include/asm/arm32/mm.h +12 -0
@@ -18,6 +18,18 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)bool init_domheap_mappings (unsigned int cpu); +bool init_domheap_mappings_mm (unsigned int cpu); + +void *map_domain_page_global_mm (mfn_t mfn); + +void unmap_domain_page_global_mm (const void *ptr); + +void *map_domain_page_mm (mfn_t mfn); + +void unmap_domain_page_mm (const void *ptr); + +mfn_t domain_page_map_to_mfn_mm (const void *ptr); +static inline void arch_setup_page_tables (void ) { }
xen/arch/arm/mmu/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-y += p2m.o obj-y += pt.o obj-y += setup.o obj-y += smpboot.o +obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
xen/arch/arm/mmu/domain_page.c new file +194 -0
194 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v1 3/4] xen: arm: Move the functions of domain_page to MMU specific
Hi,
Quoted 10 lines · Ayan Kumar Halder
Moved
init_domheap_mappings(),map_domain_page_global(),unmap_domain_page_global(),map_domain_page(),unmap_domain_page(),domain_page_map_to_mfn()to MMU specific folder.On the top level, we have added stubs which will invoke the MMU specific equivalent of these functions.
Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/domain_page.c | 161 +----------------------
Looking at what's left in domain_page.c, we seem to have just a series of stubs:
bool init_domheap_mappings(unsigned int cpu)
{
return init_domheap_mappings_mm(cpu);
}void *map_domain_page_global(mfn_t mfn)
{
return map_domain_page_global_mm(mfn);
}void unmap_domain_page_global(const void *ptr)
{
return unmap_domain_page_global_mm(ptr);
}/* Map a page of domheap memory */
void *map_domain_page(mfn_t mfn)
{
return map_domain_page_mm(mfn);
}/* Release a mapping taken with map_domain_page() */ void unmap_domain_page(const void *ptr)
{
return unmap_domain_page_mm(ptr);
}mfn_t domain_page_map_to_mfn(const void *ptr)
{
return domain_page_map_to_mfn_mm(ptr);
}The indirection seems unnecessary to me. What about renaming arch/arm/domain_page.c to arch/arm/mmu/domain_page.c? Then, for the MMU you can implement unmap_domain_page() & co rather than suffixed _mm ones.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v1 3/4] xen: arm: Move the functions of domain_page to MMU specific
Quoted 1 line · Julien Grall
Hi,
Hi Julien,
Quoted 42 lines · Ayan Kumar Halder
Quoted 10 lines
Moved
init_domheap_mappings(),map_domain_page_global(),unmap_domain_page_global(),map_domain_page(),unmap_domain_page(),domain_page_map_to_mfn()to MMU specific folder.On the top level, we have added stubs which will invoke the MMU specific equivalent of these functions.
Signed-off-by Ayan Kumar Halder <[email protected]>---
xen/arch/arm/domain_page.c | 161 +----------------------Looking at what's left in
domain_page.c, we seem to have just a series of stubs:bool
init_domheap_mappings(unsigned int cpu)
{
returninit_domheap_mappings_mm(cpu);
}void *map_domain_page_global(mfn_t mfn)
{
returnmap_domain_page_global_mm(mfn);
}void
unmap_domain_page_global(const void *ptr)
{
returnunmap_domain_page_global_mm(ptr);
}/* Map a page of domheap memory */
void *map_domain_page(mfn_t mfn)
{
returnmap_domain_page_mm(mfn);
}/* Release a mapping taken with
map_domain_page()*/ voidunmap_domain_page(const void *ptr)
{
returnunmap_domain_page_mm(ptr);
}
Quoted 6 lines
mfn_tdomain_page_map_to_mfn(const void *ptr)
{
returndomain_page_map_to_mfn_mm(ptr);
}The indirection seems unnecessary to me. What about renaming
arch/arm/domain_page.ctoarch/arm/mmu/domain_page.c? Then, for the MMU you can implementunmap_domain_page()& co rather than suffixed_mmones.
Makes sense. I will do this way.
- Ayan
Quoted 3 lines
Cheers,
PATCH 4/4 xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
In reply to Ayan Kumar HalderAll the EL2 MMU specific registers are enclosed within CONFIG_MMU.
--- xen/arch/arm/traps.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
xen/arch/arm/traps.c +5 -1
@@ -919,12 +919,14 @@ static void _show_registers(const struct cpu_user_regs *regs,#endif }printk (" VTCR_EL2: %" PRIregister"\n" ,READ_SYSREG (VTCR_EL2 )); -printk (" VTTBR_EL2: %016" PRIx64"\n" , ctxt->vttbr_el2);printk ("\n" );printk (" SCTLR_EL2: %" PRIregister"\n" ,READ_SYSREG (SCTLR_EL2 ));printk (" HCR_EL2: %" PRIregister"\n" ,READ_SYSREG (HCR_EL2 )); +#ifdef CONFIG_MMU +printk (" VTTBR_EL2: %016" PRIx64"\n" , ctxt->vttbr_el2);printk (" TTBR0_EL2: %016" PRIx64"\n" ,READ_SYSREG64 (TTBR0_EL2 )); +#endif printk ("\n" );printk (" ESR_EL2: %" PRIregister"\n" , regs->hsr);printk (" HPFAR_EL2: %" PRIregister"\n" ,READ_SYSREG (HPFAR_EL2 ));
@@ -956,7 +958,9 @@ void show_registers(const struct cpu_user_regs *regs)if (guest_mode (regs) &&is_32bit_domain (current->domain) ) ctxt.ifsr32_el2 =READ_SYSREG (IFSR32_EL2 );#endif +#ifdef CONFIG_MMU ctxt.vttbr_el2 =READ_SYSREG64 (VTTBR_EL2 ); +#endif _show_registers (regs, &ctxt,guest_mode (regs), current); }
Signature · 1 line
2.25.1
Re: [PATCH v1 4/4] xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
Hi,
Quoted 12 lines · Ayan Kumar Halder
All the EL2 MMU specific registers are enclosed within
CONFIG_MMU.Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/traps.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)xen/arch/arm/traps.c +0
-0
xen/arch/arm/traps.c static void _show_registers(const struct cpu_user_regs *regs, · line 922
Quoted 4 lines
xen/arch/arm/traps.c +0
-1@@ -919,12 +919,14 @@ static void _show_registers(const struct cpu_user_regs *regs,#endif }printk (" VTCR_EL2: %" PRIregister"\n" ,READ_SYSREG (VTCR_EL2 )); -printk (" VTTBR_EL2: %016" PRIx64"\n" , ctxt->vttbr_el2);
Can you #ifdef the field vttrb_el2 if it is not meant to be used?
xen/arch/arm/traps.c static void _show_registers(const struct cpu_user_regs *regs, · line 927
Quoted 6 lines
xen/arch/arm/traps.c +2
-0printk ("\n" );printk (" SCTLR_EL2: %" PRIregister"\n" ,READ_SYSREG (SCTLR_EL2 ));printk (" HCR_EL2: %" PRIregister"\n" ,READ_SYSREG (HCR_EL2 )); +#ifdef CONFIG_MMU +printk (" VTTBR_EL2: %016" PRIx64"\n" , ctxt->vttbr_el2);
VTCR_EL2 and VTTBR_EL2 needs to be read together. So I would prefer the printk is not moved.
Quoted 5 lines
xen/arch/arm/traps.c +1
-0printk (" TTBR0_EL2: %016" PRIx64"\n" ,READ_SYSREG64 (TTBR0_EL2 )); +#endif printk("\n");> printk(" ESR_EL2: %"PRIregister"\n", regs->hsr);printk (" HPFAR_EL2: %" PRIregister"\n" ,READ_SYSREG (HPFAR_EL2 ));
xen/arch/arm/traps.c void show_registers(const struct cpu_user_regs *regs) · line 966
Quoted 9 lines
xen/arch/arm/traps.c +2
-0@@ -956,7 +958,9 @@ void show_registers(const struct cpu_user_regs *regs)if (guest_mode (regs) &&is_32bit_domain (current->domain) ) ctxt.ifsr32_el2 =READ_SYSREG (IFSR32_EL2 );#endif +#ifdef CONFIG_MMU ctxt.vttbr_el2 =READ_SYSREG64 (VTTBR_EL2 ); +#endif _show_registers (regs, &ctxt,guest_mode (regs), current); }
Cheers,
Signature · 1 line
Julien Grall