This avoids having to extract these MSI capabilities from hardware in
the hypervisor.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
.bdf = 0x8,
.caps_start = 1,
.num_caps = 4,
.bdf = 0x8,
.caps_start = 1,
.num_caps = 4,
},
/* PCIDevice: 00:02.0 */
{
},
/* PCIDevice: 00:02.0 */
{
.bdf = 0x10,
.caps_start = 5,
.num_caps = 3,
.bdf = 0x10,
.caps_start = 5,
.num_caps = 3,
},
/* PCIDevice: 00:03.0 */
{
},
/* PCIDevice: 00:03.0 */
{
.bdf = 0x18,
.caps_start = 8,
.num_caps = 3,
.bdf = 0x18,
.caps_start = 8,
.num_caps = 3,
},
/* PCIDevice: 00:14.0 */
{
},
/* PCIDevice: 00:14.0 */
{
.bdf = 0xa0,
.caps_start = 11,
.num_caps = 2,
.bdf = 0xa0,
.caps_start = 11,
.num_caps = 2,
+ .num_msi_vectors = 8,
+ .msi_64bits = 1,
},
/* PCIDevice: 00:16.0 */
{
},
/* PCIDevice: 00:16.0 */
{
.bdf = 0xb0,
.caps_start = 13,
.num_caps = 2,
.bdf = 0xb0,
.caps_start = 13,
.num_caps = 2,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
},
/* PCIDevice: 00:19.0 */
{
},
/* PCIDevice: 00:19.0 */
{
.bdf = 0xc8,
.caps_start = 15,
.num_caps = 3,
.bdf = 0xc8,
.caps_start = 15,
.num_caps = 3,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
},
/* PCIDevice: 00:1a.0 */
{
},
/* PCIDevice: 00:1a.0 */
{
.bdf = 0xd8,
.caps_start = 21,
.num_caps = 3,
.bdf = 0xd8,
.caps_start = 21,
.num_caps = 3,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
},
/* PCIDevice: 00:1d.0 */
{
},
/* PCIDevice: 00:1d.0 */
{
.bdf = 0xfa,
.caps_start = 24,
.num_caps = 3,
.bdf = 0xfa,
.caps_start = 24,
.num_caps = 3,
},
/* PCIDevice: 00:1f.3 */
{
},
/* PCIDevice: 00:1f.3 */
{
.bdf = 0x00d8,
.caps_start = 0,
.num_caps = 1,
.bdf = 0x00d8,
.caps_start = 0,
.num_caps = 1,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
.bdf = 0x00fa,
.caps_start = 2,
.num_caps = 2,
.bdf = 0x00fa,
.caps_start = 2,
.num_caps = 2,
+ .num_msi_vectors = 1,
+ .msi_64bits = 1,
},
{ /* SMBus */
.type = JAILHOUSE_PCI_TYPE_DEVICE,
},
{ /* SMBus */
.type = JAILHOUSE_PCI_TYPE_DEVICE,
__u16 bdf;
__u16 caps_start;
__u16 num_caps;
__u16 bdf;
__u16 caps_start;
__u16 num_caps;
+ __u8 num_msi_vectors;
+ __u8 msi_64bits;
+ __u16 padding;
} __attribute__((packed));
#define JAILHOUSE_PCICAPS_WRITE 0x0001
} __attribute__((packed));
#define JAILHOUSE_PCICAPS_WRITE 0x0001
- def __init__(self, id, start, len, flags):
+ def __init__(self, id, start, len, flags, content):
self.id = id
self.start = start
self.len = len
self.flags = flags
self.id = id
self.start = start
self.len = len
self.flags = flags
self.comments = []
def __eq__(self, other):
self.comments = []
def __eq__(self, other):
# unknown/unhandled cap, mark its existence
len = 2
flags = PCICapability.RD
# unknown/unhandled cap, mark its existence
len = 2
flags = PCICapability.RD
- caps.append(PCICapability(id, cap, len, flags))
+ f.seek(cap + 2)
+ content = f.read(len - 2)
+ caps.append(PCICapability(id, cap, len, flags, content))
self.caps = caps
self.caps_start = 0
self.num_caps = len(caps)
self.caps = caps
self.caps_start = 0
self.num_caps = len(caps)
+ self.num_msi_vectors = 0
+ self.msi_64bits = 0
+ for c in caps:
+ if c.id in (0x05, 0x11):
+ msg_ctrl = struct.unpack('<H', c.content[:2])[0]
+ if c.id == 0x05: # MSI
+ self.num_msi_vectors = 1 << ((msg_ctrl >> 1) & 0x7)
+ self.msi_64bits = (msg_ctrl >> 7) & 1
def __str__(self):
return 'PCIDevice: %02x:%02x.%x' % (self.bus, self.dev, self.fn)
def __str__(self):
return 'PCIDevice: %02x:%02x.%x' % (self.bus, self.dev, self.fn)
.bdf = ${hex(d.bdf())},
.caps_start = ${d.caps_start},
.num_caps = ${d.num_caps},
.bdf = ${hex(d.bdf())},
.caps_start = ${d.caps_start},
.num_caps = ${d.num_caps},
+ .num_msi_vectors = ${d.num_msi_vectors},
+ .msi_64bits = ${d.msi_64bits},