[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2] build: Fix x86 out-of-tree build without EFI


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 17 Aug 2022 14:24:04 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h0l1DSorM3j5cICVZ3WhVkpwVgUcbH9HzCGIK2CTplM=; b=ZSngt7ZLMI+ERuIVeWmSdpEmApXfEphLH9cHvllJAimJAYAXEUiSXba2u4O5v73JhMFMZQGcR1AZ+6w7GIrFlj19iyP+zo8EE9UDjyJxYIiit4dkljmN8ButJehWtunN9Lc2wP3BKzRg4uFpN2k/zdYIVWCdzlp1Ta6LstmzoGYp5jCXSOEVn4etDbCOAUXhIEYNOGvyaHQ6iNTYABjaL/j3oouekVqdLp8W6HoEqH0wlFWaivuj3QiD8qD0K1Lnf0i1hqje5axY3ghNCKJlULk8XSAMERQub+L4eitLWhhfJUXqPjQkCVHxNY2mJ9lBwsonBR+5n4zQvflq/8eSQA==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h0l1DSorM3j5cICVZ3WhVkpwVgUcbH9HzCGIK2CTplM=; b=XBt5Tx/928BjcNaja5MD/IsA7QBmbeisYe0T8DxkOv1c6gVjU7rnqAvbbmnxLF37UfTHF2bVtpUxDeW89YyddnKP18ohgWwFutODCv9pjlpmxhSapIOwhq9lg97qRh+e9lBjBqJHH95GaukAKVUMBGpS5Zl2D0t/IMttJPGdjDfVxvyrNz9MPn2Ez4CjXHFMzuXl3XVgVorF8ZmE8nRdXImGVjlFajPD8Bt7O17YriLR4U89JxQzin55Zn3crCStMk5qdUqFG7LleZ4L5YQmfDyvhYoExoWfJWLEXE18PPwnKDXfQ7esxy+8HHzomcSkl539IJqEVex/sGanRQikZA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=QOETATqJc3dOpA+q/LGbB2VwCcbfS/9cgFMNOH/0Z1pA4LYzYKmNy6LzCcO1HTQBhQnPLu1I1NkW/Tcm70+zSevP0ulJNyypldD8hLbJT+71MGRB19ctyVtmK64A38lfTaMehuqLJtlCyaHMC++DSJ0lanD9+Cah1ywzo4lBW7/o5v+YxCN6jhZRJiU4m+eC4hhDD6huQm3I2ehvFojGLHeKe9LE9VSfun2t81BW0zAtjmPbslp/TTskxO3hayqEoNbamDM6uF0SUAO5/xmNj9N5LWCwQM8piE2x/LL1PCo2gSKN0nqO/jboUv/+6EGlIOYhBhQmhsJVYq25audnlg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KwaEOx2w6ocd/i4XGYjEbWtY+BpgiSL8jmQQVavWW92p8PN3adPgqURd/sloPbQcg+u8uvUNcE8w0uxSKNeb1fdmqhlO/iKdgzuzjWzOIUdxN5s51OpOSrHgGSv5ZV3ADcQr7yf91Z228+yxefDEk96GTe0XYgyvtrRIPWrFc2qGGOfjVvSLf8xE9q+d+qhVhz039Bj9iBAHZLV6Bjm516pJdd9lpYbygARw7WI8nzbPGO7be+tPU3d1TgkPPfwG/XatAN0y0lt9J6m88QwFeL2Ew8dLE4VpZuBbhFUv7OcPLriqRYUIl6dn+vGZPGRa8nv3nMwVWFaDgDy3hhYodA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 17 Aug 2022 14:24:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYshn5p8B+wu2e+kaYxiD64FUdFq2zJc0A
  • Thread-topic: [XEN PATCH v2] build: Fix x86 out-of-tree build without EFI

Hi Anthony,

> On 17 Aug 2022, at 10:15, Anthony PERARD <anthony.perard@xxxxxxxxxx> wrote:
> 
> We can't have a source file with the same name that exist in both the
> common code and in the arch specific code for efi/. This can lead to
> comfusion in make and it can pick up the wrong source file. This issue
> lead to a failure to build a pv-shim for x86 out-of-tree, as this is
> one example of an x86 build using the efi/stub.c.
> 
> The issue is that in out-of-tree, make might find x86/efi/stub.c via
> VPATH, but as the target needs to be rebuilt due to FORCE, make
> actually avoid changing the source tree and rebuilt the target with
> VPATH ignored, so $@ lead to the build tree where "stub.c" dosen't
> exist yet so a link is made to "common/stub.c".
> 
> Rework the new common/stub.c file to have a different name than the
> already existing one, by renaming the existing one. We will take
> example of efi/boot.c and have the common stub.c include a per-arch
> stub.h. This at least avoid the need to expose to Arm both alias
> efi_compat_get_info and efi_compat_runtime_call.
> 
> Avoid using $(EFIOBJ-y) as an alias for $(clean-files), add
> "stub.c" directly to $(clean-files).
> 
> Also update .gitignore as this was also missing from the original
> patch.
> 
> Fixes: 7f96859b0d00 ("xen: reuse x86 EFI stub functions for Arm")
> Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

I do not really like the empty header but I have no better solution so:
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Also I did some compilation runs and it works.

Cheers
Bertrand

> ---
> 
> Notes:
>    v2:
>    - instead of renaming common/efi/stub.c to common_stub.c; we rename
>      arch/*/efi/stub.c to stub.h and include it from common/stub.c
>    - update .gitignore
> 
>    CC: Jan Beulich <jbeulich@xxxxxxxx>
>    CC: Wei Chen <wei.chen@xxxxxxx>
> 
> xen/arch/arm/efi/Makefile           | 4 ----
> xen/common/efi/efi-common.mk        | 4 ++--
> xen/arch/arm/efi/stub.h             | 4 ++++
> xen/arch/x86/efi/{stub.c => stub.h} | 5 ++++-
> xen/common/efi/stub.c               | 5 +++++
> .gitignore                          | 1 +
> 6 files changed, 16 insertions(+), 7 deletions(-)
> create mode 100644 xen/arch/arm/efi/stub.h
> rename xen/arch/x86/efi/{stub.c => stub.h} (93%)
> 
> diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile
> index bd954a3b2d..ff1bcd6c50 100644
> --- a/xen/arch/arm/efi/Makefile
> +++ b/xen/arch/arm/efi/Makefile
> @@ -4,10 +4,6 @@ ifeq ($(CONFIG_ARM_EFI),y)
> obj-y += $(EFIOBJ-y)
> obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
> else
> -# Add stub.o to EFIOBJ-y to re-use the clean-files in
> -# efi-common.mk. Otherwise the link of stub.c in arm/efi
> -# will not be cleaned in "make clean".
> -EFIOBJ-y += stub.o
> obj-y += stub.o
> 
> $(obj)/stub.o: CFLAGS-y += -fno-short-wchar
> diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk
> index ec2c34f198..950f564575 100644
> --- a/xen/common/efi/efi-common.mk
> +++ b/xen/common/efi/efi-common.mk
> @@ -9,9 +9,9 @@ CFLAGS-y += -iquote $(srcdir)
> # e.g.: It transforms "dir/foo/bar" into successively
> #       "dir foo bar", ".. .. ..", "../../.."
> $(obj)/%.c: $(srctree)/common/efi/%.c FORCE
> -     $(Q)test -f $@ || \
> -         ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, 
> ,$(obj))))/source/common/efi/$(<F) $@
> +     $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, 
> ,$(obj))))/source/common/efi/$(<F) $@
> 
> clean-files += $(patsubst %.o, %.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))
> +clean-files += stub.c
> 
> .PRECIOUS: $(obj)/%.c
> diff --git a/xen/arch/arm/efi/stub.h b/xen/arch/arm/efi/stub.h
> new file mode 100644
> index 0000000000..b0a9b03e59
> --- /dev/null
> +++ b/xen/arch/arm/efi/stub.h
> @@ -0,0 +1,4 @@
> +/*
> + * Architecture specific implementation for EFI stub code.  This file
> + * is intended to be included by common/efi/stub.c _only_.
> + */
> diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub.h
> similarity index 93%
> rename from xen/arch/x86/efi/stub.c
> rename to xen/arch/x86/efi/stub.h
> index f2365bc041..9d2845b833 100644
> --- a/xen/arch/x86/efi/stub.c
> +++ b/xen/arch/x86/efi/stub.h
> @@ -1,3 +1,7 @@
> +/*
> + * Architecture specific implementation for EFI stub code.  This file
> + * is intended to be included by common/efi/stub.c _only_.
> + */
> #include <xen/efi.h>
> #include <xen/init.h>
> #include <asm/asm_defns.h>
> @@ -8,7 +12,6 @@
> #include <efi/eficon.h>
> #include <efi/efidevp.h>
> #include <efi/efiapi.h>
> -#include "../../../common/efi/stub.c"
> 
> /*
>  * Here we are in EFI stub. EFI calls are not supported due to lack
> diff --git a/xen/common/efi/stub.c b/xen/common/efi/stub.c
> index 15694632c2..854efd9c99 100644
> --- a/xen/common/efi/stub.c
> +++ b/xen/common/efi/stub.c
> @@ -30,3 +30,8 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
> {
>     return -ENOSYS;
> }
> +
> +/*
> + * Include architecture specific implementation here.
> + */
> +#include "stub.h"
> diff --git a/.gitignore b/.gitignore
> index ed7bd8bdc7..3a91e79672 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -311,6 +311,7 @@ xen/arch/*/efi/ebmalloc.c
> xen/arch/*/efi/efi.h
> xen/arch/*/efi/pe.c
> xen/arch/*/efi/runtime.c
> +xen/arch/*/efi/stub.c
> xen/arch/*/include/asm/asm-offsets.h
> xen/common/config_data.S
> xen/common/config.gz
> -- 
> Anthony PERARD
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.