Skip to content

arm64/mm: Limit the DMA zone for arm64#3080

Merged
pelwell merged 1 commit intoraspberrypi:rpi-4.19.yfrom
balena-os:ag/rpi4-dma
Jul 17, 2019
Merged

arm64/mm: Limit the DMA zone for arm64#3080
pelwell merged 1 commit intoraspberrypi:rpi-4.19.yfrom
balena-os:ag/rpi4-dma

Conversation

@agherzan
Copy link
Contributor

On RaspberryPi, only the first 1Gb can be used for DMA[1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2019-July/665986.html

Signed-off-by: Andrei Gherzan andrei@balena.io

@pelwell
Copy link
Contributor

pelwell commented Jul 16, 2019

I have no problem with this, provided it just keeps the coherent DMA buffers in the first 1GB and doesn't prevent a more capable DMA device from addressing any page.

@vianpl
Copy link
Contributor

vianpl commented Jul 16, 2019

I suggest using this:

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index f3c795278def..cad580bda548 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -170,8 +170,9 @@ static void __init reserve_elfcorehdr(void)
  */
 static phys_addr_t __init max_zone_dma_phys(void)
 {
-       phys_addr_t offset = memblock_start_of_DRAM() & GENMASK_ULL(63, 32);
-       return min(offset + (1ULL << 32), memblock_end_of_DRAM());
+       /*phys_addr_t offset = memblock_start_of_DRAM() & GENMASK_ULL(63, 32);*/
+       /*return min(offset + (1ULL << 32), memblock_end_of_DRAM());*/
+       return 0x40000000;
 }

It's pretty much the same, but you get the proper ZONE_DMA32 areas in the boot log.

@agherzan
Copy link
Contributor Author

@vianpl I like that. I'll push.
@pelwell I'm not sure of the impact on devices dma capable of accessing any page. I've mostly relayed this change and tested it locally. Even if this is a temporary fix, I reckon we should go forward until we implement something like bounce buffers.

@pelwell
Copy link
Contributor

pelwell commented Jul 16, 2019

Let me know when you've pushed the update.

On RaspberryPi, only the first 1Gb can be used for DMA[1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2019-July/665986.html

Signed-off-by: Andrei Gherzan <andrei@balena.io>
@agherzan
Copy link
Contributor Author

@Pewell @vianpl I pushed the change. I tweaked it a little.

@agherzan
Copy link
Contributor Author

@pelwell for whatever reason your mention above didn't go through.

@pelwell pelwell merged commit d5dc848 into raspberrypi:rpi-4.19.y Jul 17, 2019
@agherzan agherzan deleted the ag/rpi4-dma branch July 17, 2019 12:54
agherzan added a commit to agherzan/meta-raspberrypi that referenced this pull request Jul 17, 2019
We can do this because the kernel now includes a workaround for the DMA
issue.
raspberrypi/linux#3080

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
agherzan added a commit to agherzan/meta-raspberrypi that referenced this pull request Jul 18, 2019
We can do this because the kernel now includes a workaround for the DMA
issue.
raspberrypi/linux#3080

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
agherzan added a commit to agherzan/meta-raspberrypi that referenced this pull request Jul 18, 2019
We can do this because the kernel now includes a workaround for the DMA
issue.
raspberrypi/linux#3080

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
agherzan added a commit to agherzan/meta-raspberrypi that referenced this pull request Jul 20, 2019
We can do this because the kernel now includes a workaround for the DMA
issue.
raspberrypi/linux#3080

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants