Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2125144ybb; Sat, 21 Mar 2020 13:27:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvP8ud4z+u4zkqtjQZN4OeZnGx1PdbnOOwAJi4FRHKAxSdJa4MFYadodTPcLYNIxbUXrDFP X-Received: by 2002:aca:f183:: with SMTP id p125mr12091613oih.74.1584822444511; Sat, 21 Mar 2020 13:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584822444; cv=none; d=google.com; s=arc-20160816; b=VohMVrGfj/twWT7PjlSgbAfvEzhBLtV8HpgNTAf7mvMl23ERwoPYuDHFFOY2SQvmmc 6l43NvRGi6Z0JcboAWrbMM13fgXBqDJjTGx9P/ipPHAmVXfGQrpAWWoAOnB1ncx+6Eu0 VLjoMcUL5/PQuZKBrXG9Q3/gbiDrqSqzueko2bzQvTJt/jhI57W5Ql2ppqLoCawVIhod SQpEiBqmcfqMuZzwzO5p2jUxYm918BvdjeASTIwe8o0hp2mCB6j+1RKQ14trCNKcLirC egpj5x3dER8nMg+iVZic1JWpWQqMXK/CDkoSZvd+uTCdFJ4MDf70E5VJYkqNTF0Vy/CS w2fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=mxJRaniDqN8rGDuLDiC/zj/fPGquF/eg66WwZRYSUCs=; b=GXyZTH2RugneSWnas3/IqF4pbxOhoAOu2DSPLhOEgb1tUFxk/4ca2BG3fDXSQV0zBN X3l5fspZCunNoKJes1VLyOkvTshy18Q34IXXGNFkA+T+PeLkw0WMGGRUrNA1Mfltc0GW RrKzYxn6BWsLAH3wHG6iGjfXno6cxQwmHGpv5eGoSvPSzg6lONLV5KgXiUwrt8YvtKWr t4xkUdQFMOm+WKLnXjPkeiNwWabcz8HDc9fzPD4tDkKW3SrxPTKCb0rbbNDCVXJgm9IA NHL8MIpCVCEADYfEosNup1SboDWGTC59Mv8qIuZZZqyLFLwbUmvticOU1jbpwefX9wGv fUfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185si5213273oif.274.2020.03.21.13.27.12; Sat, 21 Mar 2020 13:27:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728078AbgCUU0K (ORCPT + 99 others); Sat, 21 Mar 2020 16:26:10 -0400 Received: from mga03.intel.com ([134.134.136.65]:8930 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgCUU0I (ORCPT ); Sat, 21 Mar 2020 16:26:08 -0400 IronPort-SDR: eFWtV/jdffBkXM4rVldq+kUR+7v4P0+e/PQZsWhjoIrgawmXlglnv9YqdZJV0qwWbLz5tsLmT4 fl1VvdtnfLeQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2020 13:26:05 -0700 IronPort-SDR: wc7DG86xh4vPeKd3LZfA/TbWv8x9O/HuKQW/jGF3O4aUFN/qKwYCQ8SRM7iJWo2KoQnsDSJboM NHtSa3M5ZLog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,289,1580803200"; d="scan'208";a="280773532" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by fmsmga002.fm.intel.com with ESMTP; 21 Mar 2020 13:26:04 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/9] KVM: Move x86 init ops to separate struct Date: Sat, 21 Mar 2020 13:25:54 -0700 Message-Id: <20200321202603.19355-1-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The non-x86 part of this series is wholly contained in patch 01. Compared to other recent kvm-wide changes, this one is very straightforward (famous last words). Like a few other architectures, e.g. PPC, x86 uses a set of global hooks to call back into vendor code on demand. A handlful of the x86 hooks are used only within the scope of kvm_init(). This series moves the init-only hooks to a separate struct, partly to clean up the code a bit, but mainly so that the runtime hooks can be made available only after the x86 vendor has completed its ->hardware_setup(). While working on a different series I spent a fair bit of time scratching my as to why a kvm_x86_ops wasn't working, and eventually realized VMX's callback wasn't "ready" because the vmcs_config hadn't yet been populated. Due to lack of a cross-compiling setup, the non-x86 changes in patch 01 are untested. v3: - Rebase to kvm/queue, d55c9d4009c7 ("KVM: nSVM: check for EFER ... "). Conflicts galore, but all mechanical in nature. - Drop an SVM patch that was obsoleted by kvm/queue. - Collect an ack. [Marc] v2: - Rebase to kvm/queue, 2c2787938512 ("KVM: selftests: Stop ...") - Collect tags. [Cornelia] - Add a patch to make kvm_x86_ops its own instance and copy {vmx,svm}_x86_ops by value, which saves a memory access on every invocation of a kvm_x86_ops hook. [Paolo] - Add patches to tag {vmx,svm}_x86_ops as __initdata after they're copied by value. Sean Christopherson (9): KVM: Pass kvm_init()'s opaque param to additional arch funcs KVM: x86: Move init-only kvm_x86_ops to separate struct KVM: VMX: Move hardware_setup() definition below vmx_x86_ops KVM: VMX: Configure runtime hooks using vmx_x86_ops KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes KVM: x86: Copy kvm_x86_ops by value to eliminate layer of indirection KVM: x86: Drop __exit from kvm_x86_ops' hardware_unsetup() KVM: VMX: Annotate vmx_x86_ops as __initdata KVM: SVM: Annotate svm_x86_ops as __initdata arch/mips/kvm/mips.c | 4 +- arch/powerpc/kvm/powerpc.c | 4 +- arch/s390/kvm/kvm-s390.c | 4 +- arch/x86/include/asm/kvm_host.h | 33 +-- arch/x86/kvm/cpuid.c | 4 +- arch/x86/kvm/hyperv.c | 8 +- arch/x86/kvm/kvm_cache_regs.h | 10 +- arch/x86/kvm/lapic.c | 30 +-- arch/x86/kvm/mmu.h | 8 +- arch/x86/kvm/mmu/mmu.c | 32 +-- arch/x86/kvm/pmu.c | 30 +-- arch/x86/kvm/pmu.h | 2 +- arch/x86/kvm/svm.c | 19 +- arch/x86/kvm/trace.h | 4 +- arch/x86/kvm/vmx/nested.c | 17 +- arch/x86/kvm/vmx/nested.h | 3 +- arch/x86/kvm/vmx/vmx.c | 371 ++++++++++++++++---------------- arch/x86/kvm/x86.c | 370 +++++++++++++++---------------- arch/x86/kvm/x86.h | 4 +- include/linux/kvm_host.h | 4 +- virt/kvm/arm/arm.c | 4 +- virt/kvm/kvm_main.c | 18 +- 22 files changed, 507 insertions(+), 476 deletions(-) -- 2.24.1