From patchwork Wed Sep 27 09:09:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13400433 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 9316DE810B2 for ; Wed, 27 Sep 2023 09:10:11 +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:Date:Subject:Cc :To:From: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=Nph8kDobnp+TwA59Lw7S8C2+YQ5b3Z+2HGFeuX4C6ig=; b=PaLev5R3xewojW WG6J9ojzuylhxwQiXd3bfaJ2Qs0OKDQWsd8I00lKO41Dja66f/QFy5yDE7Rod8vfk0T0Yz3mZLfJr gtgAG1qAJBz2HNk4ys8rHiRgITFYezey/CfsAfA54tw5agGL0R0gKc7T8cohb8zfmFi9Z12Jdfor+ YkJ5Io1uMzSSBOeQ1PjlZHlMCL7hu+4lzBBlNXlfITNmglHEJ12AFHGjL1YCv3PeEp6p1M1cT3oZe Y77VWQlL34AmY8wdrgBWBjnVOz4M9z7Ahcp8N2J86FQc3gr2FD0HzyOhE+mBRdsvOug/BRS2nlhKm RgTGJiArXw0sSsiUOowQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlQY6-000R06-0i; Wed, 27 Sep 2023 09:09:38 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlQXp-000Qs7-0F for linux-arm-kernel@lists.infradead.org; Wed, 27 Sep 2023 09:09:23 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 52861B816D9; Wed, 27 Sep 2023 09:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C63C433C8; Wed, 27 Sep 2023 09:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695805758; bh=C9ocmaLeJ5OV2/exh6Fmx96swKIGVo7eqxyWmcVY69k=; h=From:To:Cc:Subject:Date:From; b=f7IS6WDEAZ7yEDG09Ffg4Z3cYuPSPKL1PD/kAf7Awod/zSeXp2o/h149LrpDokqPQ PD06JhtGcKwgoPQYiwN6L7GRsfdRv59MUWM8HUqb9PHguKEXfmC1t+GB14+TKO8PVj jogDvv/I8JQUj/5j/0M14fjjctCzllPiQYH7V3SATYuQfitZG35485TTtyDS10Xs3T P+fIRquDzVizuNB9T+jtEp00XCyu/EWn2Vz8RHs+UHYWZPrIivesKzQ6dfk9ZRA8dD unWc0espMvtjQC57aDyrnIqZlz1bpTcql9PRegYV2oFpN1ylkt4mLQ1i5zBOJocbNA 10LdwlKBVLvlw== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qlQXk-00GaLb-3Q; Wed, 27 Sep 2023 10:09:16 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Shameerali Kolothum Thodi , Xu Zhao , Eric Auger Subject: [PATCH v3 00/11] KVM: arm64: Accelerate lookup of vcpus by MPIDR values (and other fixes) Date: Wed, 27 Sep 2023 10:09:00 +0100 Message-Id: <20230927090911.3355209-1-maz@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, shameerali.kolothum.thodi@huawei.com, zhaoxu.35@bytedance.com, eric.auger@redhat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230927_020921_398943_3FA49A1C X-CRM114-Status: GOOD ( 11.84 ) 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 This is a follow-up on [2], which addresses both the O(n) SGI injection issue, and cleans up a number of embarassing bugs steaming form the vcpuid/vcpu_idx confusion. See the changelog below for details. Oliver, assuming that you haven't changed your mind and that nobody shouts, feel free to queue this in -next. * From v2 [2]: - Killed a number of online_vcpus comparisons, which didn't make much sense (Zenghui) - Added missing commit logs (oops) - Fixed some comments - Collected RBs, with thanks * From v1 [1]: - Added a bunch of patches fixing the vcpu_id[x] ambiguity - Added a documentation update spelling out some extra ordering requirements - Collected RBs/TBs, with thanks [1] https://lore.kernel.org/r/20230907100931.1186690-1-maz@kernel.org [2] https://lore.kernel.org/r/20230920181731.2232453-1-maz@kernel.org Marc Zyngier (11): 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 .../virt/kvm/devices/arm-vgic-v3.rst | 7 + arch/arm64/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_host.h | 28 ++++ arch/arm64/kvm/arch_timer.c | 2 +- arch/arm64/kvm/arm.c | 93 +++++++++-- arch/arm64/kvm/pmu-emul.c | 2 +- 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 | 8 +- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 150 +++++++----------- arch/arm64/kvm/vgic/vgic.c | 12 +- include/kvm/arm_vgic.h | 4 +- 13 files changed, 212 insertions(+), 153 deletions(-)