diff options
author | Dan Williams <dan.j.williams@intel.com> | 2018-10-17 13:47:19 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2018-10-17 13:47:19 -0400 |
commit | f110176633d74bbac1f80ab9b9c6b83ea3e1cc23 (patch) | |
tree | f373f4a5ba3a6aaadbd54735b39fe4668fc27549 | |
parent | 0ead11181fe0c9538b185e46a494df21dc7de23a (diff) |
tools/testing/nvdimm: Populate dirty shutdown data
Allow the unit tests to verify the retrieval of the dirty shutdown
count via smart commands, and allow the driver-load-time retrieval of
the smart health payload to be simulated by nfit_test.
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/acpi/nfit/core.c | 7 | ||||
-rw-r--r-- | tools/testing/nvdimm/Kbuild | 1 | ||||
-rw-r--r-- | tools/testing/nvdimm/acpi_nfit_test.c | 8 | ||||
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 3 |
4 files changed, 16 insertions, 3 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index bf7021bb276c..ec8fb578fa36 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -1721,7 +1721,7 @@ static bool acpi_nvdimm_has_method(struct acpi_device *adev, char *method) | |||
1721 | return false; | 1721 | return false; |
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | static void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) | 1724 | __weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) |
1725 | { | 1725 | { |
1726 | struct nd_intel_smart smart = { 0 }; | 1726 | struct nd_intel_smart smart = { 0 }; |
1727 | union acpi_object in_buf = { | 1727 | union acpi_object in_buf = { |
@@ -1785,8 +1785,11 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, | |||
1785 | nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en; | 1785 | nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en; |
1786 | nfit_mem->family = NVDIMM_FAMILY_INTEL; | 1786 | nfit_mem->family = NVDIMM_FAMILY_INTEL; |
1787 | adev = to_acpi_dev(acpi_desc); | 1787 | adev = to_acpi_dev(acpi_desc); |
1788 | if (!adev) | 1788 | if (!adev) { |
1789 | /* unit test case */ | ||
1790 | populate_shutdown_status(nfit_mem); | ||
1789 | return 0; | 1791 | return 0; |
1792 | } | ||
1790 | 1793 | ||
1791 | adev_dimm = acpi_find_child_device(adev, device_handle, false); | 1794 | adev_dimm = acpi_find_child_device(adev, device_handle, false); |
1792 | nfit_mem->adev = adev_dimm; | 1795 | nfit_mem->adev = adev_dimm; |
diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild index 0392153a0009..778ceb651000 100644 --- a/tools/testing/nvdimm/Kbuild +++ b/tools/testing/nvdimm/Kbuild | |||
@@ -22,6 +22,7 @@ NVDIMM_SRC := $(DRIVERS)/nvdimm | |||
22 | ACPI_SRC := $(DRIVERS)/acpi/nfit | 22 | ACPI_SRC := $(DRIVERS)/acpi/nfit |
23 | DAX_SRC := $(DRIVERS)/dax | 23 | DAX_SRC := $(DRIVERS)/dax |
24 | ccflags-y := -I$(src)/$(NVDIMM_SRC)/ | 24 | ccflags-y := -I$(src)/$(NVDIMM_SRC)/ |
25 | ccflags-y += -I$(src)/$(ACPI_SRC)/ | ||
25 | 26 | ||
26 | obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o | 27 | obj-$(CONFIG_LIBNVDIMM) += libnvdimm.o |
27 | obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o | 28 | obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o |
diff --git a/tools/testing/nvdimm/acpi_nfit_test.c b/tools/testing/nvdimm/acpi_nfit_test.c index 43521512e577..fec8fb1b7715 100644 --- a/tools/testing/nvdimm/acpi_nfit_test.c +++ b/tools/testing/nvdimm/acpi_nfit_test.c | |||
@@ -4,5 +4,13 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/printk.h> | 5 | #include <linux/printk.h> |
6 | #include "watermark.h" | 6 | #include "watermark.h" |
7 | #include <nfit.h> | ||
7 | 8 | ||
8 | nfit_test_watermark(acpi_nfit); | 9 | nfit_test_watermark(acpi_nfit); |
10 | |||
11 | /* strong / override definition of nfit_intel_shutdown_status */ | ||
12 | void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem) | ||
13 | { | ||
14 | set_bit(NFIT_MEM_DIRTY_COUNT, &nfit_mem->flags); | ||
15 | nfit_mem->dirty_shutdown = 42; | ||
16 | } | ||
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index f1a2a1a7bb1b..9527d47a1070 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -149,6 +149,7 @@ static const struct nd_intel_smart smart_def = { | |||
149 | | ND_INTEL_SMART_ALARM_VALID | 149 | | ND_INTEL_SMART_ALARM_VALID |
150 | | ND_INTEL_SMART_USED_VALID | 150 | | ND_INTEL_SMART_USED_VALID |
151 | | ND_INTEL_SMART_SHUTDOWN_VALID | 151 | | ND_INTEL_SMART_SHUTDOWN_VALID |
152 | | ND_INTEL_SMART_SHUTDOWN_COUNT_VALID | ||
152 | | ND_INTEL_SMART_MTEMP_VALID | 153 | | ND_INTEL_SMART_MTEMP_VALID |
153 | | ND_INTEL_SMART_CTEMP_VALID, | 154 | | ND_INTEL_SMART_CTEMP_VALID, |
154 | .health = ND_INTEL_SMART_NON_CRITICAL_HEALTH, | 155 | .health = ND_INTEL_SMART_NON_CRITICAL_HEALTH, |
@@ -161,8 +162,8 @@ static const struct nd_intel_smart smart_def = { | |||
161 | .ait_status = 1, | 162 | .ait_status = 1, |
162 | .life_used = 5, | 163 | .life_used = 5, |
163 | .shutdown_state = 0, | 164 | .shutdown_state = 0, |
165 | .shutdown_count = 42, | ||
164 | .vendor_size = 0, | 166 | .vendor_size = 0, |
165 | .shutdown_count = 100, | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | struct nfit_test_fw { | 169 | struct nfit_test_fw { |