Re: [PATCH] x86: Avoid divide by 0 in amd_smn_init()

From: Jason Andryuk

Date: Wed Jun 24 2026 - 12:49:00 EST


On 2026-06-24 11:59, Borislav Petkov wrote:
+ Andy

On Wed, Jun 24, 2026 at 11:41:16AM -0400, Jason Andryuk wrote:
I have wip s0ix support with Xen where dom0 issues the amd-pmc calls to
enter s0ix. I'm not sure of all the uses of SMN, but with Xen dom0/hardware
domain running most drivers, I think it should be available.

Well, how should we make it available if dom0 doesn't really allow us to
enumerate PCI roots and thus count AMD nodes?

dom0 enumerates the physical PCI roots. It's just the dom0 vCPUs and topology are synthetic.

Andy, see upthread.

What would you suggest we do here on dom0? We're trying to enumerate AMD
nodes but dom0 is doing something special wrt topology and PCI roots - see
get_next_root() in amd_node.c.

Thx.


I think this is the issue:

The "root" device search was introduced to support SMN access for Zen
systems. This device represents a PCIe root complex. It is not the
same as the "CPU/node" devices found at slots 0x18-0x1F.

We don't want dom0 to access the "CPU/node" devices. It's the "root" device SMN access I am trying to retain. Many amd_smn_read/write calls have hardcoded node 0, like for amd-pmc.

Regards,
Jason