Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jul 17, 2019

Conversation

@agherzan
Copy link

@agherzan agherzan commented Jul 16, 2019

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 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 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
Author

@agherzan agherzan commented Jul 16, 2019

@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 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
Author

@agherzan agherzan commented Jul 17, 2019

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

@agherzan
Copy link
Author

@agherzan agherzan commented Jul 17, 2019

@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 Jul 17, 2019
agherzan added a commit to agherzan/meta-raspberrypi that referenced this issue 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 issue 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 issue 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 issue 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
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants