linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [PATCH 04/10] powerpc/eeh: Backends to get/set settings
Date: Tue, 25 Jun 2013 13:55:11 +0800	[thread overview]
Message-ID: <1372139717-14885-5-git-send-email-shangw@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372139717-14885-1-git-send-email-shangw@linux.vnet.ibm.com>

When the PHB gets fenced, 0xFF's returns from PCI config space and
MMIO space in the hardware. The operations writting to them should
be dropped. The patch introduce backends allow to set/get flags that
indicate the access to PCI-CFG and MMIO should be blocked.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/eeh.h               |    6 +++
 arch/powerpc/platforms/pseries/eeh_pseries.c |   44 ++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index dd65e31..de821c1 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -131,6 +131,10 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
 #define EEH_LOG_TEMP		1	/* EEH temporary error log	*/
 #define EEH_LOG_PERM		2	/* EEH permanent error log	*/
 
+/* Settings for platforms */
+#define EEH_SETTING_BLOCK_CFG	1	/* Blocked PCI config access	*/
+#define EEH_SETTING_BLOCK_IO	2	/* Blocked MMIO access		*/
+
 struct eeh_ops {
 	char *name;
 	int (*init)(void);
@@ -146,6 +150,8 @@ struct eeh_ops {
 	int (*configure_bridge)(struct eeh_pe *pe);
 	int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
 	int (*write_config)(struct device_node *dn, int where, int size, u32 val);
+	int (*get_setting)(int option, int *value, void *data);
+	int (*set_setting)(int option, int value, void *data);
 	int (*next_error)(struct eeh_pe **pe);
 };
 
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 62415f2..8c9509b 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -612,6 +612,48 @@ static int pseries_eeh_write_config(struct device_node *dn, int where, int size,
 	return rtas_write_config(pdn, where, size, val);
 }
 
+/**
+ * pseries_eeh_get_setting - Retrieve settings that affect EEH core
+ * @option: option
+ * @value: value
+ * @data: dependent data
+ *
+ * Retrieve the settings from the platform in order to affect the
+ * behaviour of EEH core. We don't block PCI config or MMIO access
+ * on pSeries platform.
+ */
+static int pseries_eeh_get_setting(int option, int *value, void *data)
+{
+	int ret = 0;
+
+	switch (option) {
+	case EEH_SETTING_BLOCK_CFG:
+	case EEH_SETTING_BLOCK_IO:
+		*value = 0;
+		break;
+	default:
+		pr_warning("%s: Unrecognized option (%d)\n",
+			   __func__, option);
+		ret = -EINVAL;
+	}
+
+	return ret;
+}
+
+/**
+ * pseries_eeh_set_setting - Configure settings to affect EEH core
+ * @option: option
+ * @value: value
+ * @data: dependent data
+ *
+ * Configure the settings for the platform in order to affect the
+ * behaviour of EEH core.
+ */
+static int pseries_eeh_set_setting(int option, int value, void *data)
+{
+	return 0;
+}
+
 static struct eeh_ops pseries_eeh_ops = {
 	.name			= "pseries",
 	.init			= pseries_eeh_init,
@@ -626,6 +668,8 @@ static struct eeh_ops pseries_eeh_ops = {
 	.configure_bridge       = pseries_eeh_configure_bridge,
 	.read_config		= pseries_eeh_read_config,
 	.write_config		= pseries_eeh_write_config,
+	.get_setting		= pseries_eeh_get_setting,
+	.set_setting		= pseries_eeh_set_setting,
 	.next_error		= NULL
 };
 
-- 
1.7.5.4

  parent reply	other threads:[~2013-06-25  5:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25  5:55 [PATCH v1 00/10] powerpc/eeh: Remove eeh_mutex Gavin Shan
2013-06-25  5:55 ` [PATCH 01/10] " Gavin Shan
2013-06-25  5:55 ` [PATCH 02/10] powerpc/eeh: Don't collect PCI-CFG data on PHB Gavin Shan
2013-06-25  5:55 ` [PATCH 03/10] powerpc/eeh: Check PCIe link after reset Gavin Shan
2013-06-25  6:06   ` Benjamin Herrenschmidt
2013-06-25  7:47     ` Gavin Shan
2013-06-25  7:57       ` Benjamin Herrenschmidt
2013-06-25  8:04         ` Gavin Shan
2013-06-25  5:55 ` Gavin Shan [this message]
2013-06-25  6:07   ` [PATCH 04/10] powerpc/eeh: Backends to get/set settings Benjamin Herrenschmidt
2013-06-25  7:12     ` Gavin Shan
2013-06-25  5:55 ` [PATCH 05/10] powerpc/powernv: Support set/get EEH settings Gavin Shan
2013-06-25  5:55 ` [PATCH 06/10] powerpc/eeh: Support blocked IO access Gavin Shan
2013-06-25  5:55 ` [PATCH 07/10] powerpc/powernv: Block PCI-CFG access if necessary Gavin Shan
2013-06-25  5:55 ` [PATCH 08/10] powerpc/powernv: Hold PCI-CFG and I/O access Gavin Shan
2013-06-25  5:55 ` [PATCH 09/10] powerpc/eeh: Fix address catch for PowerNV Gavin Shan
2013-06-25  5:55 ` [PATCH 10/10] net/tg3: Avoid delay during MMIO access Gavin Shan
2013-06-25  6:15   ` Benjamin Herrenschmidt

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=1372139717-14885-5-git-send-email-shangw@linux.vnet.ibm.com \
    --to=shangw@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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).