[PATCH v7] x86/amd_node: Continue initialization even if SMN reservation fails

From: Ilan Bonneau-Zamon

Date: Wed Nov 25 2026 - 06:33:33 EST


Currently, if reserving PCI config regions fails for a node, amd_smn_init()
exits early. However, keeping successfully reserved regions active helps
prevent userspace from accessing those registers even if one node fails.

Change amd_smn_init() to attempt reserving regions for all nodes
unconditionally, logging a warning on failure instead of exiting.

Suggested-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
Signed-off-by: Ilan Bonneau-Zamon <ilan.bonneauzamon@xxxxxxxxx>
---
Changes in v7:
- Keep the diff minimal and focused only on changing the failure handling
from error/abort to a warning when reserving PCI config space.
- Drop unrelated comment, whitespace, and variable initialization changes.
---
arch/x86/kernel/amd_node.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/amd_node.c b/arch/x86/kernel/amd_node.c
index b7926ba3610a..4ddfbddbdbea 100644
--- a/arch/x86/kernel/amd_node.c
+++ b/arch/x86/kernel/amd_node.c
@@ -250,8 +250,8 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs);

static int __init amd_smn_init(void)
{
- u16 count, num_roots, roots_per_node, node, num_nodes;
- struct pci_dev *root __free(pci_dev_put) = NULL;
+ u16 count, num_roots = 0, roots_per_node, node, num_nodes;
+ struct pci_dev *root = NULL;

if (!cpu_feature_enabled(X86_FEATURE_ZEN))
return 0;
@@ -261,7 +261,6 @@ static int __init amd_smn_init(void)
if (amd_roots)
return 0;

- num_roots = 0;
while ((root = get_next_root(root))) {
pci_dbg(root, "Reserving PCI config space\n");

@@ -271,10 +270,8 @@ static int __init amd_smn_init(void)
* entire PCI config space for simplicity rather than covering
* specific registers piecemeal.
*/
- if (!pci_request_config_region_exclusive(root, 0, PCI_CFG_SPACE_SIZE, NULL)) {
- pci_err(root, "Failed to reserve config space\n");
- return -EEXIST;
- }
+ if (!pci_request_config_region_exclusive(root, 0, PCI_CFG_SPACE_SIZE, NULL))
+ pci_warn(root, "Failed to reserve config space\n");

num_roots++;
}
--
2.56.1