[PATCH v5 20/21] powerpc sstep: Add support for prefixed load/stores

kbuild test robot lkp at intel.com
Mon Apr 6 21:29:30 AEST 2020


Hi Jordan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.6]
[cannot apply to powerpc/next kvm-ppc/kvm-ppc-next scottwood/next next-20200406]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jordan-Niethe/Initial-Prefixed-Instruction-support/20200406-165215
base:    7111951b8d4973bda27ff663f2cf18b663d15b48
config: powerpc-allnoconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=9.3.0 make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/powerpc/include/asm/code-patching.h:14,
                    from arch/powerpc/include/asm/kprobes.h:24,
                    from include/linux/kprobes.h:30,
                    from arch/powerpc/lib/sstep.c:8:
   arch/powerpc/include/asm/inst.h:69:38: error: unknown type name 'ppc_inst'
      69 | static inline bool ppc_inst_prefixed(ppc_inst x)
         |                                      ^~~~~~~~
   arch/powerpc/include/asm/inst.h:79:19: error: redefinition of 'ppc_inst_val'
      79 | static inline u32 ppc_inst_val(struct ppc_inst x)
         |                   ^~~~~~~~~~~~
   arch/powerpc/include/asm/inst.h:21:19: note: previous definition of 'ppc_inst_val' was here
      21 | static inline u32 ppc_inst_val(struct ppc_inst x)
         |                   ^~~~~~~~~~~~
   arch/powerpc/include/asm/inst.h: In function 'ppc_inst_len':
   arch/powerpc/include/asm/inst.h:103:10: error: implicit declaration of function 'ppc_inst_prefixed'; did you mean 'ppc_inst_write'? [-Werror=implicit-function-declaration]
     103 |  return (ppc_inst_prefixed(x)) ? 8  : 4;
         |          ^~~~~~~~~~~~~~~~~
         |          ppc_inst_write
   arch/powerpc/lib/sstep.c: In function 'analyse_instr':
   arch/powerpc/lib/sstep.c:1215:11: error: implicit declaration of function 'ppc_inst_suffix'; did you mean 'ppc_inst_swab'? [-Werror=implicit-function-declaration]
    1215 |  suffix = ppc_inst_suffix(instr);
         |           ^~~~~~~~~~~~~~~
         |           ppc_inst_swab
>> arch/powerpc/lib/sstep.c:1207:41: error: unused variable 'prefix_r' [-Werror=unused-variable]
    1207 |  unsigned int suffixopcode, prefixtype, prefix_r;
         |                                         ^~~~~~~~
>> arch/powerpc/lib/sstep.c:1207:29: error: unused variable 'prefixtype' [-Werror=unused-variable]
    1207 |  unsigned int suffixopcode, prefixtype, prefix_r;
         |                             ^~~~~~~~~~
>> arch/powerpc/lib/sstep.c:1207:15: error: unused variable 'suffixopcode' [-Werror=unused-variable]
    1207 |  unsigned int suffixopcode, prefixtype, prefix_r;
         |               ^~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/prefix_r +1207 arch/powerpc/lib/sstep.c

  1191	
  1192	/*
  1193	 * Decode an instruction, and return information about it in *op
  1194	 * without changing *regs.
  1195	 * Integer arithmetic and logical instructions, branches, and barrier
  1196	 * instructions can be emulated just using the information in *op.
  1197	 *
  1198	 * Return value is 1 if the instruction can be emulated just by
  1199	 * updating *regs with the information in *op, -1 if we need the
  1200	 * GPRs but *regs doesn't contain the full register set, or 0
  1201	 * otherwise.
  1202	 */
  1203	int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
  1204			  struct ppc_inst instr)
  1205	{
  1206		unsigned int opcode, ra, rb, rc, rd, spr, u;
> 1207		unsigned int suffixopcode, prefixtype, prefix_r;
  1208		unsigned long int imm;
  1209		unsigned long int val, val2;
  1210		unsigned int mb, me, sh;
  1211		unsigned int word, suffix;
  1212		long ival;
  1213	
  1214		word = ppc_inst_val(instr);
  1215		suffix = ppc_inst_suffix(instr);
  1216	
  1217		op->type = COMPUTE;
  1218	
  1219		opcode = word >> 26;
  1220		switch (opcode) {
  1221		case 16:	/* bc */
  1222			op->type = BRANCH;
  1223			imm = (signed short)(word & 0xfffc);
  1224			if ((word & 2) == 0)
  1225				imm += regs->nip;
  1226			op->val = truncate_if_32bit(regs->msr, imm);
  1227			if (word & 1)
  1228				op->type |= SETLK;
  1229			if (branch_taken(word, regs, op))
  1230				op->type |= BRTAKEN;
  1231			return 1;
  1232	#ifdef CONFIG_PPC64
  1233		case 17:	/* sc */
  1234			if ((word & 0xfe2) == 2)
  1235				op->type = SYSCALL;
  1236			else
  1237				op->type = UNKNOWN;
  1238			return 0;
  1239	#endif
  1240		case 18:	/* b */
  1241			op->type = BRANCH | BRTAKEN;
  1242			imm = word & 0x03fffffc;
  1243			if (imm & 0x02000000)
  1244				imm -= 0x04000000;
  1245			if ((word & 2) == 0)
  1246				imm += regs->nip;
  1247			op->val = truncate_if_32bit(regs->msr, imm);
  1248			if (word & 1)
  1249				op->type |= SETLK;
  1250			return 1;
  1251		case 19:
  1252			switch ((word >> 1) & 0x3ff) {
  1253			case 0:		/* mcrf */
  1254				op->type = COMPUTE + SETCC;
  1255				rd = 7 - ((word >> 23) & 0x7);
  1256				ra = 7 - ((word >> 18) & 0x7);
  1257				rd *= 4;
  1258				ra *= 4;
  1259				val = (regs->ccr >> ra) & 0xf;
  1260				op->ccval = (regs->ccr & ~(0xfUL << rd)) | (val << rd);
  1261				return 1;
  1262	
  1263			case 16:	/* bclr */
  1264			case 528:	/* bcctr */
  1265				op->type = BRANCH;
  1266				imm = (word & 0x400)? regs->ctr: regs->link;
  1267				op->val = truncate_if_32bit(regs->msr, imm);
  1268				if (word & 1)
  1269					op->type |= SETLK;
  1270				if (branch_taken(word, regs, op))
  1271					op->type |= BRTAKEN;
  1272				return 1;
  1273	
  1274			case 18:	/* rfid, scary */
  1275				if (regs->msr & MSR_PR)
  1276					goto priv;
  1277				op->type = RFI;
  1278				return 0;
  1279	
  1280			case 150:	/* isync */
  1281				op->type = BARRIER | BARRIER_ISYNC;
  1282				return 1;
  1283	
  1284			case 33:	/* crnor */
  1285			case 129:	/* crandc */
  1286			case 193:	/* crxor */
  1287			case 225:	/* crnand */
  1288			case 257:	/* crand */
  1289			case 289:	/* creqv */
  1290			case 417:	/* crorc */
  1291			case 449:	/* cror */
  1292				op->type = COMPUTE + SETCC;
  1293				ra = (word >> 16) & 0x1f;
  1294				rb = (word >> 11) & 0x1f;
  1295				rd = (word >> 21) & 0x1f;
  1296				ra = (regs->ccr >> (31 - ra)) & 1;
  1297				rb = (regs->ccr >> (31 - rb)) & 1;
  1298				val = (word >> (6 + ra * 2 + rb)) & 1;
  1299				op->ccval = (regs->ccr & ~(1UL << (31 - rd))) |
  1300					(val << (31 - rd));
  1301				return 1;
  1302			}
  1303			break;
  1304		case 31:
  1305			switch ((word >> 1) & 0x3ff) {
  1306			case 598:	/* sync */
  1307				op->type = BARRIER + BARRIER_SYNC;
  1308	#ifdef __powerpc64__
  1309				switch ((word >> 21) & 3) {
  1310				case 1:		/* lwsync */
  1311					op->type = BARRIER + BARRIER_LWSYNC;
  1312					break;
  1313				case 2:		/* ptesync */
  1314					op->type = BARRIER + BARRIER_PTESYNC;
  1315					break;
  1316				}
  1317	#endif
  1318				return 1;
  1319	
  1320			case 854:	/* eieio */
  1321				op->type = BARRIER + BARRIER_EIEIO;
  1322				return 1;
  1323			}
  1324			break;
  1325		}
  1326	
  1327		/* Following cases refer to regs->gpr[], so we need all regs */
  1328		if (!FULL_REGS(regs))
  1329			return -1;
  1330	
  1331		rd = (word >> 21) & 0x1f;
  1332		ra = (word >> 16) & 0x1f;
  1333		rb = (word >> 11) & 0x1f;
  1334		rc = (word >> 6) & 0x1f;
  1335	
  1336		switch (opcode) {
  1337	#ifdef __powerpc64__
  1338		case 2:		/* tdi */
  1339			if (rd & trap_compare(regs->gpr[ra], (short) word))
  1340				goto trap;
  1341			return 1;
  1342	#endif
  1343		case 3:		/* twi */
  1344			if (rd & trap_compare((int)regs->gpr[ra], (short) word))
  1345				goto trap;
  1346			return 1;
  1347	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 6411 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20200406/47e43bbc/attachment.gz>


More information about the Linuxppc-dev mailing list