Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3208176ybi; Mon, 29 Jul 2019 02:47:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvQ/YkELv5AQ2h/5/qrcfy7oSz4QSOn5t3dw/UyVXFGtSh5sdCl7GqhYmgvjIQyzTacoz0 X-Received: by 2002:a62:14c4:: with SMTP id 187mr34716601pfu.241.1564393644823; Mon, 29 Jul 2019 02:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564393644; cv=none; d=google.com; s=arc-20160816; b=hGw8X0wRDqDu2CLazxuHR6gfCyXDGIbCNhDQES6iEYnWG729zshsq1qs6Ih6bernu1 SPHinuuMwDxK0HEOTL8YDTvcKNqYOkNBcKbAyFmjkuBA3x1KupW/E1lTIiGqLRI9J/y0 RrrLVQ7O5X1+igqInOfJv+CTXurADs0ClDdVkD0jKy8xgxKgvEectOFQPOJRvaFOrolL xu7r6RsXNFlsalMjDG4zyKJFKnJ7YkYrSLgGRHEogEwjikfpFHG+5N1T7dvMaE7ZdXAn gKA4LykX0u5QbZFslMG8CmGoSTQm2pC4pee9dlH7iPGx9bOc2M3B4JiMeyEr+LjjF3ZP 60HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=T9OtVYo/xhV083D/ARfZbZ9roQ7+Ddngo4FS13Le3Mc=; b=Q2qkiA3/3SSI66hzSpZWm+L/aGFsLyVFiyarDQ89NGHlVRiHBBT9Exed/YKQKU5Tj2 ZBOAZysyBny/t2frQKUptH6esM5BkKVK3Z1wbQDX11GtwqAo7VGwjZMvbaP9s/6HW3yg S4/hF+P8Q/NIUNKbku1ZC2P3LCWXC/3o3/Ija0N/m3FtlMLoaajyeB8twOQtSUt4cYg8 LSlQdXwDulYXTTWSRINljZ2suQQ3pQWFX5yjQWbfycckGlW831yRcIl4DbvGrEkPaE8L Ll6PYYzPbk3o8nB6gRRyGsMdySp+NSMQDVF3DxVC08lb7hhenv/+miVKi1LHmxNaJCTw s0yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c35si17277414pgm.51.2019.07.29.02.47.09; Mon, 29 Jul 2019 02:47:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbfG2JqT (ORCPT + 99 others); Mon, 29 Jul 2019 05:46:19 -0400 Received: from foss.arm.com ([217.140.110.172]:40846 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfG2JqT (ORCPT ); Mon, 29 Jul 2019 05:46:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D7B8152D; Mon, 29 Jul 2019 02:46:18 -0700 (PDT) Received: from [10.1.197.61] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF3FB3F694; Mon, 29 Jul 2019 02:46:17 -0700 (PDT) Subject: Re: [PATCH] KVM: arm64: mark expected switch fall-through To: Matteo Croce , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org References: <20190728225311.5414-1-mcroce@redhat.com> From: Marc Zyngier Organization: Approximate Message-ID: Date: Mon, 29 Jul 2019 10:46:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190728225311.5414-1-mcroce@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/07/2019 23:53, Matteo Croce wrote: > Mark switch cases where we are expecting to fall through, > fixes the following warning: > > In file included from ./arch/arm64/include/asm/kvm_emulate.h:19, > from arch/arm64/kvm/regmap.c:13: > arch/arm64/kvm/regmap.c: In function ‘vcpu_write_spsr32’: > ./arch/arm64/include/asm/kvm_hyp.h:31:3: warning: this statement may fall through [-Wimplicit-fallthrough=] > asm volatile(ALTERNATIVE(__msr_s(r##nvh, "%x0"), \ > ^~~ > ./arch/arm64/include/asm/kvm_hyp.h:46:31: note: in expansion of macro ‘write_sysreg_elx’ > #define write_sysreg_el1(v,r) write_sysreg_elx(v, r, _EL1, _EL12) > ^~~~~~~~~~~~~~~~ > arch/arm64/kvm/regmap.c:180:3: note: in expansion of macro ‘write_sysreg_el1’ > write_sysreg_el1(v, SYS_SPSR); > ^~~~~~~~~~~~~~~~ > arch/arm64/kvm/regmap.c:181:2: note: here > case KVM_SPSR_ABT: > ^~~~ > In file included from ./arch/arm64/include/asm/cputype.h:132, > from ./arch/arm64/include/asm/cache.h:8, > from ./include/linux/cache.h:6, > from ./include/linux/printk.h:9, > from ./include/linux/kernel.h:15, > from ./include/asm-generic/bug.h:18, > from ./arch/arm64/include/asm/bug.h:26, > from ./include/linux/bug.h:5, > from ./include/linux/mmdebug.h:5, > from ./include/linux/mm.h:9, > from arch/arm64/kvm/regmap.c:11: > ./arch/arm64/include/asm/sysreg.h:837:2: warning: this statement may fall through [-Wimplicit-fallthrough=] > asm volatile("msr " __stringify(r) ", %x0" \ > ^~~ > arch/arm64/kvm/regmap.c:182:3: note: in expansion of macro ‘write_sysreg’ > write_sysreg(v, spsr_abt); > ^~~~~~~~~~~~ > arch/arm64/kvm/regmap.c:183:2: note: here > case KVM_SPSR_UND: > ^~~~ > In file included from ./arch/arm64/include/asm/cputype.h:132, > from ./arch/arm64/include/asm/cache.h:8, > from ./include/linux/cache.h:6, > from ./include/linux/printk.h:9, > from ./include/linux/kernel.h:15, > from ./include/asm-generic/bug.h:18, > from ./arch/arm64/include/asm/bug.h:26, > from ./include/linux/bug.h:5, > from ./include/linux/mmdebug.h:5, > from ./include/linux/mm.h:9, > from arch/arm64/kvm/regmap.c:11: > ./arch/arm64/include/asm/sysreg.h:837:2: warning: this statement may fall through [-Wimplicit-fallthrough=] > asm volatile("msr " __stringify(r) ", %x0" \ > ^~~ > arch/arm64/kvm/regmap.c:184:3: note: in expansion of macro ‘write_sysreg’ > write_sysreg(v, spsr_und); > ^~~~~~~~~~~~ > arch/arm64/kvm/regmap.c:185:2: note: here > case KVM_SPSR_IRQ: > ^~~~ > In file included from ./arch/arm64/include/asm/cputype.h:132, > from ./arch/arm64/include/asm/cache.h:8, > from ./include/linux/cache.h:6, > from ./include/linux/printk.h:9, > from ./include/linux/kernel.h:15, > from ./include/asm-generic/bug.h:18, > from ./arch/arm64/include/asm/bug.h:26, > from ./include/linux/bug.h:5, > from ./include/linux/mmdebug.h:5, > from ./include/linux/mm.h:9, > from arch/arm64/kvm/regmap.c:11: > ./arch/arm64/include/asm/sysreg.h:837:2: warning: this statement may fall through [-Wimplicit-fallthrough=] > asm volatile("msr " __stringify(r) ", %x0" \ > ^~~ > arch/arm64/kvm/regmap.c:186:3: note: in expansion of macro ‘write_sysreg’ > write_sysreg(v, spsr_irq); > ^~~~~~~~~~~~ > arch/arm64/kvm/regmap.c:187:2: note: here > case KVM_SPSR_FIQ: > ^~~~ > > Signed-off-by: Matteo Croce > --- > arch/arm64/kvm/regmap.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/kvm/regmap.c b/arch/arm64/kvm/regmap.c > index 0d60e4f0af66..b376b2fdbf51 100644 > --- a/arch/arm64/kvm/regmap.c > +++ b/arch/arm64/kvm/regmap.c > @@ -178,12 +178,16 @@ void vcpu_write_spsr32(struct kvm_vcpu *vcpu, unsigned long v) > switch (spsr_idx) { > case KVM_SPSR_SVC: > write_sysreg_el1(v, SYS_SPSR); > + /* fallthrough */ > case KVM_SPSR_ABT: > write_sysreg(v, spsr_abt); > + /* fallthrough */ > case KVM_SPSR_UND: > write_sysreg(v, spsr_und); > + /* fallthrough */ > case KVM_SPSR_IRQ: > write_sysreg(v, spsr_irq); > + /* fallthrough */ > case KVM_SPSR_FIQ: > write_sysreg(v, spsr_fiq); > } > That's absolutely the *WRONG* fix. Please see [1] for the real thing. Thanks, M. [1] https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git/commit/?id=3d584a3c85d6fe2cf878f220d4ad7145e7f89218 -- Jazz is not dead, it just smells funny...