qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it
@ 2014-05-07  6:51 Liu Ping Fan
  2014-05-07  7:20 ` Alexey Kardashevskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Ping Fan @ 2014-05-07  6:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, Alexander Graf

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 <pingfank@linux.vnet.ibm.com>
---
 hw/ppc/spapr_pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index cbef095..7b1dfe1 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -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);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it
  2014-05-07  6:51 [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it Liu Ping Fan
@ 2014-05-07  7:20 ` Alexey Kardashevskiy
  2014-05-09  7:04   ` liu ping fan
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2014-05-07  7:20 UTC (permalink / raw)
  To: Liu Ping Fan, qemu-devel; +Cc: Alexander Graf

On 05/07/2014 04:51 PM, Liu Ping Fan wrote:
> 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 <pingfank@linux.vnet.ibm.com>
> ---
>  hw/ppc/spapr_pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index cbef095..7b1dfe1 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -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 :)


-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it
  2014-05-07  7:20 ` Alexey Kardashevskiy
@ 2014-05-09  7:04   ` liu ping fan
  2014-05-09  8:44     ` Alexey Kardashevskiy
  0 siblings, 1 reply; 4+ messages in thread
From: liu ping fan @ 2014-05-09  7:04 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-devel, Alexander Graf

On Wed, May 7, 2014 at 3:20 PM, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> On 05/07/2014 04:51 PM, Liu Ping Fan wrote:
>> 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 <pingfank@linux.vnet.ibm.com>
>> ---
>>  hw/ppc/spapr_pci.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
>> index cbef095..7b1dfe1 100644
>> --- a/hw/ppc/spapr_pci.c
>> +++ b/hw/ppc/spapr_pci.c
>> @@ -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 :)
>
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


>
> --
> Alexey
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it
  2014-05-09  7:04   ` liu ping fan
@ 2014-05-09  8:44     ` Alexey Kardashevskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2014-05-09  8:44 UTC (permalink / raw)
  To: liu ping fan; +Cc: qemu-devel, Alexander Graf

On 05/09/2014 05:04 PM, liu ping fan wrote:
> On Wed, May 7, 2014 at 3:20 PM, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
>> On 05/07/2014 04:51 PM, Liu Ping Fan wrote:
>>> 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 <pingfank@linux.vnet.ibm.com>
>>> ---
>>>  hw/ppc/spapr_pci.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
>>> index cbef095..7b1dfe1 100644
>>> --- a/hw/ppc/spapr_pci.c
>>> +++ b/hw/ppc/spapr_pci.c
>>> @@ -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 :)
>>
> 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.


-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-09  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07  6:51 [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it Liu Ping Fan
2014-05-07  7:20 ` Alexey Kardashevskiy
2014-05-09  7:04   ` liu ping fan
2014-05-09  8:44     ` Alexey Kardashevskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).