Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1475459ybl; Thu, 22 Aug 2019 15:26:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMZLr1MD07rSaUsiU97NjwbOh/WZskavyc7ca9FJ3hkXbTEibBUCnskblM10VuEHJu2+5o X-Received: by 2002:a62:b515:: with SMTP id y21mr1609014pfe.213.1566512803973; Thu, 22 Aug 2019 15:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566512803; cv=none; d=google.com; s=arc-20160816; b=IY2MWLtjHBPrxmaxxCTttHa+SE0/Zt2ZEHFuRZsATccJFov9ltn4eejlugSbIaWN3o C4dmKx5E2KOShZH0AxorxaBrGIFRqm6FlfYevqlHsYTUAdoA3oL4/OdIQ/qKBFfy8pON f1m5ljGVoYBHkjIyR9v7DyOyKdG8TBZqwALgnrHvhle7EdJEPu447ejxLudFflsykN6A WUlXTWOG6bF3NtngI+xWJuvrBCU+TUAMjY5XkCxcXZ9ncpg1ifp/ZcK8SV4E9iblZYww esEIjRsvTirAtWMMcWL0iGOPoz3EE507GUSsvZsODgvN51X+m6ykYGRqeKfPPKm9+DGW /vpg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZtTTqWaYvBFfoToj9nmA779AKE+RyZupvo/+aqSx7uA=; b=ePMldEP/30lOq1yOh2lpVkLo9HyKwTzk9P99ag7Z8CbH8mrLiHCAR8p1T/qJrUOQEV NR0j6VMY5msIT2qBL5djVk/Ri/9VTVjEKkLxMkHcWLRaBXPUoQUtjCEpm7v/Uqpfhhvu jemfrdN92mlHtU/4uSpnglc/zE27SDciFGGupVRatVr30Zd+MFrlyWd/rHIz/NUf+F+/ Z+F8RnS0CWIdhbc+dMdv5hkiAy5xlnI7V/c8x3YZd9DGthA0B6UEy/m7copSl9U2f1Z4 mPrJgKLbXvq7A4sHN2PzcRZLDI/tCREisW6+wwJxtBc2mFTsZqsU3lEUgmWg6JpnFEuZ nQtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I5FY5bGp; 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=pass (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 t26si737115pfh.275.2019.08.22.15.26.28; Thu, 22 Aug 2019 15:26:43 -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=I5FY5bGp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390701AbfHVRJM (ORCPT + 99 others); Thu, 22 Aug 2019 13:09:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:59266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390650AbfHVRJF (ORCPT ); Thu, 22 Aug 2019 13:09:05 -0400 Received: from sasha-vm.mshome.net (wsip-184-188-36-2.sd.sd.cox.net [184.188.36.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F1A823404; Thu, 22 Aug 2019 17:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566493744; bh=LnOiB9OqCt0GRJbG4EA7BRdT3fImUBdJIvCPdBkUXKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5FY5bGphIHUqxVnP5Wdp7kIpz/F0cHn+R5D52zDyufw8A4rAW8TeHiTp00Q4+t0R 3IrpQ2zS5tjmvto7xSwE5biKWOYrS7uxSm8GNqgQC4JoMoexuxfaGj6cTk+R1hZp3D lLbNBVyKlXXrII9H47/Q7MJGF6kFeH2ALbw5PDr0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anders Roxell , Marc Zyngier , Greg Kroah-Hartman Subject: [PATCH 5.2 091/135] arm64: KVM: regmap: Fix unexpected switch fall-through Date: Thu, 22 Aug 2019 13:07:27 -0400 Message-Id: <20190822170811.13303-92-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190822170811.13303-1-sashal@kernel.org> References: <20190822170811.13303-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.2.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.2.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.2.10-rc1 X-KernelTest-Deadline: 2019-08-24T17:07+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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(+) diff --git a/arch/arm64/kvm/regmap.c b/arch/arm64/kvm/regmap.c index d66613e6ad080..8a38ccf8dc021 100644 --- a/arch/arm64/kvm/regmap.c +++ b/arch/arm64/kvm/regmap.c @@ -178,13 +178,18 @@ void vcpu_write_spsr32(struct kvm_vcpu *vcpu, unsigned long v) 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; } } -- 2.20.1