From patchwork Mon May 9 09:54:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12843274 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 42331C433F5 for ; Mon, 9 May 2022 09:56:34 +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:Mime-Version: Message-Id: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=nv/P3nrXbqW83PfodWoVr91kGcwxH1TT30Rx8aMjG74=; b=NgU wkIKtEkUDQ9KET9lH3SBpAzd6OYDoPjdZHIp93GEUJzxPXkC1YxGdyZLDwAqQNDcVeQExPDxcB9yJ tHAn/eE4QOjEN5mlqirumU8d96RyofQpdqtHrDl+R5hXa4C8bxVHl+xpwHO+BOnNyqcoOXrS0V4C8 PShovqPlkTWO3z+ntkCYxmJSQGSFZzAOZyxqcA3MWigqy1vkChE+AO/W70/7zu3ahIaHrIXCY9KrN dU2/P6nSZtueFzWRnmCkm0ZnVwMQkb+0xDRkR6+BBUDZQkWo/h5+6/MiPgilDhp7k6P7VG+JjKWMh qrDvQJFwAQ8qRJ9Ulva1kQm84sLYJkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1no06h-00DbLw-5o; Mon, 09 May 2022 09:55:11 +0000 Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1no06c-00DbHx-JR for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2022 09:55:08 +0000 Received: by mail-wm1-x34a.google.com with SMTP id 205-20020a1c02d6000000b003928cd3853aso6723012wmc.9 for ; Mon, 09 May 2022 02:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=YW1pGc97VG7+w25sCvimR02dEMnUe2KZ+odKI2ArMeU=; b=RkytZLUFgKmmRLNPqBXtTKaZMdMmNAKYw3+HM0MXx/1yex7gDSCKzNlK0bLsECObX0 N6MpbeP362kVaUSM3R2gLoNKvaXzDUNXtA+AiPd5DcqpgEaTAwJU4cYcc12TBL/vBMBx R7goFNwtZ3cX69jm3LGXlujTcN7YBXY63VjEanK3UYZh49X2ef0k4sYpoHYGAzL9J7fw fTKTBBP1tKlY5SBOBaf0buWK6T2vwyuEQ3cOVC7UvXFhZIdoKaIyKJ+9VaKDAC+naOkB v3JlMDcNxef9+VITS9UHAnTXGpvLjGR4G1sm8uq4TIGL71evdYLXGnijIiUvhTRzV+ja QH9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=YW1pGc97VG7+w25sCvimR02dEMnUe2KZ+odKI2ArMeU=; b=ArhfafPfuey6/ie/9pPhMD6ixPhW46x8yjRvZpsa7WOCvEiE+xZmtuOKNs1IHMzh62 YGlb9JnXMzW/x3msA+2dmiwvmLP2QqWNoUr5MmOYWNCwaA0LL96V5Ww1oEm/qWwlpGhy ABd/2FTD7/2pRGZBWyvtmhIigzyQemqMhkn72xnBtq7UabLMQxqybwE/D+/G7WpA7tzP W9/XjPx0Q17/6wtCBILp0K1Gr6PRspDFR5pcGAaPECV5B3rvbIdVuf0SuKfIUjurrjBy oKwRFtDyeBUpWOX9WF75hKDD8LyozAKal/epRMFNrefscGEFeAsK7pDLEkVJU4Kk+9wB 0fRQ== X-Gm-Message-State: AOAM532akaPPCi4DrYKyOfs9zBANlJMPcUOMDCxd3zsDI1wSmW4WryPS BEJnfAeefwaD+qdEofwKMMAxNczcSQ== X-Google-Smtp-Source: ABdhPJzKAAF6fMy6pXPyySPxGmJhKM8F1rEGVwnvmJoNzqi2QbLfO7t4POKVPmJL/duVvF/fdfPVfZku/A== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a05:600c:2f0f:b0:393:fbd1:cc94 with SMTP id r15-20020a05600c2f0f00b00393fbd1cc94mr15465248wmn.162.1652090102410; Mon, 09 May 2022 02:55:02 -0700 (PDT) Date: Mon, 9 May 2022 09:54:56 +0000 Message-Id: <20220509095500.2408785-1-tabba@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.512.ge40c2bad7a-goog Subject: [PATCH v2 0/4] KVM: arm64: Do not communicate host pmu event changes by accessing hyp data 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, 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-20220509_025506_702733_D36AA385 X-CRM114-Status: GOOD ( 10.99 ) 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 Hi, This series changes the way KVM communicates host pmu event changes to the hypervisor in nvhe and protected mode. Instead of accessing hyp data directly from the host, the data is passed to hyp via the loaded vcpu. This provides more isolation between the host and the hypervisor, and allows us to use pmu in protected mode. This series is based on kvmarm/next (8c22fd2d4cfa). Changes since V1 [*]: - Repack struct kvm_pmu to remove all (two) holes - Updating the guest's view of the pmu events before every vcpu run rather than vcpu load to avoid missing updates Thanks, /fuad * https://lore.kernel.org/linux-arm-kernel/20220408084052.3310931-1-tabba@google.com/ Fuad Tabba (4): KVM: arm64: Wrapper for getting pmu_events KVM: arm64: Repack struct kvm_pmu to reduce size KVM: arm64: Pass pmu events to hyp via vcpu KVM: arm64: Reenable pmu in Protected Mode arch/arm64/include/asm/kvm_host.h | 8 ++----- arch/arm64/kvm/hyp/nvhe/switch.c | 20 +++++----------- arch/arm64/kvm/pmu-emul.c | 6 +++-- arch/arm64/kvm/pmu.c | 40 ++++++++++++++++++------------- include/kvm/arm_pmu.h | 10 ++++++-- 5 files changed, 43 insertions(+), 41 deletions(-) base-commit: 8c22fd2d4cfaab2ae3c5859496c894df58ab014b