xen: avoid link error on ARM
PATCH 1/1 xen: avoid link error on ARM
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!
Move the code into a new file that is built along with privcmd.o but is always built-in, even when the latter is a loadable module.
xen_remap_vma_range() may not be the best name here, if someone comes up with a better one, let me know.
--- drivers/xen/Makefile | 3 +++ drivers/xen/mm.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/xen/privcmd.c | 30 +----------------------------- include/xen/xen-ops.h | 3 +++ 4 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 drivers/xen/mm.c
drivers/xen/Makefile +3 -0
@@ -29,6 +29,9 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o obj-$(CONFIG_XEN_MCE_LOG) += mcelog.o obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o +ifdef CONFIG_XEN_PRIVCMD +obj-y += mm.o +endif obj-$(CONFIG_XEN_STUB) += xen-stub.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY) += xen-acpi-memhotplug.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o
drivers/xen/mm.c new file +41 -0
41 lines not on this page · raw message
drivers/xen/privcmd.c +1 -29
@@ -723,26 +723,6 @@ static long privcmd_ioctl_restrict(struct file *file, void __user *udata)return 0 ; } -struct remap_pfn { -struct mm_struct *mm; -struct page **pages; -pgprot_t prot; -unsigned long i; -}; - -static int remap_pfn_fn (pte_t *ptep,pgtable_t token,unsigned long addr, -void *data) -{ -struct remap_pfn *r = data; -struct page *page = r->pages[r->i]; -pte_t pte =pte_mkspecial (pfn_pte (page_to_pfn (page), r->prot)); - -set_pte_at (r->mm, addr, ptep, pte); - r->i++; - -return 0 ; -} -static long privcmd_ioctl_mmap_resource (struct file *file,void __user *udata) {struct privcmd_data *data = file->private_data;
@@ -809,15 +789,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) goto out;if (xen_feature (XENFEAT_auto_translated_physmap)) { -struct remap_pfn r = { - .mm = vma->vm_mm, - .pages = vma->vm_private_data, - .prot = vma->vm_page_prot, - }; - - rc =apply_to_page_range (r.mm, kdata.addr, - kdata.num <<PAGE_SHIFT , - remap_pfn_fn, &r); + rc =xen_remap_vma_range (vma, kdata.addr, kdata.num <<PAGE_SHIFT ); }else {unsigned int domid = (xdata.flags & XENMEM_rsrc_acq_caller_owned) ?
include/xen/xen-ops.h +3 -0
@@ -109,6 +109,9 @@ static inline int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, }#endif +int xen_remap_vma_range (struct vm_area_struct *vma,unsigned long addr, +unsigned long len); +/* * xen_remap_domain_gfn_array() - map an array of foreign frames by gfn * @vma: VMA to map the pages into
Signature · 1 line
2.20.0
Quoted 4 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!
Can __sync_icache_dcache be exported in arm32, just like it is in arm64?
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!
Can __sync_icache_dcache be exported in arm32, just like it is in arm64?
-boris
Quoted 8 lines · Boris Ostrovsky
Quoted 4 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!Can
__sync_icache_dcachebe exported in arm32, just like it is in arm64?
Russell wants all cache management operations to stay private to the kernel, as they tend to get abused by other drivers:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Arnd
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Boris Ostrovsky
Quoted 4 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!Can
__sync_icache_dcachebe exported in arm32, just like it is in arm64?
Russell wants all cache management operations to stay private to the kernel, as they tend to get abused by other drivers:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Arnd
Juergen Gross
maintainerQuoted 25 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!Move the code into a new file that is built along with privcmd.o but is always built-in, even when the latter is a loadable module.
xen_remap_vma_range()may not be the best name here, if someone comes up with a better one, let me know.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/xen/Makefile | 3 +++ drivers/xen/mm.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/xen/privcmd.c | 30 +----------------------------- include/xen/xen-ops.h | 3 +++ 4 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 drivers/xen/mm.cdrivers/xen/Makefile +0
-0
drivers/xen/Makefile obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o · line 34
Quoted 6 lines
drivers/xen/Makefile +3
-0@@ -29,6 +29,9 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o obj-$(CONFIG_XEN_MCE_LOG) += mcelog.o obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o +ifdef CONFIG_XEN_PRIVCMD +obj-y += mm.o +endif
Can we avoid that ifdef in the Makefile?
I'd rather have an architecture independant builtin driver added which is always included for CONFIG_XEN. This would allow to move redundant stuff from arch/*/xen/ into it (e.g. xen_vcpu_id).
So: rename mm.c to xen-builtin.c, use:
obj-$(CONFIG_XEN) += xen-builtin.o
Juergen
Quoted 10 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the Makefile logic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silent Kconfig symbol that turns this on and still avoid the ifdef:
obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
(or using any other symbol name that makes more sense than that.
Let me know your preference and I'll resubmit.
Arnd
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the Makefile logic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silent Kconfig symbol that turns this on and still avoid the ifdef:
obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
(or using any other symbol name that makes more sense than that.
Let me know your preference and I'll resubmit.
Arnd
Juergen Gross
maintainerQuoted 11 lines · Arnd Bergmann
Quoted 9 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:
Quoted 8 lines
Quoted 1 line
obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the
Makefilelogic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silentKconfigsymbol that turns this on and still avoid the ifdef:obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
That was my first thought.
But looking through arch/[arm|x86]/xen/enlighten.c I found several global variables defined the same way. I'd like to merge those, too.
So my preference is a common source for all this stuff.
I'll send a followup patch to move the mentioned variables into the new source.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Juergen Gross
maintainerQuoted 11 lines · Arnd Bergmann
Quoted 9 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:
Quoted 8 lines
Quoted 1 line
obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the
Makefilelogic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silentKconfigsymbol that turns this on and still avoid the ifdef:obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
That was my first thought.
But looking through arch/[arm|x86]/xen/enlighten.c I found several global variables defined the same way. I'd like to merge those, too.
So my preference is a common source for all this stuff.
I'll send a followup patch to move the mentioned variables into the new source.
Juergen
Quoted 20 lines · Juergen Gross
Quoted 18 lines · Arnd Bergmann
Quoted 10 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the
Makefilelogic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silentKconfigsymbol that turns this on and still avoid the ifdef:
Quoted 8 lines
Quoted 1 line
obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
That was my first thought.
But looking through arch/[arm|x86]/xen/enlighten.c I found several global variables defined the same way. I'd like to merge those, too.
So my preference is a common source for all this stuff.
Ok, makes sense. I've prepared that patch now and will send it after some more build testing.
Arnd
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 20 lines · Juergen Gross
Quoted 18 lines · Arnd Bergmann
Quoted 10 lines · Juergen Gross
Can we avoid that ifdef in the
Makefile?I'd rather have an architecture independant builtin driver added which is always included for
CONFIG_XEN. This would allow to move redundant stuff fromarch/*/xen/into it (e.g.xen_vcpu_id).So: rename
mm.ctoxen-builtin.c, use:obj-$(CONFIG_XEN) += xen-builtin.o
Sure, I'm happy to change the naming and the
Makefilelogic. The way you suggested sounds fine to me, but it will make the xen code slightly bigger even if that code is not used. We could also have a silentKconfigsymbol that turns this on and still avoid the ifdef:
Quoted 8 lines
Quoted 1 line
obj-$(CONFIG_XEN_BUILTIN) += xen-builtin.o
That was my first thought.
But looking through arch/[arm|x86]/xen/enlighten.c I found several global variables defined the same way. I'd like to merge those, too.
So my preference is a common source for all this stuff.
Ok, makes sense. I've prepared that patch now and will send it after some more build testing.
Arnd
Juergen Gross
maintainerQuoted 25 lines · Arnd Bergmann
Building the privcmd code as a loadable module on ARM, we get a link error due to the private cache management functions:
ERROR: "
__sync_icache_dcache" [drivers/xen/xen-privcmd.ko] undefined!Move the code into a new file that is built along with privcmd.o but is always built-in, even when the latter is a loadable module.
xen_remap_vma_range()may not be the best name here, if someone comes up with a better one, let me know.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/xen/Makefile | 3 +++ drivers/xen/mm.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/xen/privcmd.c | 30 +----------------------------- include/xen/xen-ops.h | 3 +++ 4 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 drivers/xen/mm.cdrivers/xen/Makefile +0
-0
drivers/xen/Makefile obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o · line 34
Quoted 6 lines
drivers/xen/Makefile +3
-0@@ -29,6 +29,9 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o obj-$(CONFIG_XEN_MCE_LOG) += mcelog.o obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o +ifdef CONFIG_XEN_PRIVCMD +obj-y += mm.o +endif
Can we avoid that ifdef in the Makefile?
I'd rather have an architecture independant builtin driver added which is always included for CONFIG_XEN. This would allow to move redundant stuff from arch/*/xen/ into it (e.g. xen_vcpu_id).
So: rename mm.c to xen-builtin.c, use:
obj-$(CONFIG_XEN) += xen-builtin.o
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel