Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1237301 > unrolled thread
| Started by | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| First post | 2015-10-01 13:40 +0200 |
| Last post | 2015-10-01 14:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] of/fdt: Allow memory node and root to have different size/address cells Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-10-01 13:40 +0200
Re: [PATCH] of/fdt: Allow memory node and root to have different size/address cells kbuild test robot <lkp@intel.com> - 2015-10-01 14:00 +0200
Re: [PATCH] of/fdt: Allow memory node and root to have different size/address cells Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-10-01 14:30 +0200
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2015-10-01 13:40 +0200 |
| Subject | [PATCH] of/fdt: Allow memory node and root to have different size/address cells |
| Message-ID | <qeKnp-2Lo-41@gated-at.bofh.it> |
Currently memory node parsing uses root "#size-cells", "#address-cells"
This doesn't work correctly when memory address/size is different or
greater than root's.
e.g. ARC 32-bit systems implementing physical adressing extension and
say 4GB of memory. All peripherals mappings stay within the 4GB (so root
address/size cells remain 1 each), only the memory node address/size
cells needs to specify greater than 32-bits as below
memory {
device_type = "memory";
reg = <0x0 0x80000000 0x1 0x00000000>; /* 4 GB */
#address-cells = <2>;
#size-cells = <2>;
};
This patch lets me boot a ARC system with PAE40 + 4GB of memory specified
as above and fails to boot otherwise as memory parsing doesn't populate
right base, size.
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
drivers/of/fdt.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 07496560e5b9..3af808f45965 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -888,8 +888,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
int depth, void *data)
{
const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
- const __be32 *reg, *endp;
- int l;
+ const __be32 *reg, *endp, *prop;
+ int l, dt_mem_addr_cells, dt_mem_size_cells;
/* We are scanning "memory" nodes only */
if (type == NULL) {
@@ -912,11 +912,22 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
pr_debug("memory scan node %s, reg size %d,\n", uname, l);
- while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
+
+ dt_mem_size_cells = dt_root_size_cells,;
+ prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+ if (prop)
+ dt_mem_size_cells = be32_to_cpup(prop);
+
+ dt_mem_addr_cells = dt_root_addr_cells;
+ prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+ if (prop)
+ dt_mem_addr_cells = be32_to_cpup(prop);
+
+ while ((endp - reg) >= (dt_mem_addr_cells + dt_mem_size_cells)) {
u64 base, size;
- base = dt_mem_next_cell(dt_root_addr_cells, ®);
- size = dt_mem_next_cell(dt_root_size_cells, ®);
+ base = dt_mem_next_cell(dt_mem_addr_cells, ®);
+ size = dt_mem_next_cell(dt_mem_size_cells, ®);
if (size == 0)
continue;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-10-01 14:00 +0200 |
| Subject | Re: [PATCH] of/fdt: Allow memory node and root to have different size/address cells |
| Message-ID | <qeKGM-383-45@gated-at.bofh.it> |
| In reply to | #1237301 |
[Multipart message — attachments visible in raw view] — view raw
Hi Vineet,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: i386-randconfig-i1-201539 (attached as .config)
reproduce:
git checkout 84881842f801639b80c8f6a0d9afbc582b33be01
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/of/fdt.c: In function 'early_init_dt_scan_memory':
>> drivers/of/fdt.c:916:41: error: expected expression before ';' token
dt_mem_size_cells = dt_root_size_cells,;
^
vim +916 drivers/of/fdt.c
910
911 endp = reg + (l / sizeof(__be32));
912
913 pr_debug("memory scan node %s, reg size %d,\n", uname, l);
914
915
> 916 dt_mem_size_cells = dt_root_size_cells,;
917 prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
918 if (prop)
919 dt_mem_size_cells = be32_to_cpup(prop);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2015-10-01 14:30 +0200 |
| Subject | Re: [PATCH] of/fdt: Allow memory node and root to have different size/address cells |
| Message-ID | <qeL9M-3Vj-13@gated-at.bofh.it> |
| In reply to | #1237329 |
On Thursday 01 October 2015 05:28 PM, kbuild test robot wrote:
> Hi Vineet,
>
> [auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
>
> config: i386-randconfig-i1-201539 (attached as .config)
> reproduce:
> git checkout 84881842f801639b80c8f6a0d9afbc582b33be01
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All error/warnings (new ones prefixed by >>):
>
> drivers/of/fdt.c: In function 'early_init_dt_scan_memory':
>>> drivers/of/fdt.c:916:41: error: expected expression before ';' token
> dt_mem_size_cells = dt_root_size_cells,;
> ^
>
> vim +916 drivers/of/fdt.c
>
> 910
> 911 endp = reg + (l / sizeof(__be32));
> 912
> 913 pr_debug("memory scan node %s, reg size %d,\n", uname, l);
> 914
> 915
> > 916 dt_mem_size_cells = dt_root_size_cells,;
> 917 prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> 918 if (prop)
> 919 dt_mem_size_cells = be32_to_cpup(prop);
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
This is really awesome, Thx for the report. Corrected patch v2 posted.
Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web