From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrQ6n-0008UX-0F for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrQ6l-0008O2-I6 for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:55:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrQ6l-0008Nt-Av for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:55:15 -0400 Date: Thu, 11 Aug 2011 10:55:55 +0300 From: "Michael S. Tsirkin" Message-ID: <20110811075554.GA16791@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] pcie/slot: fix hotplug event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org On Fri, Aug 05, 2011 at 06:22:03PM +0900, Isaku Yamahata wrote: > When slot status register is cleared, PCIDevice::exp.hpev_notify > needs to be cleared. > Otherwise, PCIDevice::exp.hpev_notify is never set to false resulting > in no more hot plug event once it's raised. > > Signed-off-by: Isaku Yamahata Thanks, applied. > --- > hw/pcie.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/hw/pcie.c b/hw/pcie.c > index 39607bf..5c9eb2f 100644 > --- a/hw/pcie.c > +++ b/hw/pcie.c > @@ -175,6 +175,14 @@ static void hotplug_event_notify(PCIDevice *dev) > } > } > > +static void hotplug_event_clear(PCIDevice *dev) > +{ > + hotplug_event_update_event_status(dev); > + if (!msix_enabled(dev) && !msi_enabled(dev) && !dev->exp.hpev_notified) { > + qemu_set_irq(dev->irq[dev->exp.hpev_intx], 0); > + } > +} > + > /* > * A PCI Express Hot-Plug Event has occurred, so update slot status register > * and notify OS of the event if necessary. > @@ -320,6 +328,10 @@ void pcie_cap_slot_write_config(PCIDevice *dev, > uint8_t *exp_cap = dev->config + pos; > uint16_t sltsta = pci_get_word(exp_cap + PCI_EXP_SLTSTA); > > + if (ranges_overlap(addr, len, pos + PCI_EXP_SLTSTA, 2)) { > + hotplug_event_clear(dev); > + } > + > if (!ranges_overlap(addr, len, pos + PCI_EXP_SLTCTL, 2)) { > return; > } > -- > 1.7.1.1