1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/arch/riscv/include/asm
Nathan Chancellor e830315641
riscv: Fix ALT_THEAD_PMA's asm parameters
After commit a35707c3d8 ("riscv: add memory-type errata for T-Head"),
builds with LLVM's integrated assembler fail like:

  In file included from arch/riscv/kernel/asm-offsets.c:10:
  In file included from ./include/linux/mm.h:29:
  In file included from ./include/linux/pgtable.h:6:
  In file included from ./arch/riscv/include/asm/pgtable.h:114:
  ./arch/riscv/include/asm/pgtable-64.h:210:2: error: invalid input constraint '0' in asm
          ALT_THEAD_PMA(prot_val);
          ^
  ./arch/riscv/include/asm/errata_list.h:88:4: note: expanded from macro 'ALT_THEAD_PMA'
          : "0"(_val),                                                    \
            ^

This was reported upstream to LLVM where Jessica pointed out a couple of
issues with the existing implementation of ALT_THEAD_PMA:

* t3 is modified but not listed in the clobbers list.

* "+r"(_val) marks _val as both an input and output of the asm but then
  "0"(_val) marks _val as an input matching constraint, which does not
  make much sense in this situation, as %1 is not actually used in the
  asm and matching constraints are designed to be used for different
  inputs that need to use the same register.

Drop the matching contraint and shift all the operands by one, as %1 is
unused, and mark t3 as clobbered. This resolves the build error and goes
not cause any problems with GNU as.

Fixes: a35707c3d8 ("riscv: add memory-type errata for T-Head")
Link: https://github.com/ClangBuiltLinux/linux/issues/1641
Link: https://github.com/llvm/llvm-project/issues/55514
Link: https://gcc.gnu.org/onlinedocs/gcc/Simple-Constraints.html
Suggested-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20220518184529.454008-1-nathan@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-06-17 06:16:46 -07:00
..
vdso riscv/vdso: Add support for time namespaces 2021-10-04 14:16:43 -07:00
alternative-macros.h riscv: Move alternative length validation into subsection 2022-06-02 15:55:22 -07:00
alternative.h riscv: add memory-type errata for T-Head 2022-05-11 21:36:33 -07:00
asm-extable.h riscv: extable: add a dedicated uaccess handler 2022-01-05 17:53:29 -08:00
asm-offsets.h RISC-V: Task implementation 2017-09-26 15:26:46 -07:00
asm-prototypes.h riscv: add VMAP_STACK overflow detection 2021-07-06 12:11:38 -07:00
asm.h RISC-V: Split out the XIP fixups into their own file 2022-05-25 14:43:33 -07:00
atomic.h riscv: atomic: Add custom conditional atomic operation implementation 2022-05-21 10:31:47 -07:00
barrier.h RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw 2020-07-17 09:28:35 -07:00
bitops.h include: move find.h from asm_generic to linux 2022-01-15 08:47:31 -08:00
bug.h bug: Use normal relative pointers in 'struct bug_entry' 2022-05-19 23:46:10 +02:00
cache.h riscv: add nommu support 2019-11-17 15:17:39 -08:00
cacheflush.h mm: rename flush_icache_user_range to flush_icache_user_page 2020-06-08 11:05:58 -07:00
cacheinfo.h riscv: Add cache information in AUX vector 2020-09-15 18:46:08 -07:00
clint.h RISC-V: Resurrect the MMIO timer implementation for M-mode systems 2020-09-19 13:21:11 -07:00
clocksource.h riscv: use vDSO common flow to reduce the latency of the time-related functions 2020-06-10 19:47:16 -07:00
cmpxchg.h riscv: atomic: Cleanup unnecessary definition 2022-05-21 10:31:45 -07:00
compat.h riscv: compat: Add basic compat data type implementation 2022-04-26 13:36:12 -07:00
cpu_ops.h RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method 2022-01-20 09:27:08 -08:00
cpu_ops_sbi.h RISC-V: Avoid using per cpu array for ordered booting 2022-01-20 09:26:59 -08:00
cpuidle.h RISC-V: Enable CPU_IDLE drivers 2022-03-10 09:29:21 -08:00
csr.h RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
current.h riscv: Rename "sp_in_global" to "current_stack_pointer" 2022-03-30 15:15:27 -07:00
delay.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 286 2019-06-05 17:36:37 +02:00
efi.h efi: Move efifb_setup_from_dmi() prototype from arch headers 2021-12-13 15:07:16 +01:00
elf.h riscv: compat: vdso: Add setup additional pages implementation 2022-04-26 13:36:59 -07:00
errata_list.h riscv: Fix ALT_THEAD_PMA's asm parameters 2022-06-17 06:16:46 -07:00
extable.h riscv: extable: add type and data fields 2022-01-05 17:52:54 -08:00
fence.h riscv/spinlock: Strengthen implementations with fences 2018-04-02 19:59:43 -07:00
fixmap.h riscv: remove FIXMAP_PAGE_IO and fall back to its default value 2022-05-11 21:36:33 -07:00
ftrace.h riscv: Workaround mcount name prior to clang-13 2021-04-26 08:25:01 -07:00
futex.h riscv: extable: add a dedicated uaccess handler 2022-01-05 17:53:29 -08:00
gdb_xml.h riscv: Avoid kgdb.h including gdb_xml.h to solve unused-const-variable warning 2020-07-09 20:12:28 -07:00
gpr-num.h riscv: add gpr-num.h 2022-01-05 17:53:05 -08:00
hugetlb.h mm/hugetlb: define a generic fallback for arch_clear_hugepage_flags() 2020-06-03 20:09:46 -07:00
hwcap.h riscv: add RISC-V Svpbmt extension support 2022-05-11 21:36:33 -07:00
image.h RISC-V: Typo fixes in image header and documentation. 2019-12-19 09:32:45 -07:00
io.h RISC-V: Use asm-generic for {in,out}{bwlq} 2021-06-30 20:55:40 -07:00
irq.h riscv: irq: Fix no prototype warning 2021-03-09 20:46:00 -08:00
irq_work.h riscv: Fix irq_work when SMP is disabled 2022-06-01 21:46:31 -07:00
irqflags.h riscv: abstract out CSR names for supervisor vs machine mode 2019-11-05 09:20:42 -08:00
jump_label.h riscv: Add jump-label implementation 2020-07-30 11:37:43 -07:00
kasan.h riscv: Implement sv48 support 2022-01-19 17:54:09 -08:00
Kbuild RISC-V: Move to queued RW locks 2022-05-11 11:50:10 -07:00
kdebug.h riscv: Add KGDB support 2020-05-18 11:38:10 -07:00
kexec.h RISC-V: Prepare dropping week attribute from arch_kexec_apply_relocations[_add] 2022-05-30 16:04:37 -07:00
kfence.h riscv: Enable KFENCE for riscv64 2021-06-30 20:55:41 -07:00
kgdb.h riscv: Avoid kgdb.h including gdb_xml.h to solve unused-const-variable warning 2020-07-09 20:12:28 -07:00
kprobes.h kprobes: treewide: Make it harder to refer kretprobe_trampoline directly 2021-09-30 21:24:06 -04:00
kvm_host.h RISC-V: KVM: Cleanup stale TLB entries when host CPU changes 2022-05-20 09:09:18 +05:30
kvm_types.h KVM: RISC-V: Use common KVM implementation of MMU memory caches 2022-01-06 14:38:50 +05:30
kvm_vcpu_fp.h RISC-V: KVM: Factor-out FP virtualization into separate sources 2021-10-31 02:45:43 -04:00
kvm_vcpu_sbi.h RISC-V: KVM: Add common kvm_riscv_vcpu_sbi_system_reset() function 2022-03-11 19:02:29 +05:30
kvm_vcpu_timer.h RISC-V: KVM: Add timer functionality 2021-10-04 16:07:16 +05:30
linkage.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 286 2019-06-05 17:36:37 +02:00
mmio.h riscv: Use generic pgprot_* macros from <linux/pgtable.h> 2020-07-30 11:37:46 -07:00
mmiowb.h riscv: mmiowb: Fix implicit declaration of function 'smp_processor_id' 2020-05-13 17:11:46 -07:00
mmu.h riscv: compat: vdso: Add setup additional pages implementation 2022-04-26 13:36:59 -07:00
mmu_context.h riscv: add ASID-based tlbflushing methods 2021-06-30 20:55:39 -07:00
mmzone.h riscv: Add numa support for riscv64 platform 2021-01-14 15:08:58 -08:00
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
module.lds.h riscv module: remove (NOLOAD) 2022-03-29 14:31:07 -07:00
numa.h riscv: Add numa support for riscv64 platform 2021-01-14 15:08:58 -08:00
page.h RISC-V Patches for the 5.18 Merge Window, Part 1 2022-03-25 10:11:38 -07:00
parse_asm.h riscv: Add SW single-step support for KDB 2020-05-18 11:38:12 -07:00
patch.h riscv: Remove the 'riscv_' prefix of function name 2020-05-18 11:38:13 -07:00
pci.h riscv: enable generic PCI resource mapping 2021-05-25 22:50:49 -07:00
perf_event.h RISC-V: Remove the current perf implementation 2022-03-21 14:58:12 -07:00
pgalloc.h riscv: mm: Control p4d's folding by pgtable_l5_enabled 2022-02-14 16:32:39 -08:00
pgtable-32.h riscv: add RISC-V Svpbmt extension support 2022-05-11 21:36:33 -07:00
pgtable-64.h RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
pgtable-bits.h riscv: add RISC-V Svpbmt extension support 2022-05-11 21:36:33 -07:00
pgtable.h RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
probes.h riscv: Add kprobes supported 2021-01-14 15:09:06 -08:00
processor.h riscv: compat: Support TASK_SIZE for compat mode 2022-04-26 13:36:18 -07:00
ptdump.h riscv: support DEBUG_WX 2020-06-03 20:09:50 -07:00
ptrace.h riscv: ptrace: add argn syntax 2021-07-05 20:53:09 -07:00
sbi.h RISC-V Patches for the 5.18 Merge Window, Part 1 2022-03-25 10:11:38 -07:00
seccomp.h riscv: Enable seccomp architecture tracking 2020-11-20 11:16:35 -08:00
sections.h riscv: Map the kernel with correct permissions the first time 2021-06-30 21:18:58 -07:00
set_memory.h riscv: Map the kernel with correct permissions the first time 2021-06-30 21:18:58 -07:00
signal32.h riscv: compat: signal: Add rt_frame implementation 2022-05-17 16:37:21 -07:00
smp.h RISC-V: Do not use cpumask data structure for hartid bitmap 2022-01-20 09:27:22 -08:00
soc.h riscv: Fix builtin DTB handling 2021-01-07 19:00:50 -08:00
sparsemem.h riscv: Allow to dynamically define VA_BITS 2022-01-19 17:54:07 -08:00
stackprotector.h riscv: Enable per-task stack canaries 2021-01-14 15:09:10 -08:00
stacktrace.h riscv: Add dump stack in show_regs 2021-01-14 15:09:11 -08:00
string.h riscv: Add ARCH_HAS_FORTIFY_SOURCE 2021-03-09 18:18:31 -08:00
suspend.h RISC-V: Add arch functions for non-retentive suspend entry/exit 2022-03-10 09:29:31 -08:00
switch_to.h riscv: Turn has_fpu into a static key if FPU=y 2021-05-25 22:56:57 -07:00
syscall.h riscv: compat: syscall: Add compat_sys_call_table implementation 2022-04-26 13:36:25 -07:00
thread_info.h riscv: compat: Add basic compat data type implementation 2022-04-26 13:36:12 -07:00
timex.h riscv: use fallback for random_get_entropy() instead of zero 2022-05-13 23:59:23 +02:00
tlb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 286 2019-06-05 17:36:37 +02:00
tlbflush.h riscv: fix build error when CONFIG_SMP is disabled 2021-06-08 17:05:03 -07:00
uaccess.h uaccess: generalize access_ok() 2022-02-25 09:36:05 +01:00
unistd.h riscv: Wire up memfd_secret in UAPI header 2022-06-01 21:46:36 -07:00
uprobes.h riscv: Add uprobes supported 2021-01-14 15:09:08 -08:00
vdso.h riscv: compat: vdso: Add COMPAT_VDSO base code implementation 2022-04-26 13:36:53 -07:00
vendorid_list.h riscv: add memory-type errata for T-Head 2022-05-11 21:36:33 -07:00
vermagic.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
word-at-a-time.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 286 2019-06-05 17:36:37 +02:00
xip_fixup.h RISC-V: Split out the XIP fixups into their own file 2022-05-25 14:43:33 -07:00