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

RE: [PATCH v3 2/9] xen: reuse x86 EFI stub functions for Arm


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Thu, 19 May 2022 02:36:28 +0000
  • Accept-language: 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=zcYcWYo67SS8oRwVfMgyQwbAiML4RxhxUOaj5K+ZuKY=; b=aB9oPy/Q4kzvi6Bz+t2j3gPFexhtCCFARmxsIn2pkrA+Z16mMYhORFpk5cot+qo4cxIi1VfltjCiYQCDAg8ZptDm7ltEYiq2d3AFg5M920b+1elsGGV5viHpV0P4SMMhESmlBX/Niq1FkpXHpIeQ+k72z4w1sm61OqfuoO+ssRlYSysiWcgUseJkOnBp4nNPp6ezrKQr+kIf5PkZZYJkJKi5N+7CNW/Z84G45ebIcdog1CHifdqSRXFRxfXJSNrdFTY47mLTquFU8TUs7BHWgm3JBqmhzlnamtMilJ/F3weKGJkGdqVFf8QZAbGqpHez5Uj6pd/+W/4Na5FI6e5XTA==
  • 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=zcYcWYo67SS8oRwVfMgyQwbAiML4RxhxUOaj5K+ZuKY=; b=d74/dlnupvcDpK0mFmBnKd9MYaxsS02M4pLc74x+5mELA/mq5+ZjvThY9GwZJD0n1/MPGgTafJ95RrFo54PFSeGFqXvqcxkmPY19deg/lgv55Xior8k1LYf4YaQCL7fUeG8E/XQXrpIfwC6TINfPjQZ1fW+NWDOyPPJ1b1h68GTNwGaM0wiYyhlrMYbKTfNznp4lS43nEvIlKDANg1+/UEaoLPN46/lXCUjH2C9Zbeb7R8jkdp+/IZUmfvwkOfnViyI5UMpKnW26MLsYPfPdlL8Yhz+1cbF3wCZuHI9f49zgll018Mn4R9cpSSAwlDH4Q4djfAFjBt0n9TzkFevxMA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=BSjShLCE2H9pzDM45wgO1u/OYxOgu2UtgM/ralqbxNRxfH5vq60ddYbVMjbBywDu7BDodafSaxDooRbUPSy1cJ/XrInm1PRA0enaZVbOnjCT21k1rU0lEfQ20iXPHkFuyPsd0ID24d7h2k8XxzDFnHNasF0WptBWyr/0/ceUbVz2GYq2PuCiQk+qXEmibN/QimMuxVvJnazjK/CuXQgU/180bTN9Fda0t5VXN60vPFSdBloKuYrxlLcGq5siaivjrmG+zPA2AaVMeBpc12kWO5BZ78mKm+M3r9E92ieRu6vnZLLiKUgmBzz1jMCNjqjIQNkHS7EA0IS03+nYfEKFDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3pZcdlimEbhyjiE5ajAkp80XyYzpvlG6eg0xM+5Xs6KPrAz94DiN0SN/SyvmXrRNBXBqSSyofTMPSh/W2iKYtVEiHX2jHR2c7keFAzryrGgma2YQIr3GT2ZXj4UBZPqrDpWWkh3KZ+NkgGHSdY0ua2E+LNZVse2CvBjY1UCfVMllAcCSEShpbsH1JAVjIUJqEOARBtjc27CrRAxWCw2NTYKPq120y+UCDILYCTVibNa43BYPhXKHtu4mMra6G2bX+9ENg8+rbg61ZT3fksC8JZsrimr3/cd3+oZbNDDaxtws4k1VAFFuRIEReOB4irr6cZIcPGvAyQBmdICaQhDIA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Jiamei Xie <Jiamei.Xie@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 19 May 2022 02:36:57 +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: AQHYZNkE0M8gmGVKY0iTs20r+BonU60kpgQAgADcFxA=
  • Thread-topic: [PATCH v3 2/9] xen: reuse x86 EFI stub functions for Arm

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年5月18日 21:05
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: nd <nd@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>; Julien
> Grall <julien@xxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>; Andrew Cooper
> <andrew.cooper3@xxxxxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>; Wei
> Liu <wl@xxxxxxx>; Jiamei Xie <Jiamei.Xie@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3 2/9] xen: reuse x86 EFI stub functions for Arm
> 
> On 11.05.2022 03:46, Wei Chen wrote:
> > x86 is using compiler feature testing to decide EFI build
> > enable or not. When EFI build is disabled, x86 will use an
> > efi/stub.c file to replace efi/runtime.c for build objects.
> > Following this idea, we introduce a stub file for Arm, but
> > use CONFIG_ARM_EFI to decide EFI build enable or not.
> >
> > And the most functions in x86 EFI stub.c can be reused for
> > other architectures, like Arm. So we move them to common
> > and keep the x86 specific function in x86/efi/stub.c.
> >
> > To avoid the symbol link conflict error when linking common
> > stub files to x86/efi. We add a regular file check in efi
> > stub files' link script. Depends on this check we can bypass
> > the link behaviors for existed stub files in x86/efi.
> >
> > As there is no Arm specific EFI stub function for Arm in
> > current stage, Arm still can use the existed symbol link
> > method for EFI stub files.
> 
> Wouldn't it be better to mandate that every arch has its stub.c,
> and in the Arm one all you'd do (for now) is #include the common
> one? (But see also below.)
>

Personally, I don't like to include a C file into another C file.
But I am OK as long as the Arm maintainers agree.
@Stefano Stabellini @Bertrand Marquis @Julien Grall

> > --- a/xen/arch/arm/Makefile
> > +++ b/xen/arch/arm/Makefile
> > @@ -1,6 +1,5 @@
> >  obj-$(CONFIG_ARM_32) += arm32/
> >  obj-$(CONFIG_ARM_64) += arm64/
> > -obj-$(CONFIG_ARM_64) += efi/
> >  obj-$(CONFIG_ACPI) += acpi/
> >  obj-$(CONFIG_HAS_PCI) += pci/
> >  ifneq ($(CONFIG_NO_PLAT),y)
> > @@ -20,6 +19,7 @@ obj-y += domain.o
> >  obj-y += domain_build.init.o
> >  obj-y += domctl.o
> >  obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
> > +obj-y += efi/
> >  obj-y += gic.o
> >  obj-y += gic-v2.o
> >  obj-$(CONFIG_GICV3) += gic-v3.o
> > diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile
> > index 4313c39066..dffe72e589 100644
> > --- a/xen/arch/arm/efi/Makefile
> > +++ b/xen/arch/arm/efi/Makefile
> > @@ -1,4 +1,12 @@
> >  include $(srctree)/common/efi/efi-common.mk
> >
> > +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
> > +endif
> 
> I realize Stefano indicated he's happy with the Arm side, but I still
> wonder: What use is the stub on Arm32? Even further - once you have a
> config option (rather than x86'es build-time check plus x86'es dual-
> purposing of all object files), why do you need a stub in the first
> place? You ought to be able to deal with things via inline functions
> and macros, I would think.
> 

We will use efi_enabled() on some common codes of Arm. In the last
version, I had used static inline function, but that will need an
CONFIG_EFI in xen/efi.h to gate the definitions of EFI functions,
otherwise we just can implement the efi_enabled in non-static-inline
way. Or use another name to wrapper efi_enabled. (patch#20, 21)
But as x86 has its own way to decide EFI build or not, the CONFIG_EFI
has been rejected. In this case, we use CONFIG_ARM_EFI for Arm itself.

For CONFIG_ARM_EFI, it's impossible to be used in xen/efi.h to gate
definitions. So if I want to use macros or static-inline functions,
I need to use #ifdef CONFIG_ARM_EFI in everywhere to gate xen/efi.h.
Or use another header file to warpper xen/efi.h.

> > --- a/xen/common/efi/efi-common.mk
> > +++ b/xen/common/efi/efi-common.mk
> > @@ -9,7 +9,8 @@ CFLAGS-y += -iquote $(srcdir)
> >  # e.g.: It transforms "dir/foo/bar" into successively
> >  #       "dir foo bar", ".. .. ..", "../../.."
> >  $(obj)/%.c: $(srctree)/common/efi/%.c FORCE
> > -   $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst
> /, ,$(obj))))/source/common/efi/$(<F) $@
> > +   $(Q)test -f $@ || \
> > +   ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst
> /, ,$(obj))))/source/common/efi/$(<F) $@
> 
> Please can you indent the "ln" to match "test", such that it's easily
> visible (without paying attention to line continuation characters)
> that these two lines are a single command?
> 

Yeah, of course, I will do it.

> Jan


 


Rackspace

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