diff mbox series

[v2,34/38] ppc: qemu: Delete the temporary FDT virtual-physical mapping after U-Boot is relocated

Message ID 1613663886-83811-35-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Priyanka Jain
Headers show
Series ppc: qemu: Convert qemu-ppce500 to driver model and enable additional driver support | expand

Commit Message

Bin Meng Feb. 18, 2021, 3:58 p.m. UTC
After U-Boot is relocated to RAM already, the previous temporary FDT
virtual-physical mapping that was used in the pre-relocation phase
is no longer needed. Let's delete the mapping.

get_fdt_virt() might be used before and after relocation, update it
to return different virtual address of FDT.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- new patch: ppc: qemu: Delete the temporary FDT virtual-physical mapping after U-Boot is relocated

 board/freescale/qemu-ppce500/qemu-ppce500.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Priyanka Jain Feb. 22, 2021, 9:16 a.m. UTC | #1
>-----Original Message-----
>From: Bin Meng <bmeng.cn@gmail.com>
>Sent: Thursday, February 18, 2021 9:28 PM
>To: Simon Glass <sjg@chromium.org>; Alexander Graf <agraf@csgraf.de>;
>Priyanka Jain <priyanka.jain@nxp.com>
>Cc: U-Boot Mailing List <u-boot@lists.denx.de>; Tom Rini
><trini@konsulko.com>
>Subject: [PATCH v2 34/38] ppc: qemu: Delete the temporary FDT virtual-
>physical mapping after U-Boot is relocated
>
>After U-Boot is relocated to RAM already, the previous temporary FDT virtual-
>physical mapping that was used in the pre-relocation phase is no longer
>needed. Let's delete the mapping.
>
>get_fdt_virt() might be used before and after relocation, update it to return
>different virtual address of FDT.
>
>Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
>---
>
>Changes in v2:
>- new patch: ppc: qemu: Delete the temporary FDT virtual-physical mapping
>after U-Boot is relocated
>
> board/freescale/qemu-ppce500/qemu-ppce500.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>

Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
diff mbox series

Patch

diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index 9c30c12..480776a 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -31,7 +31,10 @@  DECLARE_GLOBAL_DATA_PTR;
 
 static void *get_fdt_virt(void)
 {
-	return (void *)CONFIG_SYS_TMPVIRT;
+	if (gd->flags & GD_FLG_RELOC)
+		return (void *)gd->fdt_blob;
+	else
+		return (void *)CONFIG_SYS_TMPVIRT;
 }
 
 static uint64_t get_fdt_phys(void)
@@ -138,6 +141,12 @@  int misc_init_r(void)
 	 */
 	virtio_init();
 
+	/*
+	 * U-Boot is relocated to RAM already, let's delete the temporary FDT
+	 * virtual-physical mapping that was used in the pre-relocation phase.
+	 */
+	disable_tlb(find_tlb_idx((void *)CONFIG_SYS_TMPVIRT, 1));
+
 	return 0;
 }