Thread (7 messages) 7 messages, 3 authors, 2020-06-05

Re: [PATCH] iommu/mediatek: Use totalram_pages to setup enable_4GB

From: David Hildenbrand <hidden>
Date: 2020-06-05 12:52:45
Also in: linux-iommu, linux-mediatek, lkml

On 04.06.20 17:27, David Hildenbrand wrote:
On 04.06.20 17:06, Christoph Hellwig wrote:
quoted
On Thu, Jun 04, 2020 at 01:32:40PM +0200, David Hildenbrand wrote:
quoted
Just a thought: If memory hotplug is applicable as well, you might
either want to always assume data->enable_4GB, or handle memory hotplug
events from the memory notifier, when new memory gets onlined (not sure
how tricky that is).
We probably want a highest_pfn_possible() or similar API instead of
having drivers poking into random VM internals.
Well, memory notifiers are a reasonable api used accross the kernel to
get notified when new memory is onlined to the buddy that could be used
for allocations.

highest_pfn_possible() would have to default to something linked to
MAX_PHYSMEM_BITS whenever memory hotplug is configured, I am not sure
how helpful that is (IOW, you can just default to enable_4GB=true in
that case instead in most cases).
Correction: At least on x86-64 we have max_possible_pfn, which will
consult the ACPI SRAT table to figure out the maximum possible PFN.
(Without SRAT, max_possible_pfn will point at the end of initial boot
memory and not consider hotplug memory - something that e.g., newer QEMU
versions work around by creating SRAT tables if memory hotplug might be
possible, even if there is no actual NUMA configuration).

pci-swiotlb.c similarly relies on that to figure out if there are any
!DMA addresses to handle.

-- 
Thanks,

David / dhildenb


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help