mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Matteo Croce <mcroce@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: mark expected switch fall-through
Date: Mon, 29 Jul 2019 10:46:16 +0100	[thread overview]
Message-ID: <e14529dd-a517-afcb-24f3-198dc8ebb364@kernel.org> (raw)
In-Reply-To: <20190728225311.5414-1-mcroce@redhat.com>

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 <mcroce@redhat.com>
> ---
>  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...

      reply	other threads:[~2019-07-29  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-28 22:53 Matteo Croce
2019-07-29  9:46 ` Marc Zyngier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e14529dd-a517-afcb-24f3-198dc8ebb364@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcroce@redhat.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®