From patchwork Mon Sep 19 10:19:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 9338925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 207DD607D0 for ; Mon, 19 Sep 2016 10:22:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FE1328837 for ; Mon, 19 Sep 2016 10:22:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01E1428BD1; Mon, 19 Sep 2016 10:22:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: * X-Spam-Status: No, score=1.7 required=2.0 tests=BAYES_50, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RDNS_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (unknown [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDA9228837 for ; Mon, 19 Sep 2016 10:22:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3E8751A1E0A; Mon, 19 Sep 2016 03:22:25 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ABA4F1A1E0A for ; Mon, 19 Sep 2016 03:22:24 -0700 (PDT) Received: by mail-pf0-x244.google.com with SMTP id n24so7080578pfb.3 for ; Mon, 19 Sep 2016 03:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=46hQ27zucKwtdhpndt/KOK9InQqp4syscWY8XpgkWbY=; b=gHU2z1bRVEqc1d/sAdkfkPITFMNBFZs0X2Z5CfC/jc/Iz7/rqz8lVWekcK/vqTGAdZ 45mjNZi3pEGxbCvYC/N0Qx2Y/KIMHh451FxyEOErjahOjvGCTWhL+O0RlN/rzvRiDEcw I0Hpvugc3oqDH5T39Z3N7+llm01UQJphnVGUxQIYzOcMEneGbDGofFeJonyRNwzSeFCt Wz0MylX52FGC2Pf49ybwtQZfE32eaebpFoRWhfEnhwxMiKRK2xkdRWS/BCA6sDyc0pTg ocU0CwvNo9CGcLZXq36OMPM1VZqTfqHJyvShqth1w3YM+oFQqT5Okyqj5lFn34QSfVDI y60Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=46hQ27zucKwtdhpndt/KOK9InQqp4syscWY8XpgkWbY=; b=a5eGZkY41MIiql7reCSCnsB1pRH5yElasyxMnpRXXKo6kTCCp5npVwQBOmy/6hc+0l OD6nquYMngQhUcTPHC9PfwZk/3wqSZG7ltXvQ+ZFH6N0m/3Q7FS5/OSGb9mkNNd6T6T8 R3N509OBivG4Iz1u7UYhXSo7Dbm+U3vwc8gKHkBXR5nEPGlPpOEhtf0mqvqYcJB0XFPg 69lSm+ZQ+PWSvxuxHG9ZgpKhRcg8CApILmqEENQsOjNm7TdOSi4G5ojfy0eTF2XKfRmM Nt4vjYR8Lx6q/YeADG/UuhW9CC6I+6szu3entV8itMiSWZRO70usgIEKFr7q6kKbtQ/a oOBQ== X-Gm-Message-State: AE9vXwPElAMb9gCldlVe2ZVWFLZlzJQhXvbmdV92aQ6ZeP59DsHZCsJq/jHCv8ooh6iyJg== X-Received: by 10.98.91.197 with SMTP id p188mr46414243pfb.101.1474280544381; Mon, 19 Sep 2016 03:22:24 -0700 (PDT) Received: from canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id bl10sm30363572pab.46.2016.09.19.03.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Sep 2016 03:22:23 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH] nvdimm: fix PHYS_PFN/PFN_PHYS mixup Date: Mon, 19 Sep 2016 20:19:00 +1000 Message-Id: <1474280340-6394-1-git-send-email-oohall@gmail.com> X-Mailer: git-send-email 2.5.5 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP nd_activate_region() iomaps any hint addresses required when activating a region. To prevent duplicate mappings it checks the PFN of the hint to be mapped against the PFNs of the already mapped hints. Unfortunately it doesn't convert the PFN back into a physical address before passing it to devm_nvdimm_ioremap(). Instead it applies PHYS_PFN a second time which ends about as well as you would imagine. Signed-off-by: Oliver O'Halloran Cc: Dan Williams --- drivers/nvdimm/region_devs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index e8d5ba7b29af..4eef88eb5144 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -57,7 +57,7 @@ static int nvdimm_map_flush(struct device *dev, struct nvdimm *nvdimm, int dimm, ndrd->flush_wpq[dimm][j] & PAGE_MASK); else flush_page = devm_nvdimm_ioremap(dev, - PHYS_PFN(pfn), PAGE_SIZE); + PFN_PHYS(pfn), PAGE_SIZE); if (!flush_page) return -ENXIO; ndrd->flush_wpq[dimm][i] = flush_page