diff mbox series

[v3,04/52] xen/arm: add .text.idmap in ld script for Xen identity map sections

Message ID 20230626033443.2943270-5-Penny.Zheng@arm.com (mailing list archive)
State New, archived
Headers show
Series xen/arm: Add Armv8-R64 MPU support to Xen - Part#1 | expand

Commit Message

Penny Zheng June 26, 2023, 3:33 a.m. UTC
From: Wei Chen <wei.chen@arm.com>

Only the first 4KB of Xen image will be mapped as identity
(PA == VA). At the moment, Xen guarantees this by having
everything that needs to be used in the identity mapping
in .text.header section of head.S, and the size will be
checked by _idmap_start and _idmap_end at link time if this
fits in 4KB.

In a later patch, we will move the MMU specific code out
of head.S. Although we can add .text.header to the new file
to guarantee all identity map code still in the first 4KB.
However, the order of these two files on this 4KB depends
on the build tools. Currently, we use the build tools to
process the order of objs in the Makefile to ensure that
head.S must be at the top. But if you change to another
build tools, it might not be the same result.

In this patch we introduce a new section named .text.idmap
in the region between _idmap_start and _idmap_end. And in
Xen link script, we force the .text.idmap contents to linked
after .text.header. This will ensure code of head.S always be
at the top of Xen binary.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
v1 -> v2:
1. New patch.
---
v3:
1. adapt to changes to "_end_boot"
---
 xen/arch/arm/xen.lds.S | 1 +
 1 file changed, 1 insertion(+)

Comments

Julien Grall July 4, 2023, 7:24 p.m. UTC | #1
Hi Penny,

On 26/06/2023 04:33, Penny Zheng wrote:
> From: Wei Chen <wei.chen@arm.com>
> 
> Only the first 4KB of Xen image will be mapped as identity
> (PA == VA). At the moment, Xen guarantees this by having
> everything that needs to be used in the identity mapping
> in .text.header section of head.S, and the size will be
> checked by _idmap_start and _idmap_end at link time if this
> fits in 4KB.
> 
> In a later patch, we will move the MMU specific code out
> of head.S. Although we can add .text.header to the new file
> to guarantee all identity map code still in the first 4KB.
> However, the order of these two files on this 4KB depends
> on the build tools. Currently, we use the build tools to
> process the order of objs in the Makefile to ensure that
> head.S must be at the top. But if you change to another
> build tools, it might not be the same result.
> 
> In this patch we introduce a new section named .text.idmap
> in the region between _idmap_start and _idmap_end. And in
> Xen link script, we force the .text.idmap contents to linked
> after .text.header. This will ensure code of head.S always be
> at the top of Xen binary.
> 
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>

Now that this patch is only a single line change, I would fold it in the 
patch introducing the first user (i.e. patch #7).

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index be58c2c395..4f7daa7dca 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -34,6 +34,7 @@  SECTIONS
        _stext = .;             /* Text section */
        _idmap_start = .;
        *(.text.header)
+       *(.text.idmap)
        _idmap_end = .;
 
        *(.text.cold)