Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
From: Matthias Brugger <mbrugger@suse.com>
To: Stefan Wahren <wahrenst@gmx.net>,
	catalin.marinas@arm.com, marc.zyngier@arm.com,
	Matthias Brugger <matthias.bgg@gmail.com>,
	robh+dt@kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, hch@lst.de,
	Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: f.fainelli@gmail.com, robin.murphy@arm.com,
	linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org, phill@raspberrypi.org,
	will@kernel.org, m.szyprowski@samsung.com
Subject: Re: [PATCH v5 0/4] Raspberry Pi 4 DMA addressing support
Date: Fri, 13 Sep 2019 11:25:43 +0200
Message-ID: <2fcc5ad6-fa90-6565-e75c-d20b46965733@suse.com> (raw)
In-Reply-To: <48a6b72d-d554-b563-5ed6-9a79db5fb4ab@gmx.net>



On 13/09/2019 10:50, Stefan Wahren wrote:
> Am 13.09.19 um 10:09 schrieb Matthias Brugger:
>>
>> On 12/09/2019 21:32, Stefan Wahren wrote:
>>> Am 12.09.19 um 19:18 schrieb Matthias Brugger:
>>>> On 10/09/2019 11:27, Matthias Brugger wrote:
>>>>> On 09/09/2019 21:33, Stefan Wahren wrote:
>>>>>> Hi Nicolas,
>>>>>>
>>>>>> Am 09.09.19 um 11:58 schrieb Nicolas Saenz Julienne:
>>>>>>> Hi all,
>>>>>>> this series attempts to address some issues we found while bringing up
>>>>>>> the new Raspberry Pi 4 in arm64 and it's intended to serve as a follow
>>>>>>> up of these discussions:
>>>>>>> v4: https://lkml.org/lkml/2019/9/6/352
>>>>>>> v3: https://lkml.org/lkml/2019/9/2/589
>>>>>>> v2: https://lkml.org/lkml/2019/8/20/767
>>>>>>> v1: https://lkml.org/lkml/2019/7/31/922
>>>>>>> RFC: https://lkml.org/lkml/2019/7/17/476
>>>>>>>
>>>>>>> The new Raspberry Pi 4 has up to 4GB of memory but most peripherals can
>>>>>>> only address the first GB: their DMA address range is
>>>>>>> 0xc0000000-0xfc000000 which is aliased to the first GB of physical
>>>>>>> memory 0x00000000-0x3c000000. Note that only some peripherals have these
>>>>>>> limitations: the PCIe, V3D, GENET, and 40-bit DMA channels have a wider
>>>>>>> view of the address space by virtue of being hooked up trough a second
>>>>>>> interconnect.
>>>>>>>
>>>>>>> Part of this is solved on arm32 by setting up the machine specific
>>>>>>> '.dma_zone_size = SZ_1G', which takes care of reserving the coherent
>>>>>>> memory area at the right spot. That said no buffer bouncing (needed for
>>>>>>> dma streaming) is available at the moment, but that's a story for
>>>>>>> another series.
>>>>>>>
>>>>>>> Unfortunately there is no such thing as 'dma_zone_size' in arm64. Only
>>>>>>> ZONE_DMA32 is created which is interpreted by dma-direct and the arm64
>>>>>>> arch code as if all peripherals where be able to address the first 4GB
>>>>>>> of memory.
>>>>>>>
>>>>>>> In the light of this, the series implements the following changes:
>>>>>>>
>>>>>>> - Create both DMA zones in arm64, ZONE_DMA will contain the first 1G
>>>>>>>   area and ZONE_DMA32 the rest of the 32 bit addressable memory. So far
>>>>>>>   the RPi4 is the only arm64 device with such DMA addressing limitations
>>>>>>>   so this hardcoded solution was deemed preferable.
>>>>>>>
>>>>>>> - Properly set ARCH_ZONE_DMA_BITS.
>>>>>>>
>>>>>>> - Reserve the CMA area in a place suitable for all peripherals.
>>>>>>>
>>>>>>> This series has been tested on multiple devices both by checking the
>>>>>>> zones setup matches the expectations and by double-checking physical
>>>>>>> addresses on pages allocated on the three relevant areas GFP_DMA,
>>>>>>> GFP_DMA32, GFP_KERNEL:
>>>>>>>
>>>>>>> - On an RPi4 with variations on the ram memory size. But also forcing
>>>>>>>   the situation where all three memory zones are nonempty by setting a 3G
>>>>>>>   ZONE_DMA32 ceiling on a 4G setup. Both with and without NUMA support.
>>>>>>>
>>>>>> i like to test this series on Raspberry Pi 4 and i have some questions
>>>>>> to get arm64 running:
>>>>>>
>>>>>> Do you use U-Boot? Which tree?
>>>>> If you want to use U-Boot, try v2019.10-rc4, it should have everything you need
>>>>> to boot your kernel.
>>>>>
>>>> Ok, here is a thing. In the linux kernel we now use bcm2711 as SoC name, but the
>>>> RPi4 devicetree provided by the FW uses mostly bcm2838.
>>> Do you mean the DTB provided at runtime?
>>>
>>> You mean the merged U-Boot changes, doesn't work with my Raspberry Pi
>>> series?
>>>
>>>>  U-Boot in its default
>>>> config uses the devicetree provided by the FW, mostly because this way you don't
>>>> have to do anything to find out how many RAM you really have. Secondly because
>>>> this will allow us, in the near future, to have one U-boot binary for both RPi3
>>>> and RPi4 (and as a side effect one binary for RPi1 and RPi2).
>>>>
>>>> Anyway, I found at least, that the following compatibles need to be added:
>>>>
>>>> "brcm,bcm2838-cprman"
>>>> "brcm,bcm2838-gpio"
>>>>
>>>> Without at least the cprman driver update, you won't see anything.
>>>>
>>>> "brcm,bcm2838-rng200" is also a candidate.
>>>>
>>>> I also suppose we will need to add "brcm,bcm2838" to
>>>> arch/arm/mach-bcm/bcm2711.c, but I haven't verified this.
>>> How about changing this in the downstream kernel? Which is much easier.
>> I'm not sure I understand what you want to say. My goal is to use the upstream
>> kernel with the device tree blob provided by the FW.
> 
> The device tree blob you are talking is defined in this repository:
> 
> https://github.com/raspberrypi/linux
> 
> So the word FW is misleading to me.
> 

No, it's part of
https://github.com/raspberrypi/firmware.git
file boot/bcm2711-rpi-4-b.dtb

>>  If you talk about the
>> downstream kernel, I suppose you mean we should change this in the FW DT blob
>> and in the downstream kernel. That would work for me.
>>
>> Did I understand you correctly?
> 
> Yes
> 
> So i suggest to add the upstream compatibles into the repo mentioned above.
> 
> Sorry, but in case you decided as a U-Boot developer to be compatible
> with a unreviewed DT, we also need to make U-Boot compatible with
> upstream and downstream DT blobs.
> 

Well RPi3 is working with the DT blob provided by the FW, as I mentioned earlier
if we can use this DTB we can work towards one binary that can boot both RPi3
and RPi4. On the other hand we can rely on the FW to detect the amount of memory
our RPi4 has.

That said, I agree that we should make sure that U-Boot can boot with both DTBs,
the upstream one and the downstream. Now the question is how to get to this. I'm
a bit puzzled that by talking about "unreviewed DT" you insinuate that bcm2711
compatible is already reviewed and can't be changed. From what I can see none of
these compatibles got merged for now, so we are still at time to change them.

Apart from the point Florian made, to stay consistent with the RPi SoC naming,
it will save us work, both in the kernel and in U-Boot, as we would need to add
both compatibles to the code-base.

Regards,
Matthias

>>
>>>> Regards,
>>>> Matthias
>>>>
>>>>> Regards,
>>>>> Matthias
>>>>>
>>>>>> Are there any config.txt tweaks necessary?
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> linux-arm-kernel mailing list
>>>>> linux-arm-kernel@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>>>
>>>> _______________________________________________
>>>> linux-arm-kernel mailing list
>>>> linux-arm-kernel@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>>>
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09  9:58 Nicolas Saenz Julienne
2019-09-09  9:58 ` [PATCH v5 1/4] arm64: mm: use arm64_dma_phys_limit instead of calling max_zone_dma_phys() Nicolas Saenz Julienne
2019-09-09  9:58 ` [PATCH v5 2/4] arm64: rename variables used to calculate ZONE_DMA32's size Nicolas Saenz Julienne
2019-09-09  9:58 ` [PATCH v5 3/4] arm64: use both ZONE_DMA and ZONE_DMA32 Nicolas Saenz Julienne
2019-09-11 10:54   ` Nicolas Saenz Julienne
2019-09-11 14:35     ` Catalin Marinas
2019-09-11 15:00       ` Nicolas Saenz Julienne
2019-09-09  9:58 ` [PATCH v5 4/4] mm: refresh ZONE_DMA and ZONE_DMA32 comments in 'enum zone_type' Nicolas Saenz Julienne
2019-09-09 19:33 ` [PATCH v5 0/4] Raspberry Pi 4 DMA addressing support Stefan Wahren
2019-09-09 19:50   ` Nicolas Saenz Julienne
2019-09-10  9:27   ` Matthias Brugger
2019-09-12 17:18     ` Matthias Brugger
2019-09-12 17:27       ` Florian Fainelli
2019-09-12 19:32       ` Stefan Wahren
2019-09-13  7:15         ` Matthias Brugger
2019-09-13  8:09         ` Matthias Brugger
2019-09-13  8:50           ` Stefan Wahren
2019-09-13  9:25             ` Matthias Brugger [this message]
2019-09-13 10:08               ` Stefan Wahren
2019-09-13 10:39                 ` Matthias Brugger

Reply instructions:

You may reply publically 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=2fcc5ad6-fa90-6565-e75c-d20b46965733@suse.com \
    --to=mbrugger@suse.com \
    --cc=catalin.marinas@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=marc.zyngier@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=nsaenzjulienne@suse.de \
    --cc=phill@raspberrypi.org \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=wahrenst@gmx.net \
    --cc=will@kernel.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: link

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org infradead-linux-riscv@archiver.kernel.org
	public-inbox-index linux-riscv


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/ public-inbox