From patchwork Mon Apr 1 23:29:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13613117 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 73933CD1292 for ; Mon, 1 Apr 2024 23:30:23 +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=k42d03e9yfrRTkeHgyvQrOrYPLeRto+KV72GJO1v6sw=; b=BviBciC3dLN1jHZsSsuWsJGhMW xxHMVYVxw9JIrSXKhJzdhskWPP792xUynXCwSXtQrnAajuHkyJxzyqnrhRwj+9OuhuRUAVBZzyp44 3fcOLkBuPDDvNzC3TBHTn9CWBWp1Gt/0a+qAJHElNC4z40k+f1ToxCmiCwfUsRULPKtep0San4RZF VwVsEzqNMmfYziJq/0/5EyQ6ByygGU4gjqlfQdqRiBKmXAaBmn6OSPF0zCTN6pIinfTwpWbxleTzd QYG2g5nnCvfR0XTVOhVSaTi/7NobdnTh9QocqjaFPUWr3j8rdZBYBtLuFJAseFzIQ7jMAbP4Z1XAz TmLKbKGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrR6M-000000097LG-3CPG; Mon, 01 Apr 2024 23:30:06 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrR6H-000000097Fs-0Of3 for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2024 23:30:02 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-dc6b26783b4so5073424276.0 for ; Mon, 01 Apr 2024 16:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712014199; x=1712618999; 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=nylYGqt19cj6oDr0RFoeiQ+kw/0yLdSX5tVYYbKq8QU=; b=dfmRE4kiWU97B0AUM5w/WEn9+unqGq0yw/vBUw9es59UalW2xY/zlOyNQuZEOCteFu Nm6Dzlgueb1kYXBxEtWOAUQsO9LWSITfbJpWoLxuzuLtg9FMBNX97L2i+HXuFyqvYfy1 SDJZCCl2XfIqy8GyaLYcMAYayKZESJLcpIYreZOcIZZ/iBoDyl47Cl0KTs+II8z6ysmA LmrVkVyfw6lABQFl+1OYGUnl7h6cJkKNZCBd7iYaZECqXdseae+ajrF4DFqQLXxsD3uH Rnae0JD6cV55inQ3dFuzuNvyZ+5ZJHvrFGtxSQc01VPjj5NeDQHXc/iE47m9zCpDAtKY HEWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712014199; x=1712618999; 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=nylYGqt19cj6oDr0RFoeiQ+kw/0yLdSX5tVYYbKq8QU=; b=uYR2gteIeXz9BpKoQ9mHJH3WoEH4lD1vAZWJRwD7EkOn6QL9U3wXfyWjib3Kl9dz6q O70vT53RbIXLmm+keFC++eIO5N5V1zReB5QoM9WPh5Ov/YhMbfCriQI2i2yDXalMmYwY IwxfOlQxdbcSYvSEXFnMgmVLAzg0VB7V7BteA1WyruU1cZ9heCPJhxtJY7AUP0C0NdA7 4BmbjQrixZ132WNqncO8m3BvYcjmL+yw2+6/RHt20iZHxWGyDc3hBHYP/wGwxUPgcql4 Uo6RECvNaNLAIadOys0/LKWScEGSzYsegU6nbZOSVMk/HX5vDImDL4VqlfjncOrfTEep Hxpw== X-Forwarded-Encrypted: i=1; AJvYcCXS4iT4gUnQYBwsHCS+M7kvyForRDTqzF1BtQEZM9OukWW1DiXdkHnbMh0c4E3qPncFygaQp7QCZr9WHz53V/dthUmdO9atYGxvmTdyzKMzbN5igcY= X-Gm-Message-State: AOJu0YzHD/oy9FJUfk3NCaAd0LWhPTl3gCui88vHRt+DjRTvRHNJieMC sAv/DMJUhnyo798D+Ghj0sP6UQ6ITqSZy3hEeg93yNy/1XIzwVljOPOGDj5WVsyz7c7N11OWlHY t9oCTP9ZEFj916mikVg== X-Google-Smtp-Source: AGHT+IH11gFjd5KLSe+p+dgHN5WTYlvUkDoQzbaal5VNFeM0iKdCiBmTQIhFAj+2vV8eggKrfvh7CUqHaFUquRNc X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a05:6902:2182:b0:dcd:2f3e:4d18 with SMTP id dl2-20020a056902218200b00dcd2f3e4d18mr765892ybb.12.1712014199648; Mon, 01 Apr 2024 16:29:59 -0700 (PDT) Date: Mon, 1 Apr 2024 23:29:43 +0000 In-Reply-To: <20240401232946.1837665-1-jthoughton@google.com> Mime-Version: 1.0 References: <20240401232946.1837665-1-jthoughton@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <20240401232946.1837665-5-jthoughton@google.com> Subject: [PATCH v3 4/7] KVM: x86: Move tdp_mmu_enabled and shadow_accessed_mask From: James Houghton To: Andrew Morton , Paolo Bonzini Cc: Yu Zhao , David Matlack , Marc Zyngier , Oliver Upton , Sean Christopherson , Jonathan Corbet , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Shaoqin Huang , Gavin Shan , Ricardo Koller , Raghavendra Rao Ananta , Ryan Roberts , David Rientjes , Axel Rasmussen , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, James Houghton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240401_163001_163177_EB4A495D X-CRM114-Status: GOOD ( 13.12 ) 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_prepare_bitmap_age(). 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 16e07a2eee19..3b58e2306621 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1847,6 +1847,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; @@ -1952,6 +1953,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 60f21bb4c27b..8ae279035900 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -270,12 +270,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 a129951c9a88..f791fe045c7d 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -154,7 +154,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;