* [Buildroot] [PATCH v2 0/2] Generic MMU page size selection [not found] <CGME20211206192737eucas1p2f5cd4b11833868a8a965d39dbd3bf70a@eucas1p2.samsung.com> @ 2021-12-06 19:27 ` Łukasz Stelmach 2021-12-06 19:27 ` [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent Łukasz Stelmach 2021-12-06 19:27 ` [Buildroot] [PATCH v2 2/2] arch/arm: Make page size configurable on Aarch64 Łukasz Stelmach 0 siblings, 2 replies; 7+ messages in thread From: Łukasz Stelmach @ 2021-12-06 19:27 UTC (permalink / raw) To: buildroot Cc: ARC Maintainers, Łukasz Stelmach, Yann E. MORIN, Thomas Petazzoni, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski On some systems MMUs support more than one page size. It is OS kernel's task to choose the configuration during boot. Linux kernel can be compiled to support different page size. To run on a system with pages larger than 4 kB userland binaries need to be properly aligned during the linking process. However, binaries prepared for systems with larger pages can run on systems with smaller pages. Changes v1 -> v2: - make page size selection architecture-independent (needs architecture support to be declared) - add page size slection for Aarch64 in a separate patch Łukasz Stelmach (2): arch: Make page size configuration architecture-independent. arch/arm: Make page size configurable on Aarch64 arch/Config.in | 70 ++++++++++++++++++++++++++++++++++ arch/Config.in.arc | 38 ------------------ arch/arch.mk.arc | 9 ----- linux/linux.mk | 40 +++++++++++++------ package/uclibc/uclibc.mk | 2 +- toolchain/toolchain-wrapper.mk | 13 +++++++ 6 files changed, 112 insertions(+), 60 deletions(-) -- 2.30.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent. 2021-12-06 19:27 ` [Buildroot] [PATCH v2 0/2] Generic MMU page size selection Łukasz Stelmach @ 2021-12-06 19:27 ` Łukasz Stelmach 2021-12-06 20:30 ` Arnout Vandecappelle 2021-12-06 19:27 ` [Buildroot] [PATCH v2 2/2] arch/arm: Make page size configurable on Aarch64 Łukasz Stelmach 1 sibling, 1 reply; 7+ messages in thread From: Łukasz Stelmach @ 2021-12-06 19:27 UTC (permalink / raw) To: buildroot Cc: ARC Maintainers, Łukasz Stelmach, Yann E. MORIN, Thomas Petazzoni, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski Rename BR2_ARC_PAGE_SIZE_* to BR2_ARCH_MMU_PAGE_SIZE_* options. Add BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE and BR2_ARCH_HAS_MMU_PAGE_SIZE_* to control configuration option dependencies and visibility. Adapt existing ARC page size selection. Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> --- arch/Config.in | 64 ++++++++++++++++++++++++++++++++++ arch/Config.in.arc | 38 -------------------- arch/arch.mk.arc | 9 ----- linux/linux.mk | 27 +++++++------- package/uclibc/uclibc.mk | 2 +- toolchain/toolchain-wrapper.mk | 13 +++++++ 6 files changed, 93 insertions(+), 60 deletions(-) diff --git a/arch/Config.in b/arch/Config.in index 1853e26bb4..561d599561 100644 --- a/arch/Config.in +++ b/arch/Config.in @@ -24,6 +24,9 @@ choice config BR2_arcle bool "ARC (little endian)" select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K help Synopsys' DesignWare ARC Processor Cores are a family of 32-bit CPUs that can be used from deeply embedded to high @@ -32,6 +35,9 @@ config BR2_arcle config BR2_arceb bool "ARC (big endian)" select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K help Synopsys' DesignWare ARC Processor Cores are a family of 32-bit CPUs that can be used from deeply embedded to high @@ -426,6 +432,64 @@ config BR2_BINFMT_FLAT_SHARED endchoice +config BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + bool + +config BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + bool + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + +config BR2_ARCH_HAS_MMU_PAGE_SIZE_8K + bool + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + +config BR2_ARCH_HAS_MMU_PAGE_SIZE_16K + bool + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + +config BR2_ARCH_HAS_MMU_PAGE_SIZE_32K + bool + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + +config BR2_ARCH_HAS_MMU_PAGE_SIZE_64K + bool + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + +choice + prompt "MMU Page Size" + depends on BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE + help + Choose MMU page size + +config BR2_ARCH_MMU_PAGE_SIZE_4K + bool "4K" + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + +config BR2_ARCH_MMU_PAGE_SIZE_8K + bool "8K" + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_8K + +config BR2_ARCH_MMU_PAGE_SIZE_16K + bool "16K" + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_16K + +config BR2_ARCH_MMU_PAGE_SIZE_32K + bool "32K" + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_32K + +config BR2_ARCH_MMU_PAGE_SIZE_64K + bool "64K" + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_64K +endchoice + +config BR2_ARCH_MMU_PAGE_SIZE + string + default "4K" if BR2_ARCH_MMU_PAGE_SIZE_4K + default "8K" if BR2_ARCH_MMU_PAGE_SIZE_4K + default "16K" if BR2_ARCH_MMU_PAGE_SIZE_16K + default "32K" if BR2_ARCH_MMU_PAGE_SIZE_32K + default "64K" if BR2_ARCH_MMU_PAGE_SIZE_64K + if BR2_arcle || BR2_arceb source "arch/Config.in.arc" endif diff --git a/arch/Config.in.arc b/arch/Config.in.arc index f7a6d920b5..c82a580c5b 100644 --- a/arch/Config.in.arc +++ b/arch/Config.in.arc @@ -84,43 +84,5 @@ config BR2_READELF_ARCH_NAME default "ARCv2" if BR2_archs38 || BR2_archs38_64mpy || BR2_archs38_full default "ARCv2" if BR2_archs4x_rel31 || BR2_archs4x -choice - prompt "MMU Page Size" - default BR2_ARC_PAGE_SIZE_8K - help - MMU starting from version 3 (found in ARC 770) and now - version 4 (found in ARC HS38) allows the selection of the - page size during ASIC design creation. - - The following options are available for MMU v3 and v4: 4kB, - 8kB and 16 kB. - - The default is 8 kB (that really matches the only page size - in MMU v2). It is important to build a toolchain with page - size matching the hardware configuration. Otherwise - user-space applications will fail at runtime. - -config BR2_ARC_PAGE_SIZE_4K - bool "4KB" - depends on !BR2_arc750d - -config BR2_ARC_PAGE_SIZE_8K - bool "8KB" - help - This is the one and only option available for MMUv2 and - default value for MMU v3 and v4. - -config BR2_ARC_PAGE_SIZE_16K - bool "16KB" - depends on !BR2_arc750d - -endchoice - -config BR2_ARC_PAGE_SIZE - string - default "4K" if BR2_ARC_PAGE_SIZE_4K - default "8K" if BR2_ARC_PAGE_SIZE_8K - default "16K" if BR2_ARC_PAGE_SIZE_16K - # vim: ft=kconfig # -*- mode:kconfig; -*- diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc index 32b818b0e0..a6b56a869f 100644 --- a/arch/arch.mk.arc +++ b/arch/arch.mk.arc @@ -5,13 +5,4 @@ ifeq ($(BR2_ARC_ATOMIC_EXT),y) ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic endif -# Explicitly set LD's "max-page-size" instead of relying on some defaults -ifeq ($(BR2_ARC_PAGE_SIZE_4K),y) -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 -else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y) -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 -else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y) -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 -endif - endif diff --git a/linux/linux.mk b/linux/linux.mk index 61fdc0c76c..e66e0db52f 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -328,18 +328,21 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) - $(if $(BR2_ARC_PAGE_SIZE_4K), - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) - $(if $(BR2_ARC_PAGE_SIZE_8K), - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) - $(if $(BR2_ARC_PAGE_SIZE_16K), - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) + $(if $(BR2_ARCH_MMU_PAGE_SIZE_4K), + $(if $(BR2_arcle)$(BR2_arcbe), + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) + $(if $(BR2_ARCH_MMU_PAGE_SIZE_8K), + $(if $(BR2_arcle)$(BR2_arcbe), + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) + $(if $(BR2_ARCH_MMU_PAGE_SIZE_16K), + $(if $(BR2_arcle)$(BR2_arcbe), + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) $(if $(BR2_TARGET_ROOTFS_CPIO), $(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD)) # As the kernel gets compiled before root filesystems are diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk index 87e283de2a..e6699b74b8 100644 --- a/package/uclibc/uclibc.mk +++ b/package/uclibc/uclibc.mk @@ -78,7 +78,7 @@ endif # ifeq ($(UCLIBC_TARGET_ARCH),arc) -UCLIBC_ARC_PAGE_SIZE = CONFIG_ARC_PAGE_SIZE_$(call qstrip,$(BR2_ARC_PAGE_SIZE)) +UCLIBC_ARC_PAGE_SIZE = CONFIG_ARCH_MMU_PAGE_SIZE_$(call qstrip,$(BR2_ARCH_MMU_PAGE_SIZE)) define UCLIBC_ARC_PAGE_SIZE_CONFIG $(SED) '/CONFIG_ARC_PAGE_SIZE_*/d' $(@D)/.config $(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARC_PAGE_SIZE)) diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index 8b551e3a18..a8564441b5 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -90,3 +90,16 @@ define TOOLCHAIN_WRAPPER_INSTALL $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ $(HOST_DIR)/bin/toolchain-wrapper endef + +# Explicitly set LD's "max-page-size" instead of relying on some defaults +ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_4K),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_8K),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_16K),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_32K),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=32768 +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_64K),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 +endif -- 2.30.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent. 2021-12-06 19:27 ` [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent Łukasz Stelmach @ 2021-12-06 20:30 ` Arnout Vandecappelle 2021-12-06 21:23 ` Yann E. MORIN 0 siblings, 1 reply; 7+ messages in thread From: Arnout Vandecappelle @ 2021-12-06 20:30 UTC (permalink / raw) To: Łukasz Stelmach, buildroot Cc: ARC Maintainers, Yann E. MORIN, Thomas Petazzoni, Giulio Benetti, Romain Naour, Thomas De Schampheleire, Marek Szyprowski Hi Łukasz, Thank you for this patch! Since it's a bit an invasive feature, it might not get merged easily. On 06/12/2021 20:27, Łukasz Stelmach wrote: > Rename BR2_ARC_PAGE_SIZE_* to BR2_ARCH_MMU_PAGE_SIZE_* options. My first reaction was: this is probably going to be limited to a very small number of architectures, so maybe it shouldn't be a generic option (especially since the kernel config changes are anyway still arch specific). However, it turns out that mips, powerpc and sh also support several page sizes (as well as a few other arches that we don't support). And I can imagine that riscv may get this feature at some point as well. So, the generic approach is probably right after all. > > Add BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE and > BR2_ARCH_HAS_MMU_PAGE_SIZE_* to control configuration option dependencies > and visibility. > > Adapt existing ARC page size selection. > > Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr> > Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> > --- > arch/Config.in | 64 ++++++++++++++++++++++++++++++++++ > arch/Config.in.arc | 38 -------------------- > arch/arch.mk.arc | 9 ----- > linux/linux.mk | 27 +++++++------- > package/uclibc/uclibc.mk | 2 +- > toolchain/toolchain-wrapper.mk | 13 +++++++ > 6 files changed, 93 insertions(+), 60 deletions(-) > > diff --git a/arch/Config.in b/arch/Config.in > index 1853e26bb4..561d599561 100644 > --- a/arch/Config.in > +++ b/arch/Config.in > @@ -24,6 +24,9 @@ choice > config BR2_arcle > bool "ARC (little endian)" > select BR2_ARCH_HAS_MMU_MANDATORY > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > help > Synopsys' DesignWare ARC Processor Cores are a family of > 32-bit CPUs that can be used from deeply embedded to high > @@ -32,6 +35,9 @@ config BR2_arcle > config BR2_arceb > bool "ARC (big endian)" > select BR2_ARCH_HAS_MMU_MANDATORY > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > help > Synopsys' DesignWare ARC Processor Cores are a family of > 32-bit CPUs that can be used from deeply embedded to high > @@ -426,6 +432,64 @@ config BR2_BINFMT_FLAT_SHARED > > endchoice > > +config BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + bool > + > +config BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > + bool > + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + > +config BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > + bool > + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + > +config BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > + bool > + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + > +config BR2_ARCH_HAS_MMU_PAGE_SIZE_32K > + bool > + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + > +config BR2_ARCH_HAS_MMU_PAGE_SIZE_64K > + bool > + select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + > +choice > + prompt "MMU Page Size" > + depends on BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > + help > + Choose MMU page size > + > +config BR2_ARCH_MMU_PAGE_SIZE_4K > + bool "4K" > + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > + > +config BR2_ARCH_MMU_PAGE_SIZE_8K > + bool "8K" > + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > + > +config BR2_ARCH_MMU_PAGE_SIZE_16K > + bool "16K" > + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > + > +config BR2_ARCH_MMU_PAGE_SIZE_32K > + bool "32K" > + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_32K > + > +config BR2_ARCH_MMU_PAGE_SIZE_64K > + bool "64K" > + depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_64K > +endchoice > + > +config BR2_ARCH_MMU_PAGE_SIZE > + string > + default "4K" if BR2_ARCH_MMU_PAGE_SIZE_4K > + default "8K" if BR2_ARCH_MMU_PAGE_SIZE_4K > + default "16K" if BR2_ARCH_MMU_PAGE_SIZE_16K > + default "32K" if BR2_ARCH_MMU_PAGE_SIZE_32K > + default "64K" if BR2_ARCH_MMU_PAGE_SIZE_64K > + > if BR2_arcle || BR2_arceb > source "arch/Config.in.arc" > endif > diff --git a/arch/Config.in.arc b/arch/Config.in.arc > index f7a6d920b5..c82a580c5b 100644 > --- a/arch/Config.in.arc > +++ b/arch/Config.in.arc > @@ -84,43 +84,5 @@ config BR2_READELF_ARCH_NAME > default "ARCv2" if BR2_archs38 || BR2_archs38_64mpy || BR2_archs38_full > default "ARCv2" if BR2_archs4x_rel31 || BR2_archs4x > > -choice > - prompt "MMU Page Size" > - default BR2_ARC_PAGE_SIZE_8K This default is lost with this change. Since MMU_PAGE_SIZE is a choice, the only thing you can do really is add a per-architecture default in that choice. > - help > - MMU starting from version 3 (found in ARC 770) and now > - version 4 (found in ARC HS38) allows the selection of the > - page size during ASIC design creation. > - > - The following options are available for MMU v3 and v4: 4kB, > - 8kB and 16 kB. > - > - The default is 8 kB (that really matches the only page size > - in MMU v2). It is important to build a toolchain with page > - size matching the hardware configuration. Otherwise > - user-space applications will fail at runtime. This help text is also lost, which is unfortunate. > - > -config BR2_ARC_PAGE_SIZE_4K When a user-selectable option is removed, legacy handling is required for it. See the documentation at the top of Config.in.legacy. For choices, that's a bit complicated... > - bool "4KB" > - depends on !BR2_arc750d This dependency is also lost. Since so much is lost with this generalisation, I think a better approach is to keep the user-visible MMU size selection architecture-specific, and restrict the generic part to blind symbols. So basically: - BR2_ARCH_MMU_PAGE_SIZE_* become blind options; - they're plain options, not in a choice; - the only thing that changes in Config.in.arc is that the different options select one of BR2_ARCH_MMU_PAGE_SIZE_*; - most of the .mk files don't need to be changed either (see below). > - > -config BR2_ARC_PAGE_SIZE_8K > - bool "8KB" > - help > - This is the one and only option available for MMUv2 and > - default value for MMU v3 and v4. > - > -config BR2_ARC_PAGE_SIZE_16K > - bool "16KB" > - depends on !BR2_arc750d > - > -endchoice > - > -config BR2_ARC_PAGE_SIZE > - string > - default "4K" if BR2_ARC_PAGE_SIZE_4K > - default "8K" if BR2_ARC_PAGE_SIZE_8K > - default "16K" if BR2_ARC_PAGE_SIZE_16K > - > # vim: ft=kconfig > # -*- mode:kconfig; -*- > diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc > index 32b818b0e0..a6b56a869f 100644 > --- a/arch/arch.mk.arc > +++ b/arch/arch.mk.arc > @@ -5,13 +5,4 @@ ifeq ($(BR2_ARC_ATOMIC_EXT),y) > ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic > endif > > -# Explicitly set LD's "max-page-size" instead of relying on some defaults > -ifeq ($(BR2_ARC_PAGE_SIZE_4K),y) > -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 > -else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y) > -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 > -else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y) > -ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 > -endif > - > endif > diff --git a/linux/linux.mk b/linux/linux.mk > index 61fdc0c76c..e66e0db52f 100644 > --- a/linux/linux.mk > +++ b/linux/linux.mk > @@ -328,18 +328,21 @@ define LINUX_KCONFIG_FIXUP_CMDS > $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) > $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), > $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) > - $(if $(BR2_ARC_PAGE_SIZE_4K), > - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) With my proposal, this can be kept as well. The kernel options are anyway arch-specific, so it's simpler to use the arch-specific boolean than the generic one. > - $(if $(BR2_ARC_PAGE_SIZE_8K), > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) > - $(if $(BR2_ARC_PAGE_SIZE_16K), > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) > + $(if $(BR2_ARCH_MMU_PAGE_SIZE_4K), > + $(if $(BR2_arcle)$(BR2_arcbe), > + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > + $(if $(BR2_ARCH_MMU_PAGE_SIZE_8K), > + $(if $(BR2_arcle)$(BR2_arcbe), > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > + $(if $(BR2_ARCH_MMU_PAGE_SIZE_16K), > + $(if $(BR2_arcle)$(BR2_arcbe), > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > + $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > + $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > $(if $(BR2_TARGET_ROOTFS_CPIO), > $(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD)) > # As the kernel gets compiled before root filesystems are > diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk > index 87e283de2a..e6699b74b8 100644 > --- a/package/uclibc/uclibc.mk > +++ b/package/uclibc/uclibc.mk > @@ -78,7 +78,7 @@ endif > # > > ifeq ($(UCLIBC_TARGET_ARCH),arc) > -UCLIBC_ARC_PAGE_SIZE = CONFIG_ARC_PAGE_SIZE_$(call qstrip,$(BR2_ARC_PAGE_SIZE)) > +UCLIBC_ARC_PAGE_SIZE = CONFIG_ARCH_MMU_PAGE_SIZE_$(call qstrip,$(BR2_ARCH_MMU_PAGE_SIZE)) This is also only for ARC so can stay as is. Which means that BR2_ARCH_MMU_PAGE_SIZE can be removed as well. > define UCLIBC_ARC_PAGE_SIZE_CONFIG > $(SED) '/CONFIG_ARC_PAGE_SIZE_*/d' $(@D)/.config > $(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARC_PAGE_SIZE)) > diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk > index 8b551e3a18..a8564441b5 100644 > --- a/toolchain/toolchain-wrapper.mk > +++ b/toolchain/toolchain-wrapper.mk > @@ -90,3 +90,16 @@ define TOOLCHAIN_WRAPPER_INSTALL > $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ > $(HOST_DIR)/bin/toolchain-wrapper > endef > + > +# Explicitly set LD's "max-page-size" instead of relying on some defaults > +ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_4K),y) > +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 > +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_8K),y) > +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 > +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_16K),y) > +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 > +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_32K),y) > +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=32768 > +else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_64K),y) > +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 > +endif This is the only generic part that would remain. Regards, Arnout _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent. 2021-12-06 20:30 ` Arnout Vandecappelle @ 2021-12-06 21:23 ` Yann E. MORIN 2021-12-06 21:33 ` Arnout Vandecappelle 2021-12-06 22:26 ` Lukasz Stelmach 0 siblings, 2 replies; 7+ messages in thread From: Yann E. MORIN @ 2021-12-06 21:23 UTC (permalink / raw) To: Arnout Vandecappelle Cc: ARC Maintainers, Łukasz Stelmach, Thomas Petazzoni, buildroot, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski Arnout, All, On 2021-12-06 21:30 +0100, Arnout Vandecappelle spake thusly: > Thank you for this patch! Since it's a bit an invasive feature, it might > not get merged easily. Yeah, I have already been looking into it, and will do a proper review "asap". In the meantime, the easy low-hanging fruits, see below... > On 06/12/2021 20:27, Łukasz Stelmach wrote: > >Rename BR2_ARC_PAGE_SIZE_* to BR2_ARCH_MMU_PAGE_SIZE_* options. > > My first reaction was: this is probably going to be limited to a very small > number of architectures, so maybe it shouldn't be a generic option I was the one to ask for a generic solution, since Łukasz' v1 was basically duplicating the code from arc to arm. > (especially since the kernel config changes are anyway still arch specific). > However, it turns out that mips, powerpc and sh also support several page > sizes (as well as a few other arches that we don't support). And I can > imagine that riscv may get this feature at some point as well. So, the > generic approach is probably right after all. Yeah, that was also my (inner-mind) analysis which prompted the generic solution. > >Add BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE and > >BR2_ARCH_HAS_MMU_PAGE_SIZE_* to control configuration option dependencies > >and visibility. > > > >Adapt existing ARC page size selection. > > > >Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr> > >Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> > >--- > > arch/Config.in | 64 ++++++++++++++++++++++++++++++++++ > > arch/Config.in.arc | 38 -------------------- > > arch/arch.mk.arc | 9 ----- > > linux/linux.mk | 27 +++++++------- > > package/uclibc/uclibc.mk | 2 +- > > toolchain/toolchain-wrapper.mk | 13 +++++++ > > 6 files changed, 93 insertions(+), 60 deletions(-) > > > >diff --git a/arch/Config.in b/arch/Config.in > >index 1853e26bb4..561d599561 100644 > >--- a/arch/Config.in > >+++ b/arch/Config.in > >@@ -24,6 +24,9 @@ choice > > config BR2_arcle > > bool "ARC (little endian)" > > select BR2_ARCH_HAS_MMU_MANDATORY > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K The arc750d does not support 4K or 16K page sizes. So, as I suggested in the review of v1, the above should be: select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K if !BR2_arc750d select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K if !BR2_arc750d (ditto for BR2_arceb) > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > > help > > Synopsys' DesignWare ARC Processor Cores are a family of > > 32-bit CPUs that can be used from deeply embedded to high > >@@ -32,6 +35,9 @@ config BR2_arcle > > config BR2_arceb > > bool "ARC (big endian)" > > select BR2_ARCH_HAS_MMU_MANDATORY > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > >+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > > help > > Synopsys' DesignWare ARC Processor Cores are a family of > > 32-bit CPUs that can be used from deeply embedded to high > >@@ -426,6 +432,64 @@ config BR2_BINFMT_FLAT_SHARED > > endchoice > >+config BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ bool > >+ > >+config BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > >+ bool > >+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ > >+config BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > >+ bool > >+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ > >+config BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > >+ bool > >+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ > >+config BR2_ARCH_HAS_MMU_PAGE_SIZE_32K > >+ bool > >+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ > >+config BR2_ARCH_HAS_MMU_PAGE_SIZE_64K > >+ bool > >+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE Limit the churn in this patach by just making the transition from arc to generic options. We can add more entries (32K, 64K) when we make an new architecture use it. For example, next patch would add 64K for Aarch64 (32K would still not be introduced because Aarch64 does not have 64K pages). > >+choice > >+ prompt "MMU Page Size" > >+ depends on BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE > >+ help > >+ Choose MMU page size > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE_4K > >+ bool "4K" > >+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_4K > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE_8K > >+ bool "8K" > >+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_8K > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE_16K > >+ bool "16K" > >+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_16K > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE_32K > >+ bool "32K" > >+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_32K > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE_64K > >+ bool "64K" > >+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_64K > >+endchoice > >+ > >+config BR2_ARCH_MMU_PAGE_SIZE > >+ string > >+ default "4K" if BR2_ARCH_MMU_PAGE_SIZE_4K > >+ default "8K" if BR2_ARCH_MMU_PAGE_SIZE_4K > >+ default "16K" if BR2_ARCH_MMU_PAGE_SIZE_16K > >+ default "32K" if BR2_ARCH_MMU_PAGE_SIZE_32K > >+ default "64K" if BR2_ARCH_MMU_PAGE_SIZE_64K > >+ > > if BR2_arcle || BR2_arceb > > source "arch/Config.in.arc" > > endif > >diff --git a/arch/Config.in.arc b/arch/Config.in.arc > >index f7a6d920b5..c82a580c5b 100644 > >--- a/arch/Config.in.arc > >+++ b/arch/Config.in.arc > >@@ -84,43 +84,5 @@ config BR2_READELF_ARCH_NAME > > default "ARCv2" if BR2_archs38 || BR2_archs38_64mpy || BR2_archs38_full > > default "ARCv2" if BR2_archs4x_rel31 || BR2_archs4x > >-choice > >- prompt "MMU Page Size" We do not use 'prompt' but we do define the type and use that to define the prompt: choice bool "MMU Page Size" > >- default BR2_ARC_PAGE_SIZE_8K > > This default is lost with this change. Since MMU_PAGE_SIZE is a choice, the > only thing you can do really is add a per-architecture default in that > choice. This default thing is a bit difficult to handle nicely. If we wnated to add proper infra for it, we'd need to introduce BR2_ARCH_MMU_PREFERS_4K or BR2_ARCH_MMU_PREFERS_8K and so on: config BR2_ARCH_MMU_PREFERS_4K bool # To force selector to also depend on it: depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_4K config BR2_ARCH_MMU_PREFERS_8K bool # To force selector to also depend on it: depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_8K which would be used like: config BR2_arcle bool "arcle" select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K if !BR2_arc750d select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K if !BR2_arc750d select BR2_ARCH_MMU_PREFERS_8K And then that would be used in the choice: choice bool "MMU Page Size" default BR2_ARCH_MMU_PAGE_SIZE_4K if BR2_ARCH_MMU_PREFERS_4K default BR2_ARCH_MMU_PAGE_SIZE_8K if BR2_ARCH_MMU_PREFERS_8K # and so on... [...] endchoice > >- help > >- MMU starting from version 3 (found in ARC 770) and now > >- version 4 (found in ARC HS38) allows the selection of the > >- page size during ASIC design creation. > >- > >- The following options are available for MMU v3 and v4: 4kB, > >- 8kB and 16 kB. > >- > >- The default is 8 kB (that really matches the only page size > >- in MMU v2). It is important to build a toolchain with page > >- size matching the hardware configuration. Otherwise > >- user-space applications will fail at runtime. > > This help text is also lost, which is unfortunate. > > >- > >-config BR2_ARC_PAGE_SIZE_4K > > When a user-selectable option is removed, legacy handling is required for > it. See the documentation at the top of Config.in.legacy. For choices, > that's a bit complicated... Yeah, that's not totally easy, but we already have a few cases... > >- bool "4KB" > >- depends on !BR2_arc750d > > This dependency is also lost. > > Since so much is lost with this generalisation, I think a better approach > is to keep the user-visible MMU size selection architecture-specific, and > restrict the generic part to blind symbols. So basically: > > - BR2_ARCH_MMU_PAGE_SIZE_* become blind options; > - they're plain options, not in a choice; > - the only thing that changes in Config.in.arc is that the different options > select one of BR2_ARCH_MMU_PAGE_SIZE_*; > - most of the .mk files don't need to be changed either (see below). Hmm... > >-config BR2_ARC_PAGE_SIZE_8K > >- bool "8KB" > >- help > >- This is the one and only option available for MMUv2 and > >- default value for MMU v3 and v4. > >- > >-config BR2_ARC_PAGE_SIZE_16K > >- bool "16KB" > >- depends on !BR2_arc750d > >- > >-endchoice > >- > >-config BR2_ARC_PAGE_SIZE > >- string > >- default "4K" if BR2_ARC_PAGE_SIZE_4K > >- default "8K" if BR2_ARC_PAGE_SIZE_8K > >- default "16K" if BR2_ARC_PAGE_SIZE_16K > >- > > # vim: ft=kconfig > > # -*- mode:kconfig; -*- > >diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc > >index 32b818b0e0..a6b56a869f 100644 > >--- a/arch/arch.mk.arc > >+++ b/arch/arch.mk.arc > >@@ -5,13 +5,4 @@ ifeq ($(BR2_ARC_ATOMIC_EXT),y) > > ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic > > endif > >-# Explicitly set LD's "max-page-size" instead of relying on some defaults > >-ifeq ($(BR2_ARC_PAGE_SIZE_4K),y) > >-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 > >-else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y) > >-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 > >-else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y) > >-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 > >-endif > >- > > endif > >diff --git a/linux/linux.mk b/linux/linux.mk > >index 61fdc0c76c..e66e0db52f 100644 > >--- a/linux/linux.mk > >+++ b/linux/linux.mk > >@@ -328,18 +328,21 @@ define LINUX_KCONFIG_FIXUP_CMDS > > $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) > > $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), > > $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) > >- $(if $(BR2_ARC_PAGE_SIZE_4K), > >- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) > > With my proposal, this can be kept as well. The kernel options are anyway > arch-specific, so it's simpler to use the arch-specific boolean than the > generic one. Actually, I think this huge list should move to the individual architectures. Like we have a mean for packages to provide kernel options, we should introduce the same for architectures. This way, it becomes easier to maintain (I think) rather than this huge mess... > >- $(if $(BR2_ARC_PAGE_SIZE_8K), > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) > >- $(if $(BR2_ARC_PAGE_SIZE_16K), > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) > >+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_4K), > >+ $(if $(BR2_arcle)$(BR2_arcbe), > >+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > >+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_8K), > >+ $(if $(BR2_arcle)$(BR2_arcbe), > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > >+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_16K), > >+ $(if $(BR2_arcle)$(BR2_arcbe), > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) > >+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) > >+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) > > $(if $(BR2_TARGET_ROOTFS_CPIO), > > $(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD)) > > # As the kernel gets compiled before root filesystems are > >diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk > >index 87e283de2a..e6699b74b8 100644 > >--- a/package/uclibc/uclibc.mk > >+++ b/package/uclibc/uclibc.mk > >@@ -78,7 +78,7 @@ endif > > # > > ifeq ($(UCLIBC_TARGET_ARCH),arc) > >-UCLIBC_ARC_PAGE_SIZE = CONFIG_ARC_PAGE_SIZE_$(call qstrip,$(BR2_ARC_PAGE_SIZE)) > >+UCLIBC_ARC_PAGE_SIZE = CONFIG_ARCH_MMU_PAGE_SIZE_$(call qstrip,$(BR2_ARCH_MMU_PAGE_SIZE)) > > This is also only for ARC so can stay as is. Which means that > BR2_ARCH_MMU_PAGE_SIZE can be removed as well. > > > define UCLIBC_ARC_PAGE_SIZE_CONFIG > > $(SED) '/CONFIG_ARC_PAGE_SIZE_*/d' $(@D)/.config > > $(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARC_PAGE_SIZE)) > >diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk > >index 8b551e3a18..a8564441b5 100644 > >--- a/toolchain/toolchain-wrapper.mk > >+++ b/toolchain/toolchain-wrapper.mk > >@@ -90,3 +90,16 @@ define TOOLCHAIN_WRAPPER_INSTALL > > $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \ > > $(HOST_DIR)/bin/toolchain-wrapper > > endef > >+ > >+# Explicitly set LD's "max-page-size" instead of relying on some defaults > >+ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_4K),y) > >+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 > >+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_8K),y) > >+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 > >+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_16K),y) > >+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 > >+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_32K),y) > >+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=32768 > >+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_64K),y) > >+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 > >+endif > > This is the only generic part that would remain. Yeah, I think this is probably a good middle grund, in the end... Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent. 2021-12-06 21:23 ` Yann E. MORIN @ 2021-12-06 21:33 ` Arnout Vandecappelle 2021-12-06 22:26 ` Lukasz Stelmach 1 sibling, 0 replies; 7+ messages in thread From: Arnout Vandecappelle @ 2021-12-06 21:33 UTC (permalink / raw) To: Yann E. MORIN Cc: ARC Maintainers, Łukasz Stelmach, Thomas Petazzoni, buildroot, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski On 06/12/2021 22:23, Yann E. MORIN wrote: >>> diff --git a/linux/linux.mk b/linux/linux.mk >>> index 61fdc0c76c..e66e0db52f 100644 >>> --- a/linux/linux.mk >>> +++ b/linux/linux.mk >>> @@ -328,18 +328,21 @@ define LINUX_KCONFIG_FIXUP_CMDS >>> $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI)) >>> $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), >>> $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) >>> - $(if $(BR2_ARC_PAGE_SIZE_4K), >>> - $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) >>> - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) >>> - $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)) >> With my proposal, this can be kept as well. The kernel options are anyway >> arch-specific, so it's simpler to use the arch-specific boolean than the >> generic one. > Actually, I think this huge list should move to the individual > architectures. > > Like we have a mean for packages to provide kernel options, we should > introduce the same for architectures. > > This way, it becomes easier to maintain (I think) rather than this huge > mess... At the moment, there are just 3 architecture-specific kernel options: AEABI, POWERPC_DISABLE_WERROR, and ARC_PAGE_SIZE_*. Not exactly a huge mess IMHO. And also IMHO, moving it to arch just increases the mess: for packages, the kernel option usually have to be set whenever the package is selected, so FOO_LINUX_CONFIG_FIXUPS can work. However, for the arch-specific fixups, they're always conditional on something else than the mere arch, so you still need conditionals in there... You could indeed add them to PACKAGES_LINUX_CONFIG_FIXUPS directly in the arch.mk, but in terms of lines of code it really doesn't look better. Also in terms of keeping things together it's not better: this is something related to both linux and arch, so you can't ever put it in the "correct" place. Regards, Arnout _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent. 2021-12-06 21:23 ` Yann E. MORIN 2021-12-06 21:33 ` Arnout Vandecappelle @ 2021-12-06 22:26 ` Lukasz Stelmach 1 sibling, 0 replies; 7+ messages in thread From: Lukasz Stelmach @ 2021-12-06 22:26 UTC (permalink / raw) To: Yann E. MORIN, Arnout Vandecappelle Cc: ARC Maintainers, Thomas Petazzoni, buildroot, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski [-- Attachment #1.1: Type: text/plain, Size: 795 bytes --] It was <2021-12-06 pon 22:23>, when Yann E. MORIN wrote: > Arnout, All, > > On 2021-12-06 21:30 +0100, Arnout Vandecappelle spake thusly: >> Thank you for this patch! Since it's a bit an invasive feature, it might >> not get merged easily. > > Yeah, I have already been looking into it, and will do a proper review > "asap". In the meantime, the easy low-hanging fruits, see below... > No need for asap at all (-; These patches are a byproduct of my work where I use BR. I am willing to make them mergeable, but I can't work on them full-time and I will be more than grateful for your detailed advice. I am completely new here and know next to nothing about BR concepts of doing stuff. Kind regards, -- Łukasz Stelmach Samsung R&D Institute Poland Samsung Electronics [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] [-- Attachment #2: Type: text/plain, Size: 150 bytes --] _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v2 2/2] arch/arm: Make page size configurable on Aarch64 2021-12-06 19:27 ` [Buildroot] [PATCH v2 0/2] Generic MMU page size selection Łukasz Stelmach 2021-12-06 19:27 ` [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent Łukasz Stelmach @ 2021-12-06 19:27 ` Łukasz Stelmach 1 sibling, 0 replies; 7+ messages in thread From: Łukasz Stelmach @ 2021-12-06 19:27 UTC (permalink / raw) To: buildroot Cc: ARC Maintainers, Łukasz Stelmach, Yann E. MORIN, Thomas Petazzoni, Romain Naour, Giulio Benetti, Thomas De Schampheleire, Marek Szyprowski Select BR2_ARCH_HAS_MMU_PAGE_SIZE_{4,16,64}K from BR2_aarch64{,_be}. Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> --- arch/Config.in | 6 ++++++ linux/linux.mk | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/Config.in b/arch/Config.in index 561d599561..2f20cfb268 100644 --- a/arch/Config.in +++ b/arch/Config.in @@ -67,6 +67,9 @@ config BR2_aarch64 bool "AArch64 (little endian)" select BR2_ARCH_IS_64 select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_64K help Aarch64 is a 64-bit architecture developed by ARM Holdings. http://www.arm.com/products/processors/instruction-set-architectures/armv8-architecture.php @@ -76,6 +79,9 @@ config BR2_aarch64_be bool "AArch64 (big endian)" select BR2_ARCH_IS_64 select BR2_ARCH_HAS_MMU_MANDATORY + select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K + select BR2_ARCH_HAS_MMU_PAGE_SIZE_64K help Aarch64 is a 64-bit architecture developed by ARM Holdings. http://www.arm.com/products/processors/instruction-set-architectures/armv8-architecture.php diff --git a/linux/linux.mk b/linux/linux.mk index e66e0db52f..20b1be3be5 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -329,6 +329,10 @@ define LINUX_KCONFIG_FIXUP_CMDS $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le), $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR)) $(if $(BR2_ARCH_MMU_PAGE_SIZE_4K), + $(if $(BR2_aarch64)$(BR2_aarch64_be), + $(call KCONFIG_ENABLE_OPT,CONFIG_ARM64_4K_PAGES) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARM64_16K_PAGES) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARM64_64K_PAGES)) $(if $(BR2_arcle)$(BR2_arcbe), $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) @@ -339,10 +343,19 @@ define LINUX_KCONFIG_FIXUP_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) $(if $(BR2_ARCH_MMU_PAGE_SIZE_16K), + $(if $(BR2_aarch64)$(BR2_aarch64_be), + $(call KCONFIG_DISABLEOPT,CONFIG_ARM64_4K_PAGES) + $(call KCONFIG_ENABLE_OPT,CONFIG_ARM64_16K_PAGES)) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARM64_64K_PAGES) $(if $(BR2_arcle)$(BR2_arcbe), $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K) $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K) $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))) + $(if $(BR2_ARCH_MMU_PAGE_SIZE_64K), + $(if $(BR2_aarch64)$(BR2_aarch64_be), + $(call KCONFIG_DISABLEOPT,CONFIG_ARM64_4K_PAGES) + $(call KCONFIG_DISABLE_OPT,CONFIG_ARM64_16K_PAGES)) + $(call KCONFIG_ENABLE_OPT,CONFIG_ARM64_64K_PAGES)) $(if $(BR2_TARGET_ROOTFS_CPIO), $(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD)) # As the kernel gets compiled before root filesystems are -- 2.30.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-06 22:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20211206192737eucas1p2f5cd4b11833868a8a965d39dbd3bf70a@eucas1p2.samsung.com>
2021-12-06 19:27 ` [Buildroot] [PATCH v2 0/2] Generic MMU page size selection Łukasz Stelmach
2021-12-06 19:27 ` [Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent Łukasz Stelmach
2021-12-06 20:30 ` Arnout Vandecappelle
2021-12-06 21:23 ` Yann E. MORIN
2021-12-06 21:33 ` Arnout Vandecappelle
2021-12-06 22:26 ` Lukasz Stelmach
2021-12-06 19:27 ` [Buildroot] [PATCH v2 2/2] arch/arm: Make page size configurable on Aarch64 Łukasz Stelmach
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox