qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pcie/slot: fix hotplug event
Date: Thu, 11 Aug 2011 10:55:55 +0300	[thread overview]
Message-ID: <20110811075554.GA16791@redhat.com> (raw)
In-Reply-To: <c7ce40597d537fd052af00b13f29a985dd305c9a.1312536046.git.yamahata@valinux.co.jp>

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 <yamahata@valinux.co.jp>

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

      reply	other threads:[~2011-08-11  7:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05  9:22 [Qemu-devel] [PATCH] pcie/slot: fix hotplug event Isaku Yamahata
2011-08-11  7:55 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110811075554.GA16791@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).