From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22FA9C433E1 for ; Fri, 21 Aug 2020 23:22:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF3C1207DF for ; Fri, 21 Aug 2020 23:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598052173; bh=sKLHbJTSz3ktT+ei9afPlvY/f5DUe+4lL79epZPRZvY=; h=Date:From:To:Subject:Reply-To:List-ID:From; b=cIdn47absnHXjCjOnMKBCCCnPDYdAqpj2xIitargMLYUj9nhaJuK4MQL6IVMiCt3s 8R9wz236Xqy7l+77qypYfoWOYM83rd8woOjTHkTNMrMIBDNvYsOZ8eX6ryp20u+QJ4 wTlfs4xP9Mv/S9a4A0NF3ul/QR5lxtJC6tLocvoc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726753AbgHUXWw (ORCPT ); Fri, 21 Aug 2020 19:22:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbgHUXWw (ORCPT ); Fri, 21 Aug 2020 19:22:52 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 79265207C3; Fri, 21 Aug 2020 23:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598052171; bh=sKLHbJTSz3ktT+ei9afPlvY/f5DUe+4lL79epZPRZvY=; h=Date:From:To:Subject:From; b=N88SOHfAstpRMK8msKOKga8cl3LEDlbydERYaz4sx7wwUkfsZ7s7fbwrvpEILaafv u5UTztvoR2xR4n3rWuG8Xo8paHYHxPF4EVmWRxUStgFsuch4WHtu79VdeRwUUJPeEF 5xsV0olkdx/6CnlfhiSqNSVdIkg5gqbp7iUGhPlo= Date: Fri, 21 Aug 2020 16:22:48 -0700 From: akpm@linux-foundation.org To: airlied@linux.ie, ard.biesheuvel@linaro.org, ardb@kernel.org, benh@kernel.crashing.org, bp@alien8.de, Brice.Goglin@inria.fr, bskeggs@redhat.com, catalin.marinas@arm.com, dan.j.williams@intel.com, daniel@ffwll.ch, dave.hansen@linux.intel.com, dave.jiang@intel.com, david@redhat.com, gregkh@linuxfoundation.org, hpa@zytor.com, ira.weiny@intel.com, jgg@mellanox.com, jmoyer@redhat.com, joao.m.martins@oracle.com, Jonathan.Cameron@huawei.com, justin.he@arm.com, luto@kernel.org, mingo@redhat.com, mm-commits@vger.kernel.org, mpe@ellerman.id.au, pasha.tatashin@soleen.com, paulus@ozlabs.org, peterz@infradead.org, rafael.j.wysocki@intel.com, rafael@kernel.org, richardw.yang@linux.intel.com, rjw@rjwysocki.net, rppt@linux.ibm.com, tglx@linutronix.de, thomas.lendacky@amd.com, vishal.l.verma@intel.com, will@kernel.org Subject: + efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance.patch added to -mm tree Message-ID: <20200821232248.GMd9sxNR2%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: mm-commits-owner@vger.kernel.org Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: efi/fake_mem: arrange for a resource entry per efi_fake_mem instance has been added to the -mm tree. Its filename is efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Dan Williams Subject: efi/fake_mem: arrange for a resource entry per efi_fake_mem instance In preparation for attaching a platform device per iomem resource teach the efi_fake_mem code to create an e820 entry per instance. Similar to E820_TYPE_PRAM, bypass merging resource when the e820 map is sanitized. Link: https://lkml.kernel.org/r/159643096068.4062302.11590041070221681669.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams Acked-by: Ard Biesheuvel Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Ard Biesheuvel Cc: Benjamin Herrenschmidt Cc: Ben Skeggs Cc: Brice Goglin Cc: Catalin Marinas Cc: Daniel Vetter Cc: Dave Hansen Cc: Dave Jiang Cc: David Airlie Cc: David Hildenbrand Cc: Greg Kroah-Hartman Cc: Ira Weiny Cc: Jason Gunthorpe Cc: Jeff Moyer Cc: Jia He Cc: Joao Martins Cc: Jonathan Cameron Cc: Michael Ellerman Cc: Mike Rapoport Cc: Paul Mackerras Cc: Pavel Tatashin Cc: Peter Zijlstra Cc: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" Cc: Tom Lendacky Cc: Vishal Verma Cc: Wei Yang Cc: Will Deacon Signed-off-by: Andrew Morton --- arch/x86/kernel/e820.c | 16 +++++++++++++++- drivers/firmware/efi/x86_fake_mem.c | 12 +++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/e820.c~efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance +++ a/arch/x86/kernel/e820.c @@ -305,6 +305,20 @@ static int __init cpcompare(const void * return (ap->addr != ap->entry->addr) - (bp->addr != bp->entry->addr); } +static bool e820_nomerge(enum e820_type type) +{ + /* + * These types may indicate distinct platform ranges aligned to + * numa node, protection domain, performance domain, or other + * boundaries. Do not merge them. + */ + if (type == E820_TYPE_PRAM) + return true; + if (type == E820_TYPE_SOFT_RESERVED) + return true; + return false; +} + int __init e820__update_table(struct e820_table *table) { struct e820_entry *entries = table->entries; @@ -380,7 +394,7 @@ int __init e820__update_table(struct e82 } /* Continue building up new map based on this information: */ - if (current_type != last_type || current_type == E820_TYPE_PRAM) { + if (current_type != last_type || e820_nomerge(current_type)) { if (last_type != 0) { new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr; /* Move forward only if the new size was non-zero: */ --- a/drivers/firmware/efi/x86_fake_mem.c~efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance +++ a/drivers/firmware/efi/x86_fake_mem.c @@ -38,7 +38,7 @@ void __init efi_fake_memmap_early(void) m_start = mem->range.start; m_end = mem->range.end; for_each_efi_memory_desc(md) { - u64 start, end; + u64 start, end, size; if (md->type != EFI_CONVENTIONAL_MEMORY) continue; @@ -58,11 +58,17 @@ void __init efi_fake_memmap_early(void) */ start = max(start, m_start); end = min(end, m_end); + size = end - start + 1; if (end <= start) continue; - e820__range_update(start, end - start + 1, E820_TYPE_RAM, - E820_TYPE_SOFT_RESERVED); + + /* + * Ensure each efi_fake_mem instance results in + * a unique e820 resource + */ + e820__range_remove(start, size, E820_TYPE_RAM, 1); + e820__range_add(start, size, E820_TYPE_SOFT_RESERVED); e820__update_table(e820_table); } } _ Patches currently in -mm which might be from dan.j.williams@intel.com are x86-numa-cleanup-configuration-dependent-command-line-options.patch x86-numa-add-nohmat-option.patch efi-fake_mem-arrange-for-a-resource-entry-per-efi_fake_mem-instance.patch acpi-hmat-refactor-hmat_register_target_device-to-hmem_register_device.patch resource-report-parent-to-walk_iomem_res_desc-callback.patch mm-memory_hotplug-introduce-default-phys_to_target_node-implementation.patch acpi-hmat-attach-a-device-for-each-soft-reserved-range.patch device-dax-drop-the-dax_regionpfn_flags-attribute.patch device-dax-move-instance-creation-parameters-to-struct-dev_dax_data.patch device-dax-make-pgmap-optional-for-instance-creation.patch device-dax-kill-dax_kmem_res.patch device-dax-add-an-allocation-interface-for-device-dax-instances.patch device-dax-introduce-seed-devices.patch drivers-base-make-device_find_child_by_name-compatible-with-sysfs-inputs.patch device-dax-add-resize-support.patch mm-memremap_pages-convert-to-struct-range.patch mm-memremap_pages-support-multiple-ranges-per-invocation.patch device-dax-add-dis-contiguous-resource-support.patch device-dax-introduce-mapping-devices.patch