From patchwork Thu Aug 22 17:19:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 172042 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1193643ily; Thu, 22 Aug 2019 10:27:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwl5WpIKx602PRJeSjwrRT4qhyyfN+lOxolSpKMSyhSeKE+Ajq9Cn+MsffEKMwBqp2oHmTe X-Received: by 2002:a65:43c2:: with SMTP id n2mr338595pgp.110.1566494845282; Thu, 22 Aug 2019 10:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566494845; cv=none; d=google.com; s=arc-20160816; b=dX6RvnGMpt4kCTBXLSbrBLzGEYNukqQl7TsYteLE9WRm81o0Fb0qPBc5u8HEsY5ycd Ob5ZtFh7FdjPzkZUfzfTJ4T69X7bRja+6pxU3gs0DiviUwK+C/bspV3Jp0H8op9ei58s 4M9PiCgzM1vuA26ZVh7iIJgxQphH1GQRnm8ag/6XaS2PabLprPlU/C2cTuHGAakzFdhb DJiCGlNpewg2dtV5UEPQ0lqD78dpN64zLAzVsEhU1oIJ2rld5G6ZsfOlDOtfHnowrIVz odf0lg3OlqL5KHOtfKppPP+KJmUTJPE2Sci2D1UnruJfeAXK/lGZJ0fIHovgrj99LVkl SiNw== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L8e+jJ8WnQuZFi4ia9klVOdPVE3nT52F+fEzA6Mi73o=; b=GBxI50K/VDHDiYw5aU3FJnVVQBDAKAuYF167psoMALE1mqZeBtgZRyid3oTJ93oVG2 fBtNi0t1Mq3Er8tTJPJVEW92igO0gfH25vsiStKDnWdTwLD89Ol9PzmNdjwQycyi55hC pH+6BfOrLG2phrCB1hulooh/uETJX3pF53Im1w+sWG+3WrWuGSREr/9gCXJ+mWrPq9j7 t6pitE5dISUlpOJBvmMm/RvImi9vgrFua78N7+j29XV0yjeqtDoXNqVXqC5DHX7OJKnP sRNGaYkrPidtgCYnaLjdeo4SwQedTOHL+4OgqqnH2cCfFQzAoXwd7MU4WHsqcCa5tTeU 6+vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tqmELVbA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m186si210959pfb.38.2019.08.22.10.27.25; Thu, 22 Aug 2019 10:27:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=tqmELVbA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392020AbfHVR1X (ORCPT + 28 others); Thu, 22 Aug 2019 13:27:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:50226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404527AbfHVRZz (ORCPT ); Thu, 22 Aug 2019 13:25:55 -0400 Received: from localhost (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4E1E72342B; Thu, 22 Aug 2019 17:25:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566494754; bh=j3JYLHpF4NIBmPoPHjZ+6njDedYcqo4ggTg6KcrZ9Lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqmELVbAe4mUUiwVvn9m3hIyKBulgm9AszyqlhgiC1qNopwn/glaKQcN+zHALJn2M ui+NfOdphI2LiMl5gGsSWcCbHpiCa0cfGLgE+y96aofyDWMw8PqMkPmtlg5CWuONoP W1BcK51BN+BuO/YpN8H3V2xYm+nflz0UAkB2FerM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Roxell , Marc Zyngier Subject: [PATCH 4.19 54/85] arm64: KVM: regmap: Fix unexpected switch fall-through Date: Thu, 22 Aug 2019 10:19:27 -0700 Message-Id: <20190822171733.580567685@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190822171731.012687054@linuxfoundation.org> References: <20190822171731.012687054@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anders Roxell commit 3d584a3c85d6fe2cf878f220d4ad7145e7f89218 upstream. When fall-through warnings was enabled by default, commit d93512ef0f0e ("Makefile: Globally enable fall-through warning"), the following warnings was starting to show up: 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: ^~~~ Rework to add a 'break;' in the swich-case since it didn't have that, leading to an interresting set of bugs. Cc: stable@vger.kernel.org # v4.17+ Fixes: a892819560c4 ("KVM: arm64: Prepare to handle deferred save/restore of 32-bit registers") Signed-off-by: Anders Roxell [maz: reworked commit message, fixed stable range] Signed-off-by: Marc Zyngier Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/regmap.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/arm64/kvm/regmap.c +++ b/arch/arm64/kvm/regmap.c @@ -189,13 +189,18 @@ void vcpu_write_spsr32(struct kvm_vcpu * switch (spsr_idx) { case KVM_SPSR_SVC: write_sysreg_el1(v, spsr); + break; case KVM_SPSR_ABT: write_sysreg(v, spsr_abt); + break; case KVM_SPSR_UND: write_sysreg(v, spsr_und); + break; case KVM_SPSR_IRQ: write_sysreg(v, spsr_irq); + break; case KVM_SPSR_FIQ: write_sysreg(v, spsr_fiq); + break; } }