[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN] xen/arm: arm32: Use adr_l instead of load_paddr for getting address of symbols


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Wed, 25 Oct 2023 18:03:04 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eyHJM/XB9UyoPZnhX7laqyMoe+H9DU7nM/b3lw43Krw=; b=ZgAJ+j842jkDW7S+0tOSAIHkqG99ugLGRXIiTM9Ck9dvikdphVmMwExqPpweDlHeYmIQDzk/nYw9P8ZbQBG3QdxNhgDXb+PQQDsqnW0+ixnLrImYig/9ltwJdDUu93Q6LBAJt/eRKMXBBx0fbIFZ0xp5D20Fmddmg6xr/giaT2hQ4w1dkf0KNxxKbCwWHveudDZiy6WFSPzxzlgJwNfsaxE2LbZD28OcfZe3VJCvDUoYFZ38UWxotX+1kCyZDsAwk8PGGNmyNaDGTezFTpJeFAokv4gLUNkHqiD/4LBUcD9ACx3q3DWFi7l7JO0arbaEOEI51noF866BwYVXVa3T6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+T2xvm7MkZg1P7j2LocnafgPqfH/ykc+dBYbDklvyBVoxxEN2sCTcq92MFgXtMVg0a0ORCGB+FRMs1d1IDkpBqTENNO7iBh9cMKOlb4OF835+As+lDb9XCfvkTiSrzdO2xFnfxkudZf7D7oMYel9XZOEM9GF80rBW2+ixK7pccDyDFco3p+vGhzqruP5lYfN8oSCP2VSuZqvMrZQJhUIoPZE5GAo3y55ObRAZ9k+Fw0MdVfJBdLzWg1MVZgvIyjr56YmjuVwHA4ScaL6yXJU85RtgBz5TF+BM1HmYXOOwDPhn6TxbJVB4qXbCsJuX7t7k5WlRxpIHchz6YSxP1IYQ==
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <michal.orzel@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Delivery-date: Wed, 25 Oct 2023 17:03:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Before the MMU is turned on, the address returned for any symbol will always be
physical address. Thus, one can use adr_l instead of load_paddr.

create_table_entry() now takes an extra argument to denote if it is called after
the mmu is turned on or not.  If it is called with mmu on, then it uses
load_paddr to get the physical address of the page table symbol.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Refer https://lists.archive.carbon60.com/xen/devel/682900 for details.

 xen/arch/arm/arm32/head.S | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 33b038e7e0..bf442b0434 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -171,7 +171,7 @@ past_zImage:
 
         /* Using the DTB in the .dtb section? */
 .ifnes CONFIG_DTB_FILE,""
-        load_paddr r8, _sdtb
+        adr_l r8, _sdtb
 .endif
 
         /* Initialize the UART if earlyprintk has been enabled. */
@@ -213,7 +213,7 @@ GLOBAL(init_secondary)
         mrc   CP32(r1, MPIDR)
         bic   r7, r1, #(~MPIDR_HWID_MASK) /* Mask out flags to get CPU ID */
 
-        load_paddr r0, smp_up_cpu
+        adr_l r0, smp_up_cpu
         dsb
 2:      ldr   r1, [r0]
         cmp   r1, r7
@@ -406,6 +406,7 @@ ENDPROC(cpu_init)
  * tbl:     table symbol to point to
  * virt:    virtual address
  * lvl:     page-table level
+ * mmu_on:  is mmu on
  *
  * Preserves \virt
  * Clobbers r1 - r4
@@ -414,10 +415,14 @@ ENDPROC(cpu_init)
  *
  * Note that \virt should be in a register other than r1 - r4
  */
-.macro create_table_entry, ptbl, tbl, virt, lvl
+.macro create_table_entry, ptbl, tbl, virt, lvl, mmu_on
+    .if \mmu_on == 1
         load_paddr r4, \tbl
-        create_table_entry_from_paddr \ptbl, r4, \virt, \lvl
- .endm
+    .else
+        adr_l r4, \tbl
+    .endif
+    create_table_entry_from_paddr \ptbl, r4, \virt, \lvl
+.endm
 
 /*
  * Macro to create a mapping entry in \tbl to \paddr. Only mapping in 3rd
@@ -479,7 +484,7 @@ create_page_tables:
          * create_table_entry_paddr() will clobber the register storing
          * the physical address of the table to point to.
          */
-        load_paddr r5, boot_third
+        adr_l r5, boot_third
         mov_w r4, XEN_VIRT_START
 .rept XEN_NR_ENTRIES(2)
         mov   r0, r5                        /* r0 := paddr(l3 table) */
@@ -522,8 +527,8 @@ create_page_tables:
          * Setup the 1:1 mapping so we can turn the MMU on. Note that
          * only the first page of Xen will be part of the 1:1 mapping.
          */
-        create_table_entry boot_pgtable, boot_second_id, r9, 1
-        create_table_entry boot_second_id, boot_third_id, r9, 2
+        create_table_entry boot_pgtable, boot_second_id, r9, 1, 0
+        create_table_entry boot_second_id, boot_third_id, r9, 2, 0
         create_mapping_entry boot_third_id, r9, r9
 
         /*
@@ -537,7 +542,7 @@ create_page_tables:
         bne   use_temporary_mapping
 
         mov_w r0, XEN_VIRT_START
-        create_table_entry boot_pgtable, boot_second, r0, 1
+        create_table_entry boot_pgtable, boot_second, r0, 1, 0
         mov   r12, #0                /* r12 := temporary mapping not created */
         mov   pc, lr
 
@@ -551,7 +556,7 @@ use_temporary_mapping:
 
         /* Map boot_second (cover Xen mappings) to the temporary 1st slot */
         mov_w r0, TEMPORARY_XEN_VIRT_START
-        create_table_entry boot_pgtable, boot_second, r0, 1
+        create_table_entry boot_pgtable, boot_second, r0, 1, 0
 
         mov   r12, #1                /* r12 := temporary mapping created */
         mov   pc, lr
@@ -578,7 +583,7 @@ enable_mmu:
         flush_xen_tlb_local r0
 
         /* Write Xen's PT's paddr into the HTTBR */
-        load_paddr r0, boot_pgtable
+        adr_l r0, boot_pgtable
         mov   r1, #0                 /* r0:r1 is paddr (boot_pagetable) */
         mcrr  CP64(r0, r1, HTTBR)
         isb
@@ -658,7 +663,7 @@ switch_to_runtime_mapping:
 
         /* Map boot_second into boot_pgtable */
         mov_w r0, XEN_VIRT_START
-        create_table_entry boot_pgtable, boot_second, r0, 1
+        create_table_entry boot_pgtable, boot_second, r0, 1, 1
 
         /* Ensure any page table updates are visible before continuing */
         dsb   nsh
@@ -739,7 +744,7 @@ setup_fixmap:
 #endif
         /* Map fixmap into boot_second */
         mov_w r0, FIXMAP_ADDR(0)
-        create_table_entry boot_second, xen_fixmap, r0, 2
+        create_table_entry boot_second, xen_fixmap, r0, 2, 0
         /* Ensure any page table updates made above have occurred. */
         dsb   nshst
         /*
@@ -897,8 +902,8 @@ ENTRY(lookup_processor_type)
  */
 __lookup_processor_type:
         mrc   CP32(r0, MIDR)                /* r0 := our cpu id */
-        load_paddr r1, __proc_info_start
-        load_paddr r2, __proc_info_end
+        adr_l r1, __proc_info_start
+        adr_l r2, __proc_info_end
 1:      ldr   r3, [r1, #PROCINFO_cpu_mask]
         and   r4, r0, r3                    /* r4 := our cpu id with mask */
         ldr   r3, [r1, #PROCINFO_cpu_val]   /* r3 := cpu val in current proc 
info */
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.