Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: David Hildenbrand <david@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Jia He <justin.he@arm.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Hulk Robot <hulkci@huawei.com>
Cc: Jason Yan <yanaijie@huawei.com>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
Link: https://lkml.kernel.org/r/159643096068.4062302.11590041070221681669.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Dan Williams and committed by
Linus Torvalds
88e9a5b7 3b0d3101

+24 -4
+15 -1
arch/x86/kernel/e820.c
··· 305 305 return (ap->addr != ap->entry->addr) - (bp->addr != bp->entry->addr); 306 306 } 307 307 308 + static bool e820_nomerge(enum e820_type type) 309 + { 310 + /* 311 + * These types may indicate distinct platform ranges aligned to 312 + * numa node, protection domain, performance domain, or other 313 + * boundaries. Do not merge them. 314 + */ 315 + if (type == E820_TYPE_PRAM) 316 + return true; 317 + if (type == E820_TYPE_SOFT_RESERVED) 318 + return true; 319 + return false; 320 + } 321 + 308 322 int __init e820__update_table(struct e820_table *table) 309 323 { 310 324 struct e820_entry *entries = table->entries; ··· 394 380 } 395 381 396 382 /* Continue building up new map based on this information: */ 397 - if (current_type != last_type || current_type == E820_TYPE_PRAM) { 383 + if (current_type != last_type || e820_nomerge(current_type)) { 398 384 if (last_type != 0) { 399 385 new_entries[new_nr_entries].size = change_point[chg_idx]->addr - last_addr; 400 386 /* Move forward only if the new size was non-zero: */
+9 -3
drivers/firmware/efi/x86_fake_mem.c
··· 38 38 m_start = mem->range.start; 39 39 m_end = mem->range.end; 40 40 for_each_efi_memory_desc(md) { 41 - u64 start, end; 41 + u64 start, end, size; 42 42 43 43 if (md->type != EFI_CONVENTIONAL_MEMORY) 44 44 continue; ··· 58 58 */ 59 59 start = max(start, m_start); 60 60 end = min(end, m_end); 61 + size = end - start + 1; 61 62 62 63 if (end <= start) 63 64 continue; 64 - e820__range_update(start, end - start + 1, E820_TYPE_RAM, 65 - E820_TYPE_SOFT_RESERVED); 65 + 66 + /* 67 + * Ensure each efi_fake_mem instance results in 68 + * a unique e820 resource 69 + */ 70 + e820__range_remove(start, size, E820_TYPE_RAM, 1); 71 + e820__range_add(start, size, E820_TYPE_SOFT_RESERVED); 66 72 e820__update_table(e820_table); 67 73 } 68 74 }