mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00

ioremap_prot() currently accepts pgprot_val parameter as an unsigned long, thus implicitly assuming that pgprot_val and pgprot_t could never be bigger than unsigned long. But this assumption soon will not be true on arm64 when using D128 pgtables. In 128 bit page table configuration, unsigned long is 64 bit, but pgprot_t is 128 bit. Passing platform abstracted pgprot_t argument is better as compared to size based data types. Let's change the parameter to directly pass pgprot_t like another similar helper generic_ioremap_prot(). Without this change in place, D128 configuration does not work on arm64 as the top 64 bits gets silently stripped when passing the protection value to this function. Link: https://lkml.kernel.org/r/20250218101954.415331-1-anshuman.khandual@arm.com Signed-off-by: Ryan Roberts <ryan.roberts@arm.com> Co-developed-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64] Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
36 lines
808 B
C
36 lines
808 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* ioremap implementation.
|
|
*
|
|
* Copyright (C) 2015 Cadence Design Systems Inc.
|
|
*/
|
|
|
|
#include <linux/io.h>
|
|
#include <linux/pgtable.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/io.h>
|
|
|
|
void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
|
|
pgprot_t prot)
|
|
{
|
|
unsigned long pfn = __phys_to_pfn((phys_addr));
|
|
WARN_ON(pfn_valid(pfn));
|
|
|
|
return generic_ioremap_prot(phys_addr, size, prot);
|
|
}
|
|
EXPORT_SYMBOL(ioremap_prot);
|
|
|
|
void iounmap(volatile void __iomem *addr)
|
|
{
|
|
unsigned long va = (unsigned long) addr;
|
|
|
|
if ((va >= XCHAL_KIO_CACHED_VADDR &&
|
|
va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) ||
|
|
(va >= XCHAL_KIO_BYPASS_VADDR &&
|
|
va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
|
|
return;
|
|
|
|
generic_iounmap(addr);
|
|
}
|
|
EXPORT_SYMBOL(iounmap);
|