From: mark.rutland@arm.com (Mark Rutland) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v31 02/12] arm64: limit memory regions based on DT property, usable-memory-range Date: Wed, 1 Feb 2017 15:07:00 +0000 [thread overview] Message-ID: <20170201150700.GD4756@leverpostej> (raw) In-Reply-To: <20170201124630.6016-1-takahiro.akashi@linaro.org> Hi, On Wed, Feb 01, 2017 at 09:46:21PM +0900, AKASHI Takahiro wrote: > +static int __init early_init_dt_scan_usablemem(unsigned long node, > + const char *uname, int depth, void *data) > +{ > + struct memblock_region *usablemem = (struct memblock_region *)data; Nit: unnecessary cast. > + const __be32 *reg; > + int len; > + > + usablemem->size = 0; Could we please lift this assignment/initialisation into the caller... > + > + if (depth != 1 || strcmp(uname, "chosen") != 0) > + return 0; > + > + reg = of_get_flat_dt_prop(node, "linux,usable-memory-range", &len); > + if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells))) > + return 1; > + > + usablemem->base = dt_mem_next_cell(dt_root_addr_cells, ®); > + usablemem->size = dt_mem_next_cell(dt_root_size_cells, ®); > + > + return 1; > +} > + > +static void __init fdt_enforce_memory_region(void) > +{ > + struct memblock_region reg; ... e.g. have: struct memblock_region reg = { .size = 0, }; That saves us from making unnecessary assignments to the size field, and makes it clear that reg.size has definitely been initialised, regardless of what of_scan_flat_dt() happens to do. With that: Acked-by: Mark Rutland <mark.rutland@arm.com> Thanks, Mark. > + > + of_scan_flat_dt(early_init_dt_scan_usablemem, ®); > + > + if (reg.size) > + memblock_cap_memory_range(reg.base, reg.size); > +} > + > void __init arm64_memblock_init(void) > { > const s64 linear_region_size = -(s64)PAGE_OFFSET; > > + /* Handle linux,usable-memory-range property */ > + fdt_enforce_memory_region(); > + > /* > * Ensure that the linear region takes up exactly half of the kernel > * virtual address space. This way, we can distinguish a linear address > -- > 2.11.0 >
WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com> To: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: geoff@infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, james.morse@arm.com, bauerman@linux.vnet.ibm.com, dyoung@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v31 02/12] arm64: limit memory regions based on DT property, usable-memory-range Date: Wed, 1 Feb 2017 15:07:00 +0000 [thread overview] Message-ID: <20170201150700.GD4756@leverpostej> (raw) In-Reply-To: <20170201124630.6016-1-takahiro.akashi@linaro.org> Hi, On Wed, Feb 01, 2017 at 09:46:21PM +0900, AKASHI Takahiro wrote: > +static int __init early_init_dt_scan_usablemem(unsigned long node, > + const char *uname, int depth, void *data) > +{ > + struct memblock_region *usablemem = (struct memblock_region *)data; Nit: unnecessary cast. > + const __be32 *reg; > + int len; > + > + usablemem->size = 0; Could we please lift this assignment/initialisation into the caller... > + > + if (depth != 1 || strcmp(uname, "chosen") != 0) > + return 0; > + > + reg = of_get_flat_dt_prop(node, "linux,usable-memory-range", &len); > + if (!reg || (len < (dt_root_addr_cells + dt_root_size_cells))) > + return 1; > + > + usablemem->base = dt_mem_next_cell(dt_root_addr_cells, ®); > + usablemem->size = dt_mem_next_cell(dt_root_size_cells, ®); > + > + return 1; > +} > + > +static void __init fdt_enforce_memory_region(void) > +{ > + struct memblock_region reg; ... e.g. have: struct memblock_region reg = { .size = 0, }; That saves us from making unnecessary assignments to the size field, and makes it clear that reg.size has definitely been initialised, regardless of what of_scan_flat_dt() happens to do. With that: Acked-by: Mark Rutland <mark.rutland@arm.com> Thanks, Mark. > + > + of_scan_flat_dt(early_init_dt_scan_usablemem, ®); > + > + if (reg.size) > + memblock_cap_memory_range(reg.base, reg.size); > +} > + > void __init arm64_memblock_init(void) > { > const s64 linear_region_size = -(s64)PAGE_OFFSET; > > + /* Handle linux,usable-memory-range property */ > + fdt_enforce_memory_region(); > + > /* > * Ensure that the linear region takes up exactly half of the kernel > * virtual address space. This way, we can distinguish a linear address > -- > 2.11.0 > _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2017-02-01 15:07 UTC|newest] Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-01 12:42 [PATCH v31 00/12] add kdump support AKASHI Takahiro 2017-02-01 12:42 ` AKASHI Takahiro 2017-02-01 12:45 ` [PATCH v31 01/12] memblock: add memblock_cap_memory_range() AKASHI Takahiro 2017-02-01 12:45 ` AKASHI Takahiro 2017-02-01 12:45 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 02/12] arm64: limit memory regions based on DT property, usable-memory-range AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 15:07 ` Mark Rutland [this message] 2017-02-01 15:07 ` Mark Rutland 2017-02-02 4:21 ` AKASHI Takahiro 2017-02-02 4:21 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 03/12] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 15:26 ` Mark Rutland 2017-02-01 15:26 ` Mark Rutland 2017-02-02 4:52 ` AKASHI Takahiro 2017-02-02 4:52 ` AKASHI Takahiro 2017-02-02 11:26 ` Mark Rutland 2017-02-02 11:26 ` Mark Rutland 2017-02-02 13:44 ` AKASHI Takahiro 2017-02-02 13:44 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 04/12] arm64: mm: allow for unmapping part of kernel mapping AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 16:03 ` Mark Rutland 2017-02-01 16:03 ` Mark Rutland 2017-02-02 10:21 ` AKASHI Takahiro 2017-02-02 10:21 ` AKASHI Takahiro 2017-02-02 11:44 ` Mark Rutland 2017-02-02 11:44 ` Mark Rutland 2017-02-02 14:01 ` AKASHI Takahiro 2017-02-02 14:01 ` AKASHI Takahiro 2017-02-02 14:35 ` Mark Rutland 2017-02-02 14:35 ` Mark Rutland 2017-02-02 14:55 ` AKASHI Takahiro 2017-02-02 14:55 ` AKASHI Takahiro 2017-02-03 6:13 ` AKASHI Takahiro 2017-02-03 6:13 ` AKASHI Takahiro 2017-02-03 14:22 ` Mark Rutland 2017-02-03 14:22 ` Mark Rutland 2017-02-01 12:46 ` [PATCH v31 05/12] arm64: kdump: protect crash dump kernel memory AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 18:00 ` Mark Rutland 2017-02-01 18:00 ` Mark Rutland 2017-02-01 18:25 ` Mark Rutland 2017-02-01 18:25 ` Mark Rutland 2017-02-02 10:39 ` AKASHI Takahiro 2017-02-02 10:39 ` AKASHI Takahiro 2017-02-02 11:54 ` Mark Rutland 2017-02-02 11:54 ` Mark Rutland 2017-02-03 1:45 ` AKASHI Takahiro 2017-02-03 1:45 ` AKASHI Takahiro 2017-02-03 11:51 ` Mark Rutland 2017-02-03 11:51 ` Mark Rutland 2017-02-02 10:45 ` James Morse 2017-02-02 10:45 ` James Morse 2017-02-02 11:19 ` AKASHI Takahiro 2017-02-02 11:19 ` AKASHI Takahiro 2017-02-02 11:48 ` Mark Rutland 2017-02-02 11:48 ` Mark Rutland 2017-02-02 10:31 ` AKASHI Takahiro 2017-02-02 10:31 ` AKASHI Takahiro 2017-02-02 11:16 ` Mark Rutland 2017-02-02 11:16 ` Mark Rutland 2017-02-02 14:36 ` AKASHI Takahiro 2017-02-02 14:36 ` AKASHI Takahiro 2017-02-02 15:36 ` Mark Rutland 2017-02-02 15:36 ` Mark Rutland 2017-02-01 12:46 ` [PATCH v31 06/12] arm64: hibernate: preserve kdump image around hibernation AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 07/12] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 08/12] arm64: kdump: add VMCOREINFO's for user-space tools AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 09/12] arm64: kdump: provide /proc/vmcore file AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 19:21 ` Mark Rutland 2017-02-01 19:21 ` Mark Rutland 2017-02-02 6:24 ` AKASHI Takahiro 2017-02-02 6:24 ` AKASHI Takahiro 2017-02-02 12:03 ` Mark Rutland 2017-02-02 12:03 ` Mark Rutland 2017-02-02 12:08 ` Mark Rutland 2017-02-02 12:08 ` Mark Rutland 2017-02-02 14:39 ` AKASHI Takahiro 2017-02-02 14:39 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 10/12] arm64: kdump: enable kdump in defconfig AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro 2017-02-01 12:46 ` [PATCH v31 11/12] Documentation: kdump: describe arm64 port AKASHI Takahiro 2017-02-01 12:46 ` AKASHI Takahiro [not found] ` <20170201124218.5823-1-takahiro.akashi-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2017-02-01 12:48 ` [PATCH v31 12/12] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro 2017-02-01 12:48 ` AKASHI Takahiro 2017-02-01 12:48 ` AKASHI Takahiro
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=20170201150700.GD4756@leverpostej \ --to=mark.rutland@arm.com \ --cc=linux-arm-kernel@lists.infradead.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.