[linux-yocto] [PATCH 3/9] edac: Added fixes for smem edac driver
Daniel Dragomir
daniel.dragomir at windriver.com
Thu Mar 9 08:22:24 PST 2017
From: Marek Majtyka <marekx.majtyka at intel.com>
- Improved naming and code maintainability (defines).
- Fixed faulty error handling scenario (stopping workqueue).
Signed-off-by: Marek Majtyka <marekx.majtyka at intel.com>
---
drivers/edac/axxia_edac-mc_56xx.c | 53 +++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/drivers/edac/axxia_edac-mc_56xx.c b/drivers/edac/axxia_edac-mc_56xx.c
index 54dac0e..f850ebe 100644
--- a/drivers/edac/axxia_edac-mc_56xx.c
+++ b/drivers/edac/axxia_edac-mc_56xx.c
@@ -45,8 +45,8 @@
#define INTEL_EDAC_MOD_STR "axxia56xx_edac"
-#define APB2_SER3_PHY_ADDR 0x008002c00000ULL
-#define APB2_SER3_PHY_SIZE 110008
+#define AXI2_SER3_PHY_ADDR 0x008002c00000ULL
+#define AXI2_SER3_PHY_SIZE PAGE_SIZE
#define SM_MPR_PAGE 0x1
@@ -74,8 +74,7 @@
#define SM_56XX_DENALI_CTL_61 0xf4
#define SM_56XX_DENALI_CTL_62 0xf8
-/* TODO CHECK */
-#define APB2_PERSIST_SCRATCH 0xdc
+#define SYSCON_PERSIST_SCRATCH 0xdc
#define SMEM_PERSIST_SCRATCH_BIT (0x1 << 3)
#define IRQ_NAME_LEN 16
@@ -90,6 +89,7 @@
#define SM_INT_MASK_ALL_LOW (0xffffffff)
#define SM_INT_MASK_HIGH (0x1)
#define SM_INT_MASK_ALL_HIGH (0x7)
+#define ALIVE_NOTIFICATION_PERIOD (90*1000)
static int log = 1;
module_param(log, int, S_IRUGO|S_IWUSR);
@@ -603,7 +603,6 @@ struct mc_edac_data {
atomic_t dump_ready;
atomic_t event_ready;
atomic_t dump_in_progress;
-
};
struct intel_edac_dev_info {
@@ -617,7 +616,7 @@ struct intel_edac_dev_info {
int edac_idx;
u32 sm_region;
struct regmap *syscon;
- void __iomem *apb2ser3_region;
+ void __iomem *axi2ser3_region;
struct edac_device_ctl_info *edac_dev;
void (*check)(struct edac_device_ctl_info *edac_dev);
};
@@ -753,17 +752,17 @@ handle_events(struct intel_edac_dev_info *edac_dev,
if (force_restart && event_logging[i].fatal) {
if (IS_ERR(edac_dev->syscon)) {
set_val = readl(
- edac_dev->apb2ser3_region
- + APB2_PERSIST_SCRATCH);
+ edac_dev->axi2ser3_region
+ + SYSCON_PERSIST_SCRATCH);
/* set bit 3 in pscratch reg */
set_val = set_val
| SMEM_PERSIST_SCRATCH_BIT;
writel(set_val,
- edac_dev->apb2ser3_region +
- APB2_PERSIST_SCRATCH);
+ edac_dev->axi2ser3_region +
+ SYSCON_PERSIST_SCRATCH);
} else {
regmap_update_bits(edac_dev->syscon,
- APB2_PERSIST_SCRATCH,
+ SYSCON_PERSIST_SCRATCH,
SMEM_PERSIST_SCRATCH_BIT,
SMEM_PERSIST_SCRATCH_BIT);
}
@@ -993,7 +992,7 @@ start:
/* keep hung up monitor happy 90 sec's */
if (0 == wait_event_timeout(dev_info->data->dump_wq,
atomic_read(&dev_info->data->dump_in_progress),
- msecs_to_jiffies(90*1000)))
+ msecs_to_jiffies(ALIVE_NOTIFICATION_PERIOD)))
goto start;
/* the only one running workqueue */
@@ -1006,7 +1005,7 @@ start:
goto error_read;
/* bits [3:2] cs number */
- denali_ctl_57.read_mpr = 4*i + 1;
+ denali_ctl_57.read_mpr = 4*i + SM_MPR_PAGE;
if (ncr_write(dev_info->sm_region,
SM_56XX_DENALI_CTL_57,
4, (u32 *) &denali_ctl_57))
@@ -1024,7 +1023,7 @@ start:
atomic_set(&dev_info->data->dump_ready, 0);
/* collect data */
- collect_mpr_dump(dev_info, 1, i);
+ collect_mpr_dump(dev_info, SM_MPR_PAGE, i);
}
/* process all dumps - update counters */
@@ -1068,7 +1067,7 @@ static void intel_sm_events_error_check(struct edac_device_ctl_info *edac_dev)
while (1) {
if (0 == wait_event_timeout(dev_info->data->event_wq,
atomic_read(&dev_info->data->event_ready),
- msecs_to_jiffies(90*1000)))
+ msecs_to_jiffies(ALIVE_NOTIFICATION_PERIOD)))
continue;
atomic_set(&dev_info->data->event_ready, 0);
@@ -1185,7 +1184,6 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
if (!dev_info)
goto err_nomem;
-
dev_info->data =
devm_kzalloc(&pdev->dev, sizeof(*dev_info->data), GFP_KERNEL);
if (!dev_info->data)
@@ -1231,10 +1229,10 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(dev_info->syscon)) {
pr_info(FMT, np->name);
- dev_info->apb2ser3_region = ioremap(APB2_SER3_PHY_ADDR,
- APB2_SER3_PHY_SIZE);
- if (!dev_info->apb2ser3_region) {
- pr_err("ioremap of apb2ser3 region failed\n");
+ dev_info->axi2ser3_region = ioremap(AXI2_SER3_PHY_ADDR,
+ AXI2_SER3_PHY_SIZE);
+ if (!dev_info->axi2ser3_region) {
+ pr_err("ioremap of axi2ser3 region failed\n");
goto err_noctlinfo;
}
}
@@ -1413,7 +1411,10 @@ static int intel_edac_mc_probe(struct platform_device *pdev)
return 0;
err_noirq:
- flush_scheduled_work();
+ if (dev_info->is_ddr4)
+ cancel_work_sync(&dev_info->offload_alerts);
+ cancel_work_sync(&dev_info->offload_events);
+
edac_device_del_device(&dev_info->pdev->dev);
err_nosysfs:
@@ -1421,7 +1422,6 @@ err_nosysfs:
err_noctlinfo:
mutex_destroy(&dev_info->data->edac_sysfs_data_lock);
atomic64_dec(&mc_counter);
- platform_device_unregister(dev_info->pdev);
return 1;
err_nomem:
atomic64_dec(&mc_counter);
@@ -1441,16 +1441,19 @@ static int intel_edac_mc_remove(struct platform_device *pdev)
disable_irq(dev_info->data->irq);
devm_free_irq(&pdev->dev,
dev_info->data->irq, dev_info);
- }
- flush_scheduled_work();
+ dev_info->data->irq = 0;
+
+ if (dev_info->is_ddr4)
+ cancel_work_sync(&dev_info->offload_alerts);
+ cancel_work_sync(&dev_info->offload_events);
+ }
if (dev_info->edac_dev != NULL) {
edac_device_del_device(&dev_info->pdev->dev);
edac_device_free_ctl_info(dev_info->edac_dev);
}
-
mutex_destroy(&dev_info->data->edac_sysfs_data_lock);
atomic64_dec(&mc_counter);
}
--
2.7.4
More information about the linux-yocto
mailing list