nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: nvdimm@lists.linux.dev
Cc: Jacek Zloch <jacek.zloch@intel.com>,
	Lukasz Sobieraj <lukasz.sobieraj@intel.com>,
	"Lee, Chun-Yi" <jlee@suse.com>,
	Krzysztof Rusocki <krzysztof.rusocki@intel.com>,
	Damian Bassa <damian.bassa@intel.com>,
Subject: [PATCH] ACPI: NFIT: Fix support for virtual SPA ranges
Date: Fri, 30 Jul 2021 09:45:58 -0700	[thread overview]
Message-ID: <162766355874.3223041.9582643895337437921.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)

Fix the NFIT parsing code to treat a 0 index in a SPA Range Structure as
a special case and not match Region Mapping Structures that use 0 to
indicate that they are not mapped. Without this fix some platform BIOS
descriptions of "virtual disk" ranges do not result in the pmem driver
attaching to the range.

In addition to typical persistent memory ranges, the ACPI NFIT may also
convey "virtual" ranges. These ranges are indicated by a UUID in the SPA
critical difference between virtual ranges and UUID_PERSISTENT_MEMORY, is
that virtual do not support associations with Region Mapping Structures.
For this reason the "index" value of virtual SPA Range Structures is
allowed to be 0. If a platform BIOS decides to represent unmapped
NVDIMMs with a 0 index in their "SPA Range Structure Index" the driver
falsely matches them and may falsely require labels where "virtual
disks" are expected to be label-less. I.e. label-less is where the
namespace-range == region-range and the pmem driver attaches with no
user action to create a namespace.

Cc: Jacek Zloch <jacek.zloch@intel.com>
Cc: Lukasz Sobieraj <lukasz.sobieraj@intel.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Cc: <stable@vger.kernel.org>
Fixes: c2f32acdf848 ("acpi, nfit: treat virtual ramdisk SPA as pmem region")
Reported-by: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
Reported-by: Damian Bassa <damian.bassa@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
 drivers/acpi/nfit/core.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 23d9a09d7060..6f15e56ef955 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -3021,6 +3021,8 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,
 		struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev;
 		struct nd_mapping_desc *mapping;
+		if (memdev->range_index == 0 || spa->range_index == 0)
+			continue;
 		if (memdev->range_index != spa->range_index)
 		if (count >= ND_MAX_MAPPINGS) {

             reply	other threads:[~2021-07-30 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 16:45 Dan Williams [this message]
2021-08-04 16:54 ` Jeff Moyer
2021-08-11 18:53 ` [PATCH v2] " Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=162766355874.3223041.9582643895337437921.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=damian.bassa@intel.com \
    --cc=jacek.zloch@intel.com \
    --cc=jlee@suse.com \
    --cc=krzysztof.rusocki@intel.com \
    --cc=lukasz.sobieraj@intel.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    --subject='Re: [PATCH] ACPI: NFIT: Fix support for virtual SPA ranges' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).