From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whw9l-0005uH-UM for qemu-devel@nongnu.org; Wed, 07 May 2014 03:20:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Whw9a-0000eA-LL for qemu-devel@nongnu.org; Wed, 07 May 2014 03:20:45 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:58089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Whw9a-0000dU-7b for qemu-devel@nongnu.org; Wed, 07 May 2014 03:20:34 -0400 Received: by mail-pa0-f53.google.com with SMTP id kp14so765536pab.26 for ; Wed, 07 May 2014 00:20:32 -0700 (PDT) Message-ID: <5369DEBD.40306@ozlabs.ru> Date: Wed, 07 May 2014 17:20:29 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1399445471-23682-1-git-send-email-pingfank@linux.vnet.ibm.com> In-Reply-To: <1399445471-23682-1-git-send-email-pingfank@linux.vnet.ibm.com> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spapr: pci: clean msi info when releasing it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan , qemu-devel@nongnu.org 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 > --- > 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