Linux can't recognise device's MSI/MISX capability after a
load-reload operation on kernel module due to the fact that the Linux
sets PCI device's power state to `PCI_D0` and the device cannot
automatically wakeup itself when module reinitialize it.
In this patch, we add this `PCI_CAP_ID_PM` here to device's PCI
capabilities table to fix this problem.
Signed-off-by: d0u9 <d0u9.su@outlook.com>
---
hw/misc/edu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index e935c418d4..7ce32a0f0b 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -365,6 +365,9 @@ static void pci_edu_realize(PCIDevice *pdev, Error **errp)
uint8_t *pci_conf = pdev->config;
pci_config_set_interrupt_pin(pci_conf, 1);
+ if (pci_add_capability(pdev, PCI_CAP_ID_PM, 0, PCI_PM_SIZEOF, errp) < 0) {
+ return;
+ }
if (msi_init(pdev, 0, 1, true, false, errp)) {
return;
--
2.24.2 (Apple Git-127)