Skip to contentSkip to conversation

CONFIG_XEN_PV breaks xen_create_contiguous_region on ARM

PATCH Superseded Stefano Stabellini 3 participants 4 messages Oct 26, 2018 – Oct 30, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Stefano Stabellini

author maintainer
#0 lore raw

PATCH v2 1/1 CONFIG_XEN_PV breaks xen_create_contiguous_region on ARM

From: Stefano Stabellini <[email protected]>

xen_create_contiguous_region has now only an implementation if CONFIG_XEN_PV is defined. However, on ARM we never set CONFIG_XEN_PV but we do have an implementation of xen_create_contiguous_region which is required for swiotlb-xen to work correctly (although it just sets *dma_handle).

Add a stub implementation of xen_remap_pfn: it should never be called on ARM but it is necessary for linking.

This fixes a bug introduced by 16624390816c4c40df3d777b34665d3fd01e693d.

---
 arch/arm/xen/mm.c     | 8 ++++++++
 include/xen/xen-ops.h | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

---
Changes in v2:
- improve commit message
- add xen_remap_pfn stub implementation
- use if defined()

arch/arm/xen/mm.c +8 -0
index 785d2a5..7230e22 100644
@@ -182,6 +182,14 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
 }
 EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
 
+int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
+		  xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
+		  unsigned int domid, bool no_translate, struct page **pages)
+{
+	return -EOPNOTSUPP;
+}
+EXPORT_SYMBOL_GPL(xen_remap_pfn);
+
 const struct dma_map_ops *xen_dma_ops;
 EXPORT_SYMBOL(xen_dma_ops);
 
include/xen/xen-ops.h +1 -1
index 18803ff..765dd05 100644
@@ -42,7 +42,7 @@ int xen_setup_shutdown_event(void);
 
 extern unsigned long *xen_contiguous_bitmap;
 
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
 int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
 				unsigned int address_bits,
 				dma_addr_t *dma_handle);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

xen_create_contiguous_region has now only an implementation if CONFIG_XEN_PV is defined. However, on ARM we never set CONFIG_XEN_PV but we do have an implementation of xen_create_contiguous_region which is required for swiotlb-xen to work correctly (although it just sets *dma_handle).

Quoted 4 lines

Add a stub implementation of xen_remap_pfn: it should never be called on ARM but it is necessary for linking.

This fixes a bug introduced by 16624390816c4c40df3d777b34665d3fd01e693d.

Again, this should contain a tag "Fixes: sha1 ("commit title")" so it can be picked for backporting automatically.

Quoted 22 lines
---
  arch/arm/xen/mm.c     | 8 ++++++++
  include/xen/xen-ops.h | 2 +-
  2 files changed, 9 insertions(+), 1 deletion(-)

---
Changes in v2:
- improve commit message
- add xen_remap_pfn stub implementation
- use if defined()

arch/arm/xen/mm.c +0 -0
index 785d2a5..7230e22 100644

arch/arm/xen/mm.c void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) · line 191

Quoted 10 lines
arch/arm/xen/mm.c +7 -0
@@ -182,6 +182,14 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
  }
  EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
 
+int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
+		  xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
+		  unsigned int domid, bool no_translate, struct page **pages)
+{
+	return -EOPNOTSUPP;
+}
+EXPORT_SYMBOL_GPL(xen_remap_pfn);

This does not match the "unimplemented" version in xen-ops.h.

But I find this solution quite ugly. Why don't you split the #ifdef in two below?

Quoted 10 lines
arch/arm/xen/mm.c +1 -0
+
  const struct dma_map_ops *xen_dma_ops;
  EXPORT_SYMBOL(xen_dma_ops);
 
include/xen/xen-ops.h +0 -0
index 18803ff..765dd05 100644

include/xen/xen-ops.h int xen_setup_shutdown_event(void); · line 48

Quoted 8 lines
include/xen/xen-ops.h +1 -1
@@ -42,7 +42,7 @@ int xen_setup_shutdown_event(void);
 
  extern unsigned long *xen_contiguous_bitmap;
 
-#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
  int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
  				unsigned int address_bits,
  				dma_addr_t *dma_handle);

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author maintainer
#2 lore raw
Quoted 11 lines · Julien Grall

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

xen_create_contiguous_region has now only an implementation if CONFIG_XEN_PV is defined. However, on ARM we never set CONFIG_XEN_PV but we do have an implementation of xen_create_contiguous_region which is required for swiotlb-xen to work correctly (although it just sets *dma_handle).

Quoted 7 lines
Quoted 4 lines

Add a stub implementation of xen_remap_pfn: it should never be called on ARM but it is necessary for linking.

This fixes a bug introduced by 16624390816c4c40df3d777b34665d3fd01e693d.

Again, this should contain a tag "Fixes: sha1 ("commit title")" so it can be picked for backporting automatically.

Yeah, I forgot about it, it should be definitely added.

Quoted 34 lines
Quoted 21 lines
---
  arch/arm/xen/mm.c     | 8 ++++++++
  include/xen/xen-ops.h | 2 +-
  2 files changed, 9 insertions(+), 1 deletion(-)

---
Changes in v2:
- improve commit message
- add xen_remap_pfn stub implementation
- use if defined()

arch/arm/xen/mm.c +0 -0
index 785d2a5..7230e22 100644

arch/arm/xen/mm.c void xen_destroy_contiguous_region(phys_addr_t pstart, · line 191

Quoted 10 lines
arch/arm/xen/mm.c +6 -0
@@ -182,6 +182,14 @@ void xen_destroy_contiguous_region(phys_addr_t pstart,
 unsigned int order)
  }
  EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
  +int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
+		  xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
+		  unsigned int domid, bool no_translate, struct page **pages)
+{
+	return -EOPNOTSUPP;
+}
+EXPORT_SYMBOL_GPL(xen_remap_pfn);

This does not match the "unimplemented" version in xen-ops.h.

Quoted 2 lines

But I find this solution quite ugly. Why don't you split the #ifdef in two below?

I am happy to follow the maintainers' opinion on this. I would keep those those definition together but I don't mind either way.

Juergen, Boris,

What do you prefer?

Quoted 9 lines
Quoted 9 lines
arch/arm/xen/mm.c +1 -0
+
  const struct dma_map_ops *xen_dma_ops;
  EXPORT_SYMBOL(xen_dma_ops);
  diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h

index 18803ff..765dd05 100644

include/xen/xen-ops.h +0 -0
@@ -42,7 +42,7 @@ int xen_setup_shutdown_event(void);
    extern unsigned long *xen_contiguous_bitmap;
Quoted 12 lines

include/xen/xen-ops.h int xen_setup_shutdown_event(void);

Quoted 6 lines
include/xen/xen-ops.h +1 -0
  -#ifdef CONFIG_XEN_PV
+#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
  int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
  				unsigned int address_bits,
  				dma_addr_t *dma_handle);
 

Cheers,

Signature · 1 line
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

maintainer
#3 lore raw
Quoted 60 lines · Stefano Stabellini
Quoted 11 lines · Julien Grall

Hi Stefano,

Quoted 8 lines · Stefano Stabellini

From: Stefano Stabellini <[email protected]>

xen_create_contiguous_region has now only an implementation if CONFIG_XEN_PV is defined. However, on ARM we never set CONFIG_XEN_PV but we do have an implementation of xen_create_contiguous_region which is required for swiotlb-xen to work correctly (although it just sets *dma_handle).

Quoted 7 lines
Quoted 4 lines

Add a stub implementation of xen_remap_pfn: it should never be called on ARM but it is necessary for linking.

This fixes a bug introduced by 16624390816c4c40df3d777b34665d3fd01e693d.

Again, this should contain a tag "Fixes: sha1 ("commit title")" so it can be picked for backporting automatically.

Yeah, I forgot about it, it should be definitely added.

Quoted 34 lines
Quoted 21 lines
---
  arch/arm/xen/mm.c     | 8 ++++++++
  include/xen/xen-ops.h | 2 +-
  2 files changed, 9 insertions(+), 1 deletion(-)

---
Changes in v2:
- improve commit message
- add xen_remap_pfn stub implementation
- use if defined()

arch/arm/xen/mm.c +0 -0
index 785d2a5..7230e22 100644

arch/arm/xen/mm.c void xen_destroy_contiguous_region(phys_addr_t pstart, · line 191

Quoted 10 lines
arch/arm/xen/mm.c +6 -0
@@ -182,6 +182,14 @@ void xen_destroy_contiguous_region(phys_addr_t pstart,
 unsigned int order)
  }
  EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region);
  +int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
+		  xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,
+		  unsigned int domid, bool no_translate, struct page **pages)
+{
+	return -EOPNOTSUPP;
+}
+EXPORT_SYMBOL_GPL(xen_remap_pfn);

This does not match the "unimplemented" version in xen-ops.h.

Quoted 2 lines

But I find this solution quite ugly. Why don't you split the #ifdef in two below?

Quoted 7 lines

I am happy to follow the maintainers' opinion on this. I would keep those those definition together but I don't mind either way.

Juergen, Boris,

What do you prefer?

I'd follow Julien's suggestion.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel