xen/arm: Drop {boot_}phys_offset usage

boot_phys_offset stores the physical offset (PA-VA), is calculated in
the startup head.S code and passed to start_xen() as a first argument.
There is no point in using it given that we can ask MMU to translate
a VA for us using e.g. virt_to_{mfn,maddr}. Drop usage of these
variables from the C world.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Acked-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
Michal Orzel authored and Julien Grall committed 2024-08-22 11:35:05 +01:00
1 parent 98060fc4a3
commit 0cc09bdfaf
3 files changed
+8 -12

No files matched your search

+1 -1
View File
@@ -199,7 +199,7 @@ extern unsigned long frametable_base_pdx;
#define PDX_GROUP_SHIFT SECOND_SHIFT
/* Boot-time pagetable setup */
extern void setup_pagetables(unsigned long boot_phys_offset);
extern void setup_pagetables(void);
/* Map FDT in boot pagetable */
extern void *early_fdt_map(paddr_t fdt_paddr);
/* Remove early mappings */
+6 -10
View File
@@ -17,6 +17,8 @@
/* Override macros from asm/page.h to make them work with mfn_t */
#undef mfn_to_virt
#define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn))
#undef virt_to_mfn
#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
/* Main runtime page tables */
@@ -52,8 +54,6 @@ DEFINE_BOOT_PAGE_TABLE(xen_fixmap);
*/
static DEFINE_PAGE_TABLES(xen_xenmap, XEN_NR_ENTRIES(2));
static paddr_t phys_offset;
/* Limits of the Xen heap */
mfn_t directmap_mfn_start __read_mostly = INVALID_MFN_INITIALIZER;
mfn_t directmap_mfn_end __read_mostly;
@@ -138,9 +138,7 @@ static void __init __maybe_unused build_assertions(void)
lpae_t __init pte_of_xenaddr(vaddr_t va)
{
paddr_t ma = va + phys_offset;
return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL);
return mfn_to_xen_entry(virt_to_mfn(va), MT_NORMAL);
}
void * __init early_fdt_map(paddr_t fdt_paddr)
@@ -228,14 +226,12 @@ static void xen_pt_enforce_wnx(void)
* Boot-time pagetable setup.
* Changes here may need matching changes in head.S
*/
void __init setup_pagetables(unsigned long boot_phys_offset)
void __init setup_pagetables(void)
{
uint64_t ttbr;
lpae_t pte, *p;
int i;
phys_offset = boot_phys_offset;
arch_setup_page_tables();
#ifdef CONFIG_ARM_64
@@ -290,9 +286,9 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte;
#ifdef CONFIG_ARM_64
ttbr = (uintptr_t) xen_pgtable + phys_offset;
ttbr = virt_to_maddr(xen_pgtable);
#else
ttbr = (uintptr_t) cpu0_pgtable + phys_offset;
ttbr = virt_to_maddr(cpu0_pgtable);
#endif
switch_ttbr(ttbr);
+1 -1
View File
@@ -304,7 +304,7 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset,
/* Initialize traps early allow us to get backtrace when an error occurred */
init_traps();
setup_pagetables(boot_phys_offset);
setup_pagetables();
smp_clear_cpu_maps();
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.