From: Oliver Upton <oupton@google.com>
To: kvmarm@lists.cs.columbia.edu
Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, maz@kernel.org,
james.morse@arm.com, alexandru.elisei@arm.com,
suzuki.poulose@arm.com, reijiw@google.com, ricarkol@google.com,
Oliver Upton <oupton@google.com>
Subject: [PATCH v6 01/12] KVM: arm64: Don't depend on fallthrough to hide SYSTEM_RESET2
Date: Wed, 4 May 2022 03:24:35 +0000 [thread overview]
Message-ID: <20220504032446.4133305-2-oupton@google.com> (raw)
In-Reply-To: <20220504032446.4133305-1-oupton@google.com>
Depending on a fallthrough to the default case for hiding SYSTEM_RESET2
requires that any new case statements clean up the failure path for this
PSCI call.
Unhitch SYSTEM_RESET2 from the default case by setting val to
PSCI_RET_NOT_SUPPORTED outside of the switch statement. Apply the
cleanup to both the PSCI_1_1_FN_SYSTEM_RESET2 and
PSCI_1_0_FN_PSCI_FEATURES handlers.
No functional change intended.
Signed-off-by: Oliver Upton <oupton@google.com>
Reviewed-by: Reiji Watanabe <reijiw@google.com>
---
arch/arm64/kvm/psci.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/kvm/psci.c b/arch/arm64/kvm/psci.c
index 708d80e8e60d..67fbd6ef022c 100644
--- a/arch/arm64/kvm/psci.c
+++ b/arch/arm64/kvm/psci.c
@@ -305,9 +305,9 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
{
+ unsigned long val = PSCI_RET_NOT_SUPPORTED;
u32 psci_fn = smccc_get_function(vcpu);
u32 arg;
- unsigned long val;
int ret = 1;
switch(psci_fn) {
@@ -320,6 +320,8 @@ static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
if (val)
break;
+ val = PSCI_RET_NOT_SUPPORTED;
+
switch(arg) {
case PSCI_0_2_FN_PSCI_VERSION:
case PSCI_0_2_FN_CPU_SUSPEND:
@@ -338,13 +340,8 @@ static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
break;
case PSCI_1_1_FN_SYSTEM_RESET2:
case PSCI_1_1_FN64_SYSTEM_RESET2:
- if (minor >= 1) {
+ if (minor >= 1)
val = 0;
- break;
- }
- fallthrough;
- default:
- val = PSCI_RET_NOT_SUPPORTED;
break;
}
break;
@@ -365,7 +362,7 @@ static int kvm_psci_1_x_call(struct kvm_vcpu *vcpu, u32 minor)
val = PSCI_RET_INVALID_PARAMS;
break;
}
- fallthrough;
+ break;
default:
return kvm_psci_0_2_call(vcpu);
}
--
2.36.0.464.gb9c8b46e94-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-05-04 3:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 3:24 [PATCH v6 00/12] KVM: arm64: PSCI SYSTEM_SUSPEND support Oliver Upton
2022-05-04 3:24 ` Oliver Upton [this message]
2022-05-04 3:24 ` [PATCH v6 02/12] KVM: arm64: Dedupe vCPU power off helpers Oliver Upton
2022-05-04 3:24 ` [PATCH v6 03/12] KVM: arm64: Track vCPU power state using MP state values Oliver Upton
2022-05-04 3:24 ` [PATCH v6 04/12] KVM: arm64: Rename the KVM_REQ_SLEEP handler Oliver Upton
2022-05-04 3:24 ` [PATCH v6 05/12] KVM: arm64: Return a value from check_vcpu_requests() Oliver Upton
2022-05-04 3:24 ` [PATCH v6 06/12] KVM: arm64: Add support for userspace to suspend a vCPU Oliver Upton
2022-05-04 3:24 ` [PATCH v6 07/12] KVM: arm64: Implement PSCI SYSTEM_SUSPEND Oliver Upton
2022-05-04 3:24 ` [PATCH v6 08/12] selftests: KVM: Rename psci_cpu_on_test to psci_test Oliver Upton
2022-05-04 3:24 ` [PATCH v6 09/12] selftests: KVM: Create helper for making SMCCC calls Oliver Upton
2022-05-04 3:24 ` [PATCH v6 10/12] selftests: KVM: Use KVM_SET_MP_STATE to power off vCPU in psci_test Oliver Upton
2022-05-04 3:24 ` [PATCH v6 11/12] selftests: KVM: Refactor psci_test to make it amenable to new tests Oliver Upton
2022-05-04 3:24 ` [PATCH v6 12/12] selftests: KVM: Test SYSTEM_SUSPEND PSCI call Oliver Upton
2022-05-04 12:01 ` [PATCH v6 00/12] KVM: arm64: PSCI SYSTEM_SUSPEND support Marc Zyngier
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=20220504032446.4133305-2-oupton@google.com \
--to=oupton@google.com \
--cc=alexandru.elisei@arm.com \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=reijiw@google.com \
--cc=ricarkol@google.com \
--cc=suzuki.poulose@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).