arch/mips/kvm/emulate.c:946:23: warning: no previous prototype for function 'kvm_mips_emul_eret'
From: kernel test robot
Date: Mon May 03 2021 - 17:05:48 EST
Hi Huacai,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d835ff6c96ae6fa1ea474b0290a46e514ab6742b
commit: 0f78355c450835053fed85828c9d6526594c0921 KVM: MIPS: Enable KVM support for Loongson-3
date: 11 months ago
config: mips-randconfig-r026-20210504 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f78355c450835053fed85828c9d6526594c0921
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0f78355c450835053fed85828c9d6526594c0921
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:14:
In file included from include/linux/ktime.h:24:
In file included from include/linux/time.h:6:
In file included from include/linux/seqlock.h:36:
In file included from include/linux/spinlock.h:83:
In file included from include/linux/spinlock_types.h:18:
In file included from include/linux/lockdep.h:44:
include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:14:
In file included from include/linux/ktime.h:24:
In file included from include/linux/time.h:74:
In file included from include/linux/time32.h:13:
In file included from include/linux/timex.h:65:
In file included from arch/mips/include/asm/timex.h:19:
In file included from arch/mips/include/asm/cpu-type.h:12:
In file included from include/linux/smp.h:15:
include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:15:
In file included from include/linux/kvm_host.h:14:
In file included from include/linux/mm.h:95:
arch/mips/include/asm/pgtable.h:210:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
^
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:15:
In file included from include/linux/kvm_host.h:14:
In file included from include/linux/mm.h:95:
arch/mips/include/asm/pgtable.h:210:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:15:
include/linux/kvm_host.h:331:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:15:
include/linux/kvm_host.h:331:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/emulate.c:24:
In file included from arch/mips/include/asm/mmu_context.h:23:
arch/mips/include/asm/ginvt.h:41:20: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
addr &= PAGE_MASK << 1;
~~~~~~~~~ ^
arch/mips/include/asm/ginvt.h:52:20: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
addr &= PAGE_MASK << 1;
~~~~~~~~~ ^
>> arch/mips/kvm/emulate.c:946:23: warning: no previous prototype for function 'kvm_mips_emul_eret' [-Wmissing-prototypes]
enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu)
^
arch/mips/kvm/emulate.c:946:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu)
^
static
>> arch/mips/kvm/emulate.c:1029:23: warning: no previous prototype for function 'kvm_mips_emul_tlbr' [-Wmissing-prototypes]
enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu)
^
arch/mips/kvm/emulate.c:1029:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu)
^
static
>> arch/mips/kvm/emulate.c:1102:23: warning: no previous prototype for function 'kvm_mips_emul_tlbwi' [-Wmissing-prototypes]
enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
^
arch/mips/kvm/emulate.c:1102:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
^
static
>> arch/mips/kvm/emulate.c:1138:23: warning: no previous prototype for function 'kvm_mips_emul_tlbwr' [-Wmissing-prototypes]
enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu)
^
arch/mips/kvm/emulate.c:1138:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu)
^
static
>> arch/mips/kvm/emulate.c:1163:23: warning: no previous prototype for function 'kvm_mips_emul_tlbp' [-Wmissing-prototypes]
enum emulation_result kvm_mips_emul_tlbp(struct kvm_vcpu *vcpu)
^
arch/mips/kvm/emulate.c:1163:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
enum emulation_result kvm_mips_emul_tlbp(struct kvm_vcpu *vcpu)
^
static
21 warnings generated.
Assembler messages:
Fatal error: invalid -march= option: `mips64r2'
clang-13: error: assembler command failed with exit code 1 (use -v to see invocation)
--
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
In file included from include/linux/kvm_host.h:7:
In file included from include/linux/hardirq.h:5:
In file included from include/linux/context_tracking_state.h:5:
In file included from include/linux/percpu.h:6:
In file included from include/linux/preempt.h:78:
In file included from ./arch/mips/include/generated/asm/preempt.h:1:
In file included from include/asm-generic/preempt.h:5:
In file included from include/linux/thread_info.h:38:
In file included from arch/mips/include/asm/thread_info.h:16:
In file included from arch/mips/include/asm/processor.h:14:
In file included from include/linux/atomic.h:7:
arch/mips/include/asm/atomic.h:262:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
ATOMIC_SIP_OP(atomic64, s64, dsubu, lld, scd)
^
arch/mips/include/asm/atomic.h:252:7: note: expanded from macro 'ATOMIC_SIP_OP'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
In file included from include/linux/kvm_host.h:7:
In file included from include/linux/hardirq.h:5:
In file included from include/linux/context_tracking_state.h:5:
In file included from include/linux/percpu.h:7:
In file included from include/linux/smp.h:15:
include/linux/llist.h:222:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&head->first, NULL);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
In file included from include/linux/kvm_host.h:7:
In file included from include/linux/hardirq.h:7:
In file included from include/linux/lockdep.h:44:
include/linux/debug_locks.h:17:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return xchg(&debug_locks, 0);
^
arch/mips/include/asm/cmpxchg.h:102:7: note: expanded from macro 'xchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
In file included from include/linux/kvm_host.h:14:
In file included from include/linux/mm.h:95:
arch/mips/include/asm/pgtable.h:210:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL);
^
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
In file included from include/linux/kvm_host.h:14:
In file included from include/linux/mm.h:95:
arch/mips/include/asm/pgtable.h:210:3: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:220:2: note: expanded from macro 'cmpxchg64'
cmpxchg((ptr), (o), (n)); \
^
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
include/linux/kvm_host.h:331:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
^
arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
In file included from arch/mips/kvm/loongson_ipi.c:11:
include/linux/kvm_host.h:331:9: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
arch/mips/include/asm/cmpxchg.h:204:7: note: expanded from macro 'cmpxchg'
if (!__SYNC_loongson3_war) \
^
arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war'
# define __SYNC_loongson3_war (1 << 31)
^
>> arch/mips/kvm/loongson_ipi.c:190:6: warning: no previous prototype for function 'kvm_init_loongson_ipi' [-Wmissing-prototypes]
void kvm_init_loongson_ipi(struct kvm *kvm)
^
arch/mips/kvm/loongson_ipi.c:190:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void kvm_init_loongson_ipi(struct kvm *kvm)
^
static
15 warnings generated.
Assembler messages:
Fatal error: invalid -march= option: `mips64r2'
clang-13: error: assembler command failed with exit code 1 (use -v to see invocation)
vim +/kvm_mips_emul_eret +946 arch/mips/kvm/emulate.c
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 945
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 @946 enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu)
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 947 {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 948 struct mips_coproc *cop0 = vcpu->arch.cop0;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 949 enum emulation_result er = EMULATE_DONE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 950
ede5f3e7b54a43 arch/mips/kvm/emulate.c James Hogan 2016-10-25 951 if (kvm_read_c0_guest_status(cop0) & ST0_ERL) {
ede5f3e7b54a43 arch/mips/kvm/emulate.c James Hogan 2016-10-25 952 kvm_clear_c0_guest_status(cop0, ST0_ERL);
ede5f3e7b54a43 arch/mips/kvm/emulate.c James Hogan 2016-10-25 953 vcpu->arch.pc = kvm_read_c0_guest_errorepc(cop0);
ede5f3e7b54a43 arch/mips/kvm/emulate.c James Hogan 2016-10-25 954 } else if (kvm_read_c0_guest_status(cop0) & ST0_EXL) {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 955 kvm_debug("[%#lx] ERET to %#lx\n", vcpu->arch.pc,
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 956 kvm_read_c0_guest_epc(cop0));
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 957 kvm_clear_c0_guest_status(cop0, ST0_EXL);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 958 vcpu->arch.pc = kvm_read_c0_guest_epc(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 959
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 960 } else {
6ad78a5c75c5bc arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 961 kvm_err("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n",
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 962 vcpu->arch.pc);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 963 er = EMULATE_FAIL;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 964 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 965
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 966 return er;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 967 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 968
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 969 enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu)
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 970 {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 971 kvm_debug("[%#lx] !!!WAIT!!! (%#lx)\n", vcpu->arch.pc,
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 972 vcpu->arch.pending_exceptions);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 973
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 974 ++vcpu->stat.wait_exits;
1e09e86ac13747 arch/mips/kvm/emulate.c James Hogan 2016-06-14 975 trace_kvm_exit(vcpu, KVM_TRACE_EXIT_WAIT);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 976 if (!vcpu->arch.pending_exceptions) {
f4474d50c7d483 arch/mips/kvm/emulate.c James Hogan 2017-03-14 977 kvm_vz_lose_htimer(vcpu);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 978 vcpu->arch.wait = 1;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 979 kvm_vcpu_block(vcpu);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 980
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 981 /*
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 982 * We we are runnable, then definitely go off to user space to
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 983 * check if any I/O interrupts are pending.
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 984 */
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 985 if (kvm_check_request(KVM_REQ_UNHALT, vcpu)) {
72875d8a4d92f6 arch/mips/kvm/emulate.c Radim Krčmář 2017-04-26 986 kvm_clear_request(KVM_REQ_UNHALT, vcpu);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 987 vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 988 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 989 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 990
d98403a525fe16 arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 991 return EMULATE_DONE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 992 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 993
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 994 static void kvm_mips_change_entryhi(struct kvm_vcpu *vcpu,
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 995 unsigned long entryhi)
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 996 {
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 997 struct mips_coproc *cop0 = vcpu->arch.cop0;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 998 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 999 int cpu, i;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1000 u32 nasid = entryhi & KVM_ENTRYHI_ASID;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1001
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1002 if (((kvm_read_c0_guest_entryhi(cop0) & KVM_ENTRYHI_ASID) != nasid)) {
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1003 trace_kvm_asid_change(vcpu, kvm_read_c0_guest_entryhi(cop0) &
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1004 KVM_ENTRYHI_ASID, nasid);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1005
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1006 /*
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1007 * Flush entries from the GVA page tables.
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1008 * Guest user page table will get flushed lazily on re-entry to
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1009 * guest user if the guest ASID actually changes.
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1010 */
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1011 kvm_mips_flush_gva_pt(kern_mm->pgd, KMF_KERN);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1012
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1013 /*
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1014 * Regenerate/invalidate kernel MMU context.
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1015 * The user MMU context will be regenerated lazily on re-entry
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1016 * to guest user if the guest ASID actually changes.
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1017 */
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1018 preempt_disable();
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1019 cpu = smp_processor_id();
4739f7dd99d757 arch/mips/kvm/emulate.c Paul Burton 2019-02-02 1020 get_new_mmu_context(kern_mm);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1021 for_each_possible_cpu(i)
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1022 if (i != cpu)
0b317c389c6771 arch/mips/kvm/emulate.c Paul Burton 2019-02-02 1023 set_cpu_context(i, kern_mm, 0);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1024 preempt_enable();
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1025 }
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1026 kvm_write_c0_guest_entryhi(cop0, entryhi);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1027 }
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1028
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 @1029 enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu)
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1030 {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1031 struct mips_coproc *cop0 = vcpu->arch.cop0;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1032 struct kvm_mips_tlb *tlb;
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1033 unsigned long pc = vcpu->arch.pc;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1034 int index;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1035
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1036 index = kvm_read_c0_guest_index(cop0);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1037 if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) {
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1038 /* UNDEFINED */
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1039 kvm_debug("[%#lx] TLBR Index %#x out of range\n", pc, index);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1040 index &= KVM_MIPS_GUEST_TLB_SIZE - 1;
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1041 }
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1042
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1043 tlb = &vcpu->arch.guest_tlb[index];
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1044 kvm_write_c0_guest_pagemask(cop0, tlb->tlb_mask);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1045 kvm_write_c0_guest_entrylo0(cop0, tlb->tlb_lo[0]);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1046 kvm_write_c0_guest_entrylo1(cop0, tlb->tlb_lo[1]);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1047 kvm_mips_change_entryhi(vcpu, tlb->tlb_hi);
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1048
dc44abd6aad224 arch/mips/kvm/emulate.c James Hogan 2017-03-14 1049 return EMULATE_DONE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1050 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1051
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1052 /**
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1053 * kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map.
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1054 * @vcpu: VCPU with changed mappings.
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1055 * @tlb: TLB entry being removed.
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1056 *
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1057 * This is called to indicate a single change in guest MMU mappings, so that we
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1058 * can arrange TLB flushes on this and other CPUs.
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1059 */
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1060 static void kvm_mips_invalidate_guest_tlb(struct kvm_vcpu *vcpu,
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1061 struct kvm_mips_tlb *tlb)
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1062 {
c550d53934d821 arch/mips/kvm/emulate.c James Hogan 2016-10-11 1063 struct mm_struct *kern_mm = &vcpu->arch.guest_kernel_mm;
c550d53934d821 arch/mips/kvm/emulate.c James Hogan 2016-10-11 1064 struct mm_struct *user_mm = &vcpu->arch.guest_user_mm;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1065 int cpu, i;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1066 bool user;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1067
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1068 /* No need to flush for entries which are already invalid */
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1069 if (!((tlb->tlb_lo[0] | tlb->tlb_lo[1]) & ENTRYLO_V))
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1070 return;
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1071 /* Don't touch host kernel page tables or TLB mappings */
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1072 if ((unsigned long)tlb->tlb_hi > 0x7fffffff)
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1073 return;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1074 /* User address space doesn't need flushing for KSeg2/3 changes */
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1075 user = tlb->tlb_hi < KVM_GUEST_KSEG0;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1076
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1077 preempt_disable();
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1078
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1079 /* Invalidate page table entries */
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1080 kvm_trap_emul_invalidate_gva(vcpu, tlb->tlb_hi & VPN2_MASK, user);
aba8592950f1c6 arch/mips/kvm/emulate.c James Hogan 2016-12-16 1081
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1082 /*
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1083 * Probe the shadow host TLB for the entry being overwritten, if one
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1084 * matches, invalidate it
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1085 */
57e3869cfaaec7 arch/mips/kvm/emulate.c James Hogan 2016-10-08 1086 kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi, user, true);
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1087
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1088 /* Invalidate the whole ASID on other CPUs */
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1089 cpu = smp_processor_id();
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1090 for_each_possible_cpu(i) {
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1091 if (i == cpu)
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1092 continue;
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1093 if (user)
0b317c389c6771 arch/mips/kvm/emulate.c Paul Burton 2019-02-02 1094 set_cpu_context(i, user_mm, 0);
0b317c389c6771 arch/mips/kvm/emulate.c Paul Burton 2019-02-02 1095 set_cpu_context(i, kern_mm, 0);
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1096 }
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1097
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1098 preempt_enable();
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1099 }
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1100
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1101 /* Write Guest TLB Entry @ Index */
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 @1102 enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1103 {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1104 struct mips_coproc *cop0 = vcpu->arch.cop0;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1105 int index = kvm_read_c0_guest_index(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1106 struct kvm_mips_tlb *tlb = NULL;
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1107 unsigned long pc = vcpu->arch.pc;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1108
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1109 if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) {
6ad78a5c75c5bc arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1110 kvm_debug("%s: illegal index: %d\n", __func__, index);
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1111 kvm_debug("[%#lx] COP0_TLBWI [%d] (entryhi: %#lx, entrylo0: %#lx entrylo1: %#lx, mask: %#lx)\n",
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1112 pc, index, kvm_read_c0_guest_entryhi(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1113 kvm_read_c0_guest_entrylo0(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1114 kvm_read_c0_guest_entrylo1(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1115 kvm_read_c0_guest_pagemask(cop0));
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1116 index = (index & ~0x80000000) % KVM_MIPS_GUEST_TLB_SIZE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1117 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1118
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1119 tlb = &vcpu->arch.guest_tlb[index];
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1120
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1121 kvm_mips_invalidate_guest_tlb(vcpu, tlb);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1122
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1123 tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1124 tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0);
9fbfb06a406577 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1125 tlb->tlb_lo[0] = kvm_read_c0_guest_entrylo0(cop0);
9fbfb06a406577 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1126 tlb->tlb_lo[1] = kvm_read_c0_guest_entrylo1(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1127
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1128 kvm_debug("[%#lx] COP0_TLBWI [%d] (entryhi: %#lx, entrylo0: %#lx entrylo1: %#lx, mask: %#lx)\n",
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1129 pc, index, kvm_read_c0_guest_entryhi(cop0),
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1130 kvm_read_c0_guest_entrylo0(cop0),
d116e812f9026e arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1131 kvm_read_c0_guest_entrylo1(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1132 kvm_read_c0_guest_pagemask(cop0));
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1133
d98403a525fe16 arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1134 return EMULATE_DONE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1135 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1136
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1137 /* Write Guest TLB Entry @ Random Index */
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 @1138 enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu)
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1139 {
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1140 struct mips_coproc *cop0 = vcpu->arch.cop0;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1141 struct kvm_mips_tlb *tlb = NULL;
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1142 unsigned long pc = vcpu->arch.pc;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1143 int index;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1144
e6331a321aafcc arch/mips/kvm/emulate.c Paul Burton 2019-03-22 1145 index = prandom_u32_max(KVM_MIPS_GUEST_TLB_SIZE);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1146 tlb = &vcpu->arch.guest_tlb[index];
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1147
91e4f1b6073dd6 arch/mips/kvm/emulate.c James Hogan 2016-09-15 1148 kvm_mips_invalidate_guest_tlb(vcpu, tlb);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1149
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1150 tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1151 tlb->tlb_hi = kvm_read_c0_guest_entryhi(cop0);
9fbfb06a406577 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1152 tlb->tlb_lo[0] = kvm_read_c0_guest_entrylo0(cop0);
9fbfb06a406577 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1153 tlb->tlb_lo[1] = kvm_read_c0_guest_entrylo1(cop0);
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1154
8cffd197485122 arch/mips/kvm/emulate.c James Hogan 2016-06-09 1155 kvm_debug("[%#lx] COP0_TLBWR[%d] (entryhi: %#lx, entrylo0: %#lx entrylo1: %#lx)\n",
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1156 pc, index, kvm_read_c0_guest_entryhi(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1157 kvm_read_c0_guest_entrylo0(cop0),
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1158 kvm_read_c0_guest_entrylo1(cop0));
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1159
d98403a525fe16 arch/mips/kvm/kvm_mips_emul.c Dengcheng Zhu 2014-06-26 1160 return EMULATE_DONE;
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1161 }
e685c689f3a84e arch/mips/kvm/kvm_mips_emul.c Sanjay Lal 2012-11-21 1162
:::::: The code at line 946 was first introduced by commit
:::::: e685c689f3a84e5e24a5867afc5e7b5857efa3e4 KVM/MIPS32: Privileged instruction/target branch emulation.
:::::: TO: Sanjay Lal <sanjayl@xxxxxxxxxxx>
:::::: CC: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip