Message ID | 3d34dbc7a8af373b799d1e0c1c99acfa3798f37d.1733937787.git.oleksii.kurochko@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Unflattening and relocation of host device tree | expand |
On 11.12.2024 18:27, Oleksii Kurochko wrote: > @@ -433,3 +434,19 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) > { > return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE); > } > + > +/* Map a 4k page in a fixmap entry */ > +void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags) > +{ > + if ( map_pages_to_xen(FIXMAP_ADDR(map), mfn, 1, flags | PTE_SMALL) != 0 ) > + BUG(); > +} > + > +/* Remove a mapping from a fixmap entry */ > +void clear_fixmap(unsigned int map) > +{ > + if ( destroy_xen_mappings( > + FIXMAP_ADDR(map), > + FIXMAP_ADDR(map) + PAGE_SIZE) != 0 ) There are multiple options of how to indent such wrapped lines in function invocations, but this isn't one of them. if ( destroy_xen_mappings( FIXMAP_ADDR(map), FIXMAP_ADDR(map) + PAGE_SIZE) != 0 ) (arguments offset by 4 from the function name, which may not be a multiple of 4 from the start of the line) or if ( destroy_xen_mappings(FIXMAP_ADDR(map), FIXMAP_ADDR(map) + PAGE_SIZE) != 0 ) Jan
diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h index 818c8ce07b..e399a15f53 100644 --- a/xen/arch/riscv/include/asm/fixmap.h +++ b/xen/arch/riscv/include/asm/fixmap.h @@ -32,6 +32,11 @@ */ extern pte_t xen_fixmap[]; +/* Map a page in a fixmap entry */ +void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags); +/* Remove a mapping from a fixmap entry */ +void clear_fixmap(unsigned int map); + #define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot)) static inline unsigned int virt_to_fix(vaddr_t vaddr) diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c index 86bd9ea613..3407fda937 100644 --- a/xen/arch/riscv/pt.c +++ b/xen/arch/riscv/pt.c @@ -8,6 +8,7 @@ #include <xen/pmap.h> #include <xen/spinlock.h> +#include <asm/fixmap.h> #include <asm/flushtlb.h> #include <asm/page.h> @@ -433,3 +434,19 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) { return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE); } + +/* Map a 4k page in a fixmap entry */ +void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags) +{ + if ( map_pages_to_xen(FIXMAP_ADDR(map), mfn, 1, flags | PTE_SMALL) != 0 ) + BUG(); +} + +/* Remove a mapping from a fixmap entry */ +void clear_fixmap(unsigned int map) +{ + if ( destroy_xen_mappings( + FIXMAP_ADDR(map), + FIXMAP_ADDR(map) + PAGE_SIZE) != 0 ) + BUG(); +}