linux/arch/mips/include/asm
James Hogan c22c804310 MIPS: Fix input modify in __write_64bit_c0_split()
The inline asm in __write_64bit_c0_split() modifies the 64-bit input
operand by shifting the high register left by 32, and constructing the
full 64-bit value in the low register (even on a 32-bit kernel), so if
that value is used again it could cause breakage as GCC would assume the
registers haven't changed when they have.

To quote the GCC extended asm documentation:
> Warning: Do not modify the contents of input-only operands (except for
> inputs tied to outputs). The compiler assumes that on exit from the
> asm statement these operands contain the same values as they had
> before executing the statement.

Avoid modifying the input by using a temporary variable as an output
which is modified instead of the input and not otherwise used. The asm
is always __volatile__ so GCC shouldn't optimise it out. The low
register of the temporary output is written before the high register of
the input is read, so we have two constraint alternatives, one where
both use the same registers (for when the input value isn't subsequently
used), and one with an early clobber on the output in case the low
output uses the same register as the high input. This allows the
resulting assembly to remain mostly unchanged.

A diff of a MIPS32r6 kernel reveals only three differences, two in
relation to write_c0_r10k_diag() in cpu_probe() (register allocation
rearranged slightly but otherwise identical), and one in relation to
write_c0_cvmmemctl2() in kvm_vz_local_flush_guesttlb_all(), but the
octeon CPU is only supported on 64-bit kernels where
__write_64bit_c0_split() isn't used so that shouldn't matter in
practice. So there currently doesn't appear to be anything broken by
this bug.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/17315/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2017-09-21 16:26:42 +02:00
..
dec
emma
fw
ip32
lasat
mach-ar7
mach-ath25 MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-ath79
mach-au1x00 MIPS: Alchemy: update cpu feature overrides 2017-08-29 15:21:53 +02:00
mach-bcm47xx MIPS: BCM47XX: Add Luxul devices to the database 2017-01-25 02:51:12 +01:00
mach-bcm63xx MIPS: BCM63XX: fix ENETDMA_6345_MAXBURST_REG offset 2017-09-06 12:25:56 +02:00
mach-bmips
mach-cavium-octeon MIPS: Octeon: Expose support for mips32r1, mips32r2 and mips64r1 2017-08-29 15:21:52 +02:00
mach-cobalt MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-db1x00
mach-dec MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-emma2rh
mach-generic MIPS: generic: Set RTC_ALWAYS_BCD to 0 2017-06-28 12:22:41 +02:00
mach-ip22 MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-ip27 MIPS: NUMA: Remove the unused parent_node() macro 2017-08-29 15:21:51 +02:00
mach-ip28 MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-ip32 MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-jazz
mach-jz4740 mtd: nand: Rename nand.h into rawnand.h 2017-08-13 10:11:49 +02:00
mach-lantiq MIPS: lantiq: remove ltq_reset_cause() and ltq_boot_select() 2017-09-04 21:19:02 +02:00
mach-lasat
mach-loongson32 MIPS: Loongson1: Add watchdog support for Loongson1 board 2017-01-03 16:34:42 +01:00
mach-loongson64 MIPS: NUMA: Remove the unused parent_node() macro 2017-08-29 15:21:51 +02:00
mach-malta MIPS: Add definitions of SegCtl registers and use them 2016-05-28 12:35:04 +02:00
mach-netlogic MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-paravirt MIPS: paravirt: Fix undefined reference to smp_bootstrap 2016-09-13 16:45:15 +02:00
mach-pic32
mach-pistachio
mach-pmcs-msp71xx
mach-pnx833x
mach-ralink MIPS: ralink: Fix build error due to missing header 2017-07-18 23:59:18 +02:00
mach-rc32434 MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-rm MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-sibyte MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-tx39xx
mach-tx49xx MIPS16e2: Provide feature overrides for non-MIPS16 systems 2017-07-11 14:13:06 +02:00
mach-vr41xx
mach-xilfpga
mips-boards irqchip: mips-gic: Move various definitions to the driver 2017-09-04 13:53:14 +02:00
netlogic MIPS: SMP: Constify smp ops 2017-08-29 15:21:50 +02:00
octeon MIPS: Octeon: Allow access to CIU3 IRQ domains. 2017-09-04 21:19:03 +02:00
pci
sgi MIPS: IP22/IP28: Fix typo 2016-05-28 12:35:08 +02:00
sibyte
sn
txx9
vr41xx
xtalk
abi.h signals: Prepare to split out <linux/signal_types.h> from <linux/signal.h> 2017-03-02 08:42:37 +01:00
addrspace.h MIPS: Adjust MIPS64 CAC_BASE to reflect Config.K0 2016-10-06 18:02:35 +02:00
amon.h
arch_hweight.h
asm-eva.h
asm-offsets.h
asm-prototypes.h MIPS: Fix modversioning of _mcount symbol 2017-04-12 15:13:53 +02:00
asm.h MIPS: Add DWARF unwinding to assembly 2017-09-06 11:01:52 +02:00
asmmacro-32.h
asmmacro-64.h
asmmacro.h MIPS: Add a missing ".set pop" in an early commit 2016-09-13 17:25:11 +02:00
atomic.h locking/atomic, arch/mips: Convert to _relaxed atomics 2016-06-16 10:48:34 +02:00
barrier.h MIPS: Barrier: Add definitions of SYNC stype values 2016-10-04 16:13:57 +02:00
bcache.h
bitops.h
bitrev.h
bmips-spaces.h
bmips.h MIPS: SMP: Constify smp ops 2017-08-29 15:21:50 +02:00
bootinfo.h MIPS: platform: Allow for DTB to be moved during kernel relocation 2017-01-03 16:34:45 +01:00
branch.h MIPS: Fix unaligned PC interpretation in `compute_return_epc' 2017-06-29 02:42:26 +02:00
break.h
bug.h
bugs.h
cache.h Revert "MIPS: Don't unnecessarily include kmalloc.h into <asm/cache.h>." 2017-08-07 12:01:17 +02:00
cacheflush.h MIPS: c-r4k: Split user/kernel flush_icache_range() 2016-10-04 16:13:57 +02:00
cacheops.h
cdmm.h
cevt-r4k.h
checksum.h new helper: uaccess_kernel() 2017-03-28 16:43:25 -04:00
clock.h
clocksource.h
cmp.h
cmpxchg.h MIPS: cmpxchg: Rearrange __xchg() arguments to match xchg() 2017-06-29 02:42:25 +02:00
compat-signal.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
compat.h
compiler.h
cop2.h
cpu-features.h MIPS: Introduce cpu_tcache_line_size 2017-08-08 00:02:27 +02:00
cpu-info.h MIPS: Add CPU cluster number accessors 2017-08-30 00:57:27 +02:00
cpu-type.h MIPS: Remove unused R6000 support 2017-08-29 15:21:51 +02:00
cpu.h MIPS: Remove unused R6000 support 2017-08-29 15:21:51 +02:00
cpufeature.h MIPS: Enable GENERIC_CPU_AUTOPROBE 2017-04-10 11:56:04 +02:00
debug.h
delay.h
device.h treewide: Move dma_ops from struct dev_archdata into struct device 2017-01-24 12:23:35 -05:00
div64.h
dma-coherence.h MIPS: Support per-device DMA coherence 2016-10-06 18:02:01 +02:00
dma-mapping.h treewide: Consolidate get_dma_ops() implementations 2017-01-24 12:23:35 -05:00
dma.h
ds1287.h
dsemul.h MIPS: Use per-mm page to execute branch delay slot instructions 2016-08-02 09:28:53 +02:00
dsp.h
edac.h
elf.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
errno.h
eva.h
exec.h
extable.h mips: separate extable.h, switch module.h to it 2016-10-05 18:36:18 -04:00
fb.h
fixmap.h
floppy.h MIPS: Don't use dma_cache_sync to implement fd_cacheflush 2017-08-30 00:57:29 +02:00
fpregdef.h
fpu.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2017-04-06 13:16:34 -07:00
fpu_emulator.h MIPS: math-emu: Add FP emu debugfs stats for individual instructions 2017-08-29 15:21:57 +02:00
ftrace.h
futex.h futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
gio_device.h
gt64120.h
hardirq.h
hazards.h MIPS: hazards.h: Fix typo 2016-05-28 12:35:06 +02:00
highmem.h MIPS: highmem: ensure that we don't use more than one page for PTEs 2017-06-08 14:51:58 +02:00
hpet.h
hugetlb.h
hw_irq.h
i8259.h MIPS: IRQ: Remove useless i8259_of_init() prototype. 2017-01-03 16:34:48 +01:00
ide.h
idle.h
inst.h
io.h MIPS: Add __ioread64_copy 2017-09-04 13:53:14 +02:00
irq.h MIPS: Fix minimum alignment requirement of IRQ stack 2017-07-11 14:13:06 +02:00
irq_cpu.h
irq_gt641xx.h
irq_regs.h
irqflags.h
isadep.h
jazz.h
jazzdma.h
jump_label.h
Kbuild MIPS: Use queued spinlocks (qspinlock) 2017-06-29 02:42:26 +02:00
kdebug.h
kexec.h mips/panic: replace smp_send_stop() with kdump friendly version in panic path 2016-10-11 15:06:32 -07:00
kgdb.h
kmap_types.h
kprobes.h MIPS: kprobes: flush_insn_slot should flush only if probe initialised 2017-06-08 15:42:05 +02:00
kvm_host.h KVM: update to new mmu_notifier semantic v2 2017-08-31 16:13:00 -07:00
kvm_para.h
linkage.h
llsc.h
local.h
m48t37.h
maar.h MIPS: Separate MAAR V bit into VL and VH for XPA 2017-03-28 14:49:01 +01:00
machine.h MIPS: generic: Abstract FDT fixup application 2017-06-28 12:22:41 +02:00
mc146818-time.h
mc146818rtc.h
mips-cm.h MIPS: CPS: Cluster support for topology functions 2017-08-30 00:57:28 +02:00
mips-cpc.h MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
mips-cps.h MIPS: GIC: Introduce asm/mips-gic.h with accessor functions 2017-08-30 14:03:40 +02:00
mips-gic.h irqchip: mips-gic: Move gic_get_c0_*_int() to asm/mips-gic.h 2017-09-04 13:53:14 +02:00
mips-r2-to-r6-emul.h
mips_machine.h
mips_mt.h MIPS: MT: Fix typo 2016-05-28 12:35:07 +02:00
mipsmtregs.h
mipsprom.h
mipsregs.h MIPS: Fix input modify in __write_64bit_c0_split() 2017-09-21 16:26:42 +02:00
mmu.h MIPS: Use per-mm page to execute branch delay slot instructions 2016-08-02 09:28:53 +02:00
mmu_context.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
mmzone.h
module.h MIPS: Remove unused R6000 support 2017-08-29 15:21:51 +02:00
msa.h MIPS: Fix MSA asm warnings in control reg accessors 2016-07-24 12:45:00 +02:00
msc01_ic.h
nile4.h
paccess.h
page.h treewide: replace config_enabled() with IS_ENABLED() (2nd round) 2016-08-26 17:39:35 -07:00
pci.h MIPS: PCI: Remove unused busn_offset 2017-05-18 15:39:19 -05:00
perf_event.h
pgalloc.h MIPS: do not use __GFP_REPEAT for order-0 request 2017-07-12 16:26:03 -07:00
pgtable-32.h MIPS: mm: adjust PKMAP location 2017-06-08 14:51:58 +02:00
pgtable-64.h MIPS: Add 48-bit VA space (and 4-level page tables) for 4K pages. 2017-04-10 11:56:06 +02:00
pgtable-bits.h
pgtable.h mm: move phys_mem_access_prot_allowed() declaration to pgtable.h 2016-10-07 18:46:29 -07:00
pm-cps.h MIPS: pm-cps: Add MIPSr6 CPU support 2016-10-04 16:13:57 +02:00
pm.h
pmon.h
prefetch.h
processor.h locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
prom.h
ptrace.h MIPS: ptrace: Fix regs_return_value for kernel context 2016-10-12 14:34:45 +02:00
r4k-timer.h
r4kcache.h new helper: uaccess_kernel() 2017-03-28 16:43:25 -04:00
reboot.h
reg.h
regdef.h
rtlx.h
seccomp.h tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
setup.h MIPS: KVM: Don't hardcode restored HWREna 2016-06-15 23:58:31 +02:00
sgialib.h
sgiarcs.h
shmparam.h
sigcontext.h
signal.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-08-06 09:13:11 -04:00
sim.h
smp-cps.h
smp-ops.h MIPS: CPS: Have asm/mips-cps.h include CM & CPC headers 2017-08-30 00:57:27 +02:00
smp.h MIPS: SMP: Constify smp ops 2017-08-29 15:21:50 +02:00
sni.h
socket.h
sparsemem.h
spinlock.h MIPS: Use queued spinlocks (qspinlock) 2017-06-29 02:42:26 +02:00
spinlock_types.h MIPS: Use queued spinlocks (qspinlock) 2017-06-29 02:42:26 +02:00
spram.h
stackframe.h MIPS: Add DWARF unwinding to assembly 2017-09-06 11:01:52 +02:00
stackprotector.h
stacktrace.h mips: Save all registers when saving the frame 2017-09-06 11:02:11 +02:00
string.h
switch_to.h MIPS: Cleanup LLBit handling in switch_to 2017-01-03 16:34:42 +01:00
syscall.h MIPS: Correct forced syscall errors 2017-07-11 14:13:06 +02:00
termios.h Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
thread_info.h MIPS: Remove r2_emul_return from struct thread_info 2017-01-03 16:34:41 +01:00
time.h
timex.h
tlb.h MIPS: asm/tlb.h: Add UNIQUE_GUEST_ENTRYHI() macro 2017-03-28 14:49:30 +01:00
tlbdebug.h
tlbex.h MIPS: Export some tlbex internals for KVM to use 2017-02-03 15:19:01 +00:00
tlbflush.h
tlbmisc.h
topology.h MIPS: Abstract CPU core & VP(E) ID access through accessor functions 2017-08-30 00:57:26 +02:00
traps.h
txx9irq.h
txx9pio.h
txx9tmr.h
types.h
uaccess.h Merge branch 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2017-07-15 11:17:52 -07:00
uasm.h MIPS: Add some instructions to uasm. 2017-06-28 12:22:39 +02:00
unistd.h trim __ARCH_WANT_SYS_OLD_GETRLIMIT 2017-05-27 15:38:02 -04:00
uprobes.h uprobes: remove function declarations from arch/{mips,s390} 2016-10-07 18:46:30 -07:00
vdso.h MIPS: VDSO: Fix conversions in do_monotonic()/do_monotonic_coarse() 2017-06-29 02:42:29 +02:00
vga.h vga: optimise console scrolling 2017-09-08 18:26:48 -07:00
vpe.h
war.h
watch.h
wbflush.h
yamon-dt.h MIPS: generic/yamon-dt: Support > 256MB of RAM 2017-06-28 12:22:41 +02:00