* [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 @ 2022-03-30 14:34 Ben Westover 2022-03-30 15:31 ` Masahiro Yamada 0 siblings, 1 reply; 5+ messages in thread From: Ben Westover @ 2022-03-30 14:34 UTC (permalink / raw) To: linux-kernel, linux-kbuild, masahiroy, michal.lkml, ndesaulniers [-- Attachment #1.1: Type: text/plain, Size: 790 bytes --] When riscv64 or riscv32 are used as the value for ARCH during compilation, like in tools that get the ARCH value from uname, set SRCARCH to riscv instead of failing because the riscv64 and riscv32 targets don't exist. Signed-off-by: Ben Westover <kwestover.kw@gmail.com> --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index c28c5d91e5c8..315c364bf2ba 100644 --- a/Makefile +++ b/Makefile @@ -408,6 +408,14 @@ ifeq ($(ARCH),parisc64) SRCARCH := parisc endif +# Additional ARCH settings for riscv +ifeq ($(ARCH),riscv32) + SRCARCH := riscv +endif +ifeq ($(ARCH),riscv64) + SRCARCH := riscv +endif + export cross_compiling := ifneq ($(SRCARCH),$(SUBARCH)) cross_compiling := 1 -- 2.35.1 [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 2022-03-30 14:34 [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 Ben Westover @ 2022-03-30 15:31 ` Masahiro Yamada 2022-03-30 18:40 ` Ben Westover 0 siblings, 1 reply; 5+ messages in thread From: Masahiro Yamada @ 2022-03-30 15:31 UTC (permalink / raw) To: Ben Westover Cc: Linux Kernel Mailing List, Linux Kbuild mailing list, Michal Marek, Nick Desaulniers On Wed, Mar 30, 2022 at 11:34 PM Ben Westover <kwestover.kw@gmail.com> wrote: > > When riscv64 or riscv32 are used as the value for ARCH during compilation, like > in tools that get the ARCH value from uname, set SRCARCH to riscv instead of > failing because the riscv64 and riscv32 targets don't exist. Can you refer to the code that really needs this? > > Signed-off-by: Ben Westover <kwestover.kw@gmail.com> > --- > Makefile | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/Makefile b/Makefile > index c28c5d91e5c8..315c364bf2ba 100644 > --- a/Makefile > +++ b/Makefile > @@ -408,6 +408,14 @@ ifeq ($(ARCH),parisc64) > SRCARCH := parisc > endif > > +# Additional ARCH settings for riscv > +ifeq ($(ARCH),riscv32) > + SRCARCH := riscv > +endif > +ifeq ($(ARCH),riscv64) > + SRCARCH := riscv > +endif > + > export cross_compiling := > ifneq ($(SRCARCH),$(SUBARCH)) > cross_compiling := 1 > -- > 2.35.1 > -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 2022-03-30 15:31 ` Masahiro Yamada @ 2022-03-30 18:40 ` Ben Westover 2022-03-31 1:34 ` Masahiro Yamada 0 siblings, 1 reply; 5+ messages in thread From: Ben Westover @ 2022-03-30 18:40 UTC (permalink / raw) To: Masahiro Yamada Cc: Linux Kernel Mailing List, Linux Kbuild mailing list, Michal Marek, Nick Desaulniers [-- Attachment #1.1: Type: text/plain, Size: 768 bytes --] Hello Masahiro, On 3/30/22 11:31 AM, Masahiro Yamada wrote: > On Wed, Mar 30, 2022 at 11:34 PM Ben Westover <kwestover.kw@gmail.com> wrote: >> >> When riscv64 or riscv32 are used as the value for ARCH during compilation, like >> in tools that get the ARCH value from uname, set SRCARCH to riscv instead of >> failing because the riscv64 and riscv32 targets don't exist. > > Can you refer to the code that really needs this? Some software like DKMS compiles out-of-tree modules by running `uname -m`and using that for the ARCH value. Without this patch, that compilation fails because uname shows either riscv64 or riscv32 while riscv should be used. This code already exists for sparc and parisc, as well as x86 of course. Thanks, -- Ben Westover [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 2022-03-30 18:40 ` Ben Westover @ 2022-03-31 1:34 ` Masahiro Yamada 2022-03-31 2:16 ` Ben Westover 0 siblings, 1 reply; 5+ messages in thread From: Masahiro Yamada @ 2022-03-31 1:34 UTC (permalink / raw) To: Ben Westover Cc: Linux Kernel Mailing List, Linux Kbuild mailing list, Michal Marek, Nick Desaulniers On Thu, Mar 31, 2022 at 3:40 AM Ben Westover <kwestover.kw@gmail.com> wrote: > > Hello Masahiro, > > On 3/30/22 11:31 AM, Masahiro Yamada wrote: > > On Wed, Mar 30, 2022 at 11:34 PM Ben Westover <kwestover.kw@gmail.com> wrote: > >> > >> When riscv64 or riscv32 are used as the value for ARCH during compilation, like > >> in tools that get the ARCH value from uname, set SRCARCH to riscv instead of > >> failing because the riscv64 and riscv32 targets don't exist. > > > > Can you refer to the code that really needs this? > Some software like DKMS compiles out-of-tree modules by running `uname -m`and > using that for the ARCH value. Without this patch, that compilation fails because > uname shows either riscv64 or riscv32 while riscv should be used. It is a bug in DKMS. The ARCH=* in linux kernel does not necessarily match to 'uname -m'. For example, we use ARCH=arm64 for arm 64-bit (so called aarch64), but it does not match "aarch64". The kernel has freedom to determine the supported string for ARCH=. DKMS must adjust to the kernel code. > This code already exists for sparc and parisc, as well as x86 of course. This is because there is a historical reason. If you look at the old code (e.g. 2.6.x,) arch/i386/ and arch/x86_64 were separate directories. They were unified into arch/x86/ now, but we still support ARCH=i386/x86_64. It helps to choose a different defconfig. See arch/x86/Makefile. I do not see such code for riscv, where 32/64-bit is selected only by Kconfig. > > Thanks, > -- > Ben Westover -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 2022-03-31 1:34 ` Masahiro Yamada @ 2022-03-31 2:16 ` Ben Westover 0 siblings, 0 replies; 5+ messages in thread From: Ben Westover @ 2022-03-31 2:16 UTC (permalink / raw) To: Masahiro Yamada Cc: Linux Kernel Mailing List, Linux Kbuild mailing list, Michal Marek, Nick Desaulniers [-- Attachment #1.1: Type: text/plain, Size: 2135 bytes --] Hello Masahiro, On 3/30/22 9:34 PM, Masahiro Yamada wrote: > On Thu, Mar 31, 2022 at 3:40 AM Ben Westover <kwestover.kw@gmail.com> wrote: >> >> Hello Masahiro, >> >> On 3/30/22 11:31 AM, Masahiro Yamada wrote: >>> On Wed, Mar 30, 2022 at 11:34 PM Ben Westover <kwestover.kw@gmail.com> wrote: >>>> >>>> When riscv64 or riscv32 are used as the value for ARCH during compilation, like >>>> in tools that get the ARCH value from uname, set SRCARCH to riscv instead of >>>> failing because the riscv64 and riscv32 targets don't exist. >>> >>> Can you refer to the code that really needs this? >> Some software like DKMS compiles out-of-tree modules by running `uname -m`and >> using that for the ARCH value. Without this patch, that compilation fails because >> uname shows either riscv64 or riscv32 while riscv should be used. > > It is a bug in DKMS. > > The ARCH=* in linux kernel does not necessarily match to 'uname -m'. > > For example, we use ARCH=arm64 for arm 64-bit (so called aarch64), > but it does not match "aarch64". > > The kernel has freedom to determine the supported string for ARCH=. > > DKMS must adjust to the kernel code. Ah, I see. Originally, I opened an issue in DKMS, but they led me to believe it was a kernel issue. Now I see that *they* are the ones that need to change. >> This code already exists for sparc and parisc, as well as x86 of course. > > This is because there is a historical reason. > > If you look at the old code (e.g. 2.6.x,) > arch/i386/ and arch/x86_64 were separate directories. > > They were unified into arch/x86/ now, but we still support > ARCH=i386/x86_64. It helps to choose a different defconfig. > See arch/x86/Makefile. This makes more sense now. DKMS based their ARCH value off of uname, and because of this vestigial code, it worked on x86. Now, trouble is being run into on other architectures, and their bad design comes back to haunt them. Thank you for the info; I will now try to solve these issues in DKMS and open a pull request since they don't seem want to do it themselves. Regards, -- Ben Westover [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-31 2:16 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-03-30 14:34 [PATCH] riscv: Set SRCARCH to riscv if ARCH is riscv64 or riscv32 Ben Westover 2022-03-30 15:31 ` Masahiro Yamada 2022-03-30 18:40 ` Ben Westover 2022-03-31 1:34 ` Masahiro Yamada 2022-03-31 2:16 ` Ben Westover
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox