[linuxppc:next-test 92/92] arch/powerpc/kernel/kvm_emul.S:132: Error: non-constant expression in ".if" statement

From: kernel test robot
Date: Fri Aug 20 2021 - 23:29:57 EST


Hi Christophe,

First bad commit (maybe != root cause):

tree: https://github.com/linuxppc/linux next-test
head: 579a7abaf051ef84dd24cf19e6541455e7df72ce
commit: 579a7abaf051ef84dd24cf19e6541455e7df72ce [92/92] powerpc: Define and use MSR_RI only on non booke/40x
config: powerpc-randconfig-c024-20210821 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 11.2.0
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
# https://github.com/linuxppc/linux/commit/579a7abaf051ef84dd24cf19e6541455e7df72ce
git remote add linuxppc https://github.com/linuxppc/linux
git fetch --no-tags linuxppc next-test
git checkout 579a7abaf051ef84dd24cf19e6541455e7df72ce
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/powerpc/kernel/kvm_emul.S: Assembler messages:
>> arch/powerpc/kernel/kvm_emul.S:132: Error: non-constant expression in ".if" statement
>> arch/powerpc/kernel/kvm_emul.S:132: Error: non-constant expression in ".if" statement
>> arch/powerpc/kernel/kvm_emul.S:59: Error: invalid operands (*ABS* and *UND* sections) for `|'
arch/powerpc/kernel/kvm_emul.S:60: Error: invalid operands (*ABS* and *UND* sections) for `|'
arch/powerpc/kernel/kvm_emul.S:66: Error: invalid operands (*ABS* and *UND* sections) for `|'
arch/powerpc/kernel/kvm_emul.S:132: Error: invalid operands (*ABS* and *UND* sections) for `|'


vim +132 arch/powerpc/kernel/kvm_emul.S

92234722ed631f Alexander Graf 2010-07-29 26
92234722ed631f Alexander Graf 2010-07-29 27 #define SCRATCH_SAVE \
92234722ed631f Alexander Graf 2010-07-29 28 /* Enable critical section. We are critical if \
92234722ed631f Alexander Graf 2010-07-29 29 shared->critical == r1 */ \
92234722ed631f Alexander Graf 2010-07-29 30 STL64(r1, KVM_MAGIC_PAGE + KVM_MAGIC_CRITICAL, 0); \
92234722ed631f Alexander Graf 2010-07-29 31 \
92234722ed631f Alexander Graf 2010-07-29 32 /* Save state */ \
92234722ed631f Alexander Graf 2010-07-29 33 PPC_STL r31, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH1)(0); \
92234722ed631f Alexander Graf 2010-07-29 34 PPC_STL r30, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH2)(0); \
92234722ed631f Alexander Graf 2010-07-29 35 mfcr r31; \
92234722ed631f Alexander Graf 2010-07-29 36 stw r31, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH3)(0);
92234722ed631f Alexander Graf 2010-07-29 37
92234722ed631f Alexander Graf 2010-07-29 38 #define SCRATCH_RESTORE \
92234722ed631f Alexander Graf 2010-07-29 39 /* Restore state */ \
92234722ed631f Alexander Graf 2010-07-29 40 PPC_LL r31, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH1)(0); \
92234722ed631f Alexander Graf 2010-07-29 41 lwz r30, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH3)(0); \
92234722ed631f Alexander Graf 2010-07-29 42 mtcr r30; \
92234722ed631f Alexander Graf 2010-07-29 43 PPC_LL r30, (KVM_MAGIC_PAGE + KVM_MAGIC_SCRATCH2)(0); \
92234722ed631f Alexander Graf 2010-07-29 44 \
92234722ed631f Alexander Graf 2010-07-29 45 /* Disable critical section. We are critical if \
92234722ed631f Alexander Graf 2010-07-29 46 shared->critical == r1 and r2 is always != r1 */ \
92234722ed631f Alexander Graf 2010-07-29 47 STL64(r2, KVM_MAGIC_PAGE + KVM_MAGIC_CRITICAL, 0);
819a63dc792b08 Alexander Graf 2010-07-29 48
befdc0a65afd17 Liu Yu-B13201 2011-12-01 49 .global kvm_template_start
befdc0a65afd17 Liu Yu-B13201 2011-12-01 50 kvm_template_start:
befdc0a65afd17 Liu Yu-B13201 2011-12-01 51
819a63dc792b08 Alexander Graf 2010-07-29 52 .global kvm_emulate_mtmsrd
819a63dc792b08 Alexander Graf 2010-07-29 53 kvm_emulate_mtmsrd:
819a63dc792b08 Alexander Graf 2010-07-29 54
819a63dc792b08 Alexander Graf 2010-07-29 55 SCRATCH_SAVE
819a63dc792b08 Alexander Graf 2010-07-29 56
819a63dc792b08 Alexander Graf 2010-07-29 57 /* Put MSR & ~(MSR_EE|MSR_RI) in r31 */
819a63dc792b08 Alexander Graf 2010-07-29 58 LL64(r31, KVM_MAGIC_PAGE + KVM_MAGIC_MSR, 0)
819a63dc792b08 Alexander Graf 2010-07-29 @59 lis r30, (~(MSR_EE | MSR_RI))@h
819a63dc792b08 Alexander Graf 2010-07-29 60 ori r30, r30, (~(MSR_EE | MSR_RI))@l
819a63dc792b08 Alexander Graf 2010-07-29 61 and r31, r31, r30
819a63dc792b08 Alexander Graf 2010-07-29 62
819a63dc792b08 Alexander Graf 2010-07-29 63 /* OR the register's (MSR_EE|MSR_RI) on MSR */
819a63dc792b08 Alexander Graf 2010-07-29 64 kvm_emulate_mtmsrd_reg:
df08bd10266ce6 Alexander Graf 2010-08-05 65 ori r30, r0, 0
df08bd10266ce6 Alexander Graf 2010-08-05 66 andi. r30, r30, (MSR_EE|MSR_RI)
819a63dc792b08 Alexander Graf 2010-07-29 67 or r31, r31, r30
819a63dc792b08 Alexander Graf 2010-07-29 68
819a63dc792b08 Alexander Graf 2010-07-29 69 /* Put MSR back into magic page */
819a63dc792b08 Alexander Graf 2010-07-29 70 STL64(r31, KVM_MAGIC_PAGE + KVM_MAGIC_MSR, 0)
819a63dc792b08 Alexander Graf 2010-07-29 71
819a63dc792b08 Alexander Graf 2010-07-29 72 /* Check if we have to fetch an interrupt */
819a63dc792b08 Alexander Graf 2010-07-29 73 lwz r31, (KVM_MAGIC_PAGE + KVM_MAGIC_INT)(0)
819a63dc792b08 Alexander Graf 2010-07-29 74 cmpwi r31, 0
819a63dc792b08 Alexander Graf 2010-07-29 75 beq+ no_check
819a63dc792b08 Alexander Graf 2010-07-29 76
819a63dc792b08 Alexander Graf 2010-07-29 77 /* Check if we may trigger an interrupt */
819a63dc792b08 Alexander Graf 2010-07-29 78 andi. r30, r30, MSR_EE
819a63dc792b08 Alexander Graf 2010-07-29 79 beq no_check
819a63dc792b08 Alexander Graf 2010-07-29 80
819a63dc792b08 Alexander Graf 2010-07-29 81 SCRATCH_RESTORE
819a63dc792b08 Alexander Graf 2010-07-29 82
819a63dc792b08 Alexander Graf 2010-07-29 83 /* Nag hypervisor */
df08bd10266ce6 Alexander Graf 2010-08-05 84 kvm_emulate_mtmsrd_orig_ins:
819a63dc792b08 Alexander Graf 2010-07-29 85 tlbsync
819a63dc792b08 Alexander Graf 2010-07-29 86
819a63dc792b08 Alexander Graf 2010-07-29 87 b kvm_emulate_mtmsrd_branch
819a63dc792b08 Alexander Graf 2010-07-29 88
819a63dc792b08 Alexander Graf 2010-07-29 89 no_check:
819a63dc792b08 Alexander Graf 2010-07-29 90
819a63dc792b08 Alexander Graf 2010-07-29 91 SCRATCH_RESTORE
819a63dc792b08 Alexander Graf 2010-07-29 92
819a63dc792b08 Alexander Graf 2010-07-29 93 /* Go back to caller */
819a63dc792b08 Alexander Graf 2010-07-29 94 kvm_emulate_mtmsrd_branch:
819a63dc792b08 Alexander Graf 2010-07-29 95 b .
819a63dc792b08 Alexander Graf 2010-07-29 96 kvm_emulate_mtmsrd_end:
819a63dc792b08 Alexander Graf 2010-07-29 97
819a63dc792b08 Alexander Graf 2010-07-29 98 .global kvm_emulate_mtmsrd_branch_offs
819a63dc792b08 Alexander Graf 2010-07-29 99 kvm_emulate_mtmsrd_branch_offs:
819a63dc792b08 Alexander Graf 2010-07-29 100 .long (kvm_emulate_mtmsrd_branch - kvm_emulate_mtmsrd) / 4
819a63dc792b08 Alexander Graf 2010-07-29 101
819a63dc792b08 Alexander Graf 2010-07-29 102 .global kvm_emulate_mtmsrd_reg_offs
819a63dc792b08 Alexander Graf 2010-07-29 103 kvm_emulate_mtmsrd_reg_offs:
819a63dc792b08 Alexander Graf 2010-07-29 104 .long (kvm_emulate_mtmsrd_reg - kvm_emulate_mtmsrd) / 4
819a63dc792b08 Alexander Graf 2010-07-29 105
df08bd10266ce6 Alexander Graf 2010-08-05 106 .global kvm_emulate_mtmsrd_orig_ins_offs
df08bd10266ce6 Alexander Graf 2010-08-05 107 kvm_emulate_mtmsrd_orig_ins_offs:
df08bd10266ce6 Alexander Graf 2010-08-05 108 .long (kvm_emulate_mtmsrd_orig_ins - kvm_emulate_mtmsrd) / 4
df08bd10266ce6 Alexander Graf 2010-08-05 109
819a63dc792b08 Alexander Graf 2010-07-29 110 .global kvm_emulate_mtmsrd_len
819a63dc792b08 Alexander Graf 2010-07-29 111 kvm_emulate_mtmsrd_len:
819a63dc792b08 Alexander Graf 2010-07-29 112 .long (kvm_emulate_mtmsrd_end - kvm_emulate_mtmsrd) / 4
7810927760a0d1 Alexander Graf 2010-07-29 113
7810927760a0d1 Alexander Graf 2010-07-29 114
d35b1075afc017 Bharat Bhushan 2012-05-20 115 #define MSR_SAFE_BITS (MSR_EE | MSR_RI)
7810927760a0d1 Alexander Graf 2010-07-29 116 #define MSR_CRITICAL_BITS ~MSR_SAFE_BITS
7810927760a0d1 Alexander Graf 2010-07-29 117
7810927760a0d1 Alexander Graf 2010-07-29 118 .global kvm_emulate_mtmsr
7810927760a0d1 Alexander Graf 2010-07-29 119 kvm_emulate_mtmsr:
7810927760a0d1 Alexander Graf 2010-07-29 120
7810927760a0d1 Alexander Graf 2010-07-29 121 SCRATCH_SAVE
7810927760a0d1 Alexander Graf 2010-07-29 122
7810927760a0d1 Alexander Graf 2010-07-29 123 /* Fetch old MSR in r31 */
7810927760a0d1 Alexander Graf 2010-07-29 124 LL64(r31, KVM_MAGIC_PAGE + KVM_MAGIC_MSR, 0)
7810927760a0d1 Alexander Graf 2010-07-29 125
7810927760a0d1 Alexander Graf 2010-07-29 126 /* Find the changed bits between old and new MSR */
7810927760a0d1 Alexander Graf 2010-07-29 127 kvm_emulate_mtmsr_reg1:
512ba59ed9c580 Alexander Graf 2010-08-05 128 ori r30, r0, 0
512ba59ed9c580 Alexander Graf 2010-08-05 129 xor r31, r30, r31
7810927760a0d1 Alexander Graf 2010-07-29 130
7810927760a0d1 Alexander Graf 2010-07-29 131 /* Check if we need to really do mtmsr */
7810927760a0d1 Alexander Graf 2010-07-29 @132 LOAD_REG_IMMEDIATE(r30, MSR_CRITICAL_BITS)
7810927760a0d1 Alexander Graf 2010-07-29 133 and. r31, r31, r30
7810927760a0d1 Alexander Graf 2010-07-29 134
7810927760a0d1 Alexander Graf 2010-07-29 135 /* No critical bits changed? Maybe we can stay in the guest. */
7810927760a0d1 Alexander Graf 2010-07-29 136 beq maybe_stay_in_guest
7810927760a0d1 Alexander Graf 2010-07-29 137
7810927760a0d1 Alexander Graf 2010-07-29 138 do_mtmsr:
7810927760a0d1 Alexander Graf 2010-07-29 139
7810927760a0d1 Alexander Graf 2010-07-29 140 SCRATCH_RESTORE
7810927760a0d1 Alexander Graf 2010-07-29 141
7810927760a0d1 Alexander Graf 2010-07-29 142 /* Just fire off the mtmsr if it's critical */
7810927760a0d1 Alexander Graf 2010-07-29 143 kvm_emulate_mtmsr_orig_ins:
7810927760a0d1 Alexander Graf 2010-07-29 144 mtmsr r0
7810927760a0d1 Alexander Graf 2010-07-29 145
7810927760a0d1 Alexander Graf 2010-07-29 146 b kvm_emulate_mtmsr_branch
7810927760a0d1 Alexander Graf 2010-07-29 147
7810927760a0d1 Alexander Graf 2010-07-29 148 maybe_stay_in_guest:
7810927760a0d1 Alexander Graf 2010-07-29 149
512ba59ed9c580 Alexander Graf 2010-08-05 150 /* Get the target register in r30 */
512ba59ed9c580 Alexander Graf 2010-08-05 151 kvm_emulate_mtmsr_reg2:
512ba59ed9c580 Alexander Graf 2010-08-05 152 ori r30, r0, 0
512ba59ed9c580 Alexander Graf 2010-08-05 153
f9208427f72e6c Bharat Bhushan 2011-10-13 154 /* Put MSR into magic page because we don't call mtmsr */
f9208427f72e6c Bharat Bhushan 2011-10-13 155 STL64(r30, KVM_MAGIC_PAGE + KVM_MAGIC_MSR, 0)
f9208427f72e6c Bharat Bhushan 2011-10-13 156
7810927760a0d1 Alexander Graf 2010-07-29 157 /* Check if we have to fetch an interrupt */
7810927760a0d1 Alexander Graf 2010-07-29 158 lwz r31, (KVM_MAGIC_PAGE + KVM_MAGIC_INT)(0)
7810927760a0d1 Alexander Graf 2010-07-29 159 cmpwi r31, 0
7810927760a0d1 Alexander Graf 2010-07-29 160 beq+ no_mtmsr
7810927760a0d1 Alexander Graf 2010-07-29 161
7810927760a0d1 Alexander Graf 2010-07-29 162 /* Check if we may trigger an interrupt */
512ba59ed9c580 Alexander Graf 2010-08-05 163 andi. r31, r30, MSR_EE
f9208427f72e6c Bharat Bhushan 2011-10-13 164 bne do_mtmsr
7810927760a0d1 Alexander Graf 2010-07-29 165
7810927760a0d1 Alexander Graf 2010-07-29 166 no_mtmsr:
7810927760a0d1 Alexander Graf 2010-07-29 167
7810927760a0d1 Alexander Graf 2010-07-29 168 SCRATCH_RESTORE
7810927760a0d1 Alexander Graf 2010-07-29 169
7810927760a0d1 Alexander Graf 2010-07-29 170 /* Go back to caller */
7810927760a0d1 Alexander Graf 2010-07-29 171 kvm_emulate_mtmsr_branch:
7810927760a0d1 Alexander Graf 2010-07-29 172 b .
7810927760a0d1 Alexander Graf 2010-07-29 173 kvm_emulate_mtmsr_end:
7810927760a0d1 Alexander Graf 2010-07-29 174

:::::: The code at line 132 was first introduced by commit
:::::: 7810927760a0d16d7a41be4dab895fbbf9445bc0 KVM: PPC: PV mtmsrd L=0 and mtmsr

:::::: TO: Alexander Graf <agraf@xxxxxxx>
:::::: CC: Avi Kivity <avi@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip