[PATCH 4/4] powerpc: Add -Wimplicit-fallthrough to arch CFLAGS

kbuild test robot lkp at intel.com
Thu Oct 11 03:55:33 AEDT 2018


Hi Michael,

I love your patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc7 next-20181010]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Michael-Ellerman/powerpc-Move-core-kernel-logic-into-arch-powerpc-Kbuild/20181010-205834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-socrates_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.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=7.2.0 make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/align.c: In function 'emulate_spe':
>> arch/powerpc/kernel/align.c:183:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __get_user_inatomic(temp.v[3], p++);
           ^~
   arch/powerpc/kernel/align.c:184:3: note: here
      case 4:
      ^~~~
   arch/powerpc/kernel/align.c:186:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __get_user_inatomic(temp.v[5], p++);
           ^~
   arch/powerpc/kernel/align.c:187:3: note: here
      case 2:
      ^~~~
   arch/powerpc/kernel/align.c:266:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __put_user_inatomic(data.v[3], p++);
           ^~
   arch/powerpc/kernel/align.c:267:3: note: here
      case 4:
      ^~~~
   arch/powerpc/kernel/align.c:269:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       ret |= __put_user_inatomic(data.v[5], p++);
           ^~
   arch/powerpc/kernel/align.c:270:3: note: here
      case 2:
      ^~~~
   cc1: all warnings being treated as errors

vim +183 arch/powerpc/kernel/align.c

26caeb2e Kumar Gala             2007-08-24  104  
26caeb2e Kumar Gala             2007-08-24  105  /*
26caeb2e Kumar Gala             2007-08-24  106   * Emulate SPE loads and stores.
26caeb2e Kumar Gala             2007-08-24  107   * Only Book-E has these instructions, and it does true little-endian,
26caeb2e Kumar Gala             2007-08-24  108   * so we don't need the address swizzling.
26caeb2e Kumar Gala             2007-08-24  109   */
26caeb2e Kumar Gala             2007-08-24  110  static int emulate_spe(struct pt_regs *regs, unsigned int reg,
26caeb2e Kumar Gala             2007-08-24  111  		       unsigned int instr)
26caeb2e Kumar Gala             2007-08-24  112  {
f626190d Anton Blanchard        2013-09-23  113  	int ret;
26caeb2e Kumar Gala             2007-08-24  114  	union {
26caeb2e Kumar Gala             2007-08-24  115  		u64 ll;
26caeb2e Kumar Gala             2007-08-24  116  		u32 w[2];
26caeb2e Kumar Gala             2007-08-24  117  		u16 h[4];
26caeb2e Kumar Gala             2007-08-24  118  		u8 v[8];
26caeb2e Kumar Gala             2007-08-24  119  	} data, temp;
26caeb2e Kumar Gala             2007-08-24  120  	unsigned char __user *p, *addr;
26caeb2e Kumar Gala             2007-08-24  121  	unsigned long *evr = &current->thread.evr[reg];
26caeb2e Kumar Gala             2007-08-24  122  	unsigned int nb, flags;
26caeb2e Kumar Gala             2007-08-24  123  
26caeb2e Kumar Gala             2007-08-24  124  	instr = (instr >> 1) & 0x1f;
26caeb2e Kumar Gala             2007-08-24  125  
26caeb2e Kumar Gala             2007-08-24  126  	/* DAR has the operand effective address */
26caeb2e Kumar Gala             2007-08-24  127  	addr = (unsigned char __user *)regs->dar;
26caeb2e Kumar Gala             2007-08-24  128  
26caeb2e Kumar Gala             2007-08-24  129  	nb = spe_aligninfo[instr].len;
26caeb2e Kumar Gala             2007-08-24  130  	flags = spe_aligninfo[instr].flags;
26caeb2e Kumar Gala             2007-08-24  131  
26caeb2e Kumar Gala             2007-08-24  132  	/* Verify the address of the operand */
26caeb2e Kumar Gala             2007-08-24  133  	if (unlikely(user_mode(regs) &&
26caeb2e Kumar Gala             2007-08-24  134  		     !access_ok((flags & ST ? VERIFY_WRITE : VERIFY_READ),
26caeb2e Kumar Gala             2007-08-24  135  				addr, nb)))
26caeb2e Kumar Gala             2007-08-24  136  		return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  137  
26caeb2e Kumar Gala             2007-08-24  138  	/* userland only */
26caeb2e Kumar Gala             2007-08-24  139  	if (unlikely(!user_mode(regs)))
26caeb2e Kumar Gala             2007-08-24  140  		return 0;
26caeb2e Kumar Gala             2007-08-24  141  
26caeb2e Kumar Gala             2007-08-24  142  	flush_spe_to_thread(current);
26caeb2e Kumar Gala             2007-08-24  143  
26caeb2e Kumar Gala             2007-08-24  144  	/* If we are loading, get the data from user space, else
26caeb2e Kumar Gala             2007-08-24  145  	 * get it from register values
26caeb2e Kumar Gala             2007-08-24  146  	 */
26caeb2e Kumar Gala             2007-08-24  147  	if (flags & ST) {
26caeb2e Kumar Gala             2007-08-24  148  		data.ll = 0;
26caeb2e Kumar Gala             2007-08-24  149  		switch (instr) {
26caeb2e Kumar Gala             2007-08-24  150  		case EVSTDD:
26caeb2e Kumar Gala             2007-08-24  151  		case EVSTDW:
26caeb2e Kumar Gala             2007-08-24  152  		case EVSTDH:
26caeb2e Kumar Gala             2007-08-24  153  			data.w[0] = *evr;
26caeb2e Kumar Gala             2007-08-24  154  			data.w[1] = regs->gpr[reg];
26caeb2e Kumar Gala             2007-08-24  155  			break;
26caeb2e Kumar Gala             2007-08-24  156  		case EVSTWHE:
26caeb2e Kumar Gala             2007-08-24  157  			data.h[2] = *evr >> 16;
26caeb2e Kumar Gala             2007-08-24  158  			data.h[3] = regs->gpr[reg] >> 16;
26caeb2e Kumar Gala             2007-08-24  159  			break;
26caeb2e Kumar Gala             2007-08-24  160  		case EVSTWHO:
26caeb2e Kumar Gala             2007-08-24  161  			data.h[2] = *evr & 0xffff;
26caeb2e Kumar Gala             2007-08-24  162  			data.h[3] = regs->gpr[reg] & 0xffff;
26caeb2e Kumar Gala             2007-08-24  163  			break;
26caeb2e Kumar Gala             2007-08-24  164  		case EVSTWWE:
26caeb2e Kumar Gala             2007-08-24  165  			data.w[1] = *evr;
26caeb2e Kumar Gala             2007-08-24  166  			break;
26caeb2e Kumar Gala             2007-08-24  167  		case EVSTWWO:
26caeb2e Kumar Gala             2007-08-24  168  			data.w[1] = regs->gpr[reg];
26caeb2e Kumar Gala             2007-08-24  169  			break;
26caeb2e Kumar Gala             2007-08-24  170  		default:
26caeb2e Kumar Gala             2007-08-24  171  			return -EINVAL;
26caeb2e Kumar Gala             2007-08-24  172  		}
26caeb2e Kumar Gala             2007-08-24  173  	} else {
26caeb2e Kumar Gala             2007-08-24  174  		temp.ll = data.ll = 0;
26caeb2e Kumar Gala             2007-08-24  175  		ret = 0;
26caeb2e Kumar Gala             2007-08-24  176  		p = addr;
26caeb2e Kumar Gala             2007-08-24  177  
26caeb2e Kumar Gala             2007-08-24  178  		switch (nb) {
26caeb2e Kumar Gala             2007-08-24  179  		case 8:
26caeb2e Kumar Gala             2007-08-24  180  			ret |= __get_user_inatomic(temp.v[0], p++);
26caeb2e Kumar Gala             2007-08-24  181  			ret |= __get_user_inatomic(temp.v[1], p++);
26caeb2e Kumar Gala             2007-08-24  182  			ret |= __get_user_inatomic(temp.v[2], p++);
26caeb2e Kumar Gala             2007-08-24 @183  			ret |= __get_user_inatomic(temp.v[3], p++);
26caeb2e Kumar Gala             2007-08-24  184  		case 4:
26caeb2e Kumar Gala             2007-08-24  185  			ret |= __get_user_inatomic(temp.v[4], p++);
26caeb2e Kumar Gala             2007-08-24  186  			ret |= __get_user_inatomic(temp.v[5], p++);
26caeb2e Kumar Gala             2007-08-24  187  		case 2:
26caeb2e Kumar Gala             2007-08-24  188  			ret |= __get_user_inatomic(temp.v[6], p++);
26caeb2e Kumar Gala             2007-08-24  189  			ret |= __get_user_inatomic(temp.v[7], p++);
26caeb2e Kumar Gala             2007-08-24  190  			if (unlikely(ret))
26caeb2e Kumar Gala             2007-08-24  191  				return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  192  		}
26caeb2e Kumar Gala             2007-08-24  193  
26caeb2e Kumar Gala             2007-08-24  194  		switch (instr) {
26caeb2e Kumar Gala             2007-08-24  195  		case EVLDD:
26caeb2e Kumar Gala             2007-08-24  196  		case EVLDW:
26caeb2e Kumar Gala             2007-08-24  197  		case EVLDH:
26caeb2e Kumar Gala             2007-08-24  198  			data.ll = temp.ll;
26caeb2e Kumar Gala             2007-08-24  199  			break;
26caeb2e Kumar Gala             2007-08-24  200  		case EVLHHESPLAT:
26caeb2e Kumar Gala             2007-08-24  201  			data.h[0] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  202  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  203  			break;
26caeb2e Kumar Gala             2007-08-24  204  		case EVLHHOUSPLAT:
26caeb2e Kumar Gala             2007-08-24  205  		case EVLHHOSSPLAT:
26caeb2e Kumar Gala             2007-08-24  206  			data.h[1] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  207  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  208  			break;
26caeb2e Kumar Gala             2007-08-24  209  		case EVLWHE:
26caeb2e Kumar Gala             2007-08-24  210  			data.h[0] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  211  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  212  			break;
26caeb2e Kumar Gala             2007-08-24  213  		case EVLWHOU:
26caeb2e Kumar Gala             2007-08-24  214  		case EVLWHOS:
26caeb2e Kumar Gala             2007-08-24  215  			data.h[1] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  216  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  217  			break;
26caeb2e Kumar Gala             2007-08-24  218  		case EVLWWSPLAT:
26caeb2e Kumar Gala             2007-08-24  219  			data.w[0] = temp.w[1];
26caeb2e Kumar Gala             2007-08-24  220  			data.w[1] = temp.w[1];
26caeb2e Kumar Gala             2007-08-24  221  			break;
26caeb2e Kumar Gala             2007-08-24  222  		case EVLWHSPLAT:
26caeb2e Kumar Gala             2007-08-24  223  			data.h[0] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  224  			data.h[1] = temp.h[2];
26caeb2e Kumar Gala             2007-08-24  225  			data.h[2] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  226  			data.h[3] = temp.h[3];
26caeb2e Kumar Gala             2007-08-24  227  			break;
26caeb2e Kumar Gala             2007-08-24  228  		default:
26caeb2e Kumar Gala             2007-08-24  229  			return -EINVAL;
26caeb2e Kumar Gala             2007-08-24  230  		}
26caeb2e Kumar Gala             2007-08-24  231  	}
26caeb2e Kumar Gala             2007-08-24  232  
26caeb2e Kumar Gala             2007-08-24  233  	if (flags & SW) {
26caeb2e Kumar Gala             2007-08-24  234  		switch (flags & 0xf0) {
26caeb2e Kumar Gala             2007-08-24  235  		case E8:
f626190d Anton Blanchard        2013-09-23  236  			data.ll = swab64(data.ll);
26caeb2e Kumar Gala             2007-08-24  237  			break;
26caeb2e Kumar Gala             2007-08-24  238  		case E4:
f626190d Anton Blanchard        2013-09-23  239  			data.w[0] = swab32(data.w[0]);
f626190d Anton Blanchard        2013-09-23  240  			data.w[1] = swab32(data.w[1]);
26caeb2e Kumar Gala             2007-08-24  241  			break;
26caeb2e Kumar Gala             2007-08-24  242  		/* Its half word endian */
26caeb2e Kumar Gala             2007-08-24  243  		default:
f626190d Anton Blanchard        2013-09-23  244  			data.h[0] = swab16(data.h[0]);
f626190d Anton Blanchard        2013-09-23  245  			data.h[1] = swab16(data.h[1]);
f626190d Anton Blanchard        2013-09-23  246  			data.h[2] = swab16(data.h[2]);
f626190d Anton Blanchard        2013-09-23  247  			data.h[3] = swab16(data.h[3]);
26caeb2e Kumar Gala             2007-08-24  248  			break;
26caeb2e Kumar Gala             2007-08-24  249  		}
26caeb2e Kumar Gala             2007-08-24  250  	}
26caeb2e Kumar Gala             2007-08-24  251  
26caeb2e Kumar Gala             2007-08-24  252  	if (flags & SE) {
26caeb2e Kumar Gala             2007-08-24  253  		data.w[0] = (s16)data.h[1];
26caeb2e Kumar Gala             2007-08-24  254  		data.w[1] = (s16)data.h[3];
26caeb2e Kumar Gala             2007-08-24  255  	}
26caeb2e Kumar Gala             2007-08-24  256  
26caeb2e Kumar Gala             2007-08-24  257  	/* Store result to memory or update registers */
26caeb2e Kumar Gala             2007-08-24  258  	if (flags & ST) {
26caeb2e Kumar Gala             2007-08-24  259  		ret = 0;
26caeb2e Kumar Gala             2007-08-24  260  		p = addr;
26caeb2e Kumar Gala             2007-08-24  261  		switch (nb) {
26caeb2e Kumar Gala             2007-08-24  262  		case 8:
26caeb2e Kumar Gala             2007-08-24  263  			ret |= __put_user_inatomic(data.v[0], p++);
26caeb2e Kumar Gala             2007-08-24  264  			ret |= __put_user_inatomic(data.v[1], p++);
26caeb2e Kumar Gala             2007-08-24  265  			ret |= __put_user_inatomic(data.v[2], p++);
26caeb2e Kumar Gala             2007-08-24  266  			ret |= __put_user_inatomic(data.v[3], p++);
26caeb2e Kumar Gala             2007-08-24  267  		case 4:
26caeb2e Kumar Gala             2007-08-24  268  			ret |= __put_user_inatomic(data.v[4], p++);
26caeb2e Kumar Gala             2007-08-24  269  			ret |= __put_user_inatomic(data.v[5], p++);
26caeb2e Kumar Gala             2007-08-24  270  		case 2:
26caeb2e Kumar Gala             2007-08-24  271  			ret |= __put_user_inatomic(data.v[6], p++);
26caeb2e Kumar Gala             2007-08-24  272  			ret |= __put_user_inatomic(data.v[7], p++);
26caeb2e Kumar Gala             2007-08-24  273  		}
26caeb2e Kumar Gala             2007-08-24  274  		if (unlikely(ret))
26caeb2e Kumar Gala             2007-08-24  275  			return -EFAULT;
26caeb2e Kumar Gala             2007-08-24  276  	} else {
26caeb2e Kumar Gala             2007-08-24  277  		*evr = data.w[0];
26caeb2e Kumar Gala             2007-08-24  278  		regs->gpr[reg] = data.w[1];
26caeb2e Kumar Gala             2007-08-24  279  	}
26caeb2e Kumar Gala             2007-08-24  280  
26caeb2e Kumar Gala             2007-08-24  281  	return 1;
26caeb2e Kumar Gala             2007-08-24  282  }
26caeb2e Kumar Gala             2007-08-24  283  #endif /* CONFIG_SPE */
5daf9071 Benjamin Herrenschmidt 2005-11-18  284  

:::::: The code at line 183 was first introduced by commit
:::::: 26caeb2ee1924d564e8d8190aa783a569532f81a [POWERPC] Handle alignment faults on SPE load/store instructions

:::::: TO: Kumar Gala <galak at kernel.crashing.org>
:::::: CC: Kumar Gala <galak at kernel.crashing.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 17535 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20181011/ccca0ff9/attachment-0001.gz>


More information about the Linuxppc-dev mailing list