From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 316C48003D for ; Sat, 25 Jul 2026 09:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784971945; cv=none; b=A1Pvt1UGzI5A/V32oxW5EhxrfNZTQy3Y4yup5b7h3zZkzFBMuFgIP9FBAn6glheykfjLfPk07qT9br4/CPTAzg727UUsVIpzSK2qc6/C0Sy5IxegKp464nKXAdxfD3Wai1VnlZAsd6vizR0QTPvKU8Bq5n1JCMTiSPpnGp73nAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784971945; c=relaxed/simple; bh=hL4LdsRXgLMIr13056RmZCX9HUEjFn8VzKfukHKZ0cs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ieIHCDxYh7ZTmLS392NPchPhOgmEK1e3CnkZuvJS0sz6xV4JKvbYCsrmkh1reRJkKCkUzlcWY59gJWu0DdRPIA1VQSLzpTBz3ugBk9emvBexmxY2ABSPMhELQVOpRow7FqgUPb2AVbAg7L70JdfrNIzTfemuEf18Z9vxTKEd2jU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=d0PrfL81; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d0PrfL81" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784971943; x=1816507943; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hL4LdsRXgLMIr13056RmZCX9HUEjFn8VzKfukHKZ0cs=; b=d0PrfL81VUQo4Vc/NaowKJlRfz+eUh18c72mt7DXPG2y58yxLl0Cx/+8 MVOb5xK/jFxZdk3PazA0txY64ZdHwCrvOe4qqFqpU5Om3XkoTtsZsPu6v 06kRI9oYUOipnj6BNycFO0kf3RImeNm8xCy86ND8O718X9KH+YYNqPUnL 53ndS/d3COiVIn0KibdBfqOr+mNckG5FhjCeCybCbKQGlNn2k41fM/SNr v6PTYobsadgyDkr0lSn1ezQnI3+4sD9GIomwYGCkV9B77u8f5JWiJWIDo ICV2D4GeWuBwshHjzvIXgbULEzxndeNPt4FFuzbg8qOcJuK+G3Ue+9swP g==; X-CSE-ConnectionGUID: OsvEXPJCRKKuAA7BFHJUIQ== X-CSE-MsgGUID: YgU6GvHuQNSdu0LEfQz2dw== X-IronPort-AV: E=McAfee;i="6800,10657,11855"; a="95979005" X-IronPort-AV: E=Sophos;i="6.25,184,1779174000"; d="scan'208";a="95979005" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2026 02:32:23 -0700 X-CSE-ConnectionGUID: rJ+RnRkXTtW+JWlezgP+7w== X-CSE-MsgGUID: 9GJ6TpypQ7mtTuuUZTyheQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,184,1779174000"; d="scan'208";a="260878598" Received: from chenyu-dev.sh.intel.com ([10.239.62.107]) by fmviesa004.fm.intel.com with ESMTP; 25 Jul 2026 02:32:20 -0700 From: Chen Yu To: tony.luck@intel.com, reinette.chatre@intel.com Cc: tglx@kernel.org, bp@alien8.de, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, fenghuay@nvidia.com, babu.moger@amd.com, chen.yu@linux.dev, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 1/9] x86/topology: Export topo_lookup_cpuid() for resctrl use Date: Sat, 25 Jul 2026 17:22:36 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Enhanced RDT (ERDT) enumerates its monitoring and control resources through ACPI tables that identify each CPU by its x2APIC ID. To associate this firmware-provided data with the kernel's per-CPU structures, ERDT must translate those x2APIC IDs into logical CPU numbers. topo_lookup_cpuid() already performs this translation, but it is static to topology.c and therefore not reachable from resctrl. Export topo_lookup_cpuid() and add its declaration to asm/apic.h so that ERDT can resolve x2APIC IDs from ACPI tables to logical CPU numbers. No functional change intended. Signed-off-by: Chen Yu Tested-by: Hongyu Ning --- v5->v6: Move this patch to the beginning of the series because it touches a different subsystem than the rest of the series. (Reinette Chatre) Order the commit tags per Documentation/process/maintainer-tip.rst. (Reinette Chatre) --- arch/x86/include/asm/apic.h | 1 + arch/x86/kernel/cpu/topology.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 9cd493d467d4..bb84651b14bd 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -54,6 +54,7 @@ static inline void x86_32_probe_apic(void) { } #endif extern u32 cpuid_to_apicid[]; +int topo_lookup_cpuid(u32 apic_id); #define CPU_ACPIID_INVALID U32_MAX diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index 4913b64ec592..bcee70fb9277 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -92,7 +92,7 @@ static inline u32 topo_apicid(u32 apicid, enum x86_topology_domains dom) return apicid & (UINT_MAX << x86_topo_system.dom_shifts[dom - 1]); } -static int topo_lookup_cpuid(u32 apic_id) +int topo_lookup_cpuid(u32 apic_id) { int i; -- 2.25.1