[PATCH] Xen: drop exports of {set,clear}_foreign_p2m_mapping()

Jan Beulich posted 1 patch 3 years, 1 month ago
Failed in applying to current master (apply log)
[PATCH] Xen: drop exports of {set,clear}_foreign_p2m_mapping()
Posted by Jan Beulich 3 years, 1 month ago
They're only used internally, and the layering violation they contain
(x86) or imply (Arm) of calling HYPERVISOR_grant_table_op() strongly
advise against any (uncontrolled) use from a module. The functions also
never had users except the ones from drivers/xen/grant-table.c forever
since their introduction in 3.15.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
It's not clear to me why Arm doesn't have merely stubs just like x86 has
when PV support is disabled.

--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -130,7 +130,6 @@ int set_foreign_p2m_mapping(struct gntta
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
 
 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
 			      struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -145,7 +144,6 @@ int clear_foreign_p2m_mapping(struct gnt
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
 
 bool __set_phys_to_machine_multi(unsigned long pfn,
 		unsigned long mfn, unsigned long nr_pages)
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -776,7 +776,6 @@ int set_foreign_p2m_mapping(struct gntta
 out:
 	return ret;
 }
-EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
 
 int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
 			      struct gnttab_unmap_grant_ref *kunmap_ops,
@@ -802,7 +801,6 @@ int clear_foreign_p2m_mapping(struct gnt
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
 
 #ifdef CONFIG_XEN_DEBUG_FS
 #include <linux/debugfs.h>

Re: [PATCH] Xen: drop exports of {set,clear}_foreign_p2m_mapping()
Posted by Stefano Stabellini 3 years, 1 month ago
On Tue, 9 Mar 2021, Jan Beulich wrote:
> They're only used internally, and the layering violation they contain
> (x86) or imply (Arm) of calling HYPERVISOR_grant_table_op() strongly
> advise against any (uncontrolled) use from a module. The functions also
> never had users except the ones from drivers/xen/grant-table.c forever
> since their introduction in 3.15.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> It's not clear to me why Arm doesn't have merely stubs just like x86 has
> when PV support is disabled.
 
ARM implements the two functions to keep track of foreign pages mapped
into the system. It uses swiotlb-xen to translate gfn to mfn for foreign
pages. Local pages are 1:1. This way, an IOMMU is not required.


> --- a/arch/arm/xen/p2m.c
> +++ b/arch/arm/xen/p2m.c
> @@ -130,7 +130,6 @@ int set_foreign_p2m_mapping(struct gntta
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
>  
>  int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
>  			      struct gnttab_unmap_grant_ref *kunmap_ops,
> @@ -145,7 +144,6 @@ int clear_foreign_p2m_mapping(struct gnt
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
>  
>  bool __set_phys_to_machine_multi(unsigned long pfn,
>  		unsigned long mfn, unsigned long nr_pages)
> --- a/arch/x86/xen/p2m.c
> +++ b/arch/x86/xen/p2m.c
> @@ -776,7 +776,6 @@ int set_foreign_p2m_mapping(struct gntta
>  out:
>  	return ret;
>  }
> -EXPORT_SYMBOL_GPL(set_foreign_p2m_mapping);
>  
>  int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
>  			      struct gnttab_unmap_grant_ref *kunmap_ops,
> @@ -802,7 +801,6 @@ int clear_foreign_p2m_mapping(struct gnt
>  
>  	return ret;
>  }
> -EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);
>  
>  #ifdef CONFIG_XEN_DEBUG_FS
>  #include <linux/debugfs.h>
> 

Re: [PATCH] Xen: drop exports of {set,clear}_foreign_p2m_mapping()
Posted by Boris Ostrovsky 3 years, 1 month ago
On 3/9/21 12:00 PM, Jan Beulich wrote:
> They're only used internally, and the layering violation they contain
> (x86) or imply (Arm) of calling HYPERVISOR_grant_table_op() strongly
> advise against any (uncontrolled) use from a module. The functions also
> never had users except the ones from drivers/xen/grant-table.c forever
> since their introduction in 3.15.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>


Applied to for-linus-5.12b