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

kernel/resource: move and rename IORESOURCE_MEM_DRIVER_MANAGED

IORESOURCE_MEM_DRIVER_MANAGED currently uses an unused PnP bit, which is
always set to 0 by hardware. This is far from beautiful (and confusing),
and the bit only applies to SYSRAM. So let's move it out of the
bus-specific (PnP) defined bits.

We'll add another SYSRAM specific bit soon. If we ever need more bits for
other purposes, we can steal some from "desc", or reshuffle/regroup what
we have.

Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kees Cook <keescook@chromium.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Wei Yang <richardw.yang@linux.intel.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Leonardo Bras <leobras.c@gmail.com>
Cc: Libor Pechacek <lpechacek@suse.cz>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: "Oliver O'Halloran" <oohall@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pingfan Liu <kernelfans@gmail.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Roger Pau Monné <roger.pau@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Wei Liu <wei.liu@kernel.org>
Link: https://lkml.kernel.org/r/20200911103459.10306-3-david@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Hildenbrand and committed by
Linus Torvalds
7cf603d1 ec62d04e

+6 -4
+3 -1
include/linux/ioport.h
··· 58 58 #define IORESOURCE_EXT_TYPE_BITS 0x01000000 /* Resource extended types */ 59 59 #define IORESOURCE_SYSRAM 0x01000000 /* System RAM (modifier) */ 60 60 61 + /* IORESOURCE_SYSRAM specific bits. */ 62 + #define IORESOURCE_SYSRAM_DRIVER_MANAGED 0x02000000 /* Always detected via a driver. */ 63 + 61 64 #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 62 65 63 66 #define IORESOURCE_DISABLED 0x10000000 ··· 106 103 #define IORESOURCE_MEM_32BIT (3<<3) 107 104 #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ 108 105 #define IORESOURCE_MEM_EXPANSIONROM (1<<6) 109 - #define IORESOURCE_MEM_DRIVER_MANAGED (1<<7) 110 106 111 107 /* PnP I/O specific bits (IORESOURCE_BITS) */ 112 108 #define IORESOURCE_IO_16BIT_ADDR (1<<0)
+1 -1
kernel/kexec_file.c
··· 521 521 /* Returning 0 will take to next memory range */ 522 522 523 523 /* Don't use memory that will be detected and handled by a driver. */ 524 - if (res->flags & IORESOURCE_MEM_DRIVER_MANAGED) 524 + if (res->flags & IORESOURCE_SYSRAM_DRIVER_MANAGED) 525 525 return 0; 526 526 527 527 if (sz < kbuf->memsz)
+2 -2
mm/memory_hotplug.c
··· 105 105 unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; 106 106 107 107 if (strcmp(resource_name, "System RAM")) 108 - flags |= IORESOURCE_MEM_DRIVER_MANAGED; 108 + flags |= IORESOURCE_SYSRAM_DRIVER_MANAGED; 109 109 110 110 /* 111 111 * Make sure value parsed from 'mem=' only restricts memory adding ··· 1161 1161 * 1162 1162 * For this memory, no entries in /sys/firmware/memmap ("raw firmware-provided 1163 1163 * memory map") are created. Also, the created memory resource is flagged 1164 - * with IORESOURCE_MEM_DRIVER_MANAGED, so in-kernel users can special-case 1164 + * with IORESOURCE_SYSRAM_DRIVER_MANAGED, so in-kernel users can special-case 1165 1165 * this memory as well (esp., not place kexec images onto it). 1166 1166 * 1167 1167 * The resource_name (visible via /proc/iomem) has to have the format