linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi, nfit: fix acpi_check_dsm() vs zero functions implemented
@ 2016-06-24 17:44 Dan Williams
  2016-06-24 22:15 ` Rafael J. Wysocki
       [not found] ` <146679026571.24395.11569929364936343871.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 2 replies; 19+ messages in thread
From: Dan Williams @ 2016-06-24 17:44 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw
  Cc: Xiao Guangrong, linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	Rafael J. Wysocki, Len Brown

QEMU 2.6 implements nascent support for nvdimm DSMs. Depending on
configuration it may only implement the function0 dsm to indicate that
no other DSMs are available. Commit 31eca76ba2fc "nfit, libnvdimm:
limited/whitelisted dimm command marshaling mechanism" breaks QEMU, but
QEMU is spec compliant.  Per the spec the way to indicate that no
functions are supported is:

    If Function Index is zero, the return is a buffer containing one bit
    for each function index, starting with zero. Bit 0 indicates whether
    there is support for any functions other than function 0 for the
    specified UUID and Revision ID. If set to zero, no functions are
    supported (other than function zero) for the specified UUID and
    Revision ID.

Update the nfit driver to determine the family (interface UUID) without
requiring the implementation to define any other functions, i.e.
short-circuit acpi_check_dsm() to succeed per the spec.  The nfit driver
appears to be the only user passing funcs==0 to acpi_check_dsm(), so
this behavior change of the common routine should be limited to the
probing done by the nfit driver.

Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>
Cc: Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Jerry Hoemann <jerry.hoemann-ZPxbGqLxI0U@public.gmane.org>
Fixes: 31eca76ba2fc ("nfit, libnvdimm: limited/whitelisted dimm command marshaling mechanism")
Reported-by: Xiao Guangrong <guangrong.xiao-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Tested-by: Xiao Guangrong <guangrong.xiao-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/acpi/nfit.c  |    6 +++---
 drivers/acpi/utils.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 2215fc847fa9..32579a7b71d5 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -1131,11 +1131,11 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
 
 	/*
 	 * Until standardization materializes we need to consider up to 3
-	 * different command sets.  Note, that checking for function0 (bit0)
-	 * tells us if any commands are reachable through this uuid.
+	 * different command sets.  Note, that checking for zero functions
+	 * tells us if any commands might be reachable through this uuid.
 	 */
 	for (i = NVDIMM_FAMILY_INTEL; i <= NVDIMM_FAMILY_HPE2; i++)
-		if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 1))
+		if (acpi_check_dsm(adev_dimm->handle, to_nfit_uuid(i), 1, 0))
 			break;
 
 	/* limit the supported commands to those that are publicly documented */
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 22c09952e177..b4de130f2d57 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -680,9 +680,6 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
 	u64 mask = 0;
 	union acpi_object *obj;
 
-	if (funcs == 0)
-		return false;
-
 	obj = acpi_evaluate_dsm(handle, uuid, rev, 0, NULL);
 	if (!obj)
 		return false;
@@ -695,6 +692,9 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, u64 rev, u64 funcs)
 			mask |= (((u64)obj->buffer.pointer[i]) << (i * 8));
 	ACPI_FREE(obj);
 
+	if (funcs == 0)
+		return true;
+
 	/*
 	 * Bit 0 indicates whether there's support for any functions other than
 	 * function 0 for the specified UUID and revision.

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-07-22  8:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24 17:44 [PATCH] acpi, nfit: fix acpi_check_dsm() vs zero functions implemented Dan Williams
2016-06-24 22:15 ` Rafael J. Wysocki
     [not found] ` <146679026571.24395.11569929364936343871.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-06-27 17:40   ` Linda Knippers
     [not found]     ` <bd2353c0-0d84-3c0a-8117-3f24b823f469-ZPxbGqLxI0U@public.gmane.org>
2016-06-27 18:06       ` Dan Williams
     [not found]         ` <CAPcyv4iELmJ9vDD7-juYOP4a6P51UFd49OUwreeofsXX7eHzCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-27 18:47           ` Linda Knippers
     [not found]             ` <b877a201-6b62-43c6-17f8-dcaf5961cbb0-ZPxbGqLxI0U@public.gmane.org>
2016-06-27 18:58               ` Dan Williams
     [not found]                 ` <CAPcyv4gWC4cND_+DUi_gjMpy2NLhNdhEfhwHjQ7x0AhKR0K7Vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-27 19:03                   ` Linda Knippers
2016-06-28  9:37                   ` Xiao Guangrong
     [not found]                     ` <57724569.6020609-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-06-28 15:31                       ` Jerry Hoemann
2016-07-19 17:11   ` Jerry Hoemann
     [not found]     ` <20160719171153.GA121461-FG6ydVoalP1xnVILBQAtiA@public.gmane.org>
2016-07-19 18:50       ` Linda Knippers
     [not found]         ` <cfd9968d-9835-0ef1-fafd-54fd3b892d1c-ZPxbGqLxI0U@public.gmane.org>
2016-07-19 18:52           ` Dan Williams
     [not found]             ` <CAPcyv4gqmjMFveV+iE2NbvWnTb5kdy8w54VDgLYxeMJ5NJyzbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-19 19:00               ` Jerry Hoemann
2016-07-19 20:01               ` Dan Williams
2016-07-19 22:46                 ` Jerry Hoemann
2016-07-19 22:53                   ` Dan Williams
2016-07-20 22:49                     ` Dan Williams
2016-07-21  5:40                       ` Xiao Guangrong
2016-07-22  8:14                 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).