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

[xen staging] xen/arm: mm: Don't open-code Xen PT update in remove_early_mappings()



commit 6eb5a9396413896a696c4d6dda2e26c4c94589bf
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Fri May 20 13:09:25 2022 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Wed Jun 8 11:04:53 2022 +0100

    xen/arm: mm: Don't open-code Xen PT update in remove_early_mappings()
    
    Now that xen_pt_update_entry() is able to deal with different mapping
    size, we can replace the open-coding of the page-tables update by a call
    to modify_xen_mappings().
    
    As the function is not meant to fail, a BUG_ON() is added to check the
    return.
    
    Note that we don't use destroy_xen_mappings() because the helper doesn't
    allow us to pass a flags. In theory we could add an extra parameter to
    the function, however there are no other expected users. Hence why
    modify_xen_mappings() is used.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Reviewed-by: Hongda Deng <Hongda.Heng@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/mm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 747083d820..64a79d45b3 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -614,11 +614,12 @@ void * __init early_fdt_map(paddr_t fdt_paddr)
 
 void __init remove_early_mappings(void)
 {
-    lpae_t pte = {0};
-    write_pte(xen_second + second_table_offset(BOOT_FDT_VIRT_START), pte);
-    write_pte(xen_second + second_table_offset(BOOT_FDT_VIRT_START + SZ_2M),
-              pte);
-    flush_xen_tlb_range_va(BOOT_FDT_VIRT_START, BOOT_FDT_SLOT_SIZE);
+    int rc;
+
+    /* destroy the _PAGE_BLOCK mapping */
+    rc = modify_xen_mappings(BOOT_FDT_VIRT_START, BOOT_FDT_VIRT_END,
+                             _PAGE_BLOCK);
+    BUG_ON(rc);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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