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

Re: [Minios-devel] [UNIKRAFT PATCHv4 03/43] arch: Reorganize arch folder to reflect the CPU family schema



Hi Julien,

> -----Original Message-----
> From: Julien Grall <julien.grall@xxxxxxx>
> Sent: 2018年7月8日 5:44
> To: Wei Chen <Wei.Chen@xxxxxxx>; minios-devel@xxxxxxxxxxxxxxxxxxxx;
> simon.kuenzer@xxxxxxxxx
> Cc: Kaly Xin <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>
> Subject: Re: [Minios-devel] [UNIKRAFT PATCHv4 03/43] arch: Reorganize arch
> folder to reflect the CPU family schema
> 
> Hi Wei,
> 
> On 07/06/2018 10:03 AM, Wei Chen wrote:
> > As we have introduced UK_FAMILY for build scipts. In order to
> 
> s/scipts/scripts/

Thanks,

> 
> > reflect the CPU family schema, we modify the "arch/UK_ARCH"
> > to "arch/UK_FAMILY/UK_ARCH".
> >
> > The "arch/UK_FAMILY" can be used to store the common codes and build
> > scripts for the architectures of same family.
> >
> > For individual architectures, it might make sense to use forward
> > declarations in Compiler.uk and Makefile.uk to include a corresponding
> > file in a subfolder. For instance arm/Makefile.uk includes
> > arm/arm/Makefile.uk when an ARM32 architecture was selected.
> >
> > Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
> > ---
> >   Makefile                            | 12 ++++++------
> >   arch/Config.uk                      |  4 ++--
> >   arch/arm/Compiler.uk                |  7 ++-----
> >   arch/arm/Makefile.uk                | 23 ++++-------------------
> >   arch/arm/arm/Compiler.uk            |  6 ++++++
> >   arch/arm/{ => arm}/Config.uk        |  0
> >   arch/arm/arm/Makefile.uk            | 19 +++++++++++++++++++
> >   arch/arm/{ => arm}/divsi3.S         | 17 ++++++++---------
> >   arch/arm/{ => arm}/ldivmod.S        |  2 +-
> >   arch/arm/{ => arm}/ldivmod_helper.c |  0
> >   arch/arm/{ => arm}/qdivrem.c        |  0
> >   arch/x86/Compiler.uk                |  4 ++++
> >   arch/x86/Makefile.uk                |  4 ++++
> >   arch/{ => x86}/x86_64/Compiler.uk   |  0
> >   arch/{ => x86}/x86_64/Config.uk     |  0
> >   arch/{ => x86}/x86_64/Makefile.uk   |  0
> >   16 files changed, 56 insertions(+), 42 deletions(-)
> >   create mode 100644 arch/arm/arm/Compiler.uk
> >   rename arch/arm/{ => arm}/Config.uk (100%)
> >   create mode 100644 arch/arm/arm/Makefile.uk
> >   rename arch/arm/{ => arm}/divsi3.S (97%)
> >   rename arch/arm/{ => arm}/ldivmod.S (99%)
> >   rename arch/arm/{ => arm}/ldivmod_helper.c (100%)
> >   rename arch/arm/{ => arm}/qdivrem.c (100%)
> >   create mode 100644 arch/x86/Compiler.uk
> >   create mode 100644 arch/x86/Makefile.uk
> >   rename arch/{ => x86}/x86_64/Compiler.uk (100%)
> >   rename arch/{ => x86}/x86_64/Config.uk (100%)
> >   rename arch/{ => x86}/x86_64/Makefile.uk (100%)
> >
> > diff --git a/Makefile b/Makefile
> > index 178ebbc..d10f53b 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -350,12 +350,12 @@ export UK_FAMILY ?= $(shell echo "$(CONFIG_UK_ARCH)" |
> \
> >
> >   # Quick-check if architecture exists
> >   ifeq ($(filter $(null_targets) print-vars,$(MAKECMDGOALS)),)
> > -ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(ARCH)/Makefile.uk),)
> > -$(error Target architecture ($(ARCH)) is currently not supported (could not
> find $(CONFIG_UK_BASE)/arch/$(ARCH)/Makefile.uk).)
> > +ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Makefile.uk),)
> > +$(error Target architecture ($(ARCH)) is currently not supported (could not
> find $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Makefile.uk).)
> >   endif
> >
> > -ifeq ($(wildcard arch/$(ARCH)/Compiler.uk),)
> > -$(error Target architecture ($(ARCH)) is currently not supported (could not
> find $(CONFIG_UK_BASE)/arch/$(ARCH)/Compiler.uk).)
> > +ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Compiler.uk),)
> > +$(error Target architecture ($(ARCH)) is currently not supported (could not
> find $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Compiler.uk).)
> >   endif
> >   endif
> >
> > @@ -394,7 +394,7 @@ unexport MACHINE
> >   # Note: Some architectures assign CONFIG_CROSS_COMPILE in their
> arch/*/Makefile.uk
> >   CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
> >
> > -include $(CONFIG_UK_BASE)/arch/$(CONFIG_UK_ARCH)/Compiler.uk
> > +include $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk
> >
> >   # Make variables (CC, etc...)
> >   LD                := $(CONFIG_CROSS_COMPILE)gcc
> > @@ -456,7 +456,7 @@ endif
> >   $(foreach E,$(ELIB_DIR), \
> >     $(eval $(call _import_lib,$(E))); \
> >   )
> > -$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(CONFIG_UK_ARCH))) #
> architecture libraries
> > +$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY))) #
> architecture libraries
> >   include $(CONFIG_UK_BASE)/plat/Makefile.uk # platform libraries
> >   include $(CONFIG_UK_BASE)/lib/Makefile.uk # libraries
> >   include $(CONFIG_UK_BASE)/Makefile.uk # Unikraft base
> > diff --git a/arch/Config.uk b/arch/Config.uk
> > index 36df8d1..9236273 100644
> > --- a/arch/Config.uk
> > +++ b/arch/Config.uk
> > @@ -13,8 +13,8 @@ config ARCH_ARM_32
> >   endchoice
> >
> >   if (ARCH_X86_64)
> > -   source "arch/x86_64/Config.uk"
> > +   source "arch/x86/x86_64/Config.uk"
> >   endif
> >   if (ARCH_ARM_32)
> > -   source "arch/arm/Config.uk"
> > +   source "arch/arm/arm/Config.uk"
> >   endif
> > diff --git a/arch/arm/Compiler.uk b/arch/arm/Compiler.uk
> > index 44a497d..147f662 100644
> > --- a/arch/arm/Compiler.uk
> > +++ b/arch/arm/Compiler.uk
> > @@ -1,6 +1,3 @@
> > -# set cross compile
> > -ifeq ($(CONFIG_CROSS_COMPILE),)
> > -ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
> > -   CONFIG_CROSS_COMPILE := arm-linux-gnueabihf-
> > -endif
> > +ifeq ($(CONFIG_UK_ARCH),arm)
> > +   include $(CONFIG_UK_BASE)/arch/arm/arm/Compiler.uk
> >   endif
> > diff --git a/arch/arm/Makefile.uk b/arch/arm/Makefile.uk
> > index b746f70..e59b2a3 100644
> > --- a/arch/arm/Makefile.uk
> > +++ b/arch/arm/Makefile.uk
> > @@ -1,19 +1,4 @@
> > -ASFLAGS  += -D__ARM_32__
> > -ASFLAGS  += -marm
> > -CFLAGS   += -D__ARM_32__
> > -CFLAGS   += -marm -fms-extensions
> > -CXXFLAGS += -D__ARM_32__
> > -CXXFLAGS += -marm -fms-extensions
> > -
> > -#-march=armv7-a
> > -
> > -CFLAGS-$(CONFIG_MARCH_A20NEON)    += -mcpu=cortex-a7 -mtune=cortex-a7 -
> mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
> > -CXXFLAGS-$(CONFIG_MARCH_A20NEON)  += -mcpu=cortex-a7 -mtune=cortex-a7 -
> mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
> > -CFLAGS-$(CONFIG_MARCH_CORTEXA7)   += -mcpu=cortex-a7 -mtune=cortex-a7
> > -CXXFLAGS-$(CONFIG_MARCH_CORTEXA7) += -mcpu=cortex-a7 -mtune=cortex-a
> > -
> > -$(eval $(call addlib,libarmmath))
> > -LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/divsi3.S
> > -LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/ldivmod.S
> > -LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/ldivmod_helper.c
> > -LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/qdivrem.c
> > +# Include corresponding Makefiles for specified architechtures
> > +ifeq ($(CONFIG_UK_ARCH),arm)
> > +   include $(CONFIG_UK_BASE)/arch/arm/arm/Makefile.uk
> > +endif
> > diff --git a/arch/arm/arm/Compiler.uk b/arch/arm/arm/Compiler.uk
> > new file mode 100644
> > index 0000000..44a497d
> > --- /dev/null
> > +++ b/arch/arm/arm/Compiler.uk
> > @@ -0,0 +1,6 @@
> > +# set cross compile
> > +ifeq ($(CONFIG_CROSS_COMPILE),)
> > +ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
> > +   CONFIG_CROSS_COMPILE := arm-linux-gnueabihf-
> > +endif
> > +endif
> > diff --git a/arch/arm/Config.uk b/arch/arm/arm/Config.uk
> > similarity index 100%
> > rename from arch/arm/Config.uk
> > rename to arch/arm/arm/Config.uk
> > diff --git a/arch/arm/arm/Makefile.uk b/arch/arm/arm/Makefile.uk
> > new file mode 100644
> > index 0000000..b746f70
> > --- /dev/null
> > +++ b/arch/arm/arm/Makefile.uk
> > @@ -0,0 +1,19 @@
> > +ASFLAGS  += -D__ARM_32__
> > +ASFLAGS  += -marm
> > +CFLAGS   += -D__ARM_32__
> > +CFLAGS   += -marm -fms-extensions
> > +CXXFLAGS += -D__ARM_32__
> > +CXXFLAGS += -marm -fms-extensions
> > +
> > +#-march=armv7-a
> > +
> > +CFLAGS-$(CONFIG_MARCH_A20NEON)    += -mcpu=cortex-a7 -mtune=cortex-a7 -
> mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
> > +CXXFLAGS-$(CONFIG_MARCH_A20NEON)  += -mcpu=cortex-a7 -mtune=cortex-a7 -
> mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
> > +CFLAGS-$(CONFIG_MARCH_CORTEXA7)   += -mcpu=cortex-a7 -mtune=cortex-a7
> > +CXXFLAGS-$(CONFIG_MARCH_CORTEXA7) += -mcpu=cortex-a7 -mtune=cortex-a
> > +
> > +$(eval $(call addlib,libarmmath))
> > +LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/divsi3.S
> > +LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/ldivmod.S
> > +LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/ldivmod_helper.c
> > +LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) +=
> $(CONFIG_UK_BASE)/arch/arm/qdivrem.c
> > diff --git a/arch/arm/divsi3.S b/arch/arm/arm/divsi3.S
> > similarity index 97%
> > rename from arch/arm/divsi3.S
> > rename to arch/arm/arm/divsi3.S
> 
> I understand that you reorganize the folder, and this should just be a
> pure renaming. So why does the code is modified?
> 

I was curious about this before. Because in this file, there are
space characters at the end of lines in these files.

> > index fa92233..23edbf7 100644
> > --- a/arch/arm/divsi3.S
> > +++ b/arch/arm/arm/divsi3.S
> > @@ -20,7 +20,7 @@
> >
> >   #define END(symbol)
> >
> > -/*
> > +/*
> >    * stack is aligned as there's a possibility of branching to L_overflow
> >    * which makes a C call
> >    */
> > @@ -55,9 +55,9 @@ ENTRY_NP(__aeabi_uidivmod)
> >   #endif
> >   ENTRY_NP(__udivsi3)
> >   .L_udivide:                               /* r0 = r0 / r1; r1 = r0 % r1 */
> > -   eor     r0, r1, r0
> > -   eor     r1, r0, r1
> > -   eor     r0, r1, r0
> > +   eor     r0, r1, r0
> > +   eor     r1, r0, r1
> > +   eor     r0, r1, r0
> >                                     /* r0 = r1 / r0; r1 = r1 % r0 */
> >     cmp     r0, #1
> >     bcc     .L_overflow
> > @@ -86,9 +86,9 @@ ENTRY_NP(__aeabi_idivmod)
> >   #endif
> >   ENTRY_NP(__divsi3)
> >   .L_divide:                                /* r0 = r0 / r1; r1 = r0 % r1 */
> > -   eor     r0, r1, r0
> > -   eor     r1, r0, r1
> > -   eor     r0, r1, r0
> > +   eor     r0, r1, r0
> > +   eor     r1, r0, r1
> > +   eor     r0, r1, r0
> >                                     /* r0 = r1 / r0; r1 = r1 % r0 */
> >     cmp     r0, #1
> >     bcc     .L_overflow
> > @@ -107,7 +107,7 @@ ENTRY_NP(__divsi3)
> >
> >     /*
> >      * If the highest bit of the dividend is set, we have to be
> > -    * careful when shifting the divisor. Test this.
> > +    * careful when shifting the divisor. Test this.
> >      */
> >     movs    r1,r1
> >     bpl     .L_old_code
> > @@ -401,4 +401,3 @@ ENTRY_NP(__divsi3)
> >   END(__aeabi_idiv)
> >   END(__aeabi_idivmod)
> >   END(__divsi3)
> > -
> > diff --git a/arch/arm/ldivmod.S b/arch/arm/arm/ldivmod.S
> > similarity index 99%
> > rename from arch/arm/ldivmod.S
> > rename to arch/arm/arm/ldivmod.S
> 
> Same here.
> 
> > index 3c3083b..180227c 100644
> > --- a/arch/arm/ldivmod.S
> > +++ b/arch/arm/arm/ldivmod.S
> > @@ -34,7 +34,7 @@
> >
> >   /*
> >    * These calculate:
> > - * q = n / m
> > + * q = n / m
> >    * With a remainer r.
> >    *
> >    * They take n in {r0, r1} and m in {r2, r3} then pass them into the
> > diff --git a/arch/arm/ldivmod_helper.c b/arch/arm/arm/ldivmod_helper.c
> > similarity index 100%
> > rename from arch/arm/ldivmod_helper.c
> > rename to arch/arm/arm/ldivmod_helper.c
> > diff --git a/arch/arm/qdivrem.c b/arch/arm/arm/qdivrem.c
> > similarity index 100%
> > rename from arch/arm/qdivrem.c
> > rename to arch/arm/arm/qdivrem.c
> > diff --git a/arch/x86/Compiler.uk b/arch/x86/Compiler.uk
> > new file mode 100644
> > index 0000000..5f88bd3
> > --- /dev/null
> > +++ b/arch/x86/Compiler.uk
> > @@ -0,0 +1,4 @@
> > +# Include forward declarations by corresponding architecutes
> > +ifeq ($(CONFIG_ARCH_X86_64),y)
> > +   include $(CONFIG_UK_BASE)/arch/x86/x86_64/Compiler.uk
> > +endif
> > diff --git a/arch/x86/Makefile.uk b/arch/x86/Makefile.uk
> > new file mode 100644
> > index 0000000..cd0dfb9
> > --- /dev/null
> > +++ b/arch/x86/Makefile.uk
> > @@ -0,0 +1,4 @@
> > +# Include forward declarations by corresponding architecutes
> > +ifeq ($(CONFIG_ARCH_X86_64),y)
> > +   include $(CONFIG_UK_BASE)/arch/x86/x86_64/Makefile.uk
> > +endif
> > diff --git a/arch/x86_64/Compiler.uk b/arch/x86/x86_64/Compiler.uk
> > similarity index 100%
> > rename from arch/x86_64/Compiler.uk
> > rename to arch/x86/x86_64/Compiler.uk
> > diff --git a/arch/x86_64/Config.uk b/arch/x86/x86_64/Config.uk
> > similarity index 100%
> > rename from arch/x86_64/Config.uk
> > rename to arch/x86/x86_64/Config.uk
> > diff --git a/arch/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
> > similarity index 100%
> > rename from arch/x86_64/Makefile.uk
> > rename to arch/x86/x86_64/Makefile.uk
> >
> 
> Cheers,
> 
> --
> Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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