From mboxrd@z Thu Jan 1 00:00:00 1970 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 C017BC4167B for ; Tue, 31 Oct 2023 18:49:13 +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:MIME-Version:Message-ID:Subject:Cc:To: From: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=dqh57V4Fn9+X+7oD+DtYl/KOtJeH45qWT9/2dXEy4n0=; b=ZKJV23u3b/bpiv wuiIvy6PHOvBqwUVCs/KzdKvSAz0ExtHrgQT9OwpAsj+bnkLeKoAER/SbEfNdYACO2z/1c+FmqAZO VqEJsROg7RBdD8wcrFR5lQN8d8hzixhXXYy8fpJkD+B3oUteWy1SOD0BTXzjB/x+gmD1dRl4Dynf9 CiBaQ/3xU3nzw3OuL7qvL/rNCoKjDl45WBfqVpuLomgyg9u5nOXa/1nahXHlBmZpC2D0YUMVU1jUW nT3o4IDYOvG2IUUcK3dpThHL+nRvS6OOXdo9n70RJV4z+pnS5cy2ygCitPt3n/h9v/UkivfhNxA/1 2z/x5s396kVodqV8in4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxtn5-005ykE-0q; Tue, 31 Oct 2023 18:48:39 +0000 Received: from out-188.mta1.migadu.com ([95.215.58.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxtmz-005yjk-2T for linux-arm-kernel@lists.infradead.org; Tue, 31 Oct 2023 18:48:36 +0000 Date: Tue, 31 Oct 2023 11:48:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698778107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=F52dpzxQTPPk/FaCOWtBXUXkQp0gcrrYXYChduY6NvI=; b=xEhJ4no/xpHh1E7x2rGc8KVPqJqNHC6p7lvG5dtQyHFojFjOa9ZofLU38I7re2nFTkvtmI Y8ISoiSYMTcQQIv+Z3hLLxKtJxVW644xrIuc8mooSVaOgbhGWUYQb+Z4Ew2r0LuLJO+xZG ndXNu4y5qGLPrK7ggHCBM1EBztK4Yvg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Paolo Bonzini Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Jing Zhang , Raghavendra Rao Ananta , Vincent Donnefort , Kristina Martsenko , Miguel Luis Subject: [GIT PULL] KVM/arm64 updates for 6.7 Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231031_114834_222813_B2B84A09 X-CRM114-Status: GOOD ( 21.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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Paolo, Here's the pile of KVM/arm64 changes for 6.7. Almost all of these changes have been baking in -next for a while, although I did need to rebase to back out a broken change last minute. I'm only aware of a single (trivial) conflict with the arm64 tree resulting from a moved cpucap check, resolution below. Please pull. -- Thanks, Oliver The following changes since commit 6465e260f48790807eef06b583b38ca9789b6072: Linux 6.6-rc3 (2023-09-24 14:31:13 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvmarm-6.7 for you to fetch changes up to 123f42f0ad6815014f54d0cc6eb9039c46ee2907: Merge branch kvm-arm64/pmu_pmcr_n into kvmarm/next (2023-10-30 20:24:19 +0000) ---------------------------------------------------------------- KVM/arm64 updates for 6.7 - Generalized infrastructure for 'writable' ID registers, effectively allowing userspace to opt-out of certain vCPU features for its guest - Optimization for vSGI injection, opportunistically compressing MPIDR to vCPU mapping into a table - Improvements to KVM's PMU emulation, allowing userspace to select the number of PMCs available to a VM - Guest support for memory operation instructions (FEAT_MOPS) - Cleanups to handling feature flags in KVM_ARM_VCPU_INIT, squashing bugs and getting rid of useless code - Changes to the way the SMCCC filter is constructed, avoiding wasted memory allocations when not in use - Load the stage-2 MMU context at vcpu_load() for VHE systems, reducing the overhead of errata mitigations - Miscellaneous kernel and selftest fixes ---------------------------------------------------------------- Jing Zhang (7): KVM: arm64: Allow userspace to get the writable masks for feature ID registers KVM: arm64: Document KVM_ARM_GET_REG_WRITABLE_MASKS KVM: arm64: Use guest ID register values for the sake of emulation KVM: arm64: Allow userspace to change ID_AA64MMFR{0-2}_EL1 KVM: arm64: Allow userspace to change ID_AA64PFR0_EL1 tools headers arm64: Update sysreg.h with kernel sources KVM: arm64: selftests: Test for setting ID register from usersapce Kristina Martsenko (2): KVM: arm64: Add handler for MOPS exceptions KVM: arm64: Expose MOPS instructions to guests Marc Zyngier (16): KVM: arm64: vgic: Make kvm_vgic_inject_irq() take a vcpu pointer KVM: arm64: vgic-its: Treat the collection target address as a vcpu_id KVM: arm64: vgic-v3: Refactor GICv3 SGI generation KVM: arm64: vgic-v2: Use cpuid from userspace as vcpu_id KVM: arm64: vgic: Use vcpu_idx for the debug information KVM: arm64: Use vcpu_idx for invalidation tracking KVM: arm64: Simplify kvm_vcpu_get_mpidr_aff() KVM: arm64: Build MPIDR to vcpu index cache at runtime KVM: arm64: Fast-track kvm_mpidr_to_vcpu() when mpidr_data is available KVM: arm64: vgic-v3: Optimize affinity-based SGI injection KVM: arm64: Clarify the ordering requirements for vcpu/RD creation KVM: arm64: Restore the stage-2 context in VHE's __tlb_switch_to_host() KVM: arm64: Reload stage-2 for VMID change on VHE KVM: arm64: Move VTCR_EL2 into struct s2_mmu KVM: arm64: Do not let a L1 hypervisor access the *32_EL2 sysregs KVM: arm64: Handle AArch32 SPSR_{irq,abt,und,fiq} as RAZ/WI Miguel Luis (3): arm64: Add missing _EL12 encodings arm64: Add missing _EL2 encodings KVM: arm64: Refine _EL2 system register list that require trap reinjection Oliver Upton (42): KVM: arm64: Don't use kerneldoc comment for arm64_check_features() 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 arm64: tlbflush: Rename MAX_TLBI_OPS KVM: arm64: Avoid soft lockups due to I-cache maintenance KVM: arm64: Advertise selected DebugVer in DBGDIDR.Version KVM: arm64: Reject attempts to set invalid debug arch version KVM: arm64: Bump up the default KVM sanitised debug version to v8p8 KVM: arm64: Allow userspace to change ID_AA64ISAR{0-2}_EL1 KVM: arm64: Allow userspace to change ID_AA64ZFR0_EL1 KVM: arm64: Document vCPU feature selection UAPIs KVM: arm64: Add a predicate for testing if SMCCC filter is configured KVM: arm64: Only insert reserved ranges when SMCCC filter is used KVM: arm64: Use mtree_empty() to determine if SMCCC filter configured tools: arm64: Add a Makefile for generating sysreg-defs.h perf build: Generate arm64's sysreg-defs.h and add to include path KVM: selftests: Generate sysreg-defs.h and add to include path KVM: arm64: Don't zero VTTBR in __tlb_switch_to_host() KVM: arm64: Rename helpers for VHE vCPU load/put KVM: arm64: Load the stage-2 MMU context in kvm_vcpu_load_vhe() KVM: arm64: Make PMEVTYPER_EL0.NSH RES0 if EL2 isn't advertised KVM: arm64: Add PMU event filter bits required if EL3 is implemented KVM: arm64: Always invalidate TLB for stage-2 permission faults KVM: arm64: Add tracepoint for MMIO accesses where ISV==0 Merge branch kvm-arm64/misc into kvmarm/next Merge branch kvm-arm64/feature-flag-refactor into kvmarm/next Merge branch kvm-arm64/pmevtyper-filter into kvmarm/next Merge branch kvm-arm64/smccc-filter-cleanups into kvmarm/next Merge branch kvm-arm64/nv-trap-fixes into kvmarm/next Merge branch kvm-arm64/stage2-vhe-load into kvmarm/next Merge branch kvm-arm64/sgi-injection into kvmarm/next tools headers arm64: Fix references to top srcdir in Makefile KVM: selftests: Avoid using forced target for generating arm64 headers Merge branch kvm-arm64/writable-id-regs into kvmarm/next Merge branch kvm-arm64/mops into kvmarm/next Merge branch kvm-arm64/pmu_pmcr_n into kvmarm/next Raghavendra Rao Ananta (5): KVM: arm64: PMU: Set PMCR_EL0.N for vCPU based on the associated PMU KVM: arm64: Add {get,set}_user for PM{C,I}NTEN{SET,CLR}, PMOVS{SET,CLR} KVM: arm64: Sanitize PM{C,I}NTEN{SET,CLR}, PMOVS{SET,CLR} before first run tools: Import arm_pmuv3.h KVM: selftests: aarch64: vPMU test for validating user accesses Reiji Watanabe (7): KVM: arm64: PMU: Introduce helpers to set the guest's PMU KVM: arm64: Select default PMU in KVM_ARM_VCPU_INIT handler KVM: arm64: PMU: Add a helper to read a vCPU's PMCR_EL0 KVM: arm64: PMU: Allow userspace to limit PMCR_EL0.N for the guest KVM: selftests: aarch64: Introduce vpmu_counter_access test KVM: selftests: aarch64: vPMU register test for implemented counters KVM: selftests: aarch64: vPMU register test for unimplemented counters Vincent Donnefort (1): KVM: arm64: Do not transfer page refcount for THP adjustment Zenghui Yu (2): KVM: arm64: selftest: Add the missing .guest_prepare() KVM: arm64: selftest: Perform ISB before reading PAR_EL1 Documentation/virt/kvm/api.rst | 52 ++ Documentation/virt/kvm/arm/index.rst | 1 + Documentation/virt/kvm/arm/vcpu-features.rst | 48 ++ Documentation/virt/kvm/devices/arm-vgic-v3.rst | 7 + arch/arm64/include/asm/kvm_arm.h | 4 +- arch/arm64/include/asm/kvm_emulate.h | 15 +- arch/arm64/include/asm/kvm_host.h | 61 +- arch/arm64/include/asm/kvm_hyp.h | 7 +- arch/arm64/include/asm/kvm_mmu.h | 45 +- arch/arm64/include/asm/kvm_nested.h | 3 +- arch/arm64/include/asm/stage2_pgtable.h | 4 +- arch/arm64/include/asm/sysreg.h | 45 ++ arch/arm64/include/asm/tlbflush.h | 8 +- arch/arm64/include/asm/traps.h | 54 +- arch/arm64/include/uapi/asm/kvm.h | 32 + arch/arm64/kernel/traps.c | 48 +- arch/arm64/kvm/arch_timer.c | 6 +- arch/arm64/kvm/arm.c | 196 ++++- arch/arm64/kvm/emulate-nested.c | 77 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 17 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 3 +- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 8 +- arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 +- arch/arm64/kvm/hyp/nvhe/switch.c | 2 + arch/arm64/kvm/hyp/pgtable.c | 4 +- arch/arm64/kvm/hyp/vhe/switch.c | 34 +- arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 11 +- arch/arm64/kvm/hyp/vhe/tlb.c | 18 +- arch/arm64/kvm/hypercalls.c | 36 +- arch/arm64/kvm/mmio.c | 4 +- arch/arm64/kvm/mmu.c | 33 +- arch/arm64/kvm/pkvm.c | 2 +- arch/arm64/kvm/pmu-emul.c | 145 +++- arch/arm64/kvm/reset.c | 56 +- arch/arm64/kvm/sys_regs.c | 355 +++++++-- arch/arm64/kvm/trace_arm.h | 25 + arch/arm64/kvm/vgic/vgic-debug.c | 6 +- arch/arm64/kvm/vgic/vgic-irqfd.c | 2 +- arch/arm64/kvm/vgic/vgic-its.c | 49 +- arch/arm64/kvm/vgic/vgic-kvm-device.c | 11 +- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 150 ++-- arch/arm64/kvm/vgic/vgic.c | 12 +- arch/arm64/kvm/vmid.c | 11 +- include/kvm/arm_arch_timer.h | 2 +- include/kvm/arm_pmu.h | 28 +- include/kvm/arm_psci.h | 2 +- include/kvm/arm_vgic.h | 4 +- include/linux/perf/arm_pmuv3.h | 9 +- include/uapi/linux/kvm.h | 2 + tools/arch/arm64/include/.gitignore | 1 + tools/arch/arm64/include/asm/gpr-num.h | 26 + tools/arch/arm64/include/asm/sysreg.h | 839 +++++---------------- tools/arch/arm64/tools/Makefile | 38 + tools/include/perf/arm_pmuv3.h | 308 ++++++++ tools/perf/Makefile.perf | 15 +- tools/perf/util/Build | 2 +- tools/testing/selftests/kvm/Makefile | 24 +- .../selftests/kvm/aarch64/aarch32_id_regs.c | 4 +- .../selftests/kvm/aarch64/debug-exceptions.c | 12 +- .../selftests/kvm/aarch64/page_fault_test.c | 11 +- tools/testing/selftests/kvm/aarch64/set_id_regs.c | 481 ++++++++++++ .../selftests/kvm/aarch64/vpmu_counter_access.c | 670 ++++++++++++++++ .../selftests/kvm/include/aarch64/processor.h | 1 + .../testing/selftests/kvm/lib/aarch64/processor.c | 6 +- 64 files changed, 3019 insertions(+), 1177 deletions(-) create mode 100644 Documentation/virt/kvm/arm/vcpu-features.rst create mode 100644 tools/arch/arm64/include/.gitignore create mode 100644 tools/arch/arm64/include/asm/gpr-num.h create mode 100644 tools/arch/arm64/tools/Makefile create mode 100644 tools/include/perf/arm_pmuv3.h create mode 100644 tools/testing/selftests/kvm/aarch64/set_id_regs.c create mode 100644 tools/testing/selftests/kvm/aarch64/vpmu_counter_access.c -- diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 49ce32d3d6f7..e5f75f1f1085 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1298,12 +1298,6 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu, if (!test_bit(KVM_ARM_VCPU_EL1_32BIT, &features)) return 0; -<<<<<<< HEAD -======= - if (!cpus_have_final_cap(ARM64_HAS_32BIT_EL1)) - return -EINVAL; - ->>>>>>> arm64-upstream /* MTE is incompatible with AArch32 */ if (kvm_has_mte(vcpu->kvm)) return -EINVAL; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel