Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp374772rwb; Thu, 27 Jul 2023 14:16:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHYs8FXWA5H9zm5o0CxXKkBN29tKsAtt/LsmZ65p9k3IT29yh8MlDt/lLTqqa0P12Frx//P X-Received: by 2002:a17:903:2582:b0:1b8:5b70:2988 with SMTP id jb2-20020a170903258200b001b85b702988mr353399plb.30.1690492572475; Thu, 27 Jul 2023 14:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690492572; cv=none; d=google.com; s=arc-20160816; b=KY5QI9QejVX82sPA1ZdevyquWl7A/WCHvBAKBthSQLdOgKzQKIkA5clb9JFlxl3UgT dHqAr/QMMMxykeHuxrpnz/h1bmYqSc5inqUcD04YxytI1XY9z8HenXvyecz2b20WUvdV CyC5Ceq6ebnbwsKA1MtYszIIXXbYclNm9bTn+T/ZEoKhG452oGJuo1FJNrvaHAan9sjf BG0p2CyPrN6hxze8zVWtECm6MSmKY9+H345KHfAvr4XpzgVG4W7oj5D1bDwbbul6piB0 PrdCJUxHrpr7icll+7MEcq0uArhwZwfp8BaZ1QNSXZ+hBrtjmV7f+IBKmEOPs2Jk1elA A2oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=lX/Yd7rNSCr3YxLFCMt412GXyk0hTSxOqqx3DJg2Au0=; fh=y8tS7hHyMnVm4J/EG8JBk7xmqgMCnIiFB1dTM3zggRY=; b=DK3Obh+TBIkx4g7CIHG7Xz/vE70ARa73qa8C/IaY0xyO5wgLbWF9BwFGAvdjjcQSIO OtILII1ws3x8vzBIGOPhvP074AOoG4PxebwdkXMgKge6rPEgKJNdOA88i/A5uq8j694O s2UOouKlipEFijfR55Uxgz0uoLHNsHeNp4uJYnp17RxIrzYxWBNv8eXWJXvdvWaLtrnp 3CwDxMgETJ//d0qlsKCLkwJiqqV6e1iod+NofOqXzirWcTzZ1uYAISaYtSH34/k8ujr5 XOoGkeUtY8cBq0Zl1nJsRSu78C2LZvIs5d5K1CRo4oMMtO9aSiB00OO2ahkp9Jsixhe/ 4h+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=hKg2RCzp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170902e80400b001b7fee7d5f0si1884683plg.25.2023.07.27.14.16.00; Thu, 27 Jul 2023 14:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=hKg2RCzp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232257AbjG0TzD (ORCPT + 99 others); Thu, 27 Jul 2023 15:55:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbjG0Ty7 (ORCPT ); Thu, 27 Jul 2023 15:54:59 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42F562D7B; Thu, 27 Jul 2023 12:54:57 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id AA90623834D8; Thu, 27 Jul 2023 12:54:56 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AA90623834D8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1690487696; bh=lX/Yd7rNSCr3YxLFCMt412GXyk0hTSxOqqx3DJg2Au0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKg2RCzpK8sWiO1Zk8WE7f2f+pRbakMoY4KRfHPmRzADZqhlgwFznmmpm2xPHcmdf kyyYQD3dD4x38M5X7P3WBiFbQno75H1CNM9xiNbskS4r44H+uR5Uwhj9LX6vf/m6oA 9pGEs2KT9vdqOA6pnkwVFUcKqPmhwEAvgbuDq5FY= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Cc: mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com Subject: [PATCH 03/15] mshyperv: Introduce numa_node_to_proximity_domain_info Date: Thu, 27 Jul 2023 12:54:38 -0700 Message-Id: <1690487690-2428-4-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Factor out logic for converting numa node to proximity domain info into a helper function, and export it. Signed-off-by: Nuno Das Neves --- arch/x86/hyperv/hv_proc.c | 8 ++------ drivers/acpi/numa/srat.c | 1 + include/asm-generic/mshyperv.h | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/arch/x86/hyperv/hv_proc.c b/arch/x86/hyperv/hv_proc.c index 68a0843d4750..5ba5ca1b2089 100644 --- a/arch/x86/hyperv/hv_proc.c +++ b/arch/x86/hyperv/hv_proc.c @@ -121,7 +121,6 @@ int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id) u64 status; unsigned long flags; int ret = HV_STATUS_SUCCESS; - int pxm = node_to_pxm(node); /* * When adding a logical processor, the hypervisor may return @@ -137,11 +136,8 @@ int hv_call_add_logical_proc(int node, u32 lp_index, u32 apic_id) input->lp_index = lp_index; input->apic_id = apic_id; - input->flags = 0; - input->proximity_domain_info.domain_id = pxm; - input->proximity_domain_info.flags.reserved = 0; - input->proximity_domain_info.flags.proximity_info_valid = 1; - input->proximity_domain_info.flags.proximity_preferred = 1; + input->proximity_domain_info = + numa_node_to_proximity_domain_info(node); status = hv_do_hypercall(HVCALL_ADD_LOGICAL_PROCESSOR, input, output); local_irq_restore(flags); diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 1f4fc5f8a819..0cf9f0574495 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -48,6 +48,7 @@ int node_to_pxm(int node) return PXM_INVAL; return node_to_pxm_map[node]; } +EXPORT_SYMBOL(node_to_pxm); static void __acpi_map_pxm_to_node(int pxm, int node) { diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 233c976344e5..447e7ebe67ee 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,23 @@ #define VTPM_BASE_ADDRESS 0xfed40000 +static inline union hv_proximity_domain_info +numa_node_to_proximity_domain_info(int node) +{ + union hv_proximity_domain_info proximity_domain_info; + + if (node != NUMA_NO_NODE) { + proximity_domain_info.domain_id = node_to_pxm(node); + proximity_domain_info.flags.reserved = 0; + proximity_domain_info.flags.proximity_info_valid = 1; + proximity_domain_info.flags.proximity_preferred = 1; + } else { + proximity_domain_info.as_uint64 = 0; + } + + return proximity_domain_info; +} + struct ms_hyperv_info { u32 features; u32 priv_high; -- 2.25.1