From patchwork Tue Jun 11 00:21:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13692710 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 84883C27C5F for ; Tue, 11 Jun 2024 00:22:49 +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:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uWWq0J/vYTTdyXsGLYY5wB8yKDR5Gx9CYoZ4W9eV2i4=; b=B4x0osE3dbY+Bc8nmCOCyQ2VEE 6wFrttHnfX0kwXy5wFnmPMmaMkkrPDv2P9tuvmr+m8xsk5rVZpnJEnAqSINxzu5/gl8sOTRGyvucu b5H/fsOeEMkrHvdhdI3JdsgVGmiJethyThdBI1wyTiUvyR/aVRsUdo7f30Ps1N8q/Sr6ZlM993cFs lsenofzI8ytjO+Nzvf893f37trMokbQtqVzJKFW3pU0zs+WIKvg/0Hu84XvSIfb/M5V8ltOhKkoY2 eko507RDS6mT4tnVJs4uw2EXYiImJPxx/EHGX6npIcMU5sgnaHHuntSRCOXieT+GWjE7eGTXHb6P3 0/HM/xoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGpHX-00000006w7B-0fjJ; Tue, 11 Jun 2024 00:22:35 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGpH5-00000006vld-47NN for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 00:22:09 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-62a0841402aso82809477b3.2 for ; Mon, 10 Jun 2024 17:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718065324; x=1718670124; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=HV93t1qtvLY2HqXeqD4WwNLQ267HOmhqjDYyVDwgnFc=; b=fshspiqYnCdkpkMwWV1GXMCQOcM8cz0Qm+RMuuYP/uLfwXXlgs674Eh6gcX5ApSc9a jy4DGTivtt2WrF3MFpe7t9Trq9uAsvLgJ881aGyEp2+cSqSWoOcMqKBk/sjlH+oPMWr1 msh2dSrvxoDxoHQayTugotGlhNcb9LFFNGuGkuuQ4jOKVXqCdIhS+lRogIJpRQq1F6uj L5LmyuM3/+KguRcxCNhVp0Y01aZNFyRYPzXYawAg8D0Y1HGhgB8HwNmRvDwwVnf9prWy XEr3HcQ/LqrYP63eGRHWTf9qp0XAsX09mCEvcXbS3jpB7XIVE2saag9kMXjMonbgCfHg BDeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718065324; x=1718670124; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HV93t1qtvLY2HqXeqD4WwNLQ267HOmhqjDYyVDwgnFc=; b=tDPxldaxME9RmnQ6qdZnqW9kqo6jHs0mjU++0g0XnnWgU6Zah0e2lDGPy4q8J6b5Lm IlrEiKD/ew4NDwMHJnGktX+y9Ic1Je+8nLBC/2YIqK/swvu+Rqp24jfISrmO1F/3+BBB ze963/jXE4V5xqtPiagWQc0wAQJHJK/IMpM4ra+5AkmxSRGk5xyCji1p5tzBVFtZwBsO vAJHL+7f6+sWcR0dDTpNksY70ZUr8gLbvu6Ci+NprgYVwV70qtuFuJaNT/SCn9P2G2DS bHe3fuyC+aBqwWS1ADgIcAsQ7OzlPVow2PZ4pXl9Ny9e3jP5iKmdGtxZ+Tp7v7nskhJg icXQ== X-Forwarded-Encrypted: i=1; AJvYcCVQ4y5z3qMwthUta585KF8p/D9COhuUpnLgKtEPgq94XKBBuYKvQ0lDLYNabjUTZfxBnr0dmWaWRYqRjMLG5USVFB0RACy0qAav4gqggKGGdYmf1GU= X-Gm-Message-State: AOJu0Yxu/zexLfoN6G48DMG2m+mZZCCmvuKxa1hscNg12CKOirCPyhiY 7wLiCXjOEiABkRPtVgX9YyDOXWmnj9mcMSY9DKz62WNNTaehe8toLWryU939Rro2uLYTM6M9Rq5 mADoHAONNDvMnXITa/w== X-Google-Smtp-Source: AGHT+IGdrDSzxMWV88JW0LA6UnAEJXd+QZJzNBe66poa1GZZ236cqaZmaxZKOwtkV9plz4I87xyLdQPCAlnoV8zg X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a05:690c:38b:b0:627:7563:95b1 with SMTP id 00721157ae682-62cd5652459mr33516247b3.5.1718065324168; Mon, 10 Jun 2024 17:22:04 -0700 (PDT) Date: Tue, 11 Jun 2024 00:21:42 +0000 In-Reply-To: <20240611002145.2078921-1-jthoughton@google.com> Mime-Version: 1.0 References: <20240611002145.2078921-1-jthoughton@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240611002145.2078921-7-jthoughton@google.com> Subject: [PATCH v5 6/9] KVM: x86: Move tdp_mmu_enabled and shadow_accessed_mask From: James Houghton To: Andrew Morton , Paolo Bonzini Cc: Ankit Agrawal , Axel Rasmussen , Catalin Marinas , David Matlack , David Rientjes , James Houghton , James Morse , Jonathan Corbet , Marc Zyngier , Oliver Upton , Raghavendra Rao Ananta , Ryan Roberts , Sean Christopherson , Shaoqin Huang , Suzuki K Poulose , Wei Xu , Will Deacon , Yu Zhao , Zenghui Yu , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240610_172208_211988_641D8830 X-CRM114-Status: GOOD ( 10.60 ) 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 From: Yu Zhao tdp_mmu_enabled and shadow_accessed_mask are needed to implement kvm_arch_young_notifier_likely_fast(). Signed-off-by: Yu Zhao Signed-off-by: James Houghton --- arch/x86/include/asm/kvm_host.h | 6 ++++++ arch/x86/kvm/mmu.h | 6 ------ arch/x86/kvm/mmu/spte.h | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 011c8eb7c8d3..0dc1fa99cdbb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1855,6 +1855,7 @@ struct kvm_arch_async_pf { extern u32 __read_mostly kvm_nr_uret_msrs; extern u64 __read_mostly host_efer; +extern u64 __read_mostly shadow_accessed_mask; extern bool __read_mostly allow_smaller_maxphyaddr; extern bool __read_mostly enable_apicv; extern struct kvm_x86_ops kvm_x86_ops; @@ -1960,6 +1961,11 @@ void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, bool mask); extern bool tdp_enabled; +#ifdef CONFIG_X86_64 +extern bool tdp_mmu_enabled; +#else +#define tdp_mmu_enabled false +#endif u64 vcpu_tsc_khz(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 2e454316f2a2..267f72b065f5 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -271,12 +271,6 @@ static inline bool kvm_shadow_root_allocated(struct kvm *kvm) return smp_load_acquire(&kvm->arch.shadow_root_allocated); } -#ifdef CONFIG_X86_64 -extern bool tdp_mmu_enabled; -#else -#define tdp_mmu_enabled false -#endif - static inline bool kvm_memslots_have_rmaps(struct kvm *kvm) { return !tdp_mmu_enabled || kvm_shadow_root_allocated(kvm); diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index 52fa004a1fbc..9ca6d80fb86c 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -172,7 +172,6 @@ extern u64 __read_mostly shadow_mmu_writable_mask; extern u64 __read_mostly shadow_nx_mask; extern u64 __read_mostly shadow_x_mask; /* mutual exclusive with nx_mask */ extern u64 __read_mostly shadow_user_mask; -extern u64 __read_mostly shadow_accessed_mask; extern u64 __read_mostly shadow_dirty_mask; extern u64 __read_mostly shadow_mmio_value; extern u64 __read_mostly shadow_mmio_mask;