From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 B434C383C81 for ; Thu, 2 Apr 2026 23:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775173864; cv=none; b=uI7PL5c18YXzAc96ewhPfYX7cvLuR8twuY3g2Q8MswDte/j1Nq430pMedxAFHE4Bnpy8PA/BLki93rinxTr+iABnPshKuuwvzfAi3jZTczPp6kMHFaP1BetzYRyiO9vSEb8zhwD6y50Au+PYaw2Rx5zXgcX+22foYUE8kQ53XcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775173864; c=relaxed/simple; bh=2kAutj4g13DMwd72j/3f7uAiNWyzdgxKfNTpf3tf768=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g08M7bNDlswT5Wg0BjqR0aUABTvy1K7iMCEM4IW1XwynkABs0xkFDOTfwZgpCqzbjI3ZZZT0CjqDA9P/3Q82YYOXlTchF449WvaVHyR+0H78zaDBHZRXJNWqoekFEbrjmf78Ptrbe1TvESFZcevItU3nO9G1kLIwMQdJ4kZpjic= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=H8Jjypql; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="H8Jjypql" Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id B336A40E015B; Thu, 2 Apr 2026 23:51:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qbhCf9v4hWpX; Thu, 2 Apr 2026 23:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1775173854; bh=v+EW6sVKK0p+VDKqw76JRdsoSIhelmNSmSagIvQlpZE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H8JjypqluizpPIzJKdNYFfGaQFkWYg/rBy9GPwVIcl1ilAiszT/RCSxSAL+Mb/pC/ 8JLZOr2gaw9lYsGnG+cuUbxUvr2SKvh47It5jub84AhuIGWtoEsImkAjyWC4AythvI cqfGpB7Zu32cWMDOURoLUgLs7U8Pc6ycYDCIHbOiaTPNghMSYHGo4EVQu87mohT2kw hTgLeMcI4QTYFygzchdC7TLMyVf9UgVYKd90wFbc0t0nSYHL8F5HbTLYv2GzLHJ+6s qrCZvmfotTiHZhqiVmuqadacLnmESkMtWRld9mGh+R7KtWvD/Yi1GShiq87N3giOez +5P+7GtdySI63rLa5iUdxVrkW89cWalW35QSQPGbnfUt1UgsVPGcWisW0ql3U42rY9 k5VWvQoLTy3TJnr+lB7k+MCRA6nzwVIskDHvk+b5m6F6F7JOr2wZh4ShLw5pq5z1RG j1e5E1TcwyAIuPfNuwcUAYpCB2CKcIiq7ZLO5gdthY95H2SPafGo+OCOgRhGNOwnML XDZHfasOQ244QIgcZQU4lcjSnM5VhI9KXyRwsPucdKyDdma+m4zdi5gg9R+lanxni1 iAuRriRWISA7jNlQdT8xMkxNrdA8FxcjfGm5ES17FpWqcdJO2+o3I7aW7ufLfGWSFl QPDJRfRE1Jg0QU7B/BfqQu1A= Received: from zn.tnic (p5de8e020.dip0.t-ipconnect.de [93.232.224.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with UTF8SMTPSA id 11C1540E0031; Thu, 2 Apr 2026 23:50:47 +0000 (UTC) Date: Fri, 3 Apr 2026 01:50:36 +0200 From: Borislav Petkov To: Lin Wang Cc: yazen.ghannam@amd.com, mario.limonciello@amd.com, tglx@kernel.org, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 5/5] x86/amd_node: Support Hygon SMN roots by socket Message-ID: <20260402235036.GDac8AzDPVVq-tBeG-@fat_crate.local> References: <20260402111515.1155505-1-wanglin@open-hieco.net> <20260402111515.1155505-6-wanglin@open-hieco.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260402111515.1155505-6-wanglin@open-hieco.net> On Thu, Apr 02, 2026 at 07:15:11PM +0800, Lin Wang wrote: > SMN root devices (PCI class 0x0600, vendor 0x1d94) are already > enumerated by get_next_root(), which already matches the Hygon vendor > ID. The difference from AMD is root-to-node assignment: > > AMD: one root per node (roots_per_node grouping) > Hygon: one root per socket, shared across all nodes on that socket > > Extend amd_smn_init() with a Hygon branch that: > - uses hygon_node_num() and hygon_socket_num() to determine the node > and socket counts from the hygon_node cache > - groups the discovered roots by socket (roots_per_socket) > - expands them to per-node entries in amd_roots[] using > hygon_node_socket() > > Introduce smn_num_nodes to hold the per-vendor node count, so that > __amd_smn_rw() and the debugfs bounds check work correctly for both > AMD and Hygon system layouts. > > AMD behavior is unchanged. > > Signed-off-by: Lin Wang > --- > arch/x86/kernel/amd_node.c | 122 +++++++++++++++++++++++++++++++------ > 1 file changed, 102 insertions(+), 20 deletions(-) All Hygon enablement goes into Hygon-specific files. If there's a piece of functionality which is generic enough, then that can be extracted into a function which can be called by both vendors code. But pls forget this piggy-backing on AMD code and thus turning AMD code into an unmaintainable mess. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette