From patchwork Mon Dec 2 07:31:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 13890085 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 36AFCD10DB4 for ; Mon, 2 Dec 2024 07:32:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.846277.1261448 (Exim 4.92) (envelope-from ) id 1tI0uZ-00084Q-Fa; Mon, 02 Dec 2024 07:32:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 846277.1261448; Mon, 02 Dec 2024 07:32:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tI0uZ-00084J-Ce; Mon, 02 Dec 2024 07:32:03 +0000 Received: by outflank-mailman (input) for mailman id 846277; Mon, 02 Dec 2024 07:32:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) id 1tI0uY-00084D-LP for xen-devel@lists.xenproject.org; Mon, 02 Dec 2024 07:32:02 +0000 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 820d8b95-b07f-11ef-99a3-01e77a169b0f; Mon, 02 Dec 2024 08:31:58 +0100 (CET) Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2024 23:31:55 -0800 Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 01 Dec 2024 23:31:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id B58773B2; Mon, 02 Dec 2024 09:31:47 +0200 (EET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 820d8b95-b07f-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjE5OC4xNzUuNjUuMTUiLCJoZWxvIjoibWdhbWFpbC5pbnRlbC5jb20ifQ== X-Custom-Transaction: eyJpZCI6IjgyMGQ4Yjk1LWIwN2YtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMzMTI0NzE4LjM3Mjg2NSwic2VuZGVyIjoiIiwicmVjaXBpZW50IjoieGVuLWRldmVsQGxpc3RzLnhlbnByb2plY3Qub3JnIn0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733124718; x=1764660718; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=M15az0QjHwqSnaRdQ3vhhyKn2F1zyuHqY37H2ln+rKo=; b=L/nFC4rEUW6tJk1jHMPrscqJdngXKXCChJF9fHyEv5ARsr4WVDaM7DRE O2r6KXb8os7C/0OFHGf01/HMUOrHr09vl24aMjuR/5OXjdwT7KD/NEdnO a60GXroQmIvzlKoHC222F2vcjXyeyQDGbotNbHZRbi7GKHbraQzjWE8Iy edIQxQpRetgdhsBG0D0IucVQhI48WL0dCzLwPJkkEY81ZpVEBENgfevmZ uGuhUtqFR1h16DwqQJE9Sax2rNWcEE3Bc4zrpu8S5YGMKkD9atZKgFjZe EkXtvJoZSjbCkw4JDMvytBzrTVXw6K94w/LGRm4Yx65eE3n5EyTNIy/ks w==; X-CSE-ConnectionGUID: yTYMf//0RhytFFbgfzDa3Q== X-CSE-MsgGUID: jj0/r0M4RxaBoTTXTWnX0g== X-IronPort-AV: E=McAfee;i="6700,10204,11273"; a="36943338" X-IronPort-AV: E=Sophos;i="6.12,201,1728975600"; d="scan'208";a="36943338" X-CSE-ConnectionGUID: 5gTE3+swTUCPaC+Chly83w== X-CSE-MsgGUID: 9RWjv968Rkar/vBJ99Abxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,201,1728975600"; d="scan'208";a="93408303" From: "Kirill A. Shutemov" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , "H. Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky , "Kirill A. Shutemov" , Gaosheng Cui , Michael Roth , Tom Lendacky , Ashish Kalra , Kai Huang , Andi Kleen , Sean Christopherson , Xiaoyao Li , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Dave Hansen Subject: [PATCH, RESEND] x86/mtrr: Rename mtrr_overwrite_state() to guest_force_mtrr_state() Date: Mon, 2 Dec 2024 09:31:39 +0200 Message-ID: <20241202073139.448208-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Rename the helper to better reflect its function. Signed-off-by: Kirill A. Shutemov Suggested-by: Dave Hansen Acked-by: Dave Hansen --- arch/x86/hyperv/ivm.c | 2 +- arch/x86/include/asm/mtrr.h | 10 +++++----- arch/x86/kernel/cpu/mtrr/generic.c | 6 +++--- arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +- arch/x86/kernel/kvm.c | 2 +- arch/x86/xen/enlighten_pv.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index 60fc3ed72830..90aabe1fd3b6 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -664,7 +664,7 @@ void __init hv_vtom_init(void) x86_platform.guest.enc_status_change_finish = hv_vtom_set_host_visibility; /* Set WB as the default cache mode. */ - mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK); + guest_force_mtrr_state(NULL, 0, MTRR_TYPE_WRBACK); } #endif /* defined(CONFIG_AMD_MEM_ENCRYPT) || defined(CONFIG_INTEL_TDX_GUEST) */ diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h index 4218248083d9..c69e269937c5 100644 --- a/arch/x86/include/asm/mtrr.h +++ b/arch/x86/include/asm/mtrr.h @@ -58,8 +58,8 @@ struct mtrr_state_type { */ # ifdef CONFIG_MTRR void mtrr_bp_init(void); -void mtrr_overwrite_state(struct mtrr_var_range *var, unsigned int num_var, - mtrr_type def_type); +void guest_force_mtrr_state(struct mtrr_var_range *var, unsigned int num_var, + mtrr_type def_type); extern u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform); extern void mtrr_save_fixed_ranges(void *); extern void mtrr_save_state(void); @@ -75,9 +75,9 @@ void mtrr_disable(void); void mtrr_enable(void); void mtrr_generic_set_state(void); # else -static inline void mtrr_overwrite_state(struct mtrr_var_range *var, - unsigned int num_var, - mtrr_type def_type) +static inline void guest_force_mtrr_state(struct mtrr_var_range *var, + unsigned int num_var, + mtrr_type def_type) { } diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 7b29ebda024f..2fdfda2b60e4 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -423,7 +423,7 @@ void __init mtrr_copy_map(void) } /** - * mtrr_overwrite_state - set static MTRR state + * guest_force_mtrr_state - set static MTRR state for a guest * * Used to set MTRR state via different means (e.g. with data obtained from * a hypervisor). @@ -436,8 +436,8 @@ void __init mtrr_copy_map(void) * @num_var: length of the @var array * @def_type: default caching type */ -void mtrr_overwrite_state(struct mtrr_var_range *var, unsigned int num_var, - mtrr_type def_type) +void guest_force_mtrr_state(struct mtrr_var_range *var, unsigned int num_var, + mtrr_type def_type) { unsigned int i; diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index 989d368be04f..ecbda0341a8a 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.c +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c @@ -625,7 +625,7 @@ void mtrr_save_state(void) static int __init mtrr_init_finalize(void) { /* - * Map might exist if mtrr_overwrite_state() has been called or if + * Map might exist if guest_force_mtrr_state() has been called or if * mtrr_enabled() returns true. */ mtrr_copy_map(); diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 21e9e4845354..7a422a6c5983 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -983,7 +983,7 @@ static void __init kvm_init_platform(void) x86_platform.apic_post_init = kvm_apic_init; /* Set WB as the default cache mode for SEV-SNP and TDX */ - mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK); + guest_force_mtrr_state(NULL, 0, MTRR_TYPE_WRBACK); } #if defined(CONFIG_AMD_MEM_ENCRYPT) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index d6818c6cafda..633469fab536 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -171,7 +171,7 @@ static void __init xen_set_mtrr_data(void) /* Only overwrite MTRR state if any MTRR could be got from Xen. */ if (reg) - mtrr_overwrite_state(var, reg, MTRR_TYPE_UNCACHABLE); + guest_force_mtrr_state(var, reg, MTRR_TYPE_UNCACHABLE); #endif } @@ -195,7 +195,7 @@ static void __init xen_pv_init_platform(void) if (xen_initial_domain()) xen_set_mtrr_data(); else - mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK); + guest_force_mtrr_state(NULL, 0, MTRR_TYPE_WRBACK); /* Adjust nr_cpu_ids before "enumeration" happens */ xen_smp_count_cpus();