From patchwork Tue May 10 09:57:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12844753 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 BF0FEC433F5 for ; Tue, 10 May 2022 09:59:20 +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:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7+LVFQ1bf1vimrJ5gSYBZBYtdwvl9PIiKR7o/GXjij0=; b=oF3XtHlsEd55JekvO3DjP5RT31 wDnkqSYs894wJYad7dvelxIRjUzLjU1578tTMsbGa+q3KTMimq89PRS+ja8inRcLX0bBVzWCbCs89 k9HHaH2ShjRSCVbxXcSZTWj3cMzawV/O9Hs6hVuJ9Se/vpDUgy5f71vYXk5G0VndSSzjXO6vR8cCW Vlj/WI8KOj2SyvLj2C9BnCCNRqWb5ufVyqXRmXl0co845CADtLYRazH2u3FkWewCWnu8Ie+twuW85 yamYnLTu5b9jszwX23RLztaQ18n9O2Lo+KXyVdY47c5k2tRCiTvNCr43JY8HTuFFmsS3UoJWgNq0o cR3Nmw5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noMd4-00119O-Nt; Tue, 10 May 2022 09:58:06 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noMcO-0010od-RQ for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2022 09:57:26 +0000 Received: by mail-wm1-x349.google.com with SMTP id q128-20020a1c4386000000b003942fe15835so5067902wma.6 for ; Tue, 10 May 2022 02:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=mKMNvyZBuuA9SLayUryCuhjhpUdoCiXuRmOyn6vDo4I=; b=T/9pE2m91NoXAenAIeFnB7RnZeuYl5qJg/+rpiIScDWS4RmtOIFi9MbPy32BAJeqoW RwcnK57L7upiL7QOz/V5hMywhWMYCQCTbll1Z4T3RPXHP+d1Ojpd2o6+L1S586UQjYJK JT6j+mzFnm41weM8A9dBJRdsS5EtuS0FDEmmtwpTCGCgc5ASwhKeYIUsKnsATbNeWCL6 SBhYzzw0qie0weuXxrZtYDPvAo0qFsNJ3YrNmUUuBYQ3PatAiVMT/OFPaJpG8epyYeOY dDQc8D1bND0SL9afGXin4WqivexrrfLhqe8ejOaw48vlsctcrl9B50jC6zq01ePYjrNr ry2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=mKMNvyZBuuA9SLayUryCuhjhpUdoCiXuRmOyn6vDo4I=; b=7uIopCbaE9RzBbudOzLuTEdpUG/ERPwXwj8xmFCmH6N/Vxp/I19BhNpp3VDFlO6Asc dhW+UHrn0kuDMyXTYqXAX/itgPOvJ2fmUwygz9MrvvBR2ldLKqHjtLozVsJZUC3G4X14 AUSiKdBogWiDgU2M5LQNS0xMF/0YWfRjHp6FYhCPlCrYm2Ae0teHCXwJ1vb4oxQ/3owQ 2beZLINgk/IUo3vNiJaRIcE31WVBA2UvXMPftDzpWqkaHeY+D+ZUn6ACf9rofhtAPKmV jgXMw4s7SjVHJ8ESl0BVDb6X0KuHwJWn7R7iRsYuWVcUIEbdisdhLVxuQoIbymlABwkl ftZw== X-Gm-Message-State: AOAM530knS7hg8BC5fsEx99ajofG0nFCbaMEPWza7ANUSdbdexfHgAcL 07MZtsgXDzJuKxLghBY7SCxc48+LIg== X-Google-Smtp-Source: ABdhPJxgxLziV5lD00E3d70FP+JsDRwBhJjSHtA0R3ZtNY/VGd2q0FAYdR9UTgDYUJOb/BpOuW//Rhvhug== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a1c:4e0b:0:b0:393:fd8f:e340 with SMTP id g11-20020a1c4e0b000000b00393fd8fe340mr26699159wmh.136.1652176640085; Tue, 10 May 2022 02:57:20 -0700 (PDT) Date: Tue, 10 May 2022 09:57:10 +0000 In-Reply-To: <20220510095710.148178-1-tabba@google.com> Message-Id: <20220510095710.148178-5-tabba@google.com> Mime-Version: 1.0 References: <20220510095710.148178-1-tabba@google.com> X-Mailer: git-send-email 2.36.0.512.ge40c2bad7a-goog Subject: [PATCH v4 4/4] KVM: arm64: Reenable pmu in Protected Mode From: Fuad Tabba To: kvmarm@lists.cs.columbia.edu Cc: maz@kernel.org, will@kernel.org, qperret@google.com, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, drjones@redhat.com, oupton@google.com, linux-arm-kernel@lists.infradead.org, tabba@google.com, kernel-team@android.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220510_025724_936536_A19E32E9 X-CRM114-Status: GOOD ( 10.88 ) 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 Now that the pmu code does not access hyp data, reenable it in protected mode. Once fully supported, protected VMs will not have pmu support, since that could leak information. However, non-protected VMs in protected mode should have pmu support if available. Signed-off-by: Fuad Tabba Reviewed-by: Oliver Upton --- arch/arm64/kvm/pmu-emul.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index 3dc990ac4f44..11c43bed5f97 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -774,8 +774,7 @@ void kvm_host_pmu_init(struct arm_pmu *pmu) { struct arm_pmu_entry *entry; - if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF || - is_protected_kvm_enabled()) + if (pmu->pmuver == 0 || pmu->pmuver == ID_AA64DFR0_PMUVER_IMP_DEF) return; mutex_lock(&arm_pmus_lock);