From patchwork Wed Jan 31 02:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Xu X-Patchwork-Id: 194450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1628426dyb; Tue, 30 Jan 2024 18:27:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0JPvUwu8AE1AEoZIyG3WvSMN7Nvib0aCsGeAWBOQbalVNXdgS5SdCiiCsp4x1YP6LtQKM X-Received: by 2002:a92:d48f:0:b0:363:7d46:4cf0 with SMTP id p15-20020a92d48f000000b003637d464cf0mr435922ilg.8.1706668039150; Tue, 30 Jan 2024 18:27:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706668039; cv=pass; d=google.com; s=arc-20160816; b=Zzcc2JlAl1Cop2AcN7bpCVVi9ZjOhaIn4cpFu2utfXqAdpJW6ETbLvImQT/2aXqiDw jzUj4ZE8DRYWkgXyD9bbMYXiP25HAbF99IIdbRHZxeCqocKLJ+gZfCNoSKANwKYQglBi t7PHjlDwMQ9L3ShhVSIbpP/wunzNtYP8X8MNZyppax3zlYpN3woBut/tSxE0wV5Ah84W WAsSJVrnP2glK8XbfwA8H4s+7yb8dUNdYl6KbNM2wgb8e/2wCywTu2l026zVJZHvOmLR 5ElIqygKwTWhURVjb+l+naRjv04TWBZOrjgOfgtvxSni9JH+OsE21JeTJgRPzksgvM7o 4HLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=b23tcK54D1K04i1rwiVUce6u516BJiNne7Hw6RBoMRY=; fh=8dc/Y1h568NBYMnEH+VnOeXRSylrAu8KnIv1JU4CMOg=; b=A7e6e+8FnoqiIlZeh/87h294uSSEfEK9MUmZ1oKHkEMfK6p3et/m49XdfWhEezHDer /HJ5ShsuFMieIcyk9wNltm8DBN5jhRwJXcA/M79qONL6auySVOjOsvRsN37QBx0r8OrC tB7+ok/stJtaR1jFN831h6Tuxvc2X2/2ZFCBsgOwkPapzfTHMnqFJT5ajJtwAihv6y7e tIvJygZJQXcKJJ0X+A9fi1eaXalNJkVjBWTokSGu4I5Vh9gUqGXWmIISsLzLx0gmbFH5 G0pGclhx/Sflyi1zYaAkYQEzQQuhCUTvhjVMKXdu20I7r/aA+SnO4770lWOKvdhPcT9e GX/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c+JT9BFr; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45662-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45662-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXyUa+q4g9S9ZAC6WufsHmAki2Dbjf5VHjFmfCe8Iqu8ibBD2cY0O6ZQaQGBt+wOrzpe+dnpXv8eyDuSEpdiwainoI/Zw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h64-20020a636c43000000b005d553239b1asi8216566pgc.535.2024.01.30.18.27.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:27:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45662-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c+JT9BFr; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45662-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45662-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A703728E389 for ; Wed, 31 Jan 2024 02:24:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CCE0E544; Wed, 31 Jan 2024 02:18:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="c+JT9BFr" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 EF1961FA1; Wed, 31 Jan 2024 02:18:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667532; cv=none; b=FDrFZTP2x6dK2Q+kBPterafeKpwfHi69yGY9OjMfZiDGou+MTT2wxBWyfq0qhds+btdEEumnWMbe+G6Zb7qef1F/korVn8pz1PtEDG3/m6L079gFOPBwA9eOlXD2sWVBC+j/QyPf+8QRVOd1O7FArVXl5NP9Nl4XMyh1fJR3h0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667532; c=relaxed/simple; bh=vVb6RIIvOt4enB6/MzuWcA6dkAPHXShQ2Vxb7to1nk8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fpq5EE1+7gF2tglGVmgST1Zl+/rEUXH8B9TPiseQKZ6TGAaBB19MGuoNfBKTN9/z+QwPyoeQ0d4VmquZHXegsq6nY4EZ6t1WhhGUlKDnCCdX0XIodE28/Q4Jziyg1CbKifwT6lDMsc/RT1ejsHjyTjSlHvU02w3X5ZNJAxq6bm8= 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=c+JT9BFr; arc=none smtp.client-ip=192.198.163.7 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706667530; x=1738203530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vVb6RIIvOt4enB6/MzuWcA6dkAPHXShQ2Vxb7to1nk8=; b=c+JT9BFrlYhYTn4TBb/f5zXZo1yTFyR3qoIN6jw7BatTkPRW/VrnDze6 RkgGTTiFlgRFqmGjQEDbdjRwQcPX8+SDDY7ynKSavq0pjyCiy9UvORqoE AWnMnlxeOeOKreQ+xUYd/j3CYupCET5kiJ5Fsbpm1sT+lv8ocL2iNUAc2 Fcw4DrGALZwT+0qx7gV2NQ/q02E50eqYhxvBSy6NMUbH5TcyLT2syjrvg 9XQfmB7BTRmZBipZlBqfan4b6aZ7aevCxrPFE00HYrB+Wf13kyL7+m1yf TZTpYNd2nyv8Q1GvF6PlOxtCy7zCiw9hpiIseeJfH/uApcyV0xsumx/Ik Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="24939042" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="24939042" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:18:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="907714702" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="907714702" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:18:41 -0800 From: Haibo Xu To: Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, sunilvl@ventanamicro.com, Haibo Xu , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Robert Moore , Conor Dooley , Guo Ren , Anup Patel , Alexandre Ghiti , Greentime Hu , Jisheng Zhang , Sami Tolvanen , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Baoquan He , Greg Kroah-Hartman , Chen Jiahao , Arnd Bergmann , James Morse , Evan Green , Samuel Holland , Marc Zyngier , Tony Luck , Ard Biesheuvel , Yuntao Wang , Dave Hansen , Alison Schofield , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Subject: [PATCH 1/4] ACPICA: SRAT: Add RISC-V RINTC affinity structure Date: Wed, 31 Jan 2024 10:31:58 +0800 Message-Id: <6473e0bb42524e4f29112290a92539d1a800eb69.1706603678.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789571145358535586 X-GMAIL-MSGID: 1789571145358535586 ACPICA commit 93caddbf2f620769052c59ec471f018281dc3a24 Add definition of RISC-V Interrupt Controller(RINTC) affinity structure which was approved by UEFI forum and will be part of next ACPI spec version(6.6). Link: https://github.com/acpica/acpica/commit/93caddbf Signed-off-by: Haibo Xu --- include/acpi/actbl3.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index c080d579a546..5202e3fc9b41 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h @@ -192,7 +192,8 @@ enum acpi_srat_type { ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4, /* ACPI 6.2 */ ACPI_SRAT_TYPE_GENERIC_AFFINITY = 5, /* ACPI 6.3 */ ACPI_SRAT_TYPE_GENERIC_PORT_AFFINITY = 6, /* ACPI 6.4 */ - ACPI_SRAT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ + ACPI_SRAT_TYPE_RINTC_AFFINITY = 7, /* ACPI 6.6 */ + ACPI_SRAT_TYPE_RESERVED = 8 /* 8 and greater are reserved */ }; /* @@ -296,6 +297,21 @@ struct acpi_srat_generic_affinity { #define ACPI_SRAT_GENERIC_AFFINITY_ENABLED (1) /* 00: Use affinity structure */ #define ACPI_SRAT_ARCHITECTURAL_TRANSACTIONS (1<<1) /* ACPI 6.4 */ +/* 7: RINTC Affinity (ACPI 6.6) */ + +struct acpi_srat_rintc_affinity { + struct acpi_subtable_header header; + u16 reserved; /* Reserved, must be zero */ + u32 proximity_domain; + u32 acpi_processor_uid; + u32 flags; + u32 clock_domain; +}; + +/* Flags for struct acpi_srat_rintc_affinity */ + +#define ACPI_SRAT_RINTC_ENABLED (1) /* 00: Use affinity structure */ + /******************************************************************************* * * STAO - Status Override Table (_STA override) - ACPI 6.0 From patchwork Wed Jan 31 02:31:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Xu X-Patchwork-Id: 194446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1627712dyb; Tue, 30 Jan 2024 18:25:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEK9PMgV5cP2SWRcEsL9P51R+65PTEfw+B/FIKM2qWGnCjms5XFb9mE+exYbGXXR7ehEcFS X-Received: by 2002:ad4:5d6f:0:b0:684:e4e3:3a49 with SMTP id fn15-20020ad45d6f000000b00684e4e33a49mr387652qvb.48.1706667902084; Tue, 30 Jan 2024 18:25:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706667902; cv=pass; d=google.com; s=arc-20160816; b=Xho8INiO7lORdvVhpMMsavcYJcbezaeHDaEEje1QOUK33IkcCECdbMa37NhRJDpidg t98PR9D92ZwA4AdffT89AkIcCiqMSmG3hptv9yubxz79mlovVY0UppKJXqaYTgjZlO1v Y+nDibdHa7ZVnfcWztMm1nrbV1mrzdqBAZ4apBSKgQM5hvIDanind+lazMiA7rNsKNHo rK9mHVOfmF65Ls0N1KPJU+JbP1QmdkwKOQTSbbRh7MRZbh5lNPeFf2WPQcXzPc5fulwo nzHiQqITbfzFouuZv/LvmFRkKy4Q2BmuDsn8a1MuEpR3OJdcQPjLUUlamCSFWdpya+Gh 0v1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GxMPdz2fWmQz0LEfzZItEmMCJkLB5Ba4ZYrhl8UAxh4=; fh=oRVb5a/N8pBiQWwrjppCgx3NaMeOAkWlyoQ5xXHdlZg=; b=Oj7eD4YUh7U6EHDUTIKIJO0RHcoexsawaQ+oYwXDUiWicSeJ3E1gCYvat5ePnsj8MX WV0bzQlcQi2fT9J1HFi6r08T/FPzXWCRP3EniWNWBieARbZrdziH2dOnvcIQDdILXs2d Knq/0ulAn60N1wUuaVLAF+wNBc8b1AARGl+j8eQ1dnbKLI5ENthm/5Ydyv+VagMz87g4 NIanVuQsaOF/61BkYdYZYL36GwxyIPzv7eX8P462IWI+dGf976eaNNkkPZj9hRaDuIJd iJY2GyBW5X0SB1LNe4M+tP2uqvnm+LU/oVWkdJ7ZmLLk9NGkw1R3lmM3z+7AypvWUn9t 8b4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Bky9jtv1; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45663-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45663-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXxDjBQ2A5TXcORssdeVCuDHaQoYSHpGWZLZ6o1TO5bAidkYDDyEfcSZ1eAYWP8mnKxtY/rfsdEe48nabm4SymQSDBPLQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iv14-20020ad45cee000000b00681993f0261si11446720qvb.391.2024.01.30.18.25.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:25:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45663-ouuuleilei=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=@intel.com header.s=Intel header.b=Bky9jtv1; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45663-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45663-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 DC25F1C27D9C for ; Wed, 31 Jan 2024 02:25:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C013D125B9; Wed, 31 Jan 2024 02:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Bky9jtv1" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 6599CFBE7; Wed, 31 Jan 2024 02:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667549; cv=none; b=hwjS6dHOXHwz2ntDDT9TKsFj6Dy99mqzd3uT+QFW/LO54jRONuYyLVMuYAnmj4W4eQgVXpE0mPYdzVbdc50fy6T4So7hhsLd4Kol5tqIZhYg1PAxbW4vxb2yfxLvt0zWPNVaJ6JQLEdfUnMwgkPDeLuAw3EWc/TzbfP67EIiBPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667549; c=relaxed/simple; bh=EazMTTYX9oeR/uhQC7ENeexop7S60anC75kEcPjLk3Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QRlHFImZmwG4Mz3li7x4FxYVz0PLReapV15ZazSPnIaKRoDn33httJ7f9rwiVRYT8JdR1Prr4WBqou00qc2UVj8oW7IKXt0V7IbjzXs2jM6gNwmLgUHmSd65ZeM2qDRc60Q+bXAkv0ena5H3kxbThI1ckHle5SV/V620uBfxpG4= 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=Bky9jtv1; arc=none smtp.client-ip=192.198.163.7 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706667547; x=1738203547; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EazMTTYX9oeR/uhQC7ENeexop7S60anC75kEcPjLk3Y=; b=Bky9jtv1AmGnEyLuST7iUPm66tWCHVgLTmBmJ/2GNDFZNRdmDWmk4Mz7 Tm0tF6d4Ud8gS0k+mjha5BeRWmMPLMi4RsvgN7arXDcia0PfUo4dAvFq8 e9uNu/jUlFYVRDsyMIOz0Uh8hAJ0gOxpj9OcJbFHQOsMVEhMGFDTa+bm8 CjWU/82fsxz80z/VvOvlJpcSf9zcQvCJoTLgE4qhogq8jGGyQnbyl+Rx5 wBR959dZwA5DgbM2cZDW+xSf5zGn3fa98HthE+k/MIk6kp/+VPSa4xWD7 nWIFSZPtvJCxX0jmTwSQOIMksi/0NHwhjJxx69/k2AtVqjl3FBQafxuwZ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="24939137" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="24939137" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:19:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="907714731" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="907714731" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:18:59 -0800 From: Haibo Xu To: Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, sunilvl@ventanamicro.com, Haibo Xu , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Robert Moore , Conor Dooley , Guo Ren , Anup Patel , Alexandre Ghiti , Greentime Hu , Baoquan He , Jisheng Zhang , Sami Tolvanen , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Greg Kroah-Hartman , Arnd Bergmann , Chen Jiahao , James Morse , Evan Green , Samuel Holland , Ard Biesheuvel , Tony Luck , Yuntao Wang , Alison Schofield , Dave Hansen , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Subject: [PATCH 2/4] ACPI: NUMA: Add handler for SRAT RINTC affinity structure Date: Wed, 31 Jan 2024 10:31:59 +0800 Message-Id: X-Mailer: git-send-email 2.34.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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789571002222139152 X-GMAIL-MSGID: 1789571002222139152 Add RINTC affinity structure handler during parsing SRAT table. The ARCH specific implementation will be added in next patch. Signed-off-by: Haibo Xu --- drivers/acpi/numa/srat.c | 32 +++++++++++++++++++++++++++++++- include/linux/acpi.h | 3 +++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 0214518fc582..503abcf6125d 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -165,6 +165,19 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) } } break; + + case ACPI_SRAT_TYPE_RINTC_AFFINITY: + { + struct acpi_srat_rintc_affinity *p = + (struct acpi_srat_rintc_affinity *)header; + pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", + p->acpi_processor_uid, + p->proximity_domain, + (p->flags & ACPI_SRAT_RINTC_ENABLED) ? + "enabled" : "disabled"); + } + break; + default: pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", header->type); @@ -448,6 +461,21 @@ acpi_parse_gi_affinity(union acpi_subtable_headers *header, } #endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */ +static int __init +acpi_parse_rintc_affinity(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_srat_rintc_affinity *rintc_affinity; + + rintc_affinity = (struct acpi_srat_rintc_affinity *)header; + acpi_table_print_srat_entry(&header->common); + + /* let architecture-dependent part to do it */ + acpi_numa_rintc_affinity_init(rintc_affinity); + + return 0; +} + static int __initdata parsed_numa_memblks; static int __init @@ -501,7 +529,7 @@ int __init acpi_numa_init(void) /* SRAT: System Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { - struct acpi_subtable_proc srat_proc[4]; + struct acpi_subtable_proc srat_proc[5]; memset(srat_proc, 0, sizeof(srat_proc)); srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; @@ -512,6 +540,8 @@ int __init acpi_numa_init(void) srat_proc[2].handler = acpi_parse_gicc_affinity; srat_proc[3].id = ACPI_SRAT_TYPE_GENERIC_AFFINITY; srat_proc[3].handler = acpi_parse_gi_affinity; + srat_proc[4].id = ACPI_SRAT_TYPE_RINTC_AFFINITY; + srat_proc[4].handler = acpi_parse_rintc_affinity; acpi_table_parse_entries_array(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), diff --git a/include/linux/acpi.h b/include/linux/acpi.h index b7165e52b3c6..a65273db55c6 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -269,6 +269,9 @@ acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); +static inline void +acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) { } + #ifndef PHYS_CPUID_INVALID typedef u32 phys_cpuid_t; #define PHYS_CPUID_INVALID (phys_cpuid_t)(-1) From patchwork Wed Jan 31 02:32:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Xu X-Patchwork-Id: 194453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1628552dyb; Tue, 30 Jan 2024 18:27:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsuwzFBCUkAnij8Og3Mnvfbi61q+5AXzCEFVjvFJ8n/R1LeutHl5SXOpw2ZipwHUiL4PYl X-Received: by 2002:a05:6a20:8484:b0:19b:62da:16b0 with SMTP id u4-20020a056a20848400b0019b62da16b0mr280031pzd.5.1706668067788; Tue, 30 Jan 2024 18:27:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706668067; cv=pass; d=google.com; s=arc-20160816; b=W5oSKG/39VS4wxoVwHU4WRZEPilD2WqEzCgeJ33MphNdyi7tpaZP14q+eI2o1J/5Bj SReyAiOgGcv1Iu2tOY1NWS3NLTPzP0GbSKgyHEmCQDpd1GB3TjCqjleveE6kudMX5bcB VXJ511GPd9FQsfwt/4k67eFe8HDyNL1r42Y5af9m3yVhY2/SIWOFLJS1CXCsPGLFZ+CG ZWn1fFkpy2psUlqqbMh/ADxhX5c/ZbzRvaoeL++s6U8vZvyeijahA3bGMoO5Nvs2yA+V hI3cdSEAgx98FYUmcxvXA7dgiDuuCusbYkcQ+pjLB+maZlOrUbCsZXV0XQanu6Olp3EJ lDIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OK0zewl3DbC1/7W8+J7eUTSIzdHrmPnM+WEB5xya9zQ=; fh=02OL2Kaob2Zc4LRk/eP08H9UHv8hHHx0nLGhcYSdOQ8=; b=viDPMcE5pg75bEhoUAWyF0Ohk7FxoM58A5cIk87nZ6HPxjGw1bbjBY+lXeXE9wlLd2 mErGG7XImrU26MagUI8ID3mOqtOaME00ZxSS91MUyA5oEyNayLsPXPS9Zp16Js2fTrUQ ZF2olwyF/1pWn6lVHsKq0H7x7t7fkZ6qPntpISSymhEAfHtPYZ8WsdKUC41oafKfKFRj IX3k0sz++dcbARmNvwtQ59WUX/CJj/lKLH0lAuYv+8DNAcOWx7S/XvdKUN+v1tLXTbG5 ByP2XzoW4S/MyRHU2Lysb53Psw3bij/+9gh3JCjTesfI5dOP3yU1lSS00oT++cp+hXIs vHaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HLIX9Apc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWwhOjtkOEprq91bGFlr32CUM7jAp9x3nrNXuBCfwbBv/Rw9YtFRZbOxLx98Q2DrvJdb7aVRBtJoVngFglekspNreMaZg== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h5-20020a170902f54500b001d785435c3bsi8672323plf.603.2024.01.30.18.27.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:27:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HLIX9Apc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45664-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45664-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4BD0A28EB5E for ; Wed, 31 Jan 2024 02:25:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0009817C80; Wed, 31 Jan 2024 02:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HLIX9Apc" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 28B2418AFB; Wed, 31 Jan 2024 02:19:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667567; cv=none; b=Ik5/Em6J9FL0+K84n7GoauM7/sVdDiDvS1UA9xNjBaaNKX9hYQt1qqT/1O15ASqhoaU5fDiW2pNNOtsh+0wbFzIimmOunupSfOnCdnG11kOd9EoZLE0ALWCVej5YEBVEztaVycuGWx0kqFe+n128nUHOJMsVQs26VQ8aGZdip7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667567; c=relaxed/simple; bh=yF0cmRPYM74Wroboq1Me4P8QG6U65gjWBJJ6qce166E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pka4vzOAqSk65SEz0++tJr3nHr5nJdRThrS8V85P2doYjdifKJqxIpPl6aaDEyn+zf+nxz9+qCBIBQvhMlW6OAc+lFxhdD0tuSmswCOJSTWjc94cudNDg1aZSPHuMkr2iKZ7fzMPFmfL/iyILbPBMOzV7wi8+Ga6lgz5OOBJ6AY= 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=HLIX9Apc; arc=none smtp.client-ip=192.198.163.7 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706667565; x=1738203565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yF0cmRPYM74Wroboq1Me4P8QG6U65gjWBJJ6qce166E=; b=HLIX9Apc1fylpMaVTVbTPVGRzc2bUQbTUv3y0z7ThzvMRIgvxy032zHP sG0yS28H1yNw4CDlz3Y80Lv5GRtMPX3tuWFdfIGSLANr80br8yespqGak LsII6a5sn3KqypX8A/xsb7g5NL2TvOu8wtKYPO/hcfumfL7KwML957wIx 7lMmy8kpOs3kEzxSsEuFYjvtLhzmkFQMkgKrfrG/vzVrXs0Co7NpZ3PCi pT4Zf54wYaQ/MiMOi/2CMR5/CslRaKVueyGhpaTRS0FzBjbnSgPWXVDJ+ gDZ16+ea65pBFGdacmEaD4oRM7XeCM31L77zmHEPEFMcE86CeLm4b4p69 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="24939189" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="24939189" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:19:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="907714749" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="907714749" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:19:16 -0800 From: Haibo Xu To: Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, sunilvl@ventanamicro.com, Haibo Xu , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Robert Moore , Conor Dooley , Guo Ren , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Alexandre Ghiti , Greentime Hu , Baoquan He , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Sami Tolvanen , Jisheng Zhang , Greg Kroah-Hartman , Arnd Bergmann , Chen Jiahao , James Morse , Evan Green , Samuel Holland , Anup Patel , Ard Biesheuvel , Tony Luck , Yuntao Wang , Dan Williams , Alison Schofield , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Subject: [PATCH 3/4] ACPI: RISCV: Add NUMA support based on SRAT and SLIT Date: Wed, 31 Jan 2024 10:32:00 +0800 Message-Id: <799dcc07f41c2357328e9778fbbded7818af34a7.1706603678.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789571175874327679 X-GMAIL-MSGID: 1789571175874327679 Add acpi_numa.c file to enable parse NUMA information from ACPI SRAT and SLIT tables. SRAT table provide CPUs(Hart) and memory nodes to proximity domain mapping, while SLIT table provide the distance metrics between proximity domains. Signed-off-by: Haibo Xu --- arch/riscv/include/asm/acpi.h | 15 +++- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/acpi.c | 5 -- arch/riscv/kernel/acpi_numa.c | 133 ++++++++++++++++++++++++++++++++++ arch/riscv/kernel/setup.c | 4 +- arch/riscv/kernel/smpboot.c | 2 - drivers/acpi/numa/srat.c | 3 +- include/linux/acpi.h | 4 + 8 files changed, 156 insertions(+), 11 deletions(-) create mode 100644 arch/riscv/kernel/acpi_numa.c diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 7dad0cf9d701..e0a1f84404f3 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -61,11 +61,14 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } void acpi_init_rintc_map(void); struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); -u32 get_acpi_id_for_cpu(int cpu); +static inline u32 get_acpi_id_for_cpu(int cpu) +{ + return acpi_cpu_get_madt_rintc(cpu)->uid; +} + int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa); -static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } void acpi_get_cbo_block_size(struct acpi_table_header *table, u32 *cbom_size, u32 *cboz_size, u32 *cbop_size); #else @@ -87,4 +90,12 @@ static inline void acpi_get_cbo_block_size(struct acpi_table_header *table, #endif /* CONFIG_ACPI */ +#ifdef CONFIG_ACPI_NUMA +int acpi_numa_get_nid(unsigned int cpu); +void acpi_map_cpus_to_nodes(void); +#else +static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } +static inline void acpi_map_cpus_to_nodes(void) { } +#endif /* CONFIG_ACPI_NUMA */ + #endif /*_ASM_ACPI_H*/ diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile index f71910718053..5d3e9cf89b76 100644 --- a/arch/riscv/kernel/Makefile +++ b/arch/riscv/kernel/Makefile @@ -105,3 +105,4 @@ obj-$(CONFIG_COMPAT) += compat_vdso/ obj-$(CONFIG_64BIT) += pi/ obj-$(CONFIG_ACPI) += acpi.o +obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index e619edc8b0cc..040bdbfea2b4 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -191,11 +191,6 @@ struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) return &cpu_madt_rintc[cpu]; } -u32 get_acpi_id_for_cpu(int cpu) -{ - return acpi_cpu_get_madt_rintc(cpu)->uid; -} - /* * __acpi_map_table() will be called before paging_init(), so early_ioremap() * or early_memremap() should be called here to for ACPI table mapping. diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c new file mode 100644 index 000000000000..493642a61457 --- /dev/null +++ b/arch/riscv/kernel/acpi_numa.c @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ACPI 6.6 based NUMA setup for RISCV + * Lots of code was borrowed from arch/arm64/kernel/acpi_numa.c + * + * Copyright 2004 Andi Kleen, SuSE Labs. + * Copyright (C) 2013-2016, Linaro Ltd. + * Author: Hanjun Guo + * Copyright (C) 2024 Intel Corporation. + * + * Reads the ACPI SRAT table to figure out what memory belongs to which CPUs. + * + * Called from acpi_numa_init while reading the SRAT and SLIT tables. + * Assumes all memory regions belonging to a single proximity domain + * are in one chunk. Holes between them will be included in the node. + */ + +#define pr_fmt(fmt) "ACPI: NUMA: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE }; + +int __init acpi_numa_get_nid(unsigned int cpu) +{ + return acpi_early_node_map[cpu]; +} + +static inline int get_cpu_for_acpi_id(u32 uid) +{ + int cpu; + + for (cpu = 0; cpu < nr_cpu_ids; cpu++) + if (uid == get_acpi_id_for_cpu(cpu)) + return cpu; + + return -EINVAL; +} + +static int __init acpi_parse_rintc_pxm(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_srat_rintc_affinity *pa; + int cpu, pxm, node; + + if (srat_disabled()) + return -EINVAL; + + pa = (struct acpi_srat_rintc_affinity *)header; + if (!pa) + return -EINVAL; + + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) + return 0; + + pxm = pa->proximity_domain; + node = pxm_to_node(pxm); + + /* + * If we can't map the UID to a logical cpu this + * means that the UID is not part of possible cpus + * so we do not need a NUMA mapping for it, skip + * the SRAT entry and keep parsing. + */ + cpu = get_cpu_for_acpi_id(pa->acpi_processor_uid); + if (cpu < 0) + return 0; + + acpi_early_node_map[cpu] = node; + pr_info("SRAT: PXM %d -> HARTID 0x%lx -> Node %d\n", pxm, + cpuid_to_hartid_map(cpu), node); + + return 0; +} + +void __init acpi_map_cpus_to_nodes(void) +{ + int i; + + /* + * In ACPI, SMP and CPU NUMA information is provided in separate + * static tables, namely the MADT and the SRAT. + * + * Thus, it is simpler to first create the cpu logical map through + * an MADT walk and then map the logical cpus to their node ids + * as separate steps. + */ + acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), + ACPI_SRAT_TYPE_RINTC_AFFINITY, + acpi_parse_rintc_pxm, 0); + + for (i = 0; i < nr_cpu_ids; i++) + early_map_cpu_to_node(i, acpi_numa_get_nid(i)); +} + +/* Callback for Proximity Domain -> logical node ID mapping */ +void __init acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) +{ + int pxm, node; + + if (srat_disabled()) + return; + + if (pa->header.length < sizeof(struct acpi_srat_rintc_affinity)) { + pr_err("SRAT: Invalid SRAT header length: %d\n", + pa->header.length); + bad_srat(); + return; + } + + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) + return; + + pxm = pa->proximity_domain; + node = acpi_map_pxm_to_node(pxm); + + if (node == NUMA_NO_NODE) { + pr_err("SRAT: Too many proximity domains %d\n", pxm); + bad_srat(); + return; + } + + node_set(node, numa_nodes_parsed); +} diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 4f73c0ae44b2..a2cde65b69e9 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -281,8 +281,10 @@ void __init setup_arch(char **cmdline_p) setup_smp(); #endif - if (!acpi_disabled) + if (!acpi_disabled) { acpi_init_rintc_map(); + acpi_map_cpus_to_nodes(); + } riscv_init_cbo_blocksizes(); riscv_fill_hwcap(); diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 519b6bd946e5..b188d83d1ec4 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -101,7 +101,6 @@ static int __init acpi_parse_rintc(union acpi_subtable_headers *header, const un if (hart == cpuid_to_hartid_map(0)) { BUG_ON(found_boot_cpu); found_boot_cpu = true; - early_map_cpu_to_node(0, acpi_numa_get_nid(cpu_count)); return 0; } @@ -111,7 +110,6 @@ static int __init acpi_parse_rintc(union acpi_subtable_headers *header, const un } cpuid_to_hartid_map(cpu_count) = hart; - early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count)); cpu_count++; return 0; diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 503abcf6125d..1f0462cef47c 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -219,7 +219,8 @@ int __init srat_disabled(void) return acpi_numa < 0; } -#if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH) +#if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH) || \ + defined(CONFIG_RISCV) /* * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for * I/O localities since SRAT does not list them. I/O localities are diff --git a/include/linux/acpi.h b/include/linux/acpi.h index a65273db55c6..be78a9d28927 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -269,8 +269,12 @@ acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); +#ifdef CONFIG_RISCV +void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa); +#else static inline void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) { } +#endif #ifndef PHYS_CPUID_INVALID typedef u32 phys_cpuid_t; From patchwork Wed Jan 31 02:32:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haibo Xu X-Patchwork-Id: 194447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1627904dyb; Tue, 30 Jan 2024 18:25:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRRcB8Ks2Z5lqNy5e6lorIwbq+ljnodbX2TeyYyxmB9QtNJjURA3NMcLg5xUgsfDMPli4H X-Received: by 2002:a05:620a:843:b0:783:7588:6506 with SMTP id u3-20020a05620a084300b0078375886506mr3214719qku.25.1706667933083; Tue, 30 Jan 2024 18:25:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706667933; cv=pass; d=google.com; s=arc-20160816; b=Q9r+BZLs4ZSdWQ28ZkpgllpFKdXsR1Mdjg/nx74uMuK9OcTTGhhJPDjH3u3kfpLILb MzgSQXMvH/61cf5H8adoyFYUJKu8FPVSJWRo6kKBw1L+xtE1f7916e1/dSinqymhSi++ J7/pIP6g/jza2+u1D71tjGV11wfbEAcdlhvwB3sn6dcVP0j7d1IcpiMUGonFY0fCnJU3 gFvZdz/gKhf2zbvwAW8VH2Qt47mv135l2+rczi+z18x8H96xtYajJPZo2L2fSmffLXcw W+3EOLtyCkF+pY7RgxjxX54pXmoakxuZAM/tRsQI0wMT+AxenyiMtH5rgL9azy3JfSXs 99hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3kjEN+FYXAjE+i8iMJFvbk/gilHM9LnxaRWdMdL3t2k=; fh=bGiroAvZX5+GBL86elKxMqcnzOsxtOaRA8fLgsaxpxU=; b=bWXmiFcs63dRf76l43rRdpnnEZ9XX+wOamU2ZafZgt8auaBG4DoioG88yE6jMkexQ+ FeTHaDjHj5Dm1SRyXNTpdg5vukXc7X/OPR/J8mDgcPMvpdz0xFjyW9JcfqvOpAZVZ2jw FCT8B/O53wpb3sPdJ8bR6V2Z2znq1fjFv6wUwDrbP5XOdsfjLkoHwpxvvOZE0v1ipfDo E2146kXrPIAjQ6CRiFuPrlG3Q7ZVwp7DUXFbrjsGp4iIshsnvtUbq8ubbglpdWFBGD85 sBwnE9owry+kj0tpKvQzlYgLYLCJ5zkiT5CqO6VVWo5k6iuQdknVnWo8TTQx1Hcaz8Y0 qhTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=icImzQlZ; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45665-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45665-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCUtBkndVJ9RbymjWDG04LjOiuZog+UmvdaM+zRttLXiMUjjL5Cb1I6teix4auJpYOWM4Y/YV9ZQhwXZf09ZPz7McOg5NA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b23-20020a05620a0f9700b007840798bb28si3495874qkn.240.2024.01.30.18.25.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 18:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45665-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=icImzQlZ; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-45665-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45665-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 BCB2D1C20BA5 for ; Wed, 31 Jan 2024 02:25:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2344A20DED; Wed, 31 Jan 2024 02:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="icImzQlZ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 E0C7620DE3; Wed, 31 Jan 2024 02:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667584; cv=none; b=YXjIKHkLcYUPAMgVKyIhRc+26WDhwI25Ch9qfb1SKNrSK+9kFYYhzlhPTGXCGcE/z9GeY7eg79xNnvWau68rAH2nnmaZuQmJZYPqfEE5wjdS7nxgwX6iTo2DSdjphTrC+4UCD5Cidcf4HrN6M/fYevUFq5p1Ab+6OrsxrNOigzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706667584; c=relaxed/simple; bh=DiVbdcfk8LX+ol56FVokjIK00/hL0BAvFjQKr27Ubus=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RIVDgCuszfLFYngmSH4DzWKO5hL3ffsCBU3HNNWTZnmIrK4zszauSA//hAZimFVW8RuoD4FIDj8lAHfgpDLQNKiO80KEEm5Dm6r9FktAy8ltE7ugsh5zkqDl5jE3PO/KGnyJXpBO0ohEyWiNpmpPkWlqY95fuDOK1wX1bOJcuyQ= 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=icImzQlZ; arc=none smtp.client-ip=192.198.163.7 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706667583; x=1738203583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DiVbdcfk8LX+ol56FVokjIK00/hL0BAvFjQKr27Ubus=; b=icImzQlZdau0hJenETKLQXFl18VO/Fe1XIvk8VEbkP9lw3QAvDemsrMG NWWnHvnQ639Zlrc5sIQqwhGvENLjToTfiKktds65zITan2402h37rz+b2 kA0FKWYTqYeHUjsdQ1hxe4SC166J8Jmkg9TSTbV00hiA8h43mFt09EAJ6 UKIDArshA3SR3DQW9Kiu9hLh95F1w0ln8HZHCcN2vzfjC0bdcyNQOJEdB yJqdsc0wUMbs935Tf6fEEsrdjahqcAtwZ6F4fwvK5Jh6pLLvPlqyHCAL3 Xz5nA3V7Dqm4u0ak6mQ6gl6wNKJlDiL7TF2Bpx6Q7uZS5ivWOPXjfgX+G A==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="24939230" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="24939230" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:19:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="907714867" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="907714867" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 18:19:34 -0800 From: Haibo Xu To: Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, sunilvl@ventanamicro.com, Haibo Xu , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Robert Moore , Conor Dooley , Guo Ren , Anup Patel , Alexandre Ghiti , Greentime Hu , Sami Tolvanen , Jisheng Zhang , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Baoquan He , Greg Kroah-Hartman , Chen Jiahao , Arnd Bergmann , James Morse , "Russell King (Oracle)" , Evan Green , Samuel Holland , Ard Biesheuvel , Tony Luck , Yuntao Wang , Dave Hansen , Dan Williams , Alison Schofield , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev Subject: [PATCH 4/4] ACPI: RISCV: Enable ACPI based NUMA Date: Wed, 31 Jan 2024 10:32:01 +0800 Message-Id: <0be49d4d7d7e43933534aad6f72b35d3380519fd.1706603678.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789571034234873994 X-GMAIL-MSGID: 1789571034234873994 Enable ACPI based NUMA for RISCV in Kconfig. Signed-off-by: Haibo Xu --- arch/riscv/Kconfig | 1 + drivers/acpi/numa/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index bffbd869a068..e586ab959f34 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -438,6 +438,7 @@ config NUMA select HAVE_SETUP_PER_CPU_AREA select NEED_PER_CPU_EMBED_FIRST_CHUNK select NEED_PER_CPU_PAGE_FIRST_CHUNK + select ACPI_NUMA if ACPI select OF_NUMA select USE_PERCPU_NUMA_NODE_ID help diff --git a/drivers/acpi/numa/Kconfig b/drivers/acpi/numa/Kconfig index 849c2bd820b9..525297c44250 100644 --- a/drivers/acpi/numa/Kconfig +++ b/drivers/acpi/numa/Kconfig @@ -2,7 +2,7 @@ config ACPI_NUMA bool "NUMA support" depends on NUMA - depends on (X86 || ARM64 || LOONGARCH) + depends on (X86 || ARM64 || LOONGARCH || RISCV) default y if ARM64 config ACPI_HMAT