From patchwork Tue May 10 09:57:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12844750 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 9008EC433FE for ; Tue, 10 May 2022 09:58:39 +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=OcORQhTKBadcEKBeDujtvmaHdL8+lm1bTcIHWHdGdE8=; b=FLm N0Z3fQcClOP4V/f3K/zEKYDngoTF+lTH0Qd5lpnYqj4MqjVvWIw0+41TvHq3SDB4fTZRCRMWWPkLK A9ZLrpRgLQe0SRVN2oZhCHS87yrjfppcDmEoanT93j2V0pwyAUUqA3spQpMa+nGh+5B74guLfVRWv jUK1K548790y3y+C7wVcd4QPYlOdc78LssiAVKJ/9nWmLy9/HPbNbOSFV618+LJoZip7NKGgkqYvf 2XBku4hqtsJk7OLEA4NKc1Q1k8/tn0YBvopTMrfHV6mA1A1vf0uuTML3E6Wg4W9luE03EHx7XSvAx Z1b00b2cadZ/etT0bAkd/iBI4tfFWGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noMcJ-0010mw-Mw; Tue, 10 May 2022 09:57:19 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noMcF-0010kc-CQ for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2022 09:57:16 +0000 Received: by mail-wr1-x44a.google.com with SMTP id o13-20020adfa10d000000b0020c6fa5a77cso6812208wro.23 for ; Tue, 10 May 2022 02:57:12 -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=MtmAwqs8YXD/WNqsl0616lAaftWmFHAYLnEsrB1KhE4=; b=ew+YDsEUoNHbNrWsYNdJdcGpH3TgT2wsvr5GWyUVKu+wt0F2/R//RpQyZ3ggJg+wLN RilebVlNbX13rClyxSmkdJ08XLrdKnhl+cTKvCau1hrFEJzlOyXhp4dr3x97CVQW51d3 wOZFDIZ3No6yG3bxFXJpsLGA+i+JnAnJ5zMcIyQ/IT3cdKDIhdvzDqBPka01K7tQixWS uBZgI25qSAPQ7chWT0yId+JULBKaBUN3i9HRdeGEpyLTw9nrtsjJDAWHNC4odg7a+gVO bmfHTw65EWxeHvM1J/qgSZ2B8FQob4a0AHZe5D02U7twBIGz0owwEpdBI4JebNquI6Lj +7Vw== 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=MtmAwqs8YXD/WNqsl0616lAaftWmFHAYLnEsrB1KhE4=; b=5f08zkuNd4JSfoxDcDnuzqE/kt6nmHsbcoMIYw3+aj8DCh83xfufW1k51KNw6ysWFp dpx4LsVRGQdKvdeqta7Rg6kiRycR8B7MrwPDrWZKGKI7fTFtUf52WAdysXx/+O8jalO/ /hwAZ64jPa+3RA8TuOTo292xiDk23cOUM8prWhpy9SZVldXzubDDBqGzOQXH9+QyBZZw YYN56Q3GYBE6N9pW7o7e/E0cSYKGmEau0dkNxPHjOld3Y+91wH74RKyXu8IbAuK53g3/ 80wdybVVgMW1o47T45JC3qWG3/4AOFeUDpaeHM9Cnkz6gqfgZtOC7wE9HZrjy69BLFCl ouIQ== X-Gm-Message-State: AOAM531FopbC74prKDbxMx4Zh61sQc/iTrm7hlUyAnP5axLZ38ro2bAn sC1+4ow85I9yHscpq5zk/4yxXemVww== X-Google-Smtp-Source: ABdhPJw4V8FP3VXISHMvP+eBFRlmx3MmQxzndgE1sucyKQRc17P8zqP22OPaMbH4UkiBA4NsOppvDdCkbA== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a7b:c414:0:b0:394:21dd:e24f with SMTP id k20-20020a7bc414000000b0039421dde24fmr20840132wmi.133.1652176631812; Tue, 10 May 2022 02:57:11 -0700 (PDT) Date: Tue, 10 May 2022 09:57:06 +0000 Message-Id: <20220510095710.148178-1-tabba@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.512.ge40c2bad7a-goog Subject: [PATCH v4 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, 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_025715_493577_952B65EB X-CRM114-Status: GOOD ( 10.42 ) 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 V3 [1]: - Fix/clarify commit messages (Oliver) - Reduce scope of kvm_pmu_events (Oliver/Marc) Changes since V2 [2]: - Update the guest view of the pmu events after interrupts have been disabled (Marc) Changes since V1 [3]: - Repack struct kvm_pmu to remove all (two) holes (Marc) - Updating the guest's view of the pmu events before every vcpu run rather than vcpu load to avoid missing updates (Marc) Thanks, /fuad [1] https://lore.kernel.org/all/20220509120330.3043773-1-tabba@google.com/ [2] https://lore.kernel.org/all/20220509095500.2408785-1-tabba@google.com/ [3] 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 | 7 +----- arch/arm64/kvm/arm.c | 15 ++++++++++++ arch/arm64/kvm/hyp/nvhe/switch.c | 20 +++++----------- arch/arm64/kvm/pmu-emul.c | 3 +-- arch/arm64/kvm/pmu.c | 40 ++++++++++++++++++------------- include/kvm/arm_pmu.h | 10 ++++++-- 6 files changed, 54 insertions(+), 41 deletions(-) base-commit: 8c22fd2d4cfaab2ae3c5859496c894df58ab014b