From patchwork Thu Jun 9 17:42:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yigal Korman X-Patchwork-Id: 9167597 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 506C1604DB for ; Thu, 9 Jun 2016 17:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43A4F282F9 for ; Thu, 9 Jun 2016 17:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3653428355; Thu, 9 Jun 2016 17:42:37 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [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 BAC62282F9 for ; Thu, 9 Jun 2016 17:42:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 50C431A1DFA; Thu, 9 Jun 2016 10:42:57 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 6F26A1A1DFA for ; Thu, 9 Jun 2016 10:42:56 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id k204so70524356wmk.0 for ; Thu, 09 Jun 2016 10:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexistor-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=UMfJYmKggR6JBF9rEAkEuXSzaLXS/IBSn2iqNlcw6cI=; b=qIaFxx4n2aM6Qyvg2enDnM+wcbYXEshfIt0LFfWSeOhAoccH8qzUdGNGlmjzeqZR+8 SwA27kp+MzUuwDerO/s3BOYOB0kGBiYjhWFRyGtSQd69JRlNHz3Pkhnvsses89fJE5I/ RxB5c1KfhEkRBqyq4UwAtveLYhJc7n1nP3GcrhPkiwosjcJfjLeQZI+iPRyqeNvXUfW+ diSAQYkXGm7C+Ge+VXcRTMUDjDt+aXrVc+71NW7y8ZBEdCrk3OUyfgLI9ILSGiy6k6LO 3s9B8exqnBN9EYubnrKbbuFleCiybVwbgKNyNXxTmPcuBEwuZSwHSk3nWjD1JM0voXTt PqzA== 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=UMfJYmKggR6JBF9rEAkEuXSzaLXS/IBSn2iqNlcw6cI=; b=g/TUkyqkml+nD3zdiDkIkgJE0BUw2c+KXsZAwlZK0aGXt/DBrjsZ07rRFTBku2wkgN +kL6tf5u6Q3AnzY1Ae1jyEvkfl5bIJPPynX9VEWFF9/rOIEDqpsmp1RgmE7H07nUMjIN 2mfnpakYmeFRtruzYsmXPVOR3PRV3RQeOnARsDigViPCGwUvzCwqBbftHAF/t5N05jfJ 4t1PK9mSdtkVZbshhBorFecUGPIF97mrXhR0IS0eRk9Vy2n+Xc14Pa+Bsh8IuFtuRH/8 sC1+SRSktVnDf88kSEkzGuZtWjZMMBVxMSRQuhpCWQ6BP1vyPaArpDRAKnGK+KDAyDuP cY4A== X-Gm-Message-State: ALyK8tJuPFwpYeWfNFEAYoAcRNbqCMOMKnnzdWoQfLpav/TGlPZQ+BE47mbThCWAv/s2zQ== X-Received: by 10.28.41.4 with SMTP id p4mr11209484wmp.33.1465494153474; Thu, 09 Jun 2016 10:42:33 -0700 (PDT) Received: from yigal-pc.plexistor.com.localdomain ([207.232.55.62]) by smtp.gmail.com with ESMTPSA id e133sm28309994wma.6.2016.06.09.10.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jun 2016 10:42:32 -0700 (PDT) From: Yigal Korman To: matt@codeblueprint.co.uk, linux-efi@vger.kernel.org Subject: [PATCH] efi: kernel param for legacy NVDIMM support Date: Thu, 9 Jun 2016 20:42:22 +0300 Message-Id: <1465494142-1456010-1-git-send-email-yigal@plexistor.com> X-Mailer: git-send-email 1.9.3 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: , Cc: linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The 'efi_legacy_pmem' parameter will convert EFI persistent memory range (type 14) into E820 legacy NVDIMM (type 12) memory range. Background: In contrast with the NVDIMM E820 types where we can clearly distinguish between old NVDIMMs (type-12) and ACPI 6.0 NVDIMMs (type-7), the EFI memory types for NVDIMMs are the same before ACPI 6.0 and after (type-14). This means that old NVDIMMs under EFI aren't supported even though they work fine if booted with BIOS (E820). So allow the user to explicitly request the kernel to identify NVDIMMs as legacy under EFI. Signed-off-by: Yigal Korman --- Documentation/kernel-parameters.txt | 3 +++ arch/x86/platform/efi/efi.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 9a53c92..58f2a9b 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -394,6 +394,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted. add_efi_memmap [EFI; X86] Include EFI memory map in kernel's map of available physical RAM. + efi_legacy_pmem [EFI; X86] Convert EFI_PERSISTENT_MEMORY to E820_PRAM + and add it to E820 memmap for legacy NVDIMM support. + agp= [AGP] { off | try_unsupported } off: disable AGP support diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index ad28540..5e82532 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -78,6 +78,14 @@ static int __init setup_add_efi_memmap(char *arg) } early_param("add_efi_memmap", setup_add_efi_memmap); +static int add_legacy_pmem __initdata; +static int __init setup_add_legacy_pmem(char *arg) +{ + add_legacy_pmem = 1; + return 0; +} +early_param("efi_legacy_pmem", setup_add_legacy_pmem); + static efi_status_t __init phys_efi_set_virtual_address_map( unsigned long memory_map_size, unsigned long descriptor_size, @@ -191,6 +199,26 @@ static void __init do_add_efi_memmap(void) sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); } +static void __init do_add_legacy_pmem(void) +{ + void *p; + + for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { + efi_memory_desc_t *md = p; + + if (md->type == EFI_PERSISTENT_MEMORY) { + pr_info("Registering %lluMB as PRAM in E820\n", + (md->num_pages >> (20 - EFI_PAGE_SHIFT))); + + e820_add_region(md->phys_addr, + md->num_pages << EFI_PAGE_SHIFT, + E820_PRAM); + } + + } + sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); +} + int __init efi_memblock_x86_reserve_range(void) { struct efi_info *e = &boot_params.efi_info; @@ -455,6 +483,9 @@ static int __init efi_memmap_init(void) if (add_efi_memmap) do_add_efi_memmap(); + if (add_legacy_pmem) + do_add_legacy_pmem(); + set_bit(EFI_MEMMAP, &efi.flags); return 0;