[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZC1RhA1Wi0B54sTO@sunil-laptop>
Date: Wed, 5 Apr 2023 16:16:28 +0530
From: Sunil V L <sunilvl@...tanamicro.com>
To: Conor Dooley <conor@...nel.org>
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-acpi@...r.kernel.org,
linux-crypto@...r.kernel.org, platform-driver-x86@...r.kernel.org,
llvm@...ts.linux.dev, Weili Qian <qianweili@...wei.com>,
Albert Ou <aou@...s.berkeley.edu>,
Herbert Xu <herbert@...dor.apana.org.au>,
Tom Rix <trix@...hat.com>, Jonathan Corbet <corbet@....net>,
Marc Zyngier <maz@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Mark Gross <markgross@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Zhou Wang <wangzhou1@...ilicon.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Maximilian Luz <luzmaximilian@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Len Brown <lenb@...nel.org>
Subject: Re: [PATCH V4 23/23] crypto: hisilicon/qm: Workaround to enable
build with RISC-V clang
Hi Conor,
On Tue, Apr 04, 2023 at 10:59:41PM +0100, Conor Dooley wrote:
> Hey Sunil,
>
> This one made me scratch my head for a bit..
>
> On Tue, Apr 04, 2023 at 11:50:37PM +0530, Sunil V L wrote:
> > With CONFIG_ACPI enabled for RISC-V, this driver gets enabled in
> > allmodconfig build. The gcc tool chain builds this driver removing the
> > inline arm64 assembly code. However, clang for RISC-V tries to build
> > the arm64 assembly and below error is seen.
>
> There's actually nothing RISC-V specific about that behaviour, that's
> just how clang works. Quoting Nathan:
> "Clang performs semantic analysis (i.e., validates assembly) before
> dead code elimination, so IS_ENABLED() is not sufficient for avoiding
> that error."
>
Huh, It never occurred to me that this issue could be known already since I
always thought we are hitting this first time since ACPI is enabled only
now for RISC-V. Thank you very much!.
> > drivers/crypto/hisilicon/qm.c:627:10: error: invalid output constraint '+Q' in asm
> > "+Q" (*((char __iomem *)fun_base))
> > ^
> > It appears that RISC-V clang is not smart enough to detect
> > IS_ENABLED(CONFIG_ARM64) and remove the dead code.
>
> So I think this statement is just not true, it can remove dead code, but
> only after it has done the semantic analysis.
>
Yes, with more details now, let me update the commit message.
> The reason that this has not been seen before, again quoting Nathan, is:
> "arm64 and x86_64 both support the Q constraint, we cannot build
> LoongArch yet (although it does not have support for Q either so same
> boat as RISC-V), and ia64 is dead/unsupported in LLVM. Those are the
> only architectures that support ACPI, so I guess that explains why we
> have seen no issues aside from RISC-V so far."
>
> > As a workaround, move this check to preprocessing stage which works
> > with the RISC-V clang tool chain.
>
> I don't think there's much else you can do!
> Reviewed-by: Conor Dooley <conor.dooley@...rochip.com>
>
> Perhaps it is also worth adding:
> Link: https://github.com/ClangBuiltLinux/linux/issues/999
>
Sure, Thank you very much for digging this!
Thanks,
Sunil
Powered by blists - more mailing lists