From patchwork Tue Jun 25 05:55:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 254029 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id B24E62C05A6 for ; Tue, 25 Jun 2013 15:57:08 +1000 (EST) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com [32.97.182.139]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e9.ny.us.ibm.com", Issuer "GeoTrust SSL CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 3DC912C0090 for ; Tue, 25 Jun 2013 15:55:28 +1000 (EST) Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Jun 2013 01:55:26 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 25 Jun 2013 01:55:25 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 7FEF438C8047 for ; Tue, 25 Jun 2013 01:55:23 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5P5tOMH266982 for ; Tue, 25 Jun 2013 01:55:24 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5P5tN6Q021390 for ; Tue, 25 Jun 2013 01:55:24 -0400 Received: from shangw (shangw.cn.ibm.com [9.125.213.109]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id r5P5tLf9021329; Tue, 25 Jun 2013 01:55:22 -0400 Received: by shangw (Postfix, from userid 1000) id CCA9C301A6C; Tue, 25 Jun 2013 13:55:20 +0800 (CST) From: Gavin Shan To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 04/10] powerpc/eeh: Backends to get/set settings Date: Tue, 25 Jun 2013 13:55:11 +0800 Message-Id: <1372139717-14885-5-git-send-email-shangw@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1372139717-14885-1-git-send-email-shangw@linux.vnet.ibm.com> References: <1372139717-14885-1-git-send-email-shangw@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13062505-7182-0000-0000-00000781DAEC Cc: Gavin Shan X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- 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 };