Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1745439lqz; Mon, 1 Apr 2024 16:31:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVtxBFqsE538cc4WHMHk7fV/JhU0T88/gB4YhTwiq/nwdd5YPAANzmue2snQFreRyzpeyg76a+POns67CO13xifg/r8ygfY2YYiXUBJA== X-Google-Smtp-Source: AGHT+IEplintJvD1yNJ+DsUgK8irn9BeVSw0/9qwjno9JVhbcND73wE0esTsyKdseQKTPCKl8c+4 X-Received: by 2002:ad4:5caa:0:b0:699:1227:5e13 with SMTP id q10-20020ad45caa000000b0069912275e13mr2578092qvh.53.1712014263492; Mon, 01 Apr 2024 16:31:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712014263; cv=pass; d=google.com; s=arc-20160816; b=0V3Mf+CpiOdxQXwCROpL0Am9jeq4A9PmzUOZ0bIea5USkiRptlIqlRk51sk7a+yxv4 eYHkvcyyKyoP0XGpYs9L7qqAWUdFNxbbj0IWRbMH/KAincxnhc4mmrsOJNVbMVeS7peW 5QZagcXtf+wEjGedHI6V5b2vWHUNsU0W6uwn0XdGCx74VEoGKkqFv9aUSeBSCWF/JfmA aqaNGE1gKbBbIi6n9qgKhAFP0DDjumjNU39uYrgr6p9Iq1+lpReDrvwl58kvpIopVKT3 6ZygXypTOxWQIfOaU7BdjHUdVK/blMiHlDyjY0o8jx8l5Nl9M4rKEL2bey/S8fISWMOn AfvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=nylYGqt19cj6oDr0RFoeiQ+kw/0yLdSX5tVYYbKq8QU=; fh=QdOz0rvEXgFNODe4Pw8DeKHcEXsO6NjevP+vNPf7DmI=; b=rD7jBCpr0nfDQxPpP77yhUzQl/voMA9fowTZ3cd7qneqFKLwO8/H+QE0eMFK6+skU2 lpGZSmsMLG7pp5gfeH3nmgu8sU+7nAgw9tmL/yf5iq2dTBfQgmBD19kfe4a08GnCKLwg n5gl2LKYQ+7qHS9FBuScH/6oz9Epq2CexhqMI33nLwI666c23lyBmFr1xrBd6LCHDHBD wOwjEkNRPOCgKc7lV+NfMGJz8Sb1fwO7EO/Ad+jBxXrmhXNvGJqc6Oq5p2y0jmJmxC0R 7k0wianlMQnykkmrz05kL3HhN2rlcPuavbzwrkq//AhUmrhrAVb6rhCYmSnAZyjvXxhh aW2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3RrC8O5Y; arc=pass (i=1 spf=pass spfdomain=flex--jthoughton.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-127174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z5-20020a0cfc05000000b00696ae65b385si10368207qvo.538.2024.04.01.16.31.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 16:31:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3RrC8O5Y; arc=pass (i=1 spf=pass spfdomain=flex--jthoughton.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-127174-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127174-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2EE961C21FFC for ; Mon, 1 Apr 2024 23:31:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0964F59179; Mon, 1 Apr 2024 23:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="3RrC8O5Y" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C12A257323 for ; Mon, 1 Apr 2024 23:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712014203; cv=none; b=Y57mf95aBCtFSDMtUQOMTZN+9e6hc0G7ymZWbj81DUOMWEiGXVTlSHI72HAw1q1xkiHEBe8y3lxO6zQwiAzp5V6sE9w3ecbd0AruVBNa29On6rfTd6eAVFTC92EaQDABMEfZmot2k71WN/fTNmVetaIF3kVd5OetOQn5NsbCMYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712014203; c=relaxed/simple; bh=6SjX+fdRUwbegUJJFXD27Uh0qk0JttGkcP5G/eXp4z4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gePGzQGpAL2ib2XuBAlv1hzxko9T3Lq+pOgKEQotA7yA5Xb8bYjmBk+naOVbpfnwWKqUkpKeLfpiTUDfVGqK9UT+gmaE9HuNgb0QUXQK6UsyAyR2j0QAf2fL3WFwiiUVmY+AjR7ADWhF7kam8popGj/tt4MkLcsiS5XDKgaY618= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthoughton.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=3RrC8O5Y; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthoughton.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcc0bcf9256so5417966276.3 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=vger.kernel.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=3RrC8O5YwbKvUemug4OQ6BwnCCSIlGpQjo/IbSt4j3lHKJaWyOSkoFmvuELcQNbl9+ 4oUsPjkhwNGIvhQ7oA5e0XQHrvJqHbx1DYKsOfWivExSBBy34RzmmALdGVr9l8YEAlkv UXVLhE9ZHUuPiwQ0fSp1HxBnJDhIV6Q+Yf56px8l/dkNW3EW7o0W0xZfnoRydrFK75av 52m7rFdCV4W2EULzM+EMXAjHehEI6Mcrozl8xBu8k+sD9J6q7YLFjfrCuogD8EIVuz9k ySkSTrUtvCohB1QqUr8m62zdXvgSR4oE2ugBCWxjvridH9KjmmeAiLOZF8j3dZoHovr2 +7bQ== 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=RZTyqlh/Elie3L9RKwTp9uQX8fasnbUdryyPD/UE20bK53oM709ubdI0zOBWugMy3o onClzt60VW+VbCqdZJhe5Vs4BTz+WGASEBYNK2Am1Ums/01GV+qv5wgUjWy5KjBArfG4 kGgKWvAXyi8pDnJfKYOw3XEr3SDj4mcgFEzh4YjxRqJdAsEqa9+M7TTkjlEptJTA/KCr QNXpcjl/K0MA/HUkas5L8QDDkQCqCy7nQVW6+wAdCNJoQPnnt34qX8qi3VeDwyQux4LC x9useMHtcC/1snGWm2HcWpS/KFU8N+zYXoHSdJHiZBrklQhY98HdmGx6rIqzfRvVGTp1 draw== X-Forwarded-Encrypted: i=1; AJvYcCXIGTRX/qEhpVL+BMIedyV0RTSLw3q5n2qLV5/07+UVTH4hASGAlusPk7MYUCw6RKsn/EtXaepxBl4Z/qn7sYY9mMY5suJyfPqH8Ozo X-Gm-Message-State: AOJu0YzCLkkuhx6hGlJMML7jk6prPmUN0rs2D02tQiLeLKtTMCC3f8vv Z849LeuSMof1oE9Tr/VkpgjhKwAYw6FSEwxATpjZyB1696+yRhkURX/vZPDd07IA4/Jzt9woWBU z3T51HcBjoT2sCLYVrQ== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Type: text/plain; charset="UTF-8" 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; -- 2.44.0.478.gd926399ef9-goog