mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 05:10:51 +07:00
20d60d9973
This is the gereric part of R4000/R4400 errata workarounds. They include compiler and assembler support as well as some source code modifications to address the problems with some combinations of multiply/divide+shift instructions as well as the daddi and daddiu instructions. Changes included are as follows: 1. New Kconfig options to select workarounds by platforms as necessary. 2. Arch top-level Makefile to pass necessary options to the compiler; also incompatible configurations are detected (-mno-sym32 unsupported as horribly intrusive for little gain). 3. Bug detection updated and shuffled -- the multiply/divide+shift problem is lethal enough that if not worked around it makes the kernel crash in time_init() because of a division by zero; the daddiu erratum might also trigger early potentially, though I have not observed it. On the other hand the daddi detection code requires the exception subsystem to have been initialised (and is there mainly for information). 4. r4k_daddiu_bug() added so that the existence of the erratum can be queried by code at the run time as necessary; useful for generated code like TLB fault and copy/clear page handlers. 5. __udelay() updated as it uses multiplication in inline assembly. Note that -mdaddi requires modified toolchain (which has been maintained by myself and available from my site for ~4years now -- versions covered are GCC 2.95.4 - 4.1.2 and binutils from 2.13 onwards). The -mfix-r4000 and -mfix-r4400 have been standard for a while though. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
54 lines
882 B
C
54 lines
882 B
C
/*
|
|
* This is included by init/main.c to check for architecture-dependent bugs.
|
|
*
|
|
* Copyright (C) 2007 Maciej W. Rozycki
|
|
*
|
|
* Needs:
|
|
* void check_bugs(void);
|
|
*/
|
|
#ifndef _ASM_BUGS_H
|
|
#define _ASM_BUGS_H
|
|
|
|
#include <linux/bug.h>
|
|
#include <linux/delay.h>
|
|
|
|
#include <asm/cpu.h>
|
|
#include <asm/cpu-info.h>
|
|
|
|
extern int daddiu_bug;
|
|
|
|
extern void check_bugs64_early(void);
|
|
|
|
extern void check_bugs32(void);
|
|
extern void check_bugs64(void);
|
|
|
|
static inline void check_bugs_early(void)
|
|
{
|
|
#ifdef CONFIG_64BIT
|
|
check_bugs64_early();
|
|
#endif
|
|
}
|
|
|
|
static inline void check_bugs(void)
|
|
{
|
|
unsigned int cpu = smp_processor_id();
|
|
|
|
cpu_data[cpu].udelay_val = loops_per_jiffy;
|
|
check_bugs32();
|
|
#ifdef CONFIG_64BIT
|
|
check_bugs64();
|
|
#endif
|
|
}
|
|
|
|
static inline int r4k_daddiu_bug(void)
|
|
{
|
|
#ifdef CONFIG_64BIT
|
|
WARN_ON(daddiu_bug < 0);
|
|
return daddiu_bug != 0;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
#endif /* _ASM_BUGS_H */
|