spapr: pci: clean msi info when releasing it
PATCH 1/1 spapr: pci: clean msi info when releasing it
In current code, we use phb->msi_table[ndev].nvec to indicate whether this msi entries are used by a device or not. So when unplug a pci device, we should reset nvec to zero.
--- hw/ppc/spapr_pci.c | 1 + 1 file changed, 1 insertion(+)
hw/ppc/spapr_pci.c +1 -0
@@ -316,6 +316,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; } + phb->msi_table[ndev].nvec =0 ;trace_spapr_pci_msi ("Released MSIs" , ndev, config_addr);rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 ,0 );
Signature · 1 line
1.8.1.4
Quoted 14 lines · Liu Ping Fan
In current code, we use phb->msi_table[ndev].nvec to indicate whether this msi entries are used by a device or not. So when unplug a pci device, we should reset nvec to zero.
Signed-off-by Liu Ping Fan <[email protected]>--- hw/ppc/spapr_pci.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr_pci.c +0
-0
hw/ppc/spapr_pci.c static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr, · line 322
Quoted 7 lines
hw/ppc/spapr_pci.c +1
-0@@ -316,6 +316,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; } + phb->msi_table[ndev].nvec =0 ;trace_spapr_pci_msi ("Released MSIs" , ndev, config_addr);rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 ,0 );
ibm,change-msi is called with 0 to disable MSIs. If later the guest decides to reenable MSI on the same device (rmmod + modprobe in the guest can do that I suppose), new block will be allocated because of this patch which is bad.
And there is no PCI hotplug for SPAPR in upstream QEMU so this patch cannot possibly fix it :)
Signature · 1 line
Alexey
Quoted 29 lines · Alexey Kardashevskiy
Quoted 14 lines · Liu Ping Fan
In current code, we use phb->msi_table[ndev].nvec to indicate whether this msi entries are used by a device or not. So when unplug a pci device, we should reset nvec to zero.
Signed-off-by Liu Ping Fan <[email protected]>--- hw/ppc/spapr_pci.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr_pci.c +0
-0hw/ppc/spapr_pci.c static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr, · line 322
Quoted 7 lines
hw/ppc/spapr_pci.c +1
-0@@ -316,6 +316,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; } + phb->msi_table[ndev].nvec =0 ;trace_spapr_pci_msi ("Released MSIs" , ndev, config_addr);rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 ,0 );ibm,change-msi is called with 0 to disable MSIs. If later the guest decides to reenable MSI on the same device (rmmod + modprobe in the guest can do that I suppose), new block will be allocated because of this patch which is bad.
Quoted 3 lines
And there is no PCI hotplug for SPAPR in upstream QEMU so this patch cannot possibly fix it :)
I saw your patch [PATCH 0/6] move interrupts from spapr to xics. And it is great to consider the reclaim of irq. So if I call something to free the irq after "phb->msi_table[ndev].nvec = 0", can it work ?
Thx,
Fan
Quoted 4 lines
--
Alexey
Quoted 30 lines · liu ping fan
Quoted 29 lines · Alexey Kardashevskiy
Quoted 14 lines · Liu Ping Fan
In current code, we use phb->msi_table[ndev].nvec to indicate whether this msi entries are used by a device or not. So when unplug a pci device, we should reset nvec to zero.
Signed-off-by Liu Ping Fan <[email protected]>--- hw/ppc/spapr_pci.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr_pci.c +0
-0hw/ppc/spapr_pci.c static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr, · line 322
Quoted 7 lines
hw/ppc/spapr_pci.c +1
-0@@ -316,6 +316,7 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,rtas_st (rets,0 ,RTAS_OUT_HW_ERROR );return ; } + phb->msi_table[ndev].nvec =0 ;trace_spapr_pci_msi ("Released MSIs" , ndev, config_addr);rtas_st (rets,0 ,RTAS_OUT_SUCCESS );rtas_st (rets,1 ,0 );ibm,change-msi is called with 0 to disable MSIs. If later the guest decides to reenable MSI on the same device (rmmod + modprobe in the guest can do that I suppose), new block will be allocated because of this patch which is bad.
Quoted 6 lines
Quoted 3 lines
And there is no PCI hotplug for SPAPR in upstream QEMU so this patch cannot possibly fix it :)
I saw your patch [PATCH 0/6] move interrupts from spapr to xics. And it is great to consider the reclaim of irq. So if I call something to free the irq after "phb->msi_table[ndev].nvec = 0", can it work ?
Yes, then it should work but I am actually planning more than just that so we will see how it goes.
Signature · 1 line
Alexey