From: Mark Salyzyn <salyzyn@android.com> To: linux-kernel@vger.kernel.org Cc: Mark Salyzyn <salyzyn@android.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Christoffer Dall <cdall@linaro.org>, Mark Rutland <mark.rutland@arm.com>, Marc Zyngier <marc.zyngier@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Stefan Traby <stefan@hello-penguin.com>, Dave Martin <Dave.Martin@arm.com>, linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: write_sysreg asm illegal for aarch32 Date: Wed, 1 Nov 2017 09:58:33 -0700 [thread overview] Message-ID: <20171101170014.20931-1-salyzyn@android.com> (raw) Cross compiling to aarch32 (for vdso32) using clang correctly identifies that (the unused) write_sysreg inline asm directive is illegal in that architectural context: arch/arm64/include/asm/arch_timer.h: error: invalid input constraint 'rZ' in asm write_sysreg(cntkctl, cntkctl_el1); ^ arch/arm64/include/asm/sysreg.h: note: expanded from macro 'write_sysreg' : : "rZ" (__val)); ^ GCC normally checks for correctness everywhere. But uniquely for unused asm, will optimize out and suppress the error report. Signed-off-by: Mark Salyzyn <salyzyn@android.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Christoffer Dall <cdall@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Stefan Traby <stefan@hello-penguin.com> Cc: Dave Martin <Dave.Martin@arm.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- arch/arm64/include/asm/sysreg.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index f707fed5886f..a7b61c9327db 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -492,11 +492,15 @@ asm( * The "Z" constraint normally means a zero immediate, but when combined with * the "%x0" template means XZR. */ +#if defined(__aarch64__) #define write_sysreg(v, r) do { \ u64 __val = (u64)(v); \ asm volatile("msr " __stringify(r) ", %x0" \ : : "rZ" (__val)); \ } while (0) +#else +#define write_sysreg(v, r) BUG() +#endif /* * For registers without architectural names, or simply unsupported by -- 2.15.0.403.gc27cc4dac6-goog
WARNING: multiple messages have this Message-ID (diff)
From: salyzyn@android.com (Mark Salyzyn) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: write_sysreg asm illegal for aarch32 Date: Wed, 1 Nov 2017 09:58:33 -0700 [thread overview] Message-ID: <20171101170014.20931-1-salyzyn@android.com> (raw) Cross compiling to aarch32 (for vdso32) using clang correctly identifies that (the unused) write_sysreg inline asm directive is illegal in that architectural context: arch/arm64/include/asm/arch_timer.h: error: invalid input constraint 'rZ' in asm write_sysreg(cntkctl, cntkctl_el1); ^ arch/arm64/include/asm/sysreg.h: note: expanded from macro 'write_sysreg' : : "rZ" (__val)); ^ GCC normally checks for correctness everywhere. But uniquely for unused asm, will optimize out and suppress the error report. Signed-off-by: Mark Salyzyn <salyzyn@android.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Christoffer Dall <cdall@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Stefan Traby <stefan@hello-penguin.com> Cc: Dave Martin <Dave.Martin@arm.com> Cc: linux-arm-kernel at lists.infradead.org Cc: linux-kernel at vger.kernel.org --- arch/arm64/include/asm/sysreg.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index f707fed5886f..a7b61c9327db 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -492,11 +492,15 @@ asm( * The "Z" constraint normally means a zero immediate, but when combined with * the "%x0" template means XZR. */ +#if defined(__aarch64__) #define write_sysreg(v, r) do { \ u64 __val = (u64)(v); \ asm volatile("msr " __stringify(r) ", %x0" \ : : "rZ" (__val)); \ } while (0) +#else +#define write_sysreg(v, r) BUG() +#endif /* * For registers without architectural names, or simply unsupported by -- 2.15.0.403.gc27cc4dac6-goog
next reply other threads:[~2017-11-01 17:00 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-11-01 16:58 Mark Salyzyn [this message] 2017-11-01 16:58 ` [PATCH] arm64: write_sysreg asm illegal for aarch32 Mark Salyzyn 2017-11-01 17:14 ` Robin Murphy 2017-11-01 17:14 ` Robin Murphy 2017-11-01 17:49 ` Mark Salyzyn 2017-11-01 17:49 ` Mark Salyzyn 2017-11-01 17:56 ` Mark Rutland 2017-11-01 17:56 ` Mark Rutland 2017-11-01 18:16 ` Mark Salyzyn 2017-11-01 18:16 ` Mark Salyzyn 2017-11-01 20:32 ` Mark Salyzyn 2017-11-01 20:32 ` Mark Salyzyn 2017-11-02 10:08 ` Mark Rutland 2017-11-02 10:08 ` Mark Rutland 2017-11-02 10:05 ` Marc Zyngier 2017-11-02 10:05 ` Marc Zyngier
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20171101170014.20931-1-salyzyn@android.com \ --to=salyzyn@android.com \ --cc=Dave.Martin@arm.com \ --cc=catalin.marinas@arm.com \ --cc=cdall@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=marc.zyngier@arm.com \ --cc=mark.rutland@arm.com \ --cc=stefan@hello-penguin.com \ --cc=suzuki.poulose@arm.com \ --cc=will.deacon@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.