[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86: convert set_gpfn_from_mfn() to a function
commit c297c9453375892284810f0dc46d408865f9998b Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Aug 24 15:38:03 2020 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Aug 24 15:38:03 2020 +0200 x86: convert set_gpfn_from_mfn() to a function It is already a little too heavy for a macro, and more logic is about to get added to it. This also allows reducing the scope of compat_machine_to_phys_mapping. Requested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/x86_64/mm.c | 16 ++++++++++++++++ xen/include/asm-x86/mm.h | 16 ++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index 102079a801..227eba911e 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -40,6 +40,8 @@ EMIT_FILE; #include <asm/mem_sharing.h> #include <public/memory.h> +#define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START) + unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START; l2_pgentry_t *compat_idle_pg_table_l2; @@ -1454,6 +1456,20 @@ destroy_frametable: return ret; } +void set_gpfn_from_mfn(unsigned long mfn, unsigned long pfn) +{ + const struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn))); + unsigned long entry = (d && (d == dom_cow)) ? SHARED_M2P_ENTRY : pfn; + + if ( unlikely(!machine_to_phys_mapping_valid) ) + return; + + if ( mfn < (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) / 4 ) + compat_machine_to_phys_mapping[mfn] = entry; + + machine_to_phys_mapping[mfn] = entry; +} + #include "compat/mm.c" /* diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 7e74996053..89a55592c4 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -494,25 +494,13 @@ extern paddr_t mem_hotplug; #define SHARED_M2P_ENTRY (~0UL - 1UL) #define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY) -#define compat_machine_to_phys_mapping ((unsigned int *)RDWR_COMPAT_MPT_VIRT_START) -#define _set_gpfn_from_mfn(mfn, pfn) ({ \ - struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn))); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ - ((void)((mfn) >= (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) / 4 || \ - (compat_machine_to_phys_mapping[(mfn)] = (unsigned int)(entry))), \ - machine_to_phys_mapping[(mfn)] = (entry)); \ - }) - /* * Disable some users of set_gpfn_from_mfn() (e.g., free_heap_pages()) until * the machine_to_phys_mapping is actually set up. */ extern bool machine_to_phys_mapping_valid; -#define set_gpfn_from_mfn(mfn, pfn) do { \ - if ( machine_to_phys_mapping_valid ) \ - _set_gpfn_from_mfn(mfn, pfn); \ -} while (0) + +void set_gpfn_from_mfn(unsigned long mfn, unsigned long pfn); extern struct rangeset *mmio_ro_ranges; -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |