xen: Convert __page_to_mfn and _mfn_to_page to use typesafe MFN
v3 cover xen: Convert __page_to_mfn and _mfn_to_page to use typesafe MFN
Hi all,
Most of the users of page_to_mfn and mfn_to_page are either overriding the macros to make them work with mfn_t or use mfn_x/_mfn becaue the rest of the function use mfn_t.
So I think it is time to make __page_to_mfn and __mfn_to_page using typesafe MFN.
The first 3 patches will convert of the code to use typesafe MFN, easing the tree-wide conversion in patch 4.
Note that this was only build tested it on x86.
Cheers,
Julien Grall (4):
xen/arm: domain_build: Clean-up insert_11_bank xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash xen/tmem: Convert the file common/tmem_xen.c to use typesafe MFN
xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
xen/arch/arm/domain_build.c | 15 ++++++++------- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 8 ++++---- xen/arch/arm/p2m.c | 10 ++-------- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/domain.c | 21 +++++++++++---------- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/hvm.c | 16 ++++++++-------- xen/arch/x86/hvm/ioreq.c | 6 +++--- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/viridian.c | 6 +++--- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +++++----- xen/arch/x86/hvm/vmx/vvmx.c | 6 +++--- xen/arch/x86/mm.c | 6 ------ xen/arch/x86/mm/guest_walk.c | 6 +++--- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 ------ xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 5 ----- xen/arch/x86/mm/p2m-ept.c | 4 ++++ xen/arch/x86/mm/p2m-pod.c | 6 ------ xen/arch/x86/mm/p2m.c | 6 ------ xen/arch/x86/mm/paging.c | 6 ------ xen/arch/x86/mm/shadow/private.h | 16 ++-------------- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 ------ xen/arch/x86/pv/descriptor-tables.c | 10 ---------- xen/arch/x86/pv/dom0_build.c | 6 ++++++ xen/arch/x86/pv/domain.c | 6 ------ xen/arch/x86/pv/emul-gate-op.c | 6 ------ xen/arch/x86/pv/emul-priv-op.c | 10 ---------- xen/arch/x86/pv/grant_table.c | 6 ------ xen/arch/x86/pv/ro-page-fault.c | 6 ------ xen/arch/x86/smpboot.c | 6 ------ xen/arch/x86/tboot.c | 4 ++-- xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/mm.c | 6 ++++++ xen/common/domain.c | 4 ++-- xen/common/grant_table.c | 6 ++++++ xen/common/kimage.c | 6 ------ xen/common/memory.c | 6 ++++++ xen/common/page_alloc.c | 6 ++++++ xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 26 ++++++++++++++------------ xen/common/trace.c | 6 ++++++ xen/common/vmap.c | 9 +++++---- xen/common/xenoprof.c | 2 -- xen/drivers/passthrough/amd/iommu_map.c | 6 ++++++ xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/mm.h | 22 ++++++++++++---------- xen/include/asm-arm/p2m.h | 4 ++-- xen/include/asm-x86/mm.h | 12 ++++++------ xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++++++++++++++---------------- xen/include/xen/domain_page.h | 8 ++++---- xen/include/xen/tmem_xen.h | 2 +- 65 files changed, 191 insertions(+), 255 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 1/4 xen/arm: domain_build: Clean-up insert_11_bank
- Remove spurious ()
- Add missing spaces
- Turn 1 << to 1UL <<
- Rename spfn to smfn and switch to mfn_t
---
Changes in v2:
- Remove double space
- s/spfn/smfn/ and switch to mfn_t
--- xen/arch/arm/domain_build.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
xen/arch/arm/domain_build.c +10 -7
@@ -50,6 +50,8 @@ struct map_range_data/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) +#undef page_to_mfn +#define page_to_mfn (pg) _mfn(__page_to_mfn(pg))//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION
@@ -104,16 +106,16 @@ static bool insert_11_bank(struct domain *d, unsigned int order) {int res, i; -paddr_t spfn; +mfn_t smfn;paddr_t start, size; - spfn =page_to_mfn (pg); - start =pfn_to_paddr (spfn); - size =pfn_to_paddr ((1 << order)); + smfn =page_to_mfn (pg); + start =mfn_to_maddr (smfn); + size =pfn_to_paddr (1UL << order);D11PRINT ("Allocated %#" PRIpaddr"-%#" PRIpaddr" (%ldMB/%ldMB, order %d)\n" , start, start + size, -1UL << (order+PAGE_SHIFT -20 ), +1UL << (order +PAGE_SHIFT -20 ),/* Don't want format this as PRIpaddr (16 digit hex) */ (unsigned long )(kinfo->unassigned_mem >>20 ), order);
@@ -126,7 +128,7 @@ static bool insert_11_bank(struct domain *d, goto fail; } - res =guest_physmap_add_page (d,_gfn (spfn),_mfn (spfn), order); + res =guest_physmap_add_page (d,_gfn (mfn_x (smfn)), smfn, order);if ( res )panic ("Failed map pages to DOM0: %d" , res);
@@ -167,7 +169,8 @@ static bool insert_11_bank(struct domain *d,*/ if ( start + size < bank->start && kinfo->mem.nr_banks <NR_MEM_BANKS ) { -memmove (bank +1 , bank,sizeof (*bank)*(kinfo->mem.nr_banks - i)); +memmove (bank +1 , bank, +sizeof (*bank) * (kinfo->mem.nr_banks - i)); kinfo->mem.nr_banks++; bank->start = start; bank->size = size;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 1/4] xen/arm: domain_build: Clean-up insert_11_bank
Quoted 6 lines · Julien Grall
- Remove spurious ()
- Add missing spaces
- Turn 1 << to 1UL <<
- Rename spfn to smfn and switch tomfn_tSigned-off-by Julien Grall <[email protected]>
Quoted 68 lines
---
Cc Stefano Stabellini <[email protected]>Changes in v2:
- Remove double space
- s/spfn/smfn/ and switch tomfn_t--- xen/arch/arm/domain_build.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)xen/arch/arm/domain_build.c +10
-7@@ -50,6 +50,8 @@ struct map_range_data/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) +#undef page_to_mfn +#define page_to_mfn (pg) _mfn(__page_to_mfn(pg))//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION @@ -104,16 +106,16 @@ static bool insert_11_bank(struct domain *d, unsigned int order) {int res, i; -paddr_t spfn; +mfn_t smfn;paddr_t start, size; - spfn =page_to_mfn (pg); - start =pfn_to_paddr (spfn); - size =pfn_to_paddr ((1 << order)); + smfn =page_to_mfn (pg); + start =mfn_to_maddr (smfn); + size =pfn_to_paddr (1UL << order);D11PRINT ("Allocated %#" PRIpaddr"-%#" PRIpaddr" (%ldMB/%ldMB, order %d)\n" , start, start + size, -1UL << (order+PAGE_SHIFT -20 ), +1UL << (order +PAGE_SHIFT -20 ),/* Don't want format this as PRIpaddr (16 digit hex) */ (unsigned long )(kinfo->unassigned_mem >>20 ), order);@@ -126,7 +128,7 @@ static bool insert_11_bank(struct domain *d, goto fail; } - res =guest_physmap_add_page (d,_gfn (spfn),_mfn (spfn), order); + res =guest_physmap_add_page (d,_gfn (mfn_x (smfn)), smfn, order);if ( res )panic ("Failed map pages to DOM0: %d" , res);@@ -167,7 +169,8 @@ static bool insert_11_bank(struct domain *d,*/ if ( start + size < bank->start && kinfo->mem.nr_banks <NR_MEM_BANKS ) { -memmove (bank +1 , bank,sizeof (*bank)*(kinfo->mem.nr_banks - i)); +memmove (bank +1 , bank, +sizeof (*bank) * (kinfo->mem.nr_banks - i)); kinfo->mem.nr_banks++; bank->start = start; bank->size = size;Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 2/4 xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash
In reply to Julien GrallThe arm32 version of the function is_xen_heap_page currently define a variable _mfn. This will lead to a compiler when use typesafe MFN in a follow-up patch:
called object '_mfn' is not a function or function pointer
Fix it by renaming the local variable _mfn to mfn_.
---
Changes in v3:
- Fix typo in the commit message
--- xen/include/asm-arm/mm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
xen/include/asm-arm/mm.h +3 -3
@@ -140,9 +140,9 @@ extern vaddr_t xenheap_virt_start;#ifdef CONFIG_ARM_32 #define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page))#define is_xen_heap_mfn (mfn) ({ \ - unsigned long _mfn = (mfn); \ - (_mfn >= mfn_x(xenheap_mfn_start) && \ - _mfn < mfn_x(xenheap_mfn_end)); \ + unsigned long mfn_ = (mfn); \ + (mfn_ >= mfn_x(xenheap_mfn_start) && \ + mfn_ < mfn_x(xenheap_mfn_end)); \ })#else #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 2/4] xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash
Quoted 9 lines · Julien Grall
The arm32 version of the function
is_xen_heap_pagecurrently define a variable_mfn. This will lead to a compiler when use typesafe MFN in a follow-up patch:called object '
_mfn' is not a function or function pointerFix it by renaming the local variable
_mfntomfn_.Signed-off-by Julien Grall <[email protected]>
Quoted 30 lines
---
Cc Stefano Stabellini <[email protected]>Changes in v3:
- Fix typo in the commit message--- xen/include/asm-arm/mm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)xen/include/asm-arm/mm.h +3
-3@@ -140,9 +140,9 @@ extern vaddr_t xenheap_virt_start;#ifdef CONFIG_ARM_32 #define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page))#define is_xen_heap_mfn (mfn) ({ \ - unsigned long _mfn = (mfn); \ - (_mfn >= mfn_x(xenheap_mfn_start) && \ - _mfn < mfn_x(xenheap_mfn_end)); \ + unsigned long mfn_ = (mfn); \ + (mfn_ >= mfn_x(xenheap_mfn_start) && \ + mfn_ < mfn_x(xenheap_mfn_end)); \ })#else #define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v3 3/4 xen/tmem: Convert the file common/tmem_xen.c to use typesafe MFN
In reply to Julien GrallThe file common/tmem_xen.c is now converted to use typesafe. This is requiring to override the macro page_to_mfn to make it work with mfn_t.
Note that all variables converted to mfn_t havem there initial value, when set, switch from 0 to INVALID_MFN. This is fine because the initial values was always overriden before used.
Also add a couple of missing newlines suggested by Andrew in the code.
---
Changes in v2:
- Add missing newlines
- Add Andrew's reviewed-by
--- xen/common/tmem_xen.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
xen/common/tmem_xen.c +18 -12
@@ -14,6 +14,10 @@#include <xen/cpu.h> #include <xen/init.h> +/* Override macros from asm/page.h to make them work with mfn_t */ +#undef page_to_mfn +#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) +bool __read_mostly opt_tmem;boolean_param ("tmem" , opt_tmem);
@@ -31,7 +35,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, dstmem); static DEFINE_PER_CPU_READ_MOSTLY(void *, scratch_page);#if defined(CONFIG_ARM ) -static inline void *cli_get_page (xen_pfn_t cmfn,unsigned long *pcli_mfn, +static inline void *cli_get_page (xen_pfn_t cmfn,mfn_t *pcli_mfn,struct page_info **pcli_pfp,bool cli_write) {ASSERT_UNREACHABLE ();
@@ -39,14 +43,14 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, }static inline void cli_put_page (void *cli_va,struct page_info *cli_pfp, -unsigned long cli_mfn,bool mark_dirty) +mfn_t cli_mfn,bool mark_dirty) {ASSERT_UNREACHABLE (); }#else #include <asm/p2m.h> -static inline void *cli_get_page (xen_pfn_t cmfn,unsigned long *pcli_mfn, +static inline void *cli_get_page (xen_pfn_t cmfn,mfn_t *pcli_mfn,struct page_info **pcli_pfp,bool cli_write) {p2m_type_t t;
@@ -68,16 +72,17 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, *pcli_mfn =page_to_mfn (page); *pcli_pfp = page; -return map_domain_page (_mfn (*pcli_mfn)); + +return map_domain_page (*pcli_mfn); }static inline void cli_put_page (void *cli_va,struct page_info *cli_pfp, -unsigned long cli_mfn,bool mark_dirty) +mfn_t cli_mfn,bool mark_dirty) {if ( mark_dirty ) {put_page_and_type (cli_pfp); -paging_mark_dirty (current->domain,_mfn (cli_mfn)); +paging_mark_dirty (current->domain, cli_mfn); }else put_page (cli_pfp);
@@ -88,14 +93,14 @@ static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp,int tmem_copy_from_client (struct page_info *pfp,xen_pfn_t cmfn,tmem_cli_va_param_t clibuf) { -unsigned long tmem_mfn, cli_mfn =0 ; +mfn_t tmem_mfn, cli_mfn =INVALID_MFN ;char *tmem_va, *cli_va =NULL ;struct page_info *cli_pfp =NULL ;int rc =1 ;ASSERT (pfp !=NULL ); tmem_mfn =page_to_mfn (pfp); - tmem_va =map_domain_page (_mfn (tmem_mfn)); + tmem_va =map_domain_page (tmem_mfn);if (guest_handle_is_null (clibuf) ) { cli_va =cli_get_page (cmfn, &cli_mfn, &cli_pfp,0 );
@@ -125,7 +130,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn,unsigned char *wmem =this_cpu (workmem);char *scratch =this_cpu (scratch_page);struct page_info *cli_pfp =NULL ; -unsigned long cli_mfn =0 ; +mfn_t cli_mfn =INVALID_MFN ;void *cli_va =NULL ;if ( dmem ==NULL || wmem ==NULL )
@@ -152,7 +157,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn,int tmem_copy_to_client (xen_pfn_t cmfn,struct page_info *pfp,tmem_cli_va_param_t clibuf) { -unsigned long tmem_mfn, cli_mfn =0 ; +mfn_t tmem_mfn, cli_mfn =INVALID_MFN ;char *tmem_va, *cli_va =NULL ;struct page_info *cli_pfp =NULL ;int rc =1 ;
@@ -165,7 +170,8 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp,return -EFAULT ; } tmem_mfn =page_to_mfn (pfp); - tmem_va =map_domain_page (_mfn (tmem_mfn)); + tmem_va =map_domain_page (tmem_mfn); +if ( cli_va ) {memcpy (cli_va, tmem_va,PAGE_SIZE );
@@ -181,7 +187,7 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp,int tmem_decompress_to_client (xen_pfn_t cmfn,void *tmem_va,size_t size,tmem_cli_va_param_t clibuf) { -unsigned long cli_mfn =0 ; +mfn_t cli_mfn =INVALID_MFN ;struct page_info *cli_pfp =NULL ;void *cli_va =NULL ;char *scratch =this_cpu (scratch_page);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 3/4] xen/tmem: Convert the file common/tmem_xen.c to use typesafe MFN
Quoted 7 lines · Julien Grall
The file
common/tmem_xen.cis now converted to use typesafe. This is requiring to override the macropage_to_mfnto make it work withmfn_t.Note that all variables converted to
mfn_thavem there initial value, when set, switch from 0 toINVALID_MFN. This is fine because the initial values was always overriden before used.
Quoted 8 lines
Also add a couple of missing newlines suggested by Andrew in the code.
Signed-off-by Julien Grall <[email protected]>Reviewed-by Andrew Cooper <[email protected]>---
Cc Konrad Rzeszutek Wilk <[email protected]>
But could you confirm that you did compile this on x86 and with CONFIG_TMEM=y in the .config?
Thanks!
Quoted 127 lines
Changes in v2:
- Add missing newlines
- Add Andrew's reviewed-by--- xen/common/tmem_xen.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)xen/common/tmem_xen.c +18
-12@@ -14,6 +14,10 @@#include <xen/cpu.h> #include <xen/init.h> +/* Override macros from asm/page.h to make them work with mfn_t */ +#undef page_to_mfn +#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) +bool __read_mostly opt_tmem;boolean_param ("tmem" , opt_tmem);@@ -31,7 +35,7 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, dstmem); static DEFINE_PER_CPU_READ_MOSTLY(void *, scratch_page);#if defined(CONFIG_ARM ) -static inline void *cli_get_page (xen_pfn_t cmfn,unsigned long *pcli_mfn, +static inline void *cli_get_page (xen_pfn_t cmfn,mfn_t *pcli_mfn,struct page_info **pcli_pfp,bool cli_write) {ASSERT_UNREACHABLE ();@@ -39,14 +43,14 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, }static inline void cli_put_page (void *cli_va,struct page_info *cli_pfp, -unsigned long cli_mfn,bool mark_dirty) +mfn_t cli_mfn,bool mark_dirty) {ASSERT_UNREACHABLE (); }#else #include <asm/p2m.h> -static inline void *cli_get_page (xen_pfn_t cmfn,unsigned long *pcli_mfn, +static inline void *cli_get_page (xen_pfn_t cmfn,mfn_t *pcli_mfn,struct page_info **pcli_pfp,bool cli_write) {p2m_type_t t;@@ -68,16 +72,17 @@ static inline void *cli_get_page(xen_pfn_t cmfn, unsigned long *pcli_mfn, *pcli_mfn =page_to_mfn (page); *pcli_pfp = page; -return map_domain_page (_mfn (*pcli_mfn)); + +return map_domain_page (*pcli_mfn); }static inline void cli_put_page (void *cli_va,struct page_info *cli_pfp, -unsigned long cli_mfn,bool mark_dirty) +mfn_t cli_mfn,bool mark_dirty) {if ( mark_dirty ) {put_page_and_type (cli_pfp); -paging_mark_dirty (current->domain,_mfn (cli_mfn)); +paging_mark_dirty (current->domain, cli_mfn); }else put_page (cli_pfp);@@ -88,14 +93,14 @@ static inline void cli_put_page(void *cli_va, struct page_info *cli_pfp,int tmem_copy_from_client (struct page_info *pfp,xen_pfn_t cmfn,tmem_cli_va_param_t clibuf) { -unsigned long tmem_mfn, cli_mfn =0 ; +mfn_t tmem_mfn, cli_mfn =INVALID_MFN ;char *tmem_va, *cli_va =NULL ;struct page_info *cli_pfp =NULL ;int rc =1 ;ASSERT (pfp !=NULL ); tmem_mfn =page_to_mfn (pfp); - tmem_va =map_domain_page (_mfn (tmem_mfn)); + tmem_va =map_domain_page (tmem_mfn);if (guest_handle_is_null (clibuf) ) { cli_va =cli_get_page (cmfn, &cli_mfn, &cli_pfp,0 );@@ -125,7 +130,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn,unsigned char *wmem =this_cpu (workmem);char *scratch =this_cpu (scratch_page);struct page_info *cli_pfp =NULL ; -unsigned long cli_mfn =0 ; +mfn_t cli_mfn =INVALID_MFN ;void *cli_va =NULL ;if ( dmem ==NULL || wmem ==NULL )@@ -152,7 +157,7 @@ int tmem_compress_from_client(xen_pfn_t cmfn,int tmem_copy_to_client (xen_pfn_t cmfn,struct page_info *pfp,tmem_cli_va_param_t clibuf) { -unsigned long tmem_mfn, cli_mfn =0 ; +mfn_t tmem_mfn, cli_mfn =INVALID_MFN ;char *tmem_va, *cli_va =NULL ;struct page_info *cli_pfp =NULL ;int rc =1 ;@@ -165,7 +170,8 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp,return -EFAULT ; } tmem_mfn =page_to_mfn (pfp); - tmem_va =map_domain_page (_mfn (tmem_mfn)); + tmem_va =map_domain_page (tmem_mfn); +if ( cli_va ) {memcpy (cli_va, tmem_va,PAGE_SIZE );@@ -181,7 +187,7 @@ int tmem_copy_to_client(xen_pfn_t cmfn, struct page_info *pfp,int tmem_decompress_to_client (xen_pfn_t cmfn,void *tmem_va,size_t size,tmem_cli_va_param_t clibuf) { -unsigned long cli_mfn =0 ; +mfn_t cli_mfn =INVALID_MFN ;struct page_info *cli_pfp =NULL ;void *cli_va =NULL ;char *scratch =this_cpu (scratch_page);Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 3/4] xen/tmem: Convert the file common/tmem_xen.c to use typesafe MFN
Hi Konrad,
Quoted 13 lines · Konrad Rzeszutek Wilk
Quoted 12 lines · Julien Grall
The file
common/tmem_xen.cis now converted to use typesafe. This is requiring to override the macropage_to_mfnto make it work withmfn_t.Note that all variables converted to
mfn_thavem there initial value, when set, switch from 0 toINVALID_MFN. This is fine because the initial values was always overriden before used.Also add a couple of missing newlines suggested by Andrew in the code.
Signed-off-by Julien Grall <[email protected]>Reviewed-by Andrew Cooper <[email protected]>
Quoted 8 lines
Quoted 3 lines
---
Cc Konrad Rzeszutek Wilk <[email protected]>But could you confirm that you did compile this on x86 and with
CONFIG_TMEM=yin the .config?
Yes, I have CONFIG_TMEM enabled in .config.
Thank you for the ack,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH v3 4/4 xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallMost of the users of page_to_mfn and mfn_to_page are either overriding the macros to make them work with mfn_t or use mfn_x/_mfn because the rest of the function use mfn_t.
So make __page_to_mfn and __mfn_to_page return mfn_t by default.
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override page_to_mfn and mfn_to_page to avoid using mfn_t.
Lastly, domain_page_to_mfn is also converted to use mfn_t given that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).
---
Andrew suggested to drop IS_VALID_PAGE in xen/tmem_xen.h. His comment was:
"/sigh This is tautological. The definition of a "valid mfn" in this case is one for which we have frametable entry, and by having a struct page_info in our hands, this is by definition true (unless you have a wild pointer, at which point your bug is elsewhere).
IS_VALID_PAGE() is only ever used in assertions and never usefully, so instead I would remove it entirely rather than trying to fix it up."
I can remove the function in a separate patch at the begining of the series if Konrad (TMEM maintainer) is happy with that.
Changes in v3:
- Rebase on the latest staging and fix some conflicts. Tags haven't be retained.
- Switch the printf format to PRI_mfn
Changes in v2:
- Some part have been moved in separate patch
- Remove one spurious comment
- Convert domain_page_to_mfn to use mfn_t
--- xen/arch/arm/domain_build.c | 2 -- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 8 ++++---- xen/arch/arm/p2m.c | 10 ++-------- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/domain.c | 21 +++++++++++---------- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/hvm.c | 16 ++++++++-------- xen/arch/x86/hvm/ioreq.c | 6 +++--- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/viridian.c | 6 +++--- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +++++----- xen/arch/x86/hvm/vmx/vvmx.c | 6 +++--- xen/arch/x86/mm.c | 6 ------ xen/arch/x86/mm/guest_walk.c | 6 +++--- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 ------ xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 5 ----- xen/arch/x86/mm/p2m-ept.c | 4 ++++ xen/arch/x86/mm/p2m-pod.c | 6 ------ xen/arch/x86/mm/p2m.c | 6 ------ xen/arch/x86/mm/paging.c | 6 ------ xen/arch/x86/mm/shadow/private.h | 16 ++-------------- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 ------ xen/arch/x86/pv/descriptor-tables.c | 10 ---------- xen/arch/x86/pv/dom0_build.c | 6 ++++++ xen/arch/x86/pv/domain.c | 6 ------ xen/arch/x86/pv/emul-gate-op.c | 6 ------ xen/arch/x86/pv/emul-priv-op.c | 10 ---------- xen/arch/x86/pv/grant_table.c | 6 ------ xen/arch/x86/pv/ro-page-fault.c | 6 ------ xen/arch/x86/smpboot.c | 6 ------ xen/arch/x86/tboot.c | 4 ++-- xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/mm.c | 6 ++++++ xen/common/domain.c | 4 ++-- xen/common/grant_table.c | 6 ++++++ xen/common/kimage.c | 6 ------ xen/common/memory.c | 6 ++++++ xen/common/page_alloc.c | 6 ++++++ xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 4 ---- xen/common/trace.c | 6 ++++++ xen/common/vmap.c | 9 +++++---- xen/common/xenoprof.c | 2 -- xen/drivers/passthrough/amd/iommu_map.c | 6 ++++++ xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/mm.h | 16 +++++++++------- xen/include/asm-arm/p2m.h | 4 ++-- xen/include/asm-x86/mm.h | 12 ++++++------ xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++++++++++++++---------------- xen/include/xen/domain_page.h | 8 ++++---- xen/include/xen/tmem_xen.h | 2 +- 65 files changed, 166 insertions(+), 239 deletions(-)
xen/arch/arm/domain_build.c +0 -2
@@ -50,8 +50,6 @@ struct map_range_data/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg))//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION
xen/arch/arm/kernel.c +1 -1
@@ -295,7 +295,7 @@ static __init int kernel_decompress(struct bootmodule *mod)iounmap (input);return -ENOMEM ; } - mfn =_mfn (page_to_mfn (pages)); + mfn =page_to_mfn (pages); output =__vmap (&mfn,1 << kernel_order_out,1 ,1 ,PAGE_HYPERVISOR ,VMAP_DEFAULT ); rc =perform_gunzip (output, input, size);
xen/arch/arm/mem_access.c +1 -1
@@ -210,7 +210,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,if ( t != p2m_ram_rw ) goto err; - page =mfn_to_page (mfn_x (mfn)); + page =mfn_to_page (mfn);if (unlikely (!get_page (page, v->domain)) ) page =NULL ;
xen/arch/arm/mm.c +4 -4
@@ -477,7 +477,7 @@ void unmap_domain_page(const void *va)local_irq_restore (flags); } -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;lpae_t *map =this_cpu (xen_dommap);
@@ -485,12 +485,12 @@ unsigned long domain_page_map_to_mfn(const void *ptr)unsigned long offset = (va>>THIRD_SHIFT ) &LPAE_ENTRY_MASK ;if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) -return __virt_to_mfn (va); +return virt_to_mfn (va);ASSERT (slot >=0 && slot <DOMHEAP_ENTRIES );ASSERT (map[slot].pt.avail !=0 ); - return map[slot].pt.base + offset; + return _mfn(map[slot].pt.base + offset); }#endif
@@ -1288,7 +1288,7 @@ int xenmem_add_to_physmap_one(return -EINVAL ; } - mfn =_mfn (page_to_mfn (page)); + mfn =page_to_mfn (page); t = p2m_map_foreign;rcu_unlock_domain (od);
xen/arch/arm/p2m.c +2 -8
@@ -38,12 +38,6 @@ static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;#define P2M_ROOT_PAGES (1<<P2M_ROOT_ORDER) -/* Override macros from asm/mm.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -unsigned int __read_mostly p2m_ipa_bits;/* Helpers to lookup the properties of each level */
@@ -97,8 +91,8 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)printk ("dom%d IPA 0x%" PRIpaddr"\n" , d->domain_id, addr); -printk ("P2M @ %p mfn:0x%lx\n" , - p2m->root,__page_to_mfn (p2m->root)); +printk ("P2M @ %p mfn:%#" PRI_mfn"\n" , + p2m->root,mfn_x (page_to_mfn (p2m->root)));dump_pt_walk (page_to_maddr (p2m->root), addr,P2M_ROOT_LEVEL ,P2M_ROOT_PAGES );
xen/arch/x86/cpu/vpmu.c +2 -2
@@ -653,7 +653,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) {struct vcpu *v;struct vpmu_struct *vpmu; -uint64_t mfn; +mfn_t mfn;void *xenpmu_data;if ( (params->vcpu >= d->max_vcpus) || (d->vcpu[params->vcpu] ==NULL ) )
@@ -675,7 +675,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params)if ( xenpmu_data ) { mfn =domain_page_map_to_mfn (xenpmu_data); -ASSERT (mfn_valid (_mfn (mfn))); +ASSERT (mfn_valid (mfn));unmap_domain_page_global (xenpmu_data);put_page_and_type (mfn_to_page (mfn)); }
xen/arch/x86/domain.c +11 -10
@@ -186,7 +186,7 @@ void dump_pageframe_info(struct domain *d) } }printk (" DomPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);
@@ -199,7 +199,7 @@ void dump_pageframe_info(struct domain *d) page_list_for_each ( page, &d->xenpage_list ) {printk (" XenPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);
@@ -621,7 +621,8 @@ int arch_domain_soft_reset(struct domain *d)struct page_info *page =virt_to_page (d->shared_info), *new_page;int ret =0 ;struct domain *owner; -unsigned long mfn, gfn; +mfn_t mfn; +unsigned long gfn;p2m_type_t p2mt;unsigned int i;
@@ -655,7 +656,7 @@ int arch_domain_soft_reset(struct domain *d)ASSERT ( owner == d ); mfn =page_to_mfn (page); - gfn =mfn_to_gmfn (d, mfn); + gfn =mfn_to_gmfn (d,mfn_x (mfn));/* * gfn == INVALID_GFN indicates that the shared_info page was never mapped
@@ -664,7 +665,7 @@ int arch_domain_soft_reset(struct domain *d)if ( gfn ==gfn_x (INVALID_GFN ) ) goto exit_put_page; -if (mfn_x (get_gfn_query (d, gfn, &p2mt)) != mfn ) +if ( !mfn_eq (get_gfn_query (d, gfn, &p2mt), mfn) ) {printk (XENLOG_G_ERR "Failed to get Dom%d's shared_info GFN (%lx)\n" , d->domain_id, gfn);
@@ -681,7 +682,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_remove_page (d,_gfn (gfn),_mfn (mfn),PAGE_ORDER_4K ); + ret =guest_physmap_remove_page (d,_gfn (gfn), mfn,PAGE_ORDER_4K );if ( ret ) { printk(XENLOG_G_ERR "Failed to remove Dom%d's shared_info frame %lx\n",
@@ -690,7 +691,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_add_page (d,_gfn (gfn),_mfn (page_to_mfn (new_page)), + ret =guest_physmap_add_page (d,_gfn (gfn),page_to_mfn (new_page),PAGE_ORDER_4K );if ( ret ) {
@@ -988,7 +989,7 @@ int arch_set_info_guest( {if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l4_page_table ) - done = !fill_ro_mpt (_mfn (page_to_mfn (page))); + done = !fill_ro_mpt (page_to_mfn (page));page_unlock (page); }
@@ -1115,7 +1116,7 @@ int arch_set_info_guest(l4_pgentry_t *l4tab; l4tab =map_domain_page (pagetable_get_mfn (v->arch.guest_table)); - *l4tab =l4e_from_pfn (page_to_mfn (cr3_page), + *l4tab =l4e_from_mfn (page_to_mfn (cr3_page), _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);unmap_domain_page (l4tab); }
@@ -1945,7 +1946,7 @@ int domain_relinquish_resources(struct domain *d)if ( d->arch.pirq_eoi_map !=NULL ) {unmap_domain_page_global (d->arch.pirq_eoi_map); -put_page_and_type (mfn_to_page (d->arch.pirq_eoi_map_mfn)); +put_page_and_type (mfn_to_page (_mfn (d->arch.pirq_eoi_map_mfn))); d->arch.pirq_eoi_map =NULL ; d->arch.auto_unmask =0 ; }
xen/arch/x86/domain_page.c +3 -3
@@ -331,13 +331,13 @@ void unmap_domain_page_global(const void *ptr) }/* Translate a map-domain-page'd address to the underlying MFN */ -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;const l1_pgentry_t *pl1e;if ( va >=DIRECTMAP_VIRT_START ) -return virt_to_mfn (ptr); +return _mfn (virt_to_mfn (ptr));if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) {
@@ -350,5 +350,5 @@ unsigned long domain_page_map_to_mfn(const void *ptr) pl1e = &__linear_l1_table[l1_linear_offset (va)]; } -return l1e_get_pfn (*pl1e); +return l1e_get_mfn (*pl1e); }
xen/arch/x86/domctl.c +1 -1
@@ -429,7 +429,7 @@ long arch_do_domctl( {if ( i >= max_pfns )break ; - mfn =page_to_mfn (page); + mfn =mfn_x (page_to_mfn (page));if (copy_to_guest_offset (domctl->u.getmemlist.buffer, i, &mfn,1 ) ) {
xen/arch/x86/hvm/dm.c +1 -1
@@ -219,7 +219,7 @@ static int modified_memory(struct domain *d, page =get_page_from_gfn (d, pfn,NULL ,P2M_UNSHARE );if ( page ) { -mfn_t gmfn =_mfn (page_to_mfn (page)); +mfn_t gmfn =page_to_mfn (page);paging_mark_dirty (d, gmfn);/*
xen/arch/x86/hvm/dom0_build.c +3 -3
@@ -120,7 +120,7 @@ static int __init pvh_populate_memory_range(struct domain *d,continue ; } - rc =guest_physmap_add_page (d,_gfn (start),_mfn (page_to_mfn (page)), + rc =guest_physmap_add_page (d,_gfn (start),page_to_mfn (page), order);if ( rc !=0 ) {
@@ -270,7 +270,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d) }write_32bit_pse_identmap (ident_pt);unmap_domain_page (ident_pt); -put_page (mfn_to_page (mfn_x (mfn))); +put_page (mfn_to_page (mfn)); d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT ] = gaddr;if (pvh_add_mem_range (d, gaddr, gaddr +PAGE_SIZE ,E820_RESERVED ) )printk ("Unable to set identity page tables as reserved in the memory map\n" );
@@ -288,7 +288,7 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start,for ( mfn = start; mfn < start + nr_pages; mfn++ ) { -struct page_info *pg =mfn_to_page (mfn); +struct page_info *pg =mfn_to_page (_mfn (mfn));int rc; rc =unshare_xen_page_with_guest (pg, dom_io);
xen/arch/x86/hvm/emulate.c +3 -3
@@ -590,7 +590,7 @@ static void *hvmemul_map_linear_addr( goto unhandleable; } - *mfn++ =_mfn (page_to_mfn (page)); + *mfn++ =page_to_mfn (page);if (p2m_is_discard_write (p2mt) ) {
@@ -622,7 +622,7 @@ static void *hvmemul_map_linear_addr( out:/* Drop all held references. */ while ( mfn-- > hvmemul_ctxt->mfn ) -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn));return err; }
@@ -648,7 +648,7 @@ static void hvmemul_unmap_linear_addr( {ASSERT (mfn_valid (*mfn));paging_mark_dirty (currd, *mfn); -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn)); *mfn++ =_mfn (0 );/* Clean slot for map()'s error checking. */ }
xen/arch/x86/hvm/hvm.c +8 -8
@@ -2211,7 +2211,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer) v->arch.guest_table =pagetable_from_page (page);HVM_DBG_LOG (DBG_LEVEL_VMMU ,"Update CR3 value = %lx, mfn = %lx" , - v->arch.hvm_vcpu.guest_cr[3 ],page_to_mfn (page)); + v->arch.hvm_vcpu.guest_cr[3 ],mfn_x (page_to_mfn (page))); } }else if ( !(value &X86_CR0_PG ) && (old_value &X86_CR0_PG ) )
@@ -2546,7 +2546,7 @@ static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent,if (unlikely (p2m_is_discard_write (p2mt)) ) *writable =0 ;else if ( !permanent ) -paging_mark_dirty (d,_mfn (page_to_mfn (page))); +paging_mark_dirty (d,page_to_mfn (page)); }if ( !permanent )
@@ -2588,7 +2588,7 @@ void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent)void hvm_unmap_guest_frame (void *p,bool_t permanent) { -unsigned long mfn; +mfn_t mfn;struct page_info *page;if ( !p )
@@ -2609,7 +2609,7 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent)list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list)if ( track->page == page ) { -paging_mark_dirty (d,_mfn (mfn)); +paging_mark_dirty (d, mfn);list_del (&track->list);xfree (track);break ;
@@ -2626,7 +2626,7 @@ void hvm_mapped_guest_frames_mark_dirty(struct domain *d)spin_lock (&d->arch.hvm_domain.write_map.lock);list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list) -paging_mark_dirty (d,_mfn (page_to_mfn (track->page))); +paging_mark_dirty (d,page_to_mfn (track->page));spin_unlock (&d->arch.hvm_domain.write_map.lock); }
@@ -3200,8 +3200,8 @@ static enum hvm_translation_result __hvm_copy(if (xchg (&lastpage,gfn_x (gfn)) !=gfn_x (gfn) )dprintk (XENLOG_G_DEBUG , -"%pv attempted write to read-only gfn %#lx (mfn=%#lx)\n" , - v,gfn_x (gfn),page_to_mfn (page)); +"%pv attempted write to read-only gfn %#lx (mfn=%#" PRI_mfn")\n" , + v,gfn_x (gfn),mfn_x (page_to_mfn (page))); }else {
@@ -3209,7 +3209,7 @@ static enum hvm_translation_result __hvm_copy(memcpy (p, buf, count); else memset(p, 0, count); -paging_mark_dirty (v->domain,_mfn (page_to_mfn (page))); +paging_mark_dirty (v->domain,page_to_mfn (page)); } }else
xen/arch/x86/hvm/ioreq.c +3 -3
@@ -268,7 +268,7 @@ static void hvm_remove_ioreq_gfn( struct domain *d, struct hvm_ioreq_page *iorp) { if ( guest_physmap_remove_page(d, _gfn(iorp->gfn), - _mfn(page_to_mfn(iorp->page)), 0) ) + page_to_mfn(iorp->page), 0) ) domain_crash(d); clear_page(iorp->va); }
@@ -281,9 +281,9 @@ static int hvm_add_ioreq_gfn(clear_page (iorp->va); rc =guest_physmap_add_page (d,_gfn (iorp->gfn), -_mfn (page_to_mfn (iorp->page)),0 ); +page_to_mfn (iorp->page),0 );if ( rc ==0 ) -paging_mark_dirty (d,_mfn (page_to_mfn (iorp->page))); +paging_mark_dirty (d,page_to_mfn (iorp->page));return rc; }
xen/arch/x86/hvm/stdvga.c +1 -1
@@ -590,7 +590,7 @@ void stdvga_init(struct domain *d)if ( pg ==NULL )break ; s->vram_page[i] = pg; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); }if ( i ==ARRAY_SIZE (s->vram_page) )
xen/arch/x86/hvm/svm/svm.c +2 -2
@@ -1521,7 +1521,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_hsa =page_to_maddr (pg); }
@@ -1531,7 +1531,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_vmcb =page_to_maddr (pg); }
xen/arch/x86/hvm/viridian.c +3 -3
@@ -354,7 +354,7 @@ static void enable_hypercall_page(struct domain *d)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ; }
@@ -414,7 +414,7 @@ static void initialize_vp_assist(struct vcpu *v) fail:gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , gmfn, - page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); +mfn_x (page ?page_to_mfn (page) :INVALID_MFN )); }static void teardown_vp_assist (struct vcpu *v)
@@ -494,7 +494,7 @@ static void update_reference_tsc(struct domain *d, bool_t initialize)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ; }
xen/arch/x86/hvm/vmx/vmcs.c +1 -1
@@ -1437,7 +1437,7 @@ int vmx_vcpu_enable_pml(struct vcpu *v)vmx_vmcs_enter (v); -__vmwrite (PML_ADDRESS ,page_to_mfn (v->arch.hvm_vmx.pml_pg) <<PAGE_SHIFT ); +__vmwrite (PML_ADDRESS ,page_to_maddr (v->arch.hvm_vmx.pml_pg));__vmwrite (GUEST_PML_INDEX ,NR_PML_ENTRIES -1 ); v->arch.hvm_vmx.secondary_exec_control |=SECONDARY_EXEC_ENABLE_PML ;
xen/arch/x86/hvm/vmx/vmx.c +5 -5
@@ -2978,7 +2978,7 @@ gp_fault:static int vmx_alloc_vlapic_mapping (struct domain *d) {struct page_info *pg; -unsigned long mfn; +mfn_t mfn;if ( !cpu_has_vmx_virtualize_apic_accesses )return 0 ;
@@ -2987,10 +2987,10 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)if ( !pg )return -ENOMEM ; mfn =page_to_mfn (pg); -clear_domain_page (_mfn (mfn)); +clear_domain_page (mfn);share_xen_page_with_guest (pg, d, XENSHARE_writable); - d->arch.hvm_domain.vmx.apic_access_mfn = mfn; -set_mmio_p2m_entry (d,paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ),_mfn (mfn), + d->arch.hvm_domain.vmx.apic_access_mfn =mfn_x (mfn); +set_mmio_p2m_entry (d,paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ), mfn,PAGE_ORDER_4K ,p2m_get_hostp2m (d)->default_access);return 0 ;
@@ -3001,7 +3001,7 @@ static void vmx_free_vlapic_mapping(struct domain *d)unsigned long mfn = d->arch.hvm_domain.vmx.apic_access_mfn;if ( mfn !=0 ) -free_shared_domheap_page (mfn_to_page (mfn)); +free_shared_domheap_page (mfn_to_page (_mfn (mfn))); }static void vmx_install_vlapic_mapping (struct vcpu *v)
xen/arch/x86/hvm/vmx/vvmx.c +3 -3
@@ -84,7 +84,7 @@ int nvmx_vcpu_initialise(struct vcpu *v) } v->arch.hvm_vmx.vmread_bitmap = vmread_bitmap; -clear_domain_page (_mfn (page_to_mfn (vmread_bitmap))); +clear_domain_page (page_to_mfn (vmread_bitmap)); vmwrite_bitmap =alloc_domheap_page (NULL ,0 );if ( !vmwrite_bitmap )
@@ -1729,7 +1729,7 @@ int nvmx_handle_vmptrld(struct cpu_user_regs *regs) nvcpu->nv_vvmcx = vvmcx; nvcpu->nv_vvmcxaddr = gpa; v->arch.hvm_vmx.vmcs_shadow_maddr = -pfn_to_paddr (domain_page_map_to_mfn (vvmcx)); +mfn_to_maddr (domain_page_map_to_mfn (vvmcx)); }else {
@@ -1815,7 +1815,7 @@ int nvmx_handle_vmclear(struct cpu_user_regs *regs) {if ( writable )clear_vvmcs_launched (&nvmx->launched_list, -domain_page_map_to_mfn (vvmcs)); +mfn_x (domain_page_map_to_mfn (vvmcs)));else rc =VMFAIL_VALID ;hvm_unmap_guest_frame (vvmcs,0 );
xen/arch/x86/mm.c +0 -6
@@ -128,12 +128,6 @@#include "pv/mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* Mapping of the fixmap space needed early. */ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) l1_fixmap[L1_PAGETABLE_ENTRIES ];
xen/arch/x86/mm/guest_walk.c +3 -3
@@ -469,20 +469,20 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,if ( l3p ) {unmap_domain_page (l3p); -put_page (mfn_to_page (mfn_x (gw->l3mfn))); +put_page (mfn_to_page (gw->l3mfn)); }#endif #if GUEST_PAGING_LEVELS >=3 if ( l2p ) {unmap_domain_page (l2p); -put_page (mfn_to_page (mfn_x (gw->l2mfn))); +put_page (mfn_to_page (gw->l2mfn)); }#endif if ( l1p ) {unmap_domain_page (l1p); -put_page (mfn_to_page (mfn_x (gw->l1mfn))); +put_page (mfn_to_page (gw->l1mfn)); }return walk_ok;
xen/arch/x86/mm/hap/guest_walk.c +1 -1
@@ -83,7 +83,7 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)( *pfec &= ~PFEC_page_present; goto out_tweak_pfec; } - top_mfn =_mfn (page_to_mfn (top_page)); + top_mfn =page_to_mfn (top_page);/* Map the top-level table and call the tree-walker */ ASSERT (mfn_valid (top_mfn));
xen/arch/x86/mm/hap/hap.c +0 -6
@@ -42,12 +42,6 @@#include "private.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* HAP VRAM TRACKING SUPPORT */ /************************************************/
xen/arch/x86/mm/hap/nested_ept.c +1 -1
@@ -173,7 +173,7 @@ nept_walk_tables(struct vcpu *v, unsigned long l2ga, ept_walk_t *gw) goto map_err; gw->lxe[lvl] = lxp[ept_lvl_table_offset (l2ga, lvl)];unmap_domain_page (lxp); -put_page (mfn_to_page (mfn_x (lxmfn))); +put_page (mfn_to_page (lxmfn));if (nept_non_present_check (gw->lxe[lvl]) ) goto non_present;
xen/arch/x86/mm/mem_sharing.c +0 -5
@@ -152,11 +152,6 @@ static inline shr_handle_t get_next_handle(void)#define mem_sharing_enabled (d) \ (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled) -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -static atomic_t nr_saved_mfns =ATOMIC_INIT (0 );static atomic_t nr_shared_mfns =ATOMIC_INIT (0 );
xen/arch/x86/mm/p2m-ept.c +4 -0
@@ -33,6 +33,10 @@#include "mm-locks.h" +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +#define atomic_read_ept_entry (__pepte) \ ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } )
xen/arch/x86/mm/p2m-pod.c +0 -6
@@ -29,12 +29,6 @@#include "mm-locks.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -#define superpage_aligned (_x) (((_x)&(SUPERPAGE_PAGES-1))==0)/* Enforce lock ordering when grabbing the "external" page_alloc lock */
xen/arch/x86/mm/p2m.c +0 -6
@@ -47,12 +47,6 @@ bool_t __initdata opt_hap_1gb = 1, __initdata opt_hap_2mb = 1;boolean_param ("hap_1gb" , opt_hap_1gb);boolean_param ("hap_2mb" , opt_hap_2mb); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -DEFINE_PERCPU_RWLOCK_GLOBAL (p2m_percpu_rwlock);/* Init the datastructures for later use by the p2m code */
xen/arch/x86/mm/paging.c +0 -6
@@ -47,12 +47,6 @@/* Per-CPU variable for enforcing the lock ordering */ DEFINE_PER_CPU (int, mm_lock_level); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* LOG DIRTY SUPPORT */ /************************************************/
xen/arch/x86/mm/shadow/private.h +2 -14
@@ -315,7 +315,7 @@ static inline int page_is_out_of_sync(struct page_info *p)static inline int mfn_is_out_of_sync (mfn_t gmfn) { -return page_is_out_of_sync (mfn_to_page (mfn_x (gmfn))); +return page_is_out_of_sync (mfn_to_page (gmfn)); }static inline int page_oos_may_write (struct page_info *p)
@@ -326,7 +326,7 @@ static inline int page_oos_may_write(struct page_info *p)static inline int mfn_oos_may_write (mfn_t gmfn) { -return page_oos_may_write (mfn_to_page (mfn_x (gmfn))); +return page_oos_may_write (mfn_to_page (gmfn)); }#endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
@@ -465,18 +465,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v);* MFN/page-info handling */ -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) - -/* Override pagetable_t <-> struct page_info conversions to work with mfn_t */ -#undef pagetable_get_page -#define pagetable_get_page (x) mfn_to_page(pagetable_get_mfn(x)) -#undef pagetable_from_page -#define pagetable_from_page (pg) pagetable_from_mfn(page_to_mfn(pg)) -#define backpointer (sp) _mfn(pdx_to_pfn((unsigned long)(sp)->v.sh.back))static inline unsigned long __backpointer (const struct page_info *sp) {
xen/arch/x86/numa.c +1 -1
@@ -430,7 +430,7 @@ static void dump_numa(unsigned char key)spin_lock (&d->page_alloc_lock);page_list_for_each (page, &d->page_list) { - i =phys_to_nid ((paddr_t )page_to_mfn (page) <<PAGE_SHIFT ); + i =phys_to_nid (page_to_maddr (page)); page_num_node[i]++; }spin_unlock (&d->page_alloc_lock);
xen/arch/x86/physdev.c +1 -1
@@ -242,7 +242,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) }if (cmpxchg (&currd->arch.pirq_eoi_map_mfn, -0 ,page_to_mfn (page)) !=0 ) +0 ,mfn_x (page_to_mfn (page))) !=0 ) {put_page_and_type (page); ret = -EBUSY ;
xen/arch/x86/pv/callback.c +0 -6
@@ -31,12 +31,6 @@#include <public/callback.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static int register_guest_nmi_callback (unsigned long address) {struct vcpu *curr = current;
xen/arch/x86/pv/descriptor-tables.c +0 -10
@@ -25,16 +25,6 @@#include <asm/p2m.h> #include <asm/pv/mm.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/******************* -* Descriptor Tables -*/ -void pv_destroy_gdt (struct vcpu *v) {l1_pgentry_t *pl1e;
xen/arch/x86/pv/dom0_build.c +6 -0
@@ -20,6 +20,12 @@#include <asm/page.h> #include <asm/setup.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Allow ring-3 access in long mode as guest cannot use ring 1 ... */ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)#define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL)
xen/arch/x86/pv/domain.c +0 -6
@@ -11,12 +11,6 @@#include <asm/pv/domain.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static void noreturncontinue_nonidle_domain (struct vcpu *v) {check_wakeup_from_wait ();
xen/arch/x86/pv/emul-gate-op.c +0 -6
@@ -41,12 +41,6 @@#include "emulate.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - static int read_gate_descriptor(unsigned int gate_sel, const struct vcpu *v, unsigned int *sel,
xen/arch/x86/pv/emul-priv-op.c +0 -10
@@ -43,16 +43,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/*********************** -* I/O emulation support -*/ -struct priv_op_ctxt {struct x86_emulate_ctxt ctxt;struct {
xen/arch/x86/pv/grant_table.c +0 -6
@@ -27,12 +27,6 @@#include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static unsigned int grant_to_pte_flags (unsigned int grant_flags,unsigned int cache_flags) {
xen/arch/x86/pv/ro-page-fault.c +0 -6
@@ -33,12 +33,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/********************* * Writable Pagetables */
xen/arch/x86/smpboot.c +0 -6
@@ -46,12 +46,6 @@#include <mach_wakecpu.h> #include <smpboot_hooks.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -#define setup_trampoline () (bootsym_phys(trampoline_realmode_entry))unsigned long __read_mostly trampoline_phys;
xen/arch/x86/tboot.c +2 -2
@@ -184,7 +184,7 @@ static void update_pagetable_mac(vmac_ctx_t *ctx)for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue ;
@@ -276,7 +276,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],vmac_set_key ((uint8_t *)key, &ctx);for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =__mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue ;
xen/arch/x86/traps.c +2 -2
@@ -810,8 +810,8 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) }gdprintk (XENLOG_WARNING , -"Bad GMFN %lx (MFN %lx) to MSR %08x\n" , - gmfn, page ?page_to_mfn (page) :-1UL , base); +"Bad GMFN %lx (MFN %#" PRI_mfn") to MSR %08x\n" , + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ), base);return 0 ; }
xen/arch/x86/x86_64/mm.c +6 -0
@@ -40,6 +40,12 @@ asm(".file \"" __FILE__ "\"");#include <asm/mem_sharing.h> #include <public/memory.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;l2_pgentry_t *compat_idle_pg_table_l2;
xen/common/domain.c +2 -2
@@ -1192,7 +1192,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) } v->vcpu_info = new_info; - v->vcpu_info_mfn =_mfn (page_to_mfn (page)); + v->vcpu_info_mfn =page_to_mfn (page);/* Set new vcpu_info pointer /before/ setting pending flags. */ smp_wmb ();
@@ -1225,7 +1225,7 @@ void unmap_vcpu_info(struct vcpu *v)vcpu_info_reset (v);/* NB: Clobbers v->vcpu_info_mfn */ -put_page_and_type (mfn_to_page (mfn_x (mfn))); +put_page_and_type (mfn_to_page (mfn)); }int default_initialise_vcpu (struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg)
xen/common/grant_table.c +6 -0
@@ -40,6 +40,12 @@#include <xsm/xsm.h> #include <asm/flushtlb.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Per-domain grant information. */ struct grant_table {/*
xen/common/kimage.c +0 -6
@@ -23,12 +23,6 @@#include <asm/page.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* * When kexec transitions to the new kernel there is a one-to-one * mapping between physical and virtual addresses. On processors
xen/common/memory.c +6 -0
@@ -29,6 +29,12 @@#include <public/memory.h> #include <xsm/xsm.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +struct memop_args {/* INPUT */ struct domain *domain;/* Domain to be affected. */
xen/common/page_alloc.c +6 -0
@@ -150,6 +150,12 @@#define p2m_pod_offline_or_broken_replace (pg) BUG_ON(pg != NULL)#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* * Comma-separated list of hexadecimal page numbers containing bad bytes. * e.g. 'badpage=0x3f45,0x8a321'.
xen/common/tmem.c +1 -1
@@ -243,7 +243,7 @@ static void tmem_persistent_pool_page_put(void *page_va)struct page_info *pi;ASSERT (IS_PAGE_ALIGNED (page_va)); - pi =mfn_to_page (virt_to_mfn (page_va)); + pi =mfn_to_page (_mfn (virt_to_mfn (page_va)));ASSERT (IS_VALID_PAGE (pi));__tmem_free_page_thispool (pi); }
xen/common/tmem_xen.c +0 -4
@@ -14,10 +14,6 @@#include <xen/cpu.h> #include <xen/init.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -bool __read_mostly opt_tmem;boolean_param ("tmem" , opt_tmem);
xen/common/trace.c +6 -0
@@ -42,6 +42,12 @@ CHECK_t_buf;#define compat_t_rec t_rec#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* opt_tbuf_size: trace buffer size (in pages) for each cpu */ static unsigned int opt_tbuf_size;static unsigned int opt_tevt_mask;
xen/common/vmap.c +5 -4
@@ -36,7 +36,7 @@ void __init vm_init_type(enum vmap_region type, void *start, void *end) {struct page_info *pg =alloc_domheap_page (NULL ,0 ); -map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ); +map_pages_to_xen (va,mfn_x (page_to_mfn (pg)),1 ,PAGE_HYPERVISOR );clear_page ((void *)va); }bitmap_fill (vm_bitmap (type), vm_low[type]);
@@ -107,7 +107,8 @@ static void *vm_alloc(unsigned int nr, unsigned int align, {unsigned long va = (unsigned long )vm_bitmap (t) + vm_top[t] /8 ; -if ( !map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ) ) +if ( !map_pages_to_xen (va,mfn_x (page_to_mfn (pg)), +1 ,PAGE_HYPERVISOR ) ) {clear_page ((void *)va); vm_top[t] +=PAGE_SIZE *8 ;
@@ -258,7 +259,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) pg =alloc_domheap_page (NULL ,0 );if ( pg ==NULL ) goto error; - mfn[i] =_mfn (page_to_mfn (pg)); + mfn[i] =page_to_mfn (pg); } va =__vmap (mfn,1 , pages,1 ,PAGE_HYPERVISOR , type);
@@ -270,7 +271,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) error:while ( i-- ) -free_domheap_page (mfn_to_page (mfn_x (mfn[i]))); +free_domheap_page (mfn_to_page (mfn[i]));xfree (mfn);return NULL ; }
xen/common/xenoprof.c +0 -2
@@ -22,8 +22,6 @@/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn))/* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32
xen/drivers/passthrough/amd/iommu_map.c +6 -0
@@ -25,6 +25,12 @@#include "../ats.h" #include <xen/pci.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Given pfn and page table level, return pde index */ static unsigned int pfn_to_pde_idx (unsigned long pfn,unsigned int level) {
xen/drivers/passthrough/iommu.c +1 -1
@@ -184,7 +184,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) page_list_for_each ( page, &d->page_list ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);unsigned int mapping = IOMMUF_readable;int ret;
xen/drivers/passthrough/x86/iommu.c +1 -1
@@ -58,7 +58,7 @@ int arch_iommu_populate_page_table(struct domain *d)if (is_hvm_domain (d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);if ( gfn !=gfn_x (INVALID_GFN ) )
xen/include/asm-arm/mm.h +9 -7
@@ -138,7 +138,7 @@ extern vaddr_t xenheap_virt_start;#endif #ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_page (page) is_xen_heap_mfn(mfn_x(__page_to_mfn(page)))#define is_xen_heap_mfn (mfn) ({ \ unsigned long mfn_ = (mfn); \ (mfn_ >= mfn_x(xenheap_mfn_start) && \
@@ -220,12 +220,14 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) })/* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) +#define __mfn_to_page (mfn) \ + (frame_table + (pfn_to_pdx(mfn_x(mfn)) - frametable_base_pdx)) +#define __page_to_mfn (pg) \ + _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx))/* Convert between machine addresses and page-info structures. */ -#define maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
@@ -235,7 +237,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)#define gaddr_to_gfn (ga) _gfn(paddr_to_pfn(ga))#define mfn_to_maddr (mfn) pfn_to_paddr(mfn_x(mfn))#define maddr_to_mfn (ma) _mfn(paddr_to_pfn(ma)) -#define vmap_to_mfn (va) paddr_to_pfn(virt_to_maddr((vaddr_t)va)) +#define vmap_to_mfn (va) maddr_to_mfn(virt_to_maddr((vaddr_t)va))#define vmap_to_page (va) mfn_to_page(vmap_to_mfn(va))/* Page-align address and convert to frame number format */
@@ -309,7 +311,7 @@ static inline struct page_info *virt_to_page(const void *v)static inline void *page_to_virt (const struct page_info *pg) { -return mfn_to_virt (page_to_mfn (pg)); +return mfn_to_virt (mfn_x (__page_to_mfn (pg))); } struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va,
xen/include/asm-arm/p2m.h +2 -2
@@ -276,7 +276,7 @@ static inline struct page_info *get_page_from_gfn( {struct page_info *page;p2m_type_t p2mt; -unsigned long mfn =mfn_x (p2m_lookup (d,_gfn (gfn), &p2mt)); +mfn_t mfn =p2m_lookup (d,_gfn (gfn), &p2mt);if (t) *t = p2mt;
@@ -284,7 +284,7 @@ static inline struct page_info *get_page_from_gfn(if ( !p2m_is_any_ram (p2mt) )return NULL ; -if ( !mfn_valid (_mfn (mfn)) ) +if ( !mfn_valid (mfn) )return NULL ; page =mfn_to_page (mfn);
xen/include/asm-x86/mm.h +6 -6
@@ -270,7 +270,7 @@ struct page_info#define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ - (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn))) + (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(_mfn(mfn))))#define is_xen_fixed_mfn (mfn) \ ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) && \ (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end)))
@@ -383,7 +383,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner);static inline bool get_page_from_mfn (mfn_t mfn,struct domain *d) { -struct page_info *page =__mfn_to_page (mfn_x (mfn)); +struct page_info *page =__mfn_to_page (mfn);if (unlikely (!mfn_valid (mfn)) ||unlikely (!get_page (page, d)) ) {
@@ -477,10 +477,10 @@ extern paddr_t mem_hotplug;#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)); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ +#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)); \
xen/include/asm-x86/p2m.h +1 -1
@@ -487,7 +487,7 @@ static inline struct page_info *get_page_from_gfn(/* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */ if ( t ) *t =likely (d != dom_io) ? p2m_ram_rw : p2m_mmio_direct; - page =__mfn_to_page (gfn); + page =__mfn_to_page (_mfn (gfn));return mfn_valid (_mfn (gfn)) &&get_page (page, d) ? page :NULL ; }
xen/include/asm-x86/page.h +16 -16
@@ -88,10 +88,10 @@ ((paddr_t)(((x).l4 & (PADDR_MASK &PAGE_MASK )))) /* Get pointer to info structure of page mapped by pte (struct page_info *). */ -#define l1e_get_page (x) (__mfn_to_page(l1e_get_pfn(x))) -#define l2e_get_page (x) (__mfn_to_page(l2e_get_pfn(x))) -#define l3e_get_page (x) (__mfn_to_page(l3e_get_pfn(x))) -#define l4e_get_page (x) (__mfn_to_page(l4e_get_pfn(x))) +#define l1e_get_page (x) (__mfn_to_page(l1e_get_mfn(x))) +#define l2e_get_page (x) (__mfn_to_page(l2e_get_mfn(x))) +#define l3e_get_page (x) (__mfn_to_page(l3e_get_mfn(x))) +#define l4e_get_page (x) (__mfn_to_page(l4e_get_mfn(x)))/* Get pte access flags (unsigned int). */ #define l1e_get_flags (x) (get_pte_flags((x).l1))
@@ -157,10 +157,10 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)#define l4e_from_intpte (intpte) ((l4_pgentry_t) { (intpte_t)(intpte) })/* Construct a pte from a page pointer and access flags. */ -#define l1e_from_page (page, flags) l1e_from_pfn(__page_to_mfn(page), (flags)) -#define l2e_from_page (page, flags) l2e_from_pfn(__page_to_mfn(page), (flags)) -#define l3e_from_page (page, flags) l3e_from_pfn(__page_to_mfn(page), (flags)) -#define l4e_from_page (page, flags) l4e_from_pfn(__page_to_mfn(page), (flags)) +#define l1e_from_page (page, flags) l1e_from_mfn(__page_to_mfn(page), (flags)) +#define l2e_from_page (page, flags) l2e_from_mfn(__page_to_mfn(page), (flags)) +#define l3e_from_page (page, flags) l3e_from_mfn(__page_to_mfn(page), (flags)) +#define l4e_from_page (page, flags) l4e_from_mfn(__page_to_mfn(page), (flags))/* Add extra flags to an existing pte. */ #define l1e_add_flags (x, flags) ((x).l1 |= put_pte_flags(flags))
@@ -215,13 +215,13 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)/* Page-table type. */ typedef struct {u64 pfn; }pagetable_t ;#define pagetable_get_paddr (x) ((paddr_t)(x).pfn << PAGE_SHIFT) -#define pagetable_get_page (x) __mfn_to_page((x).pfn) +#define pagetable_get_page (x) __mfn_to_page(pagetable_get_mfn(x))#define pagetable_get_pfn (x) ((x).pfn)#define pagetable_get_mfn (x) _mfn(((x).pfn))#define pagetable_is_null (x) ((x).pfn == 0)#define pagetable_from_pfn (pfn) ((pagetable_t) { (pfn) })#define pagetable_from_mfn (mfn) ((pagetable_t) { mfn_x(mfn) }) -#define pagetable_from_page (pg) pagetable_from_pfn(__page_to_mfn(pg)) +#define pagetable_from_page (pg) pagetable_from_mfn(__page_to_mfn(pg))#define pagetable_from_paddr (p) pagetable_from_pfn((p)>>PAGE_SHIFT)#define pagetable_null () pagetable_from_pfn(0)
@@ -240,12 +240,12 @@ void copy_page_sse2(void *, const void *);#define __mfn_to_virt (mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))/* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table)) +#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn_x(mfn))) +#define __page_to_mfn (pg) _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table)))/* Convert between machine addresses and page-info structures. */ -#define __maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define __page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define __maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define __page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define __pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
@@ -273,8 +273,8 @@ void copy_page_sse2(void *, const void *);#define pfn_to_paddr (pfn) __pfn_to_paddr(pfn)#define paddr_to_pfn (pa) __paddr_to_pfn(pa)#define paddr_to_pdx (pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define vmap_to_mfn (va) l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va))) -#define vmap_to_page (va) mfn_to_page(vmap_to_mfn(va)) +#define vmap_to_mfn (va) _mfn(l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va)))) +#define vmap_to_page (va) __mfn_to_page(vmap_to_mfn(va))#endif /* !defined(__ASSEMBLY__) */
xen/include/xen/domain_page.h +4 -4
@@ -34,7 +34,7 @@ void unmap_domain_page(const void *va);/* * Given a VA from map_domain_page(), return its underlying MFN. */ -unsigned long domain_page_map_to_mfn (const void *va); +mfn_t domain_page_map_to_mfn (const void *va);/* * Similar to the above calls, except the mapping is accessible in all
@@ -44,11 +44,11 @@ unsigned long domain_page_map_to_mfn(const void *va);void *map_domain_page_global (mfn_t mfn);void unmap_domain_page_global (const void *va); -#define __map_domain_page (pg) map_domain_page(_mfn(__page_to_mfn(pg))) +#define __map_domain_page (pg) map_domain_page(__page_to_mfn(pg))static inline void *__map_domain_page_global (const struct page_info *pg) { -return map_domain_page_global (_mfn (__page_to_mfn (pg))); +return map_domain_page_global (page_to_mfn (pg)); }#else /* !CONFIG_DOMAIN_PAGE */
@@ -56,7 +56,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)#define map_domain_page (mfn) __mfn_to_virt(mfn_x(mfn))#define __map_domain_page (pg) page_to_virt(pg)#define unmap_domain_page (va) ((void)(va)) -#define domain_page_map_to_mfn (va) virt_to_mfn((unsigned long)(va)) +#define domain_page_map_to_mfn (va) _mfn(virt_to_mfn((unsigned long)(va)))static inline void *map_domain_page_global (mfn_t mfn) {
xen/include/xen/tmem_xen.h +1 -1
@@ -25,7 +25,7 @@typedef uint32_t pagesize_t ;/* like size_t, must handle largest PAGE_SIZE */ #define IS_PAGE_ALIGNED (addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE) -#define IS_VALID_PAGE (_pi) mfn_valid(_mfn(page_to_mfn(_pi))) +#define IS_VALID_PAGE (_pi) mfn_valid(page_to_mfn(_pi))extern struct page_list_head tmem_page_list;extern spinlock_t tmem_page_list_lock;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
Quoted 26 lines
-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 01 November 2017 14:03
To: [email protected]
Cc: Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>; Julien Grall <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Ian Jackson <[email protected]>; Jan Beulich <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Tim (Xen.org) <[email protected]>; Wei Liu <[email protected]>; Razvan Cojocaru <[email protected]>; Tamas K Lengyel <[email protected]>; Paul Durrant <[email protected]>; Boris Ostrovsky <[email protected]>; Suravee Suthikulpanit <[email protected]>; Jun Nakajima <[email protected]>; Kevin Tian <[email protected]>; George Dunlap <[email protected]>; Gang Wei <[email protected]>; Shane Wang <[email protected]>
Subject: [PATCH v3 for-next 4/4] xen: Convert__page_to_mfnand__mfn_to_pageto use typesafe MFNMost of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 9 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
emulate bits...
Quoted 1,743 lines
---
Andrew suggested to drop
IS_VALID_PAGEinxen/tmem_xen.h. His comment
was:"/sigh This is tautological. The definition of a "valid mfn" in this case is one for which we have frametable entry, and by having a struct
page_infoin our hands, this is by definition true (unless you have a wild pointer, at which point your bug is elsewhere).
IS_VALID_PAGE()is only ever used in assertions and never usefully, so instead I would remove it entirely rather than trying to fix it up."I can remove the function in a separate patch at the begining of the series if Konrad (TMEM maintainer) is happy with that.
Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>Cc Andrew Cooper <[email protected]>Cc George Dunlap <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Tim Deegan <[email protected]>Cc Wei Liu <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Tamas K Lengyel <[email protected]>Cc Paul Durrant <[email protected]>Cc Boris Ostrovsky <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jun Nakajima <[email protected]>Cc Kevin Tian <[email protected]>Cc George Dunlap <[email protected]>Cc Gang Wei <[email protected]>Cc Shane Wang <[email protected]>Changes in v3:
- Rebase on the latest staging and fix some conflicts. Tags haven't be retained.
- Switch the printf format toPRI_mfnChanges in v2:
- Some part have been moved in separate patch
- Remove one spurious comment
- Convertdomain_page_to_mfnto usemfn_t--- xen/arch/arm/domain_build.c | 2 -- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 8 ++++---- xen/arch/arm/p2m.c | 10 ++-------- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/domain.c | 21 +++++++++++---------- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/hvm.c | 16 ++++++++-------- xen/arch/x86/hvm/ioreq.c | 6 +++--- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/viridian.c | 6 +++--- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +++++----- xen/arch/x86/hvm/vmx/vvmx.c | 6 +++--- xen/arch/x86/mm.c | 6 ------ xen/arch/x86/mm/guest_walk.c | 6 +++--- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 ------ xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 5 ----- xen/arch/x86/mm/p2m-ept.c | 4 ++++ xen/arch/x86/mm/p2m-pod.c | 6 ------ xen/arch/x86/mm/p2m.c | 6 ------ xen/arch/x86/mm/paging.c | 6 ------ xen/arch/x86/mm/shadow/private.h | 16 ++-------------- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 ------ xen/arch/x86/pv/descriptor-tables.c | 10 ---------- xen/arch/x86/pv/dom0_build.c | 6 ++++++ xen/arch/x86/pv/domain.c | 6 ------ xen/arch/x86/pv/emul-gate-op.c | 6 ------ xen/arch/x86/pv/emul-priv-op.c | 10 ---------- xen/arch/x86/pv/grant_table.c | 6 ------ xen/arch/x86/pv/ro-page-fault.c | 6 ------ xen/arch/x86/smpboot.c | 6 ------ xen/arch/x86/tboot.c | 4 ++-- xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/mm.c | 6 ++++++ xen/common/domain.c | 4 ++-- xen/common/grant_table.c | 6 ++++++ xen/common/kimage.c | 6 ------ xen/common/memory.c | 6 ++++++ xen/common/page_alloc.c | 6 ++++++ xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 4 ---- xen/common/trace.c | 6 ++++++ xen/common/vmap.c | 9 +++++---- xen/common/xenoprof.c | 2 -- xen/drivers/passthrough/amd/iommu_map.c | 6 ++++++ xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/mm.h | 16 +++++++++------- xen/include/asm-arm/p2m.h | 4 ++-- xen/include/asm-x86/mm.h | 12 ++++++------ xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++++++++++++++---------------- xen/include/xen/domain_page.h | 8 ++++---- xen/include/xen/tmem_xen.h | 2 +- 65 files changed, 166 insertions(+), 239 deletions(-)xen/arch/arm/domain_build.c +0
-2@@ -50,8 +50,6 @@ struct map_range_data/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg))//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION xen/arch/arm/kernel.c +1
-1@@ -295,7 +295,7 @@ static __init int kernel_decompress(struct bootmodule *mod)iounmap (input );return -ENOMEM ; } - mfn =_mfn (page_to_mfn (pages)); + mfn =page_to_mfn (pages); output =__vmap (&mfn,1 << kernel_order_out,1 ,1 ,PAGE_HYPERVISOR ,VMAP_DEFAULT );rc = perform_gunzip(output, input, size);xen/arch/arm/mem_access.c +1
-1@@ -210,7 +210,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, if ( t != p2m_ram_rw ) goto err; - page =mfn_to_page (mfn_x (mfn)); + page =mfn_to_page (mfn);if (unlikely (!get_page (page, v->domain)) )page = NULL;xen/arch/arm/mm.c +4
-4@@ -477,7 +477,7 @@ void unmap_domain_page(const void *va)local_irq_restore (flags); } -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;lpae_t *map =this_cpu (xen_dommap);@@ -485,12 +485,12 @@ unsigned long domain_page_map_to_mfn(const void *ptr)unsigned long offset = (va>>THIRD_SHIFT ) &LPAE_ENTRY_MASK ;if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) -return __virt_to_mfn (va); +return virt_to_mfn (va);ASSERT (slot >=0 && slot <DOMHEAP_ENTRIES );ASSERT (map[slot].pt.avail !=0 ); - return map[slot].pt.base + offset; + return _mfn(map[slot].pt.base + offset); }#endif @@ -1288,7 +1288,7 @@ int xenmem_add_to_physmap_one(return -EINVAL ; } - mfn =_mfn (page_to_mfn (page)); + mfn =page_to_mfn (page); t = p2m_map_foreign;rcu_unlock_domain (od);xen/arch/arm/p2m.c +0
-6@@ -38,12 +38,6 @@ static unsigned int __read_mostly max_vmid =MAX_VMID_8_BIT ;#define P2M_ROOT_PAGES (1<<P2M_ROOT_ORDER) -/* Override macros from asm/mm.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -unsigned int __read_mostly p2m_ipa_bits;/* Helpers to lookup the properties of each level */
xen/arch/arm/p2m.c +2
-2@@ -97,8 +91,8 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr) printk("dom%d IPA 0x%"PRIpaddr"\n", d->domain_id, addr); -printk ("P2M @ %p mfn:0x%lx\n" , - p2m->root,__page_to_mfn (p2m->root)); +printk ("P2M @ %p mfn:%#" PRI_mfn"\n" , + p2m->root,mfn_x (page_to_mfn (p2m->root))); dump_pt_walk(page_to_maddr(p2m->root), addr,P2M_ROOT_LEVEL, P2M_ROOT_PAGES);xen/arch/x86/cpu/vpmu.c +1
-1@@ -653,7 +653,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) {struct vcpu *v;struct vpmu_struct *vpmu; -uint64_t mfn; +mfn_t mfn;void *xenpmu_data;if ( (params->vcpu >= d->max_vcpus) || (d->vcpu[params->vcpu] ==NULL) )
xen/arch/x86/cpu/vpmu.c +1
-1@@ -675,7 +675,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) if ( xenpmu_data ) { mfn =domain_page_map_to_mfn (xenpmu_data); -ASSERT (mfn_valid (_mfn (mfn))); +ASSERT (mfn_valid (mfn));unmap_domain_page_global (xenpmu_data);put_page_and_type (mfn_to_page (mfn));}xen/arch/x86/domain.c +5
-4@@ -186,7 +186,7 @@ void dump_pageframe_info(struct domain *d) } }printk (" DomPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);@@ -199,7 +199,7 @@ void dump_pageframe_info(struct domain *d) page_list_for_each ( page, &d->xenpage_list ) {printk (" XenPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);@@ -621,7 +621,8 @@ int arch_domain_soft_reset(struct domain *d)struct page_info *page =virt_to_page (d->shared_info), *new_page;int ret =0 ;struct domain *owner; -unsigned long mfn, gfn; +mfn_t mfn; +unsigned long gfn;p2m_type_t p2mt;unsigned int i;@@ -655,7 +656,7 @@ int arch_domain_soft_reset(struct domain *d)ASSERT ( owner == d ); mfn =page_to_mfn (page); - gfn =mfn_to_gmfn (d, mfn); + gfn =mfn_to_gmfn (d,mfn_x (mfn));/* * gfn == INVALID_GFN indicates that the shared_info page was never mapped
xen/arch/x86/domain.c +1
-1@@ -664,7 +665,7 @@ int arch_domain_soft_reset(struct domain *d)if ( gfn ==gfn_x (INVALID_GFN ) ) goto exit_put_page; -if (mfn_x (get_gfn_query (d, gfn, &p2mt)) != mfn ) +if ( !mfn_eq (get_gfn_query (d, gfn, &p2mt), mfn) ) { printk(XENLOG_G_ERR "Failed to get Dom%d's shared_info GFN (%lx)\n",d->domain_id, gfn);xen/arch/x86/domain.c +1
-1@@ -681,7 +682,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_remove_page (d,_gfn (gfn),_mfn (mfn), PAGE_ORDER_4K); + ret =guest_physmap_remove_page (d,_gfn (gfn), mfn,PAGE_ORDER_4K );if ( ret ){
printk(XENLOG_G_ERR "Failed to remove Dom%d'sshared_infoframe
%lx\n",xen/arch/x86/domain.c +1
-1@@ -690,7 +691,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_add_page (d,_gfn (gfn),_mfn (page_to_mfn (new_page)), + ret =guest_physmap_add_page (d,_gfn (gfn),page_to_mfn (new_page),PAGE_ORDER_4K );if ( ret ){xen/arch/x86/domain.c +3
-3@@ -988,7 +989,7 @@ int arch_set_info_guest( {if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l4_page_table ) - done = !fill_ro_mpt (_mfn (page_to_mfn (page))); + done = !fill_ro_mpt (page_to_mfn (page));page_unlock (page); }@@ -1115,7 +1116,7 @@ int arch_set_info_guest(l4_pgentry_t *l4tab; l4tab =map_domain_page (pagetable_get_mfn (v->arch.guest_table)); - *l4tab =l4e_from_pfn (page_to_mfn (cr3_page), + *l4tab =l4e_from_mfn (page_to_mfn (cr3_page), _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);unmap_domain_page (l4tab); }@@ -1945,7 +1946,7 @@ int domain_relinquish_resources(struct domain *d)if ( d->arch.pirq_eoi_map !=NULL ) {unmap_domain_page_global (d->arch.pirq_eoi_map); -put_page_and_type (mfn_to_page (d->arch.pirq_eoi_map_mfn)); +put_page_and_type (mfn_to_page (_mfn (d- >arch.pirq_eoi_map_mfn))); d->arch.pirq_eoi_map =NULL ; d->arch.auto_unmask =0 ;}xen/arch/x86/domain_page.c +3
-3@@ -331,13 +331,13 @@ void unmap_domain_page_global(const void *ptr) }/* Translate a map-domain-page'd address to the underlying MFN */ -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;const l1_pgentry_t *pl1e;if ( va >=DIRECTMAP_VIRT_START ) -return virt_to_mfn (ptr); +return _mfn (virt_to_mfn (ptr));if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) {@@ -350,5 +350,5 @@ unsigned long domain_page_map_to_mfn(const void *ptr) pl1e = &__linear_l1_table[l1_linear_offset (va)]; } -return l1e_get_pfn (*pl1e); +return l1e_get_mfn (*pl1e);}
xen/arch/x86/domctl.c +1
-1@@ -429,7 +429,7 @@ long arch_do_domctl( {if ( i >= max_pfns )break ; - mfn =page_to_mfn (page); + mfn =mfn_x (page_to_mfn (page));if (copy_to_guest_offset (domctl->u.getmemlist.buffer, i, &mfn,1 ) ) {xen/arch/x86/hvm/dm.c +1
-1@@ -219,7 +219,7 @@ static int modified_memory(struct domain *d, page =get_page_from_gfn (d, pfn,NULL ,P2M_UNSHARE );if ( page ) { -mfn_t gmfn =_mfn (page_to_mfn (page)); +mfn_t gmfn =page_to_mfn (page);paging_mark_dirty (d, gmfn);/* xen/arch/x86/hvm/dom0_build.c +1
-1@@ -120,7 +120,7 @@ static int __init pvh_populate_memory_range(structdomain *d, continue; } - rc =guest_physmap_add_page (d,_gfn (start),_mfn (page_to_mfn (page)), + rc =guest_physmap_add_page (d,_gfn (start),page_to_mfn (page), order);if ( rc != 0 ) {xen/arch/x86/hvm/dom0_build.c +1
-1@@ -270,7 +270,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d) }write_32bit_pse_identmap (ident_pt);unmap_domain_page (ident_pt); -put_page (mfn_to_page (mfn_x(mfn ))); +put_page (mfn_to_page (mfn)); d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT ] = gaddr;if (pvh_add_mem_range (d, gaddr, gaddr +PAGE_SIZE ,E820_RESERVED ) )printk("Unable to set identity page tables as reserved in the memory
map\n");xen/arch/x86/hvm/dom0_build.c +1
-1@@ -288,7 +288,7 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start, for ( mfn = start; mfn < start + nr_pages; mfn++ ) { -struct page_info *pg =mfn_to_page (mfn); +struct page_info *pg =mfn_to_page (_mfn (mfn));int rc;rc = unshare_xen_page_with_guest(pg, dom_io);xen/arch/x86/hvm/emulate.c +3
-3@@ -590,7 +590,7 @@ static void *hvmemul_map_linear_addr( goto unhandleable; } - *mfn++ =_mfn (page_to_mfn (page)); + *mfn++ =page_to_mfn (page);if (p2m_is_discard_write (p2mt) ) {@@ -622,7 +622,7 @@ static void *hvmemul_map_linear_addr( out:/* Drop all held references. */ while ( mfn-- > hvmemul_ctxt->mfn ) -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn));return err; }@@ -648,7 +648,7 @@ static void hvmemul_unmap_linear_addr( {ASSERT (mfn_valid (*mfn));paging_mark_dirty (currd, *mfn); -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn)); *mfn++ =_mfn (0 );/* Clean slot for map()'s error checking. */ }xen/arch/x86/hvm/hvm.c +1
-1@@ -2211,7 +2211,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer) v->arch.guest_table = pagetable_from_page(page); HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, mfn = %lx", - v->arch.hvm_vcpu.guest_cr[3 ],page_to_mfn (page)); + v->arch.hvm_vcpu.guest_cr[3 ],mfn_x (page_to_mfn (page))); }} else if ( !(value & X86_CR0_PG) && (old_value & X86_CR0_PG) )xen/arch/x86/hvm/hvm.c +1
-1@@ -2546,7 +2546,7 @@ static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent, if ( unlikely(p2m_is_discard_write(p2mt)) ) *writable = 0; else if ( !permanent ) - paging_mark_dirty(d, _mfn(page_to_mfn(page))); + paging_mark_dirty(d, page_to_mfn(page)); }if ( !permanent )
xen/arch/x86/hvm/hvm.c +1
-1@@ -2588,7 +2588,7 @@ void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent)void hvm_unmap_guest_frame (void *p,bool_t permanent) { -unsigned long mfn; +mfn_t mfn;struct page_info *page;if ( !p )xen/arch/x86/hvm/hvm.c +1
-1@@ -2609,7 +2609,7 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent)list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list)if ( track->page == page ) { -paging_mark_dirty (d,_mfn (mfn)); +paging_mark_dirty (d, mfn);list_del (&track->list);xfree (track);break;xen/arch/x86/hvm/hvm.c +3
-3@@ -2626,7 +2626,7 @@ void hvm_mapped_guest_frames_mark_dirty(struct domain *d) spin_lock(&d->arch.hvm_domain.write_map.lock);list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list) -paging_mark_dirty (d,_mfn (page_to_mfn (track->page))); +paging_mark_dirty (d,page_to_mfn (track->page));spin_unlock (&d->arch.hvm_domain.write_map.lock); }@@ -3200,8 +3200,8 @@ static enum hvm_translation_result __hvm_copy(if (xchg (&lastpage,gfn_x (gfn)) !=gfn_x (gfn) )dprintk (XENLOG_G_DEBUG , -"%pv attempted write to read-only gfn %#lx (mfn=%#lx)\n" , - v,gfn_x (gfn),page_to_mfn (page)); + "%pv attempted write to read-only gfn %#lx (mfn=%#"PRI_mfn")\n", + v,gfn_x (gfn),mfn_x (page_to_mfn (page))); }else {xen/arch/x86/hvm/hvm.c +1
-1@@ -3209,7 +3209,7 @@ static enum hvm_translation_result __hvm_copy(memcpy (p, buf, count); else memset(p, 0, count); -paging_mark_dirty (v->domain,_mfn (page_to_mfn (page))); +paging_mark_dirty (v->domain,page_to_mfn (page)); } }else xen/arch/x86/hvm/ioreq.c +3
-3@@ -268,7 +268,7 @@ static void hvm_remove_ioreq_gfn( struct domain *d, struct hvm_ioreq_page *iorp) { if ( guest_physmap_remove_page(d, _gfn(iorp->gfn), - _mfn(page_to_mfn(iorp->page)), 0) ) + page_to_mfn(iorp->page), 0) ) domain_crash(d); clear_page(iorp->va); }@@ -281,9 +281,9 @@ static int hvm_add_ioreq_gfn(clear_page (iorp->va); rc =guest_physmap_add_page (d,_gfn (iorp->gfn), -_mfn (page_to_mfn (iorp->page)),0 ); +page_to_mfn (iorp->page),0 );if ( rc ==0 ) -paging_mark_dirty (d,_mfn (page_to_mfn (iorp->page))); +paging_mark_dirty (d,page_to_mfn (iorp->page));return rc; }xen/arch/x86/hvm/stdvga.c +1
-1@@ -590,7 +590,7 @@ void stdvga_init(struct domain *d)if ( pg ==NULL )break ; s->vram_page[i] = pg; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); }if ( i ==ARRAY_SIZE (s->vram_page) )xen/arch/x86/hvm/svm/svm.c +2
-2@@ -1521,7 +1521,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_hsa =page_to_maddr (pg); }@@ -1531,7 +1531,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_vmcb =page_to_maddr (pg); }xen/arch/x86/hvm/viridian.c +2
-2@@ -354,7 +354,7 @@ static void enable_hypercall_page(struct domain *d)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#"PRI_mfn")\n", - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ; }@@ -414,7 +414,7 @@ static void initialize_vp_assist(struct vcpu *v) fail:gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#"PRI_mfn")\n", gmfn, - page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); +mfn_x (page ?page_to_mfn (page) :INVALID_MFN )); }static void
teardown_vp_assist(struct vcpu *v)xen/arch/x86/hvm/viridian.c +1
-1@@ -494,7 +494,7 @@ static void update_reference_tsc(struct domain *d, bool_t initialize)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#"PRI_mfn")\n", - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ;}xen/arch/x86/hvm/vmx/vmcs.c +1
-1@@ -1437,7 +1437,7 @@ int vmx_vcpu_enable_pml(struct vcpu *v)vmx_vmcs_enter (v); -__vmwrite (PML_ADDRESS ,page_to_mfn (v->arch.hvm_vmx.pml_pg) << PAGE_SHIFT); +__vmwrite (PML_ADDRESS ,page_to_maddr (v->arch.hvm_vmx.pml_pg));__vmwrite (GUEST_PML_INDEX ,NR_PML_ENTRIES -1 );v->arch.hvm_vmx.secondary_exec_control |=
SECONDARY_EXEC_ENABLE_PML;xen/arch/x86/hvm/vmx/vmx.c +4
-4@@ -2978,7 +2978,7 @@ gp_fault:static int vmx_alloc_vlapic_mapping (struct domain *d) {struct page_info *pg; -unsigned long mfn; +mfn_t mfn;if ( !cpu_has_vmx_virtualize_apic_accesses )return 0 ;@@ -2987,10 +2987,10 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)if ( !pg )return -ENOMEM ; mfn =page_to_mfn (pg); -clear_domain_page (_mfn (mfn)); +clear_domain_page (mfn);share_xen_page_with_guest (pg, d, XENSHARE_writable); - d->arch.hvm_domain.vmx.apic_access_mfn = mfn; - set_mmio_p2m_entry(d, paddr_to_pfn(APIC_DEFAULT_PHYS_BASE),_mfn (mfn), + d->arch.hvm_domain.vmx.apic_access_mfn =mfn_x (mfn); + set_mmio_p2m_entry(d, paddr_to_pfn(APIC_DEFAULT_PHYS_BASE), mfn,PAGE_ORDER_4K, p2m_get_hostp2m(d)->default_access); return 0;xen/arch/x86/hvm/vmx/vmx.c +1
-1@@ -3001,7 +3001,7 @@ static void vmx_free_vlapic_mapping(struct domain *d)unsigned long mfn = d->arch.hvm_domain.vmx.apic_access_mfn;if ( mfn !=0 ) -free_shared_domheap_page (mfn_to_page (mfn)); +free_shared_domheap_page (mfn_to_page (_mfn (mfn))); }static void
vmx_install_vlapic_mapping(struct vcpu *v)xen/arch/x86/hvm/vmx/vvmx.c +2
-2@@ -84,7 +84,7 @@ int nvmx_vcpu_initialise(struct vcpu *v) } v->arch.hvm_vmx.vmread_bitmap = vmread_bitmap; -clear_domain_page (_mfn (page_to_mfn (vmread_bitmap))); +clear_domain_page (page_to_mfn (vmread_bitmap)); vmwrite_bitmap =alloc_domheap_page (NULL ,0 );if ( !vmwrite_bitmap )@@ -1729,7 +1729,7 @@ int nvmx_handle_vmptrld(struct cpu_user_regs *regs) nvcpu->nv_vvmcx = vvmcx; nvcpu->nv_vvmcxaddr = gpa; v->arch.hvm_vmx.vmcs_shadow_maddr = -pfn_to_paddr (domain_page_map_to_mfn (vvmcx)); +mfn_to_maddr (domain_page_map_to_mfn (vvmcx)); }else {xen/arch/x86/hvm/vmx/vvmx.c +1
-1@@ -1815,7 +1815,7 @@ int nvmx_handle_vmclear(struct cpu_user_regs *regs) {if ( writable )clear_vvmcs_launched (&nvmx->launched_list, -domain_page_map_to_mfn (vvmcs)); +mfn_x (domain_page_map_to_mfn (vvmcs)));else rc =VMFAIL_VALID ;hvm_unmap_guest_frame(vvmcs, 0);xen/arch/x86/mm.c +0
-6@@ -128,12 +128,6 @@#include "pv/mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* Mapping of the fixmap space needed early. */ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) l1_fixmap[L1_PAGETABLE_ENTRIES ];xen/arch/x86/mm/guest_walk.c +3
-3@@ -469,20 +469,20 @@ guest_walk_tables(struct vcpu *v, structp2m_domain *p2m, if ( l3p ) {unmap_domain_page (l3p ); -put_page (mfn_to_page (mfn_x (gw->l3mfn))); +put_page (mfn_to_page (gw->l3mfn)); }#endif #if GUEST_PAGING_LEVELS >=3 if ( l2p ) {unmap_domain_page (l2p); -put_page (mfn_to_page (mfn_x (gw->l2mfn))); +put_page (mfn_to_page (gw->l2mfn)); }#endif if ( l1p ) {unmap_domain_page (l1p); -put_page (mfn_to_page (mfn_x (gw->l1mfn))); +put_page (mfn_to_page (gw->l1mfn)); }return walk_ok;xen/arch/x86/mm/hap/guest_walk.c +0
-0@@ -83,7 +83,7 @@ unsigned longhap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)(
*pfec &= ~PFEC_page_present; goto out_tweak_pfec; }xen/arch/x86/mm/hap/guest_walk.c +1
-1- top_mfn =_mfn (page_to_mfn (top_page)); + top_mfn =page_to_mfn (top_page);/* Map the top-level table and call the tree-walker */ ASSERT (mfn_valid (top_mfn));xen/arch/x86/mm/hap/hap.c +0
-6@@ -42,12 +42,6 @@#include "private.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* HAP VRAM TRACKING SUPPORT */ /************************************************/ xen/arch/x86/mm/hap/nested_ept.c +1
-1@@ -173,7 +173,7 @@ nept_walk_tables(struct vcpu *v, unsigned long l2ga, ept_walk_t *gw) goto map_err; gw->lxe[lvl] = lxp[ept_lvl_table_offset (l2ga, lvl)];unmap_domain_page (lxp); -put_page (mfn_to_page (mfn_x (lxmfn))); +put_page (mfn_to_page (lxmfn));if (nept_non_present_check (gw->lxe[lvl]) )goto non_present;xen/arch/x86/mm/mem_sharing.c +0
-5@@ -152,11 +152,6 @@ static inline shr_handle_t get_next_handle(void)#define mem_sharing_enabled (d) \ (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled) -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -static atomic_t nr_saved_mfns =ATOMIC_INIT (0 );static atomic_t nr_shared_mfns =ATOMIC_INIT (0 );xen/arch/x86/mm/p2m-ept.c +4
-0@@ -33,6 +33,10 @@#include "mm-locks.h" +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +#define atomic_read_ept_entry (__pepte) \ ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } )xen/arch/x86/mm/p2m-pod.c +0
-6@@ -29,12 +29,6 @@#include "mm-locks.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -#define superpage_aligned (_x) (((_x)&(SUPERPAGE_PAGES-1))==0)/* Enforce lock ordering when grabbing the "external" page_alloc lock */ xen/arch/x86/mm/p2m.c +0
-6@@ -47,12 +47,6 @@ bool_t __initdata opt_hap_1gb = 1, __initdata opt_hap_2mb =1 ;boolean_param ("hap_1gb" , opt_hap_1gb);boolean_param ("hap_2mb" , opt_hap_2mb); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -DEFINE_PERCPU_RWLOCK_GLOBAL (p2m_percpu_rwlock);/* Init the datastructures for later use by the p2m code */
xen/arch/x86/mm/paging.c +0
-6@@ -47,12 +47,6 @@/* Per-CPU variable for enforcing the lock ordering */ DEFINE_PER_CPU (int, mm_lock_level); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* LOG DIRTY SUPPORT */ /************************************************/ xen/arch/x86/mm/shadow/private.h +1
-1@@ -315,7 +315,7 @@ static inline int page_is_out_of_sync(struct page_info *p)static inline int mfn_is_out_of_sync (mfn_t gmfn) { -return page_is_out_of_sync (mfn_to_page (mfn_x (gmfn))); +return page_is_out_of_sync (mfn_to_page (gmfn)); }static inline int
page_oos_may_write(struct page_info *p)xen/arch/x86/mm/shadow/private.h +1
-8@@ -326,7 +326,7 @@ static inline int page_oos_may_write(struct page_info *p)static inline int mfn_oos_may_write (mfn_t gmfn) { -return page_oos_may_write (mfn_to_page (mfn_x (gmfn))); +return page_oos_may_write (mfn_to_page (gmfn)); }#endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */ @@ -465,18 +465,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v);* MFN/page-info handling */ -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) - -/* Override pagetable_t <-> struct page_info conversions to work with
mfn_t*/xen/arch/x86/mm/shadow/private.h +0
-4-#undef pagetable_get_page -#define pagetable_get_page (x) mfn_to_page(pagetable_get_mfn(x)) -#undef pagetable_from_page -#define pagetable_from_page (pg)pagetable_from_mfn(page_to_mfn(pg))
xen/arch/x86/mm/shadow/private.h +0
-1-#define backpointer (sp) _mfn(pdx_to_pfn((unsigned long)(sp)->v.sh.back))static inline unsigned long __backpointer (const struct page_info *sp) {xen/arch/x86/numa.c +1
-1@@ -430,7 +430,7 @@ static void dump_numa(unsigned char key)spin_lock (&d->page_alloc_lock);page_list_for_each (page, &d->page_list) { - i =phys_to_nid ((paddr_t )page_to_mfn (page) <<PAGE_SHIFT ); + i =phys_to_nid (page_to_maddr (page)); page_num_node[i]++; }spin_unlock (&d->page_alloc_lock);xen/arch/x86/physdev.c +1
-1@@ -242,7 +242,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) }if (cmpxchg (&currd->arch.pirq_eoi_map_mfn, -0 ,page_to_mfn (page)) !=0 ) +0 ,mfn_x (page_to_mfn (page))) !=0 ) {put_page_and_type (page);ret = -EBUSY;xen/arch/x86/pv/callback.c +0
-6@@ -31,12 +31,6 @@#include <public/callback.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static int register_guest_nmi_callback (unsigned long address) {struct vcpu *curr = current;xen/arch/x86/pv/descriptor-tables.c +0
-10@@ -25,16 +25,6 @@#include <asm/p2m.h> #include <asm/pv/mm.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/******************* -* Descriptor Tables -*/ -void pv_destroy_gdt (struct vcpu *v) {l1_pgentry_t *pl1e;xen/arch/x86/pv/dom0_build.c +6
-0@@ -20,6 +20,12 @@#include <asm/page.h> #include <asm/setup.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Allow ring-3 access in long mode as guest cannot use ring 1 ... */ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)#define
L1_PROT(BASE_PROT|_PAGE_GUEST_KERNEL)xen/arch/x86/pv/domain.c +0
-6@@ -11,12 +11,6 @@#include <asm/pv/domain.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static void noreturncontinue_nonidle_domain (struct vcpu *v) {check_wakeup_from_wait ();xen/arch/x86/pv/emul-gate- renamed from xen/arch/x86/pv/emul-gate-op.c +0
-0
op.c
index0f89c91dff..5cdb54c937100644xen/arch/x86/pv/emul-gate-op.c +0
-6@@ -41,12 +41,6 @@#include "emulate.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - static int read_gate_descriptor(unsigned int gate_sel, const struct vcpu *v, unsigned int *sel,xen/arch/x86/pv/emul-priv- renamed from xen/arch/x86/pv/emul-priv-op.c +0
-0
op.c
index2f9264548a..6ebaf2f1e3100644xen/arch/x86/pv/emul-priv-op.c +0
-10@@ -43,16 +43,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/*********************** -* I/O emulation support -*/ -struct priv_op_ctxt {struct x86_emulate_ctxt ctxt;struct {xen/arch/x86/pv/grant_table.c +0
-6@@ -27,12 +27,6 @@#include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static unsigned int grant_to_pte_flags (unsigned int grant_flags,unsigned int cache_flags) {xen/arch/x86/pv/ro-page- renamed from xen/arch/x86/pv/ro-page-fault.c +0
-0
fault.c
index6b2976d3df..a7b7eb5113100644xen/arch/x86/pv/ro-page-fault.c +0
-6@@ -33,12 +33,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/********************* * Writable Pagetables */ xen/arch/x86/smpboot.c +0
-6@@ -46,12 +46,6 @@#include <mach_wakecpu.h> #include <smpboot_hooks.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -#define setup_trampoline () (bootsym_phys (trampoline_realmode_entry))unsigned long
__read_mostlytrampoline_phys;xen/arch/x86/tboot.c +2
-2@@ -184,7 +184,7 @@ static void update_pagetable_mac(vmac_ctx_t *ctx)for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue ;@@ -276,7 +276,7 @@ static void tboot_gen_xenheap_integrity(constuint8_t key[TB_KEY_SIZE ], vmac_set_key((uint8_t *)key, &ctx);for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =__mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue;xen/arch/x86/traps.c +2
-2@@ -810,8 +810,8 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) }gdprintk (XENLOG_WARNING , -"Bad GMFN %lx (MFN %lx) to MSR %08x\n" , - gmfn, page ?page_to_mfn (page) :-1UL , base); +"Bad GMFN %lx (MFN %#" PRI_mfn") to MSR %08x\n" , + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ), base);return 0 ; }xen/arch/x86/x86_64/mm.c +6
-0@@ -40,6 +40,12 @@ asm(".file \"" __FILE__ "\"");#include <asm/mem_sharing.h> #include <public/memory.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;
l2_pgentry_t*compat_idle_pg_table_l2;xen/common/domain.c +1
-1@@ -1192,7 +1192,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) } v->vcpu_info = new_info; - v->vcpu_info_mfn =_mfn (page_to_mfn (page)); + v->vcpu_info_mfn =page_to_mfn (page);/* Set new vcpu_info pointer /before/ setting pending flags. */ smp_wmb();xen/common/domain.c +1
-1@@ -1225,7 +1225,7 @@ void unmap_vcpu_info(struct vcpu *v)vcpu_info_reset (v);/* NB: Clobbers v->vcpu_info_mfn */ -put_page_and_type (mfn_to_page (mfn_x (mfn))); +put_page_and_type (mfn_to_page (mfn)); } int default_initialise_vcpu(struct vcpu *v,
XEN_GUEST_HANDLE_PARAM(void)arg)xen/common/grant_table.c +6
-0@@ -40,6 +40,12 @@#include <xsm/xsm.h> #include <asm/flushtlb.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Per-domain grant information. */ struct grant_table {/* xen/common/kimage.c +0
-6@@ -23,12 +23,6 @@#include <asm/page.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* * When kexec transitions to the new kernel there is a one-to-one * mapping between physical and virtual addresses. On processors xen/common/memory.c +6
-0@@ -29,6 +29,12 @@#include <public/memory.h> #include <xsm/xsm.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +struct memop_args {/* INPUT */ struct domain *domain;/* Domain to be affected. */ xen/common/page_alloc.c +6
-0@@ -150,6 +150,12 @@#define p2m_pod_offline_or_broken_replace (pg) BUG_ON(pg != NULL)#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* * Comma-separated list of hexadecimal page numbers containing bad bytes.
* e.g. 'badpage=0x3f45,0x8a321'.xen/common/tmem.c +1
-1@@ -243,7 +243,7 @@ static void tmem_persistent_pool_page_put(void *page_va)struct page_info *pi;ASSERT (IS_PAGE_ALIGNED (page_va)); - pi =mfn_to_page (virt_to_mfn (page_va)); + pi =mfn_to_page (_mfn (virt_to_mfn (page_va)));ASSERT (IS_VALID_PAGE (pi));__tmem_free_page_thispool (pi);}
xen/common/tmem_xen.c +0
-4@@ -14,10 +14,6 @@#include <xen/cpu.h> #include <xen/init.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -bool __read_mostly opt_tmem;boolean_param ("tmem" , opt_tmem);xen/common/trace.c +6
-0@@ -42,6 +42,12 @@ CHECK_t_buf;#define compat_t_rec t_rec#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* opt_tbuf_size: trace buffer size (in pages) for each cpu */ static unsigned int opt_tbuf_size;static unsigned int opt_tevt_mask;xen/common/vmap.c +1
-1@@ -36,7 +36,7 @@ void __init vm_init_type(enum vmap_region type, void *start, void *end) {struct page_info *pg =alloc_domheap_page (NULL ,0 ); -map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ); +map_pages_to_xen (va,mfn_x (page_to_mfn (pg)),1 ,PAGE_HYPERVISOR );clear_page ((void *)va);} bitmap_fill(vm_bitmap(type), vm_low[type]);xen/common/vmap.c +2
-1@@ -107,7 +107,8 @@ static void *vm_alloc(unsigned int nr, unsigned int align, {unsigned long va = (unsigned long )vm_bitmap (t) + vm_top[t] /8 ; -if ( !map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ) ) +if ( !map_pages_to_xen (va,mfn_x (page_to_mfn (pg)), +1 ,PAGE_HYPERVISOR ) ) {clear_page((void *)va); vm_top[t] += PAGE_SIZE * 8;xen/common/vmap.c +1
-1@@ -258,7 +259,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) pg =alloc_domheap_page (NULL ,0 );if ( pg ==NULL ) goto error; - mfn[i] =_mfn (page_to_mfn (pg)); + mfn[i] =page_to_mfn (pg); }va = __vmap(mfn, 1, pages, 1, PAGE_HYPERVISOR, type);xen/common/vmap.c +1
-1@@ -270,7 +271,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) error:while ( i-- ) -free_domheap_page (mfn_to_page (mfn_x (mfn[i]))); +free_domheap_page (mfn_to_page (mfn[i]));xfree (mfn);return NULL ;}
xen/common/xenoprof.c +0
-2@@ -22,8 +22,6 @@/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn))/* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32xen/drivers/passthrough/amd/iommu_map.c +6
-0@@ -25,6 +25,12 @@#include "../ats.h" #include <xen/pci.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Given pfn and page table level, return pde index */ static unsigned int pfn_to_pde_idx (unsigned long pfn,unsigned int level) {xen/drivers/passthrough/iommu.c +1
-1@@ -184,7 +184,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) page_list_for_each ( page, &d->page_list ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);unsigned int mapping = IOMMUF_readable;int ret;xen/drivers/passthrough/x86/iommu.c +1
-1@@ -58,7 +58,7 @@ int arch_iommu_populate_page_table(struct domain *d)if (is_hvm_domain (d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);if ( gfn != gfn_x(INVALID_GFN) )xen/include/asm-arm/mm.h +1
-1@@ -138,7 +138,7 @@ extern vaddr_t xenheap_virt_start;#endif #ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_page (page) is_xen_heap_mfn(mfn_x(__page_to_mfn(page)))#define is_xen_heap_mfn (mfn) ({ \ unsigned long mfn_ = (mfn); \(mfn_ >= mfn_x(xenheap_mfn_start) && \xen/include/asm-arm/mm.h +4
-4@@ -220,12 +220,14 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) }) /* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) +#define __mfn_to_page (mfn) \ + (frame_table + (pfn_to_pdx(mfn_x(mfn)) - frametable_base_pdx)) +#define __page_to_mfn (pg) \ + _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx))/* Convert between machine addresses and page-info structures. */ -#define maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) <<
PAGE_SHIFT)xen/include/asm-arm/mm.h +3
-1+#define maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)@@ -235,7 +237,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)#define gaddr_to_gfn (ga) _gfn(paddr_to_pfn(ga))#define mfn_to_maddr (mfn) pfn_to_paddr(mfn_x(mfn))#define maddr_to_mfn (ma) _mfn(paddr_to_pfn(ma)) -#define vmap_to_mfn (va) paddr_to_pfn(virt_to_maddr((vaddr_t)va)) +#define vmap_to_mfn (va) maddr_to_mfn(virt_to_maddr((vaddr_t)va))#define vmap_to_page (va) mfn_to_page(vmap_to_mfn(va))/* Page-align address and convert to frame number format */
xen/include/asm-arm/mm.h +1
-1@@ -309,7 +311,7 @@ static inline struct page_info *virt_to_page(const void *v)static inline void *page_to_virt (const struct page_info *pg) { -return mfn_to_virt (page_to_mfn (pg)); +return mfn_to_virt (mfn_x (__page_to_mfn (pg))); }struct
page_info*get_page_from_gva(struct vcpu *v,vaddr_tva,xen/include/asm-arm/p2m.h +2
-2@@ -276,7 +276,7 @@ static inline struct page_info *get_page_from_gfn( {struct page_info *page;p2m_type_t p2mt; -unsigned long mfn =mfn_x (p2m_lookup (d,_gfn (gfn), &p2mt)); +mfn_t mfn =p2m_lookup (d,_gfn (gfn), &p2mt);if (t) *t = p2mt;@@ -284,7 +284,7 @@ static inline struct page_info *get_page_from_gfn(if ( !p2m_is_any_ram (p2mt) )return NULL ; -if ( !mfn_valid (_mfn (mfn)) ) +if ( !mfn_valid (mfn) )return NULL ; page =mfn_to_page (mfn);xen/include/asm-x86/mm.h +1
-1@@ -270,7 +270,7 @@ struct page_info#define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ - (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn))) + (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(_mfn(mfn))))#define is_xen_fixed_mfn (mfn) \ ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) && \(((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end)))xen/include/asm-x86/mm.h +1
-1@@ -383,7 +383,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner);static inline bool get_page_from_mfn (mfn_t mfn,struct domain *d) { -struct page_info *page =__mfn_to_page (mfn_x (mfn)); +struct page_info *page =__mfn_to_page (mfn);if (unlikely (!mfn_valid (mfn)) ||unlikely (!get_page (page, d)) ){xen/include/asm-x86/mm.h +4
-4@@ -477,10 +477,10 @@ extern paddr_t mem_hotplug;#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)); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ +#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)); \xen/include/asm-x86/p2m.h +1
-1@@ -487,7 +487,7 @@ static inline struct page_info *get_page_from_gfn(/* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */ if ( t ) *t =likely (d != dom_io) ? p2m_ram_rw : p2m_mmio_direct; - page =__mfn_to_page (gfn); + page =__mfn_to_page (_mfn (gfn));return mfn_valid (_mfn (gfn)) &&get_page (page, d) ? page :NULL ; }xen/include/asm-x86/page.h +4
-4@@ -88,10 +88,10 @@ ((paddr_t)(((x).l4 & (PADDR_MASK &PAGE_MASK ))))/* Get pointer to info structure of page mapped by pte (struct page_info *). */ -#define l1e_get_page (x) (__mfn_to_page(l1e_get_pfn(x))) -#define l2e_get_page (x) (__mfn_to_page(l2e_get_pfn(x))) -#define l3e_get_page (x) (__mfn_to_page(l3e_get_pfn(x))) -#define l4e_get_page (x) (__mfn_to_page(l4e_get_pfn(x))) +#define l1e_get_page (x) (__mfn_to_page(l1e_get_mfn(x))) +#define l2e_get_page (x) (__mfn_to_page(l2e_get_mfn(x))) +#define l3e_get_page (x) (__mfn_to_page(l3e_get_mfn(x))) +#define l4e_get_page (x) (__mfn_to_page(l4e_get_mfn(x)))/* Get pte access flags (unsigned int). */ #define
l1e_get_flags(x)(get_pte_flags((x).l1))xen/include/asm-x86/page.h +0
-4@@ -157,10 +157,10 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)#define l4e_from_intpte (intpte) ((l4_pgentry_t) { (intpte_t)(intpte) })/* Construct a pte from a page pointer and access flags. */ -#define l1e_from_page (page, flags) l1e_from_pfn(__page_to_mfn(page), (flags)) -#define l2e_from_page (page, flags) l2e_from_pfn(__page_to_mfn(page), (flags)) -#define l3e_from_page (page, flags) l3e_from_pfn(__page_to_mfn(page), (flags)) -#define l4e_from_page (page, flags) l4e_from_pfn(__page_to_mfn(page),(flags))
+#definel1e_from_page(page, flags)l1e_from_mfn(__page_to_mfn(page), (flags))
+#definel2e_from_page(page, flags)l2e_from_mfn(__page_to_mfn(page), (flags))
+#definel3e_from_page(page, flags)l3e_from_mfn(__page_to_mfn(page), (flags))
+#definel4e_from_page(page, flags)l4e_from_mfn(__page_to_mfn(page), (flags))/* Add extra flags to an existing pte. */
#definel1e_add_flags(x, flags)((x).l1 |=put_pte_flags(flags))xen/include/asm-x86/page.h +2
-2@@ -215,13 +215,13 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)/* Page-table type. */ typedef struct {u64 pfn; }pagetable_t ;#define pagetable_get_paddr (x) ((paddr_t)(x).pfn << PAGE_SHIFT) -#define pagetable_get_page (x) __mfn_to_page((x).pfn) +#define pagetable_get_page (x) __mfn_to_page(pagetable_get_mfn(x))#define pagetable_get_pfn (x) ((x).pfn)#define pagetable_get_mfn (x) _mfn(((x).pfn))#define pagetable_is_null (x) ((x).pfn == 0)#define pagetable_from_pfn (pfn) ((pagetable_t) { (pfn) })#define pagetable_from_mfn (mfn) ((pagetable_t) { mfn_x(mfn) }) -#define pagetable_from_page (pg) pagetable_from_pfn(__page_to_mfn(pg)) +#define pagetable_from_page (pg)pagetable_from_mfn (__page_to_mfn (pg))#define
pagetable_from_paddr(p)pagetable_from_pfn((p)>>PAGE_SHIFT)
#definepagetable_null()pagetable_from_pfn(0)xen/include/asm-x86/page.h +2
-4@@ -240,12 +240,12 @@ void copy_page_sse2(void *, const void *);#define __mfn_to_virt (mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) /* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table)) +#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn_x(mfn))) +#define __page_to_mfn (pg) _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table)))/* Convert between machine addresses and page-info structures. */ -#define __maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define __page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) <<
PAGE_SHIFT)xen/include/asm-x86/page.h +4
-2+#define __maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define __page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define __pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)@@ -273,8 +273,8 @@ void copy_page_sse2(void *, const void *);#define pfn_to_paddr (pfn) __pfn_to_paddr(pfn)#define paddr_to_pfn (pa) __paddr_to_pfn(pa)#define paddr_to_pdx (pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define vmap_to_mfn (va) l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va))) -#define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) +#define vmap_to_mfn(va) _mfn(l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va)))) +#define vmap_to_page(va) __mfn_to_page(vmap_to_mfn(va))#endif /* !defined(__ASSEMBLY__) */
xen/include/xen/domain_page.h +3
-3@@ -34,7 +34,7 @@ void unmap_domain_page(const void *va);/* * Given a VA from map_domain_page(), return its underlying MFN. */ -unsigned long domain_page_map_to_mfn (const void *va); +mfn_t domain_page_map_to_mfn (const void *va);/* * Similar to the above calls, except the mapping is accessible in all @@ -44,11 +44,11 @@ unsigned long domain_page_map_to_mfn(const void *va);void *map_domain_page_global (mfn_t mfn);void unmap_domain_page_global (const void *va); -#define __map_domain_page (pg) map_domain_page(_mfn(__page_to_mfn(pg))) +#define __map_domain_page (pg)map_domain_page (__page_to_mfn(pg )) static inline void *__map_domain_page_global(const struct page_info *pg) { -return map_domain_page_global (_mfn (__page_to_mfn (pg))); +return map_domain_page_global (page_to_mfn (pg));}
#else /* !CONFIG_DOMAIN_PAGE */
xen/include/xen/domain_page.h +1
-1@@ -56,7 +56,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)#define map_domain_page (mfn) __mfn_to_virt(mfn_x(mfn))#define __map_domain_page (pg) page_to_virt(pg)#define unmap_domain_page (va) ((void)(va)) -#define domain_page_map_to_mfn (va) virt_to_mfn((unsigned long)(va)) +#define domain_page_map_to_mfn(va) _mfn(virt_to_mfn((unsigned long)(va)))static inline void *map_domain_page_global(mfn_t mfn) {
xen/include/xen/tmem_xen.h +1
-1@@ -25,7 +25,7 @@typedef uint32_t pagesize_t ;/* like size_t, must handle largest PAGE_SIZE */ #define IS_PAGE_ALIGNED (addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE) -#define IS_VALID_PAGE (_pi) mfn_valid(_mfn(page_to_mfn(_pi))) +#define IS_VALID_PAGE (_pi) mfn_valid(page_to_mfn(_pi))
Quoted 4 lines
extern struct
page_list_headtmem_page_list;
externspinlock_ttmem_page_list_lock;
--
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallQuoted 6 lines · Julien Grall
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 8 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallQuoted 6 lines · Julien Grall
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 9 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
SVM:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallQuoted 9 lines
From: Julien Grall [mailto:[email protected]]
Sent: Wednesday, November 1, 2017 10:03 PMMost of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 9 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallQuoted 6 lines · Julien Grall
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 8 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH v3 for-next 4/4] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
In reply to Julien GrallQuoted 6 lines · Julien Grall
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn because the rest of the function usemfn_t.So make
__page_to_mfnand__mfn_to_pagereturnmfn_tby default.
Quoted 8 lines
Only reasonable clean-ups are done in this patch because it is already quite big. So some of the files now override
page_to_mfnandmfn_to_pageto avoid usingmfn_t.Lastly,
domain_page_to_mfnis also converted to usemfn_tgiven that most of the callers are now switched to _mfn(domain_page_to_mfn(...)).Signed-off-by Julien Grall <[email protected]>
Quoted 1,625 lines
---
Andrew suggested to drop
IS_VALID_PAGEinxen/tmem_xen.h. His comment was:"/sigh This is tautological. The definition of a "valid mfn" in this case is one for which we have frametable entry, and by having a struct
page_infoin our hands, this is by definition true (unless you have a wild pointer, at which point your bug is elsewhere).
IS_VALID_PAGE()is only ever used in assertions and never usefully, so instead I would remove it entirely rather than trying to fix it up."I can remove the function in a separate patch at the begining of the series if Konrad (TMEM maintainer) is happy with that.
Cc Stefano Stabellini <[email protected]>Cc Julien Grall <[email protected]>Cc Andrew Cooper <[email protected]>Cc George Dunlap <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Tim Deegan <[email protected]>Cc Wei Liu <[email protected]>Cc Razvan Cojocaru <[email protected]>Cc Tamas K Lengyel <[email protected]>Cc Paul Durrant <[email protected]>Cc Boris Ostrovsky <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Cc Jun Nakajima <[email protected]>Cc Kevin Tian <[email protected]>Cc George Dunlap <[email protected]>Cc Gang Wei <[email protected]>Cc Shane Wang <[email protected]>Changes in v3:
- Rebase on the latest staging and fix some conflicts. Tags haven't be retained.
- Switch the printf format toPRI_mfnChanges in v2:
- Some part have been moved in separate patch
- Remove one spurious comment
- Convertdomain_page_to_mfnto usemfn_t--- xen/arch/arm/domain_build.c | 2 -- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mem_access.c | 2 +- xen/arch/arm/mm.c | 8 ++++---- xen/arch/arm/p2m.c | 10 ++-------- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/domain.c | 21 +++++++++++---------- xen/arch/x86/domain_page.c | 6 +++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/dom0_build.c | 6 +++--- xen/arch/x86/hvm/emulate.c | 6 +++--- xen/arch/x86/hvm/hvm.c | 16 ++++++++-------- xen/arch/x86/hvm/ioreq.c | 6 +++--- xen/arch/x86/hvm/stdvga.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/viridian.c | 6 +++--- xen/arch/x86/hvm/vmx/vmcs.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 10 +++++----- xen/arch/x86/hvm/vmx/vvmx.c | 6 +++--- xen/arch/x86/mm.c | 6 ------ xen/arch/x86/mm/guest_walk.c | 6 +++--- xen/arch/x86/mm/hap/guest_walk.c | 2 +- xen/arch/x86/mm/hap/hap.c | 6 ------ xen/arch/x86/mm/hap/nested_ept.c | 2 +- xen/arch/x86/mm/mem_sharing.c | 5 ----- xen/arch/x86/mm/p2m-ept.c | 4 ++++ xen/arch/x86/mm/p2m-pod.c | 6 ------ xen/arch/x86/mm/p2m.c | 6 ------ xen/arch/x86/mm/paging.c | 6 ------ xen/arch/x86/mm/shadow/private.h | 16 ++-------------- xen/arch/x86/numa.c | 2 +- xen/arch/x86/physdev.c | 2 +- xen/arch/x86/pv/callback.c | 6 ------ xen/arch/x86/pv/descriptor-tables.c | 10 ---------- xen/arch/x86/pv/dom0_build.c | 6 ++++++ xen/arch/x86/pv/domain.c | 6 ------ xen/arch/x86/pv/emul-gate-op.c | 6 ------ xen/arch/x86/pv/emul-priv-op.c | 10 ---------- xen/arch/x86/pv/grant_table.c | 6 ------ xen/arch/x86/pv/ro-page-fault.c | 6 ------ xen/arch/x86/smpboot.c | 6 ------ xen/arch/x86/tboot.c | 4 ++-- xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/mm.c | 6 ++++++ xen/common/domain.c | 4 ++-- xen/common/grant_table.c | 6 ++++++ xen/common/kimage.c | 6 ------ xen/common/memory.c | 6 ++++++ xen/common/page_alloc.c | 6 ++++++ xen/common/tmem.c | 2 +- xen/common/tmem_xen.c | 4 ---- xen/common/trace.c | 6 ++++++ xen/common/vmap.c | 9 +++++---- xen/common/xenoprof.c | 2 -- xen/drivers/passthrough/amd/iommu_map.c | 6 ++++++ xen/drivers/passthrough/iommu.c | 2 +- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-arm/mm.h | 16 +++++++++------- xen/include/asm-arm/p2m.h | 4 ++-- xen/include/asm-x86/mm.h | 12 ++++++------ xen/include/asm-x86/p2m.h | 2 +- xen/include/asm-x86/page.h | 32 ++++++++++++++++---------------- xen/include/xen/domain_page.h | 8 ++++---- xen/include/xen/tmem_xen.h | 2 +- 65 files changed, 166 insertions(+), 239 deletions(-)xen/arch/arm/domain_build.c +0
-2@@ -50,8 +50,6 @@ struct map_range_data/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg))//#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION xen/arch/arm/kernel.c +1
-1@@ -295,7 +295,7 @@ static __init int kernel_decompress(struct bootmodule *mod)iounmap (input);return -ENOMEM ; } - mfn =_mfn (page_to_mfn (pages)); + mfn =page_to_mfn (pages); output =__vmap (&mfn,1 << kernel_order_out,1 ,1 ,PAGE_HYPERVISOR ,VMAP_DEFAULT ); rc =perform_gunzip (output, input, size);xen/arch/arm/mem_access.c +1
-1@@ -210,7 +210,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag,if ( t != p2m_ram_rw ) goto err; - page =mfn_to_page (mfn_x (mfn)); + page =mfn_to_page (mfn);if (unlikely (!get_page (page, v->domain)) ) page =NULL ;xen/arch/arm/mm.c +4
-4@@ -477,7 +477,7 @@ void unmap_domain_page(const void *va)local_irq_restore (flags); } -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;lpae_t *map =this_cpu (xen_dommap);@@ -485,12 +485,12 @@ unsigned long domain_page_map_to_mfn(const void *ptr)unsigned long offset = (va>>THIRD_SHIFT ) &LPAE_ENTRY_MASK ;if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) -return __virt_to_mfn (va); +return virt_to_mfn (va);ASSERT (slot >=0 && slot <DOMHEAP_ENTRIES );ASSERT (map[slot].pt.avail !=0 ); - return map[slot].pt.base + offset; + return _mfn(map[slot].pt.base + offset); }#endif @@ -1288,7 +1288,7 @@ int xenmem_add_to_physmap_one(return -EINVAL ; } - mfn =_mfn (page_to_mfn (page)); + mfn =page_to_mfn (page); t = p2m_map_foreign;rcu_unlock_domain (od);xen/arch/arm/p2m.c +2
-8@@ -38,12 +38,6 @@ static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;#define P2M_ROOT_PAGES (1<<P2M_ROOT_ORDER) -/* Override macros from asm/mm.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -unsigned int __read_mostly p2m_ipa_bits;/* Helpers to lookup the properties of each level */ @@ -97,8 +91,8 @@ void dump_p2m_lookup(struct domain *d, paddr_t addr)printk ("dom%d IPA 0x%" PRIpaddr"\n" , d->domain_id, addr); -printk ("P2M @ %p mfn:0x%lx\n" , - p2m->root,__page_to_mfn (p2m->root)); +printk ("P2M @ %p mfn:%#" PRI_mfn"\n" , + p2m->root,mfn_x (page_to_mfn (p2m->root)));dump_pt_walk (page_to_maddr (p2m->root), addr,P2M_ROOT_LEVEL ,P2M_ROOT_PAGES );xen/arch/x86/cpu/vpmu.c +2
-2@@ -653,7 +653,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params) {struct vcpu *v;struct vpmu_struct *vpmu; -uint64_t mfn; +mfn_t mfn;void *xenpmu_data;if ( (params->vcpu >= d->max_vcpus) || (d->vcpu[params->vcpu] ==NULL ) )@@ -675,7 +675,7 @@ static void pvpmu_finish(struct domain *d, xen_pmu_params_t *params)if ( xenpmu_data ) { mfn =domain_page_map_to_mfn (xenpmu_data); -ASSERT (mfn_valid (_mfn (mfn))); +ASSERT (mfn_valid (mfn));unmap_domain_page_global (xenpmu_data);put_page_and_type (mfn_to_page (mfn)); }xen/arch/x86/domain.c +11
-10@@ -186,7 +186,7 @@ void dump_pageframe_info(struct domain *d) } }printk (" DomPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);@@ -199,7 +199,7 @@ void dump_pageframe_info(struct domain *d) page_list_for_each ( page, &d->xenpage_list ) {printk (" XenPage %p: caf=%08lx, taf=%" PRtype_info"\n" , -_p (page_to_mfn (page)), +_p (mfn_x (page_to_mfn (page))), page->count_info, page->u.inuse.type_info); }spin_unlock (&d->page_alloc_lock);@@ -621,7 +621,8 @@ int arch_domain_soft_reset(struct domain *d)struct page_info *page =virt_to_page (d->shared_info), *new_page;int ret =0 ;struct domain *owner; -unsigned long mfn, gfn; +mfn_t mfn; +unsigned long gfn;p2m_type_t p2mt;unsigned int i;@@ -655,7 +656,7 @@ int arch_domain_soft_reset(struct domain *d)ASSERT ( owner == d ); mfn =page_to_mfn (page); - gfn =mfn_to_gmfn (d, mfn); + gfn =mfn_to_gmfn (d,mfn_x (mfn));/* * gfn == INVALID_GFN indicates that the shared_info page was never mapped @@ -664,7 +665,7 @@ int arch_domain_soft_reset(struct domain *d)if ( gfn ==gfn_x (INVALID_GFN ) ) goto exit_put_page; -if (mfn_x (get_gfn_query (d, gfn, &p2mt)) != mfn ) +if ( !mfn_eq (get_gfn_query (d, gfn, &p2mt), mfn) ) {printk (XENLOG_G_ERR "Failed to get Dom%d's shared_info GFN (%lx)\n" , d->domain_id, gfn);@@ -681,7 +682,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_remove_page (d,_gfn (gfn),_mfn (mfn),PAGE_ORDER_4K ); + ret =guest_physmap_remove_page (d,_gfn (gfn), mfn,PAGE_ORDER_4K );if ( ret ) { printk(XENLOG_G_ERR "Failed to remove Dom%d's shared_info frame %lx\n",@@ -690,7 +691,7 @@ int arch_domain_soft_reset(struct domain *d) goto exit_put_gfn; } - ret =guest_physmap_add_page (d,_gfn (gfn),_mfn (page_to_mfn (new_page)), + ret =guest_physmap_add_page (d,_gfn (gfn),page_to_mfn (new_page),PAGE_ORDER_4K );if ( ret ) {@@ -988,7 +989,7 @@ int arch_set_info_guest( {if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l4_page_table ) - done = !fill_ro_mpt (_mfn (page_to_mfn (page))); + done = !fill_ro_mpt (page_to_mfn (page));page_unlock (page); }@@ -1115,7 +1116,7 @@ int arch_set_info_guest(l4_pgentry_t *l4tab; l4tab =map_domain_page (pagetable_get_mfn (v->arch.guest_table)); - *l4tab =l4e_from_pfn (page_to_mfn (cr3_page), + *l4tab =l4e_from_mfn (page_to_mfn (cr3_page), _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);unmap_domain_page (l4tab); }@@ -1945,7 +1946,7 @@ int domain_relinquish_resources(struct domain *d)if ( d->arch.pirq_eoi_map !=NULL ) {unmap_domain_page_global (d->arch.pirq_eoi_map); -put_page_and_type (mfn_to_page (d->arch.pirq_eoi_map_mfn)); +put_page_and_type (mfn_to_page (_mfn (d->arch.pirq_eoi_map_mfn))); d->arch.pirq_eoi_map =NULL ; d->arch.auto_unmask =0 ; }xen/arch/x86/domain_page.c +3
-3@@ -331,13 +331,13 @@ void unmap_domain_page_global(const void *ptr) }/* Translate a map-domain-page'd address to the underlying MFN */ -unsigned long domain_page_map_to_mfn (const void *ptr) +mfn_t domain_page_map_to_mfn (const void *ptr) {unsigned long va = (unsigned long )ptr;const l1_pgentry_t *pl1e;if ( va >=DIRECTMAP_VIRT_START ) -return virt_to_mfn (ptr); +return _mfn (virt_to_mfn (ptr));if ( va >=VMAP_VIRT_START && va <VMAP_VIRT_END ) {@@ -350,5 +350,5 @@ unsigned long domain_page_map_to_mfn(const void *ptr) pl1e = &__linear_l1_table[l1_linear_offset (va)]; } -return l1e_get_pfn (*pl1e); +return l1e_get_mfn (*pl1e); }xen/arch/x86/domctl.c +1
-1@@ -429,7 +429,7 @@ long arch_do_domctl( {if ( i >= max_pfns )break ; - mfn =page_to_mfn (page); + mfn =mfn_x (page_to_mfn (page));if (copy_to_guest_offset (domctl->u.getmemlist.buffer, i, &mfn,1 ) ) {xen/arch/x86/hvm/dm.c +1
-1@@ -219,7 +219,7 @@ static int modified_memory(struct domain *d, page =get_page_from_gfn (d, pfn,NULL ,P2M_UNSHARE );if ( page ) { -mfn_t gmfn =_mfn (page_to_mfn (page)); +mfn_t gmfn =page_to_mfn (page);paging_mark_dirty (d, gmfn);/* xen/arch/x86/hvm/dom0_build.c +3
-3@@ -120,7 +120,7 @@ static int __init pvh_populate_memory_range(struct domain *d,continue ; } - rc =guest_physmap_add_page (d,_gfn (start),_mfn (page_to_mfn (page)), + rc =guest_physmap_add_page (d,_gfn (start),page_to_mfn (page), order);if ( rc !=0 ) {@@ -270,7 +270,7 @@ static int __init pvh_setup_vmx_realmode_helpers(struct domain *d) }write_32bit_pse_identmap (ident_pt);unmap_domain_page (ident_pt); -put_page (mfn_to_page (mfn_x (mfn))); +put_page (mfn_to_page (mfn)); d->arch.hvm_domain.params[HVM_PARAM_IDENT_PT ] = gaddr;if (pvh_add_mem_range (d, gaddr, gaddr +PAGE_SIZE ,E820_RESERVED ) )printk ("Unable to set identity page tables as reserved in the memory map\n" );@@ -288,7 +288,7 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start,for ( mfn = start; mfn < start + nr_pages; mfn++ ) { -struct page_info *pg =mfn_to_page (mfn); +struct page_info *pg =mfn_to_page (_mfn (mfn));int rc; rc =unshare_xen_page_with_guest (pg, dom_io);xen/arch/x86/hvm/emulate.c +3
-3@@ -590,7 +590,7 @@ static void *hvmemul_map_linear_addr( goto unhandleable; } - *mfn++ =_mfn (page_to_mfn (page)); + *mfn++ =page_to_mfn (page);if (p2m_is_discard_write (p2mt) ) {@@ -622,7 +622,7 @@ static void *hvmemul_map_linear_addr( out:/* Drop all held references. */ while ( mfn-- > hvmemul_ctxt->mfn ) -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn));return err; }@@ -648,7 +648,7 @@ static void hvmemul_unmap_linear_addr( {ASSERT (mfn_valid (*mfn));paging_mark_dirty (currd, *mfn); -put_page (mfn_to_page (mfn_x (*mfn))); +put_page (mfn_to_page (*mfn)); *mfn++ =_mfn (0 );/* Clean slot for map()'s error checking. */ }xen/arch/x86/hvm/hvm.c +8
-8@@ -2211,7 +2211,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer) v->arch.guest_table =pagetable_from_page (page);HVM_DBG_LOG (DBG_LEVEL_VMMU ,"Update CR3 value = %lx, mfn = %lx" , - v->arch.hvm_vcpu.guest_cr[3 ],page_to_mfn (page)); + v->arch.hvm_vcpu.guest_cr[3 ],mfn_x (page_to_mfn (page))); } }else if ( !(value &X86_CR0_PG ) && (old_value &X86_CR0_PG ) )@@ -2546,7 +2546,7 @@ static void *_hvm_map_guest_frame(unsigned long gfn, bool_t permanent,if (unlikely (p2m_is_discard_write (p2mt)) ) *writable =0 ;else if ( !permanent ) -paging_mark_dirty (d,_mfn (page_to_mfn (page))); +paging_mark_dirty (d,page_to_mfn (page)); }if ( !permanent )@@ -2588,7 +2588,7 @@ void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent)void hvm_unmap_guest_frame (void *p,bool_t permanent) { -unsigned long mfn; +mfn_t mfn;struct page_info *page;if ( !p )@@ -2609,7 +2609,7 @@ void hvm_unmap_guest_frame(void *p, bool_t permanent)list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list)if ( track->page == page ) { -paging_mark_dirty (d,_mfn (mfn)); +paging_mark_dirty (d, mfn);list_del (&track->list);xfree (track);break ;@@ -2626,7 +2626,7 @@ void hvm_mapped_guest_frames_mark_dirty(struct domain *d)spin_lock (&d->arch.hvm_domain.write_map.lock);list_for_each_entry (track, &d->arch.hvm_domain.write_map.list, list) -paging_mark_dirty (d,_mfn (page_to_mfn (track->page))); +paging_mark_dirty (d,page_to_mfn (track->page));spin_unlock (&d->arch.hvm_domain.write_map.lock); }@@ -3200,8 +3200,8 @@ static enum hvm_translation_result __hvm_copy(if (xchg (&lastpage,gfn_x (gfn)) !=gfn_x (gfn) )dprintk (XENLOG_G_DEBUG , -"%pv attempted write to read-only gfn %#lx (mfn=%#lx)\n" , - v,gfn_x (gfn),page_to_mfn (page)); +"%pv attempted write to read-only gfn %#lx (mfn=%#" PRI_mfn")\n" , + v,gfn_x (gfn),mfn_x (page_to_mfn (page))); }else {@@ -3209,7 +3209,7 @@ static enum hvm_translation_result __hvm_copy(memcpy (p, buf, count); else memset(p, 0, count); -paging_mark_dirty (v->domain,_mfn (page_to_mfn (page))); +paging_mark_dirty (v->domain,page_to_mfn (page)); } }else xen/arch/x86/hvm/ioreq.c +3
-3@@ -268,7 +268,7 @@ static void hvm_remove_ioreq_gfn( struct domain *d, struct hvm_ioreq_page *iorp) { if ( guest_physmap_remove_page(d, _gfn(iorp->gfn), - _mfn(page_to_mfn(iorp->page)), 0) ) + page_to_mfn(iorp->page), 0) ) domain_crash(d); clear_page(iorp->va); }@@ -281,9 +281,9 @@ static int hvm_add_ioreq_gfn(clear_page (iorp->va); rc =guest_physmap_add_page (d,_gfn (iorp->gfn), -_mfn (page_to_mfn (iorp->page)),0 ); +page_to_mfn (iorp->page),0 );if ( rc ==0 ) -paging_mark_dirty (d,_mfn (page_to_mfn (iorp->page))); +paging_mark_dirty (d,page_to_mfn (iorp->page));return rc; }xen/arch/x86/hvm/stdvga.c +1
-1@@ -590,7 +590,7 @@ void stdvga_init(struct domain *d)if ( pg ==NULL )break ; s->vram_page[i] = pg; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); }if ( i ==ARRAY_SIZE (s->vram_page) )xen/arch/x86/hvm/svm/svm.c +2
-2@@ -1521,7 +1521,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_hsa =page_to_maddr (pg); }@@ -1531,7 +1531,7 @@ static int svm_cpu_up_prepare(unsigned int cpu)if ( !pg ) goto err; -clear_domain_page (_mfn (page_to_mfn (pg))); +clear_domain_page (page_to_mfn (pg)); *this_vmcb =page_to_maddr (pg); }xen/arch/x86/hvm/viridian.c +3
-3@@ -354,7 +354,7 @@ static void enable_hypercall_page(struct domain *d)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ; }@@ -414,7 +414,7 @@ static void initialize_vp_assist(struct vcpu *v) fail:gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , gmfn, - page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); +mfn_x (page ?page_to_mfn (page) :INVALID_MFN )); }static void teardown_vp_assist (struct vcpu *v)@@ -494,7 +494,7 @@ static void update_reference_tsc(struct domain *d, bool_t initialize)if ( page )put_page (page);gdprintk (XENLOG_WARNING ,"Bad GMFN %#" PRI_gfn" (MFN %#" PRI_mfn")\n" , - gmfn, page ?page_to_mfn (page) :mfn_x (INVALID_MFN )); + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ));return ; }xen/arch/x86/hvm/vmx/vmcs.c +1
-1@@ -1437,7 +1437,7 @@ int vmx_vcpu_enable_pml(struct vcpu *v)vmx_vmcs_enter (v); -__vmwrite (PML_ADDRESS ,page_to_mfn (v->arch.hvm_vmx.pml_pg) <<PAGE_SHIFT ); +__vmwrite (PML_ADDRESS ,page_to_maddr (v->arch.hvm_vmx.pml_pg));__vmwrite (GUEST_PML_INDEX ,NR_PML_ENTRIES -1 ); v->arch.hvm_vmx.secondary_exec_control |=SECONDARY_EXEC_ENABLE_PML ;xen/arch/x86/hvm/vmx/vmx.c +5
-5@@ -2978,7 +2978,7 @@ gp_fault:static int vmx_alloc_vlapic_mapping (struct domain *d) {struct page_info *pg; -unsigned long mfn; +mfn_t mfn;if ( !cpu_has_vmx_virtualize_apic_accesses )return 0 ;@@ -2987,10 +2987,10 @@ static int vmx_alloc_vlapic_mapping(struct domain *d)if ( !pg )return -ENOMEM ; mfn =page_to_mfn (pg); -clear_domain_page (_mfn (mfn)); +clear_domain_page (mfn);share_xen_page_with_guest (pg, d, XENSHARE_writable); - d->arch.hvm_domain.vmx.apic_access_mfn = mfn; -set_mmio_p2m_entry (d,paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ),_mfn (mfn), + d->arch.hvm_domain.vmx.apic_access_mfn =mfn_x (mfn); +set_mmio_p2m_entry (d,paddr_to_pfn (APIC_DEFAULT_PHYS_BASE ), mfn,PAGE_ORDER_4K ,p2m_get_hostp2m (d)->default_access);return 0 ;@@ -3001,7 +3001,7 @@ static void vmx_free_vlapic_mapping(struct domain *d)unsigned long mfn = d->arch.hvm_domain.vmx.apic_access_mfn;if ( mfn !=0 ) -free_shared_domheap_page (mfn_to_page (mfn)); +free_shared_domheap_page (mfn_to_page (_mfn (mfn))); }static void vmx_install_vlapic_mapping (struct vcpu *v)xen/arch/x86/hvm/vmx/vvmx.c +3
-3@@ -84,7 +84,7 @@ int nvmx_vcpu_initialise(struct vcpu *v) } v->arch.hvm_vmx.vmread_bitmap = vmread_bitmap; -clear_domain_page (_mfn (page_to_mfn (vmread_bitmap))); +clear_domain_page (page_to_mfn (vmread_bitmap)); vmwrite_bitmap =alloc_domheap_page (NULL ,0 );if ( !vmwrite_bitmap )@@ -1729,7 +1729,7 @@ int nvmx_handle_vmptrld(struct cpu_user_regs *regs) nvcpu->nv_vvmcx = vvmcx; nvcpu->nv_vvmcxaddr = gpa; v->arch.hvm_vmx.vmcs_shadow_maddr = -pfn_to_paddr (domain_page_map_to_mfn (vvmcx)); +mfn_to_maddr (domain_page_map_to_mfn (vvmcx)); }else {@@ -1815,7 +1815,7 @@ int nvmx_handle_vmclear(struct cpu_user_regs *regs) {if ( writable )clear_vvmcs_launched (&nvmx->launched_list, -domain_page_map_to_mfn (vvmcs)); +mfn_x (domain_page_map_to_mfn (vvmcs)));else rc =VMFAIL_VALID ;hvm_unmap_guest_frame (vvmcs,0 );xen/arch/x86/mm.c +0
-6@@ -128,12 +128,6 @@#include "pv/mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* Mapping of the fixmap space needed early. */ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) l1_fixmap[L1_PAGETABLE_ENTRIES ];xen/arch/x86/mm/guest_walk.c +3
-3@@ -469,20 +469,20 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,if ( l3p ) {unmap_domain_page (l3p); -put_page (mfn_to_page (mfn_x (gw->l3mfn))); +put_page (mfn_to_page (gw->l3mfn)); }#endif #if GUEST_PAGING_LEVELS >=3 if ( l2p ) {unmap_domain_page (l2p); -put_page (mfn_to_page (mfn_x (gw->l2mfn))); +put_page (mfn_to_page (gw->l2mfn)); }#endif if ( l1p ) {unmap_domain_page (l1p); -put_page (mfn_to_page (mfn_x (gw->l1mfn))); +put_page (mfn_to_page (gw->l1mfn)); }return walk_ok;xen/arch/x86/mm/hap/guest_walk.c +1
-1@@ -83,7 +83,7 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)( *pfec &= ~PFEC_page_present; goto out_tweak_pfec; } - top_mfn =_mfn (page_to_mfn (top_page)); + top_mfn =page_to_mfn (top_page);/* Map the top-level table and call the tree-walker */ ASSERT (mfn_valid (top_mfn));xen/arch/x86/mm/hap/hap.c +0
-6@@ -42,12 +42,6 @@#include "private.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* HAP VRAM TRACKING SUPPORT */ /************************************************/ xen/arch/x86/mm/hap/nested_ept.c +1
-1@@ -173,7 +173,7 @@ nept_walk_tables(struct vcpu *v, unsigned long l2ga, ept_walk_t *gw) goto map_err; gw->lxe[lvl] = lxp[ept_lvl_table_offset (l2ga, lvl)];unmap_domain_page (lxp); -put_page (mfn_to_page (mfn_x (lxmfn))); +put_page (mfn_to_page (lxmfn));if (nept_non_present_check (gw->lxe[lvl]) ) goto non_present;xen/arch/x86/mm/mem_sharing.c +0
-5@@ -152,11 +152,6 @@ static inline shr_handle_t get_next_handle(void)#define mem_sharing_enabled (d) \ (is_hvm_domain(d) && (d)->arch.hvm_domain.mem_sharing_enabled) -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -static atomic_t nr_saved_mfns =ATOMIC_INIT (0 );static atomic_t nr_shared_mfns =ATOMIC_INIT (0 );xen/arch/x86/mm/p2m-ept.c +4
-0@@ -33,6 +33,10 @@#include "mm-locks.h" +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +#define atomic_read_ept_entry (__pepte) \ ( (ept_entry_t) { .epte = read_atomic(&(__pepte)->epte) } )xen/arch/x86/mm/p2m-pod.c +0
-6@@ -29,12 +29,6 @@#include "mm-locks.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -#define superpage_aligned (_x) (((_x)&(SUPERPAGE_PAGES-1))==0)/* Enforce lock ordering when grabbing the "external" page_alloc lock */ xen/arch/x86/mm/p2m.c +0
-6@@ -47,12 +47,6 @@ bool_t __initdata opt_hap_1gb = 1, __initdata opt_hap_2mb = 1;boolean_param ("hap_1gb" , opt_hap_1gb);boolean_param ("hap_2mb" , opt_hap_2mb); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -DEFINE_PERCPU_RWLOCK_GLOBAL (p2m_percpu_rwlock);/* Init the datastructures for later use by the p2m code */ xen/arch/x86/mm/paging.c +0
-6@@ -47,12 +47,6 @@/* Per-CPU variable for enforcing the lock ordering */ DEFINE_PER_CPU (int, mm_lock_level); -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) -/************************************************/ /* LOG DIRTY SUPPORT */ /************************************************/ xen/arch/x86/mm/shadow/private.h +2
-14@@ -315,7 +315,7 @@ static inline int page_is_out_of_sync(struct page_info *p)static inline int mfn_is_out_of_sync (mfn_t gmfn) { -return page_is_out_of_sync (mfn_to_page (mfn_x (gmfn))); +return page_is_out_of_sync (mfn_to_page (gmfn)); }static inline int page_oos_may_write (struct page_info *p)@@ -326,7 +326,7 @@ static inline int page_oos_may_write(struct page_info *p)static inline int mfn_oos_may_write (mfn_t gmfn) { -return page_oos_may_write (mfn_to_page (mfn_x (gmfn))); +return page_oos_may_write (mfn_to_page (gmfn)); }#endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */ @@ -465,18 +465,6 @@ void sh_reset_l3_up_pointers(struct vcpu *v);* MFN/page-info handling */ -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (_m) __mfn_to_page(mfn_x(_m)) -#undef page_to_mfn -#define page_to_mfn (_pg) _mfn(__page_to_mfn(_pg)) - -/* Override pagetable_t <-> struct page_info conversions to work with mfn_t */ -#undef pagetable_get_page -#define pagetable_get_page (x) mfn_to_page(pagetable_get_mfn(x)) -#undef pagetable_from_page -#define pagetable_from_page (pg) pagetable_from_mfn(page_to_mfn(pg)) -#define backpointer (sp) _mfn(pdx_to_pfn((unsigned long)(sp)->v.sh.back))static inline unsigned long __backpointer (const struct page_info *sp) {xen/arch/x86/numa.c +1
-1@@ -430,7 +430,7 @@ static void dump_numa(unsigned char key)spin_lock (&d->page_alloc_lock);page_list_for_each (page, &d->page_list) { - i =phys_to_nid ((paddr_t )page_to_mfn (page) <<PAGE_SHIFT ); + i =phys_to_nid (page_to_maddr (page)); page_num_node[i]++; }spin_unlock (&d->page_alloc_lock);xen/arch/x86/physdev.c +1
-1@@ -242,7 +242,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) }if (cmpxchg (&currd->arch.pirq_eoi_map_mfn, -0 ,page_to_mfn (page)) !=0 ) +0 ,mfn_x (page_to_mfn (page))) !=0 ) {put_page_and_type (page); ret = -EBUSY ;xen/arch/x86/pv/callback.c +0
-6@@ -31,12 +31,6 @@#include <public/callback.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static int register_guest_nmi_callback (unsigned long address) {struct vcpu *curr = current;xen/arch/x86/pv/descriptor-tables.c +0
-10@@ -25,16 +25,6 @@#include <asm/p2m.h> #include <asm/pv/mm.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/******************* -* Descriptor Tables -*/ -void pv_destroy_gdt (struct vcpu *v) {l1_pgentry_t *pl1e;xen/arch/x86/pv/dom0_build.c +6
-0@@ -20,6 +20,12 @@#include <asm/page.h> #include <asm/setup.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Allow ring-3 access in long mode as guest cannot use ring 1 ... */ #define BASE_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)#define L1_PROT (BASE_PROT|_PAGE_GUEST_KERNEL)xen/arch/x86/pv/domain.c +0
-6@@ -11,12 +11,6 @@#include <asm/pv/domain.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static void noreturncontinue_nonidle_domain (struct vcpu *v) {check_wakeup_from_wait ();xen/arch/x86/pv/emul-gate-op.c +0
-6@@ -41,12 +41,6 @@#include "emulate.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - static int read_gate_descriptor(unsigned int gate_sel, const struct vcpu *v, unsigned int *sel,xen/arch/x86/pv/emul-priv-op.c +0
-10@@ -43,16 +43,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) - -/*********************** -* I/O emulation support -*/ -struct priv_op_ctxt {struct x86_emulate_ctxt ctxt;struct {xen/arch/x86/pv/grant_table.c +0
-6@@ -27,12 +27,6 @@#include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -static unsigned int grant_to_pte_flags (unsigned int grant_flags,unsigned int cache_flags) {xen/arch/x86/pv/ro-page-fault.c +0
-6@@ -33,12 +33,6 @@#include "emulate.h" #include "mm.h" -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/********************* * Writable Pagetables */ xen/arch/x86/smpboot.c +0
-6@@ -46,12 +46,6 @@#include <mach_wakecpu.h> #include <smpboot_hooks.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -#define setup_trampoline () (bootsym_phys(trampoline_realmode_entry))unsigned long __read_mostly trampoline_phys;xen/arch/x86/tboot.c +2
-2@@ -184,7 +184,7 @@ static void update_pagetable_mac(vmac_ctx_t *ctx)for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue ;@@ -276,7 +276,7 @@ static void tboot_gen_xenheap_integrity(const uint8_t key[TB_KEY_SIZE],vmac_set_key ((uint8_t *)key, &ctx);for ( mfn =0 ; mfn < max_page; mfn++ ) { -struct page_info *page =__mfn_to_page (mfn); +struct page_info *page =mfn_to_page (_mfn (mfn));if ( !mfn_valid (_mfn (mfn)) )continue ;xen/arch/x86/traps.c +2
-2@@ -810,8 +810,8 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) }gdprintk (XENLOG_WARNING , -"Bad GMFN %lx (MFN %lx) to MSR %08x\n" , - gmfn, page ?page_to_mfn (page) :-1UL , base); +"Bad GMFN %lx (MFN %#" PRI_mfn") to MSR %08x\n" , + gmfn,mfn_x (page ?page_to_mfn (page) :INVALID_MFN ), base);return 0 ; }xen/arch/x86/x86_64/mm.c +6
-0@@ -40,6 +40,12 @@ asm(".file \"" __FILE__ "\"");#include <asm/mem_sharing.h> #include <public/memory.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +unsigned int __read_mostly m2p_compat_vstart = __HYPERVISOR_COMPAT_VIRT_START;l2_pgentry_t *compat_idle_pg_table_l2;xen/common/domain.c +2
-2@@ -1192,7 +1192,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) } v->vcpu_info = new_info; - v->vcpu_info_mfn =_mfn (page_to_mfn (page)); + v->vcpu_info_mfn =page_to_mfn (page);/* Set new vcpu_info pointer /before/ setting pending flags. */ smp_wmb ();@@ -1225,7 +1225,7 @@ void unmap_vcpu_info(struct vcpu *v)vcpu_info_reset (v);/* NB: Clobbers v->vcpu_info_mfn */ -put_page_and_type (mfn_to_page (mfn_x (mfn))); +put_page_and_type (mfn_to_page (mfn)); }int default_initialise_vcpu (struct vcpu *v,XEN_GUEST_HANDLE_PARAM (void ) arg)xen/common/grant_table.c +6
-0@@ -40,6 +40,12 @@#include <xsm/xsm.h> #include <asm/flushtlb.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Per-domain grant information. */ struct grant_table {/* xen/common/kimage.c +0
-6@@ -23,12 +23,6 @@#include <asm/page.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn)) -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -/* * When kexec transitions to the new kernel there is a one-to-one * mapping between physical and virtual addresses. On processors xen/common/memory.c +6
-0@@ -29,6 +29,12 @@#include <public/memory.h> #include <xsm/xsm.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +struct memop_args {/* INPUT */ struct domain *domain;/* Domain to be affected. */ xen/common/page_alloc.c +6
-0@@ -150,6 +150,12 @@#define p2m_pod_offline_or_broken_replace (pg) BUG_ON(pg != NULL)#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* * Comma-separated list of hexadecimal page numbers containing bad bytes. * e.g. 'badpage=0x3f45,0x8a321'. xen/common/tmem.c +1
-1@@ -243,7 +243,7 @@ static void tmem_persistent_pool_page_put(void *page_va)struct page_info *pi;ASSERT (IS_PAGE_ALIGNED (page_va)); - pi =mfn_to_page (virt_to_mfn (page_va)); + pi =mfn_to_page (_mfn (virt_to_mfn (page_va)));ASSERT (IS_VALID_PAGE (pi));__tmem_free_page_thispool (pi); }xen/common/tmem_xen.c +0
-4@@ -14,10 +14,6 @@#include <xen/cpu.h> #include <xen/init.h> -/* Override macros from asm/page.h to make them work with mfn_t */ -#undef page_to_mfn -#define page_to_mfn (pg) _mfn(__page_to_mfn(pg)) -bool __read_mostly opt_tmem;boolean_param ("tmem" , opt_tmem);xen/common/trace.c +6
-0@@ -42,6 +42,12 @@ CHECK_t_buf;#define compat_t_rec t_rec#endif +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* opt_tbuf_size: trace buffer size (in pages) for each cpu */ static unsigned int opt_tbuf_size;static unsigned int opt_tevt_mask;xen/common/vmap.c +5
-4@@ -36,7 +36,7 @@ void __init vm_init_type(enum vmap_region type, void *start, void *end) {struct page_info *pg =alloc_domheap_page (NULL ,0 ); -map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ); +map_pages_to_xen (va,mfn_x (page_to_mfn (pg)),1 ,PAGE_HYPERVISOR );clear_page ((void *)va); }bitmap_fill (vm_bitmap (type), vm_low[type]);@@ -107,7 +107,8 @@ static void *vm_alloc(unsigned int nr, unsigned int align, {unsigned long va = (unsigned long )vm_bitmap (t) + vm_top[t] /8 ; -if ( !map_pages_to_xen (va,page_to_mfn (pg),1 ,PAGE_HYPERVISOR ) ) +if ( !map_pages_to_xen (va,mfn_x (page_to_mfn (pg)), +1 ,PAGE_HYPERVISOR ) ) {clear_page ((void *)va); vm_top[t] +=PAGE_SIZE *8 ;@@ -258,7 +259,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) pg =alloc_domheap_page (NULL ,0 );if ( pg ==NULL ) goto error; - mfn[i] =_mfn (page_to_mfn (pg)); + mfn[i] =page_to_mfn (pg); } va =__vmap (mfn,1 , pages,1 ,PAGE_HYPERVISOR , type);@@ -270,7 +271,7 @@ static void *vmalloc_type(size_t size, enum vmap_region type) error:while ( i-- ) -free_domheap_page (mfn_to_page (mfn_x (mfn[i]))); +free_domheap_page (mfn_to_page (mfn[i]));xfree (mfn);return NULL ; }xen/common/xenoprof.c +0
-2@@ -22,8 +22,6 @@/* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn#define virt_to_mfn (va) _mfn(__virt_to_mfn(va)) -#undef mfn_to_page -#define mfn_to_page (mfn) __mfn_to_page(mfn_x(mfn))/* Limit amount of pages used for shared buffer (per domain) */ #define MAX_OPROF_SHARED_PAGES 32xen/drivers/passthrough/amd/iommu_map.c +6
-0@@ -25,6 +25,12 @@#include "../ats.h" #include <xen/pci.h> +/* Override macros from asm/page.h to avoid using typesafe mfn_t. */ +#undef page_to_mfn +#define page_to_mfn (pg) mfn_x(__page_to_mfn(pg)) +#undef mfn_to_page +#define mfn_to_page (mfn) __mfn_to_page(_mfn(mfn)) +/* Given pfn and page table level, return pde index */ static unsigned int pfn_to_pde_idx (unsigned long pfn,unsigned int level) {xen/drivers/passthrough/iommu.c +1
-1@@ -184,7 +184,7 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) page_list_for_each ( page, &d->page_list ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);unsigned int mapping = IOMMUF_readable;int ret;xen/drivers/passthrough/x86/iommu.c +1
-1@@ -58,7 +58,7 @@ int arch_iommu_populate_page_table(struct domain *d)if (is_hvm_domain (d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) { -unsigned long mfn =page_to_mfn (page); +unsigned long mfn =mfn_x (page_to_mfn (page));unsigned long gfn =mfn_to_gmfn (d, mfn);if ( gfn !=gfn_x (INVALID_GFN ) )xen/include/asm-arm/mm.h +9
-7@@ -138,7 +138,7 @@ extern vaddr_t xenheap_virt_start;#endif #ifdef CONFIG_ARM_32 -#define is_xen_heap_page (page) is_xen_heap_mfn(page_to_mfn(page)) +#define is_xen_heap_page (page) is_xen_heap_mfn(mfn_x(__page_to_mfn(page)))#define is_xen_heap_mfn (mfn) ({ \ unsigned long mfn_ = (mfn); \ (mfn_ >= mfn_x(xenheap_mfn_start) && \@@ -220,12 +220,14 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len) })/* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + (pfn_to_pdx(mfn) - frametable_base_pdx)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx) +#define __mfn_to_page (mfn) \ + (frame_table + (pfn_to_pdx(mfn_x(mfn)) - frametable_base_pdx)) +#define __page_to_mfn (pg) \ + _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table) + frametable_base_pdx))/* Convert between machine addresses and page-info structures. */ -#define maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)@@ -235,7 +237,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)#define gaddr_to_gfn (ga) _gfn(paddr_to_pfn(ga))#define mfn_to_maddr (mfn) pfn_to_paddr(mfn_x(mfn))#define maddr_to_mfn (ma) _mfn(paddr_to_pfn(ma)) -#define vmap_to_mfn (va) paddr_to_pfn(virt_to_maddr((vaddr_t)va)) +#define vmap_to_mfn (va) maddr_to_mfn(virt_to_maddr((vaddr_t)va))#define vmap_to_page (va) mfn_to_page(vmap_to_mfn(va))/* Page-align address and convert to frame number format */ @@ -309,7 +311,7 @@ static inline struct page_info *virt_to_page(const void *v)static inline void *page_to_virt (const struct page_info *pg) { -return mfn_to_virt (page_to_mfn (pg)); +return mfn_to_virt (mfn_x (__page_to_mfn (pg))); } struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va,xen/include/asm-arm/p2m.h +2
-2@@ -276,7 +276,7 @@ static inline struct page_info *get_page_from_gfn( {struct page_info *page;p2m_type_t p2mt; -unsigned long mfn =mfn_x (p2m_lookup (d,_gfn (gfn), &p2mt)); +mfn_t mfn =p2m_lookup (d,_gfn (gfn), &p2mt);if (t) *t = p2mt;@@ -284,7 +284,7 @@ static inline struct page_info *get_page_from_gfn(if ( !p2m_is_any_ram (p2mt) )return NULL ; -if ( !mfn_valid (_mfn (mfn)) ) +if ( !mfn_valid (mfn) )return NULL ; page =mfn_to_page (mfn);xen/include/asm-x86/mm.h +6
-6@@ -270,7 +270,7 @@ struct page_info#define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ - (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn))) + (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(_mfn(mfn))))#define is_xen_fixed_mfn (mfn) \ ((((mfn) << PAGE_SHIFT) >= __pa(&_stext)) && \ (((mfn) << PAGE_SHIFT) <= __pa(&__2M_rwdata_end)))@@ -383,7 +383,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner);static inline bool get_page_from_mfn (mfn_t mfn,struct domain *d) { -struct page_info *page =__mfn_to_page (mfn_x (mfn)); +struct page_info *page =__mfn_to_page (mfn);if (unlikely (!mfn_valid (mfn)) ||unlikely (!get_page (page, d)) ) {@@ -477,10 +477,10 @@ extern paddr_t mem_hotplug;#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)); \ - unsigned long entry = (d && (d == dom_cow)) ? \ - SHARED_M2P_ENTRY : (pfn); \ +#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)); \xen/include/asm-x86/p2m.h +1
-1@@ -487,7 +487,7 @@ static inline struct page_info *get_page_from_gfn(/* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */ if ( t ) *t =likely (d != dom_io) ? p2m_ram_rw : p2m_mmio_direct; - page =__mfn_to_page (gfn); + page =__mfn_to_page (_mfn (gfn));return mfn_valid (_mfn (gfn)) &&get_page (page, d) ? page :NULL ; }xen/include/asm-x86/page.h +16
-16@@ -88,10 +88,10 @@ ((paddr_t)(((x).l4 & (PADDR_MASK &PAGE_MASK )))) /* Get pointer to info structure of page mapped by pte (struct page_info *). */ -#define l1e_get_page (x) (__mfn_to_page(l1e_get_pfn(x))) -#define l2e_get_page (x) (__mfn_to_page(l2e_get_pfn(x))) -#define l3e_get_page (x) (__mfn_to_page(l3e_get_pfn(x))) -#define l4e_get_page (x) (__mfn_to_page(l4e_get_pfn(x))) +#define l1e_get_page (x) (__mfn_to_page(l1e_get_mfn(x))) +#define l2e_get_page (x) (__mfn_to_page(l2e_get_mfn(x))) +#define l3e_get_page (x) (__mfn_to_page(l3e_get_mfn(x))) +#define l4e_get_page (x) (__mfn_to_page(l4e_get_mfn(x)))/* Get pte access flags (unsigned int). */ #define l1e_get_flags (x) (get_pte_flags((x).l1))@@ -157,10 +157,10 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)#define l4e_from_intpte (intpte) ((l4_pgentry_t) { (intpte_t)(intpte) })/* Construct a pte from a page pointer and access flags. */ -#define l1e_from_page (page, flags) l1e_from_pfn(__page_to_mfn(page), (flags)) -#define l2e_from_page (page, flags) l2e_from_pfn(__page_to_mfn(page), (flags)) -#define l3e_from_page (page, flags) l3e_from_pfn(__page_to_mfn(page), (flags)) -#define l4e_from_page (page, flags) l4e_from_pfn(__page_to_mfn(page), (flags)) +#define l1e_from_page (page, flags) l1e_from_mfn(__page_to_mfn(page), (flags)) +#define l2e_from_page (page, flags) l2e_from_mfn(__page_to_mfn(page), (flags)) +#define l3e_from_page (page, flags) l3e_from_mfn(__page_to_mfn(page), (flags)) +#define l4e_from_page (page, flags) l4e_from_mfn(__page_to_mfn(page), (flags))/* Add extra flags to an existing pte. */ #define l1e_add_flags (x, flags) ((x).l1 |= put_pte_flags(flags))@@ -215,13 +215,13 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)/* Page-table type. */ typedef struct {u64 pfn; }pagetable_t ;#define pagetable_get_paddr (x) ((paddr_t)(x).pfn << PAGE_SHIFT) -#define pagetable_get_page (x) __mfn_to_page((x).pfn) +#define pagetable_get_page (x) __mfn_to_page(pagetable_get_mfn(x))#define pagetable_get_pfn (x) ((x).pfn)#define pagetable_get_mfn (x) _mfn(((x).pfn))#define pagetable_is_null (x) ((x).pfn == 0)#define pagetable_from_pfn (pfn) ((pagetable_t) { (pfn) })#define pagetable_from_mfn (mfn) ((pagetable_t) { mfn_x(mfn) }) -#define pagetable_from_page (pg) pagetable_from_pfn(__page_to_mfn(pg)) +#define pagetable_from_page (pg) pagetable_from_mfn(__page_to_mfn(pg))#define pagetable_from_paddr (p) pagetable_from_pfn((p)>>PAGE_SHIFT)#define pagetable_null () pagetable_from_pfn(0)@@ -240,12 +240,12 @@ void copy_page_sse2(void *, const void *);#define __mfn_to_virt (mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))/* Convert between machine frame numbers and page-info structures. */ -#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn)) -#define __page_to_mfn (pg) pdx_to_pfn((unsigned long)((pg) - frame_table)) +#define __mfn_to_page (mfn) (frame_table + pfn_to_pdx(mfn_x(mfn))) +#define __page_to_mfn (pg) _mfn(pdx_to_pfn((unsigned long)((pg) - frame_table)))/* Convert between machine addresses and page-info structures. */ -#define __maddr_to_page (ma) __mfn_to_page((ma) >> PAGE_SHIFT) -#define __page_to_maddr (pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT) +#define __maddr_to_page (ma) __mfn_to_page(maddr_to_mfn(ma)) +#define __page_to_maddr (pg) (mfn_to_maddr(__page_to_mfn(pg)))/* Convert between frame number and address formats. */ #define __pfn_to_paddr (pfn) ((paddr_t)(pfn) << PAGE_SHIFT)@@ -273,8 +273,8 @@ void copy_page_sse2(void *, const void *);#define pfn_to_paddr (pfn) __pfn_to_paddr(pfn)#define paddr_to_pfn (pa) __paddr_to_pfn(pa)#define paddr_to_pdx (pa) pfn_to_pdx(paddr_to_pfn(pa)) -#define vmap_to_mfn (va) l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va))) -#define vmap_to_page (va) mfn_to_page(vmap_to_mfn(va)) +#define vmap_to_mfn (va) _mfn(l1e_get_pfn(*virt_to_xen_l1e((unsigned long)(va)))) +#define vmap_to_page (va) __mfn_to_page(vmap_to_mfn(va))#endif /* !defined(__ASSEMBLY__) */ xen/include/xen/domain_page.h +4
-4@@ -34,7 +34,7 @@ void unmap_domain_page(const void *va);/* * Given a VA from map_domain_page(), return its underlying MFN. */ -unsigned long domain_page_map_to_mfn (const void *va); +mfn_t domain_page_map_to_mfn (const void *va);/* * Similar to the above calls, except the mapping is accessible in all @@ -44,11 +44,11 @@ unsigned long domain_page_map_to_mfn(const void *va);void *map_domain_page_global (mfn_t mfn);void unmap_domain_page_global (const void *va); -#define __map_domain_page (pg) map_domain_page(_mfn(__page_to_mfn(pg))) +#define __map_domain_page (pg) map_domain_page(__page_to_mfn(pg))static inline void *__map_domain_page_global (const struct page_info *pg) { -return map_domain_page_global (_mfn (__page_to_mfn (pg))); +return map_domain_page_global (page_to_mfn (pg)); }#else /* !CONFIG_DOMAIN_PAGE */ @@ -56,7 +56,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg)#define map_domain_page (mfn) __mfn_to_virt(mfn_x(mfn))#define __map_domain_page (pg) page_to_virt(pg)#define unmap_domain_page (va) ((void)(va)) -#define domain_page_map_to_mfn (va) virt_to_mfn((unsigned long)(va)) +#define domain_page_map_to_mfn (va) _mfn(virt_to_mfn((unsigned long)(va)))static inline void *map_domain_page_global (mfn_t mfn) {xen/include/xen/tmem_xen.h +1
-1@@ -25,7 +25,7 @@typedef uint32_t pagesize_t ;/* like size_t, must handle largest PAGE_SIZE */ #define IS_PAGE_ALIGNED (addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE) -#define IS_VALID_PAGE (_pi) mfn_valid(_mfn(page_to_mfn(_pi))) +#define IS_VALID_PAGE (_pi) mfn_valid(page_to_mfn(_pi))extern struct page_list_head tmem_page_list;extern spinlock_t tmem_page_list_lock;Signature · 1 line
2.11.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.
I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Jan,
Quoted 15 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
Quoted 5 lines
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
At the end of the discussion in the previous version, you were happy with the modification done here (see [1]).
Overall, I think this is an improvement compare to what we have today. Because we enforce the use of MFN typesafe by default. The developer would have to override the helpers if he wants to to use the non-typesafe version.
With your suggestion here, you would just keep the override around even when they are not necessary. They will have to be dropped at some point, so why not now?
Cheers,
[1] https://lists.xenproject.org/archives/html/xen-devel/2017-10/msg00986.html
Quoted 3 lines
Jan
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 12:47, <[email protected]> wrote:
Hi Jan,
Quoted 15 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
Quoted 8 lines
Quoted 5 lines
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
At the end of the discussion in the previous version, you were happy with the modification done here (see [1]).
From the angle looked at it back then I indeed was, but I'm looking at this from a slightly different angle now with the reply above.
Quoted 8 lines
Overall, I think this is an improvement compare to what we have today. Because we enforce the use of MFN typesafe by default. The developer would have to override the helpers if he wants to to use the non-typesafe version.
With your suggestion here, you would just keep the override around even when they are not necessary. They will have to be dropped at some point, so why not now?
Why would we keep the overrides in place once no longer needed? All I'm asking for is that the double-underscore prefixed macros be left alone, and the non-prefixed versions be converted to be type-safe by default (with the option to override). That'll allow the prefixed variants to go way altogether once all code was switched to typesafe, no longer requiring any overrides.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 40 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 12:47, <[email protected]> wrote:
Hi Jan,
Quoted 15 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
Quoted 8 lines
Quoted 5 lines
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
At the end of the discussion in the previous version, you were happy with the modification done here (see [1]).
From the angle looked at it back then I indeed was, but I'm looking
at this from a slightly different angle now with the reply above.Quoted 8 lines
Overall, I think this is an improvement compare to what we have today. Because we enforce the use of MFN typesafe by default. The developer would have to override the helpers if he wants to to use the non-typesafe version.
With your suggestion here, you would just keep the override around even when they are not necessary. They will have to be dropped at some point, so why not now?
Quoted 6 lines
Why would we keep the overrides in place once no longer needed? All I'm asking for is that the double-underscore prefixed macros be left alone, and the non-prefixed versions be converted to be type-safe by default (with the option to override). That'll allow the prefixed variants to go way altogether once all code was switched to typesafe, no longer requiring any overrides.
If you left the double-underscore alone, then you can't convert headers using them to typesafe. This is because they can't use the non-prefixed version as they may be override.
So what you are suggesting here is will avoid converting those headers until someone step up and finish to convert all the source to MFN typesafe. Personally, I find quite silly to have to delay that...
Cheers,
Quoted 3 lines
Jan
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 51 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 13:16, <[email protected]> wrote:
Quoted 40 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 12:47, <[email protected]> wrote:
Hi Jan,
Quoted 15 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
Quoted 8 lines
Quoted 5 lines
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
At the end of the discussion in the previous version, you were happy with the modification done here (see [1]).
From the angle looked at it back then I indeed was, but I'm looking
at this from a slightly different angle now with the reply above.Quoted 8 lines
Overall, I think this is an improvement compare to what we have today. Because we enforce the use of MFN typesafe by default. The developer would have to override the helpers if he wants to to use the non-typesafe version.
With your suggestion here, you would just keep the override around even when they are not necessary. They will have to be dropped at some point, so why not now?
Quoted 6 lines
Why would we keep the overrides in place once no longer needed? All I'm asking for is that the double-underscore prefixed macros be left alone, and the non-prefixed versions be converted to be type-safe by default (with the option to override). That'll allow the prefixed variants to go way altogether once all code was switched to typesafe, no longer requiring any overrides.
Quoted 7 lines
If you left the double-underscore alone, then you can't convert headers using them to typesafe. This is because they can't use the non-prefixed version as they may be override.
So what you are suggesting here is will avoid converting those headers until someone step up and finish to convert all the source to MFN typesafe. Personally, I find quite silly to have to delay that...
Hmm, I see your point, but if we went the route you suggest, what would be the steps to reach the ultimate result I've described (the prefixed variants gone)? I seems to me that this would require touching a lot of code a second time that is being touched now, or is going to be touched as further conversion happens.
Otoh, considering all the acks you've got already, if I'm the only one thinking that switching the prefixed ones around is the wrong thing, I perhaps shouldn't stand in the way of this patch going in as is.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Jan,
Quoted 59 lines · Jan Beulich
Quoted 51 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 13:16, <[email protected]> wrote:
Quoted 40 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.11.17 at 12:47, <[email protected]> wrote:
Hi Jan,
Quoted 15 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.11.17 at 15:03, <[email protected]> wrote:
Most of the users of
page_to_mfnandmfn_to_pageare either overriding the macros to make them work withmfn_tor use mfn_x/_mfn becaue the rest of the function usemfn_t.So I think it is time to make
__page_to_mfnand__mfn_to_pageusing typesafe MFN.I have to admit that I still find the overall goal confusing: Afaict the double-underscore-prefixed versions exist only to allow easily overriding the non-prefixed ones. Hence the first and foremost goal ought to be to convert everyone to using the non-prefixed versions. Files wanting to avoid the typed forms could then continue to use / be switched to the prefixed ones.
Quoted 8 lines
Quoted 5 lines
What you're doing here is producing a mess: The prefixed versions should never have been touched in the first place. And iirc this was discussed before, with the suggestion to use overrides (for the non-prefixed versions) to limit overall patch size.
At the end of the discussion in the previous version, you were happy with the modification done here (see [1]).
From the angle looked at it back then I indeed was, but I'm looking
at this from a slightly different angle now with the reply above.Quoted 8 lines
Overall, I think this is an improvement compare to what we have today. Because we enforce the use of MFN typesafe by default. The developer would have to override the helpers if he wants to to use the non-typesafe version.
With your suggestion here, you would just keep the override around even when they are not necessary. They will have to be dropped at some point, so why not now?
Quoted 6 lines
Why would we keep the overrides in place once no longer needed? All I'm asking for is that the double-underscore prefixed macros be left alone, and the non-prefixed versions be converted to be type-safe by default (with the option to override). That'll allow the prefixed variants to go way altogether once all code was switched to typesafe, no longer requiring any overrides.
Quoted 7 lines
If you left the double-underscore alone, then you can't convert headers using them to typesafe. This is because they can't use the non-prefixed version as they may be override.
So what you are suggesting here is will avoid converting those headers until someone step up and finish to convert all the source to MFN typesafe. Personally, I find quite silly to have to delay that...
Quoted 6 lines
Hmm, I see your point, but if we went the route you suggest, what would be the steps to reach the ultimate result I've described (the prefixed variants gone)? I seems to me that this would require touching a lot of code a second time that is being touched now, or is going to be touched as further conversion happens.
We would indeed need to modify the headers to use page_to_mfn/mfn_to_page instead of __page_to_mfn/__mfn_to_page. Those headers are:
- asm-arm/mm.h
- xen/domain_page.h
- asm-x86/mm.h
- asm-x86/page.h
- asm-x86/p2m.h
I had a look at the files that needs to convert. It seems there are few files with page_to_mfn/mfn_to_page re-defined but no callers:
- arch/x86/mm/hap/nested_hap.c
- arch/x86/mm/p2m-pt.c
- arch/x86/pv/traps.c
- arch/x86/pv/mm.c
- arch/x86/pv/iret.c
Those can be fixed now. That leave the following files:
- arch/x86/mm/p2m-ept.c
In that file, the override prevents all the caller to use the
construction mfn_to_page(_mfn(...)) as it mostly deals with hardware.
- arch/x86/x86_64/mm.c
This is could be done without too much trouble.
- arch/x86/pv/dom0_build.c
It would need a bit of rework to get the code MFN typesafe in a neat way.
- drivers/passthrough/amd/iommu_map.c
It would need a bit of rework to get the code MFN typesafe in a neat way.
- common/trace.c
I think it should be ok. Though I am bit surprised to see uint32_t
been used for MFN...
- common/memory.c
It would need a bit of rework to get the code MFN typesafe in a neat way.
- common/page_alloc.c
This is could be done without too much trouble.
- common/grant_table.c
It would need a bit of rework to get the code MFN typesafe in a neat way.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:20, <[email protected]> wrote:
I had a look at the files that needs to convert. It seems there are few files with page_to_mfn/mfn_to_page re-defined but no callers:
-arch/x86/mm/hap/nested_hap.c
-arch/x86/mm/p2m-pt.c
-arch/x86/pv/traps.c
-arch/x86/pv/mm.c
-arch/x86/pv/iret.c
Quoted 4 lines
Those can be fixed now. That leave the following files:
-arch/x86/mm/p2m-ept.c
In that file, the override prevents all the caller to use the
construction mfn_to_page(_mfn(...)) as it mostly deals with hardware.
I'm not clear what you're trying to tell me here. The file has a total for four mfn_to_page() uses - if overrides don't help (and perhaps regardless of if they do), I think it wouldn't be very difficult to simply change the four places. And note that plain staging has no override there right now.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi,
Quoted 14 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:20, <[email protected]> wrote:
I had a look at the files that needs to convert. It seems there are few files with page_to_mfn/mfn_to_page re-defined but no callers:
-arch/x86/mm/hap/nested_hap.c
-arch/x86/mm/p2m-pt.c
-arch/x86/pv/traps.c
-arch/x86/pv/mm.c
-arch/x86/pv/iret.cQuoted 4 lines
Those can be fixed now. That leave the following files:
-arch/x86/mm/p2m-ept.c
In that file, the override prevents all the caller to use the
construction mfn_to_page(_mfn(...)) as it mostly deals with hardware.
Quoted 5 lines
I'm not clear what you're trying to tell me here. The file has a total for four
mfn_to_page()uses - if overrides don't help (and perhaps regardless of if they do), I think it wouldn't be very difficult to simply change the four places. And note that plain staging has no override there right now.
Because the plain staging still has page_to_mfn() not using typesafe... You would need to override it even I follow your suggestion.
What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:39, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:20, <[email protected]> wrote:
I had a look at the files that needs to convert. It seems there are few files with page_to_mfn/mfn_to_page re-defined but no callers:
-arch/x86/mm/hap/nested_hap.c
-arch/x86/mm/p2m-pt.c
-arch/x86/pv/traps.c
-arch/x86/pv/mm.c
-arch/x86/pv/iret.cQuoted 4 lines
Those can be fixed now. That leave the following files:
-arch/x86/mm/p2m-ept.c
In that file, the override prevents all the caller to use the
construction mfn_to_page(_mfn(...)) as it mostly deals with hardware.Quoted 5 lines
I'm not clear what you're trying to tell me here. The file has a total for four
mfn_to_page()uses - if overrides don't help (and perhaps regardless of if they do), I think it wouldn't be very difficult to simply change the four places. And note that plain staging has no override there right now.
Quoted 5 lines
Because the plain staging still has
page_to_mfn()not using typesafe... You would need to override it even I follow your suggestion.What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Oh, sure, that's a fine intermediate state, which we have all over the place right now. It's clear that it'll take a while to fully carry through typesafeness to everywhere.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Jan,
Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:39, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:20, <[email protected]> wrote:
I had a look at the files that needs to convert. It seems there are few files with page_to_mfn/mfn_to_page re-defined but no callers:
-arch/x86/mm/hap/nested_hap.c
-arch/x86/mm/p2m-pt.c
-arch/x86/pv/traps.c
-arch/x86/pv/mm.c
-arch/x86/pv/iret.cQuoted 4 lines
Those can be fixed now. That leave the following files:
-arch/x86/mm/p2m-ept.c
In that file, the override prevents all the caller to use the
construction mfn_to_page(_mfn(...)) as it mostly deals with hardware.Quoted 5 lines
I'm not clear what you're trying to tell me here. The file has a total for four
mfn_to_page()uses - if overrides don't help (and perhaps regardless of if they do), I think it wouldn't be very difficult to simply change the four places. And note that plain staging has no override there right now.Because the plain staging still has
page_to_mfn()not using typesafe... You would need to override it even I follow your suggestion.
Quoted 6 lines
Quoted 2 lines
What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Oh, sure, that's a fine intermediate state, which we have all over the place right now. It's clear that it'll take a while to fully carry through typesafeness to everywhere.
Would you be fine with other part of Xen too? If so, I can have a go at removing completely __page_to_mfn/__mfn_to_page.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:48, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:39, <[email protected]> wrote:
What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Quoted 6 lines
Quoted 3 lines
Oh, sure, that's a fine intermediate state, which we have all over the place right now. It's clear that it'll take a while to fully carry through typesafeness to everywhere.
Would you be fine with other part of Xen too? If so, I can have a go at removing completely __page_to_mfn/__mfn_to_page.
Oh, if you want to go that extra mile, that's certainly fine with me.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:48, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:39, <[email protected]> wrote:
What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Oh, sure, that's a fine intermediate state, which we have all over the place right now. It's clear that it'll take a while to fully carry through typesafeness to everywhere.
Would you be fine with other part of Xen too? If so, I can have a go at removing completely __page_to_mfn/__mfn_to_page.
Oh, if you want to go that extra mile, that's certainly fine with me.
FYI I committed the first two patches (which are ARM only). I'll leave to other to commit the other two.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Stefano,
Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:48, <[email protected]> wrote:
Quoted 7 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.11.17 at 16:39, <[email protected]> wrote:
What I meant is you would replace the 4 occurrences by mfn_to_page(_mfn(...)). If you are happy with that, then fine.
Oh, sure, that's a fine intermediate state, which we have all over the place right now. It's clear that it'll take a while to fully carry through typesafeness to everywhere.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Would you be fine with other part of Xen too? If so, I can have a go at removing completely __page_to_mfn/__mfn_to_page.
Oh, if you want to go that extra mile, that's certainly fine with me.
FYI I committed the first two patches (which are ARM only). I'll leave to other to commit the other two.
Thank you! The rest of the series is going to be reworked to fully drop __page_to_mfn/__mfn_to_page. Not sure I will resend it though.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel