Skip to content

Commit 099b07a

Browse files
committed
acpi, nfit: Prefer _DSM over _LSR for namespace label reads
The _LSR method indicates locked status via error-code-3 returned in the _LSR payload. When any error is returned the payload of _LSR is truncated to a zero-length buffer. The _DSM path in comparison allows system software to retrieve the locked status *and* namespace label area contents. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 08e6b3c commit 099b07a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/acpi/nfit/core.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
16971697
{
16981698
struct acpi_device *adev, *adev_dimm;
16991699
struct device *dev = acpi_desc->dev;
1700-
unsigned long dsm_mask;
1700+
unsigned long dsm_mask, label_mask;
17011701
const guid_t *guid;
17021702
int i;
17031703
int family = -1;
@@ -1769,6 +1769,16 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
17691769
1ULL << i))
17701770
set_bit(i, &nfit_mem->dsm_mask);
17711771

1772+
/*
1773+
* Prefer the NVDIMM_FAMILY_INTEL label read commands if present
1774+
* due to their better semantics handling locked capacity.
1775+
*/
1776+
label_mask = 1 << ND_CMD_GET_CONFIG_SIZE | 1 << ND_CMD_GET_CONFIG_DATA
1777+
| 1 << ND_CMD_SET_CONFIG_DATA;
1778+
if (family == NVDIMM_FAMILY_INTEL
1779+
&& (dsm_mask & label_mask) == label_mask)
1780+
return 0;
1781+
17721782
if (acpi_nvdimm_has_method(adev_dimm, "_LSI")
17731783
&& acpi_nvdimm_has_method(adev_dimm, "_LSR")) {
17741784
dev_dbg(dev, "%s: has _LSR\n", dev_name(&adev_dimm->dev));

0 commit comments

Comments
 (0)