All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Orzel <michal.orzel@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: Michal Orzel <michal.orzel@amd.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: [PATCH 3/3] xen/arm64/mmu: head: Replace load_paddr with adr_l where appropriate
Date: Tue, 21 Nov 2023 10:45:16 +0100	[thread overview]
Message-ID: <20231121094516.24714-4-michal.orzel@amd.com> (raw)
In-Reply-To: <20231121094516.24714-1-michal.orzel@amd.com>

Macros load_paddr and adr_l are equivalent when used before the MMU is
enabled, resulting in obtaining physical address of a symbol. The former
requires to know the physical offset (PA - VA) and can be used both before
and after the MMU is enabled. In the spirit of using something only when
truly necessary, replace all instances of load_paddr with adr_l, except
in create_table_entry macro. Even though there is currently no use of
load_paddr after MMU is enabled, this macro used to be call in such a
context and we can't rule out that it won't happen again.

This way, the logic behind using load_paddr/adr_l is consistent between
arm32 and arm64, making it easier for developers to determine which one
to use and when.

Take the opportunity to fix a comment with incorrect function name.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm64/mmu/head.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/arm64/mmu/head.S b/xen/arch/arm/arm64/mmu/head.S
index 10774f30e40e..41779020eb4d 100644
--- a/xen/arch/arm/arm64/mmu/head.S
+++ b/xen/arch/arm/arm64/mmu/head.S
@@ -146,10 +146,10 @@ create_page_tables:
 
         /*
          * We need to use a stash register because
-         * create_table_entry_paddr() will clobber the register storing
+         * create_table_entry_from_paddr() will clobber the register storing
          * the physical address of the table to point to.
          */
-        load_paddr x4, boot_third
+        adr_l x4, boot_third
         ldr   x1, =XEN_VIRT_START
 .rept XEN_NR_ENTRIES(2)
         mov   x0, x4                            /* x0 := paddr(l3 table) */
@@ -311,7 +311,7 @@ ENDPROC(enable_mmu)
 ENTRY(enable_secondary_cpu_mm)
         mov   x6, lr
 
-        load_paddr x0, init_ttbr
+        adr_l x0, init_ttbr
         ldr   x0, [x0]
 
         mov   x1, #SCTLR_Axx_ELx_WXN        /* Enable WxN from the start */
@@ -336,7 +336,7 @@ ENTRY(enable_boot_cpu_mm)
         mov   x6, lr
 
         bl    create_page_tables
-        load_paddr x0, boot_pgtable
+        adr_l x0, boot_pgtable
 
         mov   x1, #0        /* No extra SCTLR flags */
         bl    enable_mmu
-- 
2.25.1



  parent reply	other threads:[~2023-11-21  9:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21  9:45 [PATCH 0/3] xen/arm64: head: misc cleanup Michal Orzel
2023-11-21  9:45 ` [PATCH 1/3] xen/arm64: head: Move earlyprintk 'hex' string to .rodata.str Michal Orzel
2023-11-21 15:48   ` Luca Fancellu
2023-11-21 16:09   ` Julien Grall
2023-11-21 17:00     ` Michal Orzel
2023-11-21 17:04       ` Julien Grall
2023-11-21 17:18         ` Michal Orzel
2023-11-21 18:31           ` Julien Grall
2023-11-22  7:54             ` Michal Orzel
2023-11-21  9:45 ` [PATCH 2/3] xen/arm64: Move print_reg macro to asm/arm64/macros.h Michal Orzel
2023-11-21 16:05   ` Luca Fancellu
2023-11-21 16:16   ` Julien Grall
2023-11-21 17:02     ` Michal Orzel
2023-11-21  9:45 ` Michal Orzel [this message]
2023-11-21 16:30   ` [PATCH 3/3] xen/arm64/mmu: head: Replace load_paddr with adr_l where appropriate Julien Grall
2023-11-21 18:13     ` Michal Orzel
2023-11-21 18:43       ` Julien Grall
2023-11-22  8:12         ` Michal Orzel
2023-11-21 16:31   ` Luca Fancellu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231121094516.24714-4-michal.orzel@amd.com \
    --to=michal.orzel@amd.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.