From: Dan Williams <dan.j.williams@intel.com> To: mingo@redhat.com Cc: Taku Izumi <izumi.taku@jp.fujitsu.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, kexec@lists.infradead.org, x86@kernel.org Subject: [PATCH v2 1/4] efi: Add a flags parameter to efi_memory_map Date: Tue, 31 Dec 2019 14:04:23 -0800 [thread overview] Message-ID: <157782986309.367056.18234587970434659175.stgit@dwillia2-desk3.amr.corp.intel.com> (raw) In-Reply-To: <157782985777.367056.14741265874314204783.stgit@dwillia2-desk3.amr.corp.intel.com> In preparation for garbage collecting dynamically allocated efi memory maps, where the allocation method of memblock vs slab needs to be recalled, convert the existing 'late' flag into a 'flags' bitmask. Cc: Taku Izumi <izumi.taku@jp.fujitsu.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/firmware/efi/memmap.c | 24 +++++++++++++----------- include/linux/efi.h | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c index 38b686c67b17..813674ef9000 100644 --- a/drivers/firmware/efi/memmap.c +++ b/drivers/firmware/efi/memmap.c @@ -52,7 +52,7 @@ phys_addr_t __init efi_memmap_alloc(unsigned int num_entries) /** * __efi_memmap_init - Common code for mapping the EFI memory map * @data: EFI memory map data - * @late: Use early or late mapping function? + * @flags: Use early or late mapping function? * * This function takes care of figuring out which function to use to * map the EFI memory map in efi.memmap based on how far into the boot @@ -66,9 +66,9 @@ phys_addr_t __init efi_memmap_alloc(unsigned int num_entries) * Returns zero on success, a negative error code on failure. */ static int __init -__efi_memmap_init(struct efi_memory_map_data *data, bool late) +__efi_memmap_init(struct efi_memory_map_data *data, unsigned long flags) { - struct efi_memory_map map; + struct efi_memory_map map = { 0 }; phys_addr_t phys_map; if (efi_enabled(EFI_PARAVIRT)) @@ -76,7 +76,7 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) phys_map = data->phys_map; - if (late) + if (flags & EFI_MEMMAP_LATE) map.map = memremap(phys_map, data->size, MEMREMAP_WB); else map.map = early_memremap(phys_map, data->size); @@ -92,7 +92,7 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) map.desc_version = data->desc_version; map.desc_size = data->desc_size; - map.late = late; + map.flags |= flags; set_bit(EFI_MEMMAP, &efi.flags); @@ -111,9 +111,9 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) int __init efi_memmap_init_early(struct efi_memory_map_data *data) { /* Cannot go backwards */ - WARN_ON(efi.memmap.late); + WARN_ON(efi.memmap.flags & EFI_MEMMAP_LATE); - return __efi_memmap_init(data, false); + return __efi_memmap_init(data, 0); } void __init efi_memmap_unmap(void) @@ -121,7 +121,7 @@ void __init efi_memmap_unmap(void) if (!efi_enabled(EFI_MEMMAP)) return; - if (!efi.memmap.late) { + if (!(efi.memmap.flags & EFI_MEMMAP_LATE)) { unsigned long size; size = efi.memmap.desc_size * efi.memmap.nr_map; @@ -168,7 +168,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) WARN_ON(efi.memmap.map); /* Were we already called? */ - WARN_ON(efi.memmap.late); + WARN_ON(efi.memmap.flags & EFI_MEMMAP_LATE); /* * It makes no sense to allow callers to register different @@ -178,7 +178,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) data.desc_version = efi.memmap.desc_version; data.desc_size = efi.memmap.desc_size; - return __efi_memmap_init(&data, true); + return __efi_memmap_init(&data, EFI_MEMMAP_LATE); } /** @@ -195,6 +195,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map) { struct efi_memory_map_data data; + unsigned long flags; efi_memmap_unmap(); @@ -202,8 +203,9 @@ int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map) data.size = efi.memmap.desc_size * nr_map; data.desc_version = efi.memmap.desc_version; data.desc_size = efi.memmap.desc_size; + flags = efi.memmap.flags & EFI_MEMMAP_LATE; - return __efi_memmap_init(&data, efi.memmap.late); + return __efi_memmap_init(&data, flags); } /** diff --git a/include/linux/efi.h b/include/linux/efi.h index aa54586db7a5..b8e930f5ff77 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -795,7 +795,8 @@ struct efi_memory_map { int nr_map; unsigned long desc_version; unsigned long desc_size; - bool late; +#define EFI_MEMMAP_LATE (1UL << 0) + unsigned long flags; }; struct efi_mem_range {
WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams@intel.com> To: mingo@redhat.com Cc: linux-efi@vger.kernel.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Taku Izumi <izumi.taku@jp.fujitsu.com> Subject: [PATCH v2 1/4] efi: Add a flags parameter to efi_memory_map Date: Tue, 31 Dec 2019 14:04:23 -0800 [thread overview] Message-ID: <157782986309.367056.18234587970434659175.stgit@dwillia2-desk3.amr.corp.intel.com> (raw) In-Reply-To: <157782985777.367056.14741265874314204783.stgit@dwillia2-desk3.amr.corp.intel.com> In preparation for garbage collecting dynamically allocated efi memory maps, where the allocation method of memblock vs slab needs to be recalled, convert the existing 'late' flag into a 'flags' bitmask. Cc: Taku Izumi <izumi.taku@jp.fujitsu.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/firmware/efi/memmap.c | 24 +++++++++++++----------- include/linux/efi.h | 3 ++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c index 38b686c67b17..813674ef9000 100644 --- a/drivers/firmware/efi/memmap.c +++ b/drivers/firmware/efi/memmap.c @@ -52,7 +52,7 @@ phys_addr_t __init efi_memmap_alloc(unsigned int num_entries) /** * __efi_memmap_init - Common code for mapping the EFI memory map * @data: EFI memory map data - * @late: Use early or late mapping function? + * @flags: Use early or late mapping function? * * This function takes care of figuring out which function to use to * map the EFI memory map in efi.memmap based on how far into the boot @@ -66,9 +66,9 @@ phys_addr_t __init efi_memmap_alloc(unsigned int num_entries) * Returns zero on success, a negative error code on failure. */ static int __init -__efi_memmap_init(struct efi_memory_map_data *data, bool late) +__efi_memmap_init(struct efi_memory_map_data *data, unsigned long flags) { - struct efi_memory_map map; + struct efi_memory_map map = { 0 }; phys_addr_t phys_map; if (efi_enabled(EFI_PARAVIRT)) @@ -76,7 +76,7 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) phys_map = data->phys_map; - if (late) + if (flags & EFI_MEMMAP_LATE) map.map = memremap(phys_map, data->size, MEMREMAP_WB); else map.map = early_memremap(phys_map, data->size); @@ -92,7 +92,7 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) map.desc_version = data->desc_version; map.desc_size = data->desc_size; - map.late = late; + map.flags |= flags; set_bit(EFI_MEMMAP, &efi.flags); @@ -111,9 +111,9 @@ __efi_memmap_init(struct efi_memory_map_data *data, bool late) int __init efi_memmap_init_early(struct efi_memory_map_data *data) { /* Cannot go backwards */ - WARN_ON(efi.memmap.late); + WARN_ON(efi.memmap.flags & EFI_MEMMAP_LATE); - return __efi_memmap_init(data, false); + return __efi_memmap_init(data, 0); } void __init efi_memmap_unmap(void) @@ -121,7 +121,7 @@ void __init efi_memmap_unmap(void) if (!efi_enabled(EFI_MEMMAP)) return; - if (!efi.memmap.late) { + if (!(efi.memmap.flags & EFI_MEMMAP_LATE)) { unsigned long size; size = efi.memmap.desc_size * efi.memmap.nr_map; @@ -168,7 +168,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) WARN_ON(efi.memmap.map); /* Were we already called? */ - WARN_ON(efi.memmap.late); + WARN_ON(efi.memmap.flags & EFI_MEMMAP_LATE); /* * It makes no sense to allow callers to register different @@ -178,7 +178,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) data.desc_version = efi.memmap.desc_version; data.desc_size = efi.memmap.desc_size; - return __efi_memmap_init(&data, true); + return __efi_memmap_init(&data, EFI_MEMMAP_LATE); } /** @@ -195,6 +195,7 @@ int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size) int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map) { struct efi_memory_map_data data; + unsigned long flags; efi_memmap_unmap(); @@ -202,8 +203,9 @@ int __init efi_memmap_install(phys_addr_t addr, unsigned int nr_map) data.size = efi.memmap.desc_size * nr_map; data.desc_version = efi.memmap.desc_version; data.desc_size = efi.memmap.desc_size; + flags = efi.memmap.flags & EFI_MEMMAP_LATE; - return __efi_memmap_init(&data, efi.memmap.late); + return __efi_memmap_init(&data, flags); } /** diff --git a/include/linux/efi.h b/include/linux/efi.h index aa54586db7a5..b8e930f5ff77 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -795,7 +795,8 @@ struct efi_memory_map { int nr_map; unsigned long desc_version; unsigned long desc_size; - bool late; +#define EFI_MEMMAP_LATE (1UL << 0) + unsigned long flags; }; struct efi_mem_range { _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2019-12-31 22:20 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-31 22:04 [PATCH v2 0/4] efi: Fix handling of multiple efi_fake_mem= entries Dan Williams 2019-12-31 22:04 ` Dan Williams 2019-12-31 22:04 ` Dan Williams [this message] 2019-12-31 22:04 ` [PATCH v2 1/4] efi: Add a flags parameter to efi_memory_map Dan Williams 2019-12-31 22:04 ` [PATCH v2 2/4] efi: Add tracking for dynamically allocated memmaps Dan Williams 2019-12-31 22:04 ` Dan Williams 2019-12-31 22:04 ` [PATCH v2 3/4] efi: Fix efi_memmap_alloc() leaks Dan Williams 2019-12-31 22:04 ` Dan Williams 2020-01-01 3:35 ` Dave Young 2020-01-01 4:52 ` Dan Williams 2019-12-31 22:04 ` [PATCH v2 4/4] efi: Fix handling of multiple efi_fake_mem= entries Dan Williams 2019-12-31 22:04 ` Dan Williams 2020-01-01 4:51 ` Dave Young 2020-01-01 5:04 ` Dan Williams 2020-01-01 6:15 ` Dave Young 2020-01-01 6:20 ` Dave Young 2020-01-01 18:36 ` Dan Williams 2020-01-02 2:21 ` Dave Young
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=157782986309.367056.18234587970434659175.stgit@dwillia2-desk3.amr.corp.intel.com \ --to=dan.j.williams@intel.com \ --cc=ard.biesheuvel@linaro.org \ --cc=izumi.taku@jp.fujitsu.com \ --cc=kexec@lists.infradead.org \ --cc=linux-efi@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=x86@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.