Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp330275pxb; Mon, 16 Aug 2021 06:28:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbuy4qYFByd0V+OXVwX4GWhYMYo/rdue9U6vqM/Yux3XwLukZ31PdBDeVOHD/W9sRgmfj1 X-Received: by 2002:a17:906:4ad8:: with SMTP id u24mr16130471ejt.186.1629120518100; Mon, 16 Aug 2021 06:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629120518; cv=none; d=google.com; s=arc-20160816; b=GiLBnVPQ1ayJg2RkhH0mCwMZpjXOCrXsvauUvUDN9hIwX4j/rtCm3gHlrkX0dL+rT6 phhSr4tuAf+AkJGnLdEbcnUKuV0OsiYBguMEd2CPGdLpyFA9iL6OJlgPq9hHGpdTRag+ RHaoMZBqVl7G37wT88f4YMLtgVqRC7tm2IfxEigEgY5tPAG8vX1yPKItpm2MuqqXomet LIAnLCxnGMexfIjjddnQUVRfQ/5bhlZ1yTJgvCfRJsrkt4ii96wILNV1VGZ8OyorrCre U8wkJ8BNjVJT+q9g0qIQvuXfQfaDommtFMerBb3DNqL0y3cc+g6CnA80maLZgm/A+Cbs gFxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2ySgueXmlfY+vZFEdkW/KNmhHT0PiuzySHCQhzX77OI=; b=QoJfy3f87Ajozcm2kFiNRsaF3W8brl1Ip5i52F0BX3ipLysiIQ2Yz/wOzCSmwhHgsb HJniQ3SkyVjU7yphkoF2zOtwJaf9weAxapccEVEEJ6T9XUrm9UchakBGqlrRf4dW7hdJ 763wU/FqJ5CxjP5mSWOtn6R6eoDoxvCHNBg0fHFQdVk9bSZcyaYbsRFMGL370aDZIAyQ ci3vPFj3n5erTpb3NUQJBXTOv0Ar70WuPUOGfgKl4mm/cTxr0vusWoK9X+lt2IhFHBLk Q3h/pE4T0gYH9D/Q4oFp35f2MTVh8ba2ycyAQ8W2cn4s7U9DZUCzO+b7Tf9lELKlsGwE np/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0aCWuwv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si9950980ejc.522.2021.08.16.06.28.15; Mon, 16 Aug 2021 06:28:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0aCWuwv5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241140AbhHPNZI (ORCPT + 99 others); Mon, 16 Aug 2021 09:25:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240277AbhHPNPD (ORCPT ); Mon, 16 Aug 2021 09:15:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 67447632DC; Mon, 16 Aug 2021 13:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1629119528; bh=qgDWIwZb8QP5dz6TuZUfkfjVg0xnYx9m25+qSSJBEQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0aCWuwv5gE7tCCvawQqKRae5/qULzLVBs/KtmoLlcBnk/ZyofXqgJWNM8hmAqHhHU 4siRsIfyp+zsuBVG1MmHrcMLGZGKrJL6mAMst0waoj2SFvqORmbGqnIFSYP5NTEb0+ w/2+c5218sUgFph+VXd+jRNUwJte9a5RVX8+405k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacek Zloch , Lukasz Sobieraj , "Lee, Chun-Yi" , Krzysztof Rusocki , Damian Bassa , Jeff Moyer , Dan Williams Subject: [PATCH 5.13 028/151] ACPI: NFIT: Fix support for virtual SPA ranges Date: Mon, 16 Aug 2021 15:00:58 +0200 Message-Id: <20210816125445.003580090@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210816125444.082226187@linuxfoundation.org> References: <20210816125444.082226187@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Williams commit b93dfa6bda4d4e88e5386490f2b277a26958f9d3 upstream. 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. Details: 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 Range Structure of UUID_VOLATILE_VIRTUAL_DISK, UUID_VOLATILE_VIRTUAL_CD, UUID_PERSISTENT_VIRTUAL_DISK, or UUID_PERSISTENT_VIRTUAL_CD. The 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 NVDIMMs with disconnected "Region Mapping Structures" (range-index == 0), the kernel may falsely associate them with standalone ranges where the "SPA Range Structure Index" is also zero. When this happens the driver 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 Cc: Lukasz Sobieraj Cc: "Lee, Chun-Yi" Cc: Fixes: c2f32acdf848 ("acpi, nfit: treat virtual ramdisk SPA as pmem region") Reported-by: Krzysztof Rusocki Reported-by: Damian Bassa Reviewed-by: Jeff Moyer Link: https://lore.kernel.org/r/162870796589.2521182.1240403310175570220.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/nfit/core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3021,6 +3021,9 @@ static int acpi_nfit_register_region(str struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev; struct nd_mapping_desc *mapping; + /* range index 0 == unmapped in SPA or invalid-SPA */ + if (memdev->range_index == 0 || spa->range_index == 0) + continue; if (memdev->range_index != spa->range_index) continue; if (count >= ND_MAX_MAPPINGS) {