提交 8a5ad356 编写于 作者: G Gavin Shan 提交者: Benjamin Herrenschmidt

powerpc/eeh: Cleanup EEH subsystem variables

There're 2 EEH subsystem variables: eeh_subsystem_enabled and
eeh_probe_mode. We needn't maintain 2 variables and we can just
have one variable and introduce different flags. The patch also
introduces additional flag EEH_FORCE_DISABLE, which will be used
to disable EEH subsystem via boot parameter ("eeh=off") in future.
Besides, the patch also introduces flag EEH_ENABLED, which is
changed to disable or enable EEH functionality on the fly through
debugfs entry in future.

With the patch applied, the creteria to check the enabled EEH
functionality is changed to:

!EEH_FORCE_DISABLED && EEH_ENABLED : Enabled
                       Other cases : Disabled
Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 2a18dfc6
......@@ -32,6 +32,12 @@ struct device_node;
#ifdef CONFIG_EEH
/* EEH subsystem flags */
#define EEH_ENABLED 0x1 /* EEH enabled */
#define EEH_FORCE_DISABLED 0x2 /* EEH disabled */
#define EEH_PROBE_MODE_DEV 0x4 /* From PCI device */
#define EEH_PROBE_MODE_DEVTREE 0x8 /* From device tree */
/*
* The struct is used to trace PE related EEH functionality.
* In theory, there will have one instance of the struct to
......@@ -173,37 +179,40 @@ struct eeh_ops {
int (*restore_config)(struct device_node *dn);
};
extern int eeh_subsystem_flags;
extern struct eeh_ops *eeh_ops;
extern bool eeh_subsystem_enabled;
extern raw_spinlock_t confirm_error_lock;
extern int eeh_probe_mode;
static inline bool eeh_enabled(void)
{
return eeh_subsystem_enabled;
if ((eeh_subsystem_flags & EEH_FORCE_DISABLED) ||
!(eeh_subsystem_flags & EEH_ENABLED))
return false;
return true;
}
static inline void eeh_set_enable(bool mode)
{
eeh_subsystem_enabled = mode;
if (mode)
eeh_subsystem_flags |= EEH_ENABLED;
else
eeh_subsystem_flags &= ~EEH_ENABLED;
}
#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */
static inline void eeh_probe_mode_set(int flag)
{
eeh_probe_mode = flag;
eeh_subsystem_flags |= flag;
}
static inline int eeh_probe_mode_devtree(void)
{
return (eeh_probe_mode == EEH_PROBE_MODE_DEVTREE);
return (eeh_subsystem_flags & EEH_PROBE_MODE_DEVTREE);
}
static inline int eeh_probe_mode_dev(void)
{
return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV);
}
static inline void eeh_serialize_lock(unsigned long *flags)
......
......@@ -87,22 +87,21 @@
/* Time to wait for a PCI slot to report status, in milliseconds */
#define PCI_BUS_RESET_WAIT_MSEC (5*60*1000)
/* Platform dependent EEH operations */
struct eeh_ops *eeh_ops = NULL;
bool eeh_subsystem_enabled = false;
EXPORT_SYMBOL(eeh_subsystem_enabled);
/*
* EEH probe mode support. The intention is to support multiple
* platforms for EEH. Some platforms like pSeries do PCI emunation
* based on device tree. However, other platforms like powernv probe
* PCI devices from hardware. The flag is used to distinguish that.
* In addition, struct eeh_ops::probe would be invoked for particular
* OF node or PCI device so that the corresponding PE would be created
* there.
* EEH probe mode support, which is part of the flags,
* is to support multiple platforms for EEH. Some platforms
* like pSeries do PCI emunation based on device tree.
* However, other platforms like powernv probe PCI devices
* from hardware. The flag is used to distinguish that.
* In addition, struct eeh_ops::probe would be invoked for
* particular OF node or PCI device so that the corresponding
* PE would be created there.
*/
int eeh_probe_mode;
int eeh_subsystem_flags;
EXPORT_SYMBOL(eeh_subsystem_flags);
/* Platform dependent EEH operations */
struct eeh_ops *eeh_ops = NULL;
/* Lock to avoid races due to multiple reports of an error */
DEFINE_RAW_SPINLOCK(confirm_error_lock);
......@@ -842,8 +841,8 @@ int eeh_init(void)
&hose_list, list_node)
pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL);
} else {
pr_warning("%s: Invalid probe mode %d\n",
__func__, eeh_probe_mode);
pr_warn("%s: Invalid probe mode %x",
__func__, eeh_subsystem_flags);
return -EINVAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册