Skip to content

Commit 14c73f9

Browse files
committed
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: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 243f29f commit 14c73f9

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

drivers/acpi/nfit/core.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,7 +2808,7 @@ static void acpi_nfit_async_scrub(struct acpi_nfit_desc *acpi_desc,
28082808
unsigned int tmo = scrub_timeout;
28092809
int rc;
28102810

2811-
if (!nfit_spa->ars_required || !nfit_spa->nd_region)
2811+
if (!test_bit(ARS_REQ, &nfit_spa->ars_state) || !nfit_spa->nd_region)
28122812
return;
28132813

28142814
rc = ars_start(acpi_desc, nfit_spa);
@@ -3003,7 +3003,7 @@ static void acpi_nfit_scrub(struct work_struct *work)
30033003
* register them now to make data available.
30043004
*/
30053005
if (!nfit_spa->nd_region) {
3006-
nfit_spa->ars_required = 1;
3006+
set_bit(ARS_REQ, &nfit_spa->ars_state);
30073007
acpi_nfit_register_region(acpi_desc, nfit_spa);
30083008
}
30093009
}
@@ -3241,7 +3241,7 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
32413241
return 0;
32423242
}
32433243

3244-
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
3244+
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, unsigned long flags)
32453245
{
32463246
struct device *dev = acpi_desc->dev;
32473247
struct nfit_spa *nfit_spa;
@@ -3261,9 +3261,11 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
32613261
if (nfit_spa_type(spa) != NFIT_SPA_PM)
32623262
continue;
32633263

3264-
nfit_spa->ars_required = 1;
3264+
set_bit(ARS_REQ, &nfit_spa->ars_state);
32653265
}
3266-
acpi_desc->ars_start_flags = flags;
3266+
acpi_desc->ars_start_flags = 0;
3267+
if (test_bit(ARS_SHORT, &flags))
3268+
acpi_desc->ars_start_flags |= ND_ARS_RETURN_PREV_DATA;
32673269
queue_work(nfit_wq, &acpi_desc->work);
32683270
dev_dbg(dev, "ars_scan triggered\n");
32693271
mutex_unlock(&acpi_desc->init_mutex);
@@ -3440,8 +3442,8 @@ static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
34403442
static void acpi_nfit_uc_error_notify(struct device *dev, acpi_handle handle)
34413443
{
34423444
struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(dev);
3443-
u8 flags = (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) ?
3444-
0 : ND_ARS_RETURN_PREV_DATA;
3445+
unsigned long flags = (acpi_desc->scrub_mode == HW_ERROR_SCRUB_ON) ?
3446+
0 : 1 << ARS_SHORT;
34453447

34463448
acpi_nfit_ars_rescan(acpi_desc, flags);
34473449
}

drivers/acpi/nfit/nfit.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,17 @@ enum nfit_dimm_notifiers {
117117
NFIT_NOTIFY_DIMM_HEALTH = 0x81,
118118
};
119119

120+
enum nfit_ars_state {
121+
ARS_REQ,
122+
ARS_DONE,
123+
ARS_SHORT,
124+
ARS_FAILED,
125+
};
126+
120127
struct nfit_spa {
121128
struct list_head list;
122129
struct nd_region *nd_region;
123-
unsigned int ars_required:1;
130+
unsigned long ars_state;
124131
u32 clear_err_unit;
125132
u32 max_ars;
126133
struct acpi_nfit_system_address spa[0];
@@ -243,7 +250,7 @@ struct nfit_blk {
243250

244251
extern struct list_head acpi_descs;
245252
extern struct mutex acpi_desc_lock;
246-
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags);
253+
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, unsigned long flags);
247254

248255
#ifdef CONFIG_X86_MCE
249256
void nfit_mce_register(void);

0 commit comments

Comments
 (0)