Commit 14c73f99 authored by Dan Williams's avatar Dan Williams

nfit, address-range-scrub: introduce nfit_spa->ars_state

In preparation for re-working the ARS implementation to better handle
short vs long ARS runs, introduce nfit_spa->ars_state. For now this just
replaces the nfit_spa->ars_required bit-field/flag, but going forward it
will be used to track ARS completion and make short vs long ARS
requests.
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 243f29fe
...@@ -2808,7 +2808,7 @@ static void acpi_nfit_async_scrub(struct acpi_nfit_desc *acpi_desc, ...@@ -2808,7 +2808,7 @@ static void acpi_nfit_async_scrub(struct acpi_nfit_desc *acpi_desc,
unsigned int tmo = scrub_timeout; unsigned int tmo = scrub_timeout;
int rc; int rc;
if (!nfit_spa->ars_required || !nfit_spa->nd_region) if (!test_bit(ARS_REQ, &nfit_spa->ars_state) || !nfit_spa->nd_region)
return; return;
rc = ars_start(acpi_desc, nfit_spa); rc = ars_start(acpi_desc, nfit_spa);
...@@ -3003,7 +3003,7 @@ static void acpi_nfit_scrub(struct work_struct *work) ...@@ -3003,7 +3003,7 @@ static void acpi_nfit_scrub(struct work_struct *work)
* register them now to make data available. * register them now to make data available.
*/ */
if (!nfit_spa->nd_region) { if (!nfit_spa->nd_region) {
nfit_spa->ars_required = 1; set_bit(ARS_REQ, &nfit_spa->ars_state);
acpi_nfit_register_region(acpi_desc, nfit_spa); acpi_nfit_register_region(acpi_desc, nfit_spa);
} }
} }
...@@ -3241,7 +3241,7 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, ...@@ -3241,7 +3241,7 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
return 0; return 0;
} }
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags) int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, unsigned long flags)
{ {
struct device *dev = acpi_desc->dev; struct device *dev = acpi_desc->dev;
struct nfit_spa *nfit_spa; struct nfit_spa *nfit_spa;
...@@ -3261,9 +3261,11 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags) ...@@ -3261,9 +3261,11 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
if (nfit_spa_type(spa) != NFIT_SPA_PM) if (nfit_spa_type(spa) != NFIT_SPA_PM)
continue; continue;
nfit_spa->ars_required = 1; set_bit(ARS_REQ, &nfit_spa->ars_state);
} }
acpi_desc->ars_start_flags = flags; acpi_desc->ars_start_flags = 0;
if (test_bit(ARS_SHORT, &flags))
acpi_desc->ars_start_flags |= ND_ARS_RETURN_PREV_DATA;
queue_work(nfit_wq, &acpi_desc->work); queue_work(nfit_wq, &acpi_desc->work);
dev_dbg(dev, "ars_scan triggered\n"); dev_dbg(dev, "ars_scan triggered\n");
mutex_unlock(&acpi_desc->init_mutex); mutex_unlock(&acpi_desc->init_mutex);
...@@ -3440,8 +3442,8 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle) ...@@ -3440,8 +3442,8 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
static void acpi_nfit_uc_error_notify(struct device *dev, acpi_handle handle) static void acpi_nfit_uc_error_notify(struct device *dev, acpi_handle handle)
{ {
struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev); struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev);
u8 flags = (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) ? unsigned long flags = (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) ?
0 : ND_ARS_RETURN_PREV_DATA; 0 : 1 << ARS_SHORT;
acpi_nfit_ars_rescan(acpi_desc, flags); acpi_nfit_ars_rescan(acpi_desc, flags);
} }
......
...@@ -117,10 +117,17 @@ enum nfit_dimm_notifiers { ...@@ -117,10 +117,17 @@ enum nfit_dimm_notifiers {
NFIT_NOTIFY_DIMM_HEALTH = 0x81, NFIT_NOTIFY_DIMM_HEALTH = 0x81,
}; };
enum nfit_ars_state {
ARS_REQ,
ARS_DONE,
ARS_SHORT,
ARS_FAILED,
};
struct nfit_spa { struct nfit_spa {
struct list_head list; struct list_head list;
struct nd_region *nd_region; struct nd_region *nd_region;
unsigned int ars_required:1; unsigned long ars_state;
u32 clear_err_unit; u32 clear_err_unit;
u32 max_ars; u32 max_ars;
struct acpi_nfit_system_address spa[0]; struct acpi_nfit_system_address spa[0];
...@@ -243,7 +250,7 @@ struct nfit_blk { ...@@ -243,7 +250,7 @@ struct nfit_blk {
extern struct list_head acpi_descs; extern struct list_head acpi_descs;
extern struct mutex acpi_desc_lock; extern struct mutex acpi_desc_lock;
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags); int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, unsigned long flags);
#ifdef CONFIG_X86_MCE #ifdef CONFIG_X86_MCE
void nfit_mce_register(void); void nfit_mce_register(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment