From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Alejandro Vallejo <alejandro.vallejo@cloud.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 v2 1/5] arm/mm: Document the differences between arm32 and arm64 directmaps
Date: Fri, 28 Jul 2023 08:58:59 +0100 [thread overview]
Message-ID: <20230728075903.7838-2-alejandro.vallejo@cloud.com> (raw)
In-Reply-To: <20230728075903.7838-1-alejandro.vallejo@cloud.com>
arm32 merely covers the XENHEAP, whereas arm64 currently covers anything in
the frame table. These comments highlight why arm32 doesn't need to account for PDX
compression in its __va() implementation while arm64 does.
Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
v2:
* Removed statement about "containing GiB" (Julien)
---
xen/arch/arm/include/asm/mm.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 4262165ce2..5b530f0f40 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -280,6 +280,19 @@ static inline paddr_t __virt_to_maddr(vaddr_t va)
#define virt_to_maddr(va) __virt_to_maddr((vaddr_t)(va))
#ifdef CONFIG_ARM_32
+/**
+ * Find the virtual address corresponding to a machine address
+ *
+ * Only memory backing the XENHEAP has a corresponding virtual address to
+ * be found. This is so we can save precious virtual space, as it's in
+ * short supply on arm32. This mapping is not subject to PDX compression
+ * because XENHEAP is known to be physically contiguous and can't hence
+ * jump over the PDX hole. This means we can avoid the roundtrips
+ * converting to/from pdx.
+ *
+ * @param ma Machine address
+ * @return Virtual address mapped to `ma`
+ */
static inline void *maddr_to_virt(paddr_t ma)
{
ASSERT(is_xen_heap_mfn(maddr_to_mfn(ma)));
@@ -287,6 +300,19 @@ static inline void *maddr_to_virt(paddr_t ma)
return (void *)(unsigned long) ma + XENHEAP_VIRT_START;
}
#else
+/**
+ * Find the virtual address corresponding to a machine address
+ *
+ * The directmap covers all conventional memory accesible by the
+ * hypervisor. This means it's subject to PDX compression.
+ *
+ * Note there's an extra offset applied (directmap_base_pdx) on top of the
+ * regular PDX compression logic. Its purpose is to skip over the initial
+ * range of non-existing memory, should there be one.
+ *
+ * @param ma Machine address
+ * @return Virtual address mapped to `ma`
+ */
static inline void *maddr_to_virt(paddr_t ma)
{
ASSERT((mfn_to_pdx(maddr_to_mfn(ma)) - directmap_base_pdx) <
--
2.34.1
next prev parent reply other threads:[~2023-07-28 7:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 7:58 [PATCH v2 0/5] Make PDX compression optional Alejandro Vallejo
2023-07-28 7:58 ` Alejandro Vallejo [this message]
2023-07-28 9:05 ` [PATCH v2 1/5] arm/mm: Document the differences between arm32 and arm64 directmaps Julien Grall
2023-08-07 13:45 ` Julien Grall
2023-07-28 7:59 ` [PATCH v2 2/5] mm: Factor out the pdx compression logic in ma/va converters Alejandro Vallejo
2023-07-28 9:07 ` Julien Grall
2023-07-31 15:15 ` Jan Beulich
2023-08-07 16:26 ` Alejandro Vallejo
2023-08-08 6:05 ` Jan Beulich
2023-08-08 7:58 ` Julien Grall
2023-07-28 7:59 ` [PATCH v2 3/5] mm/pdx: Standardize region validation wrt pdx compression Alejandro Vallejo
2023-07-28 16:19 ` Julien Grall
2023-07-31 15:27 ` Jan Beulich
2023-08-07 16:50 ` Alejandro Vallejo
2023-07-28 7:59 ` [PATCH v2 4/5] pdx: Reorder pdx.[ch] Alejandro Vallejo
2023-07-28 16:20 ` Julien Grall
2023-07-28 7:59 ` [PATCH v2 5/5] pdx: Add CONFIG_HAS_PDX_COMPRESSION as a common Kconfig option Alejandro Vallejo
2023-07-28 16:27 ` Julien Grall
2023-07-28 16:36 ` Andrew Cooper
2023-07-28 16:58 ` Andrew Cooper
2023-07-31 8:00 ` Jan Beulich
2023-07-31 17:38 ` Andrew Cooper
2023-08-01 7:57 ` Jan Beulich
2023-08-07 16:06 ` Alejandro Vallejo
2023-08-08 6:17 ` Jan Beulich
2023-07-31 9:09 ` Julien Grall
2023-07-31 15:33 ` Jan Beulich
2023-08-07 17:48 ` Julien Grall
2023-08-08 9:52 ` Alejandro Vallejo
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=20230728075903.7838-2-alejandro.vallejo@cloud.com \
--to=alejandro.vallejo@cloud.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.