Re: [PATCH] xen: avoid link error on ARM

From: Juergen Gross
Date: Tue Mar 05 2019 - 01:42:03 EST


On 04/03/2019 21:47, Arnd Bergmann wrote:
> 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 <arnd@xxxxxxxx>
> ---
> 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
>
> diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
> index ad3844d9f876..7124f9e749b4 100644
> --- a/drivers/xen/Makefile
> +++ b/drivers/xen/Makefile
> @@ -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