From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, bhelgaas@google.com, mpe@ellerman.id.au
Subject: Re: [PATCH v2 5/5] drivers/pci/hotplug: Support surprise hotplug in powernv driver
Date: Wed, 28 Sep 2016 14:33:40 +1000 [thread overview]
Message-ID: <20160928043340.GA18600@gwshan> (raw)
In-Reply-To: <1474894567-15229-6-git-send-email-gwshan@linux.vnet.ibm.com>
On Mon, Sep 26, 2016 at 10:56:07PM +1000, Gavin Shan wrote:
>This supports PCI surprise hotplug. The design is highlighted as
>below:
>
> * The PCI slot's surprise hotplug capability is exposed through
> device node property "ibm,slot-surprise-pluggable", meaning
> PCI surprise hotplug will be disabled if skiboot doesn't support
> it yet.
> * The interrupt because of presence or link state change is raised
> on surprise hotplug event. One event is allocated and queued to
> the PCI slot for workqueue to pick it up and process in serialized
> fashion. The code flow for surprise hotplug is same to that for
> managed hotplug except: the affected PEs are put into frozen state
> to avoid unexpected EEH error reporting in surprise hot remove path.
>
>Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>---
.../...
>+static irqreturn_t pnv_php_interrupt(int irq, void *data)
>+{
>+ struct pnv_php_slot *php_slot = data;
>+ struct pci_dev *pchild, *pdev = php_slot->pdev;
>+ struct eeh_dev *edev;
>+ struct eeh_pe *pe;
>+ struct pnv_php_event *event;
>+ u16 sts, lsts;
>+ u8 presence;
>+ bool added;
>+ unsigned long flags;
>+ int ret;
>+
>+ pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &sts);
>+ sts &= (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC);
>+ pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, sts);
>+ if (sts & PCI_EXP_SLTSTA_DLLSC) {
>+ pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &lsts);
>+ added = !!(lsts & PCI_EXP_LNKSTA_DLLLA);
>+ } else if (sts & PCI_EXP_SLTSTA_PDC) {
>+ ret = pnv_pci_get_presence_state(php_slot->id, &presence);
>+ if (!ret)
>+ return IRQ_HANDLED;
>+ added = !!(presence == OPAL_PCI_SLOT_PRESENT);
>+ } else {
>+ return IRQ_NONE;
>+ }
>+
>+ /* Freeze the removed PE to avoid unexpected error reporting */
>+ if (!added) {
>+ pchild = list_first_entry_or_null(&php_slot->bus->devices,
>+ struct pci_dev, bus_list);
>+ edev = pchild ? pci_dev_to_eeh_dev(pchild) : NULL;
>+ pe = edev ? edev->pe : NULL;
>+ if (pe) {
>+ eeh_serialize_lock(&flags);
>+ eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
>+ eeh_serialize_unlock(flags);
>+ eeh_pe_set_option(pe, EEH_OPT_FREEZE_PE);
>+ }
>+ }
>+
I still need export @confirm_error_lock. Otherwise, it will be failed to be
built when having CONFIG_HOTPLUG_PCI_POWERNV=m. I will respin and add one
patch for that in v3.
Thanks,
Gavin
prev parent reply other threads:[~2016-09-28 4:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 12:56 [PATCH v2 0/5] powerpc/powernv: PCI Surprise Hotplug Support Gavin Shan
2016-09-26 12:56 ` [PATCH v2 1/5] powerpc/eeh: Allow to freeze PE in eeh_pe_set_option() Gavin Shan
2016-09-26 12:56 ` [PATCH v2 2/5] powerpc/eeh: Export eeh_pe_state_mark() Gavin Shan
2016-09-26 12:56 ` [PATCH v2 3/5] powerpc/powernv: Unfreeze PE on allocation Gavin Shan
2016-09-26 12:56 ` [PATCH v2 4/5] drivers/pci/hotplug: Remove likely() and unlikely() in powernv driver Gavin Shan
2016-09-26 12:56 ` [PATCH v2 5/5] drivers/pci/hotplug: Support surprise hotplug " Gavin Shan
2016-09-28 4:33 ` Gavin Shan [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=20160928043340.GA18600@gwshan \
--to=gwshan@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).