From patchwork Sat Jun 10 06:15:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 13274727 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 509A8C7EE2E for ; Sat, 10 Jun 2023 06:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=hM/hnrDTmG84QA8vX9v6W26BF/ckNYXCZsMvOGIKe6g=; b=doX h1D3BF4a+pmCAPLGNJtH+3WBBHLjqa9Jk2kbNFxo1OQeXbEdupsprlNuQIIPO3wXsIVz/hQICLj9h nz8QFLOG8s0q+lFFMdQlwKFvRnfgzurtQreJSPsI7G7ryWnyiQld2zDuU6b+5PTp73Cd1asKMvbPG Rj+BPiBvauj5L11g13mZgdgNFdWfTweOaEldC7GOCPPsuJ8ERHTfC7r3kP4n7JAY1UhnWyKgNsJcn 4XVvyG4tKytPJGzeLImO1FAX6qxXVs6MhfwA+Cj08tWbGVNLssHlZ8uBESGC1rAXqoQXV992rG3Hp cPVgSggKMd1NmM1WAaLw6zd6Bvtg2/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7rt7-00FM2b-0t; Sat, 10 Jun 2023 06:15:49 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7rt2-00FM1t-2r for linux-arm-kernel@lists.infradead.org; Sat, 10 Jun 2023 06:15:46 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-bb2202e0108so3155104276.1 for ; Fri, 09 Jun 2023 23:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686377740; x=1688969740; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=+DLblTLkyid4xi77mptvky8xPiYLH98cRQBJONV33+M=; b=5trV4LUBPAk2oZ2MNDsq0hNSHwU9CDjeR+EXZeul7HOMAixCsZXeusHHWFB76Pw3qi hYeZDf/LgRGUK5pCQFEUzwhfsYUiKm0fEQh6LGGGtZi+chULiJc8ZjICCjm1JHc5aCiB YMYKQgtHwPSm60jtVtIIFU5sfyE+CFz6aun2E0Rb8ALC0FqD8pDTsCcxeU9qXtBOHhi1 cDuWxl2keBkONTHkDOrDQ3/yPOloujM8T09AbD2Nq9tAGTqDnd1kHrseHSRlCr7xZVVx 7thnf51PBcHtBD3bcjkK/uzXxDPEWXT92OPqp4DMVLC4nCEpq8oKouP4gjtq4TFUpIOI w09A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686377740; x=1688969740; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+DLblTLkyid4xi77mptvky8xPiYLH98cRQBJONV33+M=; b=LCLIKtfHLUTbd0sx+gbdu45IB2asaPYY5zyFAZUfBLtdumV3XYr2Z2uXbbEmrzdhOi bYOhKH0OJ9WZG1fy8wT/s2nhrq3rMYsQ8d88P9bo4dT79hLGbicuWpYBTbKydnwr+sjJ YEKX5jYqstGbd/WbsaO+FxZlrmzKNECwN6IBjRKw6GKLT88NvcyOzjcUnkcSvIl+YF1S S2uoDipNGvsqyQdiP1pQiSmhIYuUdiIFWGdGBI0M8gQHT2M5ClHDlIEIwtrU6lGzikSU ahTYobsLcf3y5WXfKR339Tbdio1zjeWV/4vt4W8WpG1K3toMMRAldANnD2k0nKPE1pBq Xl9w== X-Gm-Message-State: AC+VfDwFNLtgk28LNxhKmvE3VF+bMMAVF6kOZjnoUXkj/Gy0LsZFZI4P D6Nt9YQ7H6OrDlMBnljBwFNqqDlyhes= X-Google-Smtp-Source: ACHHUZ4WAaaRBANzh1YtIO3Ah8WyAfBy7JqoJgzUoXbqmI3wb/BNso2nkXQfZadKKhNUquplRIS9fKP8yrQ= X-Received: from reijiw-west4.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:aa1]) (user=reijiw job=sendgmr) by 2002:a05:6902:1085:b0:ba8:918a:ceec with SMTP id v5-20020a056902108500b00ba8918aceecmr971640ybu.4.1686377740149; Fri, 09 Jun 2023 23:15:40 -0700 (PDT) Date: Fri, 9 Jun 2023 23:15:18 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230610061520.3026530-1-reijiw@google.com> Subject: [PATCH 0/2] KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems From: Reiji Watanabe To: Marc Zyngier , Oliver Upton , kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Zenghui Yu , Suzuki K Poulose , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_231544_926128_3688D38C X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On systems where the PMUVer is not uniform across all PEs, KVM currently does not advertise PMUv3 to the guests, even if userspace successfully runs KVM_ARM_VCPU_INIT with KVM_ARM_VCPU_PMU_V3. In such systems, KVM should either disallow userspace from configuring vPMU, or advertise PMUv3 to the guest. This series addresses this inconsistent behavior by implementing the former, as such systems would be extremely uncommon and unlikely to even use KVM (according to Marc [1]). The series is based on v6.4-rc5. [1] https://lore.kernel.org/all/874jnqp73o.wl-maz@kernel.org/ Reiji Watanabe (2): KVM: arm64: PMU: Introduce pmu_v3_is_supported() helper KVM: arm64: PMU: Disallow vPMU on non-uniform PMUVer systems arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/pmu-emul.c | 6 +----- arch/arm64/kvm/sys_regs.c | 2 +- include/kvm/arm_pmu.h | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7