From patchwork Sun Jul 28 22:53:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matteo Croce X-Patchwork-Id: 11063087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7662613A4 for ; Sun, 28 Jul 2019 22:53:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E00286F3 for ; Sun, 28 Jul 2019 22:53:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 541FA2870E; Sun, 28 Jul 2019 22:53:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD3A1286F3 for ; Sun, 28 Jul 2019 22:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ki626QeOeNqzFngVzvIBSib/xhJoWV9i4uT9FvAlGB4=; b=VayH2Wpus2Ol/6 jY1lnAnojEiQY8+KfGzMVwylLKXAa3zAo2EJvnbY2NNUguO3z56OOmBKrUz21f6q/50JkN3xct3UW wFiyaTnBI+YN/roR97iO6hOwvqDnOoXm94fJ+5l4nJvC55iP0VY33urobCp6ZVDdgOnYaCe3ygg+n si7i7wSV6IqOcI/pdpa9tvzeWm2sU7gRhSknPE9Eqf7rELDdSiCRrOqJGpGPGKQPNCjTy1YIEzvi9 E5YXVcgXGf8UxTE13MV/zDpeWorM7X2ZcVPOVy5nzf3Cet4C9YBbDnvdT0L6bL5A3PDhjG1zLHnve f9d2LXQu13VHvNS+obIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hrs2d-0007uP-Tf; Sun, 28 Jul 2019 22:53:23 +0000 Received: from mail-wr1-f67.google.com ([209.85.221.67]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hrs2a-0007th-RU for linux-arm-kernel@lists.infradead.org; Sun, 28 Jul 2019 22:53:22 +0000 Received: by mail-wr1-f67.google.com with SMTP id g17so59747772wrr.5 for ; Sun, 28 Jul 2019 15:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ftGcDLnR4imQmQ+UkOat+KWbwwjELLyC+CYKk4KZ2MI=; b=bbFMzStlum9xNq8SpWD8ON2n0vdGLW2lMz+5Co7TKuMPvk1R17+njuW0vPoTx2GfKF xQE9rp7DqLgtQ1rufga93ja8afM+zQ1VgZs+j+FPdTcHSAjZJgEKv8Zuc6+TXr7Lmet+ nQq/LC+BRVNK5DyCRu0GjEmWueTY8X4JX8PDX5iwKuRfdRa46f/cTDSVNd5QVP2ZSwJH osrFXZO53o5TXqu73mvYAV9U8tlCNBkm6/NLbK/cegN+Ef/JwX4FbOUZzAk9ZzWkurZI +czw57DU6Ore3yMqc2x2btk34O3e8xOgMiQYZ/Og5eRmGclg+FYKxbUjoq2OGeNVqNQG jALw== X-Gm-Message-State: APjAAAW98KdTLB3AFGrohDa7IcwGWE+BCZ5SiVlKhm/Q5IFDiqQdZMkQ hMTRWafk8z6aOE50/KT0tEkkFQS9qUI= X-Google-Smtp-Source: APXvYqzXz/uRYLBkINGQsD6hev7BbnvXZn0rdIH9tudJoRoTw/rjgcK0VY1Im/N583+KNY1tUym6uQ== X-Received: by 2002:a5d:4212:: with SMTP id n18mr112558387wrq.261.1564354397866; Sun, 28 Jul 2019 15:53:17 -0700 (PDT) Received: from mcroce-redhat.homenet.telecomitalia.it (host221-208-dynamic.27-79-r.retail.telecomitalia.it. [79.27.208.221]) by smtp.gmail.com with ESMTPSA id q193sm45278109wme.8.2019.07.28.15.53.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 15:53:17 -0700 (PDT) From: Matteo Croce To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH] KVM: arm64: mark expected switch fall-through Date: Mon, 29 Jul 2019 00:53:11 +0200 Message-Id: <20190728225311.5414-1-mcroce@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190728_155320_897304_DC31FAB8 X-CRM114-Status: UNSURE ( 7.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Will Deacon , linux-kernel@vger.kernel.org, Catalin Marinas Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }