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

Re: [PATCH v2 2/2] xen/arm32: head Split and move MMU-specific head.S to mmu/head.S



Hi Ayan,

On 03/11/2023 17:34, Ayan Kumar Halder wrote:
The MMU specific code in head.S will not be used on MPU systems.
Instead of introducing more #ifdefs which will bring complexity
to the code, move MMU related code to mmu/head.S and keep common
code in head.S. Two notes while moving:
  - As "fail" in original head.S is very simple and this name is too
    easy to be conflicted, duplicate it in mmu/head.S instead of
    exporting it.
  - Use ENTRY() for enable_secondary_cpu_mm, enable_boot_cpu_mm and
    setup_fixmap as they will be used externally.

Also move the assembly macros shared by head.S and mmu/head.S to
macros.h.

Note that, 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. Since we are introducing a new head.S
in this patch, 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 toolchains.
Hence, introduce a new section named .text.idmap in the region between
_idmap_start and _idmap_end. And in Xen linker 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.
This paragraph doesn't make much sense as you don't introduce .text.idmap. Instead, you piggy back on a previous commit. So I would suggest to delete it.

[...]

+.macro create_mapping_entry, ptbl, virt, phys, type=PT_MEM_L3
+        mov_w r2, XEN_PT_LPAE_ENTRY_MASK
+        lsr   r1, \virt, #THIRD_SHIFT
+        and   r1, r1, r2             /* r1 := slot in \tlb */
+        lsl   r1, r1, #3             /* r1 := slot offset in \tlb */
+
+        lsr   r4, \phys, #THIRD_SHIFT
+        lsl   r4, r4, #THIRD_SHIFT   /* r4 := PAGE_ALIGNED(phys) */
+
+        movw  r2, #\type             /* r2:r3 := right for section PT */
+        orr   r2, r2, r4             /*          + PAGE_ALIGNED(phys) */
+        mov   r3, #0
+
+        adr_l r4, \ptbl
+
+        strd  r2, r3, [r4, r1]
+.endm

Newline here please.

+.section .text.idmap, "ax", %progbits

Cheers,

--
Julien Grall



 


Rackspace

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