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: 13613093 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A561ACD1288 for ; Mon, 1 Apr 2024 23:30:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3CD86B0099; Mon, 1 Apr 2024 19:30:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC5A06B009A; Mon, 1 Apr 2024 19:30:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1A0D6B009B; Mon, 1 Apr 2024 19:30:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8DB536B0099 for ; Mon, 1 Apr 2024 19:30:02 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5F27C40168 for ; Mon, 1 Apr 2024 23:30:02 +0000 (UTC) X-FDA: 81962558244.23.6C18572 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf12.hostedemail.com (Postfix) with ESMTP id 98DB140005 for ; Mon, 1 Apr 2024 23:30:00 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LW88t150; spf=pass (imf12.hostedemail.com: domain of 3d0MLZgoKCGIJTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3d0MLZgoKCGIJTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712014200; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nylYGqt19cj6oDr0RFoeiQ+kw/0yLdSX5tVYYbKq8QU=; b=tn8ti6xlbF0hzmb5CI3z1o4mgGEMr6wByThLdgLM70xbHrUz/ryWPB7jqhFhul/THcm5uG wNMJ4hWfof9hTZMKMDzNypU1NuUOS9O76JbuLlZ3i6YZhs3MwwCcFdmG0iYfrwd6pwnUwT 4kTU+nLu+pmohBNrr9bYi50EK+UNwtA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712014200; a=rsa-sha256; cv=none; b=aF5I5RgrNE1YFtC3OlVJ5IqA/zIT6VzNPap8DRA9o0atg5L2HrAyjEBxpC3fAFbRIa1fIO rcBC4gEpZucCEAJzrDDvEgYHmcNs9VW5MxNgZYblor1aIrcDa1EDm1Zam1rT4heUuIWAlK Yyenj7SNkmHiwtpzbqXoaSo1jz5MtFw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=LW88t150; spf=pass (imf12.hostedemail.com: domain of 3d0MLZgoKCGIJTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3d0MLZgoKCGIJTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dcc05887ee9so5314179276.1 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=kvack.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=LW88t1503tBI1C28ZHfg6LMe4iwcBX8DrnZcb69fncKvkiFpn0Ji1EF8DUOwB0C7qX riFNKd1jJL52kCeqylMWcQc4IzBGLbmoel+oVl84NmWZPorV8ILhH7HhlqBiPDkxTdWF tAKc+ul95kclD01AVBi4hdN4/WvrJtsC2Bp9IJBjnpfNKNFRUfoYNYH4LbhtuxHC4QA6 /9wEYkl+6DJKcHkyVE4npDSXYPH0zXnlVc1BFqf6zODNiKba8pMRSr/yZlWPMU8CK1pk Xxi/xrorS0fZswYMj61puqJXpYCc5imz1331wSSPyPJA5WidUGOpmzEgYUoLeSTAEUQh +NZA== 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=d2o4b9ZAc9gt84fTFh0fBp9qs1E8e63fTAsDwglhUjCatk555CMg3zFIEhEARRIqdB cHb16iwtCJZSUSytDjUFrpTWd2IQBHLb2xMTb5gBa79aTX7s1bMa8bcyd2+5a8MqiysS 0VLXGoDu3ST2wkdIL1kQIHRCpoJuG4IoMcfXg93BzTSVS4dRiHyxmagU34AYJWO9T7qp wKQajm0Hht/WdO5bKbGA0/0X/O5Y/jZh1cGKmgO3WyUz8xPwbTU/kcAeGWnNjkUDITJd NyJvLcqON1S0AGmQz3Ptb6Nzn4IbvIllqybXKb/TmgcDsYksmEtqXxqkxBhtAyHnhVks QsIw== X-Forwarded-Encrypted: i=1; AJvYcCUR/7PuIbh5sBUd8ZVEbhLYo3tejnI2iLl9iDpXsK+AxPfTcHL8vii2/4eXPTP6bDH4xQr9+dUEjl/aDOH1Y4RN4nU= X-Gm-Message-State: AOJu0YwwuwC2bS20zYpFhnV5YSEf4A3ygv1f+bcHJ/MqCEml3HVCfRDS KebYnrrFEVFtiCrfjfjYKTfniLT3QjdxmrofdvfpaSmfTXbef76N/BbBil3KjfLiTboUWempaGJ E3bGqM9IH/hRl0o8GWQ== 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-Rspamd-Queue-Id: 98DB140005 X-Rspam-User: X-Stat-Signature: fcrn1p5jw56b34umj5b53pprznrftpbi X-Rspamd-Server: rspam03 X-HE-Tag: 1712014200-736411 X-HE-Meta: U2FsdGVkX1+pm0Nxr2O05BCDuSJ8htxTWmdj2uE08jcLaj7qVC2xfFiU75k/y+TfwuM/dpszKfmzhOZc8WGiyuln7Dr+EBDev8q6rrOCnnCSBaUDX2gpFBQnUrWxe5yXohycuK9XZD8N9Kc8Q0We+FBcbcYHkIQ2E7e97GQlI26n+4I5Oc2Mh8r/lIAn3kdLK+wF8pnD6WHtz7DYlVwflCpd7yV0jWUrQUjeVsHQGJ2SB4IMjwEFXiTl5RatJQZYftw9FIO/B2WYzeNOx8heUYcy64h5pPY8iPS5i2Ag/RAohsERD1n1VnQf0/fF83D7ywC7b+/a1mApiDX9mRbLVcT17WlwaVTkWGhyYEdN9wTS19u5ASCXow2p9VjE6kR8CiNRu4SyNugXUhnTKa+lpJN9PfCFvg4ObsTLjolP0HYcLK5eOLP3rnrD4mrXwy8Wqw9nBjy5cEABzMyWrGIWpotKWsM+SiKW9tPSFz+KK+DnaolrarCWLrLIsmjC9JOCoQbBD6eRAbOQkvCOP9w6K66ebPV2CFmIlz3aNUQIjZobixfJqbSeyuW2v1dEuO8zhoYFm087pHaqIkKV16+/D20x6FbFgKqpPxziWten6ELYMRg/WhciJxQcfVehkceeA5YaV6yS1a+aMbk0F/RQXgtmMof3Va5C9Z+ReaX/W17sxQkr7U0iYlQWYe4WVpNozFV0B7hwjvL8VirDz7MLPTJAFr8m49bxTtnF0JpOx2Afbuv3sxA3P3haV8cQJQmR3oiqr0bW1uhkDw/OXQlRkx3e7OZi/p7+nloTShIYOz4gkoe53gz5POKzDUqOQ4oVEBslr0gUT1ihbHwpo/+7gBYidv8wyj2oLoHqspW8FaIarDqlIU0dIaWIT/31RiRXbyfG6OTBIXFIIqa7FH3SwjsJXkafB4OB1DNoviBfrLp/lSKTCP2d0AFAx3IQHa10pKgcj3fIg0pAC0ou45v 5yie6mvx lDwcjm2OfbjxsKolmMOguu1K54RAdY3gIxU4MLlLiJTWQ7/HwDMsxBWa/LKzjrJJOu4I7PtDsDHkF7Uwwaee0NLD6bkiVhGIe1VOtdhdKjPYB7p3gEAn80ePUh1RMLSvlMJgkR2jB4ysDZ92yBuKH/QiKDnS5ibznF1IEVfQ2HPHPCNJkKlObK8LJo+C736gGm3uuQXTQ1hpgerUi2uPxAqR/4O7hBc5z7t+cYHP0u9d0ZQPqMOyII+G/dDR536LjaRqtPcg+JrbptzMztl8dni7bRTicB1HZNwKydkoErNSIkgVY4kGkhUTlYJcEcmArdc0Vbj1vVK2gTTO2RMFKCDuNK8t900WcRdHvFQiJhfWit4F2Znhf125/roYgGGBgiQOzNdAnSzUU0i7UskU96YVj8r6AOh7wjDVyzk5yELxmbND+alCRP5bNRdoqB3x0rKGV0bev0I5OzXTjh1KhqGfESNYdjUwyb2zVgEWCfv3hwuxDb1k4A2w47X99/1304gBQmwNGiw0hZY2l+F4vENBa+jdvtsnb+odrDRr4gtPc6yTzILiR5Qs0dIiNtEZBnLqp7kgdo/V0cuZjcRrmBM3oXeNQsynVjdrbCpLhBW7blFJxTBwX3TWjKnZK/S0IDybRexFg1zGSSdYm3sc7NXIQHmsMaHrJ3bXFgtmyjIlXx18XxpbTJeOa+w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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;