[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3a1480f7-7fd6-247c-73a2-f761f9ce3362@huawei.com>
Date: Wed, 28 Oct 2020 19:08:53 +0800
From: Hanjun Guo <guohanjun@...wei.com>
To: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
<robh+dt@...nel.org>, <catalin.marinas@....com>, <hch@....de>,
<ardb@...nel.org>, <linux-kernel@...r.kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Sudeep Holla <sudeep.holla@....com>
CC: <robin.murphy@....com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-rpi-kernel@...ts.infradead.org>, <jeremy.linton@....com>,
<iommu@...ts.linux-foundation.org>, <devicetree@...r.kernel.org>,
<will@...nel.org>, Anshuman Khandual <anshuman.khandual@....com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>, <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH v4 6/7] arm64: mm: Set ZONE_DMA size based on early IORT
scan
On 2020/10/21 20:34, Nicolas Saenz Julienne wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> We recently introduced a 1 GB sized ZONE_DMA to cater for platforms
> incorporating masters that can address less than 32 bits of DMA, in
> particular the Raspberry Pi 4, which has 4 or 8 GB of DRAM, but has
> peripherals that can only address up to 1 GB (and its PCIe host
> bridge can only access the bottom 3 GB)
>
> Instructing the DMA layer about these limitations is straight-forward,
> even though we had to fix some issues regarding memory limits set in
> the IORT for named components, and regarding the handling of ACPI _DMA
> methods. However, the DMA layer also needs to be able to allocate
> memory that is guaranteed to meet those DMA constraints, for bounce
> buffering as well as allocating the backing for consistent mappings.
>
> This is why the 1 GB ZONE_DMA was introduced recently. Unfortunately,
> it turns out the having a 1 GB ZONE_DMA as well as a ZONE_DMA32 causes
> problems with kdump, and potentially in other places where allocations
> cannot cross zone boundaries. Therefore, we should avoid having two
> separate DMA zones when possible.
>
> So let's do an early scan of the IORT, and only create the ZONE_DMA
> if we encounter any devices that need it. This puts the burden on
> the firmware to describe such limitations in the IORT, which may be
> redundant (and less precise) if _DMA methods are also being provided.
> However, it should be noted that this situation is highly unusual for
> arm64 ACPI machines. Also, the DMA subsystem still gives precedence to
> the _DMA method if implemented, and so we will not lose the ability to
> perform streaming DMA outside the ZONE_DMA if the _DMA method permits
> it.
>
> Cc: Jeremy Linton <jeremy.linton@....com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
> Cc: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
> Cc: Rob Herring <robh+dt@...nel.org>
> Cc: Christoph Hellwig <hch@....de>
> Cc: Robin Murphy <robin.murphy@....com>
> Cc: Hanjun Guo <guohanjun@...wei.com>
> Cc: Sudeep Holla <sudeep.holla@....com>
> Cc: Anshuman Khandual <anshuman.khandual@....com>
> Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
> [nsaenz: Rebased, removed documentation change and add declaration in acpi_iort.h]
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
>
> ---
>
> Changes since v3:
> - Use min_not_zero()
> - Check ACPI revision
> - Remove unnecessary #ifdef in zone_sizes_init()
>
> arch/arm64/mm/init.c | 3 ++-
> drivers/acpi/arm64/iort.c | 52 +++++++++++++++++++++++++++++++++++++++
> include/linux/acpi_iort.h | 4 +++
Acked-by: Hanjun Guo <guohanjun@...wei.com>
Powered by blists - more mailing lists