From nobody Sun Nov 24 01:17:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1729075896; cv=none; d=zohomail.com; s=zohoarc; b=Vd1KfYrtnK6urIM7+ObVai5J4uiZ3/yP9WpZBM1B78rgRxUbVpfVgka8YjgrMouIMn02k4bmRj7/D75zIVwnQ90Wa3Ou7smeSOSuo/jYfsbF3K/NaUnHpyjkdHu/GdgL2Gy5lmIUIR+GRlHceFSVwsLfItw20bpe6jEytQoQLRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729075896; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fJPQMwQCNu4tdJtwg3ig64/sZwpYXdi6+eBVL3EVCdg=; b=YhkKUv0dHJAV+oVuOrDjQuh6Yy3PMmTvzB64wKemimLQpFYDtRk5ZeEzVxrqI6mT1fVaJexeSHlwEe1gENdqpW9HyNBgdhhLFUltKhr/gUikAotgYUV1UpsaK9ode5cHF1iG4cd8hek8Uu0VtiCnLtiC28OdFwkpjbgeMZVmY6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729075896660227.2055956880297; Wed, 16 Oct 2024 03:51:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819947.1233442 (Exim 4.92) (envelope-from ) id 1t11cN-0003fM-Em; Wed, 16 Oct 2024 10:51:03 +0000 Received: by outflank-mailman (output) from mailman id 819947.1233442; Wed, 16 Oct 2024 10:51: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 1t11cN-0003fF-Bp; Wed, 16 Oct 2024 10:51:03 +0000 Received: by outflank-mailman (input) for mailman id 819947; Wed, 16 Oct 2024 10:51:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) id 1t11cL-0003J9-KQ for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 10:51:02 +0000 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 86bd9cdd-8bac-11ef-a0be-8be0dac302b0; Wed, 16 Oct 2024 12:51:00 +0200 (CEST) Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2024 03:50:58 -0700 Received: from black.fi.intel.com ([10.237.72.28]) by orviesa005.jf.intel.com with ESMTP; 16 Oct 2024 03:50:51 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id DE448331; Wed, 16 Oct 2024 13:50:49 +0300 (EEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 86bd9cdd-8bac-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729075860; x=1760611860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PNIap9Mxdye6yXywbk16VpWNVzOz915uVCPZlmzOALo=; b=dAe25eiMDw2e8olrLPBQ5qTQcA8k0/et1OAX7G/gktiwpi3RrcvyUuYU wTeOK+UZel0KZpICotQqGo4yQ6iy34hO4tUBNVknD0XgP/vwbR179NtLy ldZc9cSAiprCalPDUuw9TFvEysjp1OCn6QXLjTBqD4Buv65YeoWx9D95w PoRb5BI7a1ow2SHAR/q6EF3NQSgmdP1+YyjkmHmCmSL8FuE0Pf2rjsPy9 6mh7i2Jo1ydTeJASyYi62EiW7nbjeQiIWPl/hb0nVeo/8jeGhot1vwTVG pWOuAraStv+7k6ABY8VZPXLvJ7EWfAwbYikxzWRqNMcQQ51lg2r5wawy3 A==; X-CSE-ConnectionGUID: /W0d1CHWT46/2OKjaPYktA== X-CSE-MsgGUID: VK2jCiQMQn2wNOJQMciPbA== X-IronPort-AV: E=McAfee;i="6700,10204,11226"; a="28395571" X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="28395571" X-CSE-ConnectionGUID: BcSritA1TJ2xJIzrN/E4tw== X-CSE-MsgGUID: rEYd4NKfRJOPJascwiMpVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,207,1725346800"; d="scan'208";a="82969242" 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] x86/mtrr: Rename mtrr_overwrite_state() to guest_force_mtrr_state() Date: Wed, 16 Oct 2024 13:50:48 +0300 Message-ID: <20241016105048.757081-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241015095818.357915-1-kirill.shutemov@linux.intel.com> References: <20241015095818.357915-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1729075898265116600 Content-Type: text/plain; charset="utf-8" Rename the helper to better reflect its function. Signed-off-by: Kirill A. Shutemov Suggested-by: Dave Hansen Acked-by: Dave Hansen Reviewed-by: Michael Kelley --- 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 =3D hv_vtom_set_host_visibili= ty; =20 /* Set WB as the default cache mode. */ - mtrr_overwrite_state(NULL, 0, MTRR_TYPE_WRBACK); + guest_force_mtrr_state(NULL, 0, MTRR_TYPE_WRBACK); } =20 #endif /* defined(CONFIG_AMD_MEM_ENCRYPT) || defined(CONFIG_INTEL_TDX_GUES= T) */ 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_v= ar, + 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) { } =20 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) } =20 /** - * 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_v= ar, + mtrr_type def_type) { unsigned int i; =20 diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtr= r.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 =3D kvm_apic_init; =20 /* 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); } =20 #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) =20 /* 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 } =20 @@ -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); =20 /* Adjust nr_cpu_ids before "enumeration" happens */ xen_smp_count_cpus(); --=20 2.45.2