From 08f87f769b595151be1afeff53e144f543faa614 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 06 Dec 2023 09:51:13 +0000 Subject: [PATCH] add dts config --- kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_lowlevel.h | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_lowlevel.h b/kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_lowlevel.h index 3f260bf..5a1bb16 100644 --- a/kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_lowlevel.h +++ b/kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_lowlevel.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * - * (C) COPYRIGHT 2012-2014, 2016-2018, 2020-2021 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2012-2014, 2016-2018, 2020-2022 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -47,6 +47,8 @@ #define HUGE_PAGE (1u << 0) #define HUGE_HEAD (1u << 1) #define FROM_PARTIAL (1u << 2) + +#define NUM_4K_PAGES_IN_2MB_PAGE (SZ_2M / SZ_4K) /* * Note: if macro for converting physical address to page is not defined @@ -158,4 +160,20 @@ return t.tagged_addr & FROM_PARTIAL; } +/** + * index_in_large_page() - Get index of a 4KB page within a 2MB page which + * wasn't split to be used partially. + * + * @t: Tagged physical address of the physical 4KB page that lies within + * the large (or 2 MB) physical page. + * + * Return: Index of the 4KB page within a 2MB page + */ +static inline unsigned int index_in_large_page(struct tagged_addr t) +{ + WARN_ON(!is_huge(t)); + + return (PFN_DOWN(as_phys_addr_t(t)) & (NUM_4K_PAGES_IN_2MB_PAGE - 1)); +} + #endif /* _KBASE_LOWLEVEL_H */ -- Gitblit v1.6.2