On 09/13/2018 01:18 PM, Michael S. Tsirkin wrote:
...>>
0x01 00a0 00 00 0000 48
Byte 0: 0x48 (special device)
Byte 1 & 2: must be zero
Byte 3: 0 (dte setting)
Byte 4: 0 (handle)
Byte 5 & 6: IOAPIC devfn (14:0.0)
Do you mean *bus* devfn? devfn is 0.0.
Sorry my bad, I was meaning to write devid and not devfn.
See,
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/amd_iommu_init.c#n2343
/* SB IOAPIC is always on this device in AMD systems */
#define IOAPIC_SB_DEVID ((0x00 << 8) | PCI_DEVFN(0x14, 0))
Byte 7: 0x1 (IOAPIC) - See Table 97 in spec
Above should go into code comment, along with
first (oldest) version of spec that has this table.
Additionally the number is IMHO more readable as:
(0x1ull << 56) | (PCI_BUILD_BDF(14, 0) << 40) | 0x48
(assuming I got what it should be).