All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elias El Yandouzi <eliasely@amazon.com>
To: <xen-devel@lists.xenproject.org>
Cc: julien@xen.org, pdurrant@amazon.com, dwmw@amazon.com,
	"Elias El Yandouzi" <eliasely@amazon.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>
Subject: [PATCH v2 (resend) 23/27] Rename maddr_to_virt() calls
Date: Tue, 16 Jan 2024 19:26:07 +0000	[thread overview]
Message-ID: <20240116192611.41112-24-eliasely@amazon.com> (raw)
In-Reply-To: <20240116192611.41112-1-eliasely@amazon.com>

Until directmap gets completely removed, we'd still need to
keep some calls to mmaddr_to_virt() for xenheap pages or when the
directmap is enabled.

Rename the macro to maddr_to_directmap_virt() to flag them and
prevent further use of maddr_to_virt().

Signed-off-by: Elias El Yandouzi <eliasely@amazon.com>

diff --git a/xen/arch/x86/dmi_scan.c b/xen/arch/x86/dmi_scan.c
index 81f80c053a..ac016f3a04 100644
--- a/xen/arch/x86/dmi_scan.c
+++ b/xen/arch/x86/dmi_scan.c
@@ -277,7 +277,7 @@ const char *__init dmi_get_table(paddr_t *base, u32 *len)
 			return "SMBIOS";
 		}
 	} else {
-		char __iomem *p = maddr_to_virt(0xF0000), *q;
+		char __iomem *p = maddr_to_directmap_virt(0xF0000), *q;
 		union {
 			struct dmi_eps dmi;
 			struct smbios3_eps smbios3;
@@ -364,7 +364,7 @@ static int __init dmi_iterate(void (*decode)(const struct dmi_header *))
 	dmi.size = 0;
 	smbios3.length = 0;
 
-	p = maddr_to_virt(0xF0000);
+	p = maddr_to_directmap_virt(0xF0000);
 	for (q = p; q < p + 0x10000; q += 16) {
 		if (!dmi.size) {
 			memcpy_fromio(&dmi, q, sizeof(dmi));
diff --git a/xen/arch/x86/include/asm/mach-default/bios_ebda.h b/xen/arch/x86/include/asm/mach-default/bios_ebda.h
index 42de6b2a5b..8cfe53d1f2 100644
--- a/xen/arch/x86/include/asm/mach-default/bios_ebda.h
+++ b/xen/arch/x86/include/asm/mach-default/bios_ebda.h
@@ -7,7 +7,7 @@
  */
 static inline unsigned int get_bios_ebda(void)
 {
-	unsigned int address = *(unsigned short *)maddr_to_virt(0x40E);
+	unsigned int address = *(unsigned short *)maddr_to_directmap_virt(0x40E);
 	address <<= 4;
 	return address;	/* 0 means none */
 }
diff --git a/xen/arch/x86/include/asm/page.h b/xen/arch/x86/include/asm/page.h
index c6891b52d4..bf7bf08ba4 100644
--- a/xen/arch/x86/include/asm/page.h
+++ b/xen/arch/x86/include/asm/page.h
@@ -240,11 +240,11 @@ void copy_page_sse2(void *to, const void *from);
 
 /* Convert between Xen-heap virtual addresses and machine addresses. */
 #define __pa(x)             (virt_to_maddr(x))
-#define __va(x)             (maddr_to_virt(x))
+#define __va(x)             (maddr_to_directmap_virt(x))
 
 /* Convert between Xen-heap virtual addresses and machine frame numbers. */
 #define __virt_to_mfn(va)   (virt_to_maddr(va) >> PAGE_SHIFT)
-#define __mfn_to_virt(mfn)  (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
+#define __mfn_to_virt(mfn)  (maddr_to_directmap_virt((paddr_t)(mfn) << PAGE_SHIFT))
 
 /* Convert between machine frame numbers and page-info structures. */
 #define mfn_to_page(mfn)    (frame_table + mfn_to_pdx(mfn))
@@ -270,7 +270,7 @@ void copy_page_sse2(void *to, const void *from);
 #define virt_to_mfn(va)     __virt_to_mfn(va)
 #define mfn_to_directmap_virt(mfn)    __mfn_to_virt(mfn)
 #define virt_to_maddr(va)   __virt_to_maddr((unsigned long)(va))
-#define maddr_to_virt(ma)   __maddr_to_virt((unsigned long)(ma))
+#define maddr_to_directmap_virt(ma)   __maddr_to_directmap_virt((unsigned long)(ma))
 #define maddr_to_page(ma)   __maddr_to_page(ma)
 #define page_to_maddr(pg)   __page_to_maddr(pg)
 #define virt_to_page(va)    __virt_to_page(va)
diff --git a/xen/arch/x86/include/asm/x86_64/page.h b/xen/arch/x86/include/asm/x86_64/page.h
index f49e10475f..b9e47da46e 100644
--- a/xen/arch/x86/include/asm/x86_64/page.h
+++ b/xen/arch/x86/include/asm/x86_64/page.h
@@ -46,7 +46,7 @@ static inline unsigned long __virt_to_maddr(unsigned long va)
     return xen_phys_start + va - XEN_VIRT_START;
 }
 
-static inline void *__maddr_to_virt(unsigned long ma)
+static inline void *__maddr_to_directmap_virt(unsigned long ma)
 {
     /* Offset in the direct map, accounting for pdx compression */
     unsigned long va_offset = maddr_to_directmapoff(ma);
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index d8ccab2449..69181b0abe 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -664,7 +664,7 @@ void __init get_smp_config (void)
 
 static int __init smp_scan_config (unsigned long base, unsigned long length)
 {
-	unsigned int *bp = maddr_to_virt(base);
+	unsigned int *bp = maddr_to_directmap_virt(base);
 	struct intel_mp_floating *mpf;
 
 	Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length);
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 39aed5845d..1b02e2b6d5 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -1764,7 +1764,7 @@ void __init efi_init_memory(void)
                 if ( map_pages_to_xen((unsigned long)mfn_to_directmap_virt(smfn),
                                     _mfn(smfn), emfn - smfn, prot) == 0 )
                     desc->VirtualStart =
-                        (unsigned long)maddr_to_virt(desc->PhysicalStart);
+                        (unsigned long)maddr_to_directmap_virt(desc->PhysicalStart);
                 else
                     printk(XENLOG_ERR "Could not map MFNs %#lx-%#lx\n",
                         smfn, emfn - 1);
-- 
2.40.1



  parent reply	other threads:[~2024-01-16 19:37 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 19:25 [PATCH v2 (resend) 00/27] Remove the directmap Elias El Yandouzi
2024-01-16 19:25 ` [PATCH v2 (resend) 01/27] xen/vmap: Check the page has been mapped in vm_init_type() Elias El Yandouzi
2024-01-25 16:14   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 02/27] x86/setup: Move vm_init() before acpi calls Elias El Yandouzi
2024-01-25 16:17   ` Jan Beulich
2024-02-05 22:55     ` Stefano Stabellini
2024-01-16 19:25 ` [PATCH v2 (resend) 03/27] xen/vmap: Introduce vmap_size() and use it Elias El Yandouzi
2024-01-25 16:26   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 04/27] acpi: vmap pages in acpi_os_alloc_memory Elias El Yandouzi
2024-01-25 16:28   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 05/27] xen/numa: vmap the pages for memnodemap Elias El Yandouzi
2024-01-25 16:30   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 06/27] x86/srat: vmap the pages for acpi_slit Elias El Yandouzi
2024-01-25 16:32   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 07/27] x86: Map/unmap pages in restore_all_guests Elias El Yandouzi
2024-02-20  9:51   ` Jan Beulich
2024-04-30 16:08     ` Elias El Yandouzi
2024-05-02  6:48       ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 08/27] x86/pv: Domheap pages should be mapped while relocating initrd Elias El Yandouzi
2024-02-20 10:07   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 09/27] x86/pv: Rewrite how building PV dom0 handles domheap mappings Elias El Yandouzi
2024-02-20 10:28   ` Jan Beulich
2024-05-07 15:21     ` Elias El Yandouzi
2024-01-16 19:25 ` [PATCH v2 (resend) 10/27] x86/pv: Map L4 page table for shim domain Elias El Yandouzi
2024-02-20 10:37   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 11/27] x86: Lift mapcache variable to the arch level Elias El Yandouzi
2024-02-20 10:46   ` Jan Beulich
2024-05-07 15:22     ` Elias El Yandouzi
2024-01-16 19:25 ` [PATCH v2 (resend) 12/27] x86/mapcache: Initialise the mapcache for the idle domain Elias El Yandouzi
2024-02-20 10:51   ` Jan Beulich
2024-05-07 15:25     ` Elias El Yandouzi
2024-01-16 19:25 ` [PATCH v2 (resend) 13/27] x86: Add a boot option to enable and disable the direct map Elias El Yandouzi
2024-02-20 11:14   ` Jan Beulich
2024-01-16 19:25 ` [PATCH v2 (resend) 14/27] xen/arm: fixmap: Rename the fixmap slots to follow the x86 convention Elias El Yandouzi
2024-01-16 19:25 ` [PATCH v2 (resend) 15/27] xen/x86: Add support for the PMAP Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 16/27] xen/x86: Add build assertion for fixmap entries Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 17/27] x86/domain_page: Remove the fast paths when mfn is not in the directmap Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 18/27] xen/page_alloc: Add a path for xenheap when there is no direct map Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 19/27] x86/setup: Leave early boot slightly earlier Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 20/27] x86/setup: vmap heap nodes when they are outside the direct map Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 21/27] x86/setup: Do not create valid mappings when directmap=no Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 22/27] Rename mfn_to_virt() calls Elias El Yandouzi
2024-01-16 19:26 ` Elias El Yandouzi [this message]
2024-01-16 19:26 ` [PATCH v2 (resend) 24/27] xen/arm32: mm: Rename 'first' to 'root' in init_secondary_pagetables() Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 25/27] xen/arm64: mm: Use per-pCPU page-tables Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 26/27] xen/arm64: Implement a mapcache for arm64 Elias El Yandouzi
2024-01-16 19:26 ` [PATCH v2 (resend) 27/27] xen/arm64: Allow the admin to enable/disable the directmap Elias El Yandouzi
2024-01-29  8:28 ` [PATCH v2 (resend) 00/27] Remove " Jan Beulich
2024-02-05 11:11   ` Elias El Yandouzi
2024-02-16 17:17     ` Julien Grall
2024-03-25 10:31 ` Jan Beulich

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=20240116192611.41112-24-eliasely@amazon.com \
    --to=eliasely@amazon.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dwmw@amazon.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=pdurrant@amazon.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.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.