Skip to contentSkip to conversation

of: Allow mem_reserve of memory with a base address of zero

PATCH In review Al Cooper 4 participants 6 messages Aug 6, 2014 – Aug 22, 2014 5 messages not in the archive Device tree

lore
Share & tools
lore

Al Cooper

author
#0 lore raw

PATCH 1/1 of: Allow mem_reserve of memory with a base address of zero

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

---
 drivers/of/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/fdt.c +1 -1
index 9aa012e..379ad4f 100644
@@ -453,7 +453,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
 		base = dt_mem_next_cell(dt_root_addr_cells, &prop);
 		size = dt_mem_next_cell(dt_root_size_cells, &prop);
 
-		if (base && size &&
+		if (size &&
 		    early_init_dt_reserve_memory_arch(base, size, nomap) == 0)
 			pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n",
 				uname, &base, (unsigned long)size / SZ_1M);
Signature · 6 lines
1.9.0.138.g2de3478

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Al Cooper

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

OHCI driver or hardware? I agree with the change, but really think this should be fixed in the driver in the former case or a property of the OHCI node in the latter.

Rob

Quoted 22 lines
---
 drivers/of/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/fdt.c +1 -2
index 9aa012e..379ad4f 100644
@@ -453,7 +453,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
                base = dt_mem_next_cell(dt_root_addr_cells, &prop);
                size = dt_mem_next_cell(dt_root_size_cells, &prop);
 
-               if (base && size &&
+               if (size &&
                    early_init_dt_reserve_memory_arch(base, size, nomap) == 0)
                        pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n",
                                uname, &base, (unsigned long)size / SZ_1M);
--

1.9.0.138.g2de3478

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Rob Herring
Quoted 9 lines · Al Cooper

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

Quoted 3 lines

OHCI driver or hardware? I agree with the change, but really think this should be fixed in the driver in the former case or a property of the OHCI node in the latter.

I'm not hard and fast on that. I don't think it is unreasonable to reserve the base of memory as the platform level if there is a bug causing DMA to fail at that address.

If this is a common problem (and not merely a few boards) then I agree. Fixing it this way is just asking for the same problem to show up again and again on new boards that haven't explicitly reserved the memory.

g.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 20 lines · Grant Likely
Quoted 11 lines · Rob Herring
Quoted 9 lines · Al Cooper

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

Quoted 3 lines

OHCI driver or hardware? I agree with the change, but really think this should be fixed in the driver in the former case or a property of the OHCI node in the latter.

I'm not hard and fast on that. I don't think it is unreasonable to reserve the base of memory as the platform level if there is a bug causing DMA to fail at that address.

Quoted 6 lines

If this is a common problem (and not merely a few boards) then I agree. Fixing it this way is just asking for the same problem to show up again and again on new boards that haven't explicitly reserved the memory.

g.

Reserving memory at physical address 0 has been semi-common on our boards for many issues. Sometimes it's been for temporary debugging purposes to catch an unknown driver corrupting physical address 0. Sometimes it has been a permanent fix to a hardware limitation.

Thanks,
Laura

Signature · 6 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw
In reply to a message not in the archive

I guess another way to look at this is, why disallow reserving memory at location 0?

Al

Quoted 33 lines · Laura Abbott
Quoted 20 lines · Grant Likely
Quoted 11 lines · Rob Herring
Quoted 9 lines · Al Cooper

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

Quoted 3 lines

OHCI driver or hardware? I agree with the change, but really think this should be fixed in the driver in the former case or a property of the OHCI node in the latter.

I'm not hard and fast on that. I don't think it is unreasonable to reserve the base of memory as the platform level if there is a bug causing DMA to fail at that address.

Quoted 6 lines

If this is a common problem (and not merely a few boards) then I agree. Fixing it this way is just asking for the same problem to show up again and again on new boards that haven't explicitly reserved the memory.

g.

Reserving memory at physical address 0 has been semi-common on our boards for many issues. Sometimes it's been for temporary debugging purposes to catch an unknown driver corrupting physical address 0. Sometimes it has been a permanent fix to a hardware limitation.

Quoted 6 lines

Thanks,
Laura

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 2 lines · Alan Cooper

I guess another way to look at this is, why disallow reserving memory at location 0?

Please don't top post in replies to the list.

This absolutely should be fixed and I will apply. The /memreserve/ tag already supports this as I reserve address 0 on the platform I maintain and the new reserved regions should support the same. I'm only questioning the reasoning for this case. With the limitations in dma masks, there's not an easy way to fix this just for OHCI.

Rob

Quoted 43 lines

Al

Quoted 39 lines · Laura Abbott
Quoted 20 lines · Grant Likely
Quoted 11 lines · Rob Herring
Quoted 9 lines · Al Cooper

__reserved_mem_reserve_reg() won't reserve memory if the base address is zero. This change removes the check for a base address of zero and allows it to be reserved.

Allowing the first 4K of memory to be reserved will help solve a problem on some ARM systems where the the first 16K of memory is unused and becomes allocable memory. This will prevent this memory from being used for DMA by drivers like the USB OHCI driver which consider a physical address of zero to be illegal.

Quoted 3 lines

OHCI driver or hardware? I agree with the change, but really think this should be fixed in the driver in the former case or a property of the OHCI node in the latter.

I'm not hard and fast on that. I don't think it is unreasonable to reserve the base of memory as the platform level if there is a bug causing DMA to fail at that address.

Quoted 6 lines

If this is a common problem (and not merely a few boards) then I agree. Fixing it this way is just asking for the same problem to show up again and again on new boards that haven't explicitly reserved the memory.

g.

Reserving memory at physical address 0 has been semi-common on our boards for many issues. Sometimes it's been for temporary debugging purposes to catch an unknown driver corrupting physical address 0. Sometimes it has been a permanent fix to a hardware limitation.

Thanks,
Laura

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html