From patchwork Wed Sep 20 19:50:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 13393354 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 C4F78C04FF5 for ; Wed, 20 Sep 2023 19:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjITTuz (ORCPT ); Wed, 20 Sep 2023 15:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjITTuy (ORCPT ); Wed, 20 Sep 2023 15:50:54 -0400 Received: from out-220.mta0.migadu.com (out-220.mta0.migadu.com [91.218.175.220]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E5BD7 for ; Wed, 20 Sep 2023 12:50:47 -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=1695239445; 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; bh=u36CLFE7Of0P0rwCIt+hVWkI368S5yyzMyNNtCtqKEQ=; b=PjY68ibaZR2B7bCRmBSaK1GhcVuPiNjntzaizKAPMVDKtc0KnMIPg/p7wMDemRfl1xVPMZ M4riS/Zg+F1CvWUfaIZfgRFECgU3+L7DYnBjhkxV12le6ZWQga1ah1sJ6+J5ZRd/ESCqFt oQGoWGvDHdahDDLT4zd15LAImfGl0Nc= From: Oliver Upton To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Oliver Upton Subject: [PATCH 0/8] KVM: arm64: Cleanup + fix to vCPU reset, feature flags Date: Wed, 20 Sep 2023 19:50:28 +0000 Message-ID: <20230920195036.1169791-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 way we do vCPU feature flag checks is a bit of a scattered mess between the KVM_ARM_VCPU_INIT ioctl handler and kvm_reset_vcpu(). Let's move all the feature flag checks up into the ioctl() handler to eliminate failure paths from kvm_reset_vcpu(), as other usage of this function no not handle returned errors. Nobody screamed about the VM-wide feature flag change, so its also a good time to rip out the vestiges of the vCPU-scoped bitmap. I also spotted a bug with the NV feature flag where we allow it regardless of system support. Oliver Upton (8): KVM: arm64: Add generic check for system-supported vCPU features KVM: arm64: Hoist PMUv3 check into KVM_ARM_VCPU_INIT ioctl handler KVM: arm64: Hoist SVE check into KVM_ARM_VCPU_INIT ioctl handler KVM: arm64: Hoist PAuth checks into KVM_ARM_VCPU_INIT ioctl KVM: arm64: Prevent NV feature flag on systems w/o nested virt KVM: arm64: Hoist NV+SVE check into KVM_ARM_VCPU_INIT ioctl handler KVM: arm64: Remove unused return value from kvm_reset_vcpu() KVM: arm64: Get rid of vCPU-scoped feature bitmap arch/arm64/include/asm/kvm_emulate.h | 13 +++--- arch/arm64/include/asm/kvm_host.h | 5 +-- arch/arm64/include/asm/kvm_nested.h | 3 +- arch/arm64/kvm/arch_timer.c | 4 +- arch/arm64/kvm/arm.c | 62 +++++++++++++++++++++------- arch/arm64/kvm/hypercalls.c | 2 +- arch/arm64/kvm/reset.c | 56 +++++-------------------- include/kvm/arm_arch_timer.h | 2 +- include/kvm/arm_pmu.h | 2 +- include/kvm/arm_psci.h | 2 +- 10 files changed, 72 insertions(+), 79 deletions(-) base-commit: ce9ecca0238b140b88f43859b211c9fdfd8e5b70 Reviewed-by: Marc Zyngier