Re: [PATCH v4 3/4] xen: Remove mfn_to_gmfn macro

2020-09-23 Thread Stefano Stabellini
On Mon, 21 Sep 2020, Andrew Cooper wrote:
> On 21/09/2020 19:02, Julien Grall wrote:
> > From: Julien Grall 
> >
> > On x86, mfn_to_gmfn can be replaced with mfn_to_gfn. On Arm, there are
> > no more call to mfn_to_gmfn, so the helper can be dropped.
> 
> The previous patch dropped the mfn_to_gmfn() call from the domain shared
> info path, but without a hunk adjusting the innards of
> memory_exchange(), this is going to break the x86 build.
> 
> > At the same time rework a comment in Arm code that does not make sense.
> >
> > Signed-off-by: Julien Grall 
> 
> To save a round trip, Acked-by: Andrew Cooper
>  with the appropriate hunk to memory_exchange().

Same from me:
Acked-by: Stefano Stabellini 




Re: [PATCH v4 3/4] xen: Remove mfn_to_gmfn macro

2020-09-22 Thread Julien Grall




On 21/09/2020 21:34, Andrew Cooper wrote:

On 21/09/2020 19:02, Julien Grall wrote:

From: Julien Grall 

On x86, mfn_to_gmfn can be replaced with mfn_to_gfn. On Arm, there are
no more call to mfn_to_gmfn, so the helper can be dropped.


The previous patch dropped the mfn_to_gmfn() call from the domain shared
info path, but without a hunk adjusting the innards of
memory_exchange(), this is going to break the x86 build.


Urgh, I thought I build test it the code. I will fix it.




At the same time rework a comment in Arm code that does not make sense.

Signed-off-by: Julien Grall 


To save a round trip, Acked-by: Andrew Cooper
 with the appropriate hunk to memory_exchange().

Alternatively, it might make sense to fold the adjustment into patch 1
which is perhaps more obvious, given the insertion of an is_pv_domain()
check.


I will add in this patch unless someone else also prefer that the change 
is added in patch #1.


Cheers,

--
Julien Grall



Re: [PATCH v4 3/4] xen: Remove mfn_to_gmfn macro

2020-09-21 Thread Andrew Cooper
On 21/09/2020 19:02, Julien Grall wrote:
> From: Julien Grall 
>
> On x86, mfn_to_gmfn can be replaced with mfn_to_gfn. On Arm, there are
> no more call to mfn_to_gmfn, so the helper can be dropped.

The previous patch dropped the mfn_to_gmfn() call from the domain shared
info path, but without a hunk adjusting the innards of
memory_exchange(), this is going to break the x86 build.

> At the same time rework a comment in Arm code that does not make sense.
>
> Signed-off-by: Julien Grall 

To save a round trip, Acked-by: Andrew Cooper
 with the appropriate hunk to memory_exchange().

Alternatively, it might make sense to fold the adjustment into patch 1
which is perhaps more obvious, given the insertion of an is_pv_domain()
check.

~Andrew



[PATCH v4 3/4] xen: Remove mfn_to_gmfn macro

2020-09-21 Thread Julien Grall
From: Julien Grall 

On x86, mfn_to_gmfn can be replaced with mfn_to_gfn. On Arm, there are
no more call to mfn_to_gmfn, so the helper can be dropped.

At the same time rework a comment in Arm code that does not make sense.

Signed-off-by: Julien Grall 

---
Changes in v4:
- Remove acks as the patch is old

Changes in v2:
- Add Jan's and Stefano's acked-by
---
 xen/include/asm-arm/mm.h | 4 +---
 xen/include/asm-x86/mm.h | 5 -
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index f8ba49b1188f..29489a3e1076 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -326,10 +326,8 @@ struct page_info *get_page_from_gva(struct vcpu *v, 
vaddr_t va,
 #define SHARED_M2P_ENTRY (~0UL - 1UL)
 #define SHARED_M2P(_e)   ((_e) == SHARED_M2P_ENTRY)
 
-/* Xen always owns P2M on ARM */
+/* We don't have a M2P on Arm */
 #define set_gpfn_from_mfn(mfn, pfn) do { (void) (mfn), (void)(pfn); } while (0)
-#define mfn_to_gmfn(_d, mfn)  (mfn)
-
 
 /* Arch-specific portion of memory_op hypercall. */
 long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg);
diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h
index deeba75a1cbb..dfa71ce15ac3 100644
--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -508,11 +508,6 @@ extern struct rangeset *mmio_ro_ranges;
 
 #define get_gpfn_from_mfn(mfn)  (machine_to_phys_mapping[(mfn)])
 
-#define mfn_to_gmfn(_d, mfn)\
-( (paging_mode_translate(_d))   \
-  ? get_gpfn_from_mfn(mfn)  \
-  : (mfn) )
-
 #define compat_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 
20))
 #define compat_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 
20))
 
-- 
2.17.1