From patchwork Wed Oct 11 08:16:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 13416853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CEA7CD98FD for ; Wed, 11 Oct 2023 08:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjJKIRS (ORCPT ); Wed, 11 Oct 2023 04:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbjJKIRR (ORCPT ); Wed, 11 Oct 2023 04:17:17 -0400 Received: from out-190.mta1.migadu.com (out-190.mta1.migadu.com [95.215.58.190]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61EDA93 for ; Wed, 11 Oct 2023 01:17:16 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697012234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l4MtoeUio+QJkGABxRH9TB9eJMl3DOp+ol2TBjjaaNk=; b=nOGAlB2DnGpg6RE7lLGfaR1M3Nm4Ta5kiffzTkiJebyxxBPn3bjs2t1G96WeuBR6P6Zc12 0hPCeExtmT53kw8V0DyaHUn++UpeP7zwQ/UcnAfIz8h0exp8vsdwqpQ7JLipFuUIiyw57A 4VXFa+kMs4QF4EJzbi4jYzJe5P01Qi8= From: Oliver Upton To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Raghavendra Rao Ananta , Mark Rutland , Will Deacon , James Clark , Oliver Upton Subject: [PATCH 1/2] KVM: arm64: Disallow vPMU for NV guests Date: Wed, 11 Oct 2023 08:16:47 +0000 Message-ID: <20231011081649.3226792-2-oliver.upton@linux.dev> In-Reply-To: <20231011081649.3226792-1-oliver.upton@linux.dev> References: <20231011081649.3226792-1-oliver.upton@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The existing PMU emulation code is inadequate for use with nested virt. Disable the feature altogether with NV until the hypervisor controls are handled correctly. Signed-off-by: Oliver Upton --- arch/arm64/kvm/arm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 1bfdd583b261..356b7eec3c93 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1238,9 +1238,10 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu, test_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, &features)) return -EINVAL; - /* Disallow NV+SVE for the time being */ + /* Disallow PMU and SVE with NV for the time being */ if (test_bit(KVM_ARM_VCPU_HAS_EL2, &features) && - test_bit(KVM_ARM_VCPU_SVE, &features)) + (test_bit(KVM_ARM_VCPU_SVE, &features) || + test_bit(KVM_ARM_VCPU_PMU_V3, &features))) return -EINVAL; if (!test_bit(KVM_ARM_VCPU_EL1_32BIT, &features))