linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au
Cc: seroyer@linux.vnet.ibm.com, jjalvare@linux.vnet.ibm.com,
	alex.williamson@redhat.com, helgaas@kernel.org, aik@ozlabs.ru,
	ruscur@russell.cc, linux-pci@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, bodong@mellanox.com,
	eli@mellanox.com, saeedm@mellanox.com,
	"Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
Subject: [PATCH v4 5/7] powerpc/kernel: Add EEH notify resume sysfs
Date: Fri,  5 Jan 2018 10:45:50 -0600	[thread overview]
Message-ID: <20180105164552.36371-6-bryantly@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180105164552.36371-1-bryantly@linux.vnet.ibm.com>

Introduce a method for notify resume to be
called from sysfs. In this patch one can
now call notify resume from sysfs when
is supported by platform.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Juan J. Alvarez <jjalvare@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/eeh_sysfs.c | 45 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/arch/powerpc/kernel/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c
index 797549289798..9c513abc102c 100644
--- a/arch/powerpc/kernel/eeh_sysfs.c
+++ b/arch/powerpc/kernel/eeh_sysfs.c
@@ -90,6 +90,38 @@ static ssize_t eeh_pe_state_store(struct device *dev,
 
 static DEVICE_ATTR_RW(eeh_pe_state);
 
+#ifdef CONFIG_PCI_IOV
+static ssize_t eeh_notify_resume_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
+	struct pci_dn *pdn = pci_get_pdn(pdev);
+
+	if (!edev || !edev->pe)
+		return -ENODEV;
+
+	pdn = pci_get_pdn(pdev);
+	return sprintf(buf, "%d\n", pdn->last_allow_rc);
+}
+
+static ssize_t eeh_notify_resume_store(struct device *dev,
+				       struct device_attribute *attr,
+				       const char *buf, size_t count)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
+
+	if (!edev || !edev->pe)
+		return -ENODEV;
+
+	if (eeh_ops->notify_resume(pci_get_pdn(pdev)))
+		return -EIO;
+	return count;
+}
+static DEVICE_ATTR_RW(eeh_notify_resume);
+#endif
+
 void eeh_sysfs_add_device(struct pci_dev *pdev)
 {
 	struct eeh_dev *edev = pci_dev_to_eeh_dev(pdev);
@@ -105,6 +137,13 @@ void eeh_sysfs_add_device(struct pci_dev *pdev)
 	rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
 	rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_state);
 
+#ifdef CONFIG_PCI_IOV
+	if (of_get_property(pci_device_to_OF_node
+			    ((pdev->is_physfn ? pdev : pdev->physfn)),
+			    "ibm,is-open-sriov-pf", NULL))
+		rc += device_create_file(&pdev->dev,
+					 &dev_attr_eeh_notify_resume);
+#endif
 	if (rc)
 		pr_warn("EEH: Unable to create sysfs entries\n");
 	else if (edev)
@@ -128,6 +167,12 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
 	device_remove_file(&pdev->dev, &dev_attr_eeh_mode);
 	device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
 	device_remove_file(&pdev->dev, &dev_attr_eeh_pe_state);
+#ifdef CONFIG_PCI_IOV
+	if (of_get_property(pci_device_to_OF_node
+			    ((pdev->is_physfn ? pdev : pdev->physfn)),
+			    "ibm,is-open-sriov-pf", NULL))
+		device_remove_file(&pdev->dev, &dev_attr_eeh_notify_resume);
+#endif
 
 	if (edev)
 		edev->mode &= ~EEH_DEV_SYSFS;
-- 
2.14.3 (Apple Git-98)

  parent reply	other threads:[~2018-01-05 16:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-05 16:45 [PATCH v4 0/7] SR-IOV Enablement on PowerVM Bryant G. Ly
2018-01-05 16:45 ` [PATCH v4 1/7] platform/pseries: Update VF config space after EEH Bryant G. Ly
2018-01-29  4:13   ` [v4,1/7] " Michael Ellerman
2018-01-05 16:45 ` [PATCH v4 2/7] linux/pci: Add uevents in AER and EEH error/resume Bryant G. Ly
2018-01-05 18:15   ` Bjorn Helgaas
2018-01-05 16:45 ` [PATCH v4 3/7] platforms/pseries: Set eeh_pe of EEH_PE_VF type Bryant G. Ly
2018-01-24  1:14   ` Michael Ellerman
2018-01-24 14:53     ` Bryant G. Ly
2018-01-05 16:45 ` [PATCH v4 4/7] powerpc/kernel Add EEH operations to notify resume Bryant G. Ly
2018-01-05 16:45 ` Bryant G. Ly [this message]
2018-01-05 16:45 ` [PATCH v4 6/7] pseries/pci: Associate PEs to VFs in configure SR-IOV Bryant G. Ly
2018-01-05 16:45 ` [PATCH v4 7/7] pseries/setup: Add Initialization of VF Bars Bryant G. Ly
2018-01-29  4:13   ` [v4,7/7] " Michael Ellerman
2018-01-17 17:29 ` [PATCH v4 0/7] SR-IOV Enablement on PowerVM Bryant G. Ly
2018-01-24  1:18 ` Russell Currey

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=20180105164552.36371-6-bryantly@linux.vnet.ibm.com \
    --to=bryantly@linux.vnet.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=bodong@mellanox.com \
    --cc=eli@mellanox.com \
    --cc=helgaas@kernel.org \
    --cc=jjalvare@linux.vnet.ibm.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=ruscur@russell.cc \
    --cc=saeedm@mellanox.com \
    --cc=seroyer@linux.vnet.ibm.com \
    /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).