mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
MALI: mali400: Fix all compile errors under kernel 5.10
Change-Id: Iee1e5bc609e703de0c1e7c1f781ba7059c4aa6ae Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
This commit is contained in:
@@ -177,11 +177,7 @@ static void mali_miscdevice_unregister(void);
|
||||
|
||||
static int mali_open(struct inode *inode, struct file *filp);
|
||||
static int mali_release(struct inode *inode, struct file *filp);
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
static long mali_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
|
||||
#else
|
||||
static int mali_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
|
||||
#endif
|
||||
|
||||
static int mali_probe(struct platform_device *pdev);
|
||||
static int mali_remove(struct platform_device *pdev);
|
||||
@@ -275,11 +271,7 @@ struct file_operations mali_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = mali_open,
|
||||
.release = mali_release,
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
.unlocked_ioctl = mali_ioctl,
|
||||
#else
|
||||
.ioctl = mali_ioctl,
|
||||
#endif
|
||||
.compat_ioctl = mali_ioctl,
|
||||
.mmap = mali_mmap
|
||||
};
|
||||
@@ -917,20 +909,11 @@ int map_errcode(_mali_osk_errcode_t err)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_UNLOCKED_IOCTL
|
||||
static long mali_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
#else
|
||||
static int mali_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
#endif
|
||||
{
|
||||
int err;
|
||||
struct mali_session_data *session_data;
|
||||
|
||||
#ifndef HAVE_UNLOCKED_IOCTL
|
||||
/* inode not used */
|
||||
(void)inode;
|
||||
#endif
|
||||
|
||||
MALI_DEBUG_PRINT(7, ("Ioctl received 0x%08X 0x%08lX\n", cmd, arg));
|
||||
|
||||
session_data = (struct mali_session_data *)filp->private_data;
|
||||
|
||||
@@ -57,7 +57,7 @@ static void mali_mem_vma_close(struct vm_area_struct *vma)
|
||||
vma->vm_private_data = NULL;
|
||||
}
|
||||
|
||||
static int mali_mem_vma_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t mali_mem_vma_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
mali_mem_allocation *alloc = (mali_mem_allocation *)vma->vm_private_data;
|
||||
|
||||
@@ -309,7 +309,7 @@ int mali_mem_block_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *v
|
||||
|
||||
list_for_each_entry(m_page, &block_mem->pfns, list) {
|
||||
MALI_DEBUG_ASSERT(m_page->type == MALI_PAGE_NODE_BLOCK);
|
||||
ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
|
||||
ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
return -EFAULT;
|
||||
|
||||
@@ -529,10 +529,10 @@ int mali_mem_cow_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma
|
||||
|
||||
list_for_each_entry(m_page, &cow->pages, list) {
|
||||
/* We should use vm_insert_page, but it does a dcache
|
||||
* flush which makes it way slower than remap_pfn_range or vm_insert_pfn.
|
||||
* flush which makes it way slower than remap_pfn_range or vmf_insert_pfn.
|
||||
ret = vm_insert_page(vma, addr, page);
|
||||
*/
|
||||
ret = vm_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
|
||||
ret = vmf_insert_pfn(vma, addr, _mali_page_node_get_pfn(m_page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
return ret;
|
||||
@@ -569,7 +569,7 @@ _mali_osk_errcode_t mali_mem_cow_cpu_map_pages_locked(mali_mem_backend *mem_bken
|
||||
|
||||
list_for_each_entry(m_page, &cow->pages, list) {
|
||||
if ((count >= offset) && (count < offset + num)) {
|
||||
ret = vm_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
|
||||
ret = vmf_insert_pfn(vma, vaddr, _mali_page_node_get_pfn(m_page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
if (count == offset) {
|
||||
|
||||
@@ -361,11 +361,11 @@ int mali_mem_os_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *vma)
|
||||
|
||||
list_for_each_entry(m_page, &os_mem->pages, list) {
|
||||
/* We should use vm_insert_page, but it does a dcache
|
||||
* flush which makes it way slower than remap_pfn_range or vm_insert_pfn.
|
||||
* flush which makes it way slower than remap_pfn_range or vmf_insert_pfn.
|
||||
ret = vm_insert_page(vma, addr, page);
|
||||
*/
|
||||
page = m_page->page;
|
||||
ret = vm_insert_pfn(vma, addr, page_to_pfn(page));
|
||||
ret = vmf_insert_pfn(vma, addr, page_to_pfn(page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
return -EFAULT;
|
||||
@@ -403,7 +403,7 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken
|
||||
|
||||
vm_end -= _MALI_OSK_MALI_PAGE_SIZE;
|
||||
if (mapping_page_num > 0) {
|
||||
ret = vm_insert_pfn(vma, vm_end, page_to_pfn(m_page->page));
|
||||
ret = vmf_insert_pfn(vma, vm_end, page_to_pfn(m_page->page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
/*will return -EBUSY If the page has already been mapped into table, but it's OK*/
|
||||
@@ -426,7 +426,7 @@ _mali_osk_errcode_t mali_mem_os_resize_cpu_map_locked(mali_mem_backend *mem_bken
|
||||
list_for_each_entry(m_page, &os_mem->pages, list) {
|
||||
if (count >= offset) {
|
||||
|
||||
ret = vm_insert_pfn(vma, vstart, page_to_pfn(m_page->page));
|
||||
ret = vmf_insert_pfn(vma, vstart, page_to_pfn(m_page->page));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
/*will return -EBUSY If the page has already been mapped into table, but it's OK*/
|
||||
|
||||
@@ -129,7 +129,7 @@ int mali_mem_secure_cpu_map(mali_mem_backend *mem_bkend, struct vm_area_struct *
|
||||
MALI_DEBUG_ASSERT(0 == size % _MALI_OSK_MALI_PAGE_SIZE);
|
||||
|
||||
for (j = 0; j < size / _MALI_OSK_MALI_PAGE_SIZE; j++) {
|
||||
ret = vm_insert_pfn(vma, addr, PFN_DOWN(phys));
|
||||
ret = vmf_insert_pfn(vma, addr, PFN_DOWN(phys));
|
||||
|
||||
if (unlikely(0 != ret)) {
|
||||
return -EFAULT;
|
||||
|
||||
@@ -46,14 +46,14 @@ void _mali_osk_time_ubusydelay(u32 usecs)
|
||||
|
||||
u64 _mali_osk_time_get_ns(void)
|
||||
{
|
||||
struct timespec tsval;
|
||||
getnstimeofday(&tsval);
|
||||
return (u64)timespec_to_ns(&tsval);
|
||||
struct timespec64 tsval;
|
||||
ktime_get_real_ts64(&tsval);
|
||||
return (u64)timespec64_to_ns(&tsval);
|
||||
}
|
||||
|
||||
u64 _mali_osk_boot_time_get_ns(void)
|
||||
{
|
||||
struct timespec tsval;
|
||||
get_monotonic_boottime(&tsval);
|
||||
return (u64)timespec_to_ns(&tsval);
|
||||
struct timespec64 tsval;
|
||||
ktime_get_boottime_ts64(&tsval);
|
||||
return (u64)timespec64_to_ns(&tsval);
|
||||
}
|
||||
|
||||
@@ -202,8 +202,8 @@ int mem_write_safe_wrapper(struct mali_session_data *session_data, _mali_uk_mem_
|
||||
kargs.ctx = (uintptr_t)session_data;
|
||||
|
||||
/* Check if we can access the buffers */
|
||||
if (!access_ok(VERIFY_WRITE, (const void *)(uintptr_t)kargs.dest, kargs.size) ||
|
||||
!access_ok(VERIFY_READ, (const void *)(uintptr_t)kargs.src, kargs.size)) {
|
||||
if (!access_ok((const void *)(uintptr_t)kargs.dest, kargs.size) ||
|
||||
!access_ok((const void *)(uintptr_t)kargs.src, kargs.size)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ int mem_dump_mmu_page_table_wrapper(struct mali_session_data *session_data, _mal
|
||||
goto err_exit;
|
||||
|
||||
user_buffer = (void __user *)(uintptr_t)kargs.buffer;
|
||||
if (!access_ok(VERIFY_WRITE, user_buffer, kargs.size))
|
||||
if (!access_ok(user_buffer, kargs.size))
|
||||
goto err_exit;
|
||||
|
||||
/* allocate temporary buffer (kernel side) to store mmu page table info */
|
||||
|
||||
@@ -223,7 +223,7 @@ void _ump_osk_msync(ump_dd_mem *mem, void *virt, u32 offset, u32 size, ump_uk_ms
|
||||
|
||||
/* Flush L1 using virtual address, the entire range in one go.
|
||||
* Only flush if user space process has a valid write mapping on given address. */
|
||||
if ((mem) && (virt != NULL) && (access_ok(VERIFY_WRITE, virt, size))) {
|
||||
if ((mem) && (virt != NULL) && (access_ok(virt, size))) {
|
||||
__cpuc_flush_dcache_area(virt, size);
|
||||
DBG_MSG(3, ("UMP[%02u] Flushing CPU L1 Cache. CPU address: %x, size: %x\n", mem->secure_id, virt, size));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user