diff mbox

[4/6] nfit, address-range-scrub: introduce nfit_spa->ars_state

Message ID 152273078267.38372.2191145328822655057.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams April 3, 2018, 4:46 a.m. UTC
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.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit/core.c |    6 +++---
 drivers/acpi/nfit/nfit.h |    9 ++++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Dave Jiang April 3, 2018, 3:31 p.m. UTC | #1
On 4/2/2018 9:46 PM, Dan Williams wrote:
> 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.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/acpi/nfit/core.c |    6 +++---
>   drivers/acpi/nfit/nfit.h |    9 ++++++++-
>   2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 2a1fc3817a81..9ba60f58d929 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -2808,7 +2808,7 @@ static void acpi_nfit_async_scrub(struct acpi_nfit_desc *acpi_desc,
>   	unsigned int tmo = scrub_timeout;
>   	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;
>   
>   	rc = ars_start(acpi_desc, nfit_spa);
> @@ -3003,7 +3003,7 @@ static void acpi_nfit_scrub(struct work_struct *work)
>   		 * register them now to make data available.
>   		 */
>   		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);
>   		}
>   	}
> @@ -3261,7 +3261,7 @@ int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
>   		if (nfit_spa_type(spa) != NFIT_SPA_PM)
>   			continue;
>   
> -		nfit_spa->ars_required = 1;
> +		set_bit(ARS_REQ, &nfit_spa->ars_state);
>   	}
>   	acpi_desc->ars_start_flags = flags;
>   	queue_work(nfit_wq, &acpi_desc->work);
> diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
> index ac9c49463731..efb6c6bcde42 100644
> --- a/drivers/acpi/nfit/nfit.h
> +++ b/drivers/acpi/nfit/nfit.h
> @@ -117,10 +117,17 @@ enum nfit_dimm_notifiers {
>   	NFIT_NOTIFY_DIMM_HEALTH = 0x81,
>   };
>   
> +enum nfit_ars_state {
> +	ARS_REQ,
> +	ARS_DONE,
> +	ARS_SHORT,
> +	ARS_FAILED,
> +};
> +
>   struct nfit_spa {
>   	struct list_head list;
>   	struct nd_region *nd_region;
> -	unsigned int ars_required:1;
> +	unsigned long ars_state;
>   	u32 clear_err_unit;
>   	u32 max_ars;
>   	struct acpi_nfit_system_address spa[0];
>
diff mbox

Patch

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 2a1fc3817a81..9ba60f58d929 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2808,7 +2808,7 @@  static void acpi_nfit_async_scrub(struct acpi_nfit_desc *acpi_desc,
 	unsigned int tmo = scrub_timeout;
 	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;
 
 	rc = ars_start(acpi_desc, nfit_spa);
@@ -3003,7 +3003,7 @@  static void acpi_nfit_scrub(struct work_struct *work)
 		 * register them now to make data available.
 		 */
 		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);
 		}
 	}
@@ -3261,7 +3261,7 @@  int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, u8 flags)
 		if (nfit_spa_type(spa) != NFIT_SPA_PM)
 			continue;
 
-		nfit_spa->ars_required = 1;
+		set_bit(ARS_REQ, &nfit_spa->ars_state);
 	}
 	acpi_desc->ars_start_flags = flags;
 	queue_work(nfit_wq, &acpi_desc->work);
diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
index ac9c49463731..efb6c6bcde42 100644
--- a/drivers/acpi/nfit/nfit.h
+++ b/drivers/acpi/nfit/nfit.h
@@ -117,10 +117,17 @@  enum nfit_dimm_notifiers {
 	NFIT_NOTIFY_DIMM_HEALTH = 0x81,
 };
 
+enum nfit_ars_state {
+	ARS_REQ,
+	ARS_DONE,
+	ARS_SHORT,
+	ARS_FAILED,
+};
+
 struct nfit_spa {
 	struct list_head list;
 	struct nd_region *nd_region;
-	unsigned int ars_required:1;
+	unsigned long ars_state;
 	u32 clear_err_unit;
 	u32 max_ars;
 	struct acpi_nfit_system_address spa[0];