From patchwork Sat May 30 06:55:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209682 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C742AC433DF for ; Sat, 30 May 2020 06:56:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87D07208E4 for ; Sat, 30 May 2020 06:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821766; bh=WsVvzi9uhfGTujCG9iTqmDUj8mx9b/KZJKhMGHKz6B4=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=BHxLi3ktTfryJS0oSzhGHeQYZnI1fz8NvjtXNfQ9xyV06wPExM8r5Q6qFooPpJISk KVjYCzaO+5COmHavQrh4LsVX0DPT7/yr4KpFIs10KBNBMbhiRtKCQ5SHIzataQh6HH 8AlWY6xddaDhGHXYEsJMJiIYwZlzU+qZ8oSfMZts= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728817AbgE3G4F (ORCPT ); Sat, 30 May 2020 02:56:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:44410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728657AbgE3G4E (ORCPT ); Sat, 30 May 2020 02:56:04 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA93C207D0; Sat, 30 May 2020 06:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=WsVvzi9uhfGTujCG9iTqmDUj8mx9b/KZJKhMGHKz6B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHzLNrcVaF9hzkNLC388lrYXoTWcCblm8QwjP2JkF7YyC1pNE1IX7VtErGQg4+760 rs/zTXaKUwF8nT2GP8TsJauhgQ/CCyeOEiSyF8ikUUvOigKQK0jU3dqmK90IbQDxuC 56OW4BXT/at8yV5kvmfAF3x+Vq9NdtjPfus8LePk= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPU-001hoE-I0; Sat, 30 May 2020 08:56:00 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH v2 02/41] media: atomisp: get rid of the hrt/hive_isp_css_mm_hrt abstraction layer Date: Sat, 30 May 2020 08:55:19 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Simplify the code by removing this extra memory management abstraction layer. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/Makefile | 1 - .../staging/media/atomisp/pci/atomisp_acc.c | 24 ++++--- .../staging/media/atomisp/pci/atomisp_cmd.c | 2 +- .../media/atomisp/pci/atomisp_compat.h | 2 +- .../media/atomisp/pci/atomisp_compat_css20.c | 6 +- .../staging/media/atomisp/pci/atomisp_fops.c | 2 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 7 +- .../staging/media/atomisp/pci/atomisp_v4l2.c | 2 - .../memory_access/memory_access.h | 2 +- .../atomisp/pci/hrt/hive_isp_css_mm_hrt.c | 71 ------------------- .../atomisp/pci/hrt/hive_isp_css_mm_hrt.h | 45 ------------ .../media/atomisp/pci/ia_css_frame_public.h | 2 +- .../media/atomisp/pci/ia_css_memory_access.c | 43 ++++++----- .../atomisp/pci/runtime/frame/src/frame.c | 4 +- 14 files changed, 50 insertions(+), 163 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.c delete mode 100644 drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.h diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index b48eb7946a58..889227dcebfe 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -53,7 +53,6 @@ atomisp-objs += \ pci/hmm/hmm_dynamic_pool.o \ pci/hmm/hmm.o \ pci/hmm/hmm_reserved_pool.o \ - pci/hrt/hive_isp_css_mm_hrt.o \ pci/ia_css_device_access.o \ pci/ia_css_memory_access.o \ pci/isp/kernels/aa/aa_2/ia_css_aa2.host.o \ diff --git a/drivers/staging/media/atomisp/pci/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp_acc.c index bb1f60fab786..5e7f4cd47c8f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_acc.c +++ b/drivers/staging/media/atomisp/pci/atomisp_acc.c @@ -28,7 +28,6 @@ #include "atomisp_compat.h" #include "atomisp_cmd.h" -#include "hrt/hive_isp_css_mm_hrt.h" #include "memory_access/memory_access.h" #include "ia_css.h" @@ -353,16 +352,23 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, struct atomisp_acc_map *map) } pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE); - cssptr = hrt_isp_css_mm_alloc_user_ptr(map->length, - map->user_ptr, - pgnr, - (map->flags & ATOMISP_MAP_FLAG_CACHED)); + if (pgnr < ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is less than the expected size..\n"); + return -ENOMEM; + } else if (pgnr > ((PAGE_ALIGN(map->length)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is large than the expected size..\n"); + return -ENOMEM; + } + + cssptr = hmm_alloc(map->length, HMM_BO_USER, 0, map->user_ptr, + map->flags & ATOMISP_MAP_FLAG_CACHED); + } else { /* Allocate private buffer. */ - if (map->flags & ATOMISP_MAP_FLAG_CACHED) - cssptr = hrt_isp_css_mm_calloc_cached(map->length); - else - cssptr = hrt_isp_css_mm_calloc(map->length); + cssptr = hmm_alloc(map->length, HMM_BO_PRIVATE, 0, NULL, + map->flags & ATOMISP_MAP_FLAG_CACHED); } if (!cssptr) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 900f1ccc25fe..4913469df2bb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -44,7 +44,7 @@ #include "atomisp_subdev.h" #include "atomisp_dfs_tables.h" -#include "hrt/hive_isp_css_mm_hrt.h" +#include #include "sh_css_hrt.h" #include "sh_css_defs.h" diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h index 8847e104bb65..8693f228a875 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h @@ -261,7 +261,7 @@ void atomisp_css_frame_free(struct ia_css_frame *frame); int atomisp_css_frame_map(struct ia_css_frame **frame, const struct ia_css_frame_info *info, const void __user *data, uint16_t attribute, - void *context); + unsigned int pgnr); int atomisp_css_set_black_frame(struct atomisp_sub_device *asd, const struct ia_css_frame *raw_black_frame); diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index f1798b473dbd..f39b0ad85cfa 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -32,8 +32,6 @@ #include "atomisp_ioctl.h" #include "atomisp_acc.h" -#include "hrt/hive_isp_css_mm_hrt.h" - #include #include "ia_css_debug.h" @@ -2187,9 +2185,9 @@ void atomisp_css_frame_free(struct ia_css_frame *frame) int atomisp_css_frame_map(struct ia_css_frame **frame, const struct ia_css_frame_info *info, const void __user *data, uint16_t attribute, - void *context) + unsigned int pgnr) { - if (ia_css_frame_map(frame, info, data, attribute, context) + if (ia_css_frame_map(frame, info, data, attribute, pgnr) != IA_CSS_SUCCESS) return -ENOMEM; diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 0ed1142e69fc..fc3043bded46 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -34,8 +34,6 @@ #include "atomisp-regs.h" #include "hmm/hmm.h" -#include "hrt/hive_isp_css_mm_hrt.h" - #include "type_support.h" #include "device_access/device_access.h" #include "memory_access/memory_access.h" diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 8aea90ecd508..8783d4b59f6d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -39,8 +39,6 @@ #include "device_access.h" #include "irq.h" -#include "hrt/hive_isp_css_mm_hrt.h" - static const char *DRIVER = "atomisp"; /* max size 15 */ static const char *CARD = "ATOM ISP"; /* max size 31 */ @@ -1183,8 +1181,6 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) * address and reprograme out page table properly */ if (buf->memory == V4L2_MEMORY_USERPTR) { - struct hrt_userbuffer_attr attributes; - vb = pipe->capq.bufs[buf->index]; vm_mem = vb->priv; if (!vm_mem) { @@ -1204,10 +1200,9 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) goto error; } - attributes.pgnr = pgnr; ret = atomisp_css_frame_map(&handle, &frame_info, (void __user *)buf->m.userptr, - 0, &attributes); + 0, pgnr); if (ret) { dev_err(isp->dev, "Failed to map user buffer\n"); goto error; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 5dc84c45965c..d795fe49130c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -42,8 +42,6 @@ #include "hmm/hmm.h" #include "atomisp_trace_event.h" -#include "hrt/hive_isp_css_mm_hrt.h" - #include "device_access.h" /* Timeouts to wait for all subdevs to be registered */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h index dc63ff0c9c6a..cdba741dfdf2 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h @@ -140,7 +140,7 @@ hrt_vaddress mmgr_mmap( const void __user *ptr, const size_t size, u16 attribute, - void *context); + unsigned int pgnr); /*! Zero initialise an allocation in memory diff --git a/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.c b/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.c deleted file mode 100644 index 14e02fd76ddf..000000000000 --- a/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Support for Medifield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ - -#include "atomisp_internal.h" - -#include "hive_isp_css_mm_hrt.h" -#include "hmm/hmm.h" - -#define __page_align(size) (((size) + (PAGE_SIZE - 1)) & (~(PAGE_SIZE - 1))) - -ia_css_ptr hrt_isp_css_mm_alloc(size_t bytes) -{ - return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, NULL, false); -} - -ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, - const void __user *userptr, - unsigned int num_pages, - bool cached) -{ - if (num_pages < ((__page_align(bytes)) >> PAGE_SHIFT)) - dev_err(atomisp_dev, - "user space memory size is less than the expected size..\n"); - else if (num_pages > ((__page_align(bytes)) - >> PAGE_SHIFT)) - dev_err(atomisp_dev, - "user space memory size is large than the expected size..\n"); - - return hmm_alloc(bytes, HMM_BO_USER, 0, - userptr, cached); -} - -ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes) -{ - return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, NULL, - HMM_CACHED); -} - -ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes) -{ - ia_css_ptr ptr = hrt_isp_css_mm_alloc(bytes); - - if (ptr) - hmm_set(ptr, 0, bytes); - return ptr; -} - -ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes) -{ - ia_css_ptr ptr = hrt_isp_css_mm_alloc_cached(bytes); - - if (ptr) - hmm_set(ptr, 0, bytes); - return ptr; -} diff --git a/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.h b/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.h deleted file mode 100644 index e4c90c268c42..000000000000 --- a/drivers/staging/media/atomisp/pci/hrt/hive_isp_css_mm_hrt.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Support for Medfield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ - -#ifndef _hive_isp_css_mm_hrt_h_ -#define _hive_isp_css_mm_hrt_h_ - -#include -#include - -#define HRT_BUF_FLAG_CACHED BIT(0) - -struct hrt_userbuffer_attr { - unsigned int pgnr; -}; - -/* Allocate memory, returns a virtual address */ -ia_css_ptr hrt_isp_css_mm_alloc(size_t bytes); -ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, - const void __user *userptr, - unsigned int num_pages, - bool cached); -ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes); - -/* allocate memory and initialize with zeros, - returns a virtual address */ -ia_css_ptr hrt_isp_css_mm_calloc(size_t bytes); -ia_css_ptr hrt_isp_css_mm_calloc_cached(size_t bytes); - -#endif /* _hive_isp_css_mm_hrt_h_ */ diff --git a/drivers/staging/media/atomisp/pci/ia_css_frame_public.h b/drivers/staging/media/atomisp/pci/ia_css_frame_public.h index 69e9143e5418..ac7ed6c2e6fd 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_frame_public.h +++ b/drivers/staging/media/atomisp/pci/ia_css_frame_public.h @@ -336,7 +336,7 @@ ia_css_frame_map(struct ia_css_frame **frame, const struct ia_css_frame_info *info, const void __user *data, u16 attribute, - void *context); + unsigned int pgnr); /* @brief Unmap a CSS frame structure. * diff --git a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c index 6084d54acac3..ae9d453aed00 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c +++ b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c @@ -17,7 +17,8 @@ #include #include #include -#include + +#include "atomisp_internal.h" const hrt_vaddress mmgr_NULL = (hrt_vaddress)0; const hrt_vaddress mmgr_EXCEPTION = (hrt_vaddress)-1; @@ -31,20 +32,20 @@ mmgr_malloc(const size_t size) hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attrs) { u16 masked_attrs = attrs & MMGR_ATTRIBUTE_MASK; + ia_css_ptr data; WARN_ON(attrs & MMGR_ATTRIBUTE_CONTIGUOUS); - if (masked_attrs & MMGR_ATTRIBUTE_CLEARED) { - if (masked_attrs & MMGR_ATTRIBUTE_CACHED) - return (ia_css_ptr) hrt_isp_css_mm_calloc_cached(size); - else - return (ia_css_ptr) hrt_isp_css_mm_calloc(size); - } else { - if (masked_attrs & MMGR_ATTRIBUTE_CACHED) - return (ia_css_ptr) hrt_isp_css_mm_alloc_cached(size); - else - return (ia_css_ptr) hrt_isp_css_mm_alloc(size); - } + data = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, + masked_attrs & MMGR_ATTRIBUTE_CACHED); + + if (!data) + return 0; + + if (masked_attrs & MMGR_ATTRIBUTE_CLEARED) + hmm_set(data, 0, size); + + return (ia_css_ptr)data; } hrt_vaddress @@ -74,11 +75,19 @@ mmgr_store(const hrt_vaddress vaddr, const void *data, const size_t size) hrt_vaddress mmgr_mmap(const void __user *ptr, const size_t size, - u16 attribute, void *context) + u16 attribute, unsigned int pgnr) { - struct hrt_userbuffer_attr *userbuffer_attr = context; + if (pgnr < ((PAGE_ALIGN(size)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is less than the expected size..\n"); + return -ENOMEM; + } else if (pgnr > ((PAGE_ALIGN(size)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is large than the expected size..\n"); + return -ENOMEM; + } + + return hmm_alloc(size, HMM_BO_USER, 0, ptr, + attribute & MMGR_ATTRIBUTE_CACHED); - return hrt_isp_css_mm_alloc_user_ptr( - size, ptr, userbuffer_attr->pgnr, - attribute & HRT_BUF_FLAG_CACHED); } diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c index fcd8b06034f2..0c1e30f2923b 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c @@ -152,7 +152,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, const struct ia_css_frame_info *info, const void __user *data, u16 attribute, - void *context) + unsigned int pgnr) { enum ia_css_err err = IA_CSS_SUCCESS; struct ia_css_frame *me; @@ -169,7 +169,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, /* use mmgr_mmap to map */ me->data = (ia_css_ptr) mmgr_mmap(data, me->data_bytes, - attribute, context); + attribute, pgnr); if (me->data == mmgr_NULL) err = IA_CSS_ERR_INVALID_ARGUMENTS; } From patchwork Sat May 30 06:55:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B2C7C433E0 for ; Sat, 30 May 2020 06:59:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B8D8207D0 for ; Sat, 30 May 2020 06:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821988; bh=uCGANdPlGKLqUwt0nywQxGLZo+IJxAKCxL9fgIL/EVo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=PuY3GiNX8j4Ywl+MBzzc47KV9Z/4kNy1B9YeN2Pdi4NBl9nugAihEz9kDPXK3OXLx peJ7HJCNmP42ujrC+iq1Xp94uAxVyj0UaUgnOmMyGitVPTI+JL886Mv6ucX2ViJt5k nkoOA9Y+hDaroh7Q2szlFBv5JLvMVj/y4Iv/b4gc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgE3G4F (ORCPT ); Sat, 30 May 2020 02:56:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:44330 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728404AbgE3G4D (ORCPT ); Sat, 30 May 2020 02:56:03 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B7B1B207F9; Sat, 30 May 2020 06:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821762; bh=uCGANdPlGKLqUwt0nywQxGLZo+IJxAKCxL9fgIL/EVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xoZ7CCo2QrhBLZQSFKTqRfQAYzqMElgBjJ3arLPg9yziozBynjvP2yk3AoMoy7P8l NToIHkmqGfxxhPqLQHb3RIcFfmTV89uM9Z+0+IctBBzJQIcp5t8fXL0Eb1eUK7KhoS uehWBG9nPunOI4WH/LZpA2xplmHZPvwKkI0C47jU= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPU-001hoM-LF; Sat, 30 May 2020 08:56:00 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/41] media: atomisp: go one step further to drop ia_css_memory_access.c Date: Sat, 30 May 2020 08:55:21 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move the attrs handling into hmm, simplifying even further what the ia_css_memory_access.c file does. Yet, the returned type for ia_css_memory_access.c is an integer, instead of a pointer. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/include/hmm/hmm.h | 3 ++- .../media/atomisp/include/linux/atomisp.h | 2 ++ .../memory_access/memory_access.h | 3 --- drivers/staging/media/atomisp/pci/hmm/hmm.c | 11 ++++++++-- .../media/atomisp/pci/ia_css_memory_access.c | 21 +------------------ .../atomisp/pci/runtime/frame/src/frame.c | 4 ++-- .../staging/media/atomisp/pci/sh_css_params.c | 8 +++---- 7 files changed, 20 insertions(+), 32 deletions(-) diff --git a/drivers/staging/media/atomisp/include/hmm/hmm.h b/drivers/staging/media/atomisp/include/hmm/hmm.h index e2149b16c9fd..a661c039a2cc 100644 --- a/drivers/staging/media/atomisp/include/hmm/hmm.h +++ b/drivers/staging/media/atomisp/include/hmm/hmm.h @@ -35,7 +35,8 @@ int hmm_init(void); void hmm_cleanup(void); ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, - int from_highmem, const void __user *userptr, bool cached); + int from_highmem, const void __user *userptr, + const uint16_t attrs); void hmm_free(ia_css_ptr ptr); int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes); int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes); diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index e9670749bae0..fc2e76694613 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -917,6 +917,8 @@ struct atomisp_acc_map { #define ATOMISP_MAP_FLAG_NOFLUSH 0x0001 /* Do not flush cache */ #define ATOMISP_MAP_FLAG_CACHED 0x0002 /* Enable cache */ +#define ATOMISP_MAP_FLAG_CONTIGUOUS 0x0004 +#define ATOMISP_MAP_FLAG_CLEARED 0x0008 struct atomisp_acc_state { __u32 flags; /* Flags, see list below */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h index c8a41e5d8dab..19b9083995a4 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h @@ -76,9 +76,6 @@ * within the allocation referencable from the * returned pointer/address. */ -#define MMGR_ATTRIBUTE_CACHED 0x0001 -#define MMGR_ATTRIBUTE_CONTIGUOUS 0x0002 -#define MMGR_ATTRIBUTE_CLEARED 0x0008 #define mmgr_NULL ((hrt_vaddress)0) #define mmgr_EXCEPTION ((hrt_vaddress)-1) diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c index 975749d67131..68dab2393767 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c @@ -193,7 +193,7 @@ int hmm_init(void) * at the beginning, to avoid hmm_alloc return 0 in the * further allocation. */ - dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, false); + dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, 0); if (!ret) { ret = sysfs_create_group(&atomisp_dev->kobj, @@ -219,12 +219,16 @@ void hmm_cleanup(void) } ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, - int from_highmem, const void __user *userptr, bool cached) + int from_highmem, const void __user *userptr, + const uint16_t attrs) { unsigned int pgnr; struct hmm_buffer_object *bo; + bool cached = attrs & ATOMISP_MAP_FLAG_CACHED; int ret; + WARN_ON(attrs & ATOMISP_MAP_FLAG_CONTIGUOUS); + /* * Check if we are initialized. In the ideal world we wouldn't need * this but we can tackle it once the driver is a lot cleaner @@ -258,6 +262,9 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, hmm_mem_stat.tol_cnt += pgnr; + if (attrs & ATOMISP_MAP_FLAG_CLEARED) + hmm_set(bo->start, 0, bytes); + return bo->start; bind_err: diff --git a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c index d11843a717e0..e19b98fe7201 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c +++ b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c @@ -12,30 +12,11 @@ * more details. */ -#include -#include -#include #include -#include - -#include "atomisp_internal.h" hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attrs) { - ia_css_ptr data; - - WARN_ON(attrs & MMGR_ATTRIBUTE_CONTIGUOUS); - - data = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, - attrs & MMGR_ATTRIBUTE_CACHED); - - if (!data) - return 0; - - if (attrs & MMGR_ATTRIBUTE_CLEARED) - hmm_set(data, 0, size); - - return (ia_css_ptr)data; + return hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, attrs); } void mmgr_load(const hrt_vaddress vaddr, void *data, const size_t size) diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c index 75edd79b7968..9a9c1fffd3d9 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c @@ -178,7 +178,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, } return hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, - attribute & MMGR_ATTRIBUTE_CACHED); + attribute & ATOMISP_MAP_FLAG_CACHED); if (me->data == mmgr_NULL) err = IA_CSS_ERR_INVALID_ARGUMENTS; @@ -799,7 +799,7 @@ static enum ia_css_err frame_allocate_buffer_data(struct ia_css_frame *frame) #endif frame->data = mmgr_alloc_attr(frame->data_bytes, frame->contiguous ? - MMGR_ATTRIBUTE_CONTIGUOUS : 0); + ATOMISP_MAP_FLAG_CONTIGUOUS : 0); if (frame->data == mmgr_NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index 0a59ef0d4bce..00388e563668 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -3267,11 +3267,11 @@ sh_css_params_init(void) { xmem_sp_stage_ptrs[p][i] = ia_css_refcount_increment(-1, mmgr_alloc_attr(sizeof(struct sh_css_sp_stage), - MMGR_ATTRIBUTE_CLEARED)); + ATOMISP_MAP_FLAG_CLEARED)); xmem_isp_stage_ptrs[p][i] = ia_css_refcount_increment(-1, mmgr_alloc_attr(sizeof(struct sh_css_sp_stage), - MMGR_ATTRIBUTE_CLEARED)); + ATOMISP_MAP_FLAG_CLEARED)); if ((xmem_sp_stage_ptrs[p][i] == mmgr_NULL) || (xmem_isp_stage_ptrs[p][i] == mmgr_NULL)) { @@ -3290,10 +3290,10 @@ sh_css_params_init(void) { sp_ddr_ptrs = ia_css_refcount_increment(-1, mmgr_alloc_attr(CEIL_MUL(sizeof(struct sh_css_ddr_address_map), HIVE_ISP_DDR_WORD_BYTES), - MMGR_ATTRIBUTE_CLEARED)); + ATOMISP_MAP_FLAG_CLEARED)); xmem_sp_group_ptrs = ia_css_refcount_increment(-1, mmgr_alloc_attr(sizeof(struct sh_css_sp_group), - MMGR_ATTRIBUTE_CLEARED)); + ATOMISP_MAP_FLAG_CLEARED)); if ((sp_ddr_ptrs == mmgr_NULL) || (xmem_sp_group_ptrs == mmgr_NULL)) From patchwork Sat May 30 06:55:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209670 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C157EC433DF for ; Sat, 30 May 2020 06:58:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AE82207D0 for ; Sat, 30 May 2020 06:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821921; bh=aEE6JaVbtvfsM+kgWSz0g81jthpoQk5+1Oj9iUIvzKo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=f9iemFKbRVuGhLmvh2lNjIeGrsrTop6Iuax9DTpHHcGsPJjJuy/KQG9NdzESIz8e9 dNkrUHzKE1JbelPx1Vvtu7BffTP6z89N0DPk61hFwC8cLLscWwgcHkMtXpIwkW+uPF obPcD8bn/lZ51+SzV+Ocadli5wQyje10aAGpLxj0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728930AbgE3G6j (ORCPT ); Sat, 30 May 2020 02:58:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:44862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728714AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA3B820801; Sat, 30 May 2020 06:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=aEE6JaVbtvfsM+kgWSz0g81jthpoQk5+1Oj9iUIvzKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gfkp/zaTjIvKU3IOrDrLomsA/KtR6eXAhDJsIvKbsI9pwQPiB2d2i5U98dfL+O+Bi Qx8/5tE/sovNuotEIfjlNpR/qD/GJX+vP25vk9lKKKopNQU9ccPSR7jGmYhHVjHRQl O8eHtKjNnpHctZwrzdVd0zFlWGSWhxiBaUXxx6qc= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPU-001hoQ-Mc; Sat, 30 May 2020 08:56:00 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/41] media: atomisp: get rid of mmgr_load and mmgr_store Date: Sat, 30 May 2020 08:55:22 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Those functions are just wrappers for hmm_load/hmm_store. Signed-off-by: Mauro Carvalho Chehab --- .../pci/hive_isp_css_common/host/debug.c | 8 +++--- .../hive_isp_css_common/host/debug_private.h | 8 +++--- .../memory_access/memory_access.h | 20 ------------- drivers/staging/media/atomisp/pci/hmm/hmm.c | 18 +++++++++++- .../media/atomisp/pci/ia_css_memory_access.c | 13 --------- .../kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 2 +- .../kernels/sdis/sdis_2/ia_css_sdis2.host.c | 2 +- .../pci/runtime/isp_param/src/isp_param.c | 2 +- .../pci/runtime/queue/src/queue_access.c | 8 +++--- .../atomisp/pci/runtime/spctrl/src/spctrl.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 12 ++++---- .../media/atomisp/pci/sh_css_firmware.c | 2 +- .../staging/media/atomisp/pci/sh_css_params.c | 28 +++++++++---------- 13 files changed, 54 insertions(+), 71 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c index d911aec24185..6079ca1e7732 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c @@ -48,13 +48,13 @@ void debug_buffer_ddr_init(const hrt_vaddress addr) u32 tail = 0; /* set the ddr queue */ debug_buffer_ddr_address = addr; - mmgr_store(addr + DEBUG_DATA_BUF_MODE_DDR_ADDR, + hmm_store(addr + DEBUG_DATA_BUF_MODE_DDR_ADDR, &mode, sizeof(debug_buf_mode_t)); - mmgr_store(addr + DEBUG_DATA_HEAD_DDR_ADDR, + hmm_store(addr + DEBUG_DATA_HEAD_DDR_ADDR, &head, sizeof(uint32_t)); - mmgr_store(addr + DEBUG_DATA_TAIL_DDR_ADDR, + hmm_store(addr + DEBUG_DATA_TAIL_DDR_ADDR, &tail, sizeof(uint32_t)); - mmgr_store(addr + DEBUG_DATA_ENABLE_DDR_ADDR, + hmm_store(addr + DEBUG_DATA_ENABLE_DDR_ADDR, &enable, sizeof(uint32_t)); /* set the local copy */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h index 8447e33d1c04..f2f5b7658819 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h @@ -101,22 +101,22 @@ STORAGE_CLASS_DEBUG_C void debug_synch_queue_ddr(void) { u32 remote_tail; - mmgr_load(debug_buffer_ddr_address + DEBUG_DATA_TAIL_DDR_ADDR, &remote_tail, + hmm_load(debug_buffer_ddr_address + DEBUG_DATA_TAIL_DDR_ADDR, &remote_tail, sizeof(uint32_t)); /* We could move the remote head after the upload, but we would have to limit the upload w.r.t. the local head. This is easier */ if (remote_tail > debug_data_ptr->tail) { size_t delta = remote_tail - debug_data_ptr->tail; - mmgr_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR + + hmm_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR + debug_data_ptr->tail * sizeof(uint32_t), (void *)&debug_data_ptr->buf[debug_data_ptr->tail], delta * sizeof(uint32_t)); } else if (remote_tail < debug_data_ptr->tail) { size_t delta = DEBUG_BUF_SIZE - debug_data_ptr->tail; - mmgr_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR + + hmm_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR + debug_data_ptr->tail * sizeof(uint32_t), (void *)&debug_data_ptr->buf[debug_data_ptr->tail], delta * sizeof(uint32_t)); - mmgr_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR, + hmm_load(debug_buffer_ddr_address + DEBUG_DATA_BUF_DDR_ADDR, (void *)&debug_data_ptr->buf[0], remote_tail * sizeof(uint32_t)); } /* else we are up to date */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h index 19b9083995a4..4a062ee2f8df 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h @@ -91,24 +91,4 @@ hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attribute); -/*! Read an array of bytes from a virtual memory address - - \param vaddr[in] Address of an allocation - \param data[out] pointer to the destination array - \param size[in] number of bytes to read - - \return none - */ -void mmgr_load(const hrt_vaddress vaddr, void *data, const size_t size); - -/*! Write an array of bytes to device registers or memory in the device - - \param vaddr[in] Address of an allocation - \param data[in] pointer to the source array - \param size[in] number of bytes to write - - \return none - */ -void mmgr_store(const hrt_vaddress vaddr, const void *data, const size_t size); - #endif /* __MEMORY_ACCESS_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c index 68dab2393767..5e983442ca80 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c @@ -403,9 +403,14 @@ static int load_and_flush(ia_css_ptr virt, void *data, unsigned int bytes) /* Read function in ISP memory management */ int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes) { + if (!virt) { + dev_warn(atomisp_dev, + "hmm_store: address is NULL\n"); + return -EINVAL; + } if (!data) { dev_err(atomisp_dev, - "hmm_load NULL argument\n"); + "hmm_store: data is a NULL argument\n"); return -EINVAL; } return load_and_flush(virt, data, bytes); @@ -425,6 +430,17 @@ int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes) char *src, *des; int ret; + if (!virt) { + dev_warn(atomisp_dev, + "hmm_store: address is NULL\n"); + return -EINVAL; + } + if (!data) { + dev_err(atomisp_dev, + "hmm_store: data is a NULL argument\n"); + return -EINVAL; + } + bo = hmm_bo_device_search_in_range(&bo_device, virt); ret = hmm_check_bo(bo, virt); if (ret) diff --git a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c index e19b98fe7201..8dd41ec725f4 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c +++ b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c @@ -18,16 +18,3 @@ hrt_vaddress mmgr_alloc_attr(const size_t size, const uint16_t attrs) { return hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, attrs); } - -void mmgr_load(const hrt_vaddress vaddr, void *data, const size_t size) -{ - if (vaddr && data) - hmm_load(vaddr, data, size); -} - -void -mmgr_store(const hrt_vaddress vaddr, const void *data, const size_t size) -{ - if (vaddr && data) - hmm_store(vaddr, data, size); -} diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index 827400957bad..fb0e6dcbca43 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -249,7 +249,7 @@ ia_css_get_dvs_statistics( map = ia_css_isp_dvs_statistics_map_allocate(isp_stats, NULL); if (map) { - mmgr_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); + hmm_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); ia_css_translate_dvs_statistics(host_stats, map); ia_css_isp_dvs_statistics_map_free(map); } else diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index 21e5fb940180..b9c7736baa44 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -189,7 +189,7 @@ ia_css_get_dvs2_statistics( map = ia_css_isp_dvs_statistics_map_allocate(isp_stats, NULL); if (map) { - mmgr_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); + hmm_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); ia_css_translate_dvs2_statistics(host_stats, map); ia_css_isp_dvs_statistics_map_free(map); } else diff --git a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c index 8138fb8b4155..d1442f5653da 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c +++ b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c @@ -194,7 +194,7 @@ ia_css_isp_param_copy_isp_mem_if_to_ddr( return IA_CSS_ERR_INTERNAL_ERROR; if (!size) continue; - mmgr_store(ddr_mem_ptr, host_mem_ptr, size); + hmm_store(ddr_mem_ptr, host_mem_ptr, size); } return IA_CSS_SUCCESS; } diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c index 1e8d3eb82eab..a2f7bacd4206 100644 --- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c +++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c @@ -63,7 +63,7 @@ int ia_css_queue_load( } else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) { /* doing DMA transfer of entire structure */ - mmgr_load(rdesc->desc.remote.cb_desc_addr, + hmm_load(rdesc->desc.remote.cb_desc_addr, (void *)cb_desc, sizeof(ia_css_circbuf_desc_t)); } else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) { @@ -110,7 +110,7 @@ int ia_css_queue_store( cb_desc->step); } else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) { /* doing DMA transfer of entire structure */ - mmgr_store(rdesc->desc.remote.cb_desc_addr, + hmm_store(rdesc->desc.remote.cb_desc_addr, (void *)cb_desc, sizeof(ia_css_circbuf_desc_t)); } else if (rdesc->location == IA_CSS_QUEUE_LOC_ISP) { @@ -136,7 +136,7 @@ int ia_css_queue_item_load( item, sizeof(ia_css_circbuf_elem_t)); } else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) { - mmgr_load(rdesc->desc.remote.cb_elems_addr + hmm_load(rdesc->desc.remote.cb_elems_addr + position * sizeof(ia_css_circbuf_elem_t), (void *)item, sizeof(ia_css_circbuf_elem_t)); @@ -163,7 +163,7 @@ int ia_css_queue_item_store( item, sizeof(ia_css_circbuf_elem_t)); } else if (rdesc->location == IA_CSS_QUEUE_LOC_HOST) { - mmgr_store(rdesc->desc.remote.cb_elems_addr + hmm_store(rdesc->desc.remote.cb_elems_addr + position * sizeof(ia_css_circbuf_elem_t), (void *)item, sizeof(ia_css_circbuf_elem_t)); diff --git a/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c index 19326d888e53..65f8dda5e2c8 100644 --- a/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c @@ -66,7 +66,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, code_addr = mmgr_alloc_attr(spctrl_cfg->code_size, 0); if (code_addr == mmgr_NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; - mmgr_store(code_addr, spctrl_cfg->code, spctrl_cfg->code_size); + hmm_store(code_addr, spctrl_cfg->code, spctrl_cfg->code_size); if (sizeof(hrt_vaddress) > sizeof(hrt_data)) { ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index f9571252e6e0..791f03572f59 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -4312,7 +4312,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, return IA_CSS_ERR_INTERNAL_ERROR; } - mmgr_store(h_vbuf->vptr, + hmm_store(h_vbuf->vptr, (void *)(&ddr_buffer), sizeof(struct sh_css_hmm_buffer)); if ((buf_type == IA_CSS_BUFFER_TYPE_3A_STATISTICS) @@ -4471,7 +4471,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ddr_buffer_addr, buf_type); if (hmm_buffer_record) { /* valid hmm_buffer_record found. Save the kernel_ptr - * for validation after performing mmgr_load. The + * for validation after performing hmm_load. The * vbuf handle and buffer_record can be released. */ kernel_ptr = hmm_buffer_record->kernel_ptr; @@ -4484,7 +4484,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, return IA_CSS_ERR_INTERNAL_ERROR; } - mmgr_load(ddr_buffer_addr, + hmm_load(ddr_buffer_addr, &ddr_buffer, sizeof(struct sh_css_hmm_buffer)); @@ -10849,10 +10849,10 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, sp_dmem_load(SP0_ID, (unsigned int)sp_address_of(sp_group), &sp_group, sizeof(struct sh_css_sp_group)); - mmgr_load(sp_group.pipe[thread_id].sp_stage_addr[stage_num], + hmm_load(sp_group.pipe[thread_id].sp_stage_addr[stage_num], &sp_stage, sizeof(struct sh_css_sp_stage)); - mmgr_load(sp_stage.isp_stage_addr, + hmm_load(sp_stage.isp_stage_addr, &isp_stage, sizeof(struct sh_css_isp_stage)); for (mem = 0; mem < N_IA_CSS_ISP_MEMORIES; mem++) { @@ -10868,7 +10868,7 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, isp_seg->params[IA_CSS_PARAM_CLASS_PARAM][mem].size; } - mmgr_store(sp_stage.isp_stage_addr, + hmm_store(sp_stage.isp_stage_addr, &isp_stage, sizeof(struct sh_css_isp_stage)); } } diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index 5a2e86b02c85..fa7c62465f90 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -328,6 +328,6 @@ sh_css_load_blob(const unsigned char *blob, unsigned int size) assert(blob); if (target_addr) - mmgr_store(target_addr, blob, size); + hmm_store(target_addr, blob, size); return target_addr; } diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index 00388e563668..890f8e74a85d 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -1521,7 +1521,7 @@ sh_css_set_black_frame(struct ia_css_stream *stream, int ofs = y * width + x; for (k = 0; k < ISP_VEC_NELEMS; k += 2) { - mmgr_load(ptr, (void *)(&data), sizeof(int)); + hmm_load(ptr, (void *)(&data), sizeof(int)); params->fpn_config.data[ofs + 2 * k] = (short)(data & 0xFFFF); params->fpn_config.data[ofs + 2 * k + 2] = @@ -1529,7 +1529,7 @@ sh_css_set_black_frame(struct ia_css_stream *stream, ptr += sizeof(int); /* byte system address */ } for (k = 0; k < ISP_VEC_NELEMS; k += 2) { - mmgr_load(ptr, (void *)(&data), sizeof(int)); + hmm_load(ptr, (void *)(&data), sizeof(int)); params->fpn_config.data[ofs + 2 * k + 1] = (short)(data & 0xFFFF); params->fpn_config.data[ofs + 2 * k + 3] = @@ -1620,7 +1620,7 @@ ia_css_params_store_ia_css_host_data( IA_CSS_ENTER_PRIVATE(""); - mmgr_store(ddr_addr, + hmm_store(ddr_addr, (void *)(data->address), (size_t)data->size); @@ -2133,7 +2133,7 @@ ia_css_get_3a_statistics(struct ia_css_3a_statistics *host_stats, map = ia_css_isp_3a_statistics_map_allocate(isp_stats, NULL); if (map) { - mmgr_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); + hmm_load(isp_stats->data_ptr, map->data_ptr, isp_stats->size); ia_css_translate_3a_statistics(host_stats, map); ia_css_isp_3a_statistics_map_free(map); } else @@ -3368,7 +3368,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, } else { gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])lut, interleaved_lut_temp); - mmgr_store(pipe->scaler_pp_lut, + hmm_store(pipe->scaler_pp_lut, (int *)interleaved_lut_temp, sizeof(zoom_table)); } @@ -3411,7 +3411,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void) gdc_lut_convert_to_isp_format((const int(*)[HRT_GDC_N])zoom_table, interleaved_lut_temp); - mmgr_store(default_gdc_lut, (int *)interleaved_lut_temp, + hmm_store(default_gdc_lut, (int *)interleaved_lut_temp, sizeof(zoom_table)); IA_CSS_LEAVE_PRIVATE("lut(%u) err=%d", default_gdc_lut, err); @@ -3656,7 +3656,7 @@ static void sh_css_update_isp_params_to_ddr( assert(params); - mmgr_store(ddr_ptr, ¶ms->uds, size); + hmm_store(ddr_ptr, ¶ms->uds, size); IA_CSS_LEAVE_PRIVATE("void"); } @@ -3672,7 +3672,7 @@ static void sh_css_update_isp_mem_params_to_ddr( params = ia_css_isp_param_get_mem_init(&binary->mem_params, IA_CSS_PARAM_CLASS_PARAM, mem); - mmgr_store(ddr_mem_ptr, params->address, size); + hmm_store(ddr_mem_ptr, params->address, size); IA_CSS_LEAVE_PRIVATE("void"); } @@ -4176,7 +4176,7 @@ sh_css_params_write_to_ddr_internal( IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } - mmgr_store(ddr_map->macc_tbl, + hmm_store(ddr_map->macc_tbl, converted_macc_table.data, sizeof(converted_macc_table.data)); } @@ -4461,7 +4461,7 @@ struct ia_css_shading_table *ia_css_get_shading_table(struct ia_css_stream hrt_vaddress sh_css_store_sp_group_to_ddr(void) { IA_CSS_ENTER_LEAVE_PRIVATE("void"); - mmgr_store(xmem_sp_group_ptrs, + hmm_store(xmem_sp_group_ptrs, &sh_css_sp_group, sizeof(struct sh_css_sp_group)); return xmem_sp_group_ptrs; @@ -4472,7 +4472,7 @@ hrt_vaddress sh_css_store_sp_stage_to_ddr( unsigned int stage) { IA_CSS_ENTER_LEAVE_PRIVATE("void"); - mmgr_store(xmem_sp_stage_ptrs[pipe][stage], + hmm_store(xmem_sp_stage_ptrs[pipe][stage], &sh_css_sp_stage, sizeof(struct sh_css_sp_stage)); return xmem_sp_stage_ptrs[pipe][stage]; @@ -4483,7 +4483,7 @@ hrt_vaddress sh_css_store_isp_stage_to_ddr( unsigned int stage) { IA_CSS_ENTER_LEAVE_PRIVATE("void"); - mmgr_store(xmem_isp_stage_ptrs[pipe][stage], + hmm_store(xmem_isp_stage_ptrs[pipe][stage], &sh_css_isp_stage, sizeof(struct sh_css_isp_stage)); return xmem_isp_stage_ptrs[pipe][stage]; @@ -4545,7 +4545,7 @@ static enum ia_css_err write_ia_css_isp_parameter_set_info_to_ddr( mmgr_alloc_attr(sizeof(struct ia_css_isp_parameter_set_info), 0)); succ = (*out != mmgr_NULL); if (succ) - mmgr_store(*out, + hmm_store(*out, me, sizeof(struct ia_css_isp_parameter_set_info)); else err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -4574,7 +4574,7 @@ free_ia_css_isp_parameter_set_info( return err; } - mmgr_load(ptr, &isp_params_info.mem_map, sizeof(struct sh_css_ddr_address_map)); + hmm_load(ptr, &isp_params_info.mem_map, sizeof(struct sh_css_ddr_address_map)); /* copy map using size info */ for (i = 0; i < (sizeof(struct sh_css_ddr_address_map_size) / sizeof(size_t)); i++) From patchwork Sat May 30 06:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2157AC433DF for ; Sat, 30 May 2020 06:59:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA8EF207D0 for ; Sat, 30 May 2020 06:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821956; bh=vw/Iz5Jl+3iwT5erxVEPNa3zaZ0MrR4KDCytdwPZ+Q0=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Mt3d6ZUjljKBhRBT6PRZbG+ylAavpSyAEl7mvk2hbdhddJLZlb6EUwqt3P1fFyMt3 cEpdH3VZcsB4ZP4WWb9TCYHRX4TIpiW5BhLshynJvmy1uove2bLTu0dVqXY/ZmnnEw 2K6Wc8o5QuVrdsyZFhFsr3XA3ktzGuX4XuOXX2OQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728922AbgE3G6h (ORCPT ); Sat, 30 May 2020 02:58:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:44916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728788AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3C6A20897; Sat, 30 May 2020 06:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=vw/Iz5Jl+3iwT5erxVEPNa3zaZ0MrR4KDCytdwPZ+Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aG7W1ZkKeMJAhlRV6UKSpmdGw9LgVwUi6wbZb062le6O8aVampZFWgsL2+VVrziz8 yEp9JxXMQtTD8VKY+6JBysADLrImuKMW04LDBPNg+vjLqbXnVoj49Ih1a7U2xPMdc8 ++JoSOQgNUsSCrJPKFz+9OFFMdX3MKle8F6Cc67U= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPU-001hoh-SM; Sat, 30 May 2020 08:56:00 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH v2 08/41] media: atomisp: get rid of memory_access.c Date: Sat, 30 May 2020 08:55:25 +0200 Message-Id: <5e16d62e5a00ab9a3bdc27f7960b8c473d718e97.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Now that we have everything in place, we can get rid of the memory_access abstraction layer. Now, everything related to heterogeneous memory management (hmm) is under hmm.c & related pools. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/Makefile | 1 - .../staging/media/atomisp/include/hmm/hmm.h | 3 + .../staging/media/atomisp/pci/atomisp_acc.c | 3 +- .../staging/media/atomisp/pci/atomisp_fops.c | 1 - .../atomisp/pci/base/refcount/src/refcount.c | 3 +- .../pci/hive_isp_css_common/host/debug.c | 3 +- .../hive_isp_css_common/host/debug_private.h | 1 - .../memory_access/memory_access.h | 94 ------------------- .../media/atomisp/pci/ia_css_memory_access.c | 20 ---- .../pci/isp/kernels/bh/bh_2/ia_css_bh.host.c | 1 - .../isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c | 3 +- .../raw_aa_binning_1.0/ia_css_raa.host.c | 1 - .../kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 5 +- .../kernels/sdis/sdis_2/ia_css_sdis2.host.c | 5 +- .../media/atomisp/pci/mmu/sh_mmu_mrfld.c | 1 - .../atomisp/pci/runtime/binary/src/binary.c | 4 +- .../pci/runtime/debug/src/ia_css_debug.c | 3 +- .../atomisp/pci/runtime/event/src/event.c | 1 - .../atomisp/pci/runtime/frame/src/frame.c | 21 +++-- .../pci/runtime/isp_param/src/isp_param.c | 5 +- .../pci/runtime/pipeline/src/pipeline.c | 3 +- .../pci/runtime/queue/src/queue_access.c | 3 +- .../atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c | 4 +- .../atomisp/pci/runtime/spctrl/src/spctrl.c | 5 +- drivers/staging/media/atomisp/pci/sh_css.c | 3 +- .../media/atomisp/pci/sh_css_firmware.c | 5 +- .../staging/media/atomisp/pci/sh_css_mmu.c | 1 - .../media/atomisp/pci/sh_css_param_dvs.c | 1 - .../staging/media/atomisp/pci/sh_css_params.c | 46 +++++---- drivers/staging/media/atomisp/pci/sh_css_sp.c | 3 +- 30 files changed, 79 insertions(+), 174 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h delete mode 100644 drivers/staging/media/atomisp/pci/ia_css_memory_access.c diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index 4a77d6d6910d..01764c487b52 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -54,7 +54,6 @@ atomisp-objs += \ pci/hmm/hmm.o \ pci/hmm/hmm_reserved_pool.o \ pci/ia_css_device_access.o \ - pci/ia_css_memory_access.o \ pci/isp/kernels/aa/aa_2/ia_css_aa2.host.o \ pci/isp/kernels/anr/anr_1.0/ia_css_anr.host.o \ pci/isp/kernels/anr/anr_2/ia_css_anr2.host.o \ diff --git a/drivers/staging/media/atomisp/include/hmm/hmm.h b/drivers/staging/media/atomisp/include/hmm/hmm.h index a661c039a2cc..5d725a6b6e10 100644 --- a/drivers/staging/media/atomisp/include/hmm/hmm.h +++ b/drivers/staging/media/atomisp/include/hmm/hmm.h @@ -28,6 +28,9 @@ #include "hmm/hmm_pool.h" #include "ia_css_types.h" +#define mmgr_NULL ((ia_css_ptr)0) +#define mmgr_EXCEPTION ((ia_css_ptr)-1) + int hmm_pool_register(unsigned int pool_size, enum hmm_pool_type pool_type); void hmm_pool_unregister(enum hmm_pool_type pool_type); diff --git a/drivers/staging/media/atomisp/pci/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp_acc.c index 5e7f4cd47c8f..8633afdc3f39 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_acc.c +++ b/drivers/staging/media/atomisp/pci/atomisp_acc.c @@ -23,12 +23,13 @@ #include #include +#include "hmm.h" + #include "atomisp_acc.h" #include "atomisp_internal.h" #include "atomisp_compat.h" #include "atomisp_cmd.h" -#include "memory_access/memory_access.h" #include "ia_css.h" static const struct { diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index fc3043bded46..1588e84a6b91 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -36,7 +36,6 @@ #include "type_support.h" #include "device_access/device_access.h" -#include "memory_access/memory_access.h" #include "atomisp_acc.h" diff --git a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c index 52c40aaa1e52..1616f3a38ddd 100644 --- a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c +++ b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c @@ -12,8 +12,9 @@ * more details. */ +#include "hmm.h" + #include "ia_css_refcount.h" -#include "memory_access/memory_access.h" #include "sh_css_defs.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c index 3a5414b8912a..85b054c5ec80 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug.c @@ -14,11 +14,12 @@ #include "debug.h" +#include "hmm.h" + #ifndef __INLINE_DEBUG__ #include "debug_private.h" #endif /* __INLINE_DEBUG__ */ -#include "memory_access.h" #define __INLINE_SP__ #include "sp.h" diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h index f2f5b7658819..0b107ee13072 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/debug_private.h @@ -22,7 +22,6 @@ #define __INLINE_ISP__ #include "isp.h" -#include "memory_access.h" #include "assert_support.h" diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h deleted file mode 100644 index 8559b5045f20..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/memory_access/memory_access.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015-2017, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __MEMORY_ACCESS_H_INCLUDED__ -#define __MEMORY_ACCESS_H_INCLUDED__ - -/*! - * \brief - * Define the public interface for virtual memory - * access functions. Access types are limited to - * those defined in - * - * The address representation is private to the system - * and represented as "ia_css_ptr" rather than a - * pointer, as the memory allocation cannot be accessed - * by dereferencing but reaquires load and store access - * functions - * - * The page table selection or virtual memory context; - * The page table base index; Is implicit. This page - * table base index must be set by the implementation - * of the access function - * - * "store" is a transfer to the system - * "load" is a transfer from the system - * - * Allocation properties can be specified by setting - * attributes (see below) in case of multiple physical - * memories the memory ID is encoded on the attribute - * - * Allocations in the same physical memory, but in a - * different (set of) page tables can be shared through - * a page table information mapping function - */ - -#include -#include "platform_support.h" /* for __func__ */ - -/* - * User provided file that defines the (sub)system address types: - * - ia_css_ptr a type that can hold the (sub)system virtual address range - */ -#include "system_types.h" - -/* - * The MMU base address is a physical address, thus the same type is used - * as for the device base address - */ -#include "device_access.h" - -#include "hmm/hmm.h" - -/*! - * \brief - * Bit masks for specialised allocation functions - * the default is "uncached", "not contiguous", - * "not page aligned" and "not cleared" - * - * Forcing alignment (usually) returns a pointer - * at an alignment boundary that is offset from - * the allocated pointer. Without storing this - * pointer/offset, we cannot free it. The memory - * manager is responsible for the bookkeeping, e.g. - * the allocation function creates a sentinel - * within the allocation referencable from the - * returned pointer/address. - */ - -#define mmgr_NULL ((ia_css_ptr)0) -#define mmgr_EXCEPTION ((ia_css_ptr)-1) - -/*! Return the address of an allocation in memory - - \param size[in] Size in bytes of the allocation - \param attribute[in] Bit vector specifying the properties - of the allocation including zero initialisation - - \return vaddress - */ - -ia_css_ptr mmgr_alloc_attr(const size_t size, const uint16_t attribute); - -#endif /* __MEMORY_ACCESS_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c b/drivers/staging/media/atomisp/pci/ia_css_memory_access.c deleted file mode 100644 index 79048e1d6bcc..000000000000 --- a/drivers/staging/media/atomisp/pci/ia_css_memory_access.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015-2017, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#include - -ia_css_ptr mmgr_alloc_attr(const size_t size, const uint16_t attrs) -{ - return hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, attrs); -} diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/bh/bh_2/ia_css_bh.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/bh/bh_2/ia_css_bh.host.c index 6c7aa51ec079..4f1efd6db536 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/bh/bh_2/ia_css_bh.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/bh/bh_2/ia_css_bh.host.c @@ -14,7 +14,6 @@ #if !defined(HAS_NO_HMEM) -#include "memory_access.h" #include "ia_css_types.h" #include "sh_css_internal.h" #include "assert_support.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c index 775a0009e1b6..4dd0b0373e79 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c @@ -12,6 +12,8 @@ * more details. */ +#include "hmm.h" + #include "ia_css_frame_public.h" #define IA_CSS_INCLUDE_CONFIGURATIONS #include "ia_css_isp_configs.h" @@ -22,7 +24,6 @@ #include "sh_css_params.h" #include "ia_css_binary.h" #include "ia_css_debug.h" -#include "memory_access.h" #include "assert_support.h" #include "ia_css_dvs.host.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c index 2045b974ec8a..5aaa018370ef 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c @@ -14,7 +14,6 @@ #if !defined(HAS_NO_HMEM) -#include "memory_access.h" #include "ia_css_types.h" #include "sh_css_internal.h" #include "sh_css_frac.h" diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index fb0e6dcbca43..dfd621d3f6da 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -12,7 +12,8 @@ * more details. */ -#include "memory_access.h" +#include "hmm.h" + #include "assert_support.h" #include "ia_css_debug.h" #include "ia_css_sdis_types.h" @@ -329,7 +330,7 @@ ia_css_isp_dvs_statistics_allocate( HIVE_ISP_DDR_WORD_BYTES); me->size = hor_size + ver_size; - me->data_ptr = mmgr_alloc_attr(me->size, 0); + me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0); if (me->data_ptr == mmgr_NULL) goto err; me->hor_size = hor_size; diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index b9c7736baa44..ca34299b7998 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -12,8 +12,9 @@ * more details. */ +#include "hmm.h" + #include -#include "memory_access.h" #include "ia_css_debug.h" #include "ia_css_sdis2.host.h" @@ -295,7 +296,7 @@ ia_css_isp_dvs2_statistics_allocate( * grid->aligned_height * IA_CSS_DVS2_NUM_COEF_TYPES; me->size = 2 * size; - me->data_ptr = mmgr_alloc_attr(me->size, 0); + me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0); if (me->data_ptr == mmgr_NULL) goto err; me->hor_proj = me->data_ptr; diff --git a/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c b/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c index 031d7fa00510..0f55978ad2bd 100644 --- a/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c +++ b/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c @@ -19,7 +19,6 @@ #include "type_support.h" #include "mmu/isp_mmu.h" #include "mmu/sh_mmu_mrfld.h" -#include "memory_access/memory_access.h" #include "atomisp_compat.h" #define MERR_VALID_PTE_MASK 0x80000000 diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c index 2a23b7c6aeeb..c7083d9b3f10 100644 --- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c @@ -14,6 +14,9 @@ #include #include /* HR_GDC_N */ + +#include "hmm.h" + #include "isp.h" /* ISP_VEC_NELEMS */ #include "ia_css_binary.h" @@ -33,7 +36,6 @@ #include "camera/pipe/interface/ia_css_pipe_binarydesc.h" -#include "memory_access.h" #include "assert_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 7784e39869a6..c46621315e7b 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -13,7 +13,6 @@ */ #include "debug.h" -#include "memory_access.h" #ifndef __INLINE_INPUT_SYSTEM__ #define __INLINE_INPUT_SYSTEM__ @@ -2490,7 +2489,7 @@ void ia_css_debug_dump_perf_counters(void) void sh_css_init_ddr_debug_queue(void) { ia_css_ptr ddr_debug_queue_addr = - mmgr_alloc_attr(sizeof(debug_data_ddr_t), 0); + hmm_alloc(sizeof(debug_data_ddr_t), HMM_BO_PRIVATE, 0, NULL, 0); const struct ia_css_fw_info *fw; unsigned int HIVE_ADDR_debug_buffer_ddr_address; diff --git a/drivers/staging/media/atomisp/pci/runtime/event/src/event.c b/drivers/staging/media/atomisp/pci/runtime/event/src/event.c index c4578470ad8c..4bbed9ee2e35 100644 --- a/drivers/staging/media/atomisp/pci/runtime/event/src/event.c +++ b/drivers/staging/media/atomisp/pci/runtime/event/src/event.c @@ -29,7 +29,6 @@ /*#include "sp.h"*/ /* host2sp_enqueue_frame_data() */ -#include "memory_access.h" #include "assert_support.h" #include "platform_support.h" /* hrt_sleep() */ diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c index 9a9c1fffd3d9..c7d15a01ec9a 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c @@ -12,13 +12,14 @@ * more details. */ +#include "hmm.h" + #include "ia_css_frame.h" #include #include "assert_support.h" #include "ia_css_debug.h" #include "isp.h" #include "sh_css_internal.h" -#include "memory_access.h" #include "atomisp_internal.h" #define NV12_TILEY_TILE_WIDTH 128 @@ -170,20 +171,23 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, if (pgnr < ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { dev_err(atomisp_dev, "user space memory size is less than the expected size..\n"); - return -ENOMEM; + err = -ENOMEM; + goto error; } else if (pgnr > ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { dev_err(atomisp_dev, "user space memory size is large than the expected size..\n"); - return -ENOMEM; + err = -ENOMEM; + goto error; } - return hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, - attribute & ATOMISP_MAP_FLAG_CACHED); + me->data = hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, + attribute & ATOMISP_MAP_FLAG_CACHED); if (me->data == mmgr_NULL) err = IA_CSS_ERR_INVALID_ARGUMENTS; } +error: if (err != IA_CSS_SUCCESS) { sh_css_free(me); me = NULL; @@ -797,9 +801,10 @@ static enum ia_css_err frame_allocate_buffer_data(struct ia_css_frame *frame) #ifdef ISP2401 IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes); #endif - frame->data = mmgr_alloc_attr(frame->data_bytes, - frame->contiguous ? - ATOMISP_MAP_FLAG_CONTIGUOUS : 0); + frame->data = hmm_alloc(frame->data_bytes, + HMM_BO_PRIVATE, 0, NULL, + frame->contiguous ? + ATOMISP_MAP_FLAG_CONTIGUOUS : 0); if (frame->data == mmgr_NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; diff --git a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c index 8646000fabd4..6f7c21bbe62d 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c +++ b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c @@ -12,7 +12,8 @@ * more details. */ -#include "memory_access.h" +#include "hmm.h" + #include "ia_css_pipeline.h" #include "ia_css_isp_param.h" @@ -127,7 +128,7 @@ ia_css_isp_param_allocate_isp_parameters( goto cleanup; } if (pclass != IA_CSS_PARAM_CLASS_PARAM) { - css_params->params[pclass][mem].address = mmgr_alloc_attr(size, 0); + css_params->params[pclass][mem].address = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, 0); if (!css_params->params[pclass][mem].address) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto cleanup; diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c index 8b9982de8deb..f65d7491abd9 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c @@ -12,11 +12,12 @@ * more details. */ +#include "hmm.h" + #include "ia_css_debug.h" #include "sw_event_global.h" /* encode_sw_event */ #include "sp.h" /* cnd_sp_irq_enable() */ #include "assert_support.h" -#include "memory_access.h" #include "sh_css_sp.h" #include "ia_css_pipeline.h" #include "ia_css_isp_param.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c index a2f7bacd4206..ba7219644256 100644 --- a/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c +++ b/drivers/staging/media/atomisp/pci/runtime/queue/src/queue_access.c @@ -12,11 +12,12 @@ * more details. */ +#include "hmm.h" + #include "type_support.h" #include "queue_access.h" #include "ia_css_circbuf.h" #include "sp.h" -#include "memory_access.h" #include "assert_support.h" int ia_css_queue_load( diff --git a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c index 714b8099e544..546988a1a42e 100644 --- a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c +++ b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c @@ -12,12 +12,12 @@ * more details. */ +#include "hmm.h" #include "ia_css_rmgr.h" #include #include #include /* memset */ -#include /* mmmgr_alloc_attr */ #include /* @@ -297,7 +297,7 @@ void ia_css_rmgr_acq_vbuf(struct ia_css_rmgr_vbuf_pool *pool, } if ((*handle)->vptr == 0x0) { /* we need to allocate */ - (*handle)->vptr = mmgr_alloc_attr((*handle)->size, 0); + (*handle)->vptr = hmm_alloc((*handle)->size, HMM_BO_PRIVATE, 0, NULL, 0); } else { /* we popped a buffer */ return; diff --git a/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c index 142f181d1e55..d361ccdd70e8 100644 --- a/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/runtime/spctrl/src/spctrl.c @@ -12,11 +12,12 @@ * more details. */ +#include "hmm.h" + #include "ia_css_types.h" #define __INLINE_SP__ #include "sp.h" -#include "memory_access.h" #include "assert_support.h" #include "ia_css_spctrl.h" #include "ia_css_debug.h" @@ -63,7 +64,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, * Data used to be stored separately, because of access alignment constraints, * fix the FW generation instead */ - code_addr = mmgr_alloc_attr(spctrl_cfg->code_size, 0); + code_addr = hmm_alloc(spctrl_cfg->code_size, HMM_BO_PRIVATE, 0, NULL, 0); if (code_addr == mmgr_NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; hmm_store(code_addr, spctrl_cfg->code, spctrl_cfg->code_size); diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 5b9ed910f407..835da6f12309 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -17,6 +17,8 @@ #include #include +#include "hmm.h" + #include "ia_css.h" #include "sh_css_hrt.h" /* only for file 2 MIPI */ #include "ia_css_buffer.h" @@ -52,7 +54,6 @@ #include "ia_css_isys.h" #endif -#include "memory_access.h" #include "tag.h" #include "assert_support.h" #include "math_support.h" diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index e189d59783f8..ee23d28b1bef 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -15,6 +15,8 @@ #include #include +#include "hmm.h" + #include #include "platform_support.h" #include "sh_css_firmware.h" @@ -24,7 +26,6 @@ #include "sh_css_internal.h" #include "ia_css_isp_param.h" -#include "memory_access.h" #include "assert_support.h" #include "string_support.h" @@ -322,7 +323,7 @@ void sh_css_unload_firmware(void) ia_css_ptr sh_css_load_blob(const unsigned char *blob, unsigned int size) { - ia_css_ptr target_addr = mmgr_alloc_attr(size, 0); + ia_css_ptr target_addr = hmm_alloc(size, HMM_BO_PRIVATE, 0, NULL, 0); /* this will allocate memory aligned to a DDR word boundary which is required for the CSS DMA to read the instructions. */ diff --git a/drivers/staging/media/atomisp/pci/sh_css_mmu.c b/drivers/staging/media/atomisp/pci/sh_css_mmu.c index 179b6f40be49..4965a9e5e161 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mmu.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mmu.c @@ -43,7 +43,6 @@ ia_css_mmu_invalidate_cache(void) "ia_css_mmu_invalidate_cache() leave\n"); } -/* Deprecated, this is an HRT backend function (memory_access.h) */ void sh_css_mmu_set_page_table_base_index(hrt_data base_index) { diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c index 52e29161cb35..025f26a40062 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c @@ -18,7 +18,6 @@ #include #include #include "ia_css_debug.h" -#include "memory_access.h" static struct ia_css_dvs_6axis_config * alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res, diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index 7bd2fd0124cb..f1b543a6db82 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -24,6 +24,7 @@ #define IA_CSS_INCLUDE_PARAMETERS #define IA_CSS_INCLUDE_ACC_PARAMETERS +#include "hmm.h" #include "sh_css_params.h" #include "ia_css_queue.h" #include "sw_event_global.h" /* Event IDs */ @@ -45,7 +46,6 @@ #include "sh_css_sp.h" #include "ia_css_pipeline.h" #include "ia_css_debug.h" -#include "memory_access.h" #include "ia_css_isp_param.h" #include "ia_css_isp_params.h" @@ -2734,8 +2734,10 @@ static bool realloc_isp_css_mm_buf( id = IA_CSS_REFCOUNT_PARAM_BUFFER; ia_css_refcount_decrement(id, *curr_buf); - *curr_buf = ia_css_refcount_increment(id, mmgr_alloc_attr(needed_size, - mmgr_attribute)); + *curr_buf = ia_css_refcount_increment(id, hmm_alloc(needed_size, + HMM_BO_PRIVATE, 0, + NULL, + mmgr_attribute)); if (!*curr_buf) { *err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -2800,7 +2802,7 @@ ia_css_isp_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid) me->hmem_size = CEIL_MUL(me->hmem_size, HIVE_ISP_DDR_WORD_BYTES); me->size = me->dmem_size + me->vmem_size * 2 + me->hmem_size; - me->data_ptr = mmgr_alloc_attr(me->size, 0); + me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0); if (me->data_ptr == mmgr_NULL) { sh_css_free(me); me = NULL; @@ -2850,7 +2852,7 @@ ia_css_metadata_allocate(const struct ia_css_metadata_info *metadata_info) md->info = *metadata_info; md->exp_id = 0; - md->address = mmgr_alloc_attr(metadata_info->size, 0); + md->address = hmm_alloc(metadata_info->size, HMM_BO_PRIVATE, 0, NULL, 0); if (md->address == mmgr_NULL) goto error; @@ -3007,13 +3009,13 @@ sh_css_create_isp_params(struct ia_css_stream *stream, ddr_ptrs_size->isp_param = params_size; ddr_ptrs->isp_param = ia_css_refcount_increment(IA_CSS_REFCOUNT_PARAM_BUFFER, - mmgr_alloc_attr(params_size, 0)); + hmm_alloc(params_size, HMM_BO_PRIVATE, 0, NULL, 0)); succ &= (ddr_ptrs->isp_param != mmgr_NULL); ddr_ptrs_size->macc_tbl = sizeof(struct ia_css_macc_table); ddr_ptrs->macc_tbl = ia_css_refcount_increment(IA_CSS_REFCOUNT_PARAM_BUFFER, - mmgr_alloc_attr(sizeof(struct ia_css_macc_table), 0)); + hmm_alloc(sizeof(struct ia_css_macc_table), HMM_BO_PRIVATE, 0, NULL, 0)); succ &= (ddr_ptrs->macc_tbl != mmgr_NULL); *isp_params_out = params; @@ -3264,12 +3266,14 @@ sh_css_params_init(void) { for (i = 0; i < SH_CSS_MAX_STAGES; i++) { xmem_sp_stage_ptrs[p][i] = ia_css_refcount_increment(-1, - mmgr_alloc_attr(sizeof(struct sh_css_sp_stage), - ATOMISP_MAP_FLAG_CLEARED)); + hmm_alloc(sizeof(struct sh_css_sp_stage), + HMM_BO_PRIVATE, 0, NULL, + ATOMISP_MAP_FLAG_CLEARED)); xmem_isp_stage_ptrs[p][i] = ia_css_refcount_increment(-1, - mmgr_alloc_attr(sizeof(struct sh_css_sp_stage), - ATOMISP_MAP_FLAG_CLEARED)); + hmm_alloc(sizeof(struct sh_css_sp_stage), + HMM_BO_PRIVATE, 0, NULL, + ATOMISP_MAP_FLAG_CLEARED)); if ((xmem_sp_stage_ptrs[p][i] == mmgr_NULL) || (xmem_isp_stage_ptrs[p][i] == mmgr_NULL)) { @@ -3286,12 +3290,14 @@ sh_css_params_init(void) { ia_css_config_xnr_table(); sp_ddr_ptrs = ia_css_refcount_increment(-1, - mmgr_alloc_attr(CEIL_MUL(sizeof(struct sh_css_ddr_address_map), - HIVE_ISP_DDR_WORD_BYTES), - ATOMISP_MAP_FLAG_CLEARED)); + hmm_alloc(CEIL_MUL(sizeof(struct sh_css_ddr_address_map), + HIVE_ISP_DDR_WORD_BYTES), + HMM_BO_PRIVATE, 0, NULL, + ATOMISP_MAP_FLAG_CLEARED)); xmem_sp_group_ptrs = ia_css_refcount_increment(-1, - mmgr_alloc_attr(sizeof(struct sh_css_sp_group), - ATOMISP_MAP_FLAG_CLEARED)); + hmm_alloc(sizeof(struct sh_css_sp_group), + HMM_BO_PRIVATE, 0, NULL, + ATOMISP_MAP_FLAG_CLEARED)); if ((sp_ddr_ptrs == mmgr_NULL) || (xmem_sp_group_ptrs == mmgr_NULL)) @@ -3315,7 +3321,7 @@ static void host_lut_store(const void *lut) /* Note that allocation is in ipu address space. */ inline ia_css_ptr sh_css_params_alloc_gdc_lut(void) { - return mmgr_alloc_attr(sizeof(zoom_table), 0); + return hmm_alloc(sizeof(zoom_table), HMM_BO_PRIVATE, 0, NULL, 0); } inline void sh_css_params_free_gdc_lut(ia_css_ptr addr) @@ -3355,7 +3361,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, if (!stream_started) { if (!atomisp_hw_is_isp2401) - pipe->scaler_pp_lut = mmgr_alloc_attr(sizeof(zoom_table), 0); + pipe->scaler_pp_lut = hmm_alloc(sizeof(zoom_table), HMM_BO_PRIVATE, 0, NULL, 0); else pipe->scaler_pp_lut = sh_css_params_alloc_gdc_lut(); @@ -3400,7 +3406,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void) host_lut_store((void *)zoom_table); if (!atomisp_hw_is_isp2401) - default_gdc_lut = mmgr_alloc_attr(sizeof(zoom_table), 0); + default_gdc_lut = hmm_alloc(sizeof(zoom_table), HMM_BO_PRIVATE, 0, NULL, 0); else default_gdc_lut = sh_css_params_alloc_gdc_lut(); @@ -4540,7 +4546,7 @@ static enum ia_css_err write_ia_css_isp_parameter_set_info_to_ddr( assert(out); *out = ia_css_refcount_increment(IA_CSS_REFCOUNT_PARAM_SET_POOL, - mmgr_alloc_attr(sizeof(struct ia_css_isp_parameter_set_info), 0)); + hmm_alloc(sizeof(struct ia_css_isp_parameter_set_info), HMM_BO_PRIVATE, 0, NULL, 0)); succ = (*out != mmgr_NULL); if (succ) hmm_store(*out, diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index 9a80968f115a..1ed060d6d855 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -12,6 +12,8 @@ * more details. */ +#include "hmm.h" + #include "sh_css_sp.h" #if !defined(HAS_NO_INPUT_FORMATTER) @@ -43,7 +45,6 @@ /*#include "sp.h"*/ /* host2sp_enqueue_frame_data() */ -#include "memory_access.h" #include "assert_support.h" #include "platform_support.h" /* hrt_sleep() */ From patchwork Sat May 30 06:55:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A9E6C433E0 for ; Sat, 30 May 2020 06:59:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0CB320776 for ; Sat, 30 May 2020 06:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821981; bh=wIU4L8fcCAnFawFS/JHH3TeHXuSwoOH6ncEx3KzNzKo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=RJapNgOIw7QJPrxH315FI00hszVeJMKBZoUfNq9Z7JCIP6cK4HemsjaV0goRWfa1a PApXILFN8oRbSTrpWFYbUNxHjZsVYlNM8vnLJqLC4QDjVJrD3mfXfrr4lfVY4h47tu nYIF9IYT9KzWo5veqDIC+dzYaevuX8Ovq7lVFnaw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728872AbgE3G7h (ORCPT ); Sat, 30 May 2020 02:59:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:44904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728783AbgE3G4F (ORCPT ); Sat, 30 May 2020 02:56:05 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0A87B208E4; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=wIU4L8fcCAnFawFS/JHH3TeHXuSwoOH6ncEx3KzNzKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p16mhMVYA85/oBVoMcguyyOSOIhNsBu7VHFf93bOM38CKdxibTAri17CE09tg54dA SLzdJJzxiQR3moaWdlUwL5YzRUgzhX66q57wL66N1xddCp/BiAP+6sDavjQsilhzPN IJG4MRbz7LvDmstKzKgUt1EP9uB4mMvLGWg6ewbs= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPU-001hor-Ut; Sat, 30 May 2020 08:56:00 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/41] media: atomisp: add debug message to help debugging hmm code Date: Sat, 30 May 2020 08:55:27 +0200 Message-Id: <33194cee97bd5102335b72edd9adfcc7a3e23305.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The hmm code is partially based on a fork from 3.10 code, and has bugs. Add debug there to help tracking what happens there. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/hmm/hmm_bo.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c index 6fce8c95be1d..b6dcd246d7af 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c @@ -1015,6 +1015,11 @@ static int alloc_user_pages(struct hmm_buffer_object *bo, bo->mem_type = HMM_BO_MEM_TYPE_USER; } + dev_dbg(atomisp_dev, "%s: %d %s pages were allocated as 0x%08x\n", + __func__, + bo->pgnr, + bo->mem_type == HMM_BO_MEM_TYPE_USER ? "user" : "pfn", page_nr); + /* can be written by caller, not forced */ if (page_nr != bo->pgnr) { dev_err(atomisp_dev, From patchwork Sat May 30 06:55:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C093C433DF for ; Sat, 30 May 2020 06:59:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD785207D0 for ; Sat, 30 May 2020 06:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821965; bh=JKmzSE0kGmg7cmLoJkHr7QbAEfATLjopfGTrvBS2jDE=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=rGKDQQoSzB8kAu01wJsNC0lEbbDKLIU4I/X5eGGr7OrIM449r0v2HpChZSaH0fcq2 /w2L+M8EQPQyZPHY8+n4GNvm+Y9BMrryrsnWmxcmxdoOgf+12Z+khzyJ4MCc8WSihV T9AEszm30UR0zinP/gAXlk33rdaGk3+AbutpfTwg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbgE3G7W (ORCPT ); Sat, 30 May 2020 02:59:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:44954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728820AbgE3G4F (ORCPT ); Sat, 30 May 2020 02:56:05 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30D7D214D8; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=JKmzSE0kGmg7cmLoJkHr7QbAEfATLjopfGTrvBS2jDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEvx7CPeCZSmEAdFnPTTcStqZoPn9ipThhEjRhvezwhW9/S3e2biBsGQ2U0EV0s4c ZK+pmFelocVLWEeOlOjj5iKjQ5H0aVrp1NPLz0AlsUCIsxwrrEHSgQXlZU78EV3i8+ wmpwKUZhLeJWluOqtf+gXAdeMPJKujTUA4tyMoL8= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hp4-2C; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 13/41] media: atomisp: fix driver caps Date: Sat, 30 May 2020 08:55:30 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This device driver is not MC-centric. So, remove the wrong caps from it. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index 830aefad9312..2bde2c8ea460 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -1343,8 +1343,7 @@ int atomisp_subdev_register_entities(struct atomisp_sub_device *asd, * Should any of those use V4L2_CAP_META_OUTPUT? Probably yes. */ - device_caps = V4L2_CAP_IO_MC | - V4L2_CAP_VIDEO_CAPTURE | + device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; /* Register the subdev and video node. */ From patchwork Sat May 30 06:55:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0209FC433E4 for ; Sat, 30 May 2020 06:57:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C85EA207D0 for ; Sat, 30 May 2020 06:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821861; bh=SrcUjhOVnLeWo8E1a6KqVONGbOtrfL+Xa1tbucALTSQ=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=0SlfdfI7jSw2nj1+Rguc9oS+82V2dtMlsmuceuUHOlrOa5XNpFH9EKgeNr3I3gg1H 2Tuf94FU2uCSRyXCC7+BuJDPi+8oAo0oYNFxxoxD2Z/W82VnBR0HuoHtTRLV4tKF1L 88U0Pu86GADuRLGgqfscxNzghB60/cXMLRiM7pbI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728882AbgE3G4I (ORCPT ); Sat, 30 May 2020 02:56:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:44956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728823AbgE3G4F (ORCPT ); Sat, 30 May 2020 02:56:05 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 391F1214F1; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=SrcUjhOVnLeWo8E1a6KqVONGbOtrfL+Xa1tbucALTSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSi36M86QavR+RBpDFiBCk0z79HcPbFKbgDEzniEPJwE+cBeHGMw/lqpSAb7xgakE QzzfQxSiNqfNdMrKCDMEb5YQmdmarUY3ODkYahbwooaD8/8XT7bRJ+wDVIAvzZkr7M pb7mBP/pXKGK3Y91sbiBoegR/VFvwuQmNPmon4zg= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpJ-6N; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 16/41] media: atomisp: improve warning for IRQ enable function Date: Sat, 30 May 2020 08:55:33 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If something gets wrong when enabling or disabling an IRQ, we should know better about what happened. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index f39b0ad85cfa..5718010a0bf6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -1042,7 +1042,9 @@ int atomisp_css_irq_enable(struct atomisp_device *isp, __func__, info, enable ? "enable" : "disable"); if (ia_css_irq_enable(info, enable) != IA_CSS_SUCCESS) { - dev_warn(isp->dev, "%s:Invalid irq info.\n", __func__); + dev_warn(isp->dev, "%s:Invalid irq info: 0x%08x when %s.\n", + __func__, info, + enable ? "enabling" : "disabling"); return -EINVAL; } From patchwork Sat May 30 06:55:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D33C433E1 for ; Sat, 30 May 2020 06:58:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B259120776 for ; Sat, 30 May 2020 06:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821891; bh=xUpAPf3A4MKwvNYsKa1mMtOUiOKfXfoMBNe70NZPfuw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=cXINc/fTv3kQ7MFDU1ljqLC2khdC7FTrmQCM6Emve24gVhgyDc7m84YU5lXkVLt8n f7nzimY1YJYfIwWf621DbLgGU5CklSqpW+3S6C1R3kOC6OKUQBmdRX6V9Ohq5p0K1a vLfrK9xK2TGqrBlYKrIbNMyhIInn7dIj/6Rv00qw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729091AbgE3G5m (ORCPT ); Sat, 30 May 2020 02:57:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:44974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728834AbgE3G4H (ORCPT ); Sat, 30 May 2020 02:56:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69582215A4; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=xUpAPf3A4MKwvNYsKa1mMtOUiOKfXfoMBNe70NZPfuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6W66H4oLd7r6r4IxYJz2d7V3Q4q8H7BXCCNFN+3ivl0EawYLlOXG/zXxq94kPMRL sKq/pvi7mitogSCg0C++t0w7VVEXlj/Pc62BcFcz1iAU7auOYe2qPj+5tR3915hCYx b24sQTHOkCb6xQ5LnZyOvbGtsFDBa4Gd6hV/I5sk= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpa-AQ; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 19/41] media: atomisp: remove kvmalloc/kvcalloc abstractions Date: Sat, 30 May 2020 08:55:36 +0200 Message-Id: <68738042a2d5d4bff08dee70d928f1026db47fdf.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The sh_css layer adds an abstraction for kvmalloc/kvcalloc. Get rid of them. Most of the work here was done by this small coccinelle script: @@ expression size; @@ - sh_css_malloc(size) + kvmalloc(size, GFP_KERNEL) @@ expression n; expression size; @@ - sh_css_calloc(n, size) + kvcalloc(n, size, GFP_KERNEL) Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/pci/base/refcount/src/refcount.c | 4 +- .../kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 14 +- .../kernels/sdis/sdis_2/ia_css_sdis2.host.c | 4 +- .../atomisp/pci/runtime/binary/src/binary.c | 6 +- .../atomisp/pci/runtime/frame/src/frame.c | 12 +- .../pci/runtime/isp_param/src/isp_param.c | 6 +- .../pci/runtime/pipeline/src/pipeline.c | 4 +- .../atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c | 4 +- drivers/staging/media/atomisp/pci/sh_css.c | 35 +-- .../media/atomisp/pci/sh_css_host_data.c | 4 +- .../media/atomisp/pci/sh_css_internal.h | 6 - .../media/atomisp/pci/sh_css_metrics.c | 9 +- .../media/atomisp/pci/sh_css_param_dvs.c | 30 +- .../media/atomisp/pci/sh_css_param_shading.c | 7 +- .../staging/media/atomisp/pci/sh_css_params.c | 262 ++++++++++-------- 15 files changed, 202 insertions(+), 205 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c index 1616f3a38ddd..997f275ea9ec 100644 --- a/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c +++ b/drivers/staging/media/atomisp/pci/base/refcount/src/refcount.c @@ -81,7 +81,7 @@ enum ia_css_err ia_css_refcount_init(uint32_t size) return IA_CSS_ERR_INTERNAL_ERROR; } myrefcount.items = - sh_css_malloc(sizeof(struct ia_css_refcount_entry) * size); + kvmalloc(sizeof(struct ia_css_refcount_entry) * size, GFP_KERNEL); if (!myrefcount.items) err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; if (err == IA_CSS_SUCCESS) { @@ -115,7 +115,7 @@ void ia_css_refcount_uninit(void) entry->id = 0; } } - sh_css_free(myrefcount.items); + kvfree(myrefcount.items); myrefcount.items = NULL; myrefcount.size = 0; ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index dfd621d3f6da..2fe081ee005a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -318,7 +318,7 @@ ia_css_isp_dvs_statistics_allocate( if (!grid->enable) return NULL; - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; @@ -359,7 +359,7 @@ ia_css_isp_dvs_statistics_map_allocate( * so we use a local char * instead. */ char *base_ptr; - me = sh_css_malloc(sizeof(*me)); + me = kvmalloc(sizeof(*me), GFP_KERNEL); if (!me) { IA_CSS_LOG("cannot allocate memory"); goto err; @@ -369,7 +369,7 @@ ia_css_isp_dvs_statistics_map_allocate( me->data_allocated = !data_ptr; if (!me->data_ptr) { - me->data_ptr = sh_css_malloc(isp_stats->size); + me->data_ptr = kvmalloc(isp_stats->size, GFP_KERNEL); if (!me->data_ptr) { IA_CSS_LOG("cannot allocate memory"); goto err; @@ -386,7 +386,7 @@ ia_css_isp_dvs_statistics_map_allocate( return me; err: if (me) - sh_css_free(me); + kvfree(me); return NULL; } @@ -395,8 +395,8 @@ ia_css_isp_dvs_statistics_map_free(struct ia_css_isp_dvs_statistics_map *me) { if (me) { if (me->data_allocated) - sh_css_free(me->data_ptr); - sh_css_free(me); + kvfree(me->data_ptr); + kvfree(me); } } @@ -405,7 +405,7 @@ ia_css_isp_dvs_statistics_free(struct ia_css_isp_dvs_statistics *me) { if (me) { hmm_free(me->data_ptr); - sh_css_free(me); + kvfree(me); } } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index ca34299b7998..2d2708bde17e 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -285,7 +285,7 @@ ia_css_isp_dvs2_statistics_allocate( if (!grid->enable) return NULL; - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; @@ -318,7 +318,7 @@ ia_css_isp_dvs2_statistics_free(struct ia_css_isp_dvs_statistics *me) { if (me) { hmm_free(me->data_ptr); - sh_css_free(me); + kvfree(me); } } diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c index c7083d9b3f10..fd4ecd697868 100644 --- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c @@ -927,8 +927,8 @@ ia_css_binary_init_infos(void) { if (num_of_isp_binaries == 0) return IA_CSS_SUCCESS; - all_binaries = sh_css_malloc(num_of_isp_binaries * - sizeof(*all_binaries)); + all_binaries = kvmalloc(num_of_isp_binaries * sizeof(*all_binaries), + GFP_KERNEL); if (!all_binaries) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -966,7 +966,7 @@ ia_css_binary_uninit(void) { } binary_infos[i] = NULL; } - sh_css_free(all_binaries); + kvfree(all_binaries); return IA_CSS_SUCCESS; } diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c index c7d15a01ec9a..95dcb2b86388 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c @@ -189,7 +189,7 @@ enum ia_css_err ia_css_frame_map(struct ia_css_frame **frame, error: if (err != IA_CSS_SUCCESS) { - sh_css_free(me); + kvfree(me); me = NULL; } @@ -228,7 +228,7 @@ enum ia_css_err ia_css_frame_create_from_info(struct ia_css_frame **frame, err = ia_css_frame_init_planes(me); if (err != IA_CSS_SUCCESS) { - sh_css_free(me); + kvfree(me); me = NULL; } @@ -321,7 +321,7 @@ void ia_css_frame_free(struct ia_css_frame *frame) if (frame) { hmm_free(frame->data); - sh_css_free(frame); + kvfree(frame); } IA_CSS_LEAVE_PRIVATE("void"); @@ -551,7 +551,7 @@ enum ia_css_err ia_css_frame_allocate_with_buffer_size( err = frame_allocate_buffer_data(me); if (err != IA_CSS_SUCCESS) { - sh_css_free(me); + kvfree(me); me = NULL; } @@ -837,7 +837,7 @@ static enum ia_css_err frame_allocate_with_data(struct ia_css_frame **frame, err = frame_allocate_buffer_data(me); if (err != IA_CSS_SUCCESS) { - sh_css_free(me); + kvfree(me); #ifndef ISP2401 return err; #else @@ -858,7 +858,7 @@ static struct ia_css_frame *frame_create(unsigned int width, bool contiguous, bool valid) { - struct ia_css_frame *me = sh_css_malloc(sizeof(*me)); + struct ia_css_frame *me = kvmalloc(sizeof(*me), GFP_KERNEL); if (!me) return NULL; diff --git a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c index 6f7c21bbe62d..126d1826aa3e 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c +++ b/drivers/staging/media/atomisp/pci/runtime/isp_param/src/isp_param.c @@ -122,7 +122,9 @@ ia_css_isp_param_allocate_isp_parameters( css_params->params[pclass][mem].size = size; css_params->params[pclass][mem].address = 0x0; if (size) { - mem_params->params[pclass][mem].address = sh_css_calloc(1, size); + mem_params->params[pclass][mem].address = kvcalloc(1, + size, + GFP_KERNEL); if (!mem_params->params[pclass][mem].address) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto cleanup; @@ -153,7 +155,7 @@ ia_css_isp_param_destroy_isp_parameters( for (mem = 0; mem < IA_CSS_NUM_MEMORIES; mem++) { for (pclass = 0; pclass < IA_CSS_NUM_PARAM_CLASSES; pclass++) { if (mem_params->params[pclass][mem].address) - sh_css_free(mem_params->params[pclass][mem].address); + kvfree(mem_params->params[pclass][mem].address); if (css_params->params[pclass][mem].address) hmm_free(css_params->params[pclass][mem].address); mem_params->params[pclass][mem].address = NULL; diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c index f65d7491abd9..ebf36f7a514f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c @@ -512,7 +512,7 @@ static void pipeline_stage_destroy(struct ia_css_pipeline_stage *stage) ia_css_frame_free(stage->args.out_vf_frame); stage->args.out_vf_frame = NULL; } - sh_css_free(stage); + kvfree(stage); } static void pipeline_init_sp_thread_map(void) @@ -593,7 +593,7 @@ static enum ia_css_err pipeline_stage_create( out_frame[i] = stage_desc->out_frame[i]; } - stage = sh_css_malloc(sizeof(*stage)); + stage = kvmalloc(sizeof(*stage), GFP_KERNEL); if (!stage) { err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto ERR; diff --git a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c index 546988a1a42e..53bcfd380742 100644 --- a/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c +++ b/drivers/staging/media/atomisp/pci/runtime/rmgr/src/rmgr_vbuf.c @@ -152,7 +152,7 @@ enum ia_css_err ia_css_rmgr_init_vbuf(struct ia_css_rmgr_vbuf_pool *pool) bytes_needed = sizeof(void *) * pool->size; - pool->handles = sh_css_malloc(bytes_needed); + pool->handles = kvmalloc(bytes_needed, GFP_KERNEL); if (pool->handles) memset(pool->handles, 0, bytes_needed); else @@ -196,7 +196,7 @@ void ia_css_rmgr_uninit_vbuf(struct ia_css_rmgr_vbuf_pool *pool) } } /* now free the pool handles list */ - sh_css_free(pool->handles); + kvfree(pool->handles); pool->handles = NULL; } } diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 835da6f12309..6e18841db58a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -1860,35 +1860,6 @@ ia_css_enable_isys_event_queue(bool enable) { return IA_CSS_SUCCESS; } -void *sh_css_malloc(size_t size) -{ - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_malloc() enter: size=%zu\n", - size); - /* FIXME: This first test can probably go away */ - if (size == 0) - return NULL; - if (size > PAGE_SIZE) - return vmalloc(size); - return kmalloc(size, GFP_KERNEL); -} - -void *sh_css_calloc(size_t N, size_t size) -{ - void *p; - - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, - "sh_css_calloc() enter: N=%zu, size=%zu\n", N, size); - - /* FIXME: this test can probably go away */ - if (size > 0) { - p = sh_css_malloc(N * size); - if (p) - memset(p, 0, size); - return p; - } - return NULL; -} - void sh_css_free(void *ptr) { if (is_vmalloc_addr(ptr)) @@ -9033,7 +9004,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, i); if (err != IA_CSS_SUCCESS) { IA_CSS_LEAVE_ERR_PRIVATE(err); - sh_css_free(internal_pipe); + kvfree(internal_pipe); internal_pipe = NULL; return err; } @@ -9052,7 +9023,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, i); if (err != IA_CSS_SUCCESS) { IA_CSS_LEAVE_ERR_PRIVATE(err); - sh_css_free(internal_pipe); + kvfree(internal_pipe); internal_pipe = NULL; return err; } @@ -9064,7 +9035,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, internal_pipe->config.acc_extension); if (err != IA_CSS_SUCCESS) { IA_CSS_LEAVE_ERR_PRIVATE(err); - sh_css_free(internal_pipe); + kvfree(internal_pipe); return err; } } diff --git a/drivers/staging/media/atomisp/pci/sh_css_host_data.c b/drivers/staging/media/atomisp/pci/sh_css_host_data.c index 348183a221a8..69a7464b772a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_host_data.c +++ b/drivers/staging/media/atomisp/pci/sh_css_host_data.c @@ -24,7 +24,7 @@ struct ia_css_host_data *ia_css_host_data_allocate(size_t size) if (!me) return NULL; me->size = (uint32_t)size; - me->address = sh_css_malloc(size); + me->address = kvmalloc(size, GFP_KERNEL); if (!me->address) { kfree(me); return NULL; @@ -35,7 +35,7 @@ struct ia_css_host_data *ia_css_host_data_allocate(size_t size) void ia_css_host_data_free(struct ia_css_host_data *me) { if (me) { - sh_css_free(me->address); + kvfree(me->address); me->address = NULL; kfree(me); } diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index aaf37f0ad753..272c758dde5d 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -968,12 +968,6 @@ sh_css_params_init(void); void sh_css_params_uninit(void); -void *sh_css_malloc(size_t size); - -void *sh_css_calloc(size_t N, size_t size); - -void sh_css_free(void *ptr); - /* For Acceleration API: Flush FW (shared buffer pointer) arguments */ void sh_css_flush(struct ia_css_acc_fw *fw); diff --git a/drivers/staging/media/atomisp/pci/sh_css_metrics.c b/drivers/staging/media/atomisp/pci/sh_css_metrics.c index 17f6dd9afab4..44a01c0db808 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_metrics.c +++ b/drivers/staging/media/atomisp/pci/sh_css_metrics.c @@ -67,13 +67,16 @@ make_histogram(struct sh_css_pc_histogram *histogram, unsigned int length) return; if (histogram->run) return; - histogram->run = sh_css_malloc(length * sizeof(*histogram->run)); + histogram->run = kvmalloc(length * sizeof(*histogram->run), + GFP_KERNEL); if (!histogram->run) return; - histogram->stall = sh_css_malloc(length * sizeof(*histogram->stall)); + histogram->stall = kvmalloc(length * sizeof(*histogram->stall), + GFP_KERNEL); if (!histogram->stall) return; - histogram->msink = sh_css_malloc(length * sizeof(*histogram->msink)); + histogram->msink = kvmalloc(length * sizeof(*histogram->msink), + GFP_KERNEL); if (!histogram->msink) return; diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c index 025f26a40062..e8ef69309d92 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_dvs.c @@ -30,8 +30,8 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res, enum ia_css_err err = IA_CSS_SUCCESS; struct ia_css_dvs_6axis_config *dvs_config = NULL; - dvs_config = (struct ia_css_dvs_6axis_config *)sh_css_malloc(sizeof( - struct ia_css_dvs_6axis_config)); + dvs_config = kvmalloc(sizeof(struct ia_css_dvs_6axis_config), + GFP_KERNEL); if (!dvs_config) { IA_CSS_ERROR("out of memory"); err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -57,16 +57,16 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res, } /* Generate Y buffers */ - dvs_config->xcoords_y = (uint32_t *)sh_css_malloc(width_y * height_y * sizeof( - uint32_t)); + dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->xcoords_y) { IA_CSS_ERROR("out of memory"); err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto exit; } - dvs_config->ycoords_y = (uint32_t *)sh_css_malloc(width_y * height_y * sizeof( - uint32_t)); + dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->ycoords_y) { IA_CSS_ERROR("out of memory"); err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -76,16 +76,16 @@ alloc_dvs_6axis_table(const struct ia_css_resolution *frame_res, /* Generate UV buffers */ IA_CSS_LOG("UV W %d H %d", width_uv, height_uv); - dvs_config->xcoords_uv = (uint32_t *)sh_css_malloc(width_uv * height_uv * - sizeof(uint32_t)); + dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->xcoords_uv) { IA_CSS_ERROR("out of memory"); err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; goto exit; } - dvs_config->ycoords_uv = (uint32_t *)sh_css_malloc(width_uv * height_uv * - sizeof(uint32_t)); + dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->ycoords_uv) { IA_CSS_ERROR("out of memory"); err = IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -207,28 +207,28 @@ free_dvs_6axis_table(struct ia_css_dvs_6axis_config **dvs_6axis_config) if ((dvs_6axis_config) && (*dvs_6axis_config)) { IA_CSS_ENTER_PRIVATE("dvs_6axis_config %p", (*dvs_6axis_config)); if ((*dvs_6axis_config)->xcoords_y) { - sh_css_free((*dvs_6axis_config)->xcoords_y); + kvfree((*dvs_6axis_config)->xcoords_y); (*dvs_6axis_config)->xcoords_y = NULL; } if ((*dvs_6axis_config)->ycoords_y) { - sh_css_free((*dvs_6axis_config)->ycoords_y); + kvfree((*dvs_6axis_config)->ycoords_y); (*dvs_6axis_config)->ycoords_y = NULL; } /* Free up UV buffers */ if ((*dvs_6axis_config)->xcoords_uv) { - sh_css_free((*dvs_6axis_config)->xcoords_uv); + kvfree((*dvs_6axis_config)->xcoords_uv); (*dvs_6axis_config)->xcoords_uv = NULL; } if ((*dvs_6axis_config)->ycoords_uv) { - sh_css_free((*dvs_6axis_config)->ycoords_uv); + kvfree((*dvs_6axis_config)->ycoords_uv); (*dvs_6axis_config)->ycoords_uv = NULL; } IA_CSS_LEAVE_PRIVATE("dvs_6axis_config %p", (*dvs_6axis_config)); - sh_css_free(*dvs_6axis_config); + kvfree(*dvs_6axis_config); *dvs_6axis_config = NULL; } } diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c index 4b648df2d073..0a6e0dbe1e2a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c @@ -360,12 +360,13 @@ ia_css_shading_table_alloc( me->fraction_bits = 0; for (i = 0; i < IA_CSS_SC_NUM_COLORS; i++) { me->data[i] = - sh_css_malloc(width * height * sizeof(*me->data[0])); + kvmalloc(width * height * sizeof(*me->data[0]), + GFP_KERNEL); if (!me->data[i]) { unsigned int j; for (j = 0; j < i; j++) { - sh_css_free(me->data[j]); + kvfree(me->data[j]); me->data[j] = NULL; } kfree(me); @@ -392,7 +393,7 @@ ia_css_shading_table_free(struct ia_css_shading_table *table) for (i = 0; i < IA_CSS_SC_NUM_COLORS; i++) { if (table->data[i]) { - sh_css_free(table->data[i]); + kvfree(table->data[i]); table->data[i] = NULL; } } diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index f1b543a6db82..45df88e2aa74 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -1496,12 +1496,13 @@ sh_css_set_black_frame(struct ia_css_stream *stream, if (params->fpn_config.data && (params->fpn_config.width != width || params->fpn_config.height != height)) { - sh_css_free(params->fpn_config.data); + kvfree(params->fpn_config.data); params->fpn_config.data = NULL; } if (!params->fpn_config.data) { - params->fpn_config.data = sh_css_malloc(height * width * sizeof(short)); + params->fpn_config.data = kvmalloc(height * width * + sizeof(short), GFP_KERNEL); if (!params->fpn_config.data) { IA_CSS_ERROR("out of memory"); IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY); @@ -1910,16 +1911,16 @@ void ia_css_morph_table_free( for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) { if (me->coordinates_x[i]) { - sh_css_free(me->coordinates_x[i]); + kvfree(me->coordinates_x[i]); me->coordinates_x[i] = NULL; } if (me->coordinates_y[i]) { - sh_css_free(me->coordinates_y[i]); + kvfree(me->coordinates_y[i]); me->coordinates_y[i] = NULL; } } - sh_css_free(me); + kvfree(me); IA_CSS_LEAVE("void"); } @@ -1932,7 +1933,7 @@ struct ia_css_morph_table *ia_css_morph_table_allocate( IA_CSS_ENTER(""); - me = sh_css_malloc(sizeof(*me)); + me = kvmalloc(sizeof(*me), GFP_KERNEL); if (!me) { IA_CSS_ERROR("out of memory"); return me; @@ -1944,12 +1945,12 @@ struct ia_css_morph_table *ia_css_morph_table_allocate( } for (i = 0; i < IA_CSS_MORPH_TABLE_NUM_PLANES; i++) { - me->coordinates_x[i] = - sh_css_malloc(height * width * - sizeof(*me->coordinates_x[i])); - me->coordinates_y[i] = - sh_css_malloc(height * width * - sizeof(*me->coordinates_y[i])); + me->coordinates_x[i] = kvmalloc(height * width * + sizeof(*me->coordinates_x[i]), + GFP_KERNEL); + me->coordinates_y[i] = kvmalloc(height * width * + sizeof(*me->coordinates_y[i]), + GFP_KERNEL); if ((!me->coordinates_x[i]) || (!me->coordinates_y[i])) { @@ -2063,11 +2064,11 @@ ia_css_isp_3a_statistics_map_free(struct ia_css_isp_3a_statistics_map *me) { if (me) { if (me->data_allocated) { - sh_css_free(me->data_ptr); + kvfree(me->data_ptr); me->data_ptr = NULL; me->data_allocated = false; } - sh_css_free(me); + kvfree(me); } } @@ -2081,7 +2082,7 @@ ia_css_isp_3a_statistics_map_allocate( * so we use a local char * instead. */ char *base_ptr; - me = sh_css_malloc(sizeof(*me)); + me = kvmalloc(sizeof(*me), GFP_KERNEL); if (!me) { IA_CSS_LEAVE("cannot allocate memory"); goto err; @@ -2090,7 +2091,7 @@ ia_css_isp_3a_statistics_map_allocate( me->data_ptr = data_ptr; me->data_allocated = !data_ptr; if (!data_ptr) { - me->data_ptr = sh_css_malloc(isp_stats->size); + me->data_ptr = kvmalloc(isp_stats->size, GFP_KERNEL); if (!me->data_ptr) { IA_CSS_LEAVE("cannot allocate memory"); goto err; @@ -2113,7 +2114,7 @@ ia_css_isp_3a_statistics_map_allocate( err: if (me) - sh_css_free(me); + kvfree(me); return NULL; } @@ -2780,7 +2781,7 @@ ia_css_isp_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid) if (!grid->enable) return NULL; - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; @@ -2804,7 +2805,7 @@ ia_css_isp_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid) me->size = me->dmem_size + me->vmem_size * 2 + me->hmem_size; me->data_ptr = hmm_alloc(me->size, HMM_BO_PRIVATE, 0, NULL, 0); if (me->data_ptr == mmgr_NULL) { - sh_css_free(me); + kvfree(me); me = NULL; goto err; } @@ -2827,7 +2828,7 @@ ia_css_isp_3a_statistics_free(struct ia_css_isp_3a_statistics *me) { if (me) { hmm_free(me->data_ptr); - sh_css_free(me); + kvfree(me); } } @@ -2846,7 +2847,7 @@ ia_css_metadata_allocate(const struct ia_css_metadata_info *metadata_info) if (metadata_info->size == 0) return NULL; - md = sh_css_malloc(sizeof(*md)); + md = kvmalloc(sizeof(*md), GFP_KERNEL); if (!md) goto error; @@ -2876,7 +2877,7 @@ ia_css_metadata_free(struct ia_css_metadata *me) * and debugging. */ IA_CSS_ENTER("me=%p", me); hmm_free(me->address); - sh_css_free(me); + kvfree(me); IA_CSS_LEAVE("void"); } } @@ -2977,7 +2978,7 @@ sh_css_create_isp_params(struct ia_css_stream *stream, enum ia_css_err err = IA_CSS_SUCCESS; size_t params_size; struct ia_css_isp_parameters *params = - sh_css_malloc(sizeof(struct ia_css_isp_parameters)); + kvmalloc(sizeof(struct ia_css_isp_parameters), GFP_KERNEL); if (!params) { @@ -3526,7 +3527,7 @@ ia_css_stream_isp_parameters_uninit(struct ia_css_stream *stream) free_map(&per_frame_params->ddr_ptrs); if (params->fpn_config.data) { - sh_css_free(params->fpn_config.data); + kvfree(params->fpn_config.data); params->fpn_config.data = NULL; } @@ -3542,9 +3543,9 @@ ia_css_stream_isp_parameters_uninit(struct ia_css_stream *stream) } } - sh_css_free(params); + kvfree(params); if (per_frame_params) - sh_css_free(per_frame_params); + kvfree(per_frame_params); stream->isp_params_configs = NULL; stream->per_frame_isp_params_configs = NULL; @@ -4880,19 +4881,18 @@ ia_css_3a_statistics_allocate(const struct ia_css_3a_grid_info *grid) assert(grid); - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; me->grid = *grid; grid_size = grid->width * grid->height; - me->data = sh_css_malloc(grid_size * sizeof(*me->data)); + me->data = kvmalloc(grid_size * sizeof(*me->data), GFP_KERNEL); if (!me->data) goto err; #if !defined(HAS_NO_HMEM) /* No weighted histogram, no structure, treat the histogram data as a byte dump in a byte array */ - me->rgby_data = (struct ia_css_3a_rgby_output *)sh_css_malloc(sizeof_hmem( - HMEM0_ID)); + me->rgby_data = kvmalloc(sizeof_hmem(HMEM0_ID), GFP_KERNEL); #else me->rgby_data = NULL; #endif @@ -4910,10 +4910,10 @@ void ia_css_3a_statistics_free(struct ia_css_3a_statistics *me) { if (me) { - sh_css_free(me->rgby_data); - sh_css_free(me->data); + kvfree(me->rgby_data); + kvfree(me->data); memset(me, 0, sizeof(struct ia_css_3a_statistics)); - sh_css_free(me); + kvfree(me); } } @@ -4924,18 +4924,18 @@ ia_css_dvs_statistics_allocate(const struct ia_css_dvs_grid_info *grid) assert(grid); - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; me->grid = *grid; - me->hor_proj = sh_css_malloc(grid->height * IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->hor_proj)); + me->hor_proj = kvmalloc(grid->height * IA_CSS_DVS_NUM_COEF_TYPES * + sizeof(*me->hor_proj), GFP_KERNEL); if (!me->hor_proj) goto err; - me->ver_proj = sh_css_malloc(grid->width * IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->ver_proj)); + me->ver_proj = kvmalloc(grid->width * IA_CSS_DVS_NUM_COEF_TYPES * + sizeof(*me->ver_proj), GFP_KERNEL); if (!me->ver_proj) goto err; @@ -4949,10 +4949,10 @@ void ia_css_dvs_statistics_free(struct ia_css_dvs_statistics *me) { if (me) { - sh_css_free(me->hor_proj); - sh_css_free(me->ver_proj); + kvfree(me->hor_proj); + kvfree(me->ver_proj); memset(me, 0, sizeof(struct ia_css_dvs_statistics)); - sh_css_free(me); + kvfree(me); } } @@ -4963,21 +4963,21 @@ ia_css_dvs_coefficients_allocate(const struct ia_css_dvs_grid_info *grid) assert(grid); - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; me->grid = *grid; - me->hor_coefs = sh_css_malloc(grid->num_hor_coefs * - IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->hor_coefs)); + me->hor_coefs = kvmalloc(grid->num_hor_coefs * + IA_CSS_DVS_NUM_COEF_TYPES * + sizeof(*me->hor_coefs), GFP_KERNEL); if (!me->hor_coefs) goto err; - me->ver_coefs = sh_css_malloc(grid->num_ver_coefs * - IA_CSS_DVS_NUM_COEF_TYPES * - sizeof(*me->ver_coefs)); + me->ver_coefs = kvmalloc(grid->num_ver_coefs * + IA_CSS_DVS_NUM_COEF_TYPES * + sizeof(*me->ver_coefs), GFP_KERNEL); if (!me->ver_coefs) goto err; @@ -4991,10 +4991,10 @@ void ia_css_dvs_coefficients_free(struct ia_css_dvs_coefficients *me) { if (me) { - sh_css_free(me->hor_coefs); - sh_css_free(me->ver_coefs); + kvfree(me->hor_coefs); + kvfree(me->ver_coefs); memset(me, 0, sizeof(struct ia_css_dvs_coefficients)); - sh_css_free(me); + kvfree(me); } } @@ -5005,49 +5005,65 @@ ia_css_dvs2_statistics_allocate(const struct ia_css_dvs_grid_info *grid) assert(grid); - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; me->grid = *grid; - me->hor_prod.odd_real = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->hor_prod.odd_real)); + me->hor_prod.odd_real = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->hor_prod.odd_real), + GFP_KERNEL); if (!me->hor_prod.odd_real) goto err; - me->hor_prod.odd_imag = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->hor_prod.odd_imag)); + me->hor_prod.odd_imag = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->hor_prod.odd_imag), + GFP_KERNEL); if (!me->hor_prod.odd_imag) goto err; - me->hor_prod.even_real = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->hor_prod.even_real)); + me->hor_prod.even_real = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->hor_prod.even_real), + GFP_KERNEL); if (!me->hor_prod.even_real) goto err; - me->hor_prod.even_imag = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->hor_prod.even_imag)); + me->hor_prod.even_imag = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->hor_prod.even_imag), + GFP_KERNEL); if (!me->hor_prod.even_imag) goto err; - me->ver_prod.odd_real = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->ver_prod.odd_real)); + me->ver_prod.odd_real = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->ver_prod.odd_real), + GFP_KERNEL); if (!me->ver_prod.odd_real) goto err; - me->ver_prod.odd_imag = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->ver_prod.odd_imag)); + me->ver_prod.odd_imag = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->ver_prod.odd_imag), + GFP_KERNEL); if (!me->ver_prod.odd_imag) goto err; - me->ver_prod.even_real = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->ver_prod.even_real)); + me->ver_prod.even_real = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->ver_prod.even_real), + GFP_KERNEL); if (!me->ver_prod.even_real) goto err; - me->ver_prod.even_imag = sh_css_malloc(grid->aligned_width * - grid->aligned_height * sizeof(*me->ver_prod.even_imag)); + me->ver_prod.even_imag = kvmalloc(grid->aligned_width * + grid->aligned_height * + sizeof(*me->ver_prod.even_imag), + GFP_KERNEL); if (!me->ver_prod.even_imag) goto err; @@ -5061,16 +5077,16 @@ void ia_css_dvs2_statistics_free(struct ia_css_dvs2_statistics *me) { if (me) { - sh_css_free(me->hor_prod.odd_real); - sh_css_free(me->hor_prod.odd_imag); - sh_css_free(me->hor_prod.even_real); - sh_css_free(me->hor_prod.even_imag); - sh_css_free(me->ver_prod.odd_real); - sh_css_free(me->ver_prod.odd_imag); - sh_css_free(me->ver_prod.even_real); - sh_css_free(me->ver_prod.even_imag); + kvfree(me->hor_prod.odd_real); + kvfree(me->hor_prod.odd_imag); + kvfree(me->hor_prod.even_real); + kvfree(me->hor_prod.even_imag); + kvfree(me->ver_prod.odd_real); + kvfree(me->ver_prod.odd_imag); + kvfree(me->ver_prod.even_real); + kvfree(me->ver_prod.even_imag); memset(me, 0, sizeof(struct ia_css_dvs2_statistics)); - sh_css_free(me); + kvfree(me); } } @@ -5081,49 +5097,57 @@ ia_css_dvs2_coefficients_allocate(const struct ia_css_dvs_grid_info *grid) assert(grid); - me = sh_css_calloc(1, sizeof(*me)); + me = kvcalloc(1, sizeof(*me), GFP_KERNEL); if (!me) goto err; me->grid = *grid; - me->hor_coefs.odd_real = sh_css_malloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.odd_real)); + me->hor_coefs.odd_real = kvmalloc(grid->num_hor_coefs * + sizeof(*me->hor_coefs.odd_real), + GFP_KERNEL); if (!me->hor_coefs.odd_real) goto err; - me->hor_coefs.odd_imag = sh_css_malloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.odd_imag)); + me->hor_coefs.odd_imag = kvmalloc(grid->num_hor_coefs * + sizeof(*me->hor_coefs.odd_imag), + GFP_KERNEL); if (!me->hor_coefs.odd_imag) goto err; - me->hor_coefs.even_real = sh_css_malloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.even_real)); + me->hor_coefs.even_real = kvmalloc(grid->num_hor_coefs * + sizeof(*me->hor_coefs.even_real), + GFP_KERNEL); if (!me->hor_coefs.even_real) goto err; - me->hor_coefs.even_imag = sh_css_malloc(grid->num_hor_coefs * - sizeof(*me->hor_coefs.even_imag)); + me->hor_coefs.even_imag = kvmalloc(grid->num_hor_coefs * + sizeof(*me->hor_coefs.even_imag), + GFP_KERNEL); if (!me->hor_coefs.even_imag) goto err; - me->ver_coefs.odd_real = sh_css_malloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.odd_real)); + me->ver_coefs.odd_real = kvmalloc(grid->num_ver_coefs * + sizeof(*me->ver_coefs.odd_real), + GFP_KERNEL); if (!me->ver_coefs.odd_real) goto err; - me->ver_coefs.odd_imag = sh_css_malloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.odd_imag)); + me->ver_coefs.odd_imag = kvmalloc(grid->num_ver_coefs * + sizeof(*me->ver_coefs.odd_imag), + GFP_KERNEL); if (!me->ver_coefs.odd_imag) goto err; - me->ver_coefs.even_real = sh_css_malloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.even_real)); + me->ver_coefs.even_real = kvmalloc(grid->num_ver_coefs * + sizeof(*me->ver_coefs.even_real), + GFP_KERNEL); if (!me->ver_coefs.even_real) goto err; - me->ver_coefs.even_imag = sh_css_malloc(grid->num_ver_coefs * - sizeof(*me->ver_coefs.even_imag)); + me->ver_coefs.even_imag = kvmalloc(grid->num_ver_coefs * + sizeof(*me->ver_coefs.even_imag), + GFP_KERNEL); if (!me->ver_coefs.even_imag) goto err; @@ -5137,16 +5161,16 @@ void ia_css_dvs2_coefficients_free(struct ia_css_dvs2_coefficients *me) { if (me) { - sh_css_free(me->hor_coefs.odd_real); - sh_css_free(me->hor_coefs.odd_imag); - sh_css_free(me->hor_coefs.even_real); - sh_css_free(me->hor_coefs.even_imag); - sh_css_free(me->ver_coefs.odd_real); - sh_css_free(me->ver_coefs.odd_imag); - sh_css_free(me->ver_coefs.even_real); - sh_css_free(me->ver_coefs.even_imag); + kvfree(me->hor_coefs.odd_real); + kvfree(me->hor_coefs.odd_imag); + kvfree(me->hor_coefs.even_real); + kvfree(me->hor_coefs.even_imag); + kvfree(me->ver_coefs.odd_real); + kvfree(me->ver_coefs.odd_imag); + kvfree(me->ver_coefs.even_real); + kvfree(me->ver_coefs.even_imag); memset(me, 0, sizeof(struct ia_css_dvs2_coefficients)); - sh_css_free(me); + kvfree(me); } } @@ -5169,8 +5193,8 @@ ia_css_dvs2_6axis_config_allocate(const struct ia_css_stream *stream) goto err; } - dvs_config = (struct ia_css_dvs_6axis_config *)sh_css_calloc(1, - sizeof(struct ia_css_dvs_6axis_config)); + dvs_config = kvcalloc(1, sizeof(struct ia_css_dvs_6axis_config), + GFP_KERNEL); if (!dvs_config) goto err; @@ -5184,23 +5208,25 @@ ia_css_dvs2_6axis_config_allocate(const struct ia_css_stream *stream) params->pipe_dvs_6axis_config[IA_CSS_PIPE_ID_VIDEO]->height_uv; IA_CSS_LOG("table Y: W %d H %d", width_y, height_y); IA_CSS_LOG("table UV: W %d H %d", width_uv, height_uv); - dvs_config->xcoords_y = (uint32_t *)sh_css_malloc(width_y * height_y * sizeof( - uint32_t)); + dvs_config->xcoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->xcoords_y) goto err; - dvs_config->ycoords_y = (uint32_t *)sh_css_malloc(width_y * height_y * sizeof( - uint32_t)); + dvs_config->ycoords_y = kvmalloc(width_y * height_y * sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->ycoords_y) goto err; - dvs_config->xcoords_uv = (uint32_t *)sh_css_malloc(width_uv * height_uv * - sizeof(uint32_t)); + dvs_config->xcoords_uv = kvmalloc(width_uv * height_uv * + sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->xcoords_uv) goto err; - dvs_config->ycoords_uv = (uint32_t *)sh_css_malloc(width_uv * height_uv * - sizeof(uint32_t)); + dvs_config->ycoords_uv = kvmalloc(width_uv * height_uv * + sizeof(uint32_t), + GFP_KERNEL); if (!dvs_config->ycoords_uv) goto err; @@ -5214,12 +5240,12 @@ void ia_css_dvs2_6axis_config_free(struct ia_css_dvs_6axis_config *dvs_6axis_config) { if (dvs_6axis_config) { - sh_css_free(dvs_6axis_config->xcoords_y); - sh_css_free(dvs_6axis_config->ycoords_y); - sh_css_free(dvs_6axis_config->xcoords_uv); - sh_css_free(dvs_6axis_config->ycoords_uv); + kvfree(dvs_6axis_config->xcoords_y); + kvfree(dvs_6axis_config->ycoords_y); + kvfree(dvs_6axis_config->xcoords_uv); + kvfree(dvs_6axis_config->ycoords_uv); memset(dvs_6axis_config, 0, sizeof(struct ia_css_dvs_6axis_config)); - sh_css_free(dvs_6axis_config); + kvfree(dvs_6axis_config); } } From patchwork Sat May 30 06:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 154A6C433E0 for ; Sat, 30 May 2020 06:58:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E75BF207D0 for ; Sat, 30 May 2020 06:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821905; bh=yFRa24i4VZ+8r6vgV7GGlJU8KEqcDpSlIGpTIMqi52s=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Cl7aVKiiF6VH+HntViWOJtE9/fzYTnQRhwHPOuRU8KHDVkA63GRYTX0o1JHZkmE8P XzpOOhTl3F3/KLlk467Myw2gGWVqK4BQ3lo2mHgmPzAyprtetbIaxwUyHF95NCN75f RRrpFN3iWJSjpy+TGrbE04+L+o9bN5pki+a+Lw30= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729140AbgE3G6O (ORCPT ); Sat, 30 May 2020 02:58:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:45018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728854AbgE3G4H (ORCPT ); Sat, 30 May 2020 02:56:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 975DD21775; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=yFRa24i4VZ+8r6vgV7GGlJU8KEqcDpSlIGpTIMqi52s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrhrVxDYZ2Eej4TsUOLZqxyL46Hd+MUo6/ZQz9o4fkqe8da332nVw3OZheLX9rR4E a+r6Z0KnyMxfdskCTIdgQ4HacluOyFEz2rRMcbmM7Rghh60ahofnz03aahRZPzDBo7 W3NdszMRJhApoHiGgoWXODbdaVbawrIrMe4yealg= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpj-DO; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Nathan Chancellor , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, kbuild test robot , Mauro Carvalho Chehab Subject: [PATCH v2 21/41] media: atomisp: Clean up if block in sh_css_sp_init_stage Date: Sat, 30 May 2020 08:55:38 +0200 Message-Id: <19d491af1c88d2b2f04a26301aabb05d233c2e28.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Nathan Chancellor Clang warns: ../drivers/staging/media/atomisp/pci/sh_css_sp.c:1039:23: warning: address of 'binary->in_frame_info' will always evaluate to 'true' [-Wpointer-bool-conversion] } else if (&binary->in_frame_info) { ~~ ~~~~~~~~^~~~~~~~~~~~~ in_frame_info is not a pointer so if binary is not NULL, in_frame_info's address cannot be NULL. Change this to an else since it will always be evaluated as one. While we are here, clean up this if block. The contents of both if blocks are the same but a check against "stage == 0" is added when ISP2401 is defined. USE_INPUT_SYSTEM_VERSION_2401 is only defined when isp2401_system_global.h is included, which only happens when ISP2401. In other words, USE_INPUT_SYSTEM_VERSION_2401 always requires ISP2401 to be defined so the '#ifndef ISP2401' makes no sense. Remove that part of the block to simplify everything. Link: https://github.com/ClangBuiltLinux/linux/issues/1036 Reported-by: kbuild test robot Signed-off-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/sh_css_sp.c | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index db543c3fec51..4f58562fb389 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -1027,34 +1027,15 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, return err; #ifdef USE_INPUT_SYSTEM_VERSION_2401 -#ifndef ISP2401 - if (args->in_frame) - { + if (stage == 0) { pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); if (!pipe) return IA_CSS_ERR_INTERNAL_ERROR; - ia_css_get_crop_offsets(pipe, &args->in_frame->info); - } else if (&binary->in_frame_info) - { - pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); - if (!pipe) - return IA_CSS_ERR_INTERNAL_ERROR; - ia_css_get_crop_offsets(pipe, &binary->in_frame_info); -#else - if (stage == 0) - { - if (args->in_frame) { - pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); - if (!pipe) - return IA_CSS_ERR_INTERNAL_ERROR; + + if (args->in_frame) ia_css_get_crop_offsets(pipe, &args->in_frame->info); - } else if (&binary->in_frame_info) { - pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); - if (!pipe) - return IA_CSS_ERR_INTERNAL_ERROR; + else ia_css_get_crop_offsets(pipe, &binary->in_frame_info); - } -#endif } #else (void)pipe; /*avoid build warning*/ From patchwork Sat May 30 06:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C9C5C433E0 for ; Sat, 30 May 2020 06:59:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE944208B8 for ; Sat, 30 May 2020 06:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821960; bh=oqc98StvgmA7z0fSgQB6Aim2CtSwhSejWpxjl/8s6/s=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=yvo5OgSYHFYkk33R+nqyhzTISwCGg7O9BLZulPn0zC/wzKQ2ZalMbCPApMf3WWxti 2OTOaKIpU3RmgSOVE5f/fdmmvF/mXsE/OjUT4jgbyAu5UKOHcolYswutztZlnN+cV3 KmgGA8KhWtEz4bI84ose7AbVI/vumBluvoQl1YkU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728967AbgE3G7Q (ORCPT ); Sat, 30 May 2020 02:59:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728841AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9628C2176B; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=oqc98StvgmA7z0fSgQB6Aim2CtSwhSejWpxjl/8s6/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NWFDQBTwwLRKuN6wcO9Wbu1fRa01fAY4XnsCdOw5YJ2zKAvUrXAc8bbx87ZLwOdL0 7pN22SE0EtTYX2liFNea+arUesW6LaKESTw3WFySULoO7bfoGkQ+9SE/xV2mXwxSMt OK9kVTOpBkwhVYVZWvXUonRjIw74RrSCjjKZ7Cz8= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpo-FH; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Nathan Chancellor , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, kbuild test robot , Mauro Carvalho Chehab Subject: [PATCH v2 22/41] media: atomisp: Remove second increment of count in atomisp_subdev_probe Date: Sat, 30 May 2020 08:55:39 +0200 Message-Id: <84be50326cb07f7329012a40bc25edf7d2bade84.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Nathan Chancellor Clang warns: ../drivers/staging/media/atomisp/pci/atomisp_v4l2.c:1097:3: warning: variable 'count' is incremented both in the loop header and in the loop body [-Wfor-loop-analysis] count++; ^ This was probably unintentional, remove it. Link: https://github.com/ClangBuiltLinux/linux/issues/1036 Reported-by: kbuild test robot Signed-off-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index c89d477a3948..374b1bb6c339 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1098,7 +1098,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) if (camera_count) break; msleep(SUBDEV_WAIT_TIMEOUT); - count++; } /* Wait more time to give more time for subdev init code to finish */ msleep(5 * SUBDEV_WAIT_TIMEOUT); From patchwork Sat May 30 06:55:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F08B6C433E0 for ; Sat, 30 May 2020 06:58:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA069207D0 for ; Sat, 30 May 2020 06:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821922; bh=Yzed5rl4o/D6irqsjNtXkVmfnaEzIK5vu99aBE8y0Iw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=OHSvwKWyfGADzPkEx2z7rLd3Uic186biZHhLPEcKk+1SsjMvlx9CwhGfDfWHQ32ZN sKNAvUcTabgI6mMZ81pJxzBzpKi4BMYvabfBaP6PSG965+5RxL9MCt8P33PHD8S85i uCCbDUtGP2lZbbwpR7bS9uok7A5AUpOTF882Je5Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729200AbgE3G6k (ORCPT ); Sat, 30 May 2020 02:58:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:44912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728838AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 99E14217A0; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=Yzed5rl4o/D6irqsjNtXkVmfnaEzIK5vu99aBE8y0Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AHPmroCKHerW3ZPLKzUT9vOUTB0ghBBHKR7Xx0M9xNC9msNyeQATNbx/S6X51zS9v xtoSry+ZKqJXEKmFvhj+8McGXUUA3iTf4sJ9pFNhKXlZYuADJWuHLWYxifsLEGzLgV Y7DL+pGJpn7NI19itNKi67M7ReyDEIfWnERHO3qA= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpt-GN; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Nathan Chancellor , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Mauro Carvalho Chehab Subject: [PATCH v2 23/41] media: atomisp: Remove unnecessary NULL checks in ia_css_pipe_load_extension Date: Sat, 30 May 2020 08:55:40 +0200 Message-Id: <9a2bd92d43dc2571c90acffaa1a520af71aef287.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Nathan Chancellor Clang warns: ../drivers/staging/media/atomisp/pci/sh_css.c:8537:14: warning: address of 'pipe->output_stage' will always evaluate to 'true' [-Wpointer-bool-conversion] if (&pipe->output_stage) ~~ ~~~~~~^~~~~~~~~~~~ ../drivers/staging/media/atomisp/pci/sh_css.c:8545:14: warning: address of 'pipe->vf_stage' will always evaluate to 'true' [-Wpointer-bool-conversion] if (&pipe->vf_stage) ~~ ~~~~~~^~~~~~~~ output_stage and vf_stage are pointers in the middle of a struct, their addresses cannot be NULL if pipe is not NULL and pipe is already checked for NULL in this function. Simplify this if block. Link: https://github.com/ClangBuiltLinux/linux/issues/1036 Signed-off-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/sh_css.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 6e18841db58a..4269c16ad4f1 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -8491,22 +8491,9 @@ ia_css_pipe_load_extension(struct ia_css_pipe *pipe, } if (firmware->info.isp.type == IA_CSS_ACC_OUTPUT) - { - if (&pipe->output_stage) - append_firmware(&pipe->output_stage, firmware); - else { - IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR); - return IA_CSS_ERR_INTERNAL_ERROR; - } - } else if (firmware->info.isp.type == IA_CSS_ACC_VIEWFINDER) - { - if (&pipe->vf_stage) - append_firmware(&pipe->vf_stage, firmware); - else { - IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR); - return IA_CSS_ERR_INTERNAL_ERROR; - } - } + append_firmware(&pipe->output_stage, firmware); + else if (firmware->info.isp.type == IA_CSS_ACC_VIEWFINDER) + append_firmware(&pipe->vf_stage, firmware); err = acc_load_extension(firmware); IA_CSS_LEAVE_ERR_PRIVATE(err); From patchwork Sat May 30 06:55:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67048C433E2 for ; Sat, 30 May 2020 06:56:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 35E8820801 for ; Sat, 30 May 2020 06:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821772; bh=xrFsxx88YfCDOsT9CXP87w2g2TCYrLu1dZPyf+iyKFk=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ybfc5DlE4vcwKAlwK8eqK60+9JYrY22fGAzB3ArMnGIG5pOlLhav1Vqs1TayANgzC jIHpnLxZ41NDhh82qqoGiqSnG0fxDxjt9WiHsqZAa+z4udmb5pWz8WTWeD46++Dcfq DIxnafkQ39T3mjZ+GR767l3cd1g7KjxH6JubjNCQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728905AbgE3G4L (ORCPT ); Sat, 30 May 2020 02:56:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:44988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9926721789; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=xrFsxx88YfCDOsT9CXP87w2g2TCYrLu1dZPyf+iyKFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uhj8ubLW1nU8Arl2U9AwZ4jZecnzF5hSo036TwAv6tm8NQS4FPVicSMMxGLjZVyPs bjcG1zxC7o1JXetYO+Ol+szQXkfkHQ1MHRo1AgPtaXhbd+ANhYtfHGF8qA7psMpwd/ Rijax7aTeJuXEILqEREsFJ/QSmLWmxEqrCZYWxZ8= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hpx-HO; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Nathan Chancellor , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Mauro Carvalho Chehab Subject: [PATCH v2 24/41] media: atomisp: Remove unnecessary NULL check in atomisp_param Date: Sat, 30 May 2020 08:55:41 +0200 Message-Id: <3d2b4d8162c9b52b9510425265c5580928ab7cca.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Nathan Chancellor Clang warns: drivers/staging/media/atomisp/pci/atomisp_cmd.c:4278:17: warning: address of 'config->info' will always evaluate to 'true' [-Wpointer-bool-conversion] if (!&config->info) { ~ ~~~~~~~~^~~~ config cannot be NULL because it comes from an ioctl, which ensures that the user is not giving us an invalid pointer through copy_from_user. If config is not NULL, info cannot be NULL. Remove this check. Link: https://github.com/ClangBuiltLinux/linux/issues/1036 Signed-off-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 4913469df2bb..5f34e7586ee4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -4270,7 +4270,6 @@ int atomisp_set_parameters(struct video_device *vdev, int atomisp_param(struct atomisp_sub_device *asd, int flag, struct atomisp_parm *config) { - struct atomisp_device *isp = asd->isp; struct ia_css_pipe_config *vp_cfg = &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. pipe_configs[IA_CSS_PIPE_ID_VIDEO]; @@ -4281,10 +4280,6 @@ int atomisp_param(struct atomisp_sub_device *asd, int flag, atomisp_css_get_dvs_grid_info( &asd->params.curr_grid_info); - if (!&config->info) { - dev_err(isp->dev, "ERROR: NULL pointer in grid_info\n"); - return -EINVAL; - } atomisp_curr_user_grid_info(asd, &config->info); /* We always return the resolution and stride even if there is From patchwork Sat May 30 06:55:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6008C433E0 for ; Sat, 30 May 2020 06:58:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D174206C3 for ; Sat, 30 May 2020 06:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821918; bh=ILWZZh+okXiMKOu1SpkJQl4EysGMmt+0/+95PC1gmvc=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=WHB136EiDiUI2MdOtdv22dETQ1Io87JtWgARqlM/cz0h8aeBGuB+/f9zjxlYQ0vRO T/jt8suCSWJ3HoGSI6tErgsxB5zbqi7G3Kp0g9RxddteJdR9z8KHEjxcyogCNNs2Wx 3a0Zy7ddfGYdB92KLejJ3u63J4rUk5zAuw8Mlw/k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729164AbgE3G6h (ORCPT ); Sat, 30 May 2020 02:58:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:44920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728404AbgE3G4G (ORCPT ); Sat, 30 May 2020 02:56:06 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB1BC21835; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821763; bh=ILWZZh+okXiMKOu1SpkJQl4EysGMmt+0/+95PC1gmvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yJ1Qvi/cYiTrwvIzGwxyZsdEbNVxj/TDmZ3yvTVuA7amaawziUab2kMAL0HkGgwvA JHkVI1nzW27crkbKKSbHdMpTVUioYTzxpP4PhYMNMyTxW+VrPM3jxijQcM6/Su1rsk AQYhPTYAw4xkP8YIXWnlKQsnykJmuwzTBi+p5MJo= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hq3-Ia; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Nathan Chancellor , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Mauro Carvalho Chehab Subject: [PATCH v2 25/41] media: atomisp: Avoid overflow in compute_blending Date: Sat, 30 May 2020 08:55:42 +0200 Message-Id: <22b531f57658727abacb28f534d6fc9d44eee4cf.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Nathan Chancellor Clang warns: drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c:129:35: warning: implicit conversion from 'unsigned long' to 'int32_t' (aka 'int') changes value from 18446744073709543424 to -8192 [-Wconstant-conversion] return MAX(MIN(isp_strength, 0), -XNR_BLENDING_SCALE_FACTOR); ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ XNR_BLENDING_SCALE_FACTOR is BIT(13), or 8192, which will easily fit into a signed 32-bit integer. However, it is an unsigned long, which means that negating it is the same as subtracting that value from ULONG_MAX + 1, which causes it to be larger than a signed 32-bit integer so it gets implicitly converted. We can avoid this by using the variable isp_scale, which holds the value of XNR_BLENDING_SCALE_FACTOR already, where the implicit conversion from unsigned long to s32 already happened. If that were to ever overflow, clang would warn: https://godbolt.org/z/EeSxLG Link: https://github.com/ClangBuiltLinux/linux/issues/1036 Signed-off-by: Nathan Chancellor Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c index a9db6366d20b..629f07faf20a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c @@ -126,7 +126,7 @@ compute_blending(int strength) * exactly as s0.11 fixed point, but -1.0 can. */ isp_strength = -(((strength * isp_scale) + offset) / host_scale); - return MAX(MIN(isp_strength, 0), -XNR_BLENDING_SCALE_FACTOR); + return MAX(MIN(isp_strength, 0), -isp_scale); } void From patchwork Sat May 30 06:55:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01D18C433E5 for ; Sat, 30 May 2020 06:57:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0BAF207D0 for ; Sat, 30 May 2020 06:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821862; bh=wCDBIzjqzhZ/d4K5eGDiOf5Pm6lgLZ8FMLxcABcMHPc=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=DX/N+ymRrVe7hKUg3QxFUdIfia36FB8O9AEMC7nLYO7VoqEKUFqp6Hf0vqH3as0/x AAVCSMYr67+ntE1H7ZnqcsSktYdD2I17fcZjYIrbBPfhnMNm3v115Z13c3Q4uvUg6f wyDQwJXol/rImXgXxsg3xwV7R/u9tyuEzEx1LYL8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729084AbgE3G5m (ORCPT ); Sat, 30 May 2020 02:57:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:44966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728848AbgE3G4H (ORCPT ); Sat, 30 May 2020 02:56:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B819021883; Sat, 30 May 2020 06:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=wCDBIzjqzhZ/d4K5eGDiOf5Pm6lgLZ8FMLxcABcMHPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rggABJFc4GRUfVgeOUTTTADGJ4v0cPCP68kGiuEyuuF1DyzbLpqTfA6Q3Pl9b8+EM Xx7aoRG4rBMrvU4V4z/erH/OFYPuJN0F4DFaN+T13+zFHlLdQ4eDpoxbMlbmIcb3/b A94X12BwzjTA1iFX2ri3/Ha8wsY0/i3VINLlwIgo= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPV-001hqF-M6; Sat, 30 May 2020 08:56:01 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Jiri Kosina , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 28/41] media: atomisp: remove some trivial wrappers from compat css20 Date: Sat, 30 May 2020 08:55:45 +0200 Message-Id: <5df66951743b0e03efa24f2afacd7bd7fecc4258.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are tons of code inside atomisp_compat_css20.c, but several of them are just trivial wrappers to other functions. Getting rid of all of them will take some time, but let's start getting rid of some of the trivial ones. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/atomisp_cmd.c | 5 +- .../media/atomisp/pci/atomisp_compat.h | 10 +-- .../media/atomisp/pci/atomisp_compat_css20.c | 72 ++----------------- .../media/atomisp/pci/atomisp_compat_css20.h | 6 -- .../staging/media/atomisp/pci/atomisp_csi2.c | 4 +- .../staging/media/atomisp/pci/atomisp_drvfs.c | 5 +- .../staging/media/atomisp/pci/atomisp_fops.c | 2 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 4 +- .../staging/media/atomisp/pci/atomisp_v4l2.c | 15 ++-- .../media/atomisp/pci/mmu/sh_mmu_mrfld.c | 2 +- .../media/atomisp/pci/sh_css_firmware.c | 8 +-- 11 files changed, 35 insertions(+), 98 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 5f34e7586ee4..2758c2da60da 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -57,6 +57,7 @@ #include "ia_css_types.h" #include "ia_css_stream.h" +#include "ia_css_debug.h" #include "error_support.h" #include "bits.h" @@ -1503,8 +1504,8 @@ void atomisp_wdt_work(struct work_struct *work) } if (css_recover) { - atomisp_css_debug_dump_sp_sw_debug_info(); - atomisp_css_debug_dump_debug_info(__func__); + ia_css_debug_dump_sp_sw_debug_info(); + ia_css_debug_dump_debug_info(__func__); for (i = 0; i < isp->num_of_streams; i++) { struct atomisp_sub_device *asd = &isp->asd[i]; diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h index 8693f228a875..87677e1117ff 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h @@ -34,11 +34,7 @@ struct atomisp_metadata_buf { struct list_head list; }; -void atomisp_css_debug_dump_sp_sw_debug_info(void); -void atomisp_css_debug_dump_debug_info(const char *context); -void atomisp_css_debug_set_dtrace_level(const unsigned int trace_level); - -void atomisp_store_uint32(hrt_address addr, uint32_t data); +void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data); void atomisp_load_uint32(hrt_address addr, uint32_t *data); int atomisp_css_init(struct atomisp_device *isp); @@ -84,9 +80,9 @@ int atomisp_q_dis_buffer_to_css(struct atomisp_sub_device *asd, enum atomisp_input_stream_id stream_id, enum ia_css_pipe_id css_pipe_id); -void atomisp_css_mmu_invalidate_cache(void); +void ia_css_mmu_invalidate_cache(void); -void atomisp_css_mmu_invalidate_tlb(void); +void ia_css_mmu_invalidate_cache(void); int atomisp_css_start(struct atomisp_sub_device *asd, enum ia_css_pipe_id pipe_id, bool in_reset); diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index f7c3fdd5f670..59228d711048 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -66,26 +66,6 @@ struct bayer_ds_factor { unsigned int denominator; }; -void atomisp_css_debug_dump_sp_sw_debug_info(void) -{ - ia_css_debug_dump_sp_sw_debug_info(); -} - -void atomisp_css_debug_dump_debug_info(const char *context) -{ - ia_css_debug_dump_debug_info(context); -} - -void atomisp_css_debug_set_dtrace_level(const unsigned int trace_level) -{ - ia_css_debug_set_dtrace_level(trace_level); -} - -unsigned int atomisp_css_debug_get_dtrace_level(void) -{ - return dbg_level; -} - static void atomisp_css2_hw_store_8(hrt_address addr, uint8_t data) { unsigned long flags; @@ -104,7 +84,7 @@ static void atomisp_css2_hw_store_16(hrt_address addr, uint16_t data) spin_unlock_irqrestore(&mmio_lock, flags); } -static void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data) +void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data) { unsigned long flags; @@ -191,11 +171,6 @@ static int atomisp_css2_err_print(const char *fmt, va_list args) return 0; } -void atomisp_store_uint32(hrt_address addr, uint32_t data) -{ - atomisp_css2_hw_store_32(addr, data); -} - void atomisp_load_uint32(hrt_address addr, uint32_t *data) { *data = atomisp_css2_hw_load_32(addr); @@ -213,16 +188,6 @@ static int hmm_get_mmu_base_addr(unsigned int *mmu_base_addr) return 0; } -static void atomisp_isp_parameters_clean_up( - struct ia_css_isp_config *config) -{ - /* - * Set NULL to configs pointer to avoid they are set into isp again when - * some configs are changed and need to be updated later. - */ - memset(config, 0, sizeof(*config)); -} - static void __dump_pipe_config(struct atomisp_sub_device *asd, struct atomisp_stream_env *stream_env, unsigned int pipe_id) @@ -905,14 +870,6 @@ static inline int __set_css_print_env(struct atomisp_device *isp, int opt) return ret; } -int atomisp_css_check_firmware_version(struct atomisp_device *isp) -{ - if (!sh_css_check_firmware_version(isp->dev, (void *)isp->firmware->data)) { - return -EINVAL; - } - return 0; -} - int atomisp_css_load_firmware(struct atomisp_device *isp) { enum ia_css_err err; @@ -952,11 +909,6 @@ int atomisp_css_load_firmware(struct atomisp_device *isp) return 0; } -void atomisp_css_unload_firmware(struct atomisp_device *isp) -{ - ia_css_unload_firmware(); -} - void atomisp_css_uninit(struct atomisp_device *isp) { struct atomisp_sub_device *asd; @@ -964,7 +916,7 @@ void atomisp_css_uninit(struct atomisp_device *isp) for (i = 0; i < isp->num_of_streams; i++) { asd = &isp->asd[i]; - atomisp_isp_parameters_clean_up(&asd->params.config); + memset(&asd->params.config, 0, sizeof(asd->params.config)); asd->params.css_update_params_needed = false; } @@ -1152,16 +1104,6 @@ int atomisp_q_dis_buffer_to_css(struct atomisp_sub_device *asd, return 0; } -void atomisp_css_mmu_invalidate_cache(void) -{ - ia_css_mmu_invalidate_cache(); -} - -void atomisp_css_mmu_invalidate_tlb(void) -{ - ia_css_mmu_invalidate_cache(); -} - int atomisp_css_start(struct atomisp_sub_device *asd, enum ia_css_pipe_id pipe_id, bool in_reset) { @@ -1285,7 +1227,7 @@ void atomisp_css_update_isp_params(struct atomisp_sub_device *asd) ia_css_stream_set_isp_config( asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, &asd->params.config); - atomisp_isp_parameters_clean_up(&asd->params.config); + memset(&asd->params.config, 0, sizeof(asd->params.config)); } void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd, @@ -1309,7 +1251,7 @@ void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd, if (ret != IA_CSS_SUCCESS) dev_warn(asd->isp->dev, "%s: ia_css_stream_set_isp_config_on_pipe failed %d\n", __func__, ret); - atomisp_isp_parameters_clean_up(&asd->params.config); + memset(&asd->params.config, 0, sizeof(asd->params.config)); } int atomisp_css_queue_buffer(struct atomisp_sub_device *asd, @@ -2264,7 +2206,7 @@ int atomisp_css_stop(struct atomisp_sub_device *asd, ia_css_stream_config_defaults( &stream_env->stream_config); } - atomisp_isp_parameters_clean_up(&asd->params.config); + memset(&asd->params.config, 0, sizeof(asd->params.config)); asd->params.css_update_params_needed = false; } @@ -4215,8 +4157,8 @@ int atomisp_css_wait_acc_finish(struct atomisp_sub_device *asd) if (wait_for_completion_interruptible_timeout(&asd->acc.acc_done, ATOMISP_ISP_TIMEOUT_DURATION) == 0) { dev_err(isp->dev, "<%s: completion timeout\n", __func__); - atomisp_css_debug_dump_sp_sw_debug_info(); - atomisp_css_debug_dump_debug_info(__func__); + ia_css_debug_dump_sp_sw_debug_info(); + ia_css_debug_dump_debug_info(__func__); ret = -EIO; } rt_mutex_lock(&isp->mutex); diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h index ba8e6aed12de..e8b330dacba9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h @@ -155,17 +155,11 @@ void atomisp_css_set_b_gamma_table(struct atomisp_sub_device *asd, void atomisp_css_set_anr_thres(struct atomisp_sub_device *asd, struct ia_css_anr_thres *anr_thres); -int atomisp_css_check_firmware_version(struct atomisp_device *isp); - int atomisp_css_load_firmware(struct atomisp_device *isp); -void atomisp_css_unload_firmware(struct atomisp_device *isp); - void atomisp_css_set_dvs_6axis(struct atomisp_sub_device *asd, struct ia_css_dvs_6axis_config *dvs_6axis); -unsigned int atomisp_css_debug_get_dtrace_level(void); - int atomisp_css_debug_dump_isp_binary(void); int atomisp_css_dump_sp_raw_copy_linecount(bool reduced); diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index a2638863206e..24e421e3009d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -384,9 +384,9 @@ static void atomisp_csi2_configure_isp2401(struct atomisp_sub_device *asd) for (n = 0; n < csi2_port_lanes[port] + 1; n++) { hrt_address base = csi2_port_base[port] + csi2_lane_base[n]; - atomisp_store_uint32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN, + atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_TERMEN, n == 0 ? clk_termen : dat_termen); - atomisp_store_uint32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE, + atomisp_css2_hw_store_32(base + CSI2_REG_RX_CSI_DLY_CNT_SETTLE, n == 0 ? clk_settle : dat_settle); } } diff --git a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c index 4a6ea021ddcc..f14c7673653c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_drvfs.c +++ b/drivers/staging/media/atomisp/pci/atomisp_drvfs.c @@ -24,6 +24,7 @@ #include "atomisp_ioctl.h" #include "atomisp_drvfs.h" #include "hmm/hmm.h" +#include "ia_css_debug.h" /* * _iunit_debug: @@ -94,7 +95,7 @@ static inline int iunit_dump_dbgopt(struct atomisp_device *isp, static ssize_t iunit_dbglvl_show(struct device_driver *drv, char *buf) { - iunit_debug.dbglvl = atomisp_css_debug_get_dtrace_level(); + iunit_debug.dbglvl = dbg_level; return sprintf(buf, "dtrace level:%u\n", iunit_debug.dbglvl); } @@ -106,7 +107,7 @@ static ssize_t iunit_dbglvl_store(struct device_driver *drv, const char *buf, || iunit_debug.dbglvl > 9) { return -ERANGE; } - atomisp_css_debug_set_dtrace_level(iunit_debug.dbglvl); + ia_css_debug_set_dtrace_level(iunit_debug.dbglvl); return size; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 1588e84a6b91..3e5806403b31 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -997,7 +997,7 @@ static int atomisp_release(struct file *file) atomisp_css_uninit(isp); if (defer_fw_load) { - atomisp_css_unload_firmware(isp); + ia_css_unload_firmware(); isp->css_env.isp_css_fw.data = NULL; isp->css_env.isp_css_fw.bytes = 0; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 765e1a8c31fa..d02c500d53b7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1619,9 +1619,9 @@ static void atomisp_dma_burst_len_cfg(struct atomisp_sub_device *asd) ATOMISP_SUBDEV_PAD_SINK); if (sink->width * sink->height >= 4096 * 3072) - atomisp_store_uint32(DMA_BURST_SIZE_REG, 0x7F); + atomisp_css2_hw_store_32(DMA_BURST_SIZE_REG, 0x7F); else - atomisp_store_uint32(DMA_BURST_SIZE_REG, 0x00); + atomisp_css2_hw_store_32(DMA_BURST_SIZE_REG, 0x00); } /* diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 374b1bb6c339..719ded53ffd8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -42,6 +42,8 @@ #include "hmm/hmm.h" #include "atomisp_trace_event.h" +#include "sh_css_firmware.h" + #include "device_access.h" /* Timeouts to wait for all subdevs to be registered */ @@ -657,7 +659,7 @@ static int __maybe_unused atomisp_restore_iunit_reg(struct atomisp_device *isp) * which has bugs(like sighting:4567697 and 4567699) and * will be removed in B0 */ - atomisp_store_uint32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1); + atomisp_css2_hw_store_32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1); return 0; } @@ -687,7 +689,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp) if (!(irq & (1 << INTR_IIR))) goto done; - atomisp_store_uint32(MRFLD_INTR_CLEAR_REG, 0xFFFFFFFF); + atomisp_css2_hw_store_32(MRFLD_INTR_CLEAR_REG, 0xFFFFFFFF); atomisp_load_uint32(MRFLD_INTR_STATUS_REG, &irq); if (irq != 0) { dev_err(isp->dev, @@ -702,7 +704,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp) pci_read_config_dword(dev, PCI_INTERRUPT_CTRL, &irq); if (!(irq & (1 << INTR_IIR))) { - atomisp_store_uint32(MRFLD_INTR_ENABLE_REG, 0x0); + atomisp_css2_hw_store_32(MRFLD_INTR_ENABLE_REG, 0x0); goto done; } dev_err(isp->dev, @@ -1763,7 +1765,8 @@ static int atomisp_pci_probe(struct pci_dev *dev, goto load_fw_fail; } - err = atomisp_css_check_firmware_version(isp); + err = sh_css_check_firmware_version(isp->dev, + isp->firmware->data); if (err) { dev_dbg(&dev->dev, "Firmware version check failed\n"); goto fw_validation_fail; @@ -1792,7 +1795,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, * bugs(like sighting:4567697 and 4567699) and will be removed * in B0 */ - atomisp_store_uint32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1); + atomisp_css2_hw_store_32(MRFLD_CSI_RECEIVER_SELECTION_REG, 1); if ((id->device & ATOMISP_PCI_DEVICE_SOC_MASK) == ATOMISP_PCI_DEVICE_SOC_MRFLD) { @@ -1943,7 +1946,7 @@ static void atomisp_pci_remove(struct pci_dev *dev) atomisp_acc_cleanup(isp); - atomisp_css_unload_firmware(isp); + ia_css_unload_firmware(); hmm_cleanup(); pm_runtime_forbid(&dev->dev); diff --git a/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c b/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c index 0f55978ad2bd..2e5ce822f55b 100644 --- a/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c +++ b/drivers/staging/media/atomisp/pci/mmu/sh_mmu_mrfld.c @@ -62,7 +62,7 @@ static unsigned int sh_get_pd_base(struct isp_mmu *mmu, */ static void sh_tlb_flush(struct isp_mmu *mmu) { - atomisp_css_mmu_invalidate_cache(); + ia_css_mmu_invalidate_cache(); } struct isp_mmu_client sh_mmu_mrfld = { diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index ee23d28b1bef..ddeb953a93cf 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -203,7 +203,7 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data) } /* For now, let's just accept a wrong version, even if wrong */ - return true; + return 0; } enum ia_css_err @@ -212,7 +212,7 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, unsigned int i; struct ia_css_fw_info *binaries; struct sh_css_fw_bi_file_h *file_header; - bool valid_firmware = false; + int ret; const char *release_version; if (!atomisp_hw_is_isp2401) @@ -224,8 +224,8 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, file_header = &firmware_header->file_header; binaries = &firmware_header->binary_header; strscpy(FW_rel_ver_name, file_header->version, min(sizeof(FW_rel_ver_name), sizeof(file_header->version))); - valid_firmware = sh_css_check_firmware_version(dev, fw_data); - if (!valid_firmware) { + ret = sh_css_check_firmware_version(dev, fw_data); + if (ret) { IA_CSS_ERROR("CSS code version (%s) and firmware version (%s) mismatch!", file_header->version, release_version); return IA_CSS_ERR_VERSION_MISMATCH; From patchwork Sat May 30 06:55:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8B7FC433E6 for ; Sat, 30 May 2020 06:57:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 744ED206C3 for ; Sat, 30 May 2020 06:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821847; bh=kxbnh+AHRTOvRY1iUp5etxq7vK91dVI1mcWZd/pGJQo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=aXzVOoIEQfRGVGIl2OdH3cqmTFL1rJ6Qm4MOBZEM4/dIr9DJXZ/rvSwhDjrPbiLyZ 95/yV1lQS84/a4Dh+mj/q5MMQOdSL1py1Qfx6wW0qHRg//pZXYbVGwCaVq53uq7iOQ r0uUpBBKyExKvvjeAk0Zue7LlcoF0rfzu+1YSZgs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729021AbgE3G5G (ORCPT ); Sat, 30 May 2020 02:57:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:44912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728871AbgE3G4J (ORCPT ); Sat, 30 May 2020 02:56:09 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57D08221EF; Sat, 30 May 2020 06:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=kxbnh+AHRTOvRY1iUp5etxq7vK91dVI1mcWZd/pGJQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6dqpeHINmZO5qpFXCZ9uBQVP80pZNehoDKvhHOoP1VkB3WhHXLeCBB5mg/PzEnic LlXH7lRuaBs1/t/0bB0cW6xyt1FxXl2ncNBZmWKu98NKb1EHZswW3hwYhaCibWExyp 9eSL5pEq4SOTrfvb3TImJRli5zoU8JTIG8zq5Cj0= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPW-001hqj-5n; Sat, 30 May 2020 08:56:02 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 33/41] media: atomisp: get rid of a bunch of other wrappers Date: Sat, 30 May 2020 08:55:50 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are too many wrapper functions at atomisp_compat_css20.c. Get rid of another set of such wrappers. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/atomisp_cmd.c | 156 +++++----- .../media/atomisp/pci/atomisp_compat.h | 79 ----- .../media/atomisp/pci/atomisp_compat_css20.c | 281 ------------------ .../media/atomisp/pci/atomisp_compat_css20.h | 12 - .../staging/media/atomisp/pci/atomisp_file.c | 7 +- .../staging/media/atomisp/pci/atomisp_fops.c | 3 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 15 +- 7 files changed, 93 insertions(+), 460 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 75cbc46f4a07..f3548e741cc5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -1170,8 +1170,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, atomisp_apply_css_parameters(asd, &asd->params.css_param); if (asd->params.css_param.update_flag.dz_config) - atomisp_css_set_dz_config(asd, - &asd->params.css_param.dz_config); + asd->params.config.dz_config = &asd->params.css_param.dz_config; /* New global dvs 6axis config should be blocked * here if there's a buffer with per-frame parameters * pending in CSS frame buffer queue. @@ -1262,9 +1261,15 @@ void atomisp_delayed_init_work(struct work_struct *work) */ if (!ATOMISP_USE_YUVPP(asd)) { struct v4l2_event event = {0}; + struct ia_css_stream *stream; - atomisp_css_allocate_continuous_frames(false, asd); - atomisp_css_update_continuous_frames(asd); + stream = asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream; + + + if (ia_css_alloc_continuous_frame_remain(stream)) + return; + + ia_css_update_continuous_frames(stream); event.type = V4L2_EVENT_ATOMISP_RAW_BUFFERS_ALLOC_DONE; v4l2_event_queue(asd->subdev.devnode, &event); @@ -1823,7 +1828,8 @@ void atomisp_setup_flash(struct atomisp_sub_device *asd) return; } - atomisp_css_request_flash(asd); + ia_css_stream_request_flash(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream); + asd->params.flash_state = ATOMISP_FLASH_ONGOING; } else { asd->params.flash_state = ATOMISP_FLASH_IDLE; @@ -2107,10 +2113,9 @@ int atomisp_gdc_cac(struct atomisp_sub_device *asd, int flag, asd->params.gdc_cac_en = !!*value; if (asd->params.gdc_cac_en) { - atomisp_css_set_morph_table(asd, - asd->params.css_param.morph_table); + asd->params.config.morph_table = asd->params.css_param.morph_table; } else { - atomisp_css_set_morph_table(asd, NULL); + asd->params.config.morph_table = NULL; } asd->params.css_update_params_needed = true; atomisp_update_capture_mode(asd); @@ -2164,7 +2169,7 @@ int atomisp_nr(struct atomisp_sub_device *asd, int flag, /* Set nr config to isp parameters */ memcpy(&asd->params.css_param.nr_config, arg, sizeof(struct ia_css_nr_config)); - atomisp_css_set_nr_config(asd, &asd->params.css_param.nr_config); + asd->params.config.nr_config = &asd->params.css_param.nr_config; asd->params.css_update_params_needed = true; } return 0; @@ -2185,7 +2190,7 @@ int atomisp_tnr(struct atomisp_sub_device *asd, int flag, /* Set tnr config to isp parameters */ memcpy(&asd->params.css_param.tnr_config, config, sizeof(struct ia_css_tnr_config)); - atomisp_css_set_tnr_config(asd, &asd->params.css_param.tnr_config); + asd->params.config.tnr_config = &asd->params.css_param.tnr_config; asd->params.css_update_params_needed = true; } @@ -2206,7 +2211,7 @@ int atomisp_black_level(struct atomisp_sub_device *asd, int flag, /* Set ob config to isp parameters */ memcpy(&asd->params.css_param.ob_config, config, sizeof(struct ia_css_ob_config)); - atomisp_css_set_ob_config(asd, &asd->params.css_param.ob_config); + asd->params.config.ob_config = &asd->params.css_param.ob_config; asd->params.css_update_params_needed = true; } @@ -2227,7 +2232,7 @@ int atomisp_ee(struct atomisp_sub_device *asd, int flag, /* Set ee config to isp parameters */ memcpy(&asd->params.css_param.ee_config, config, sizeof(asd->params.css_param.ee_config)); - atomisp_css_set_ee_config(asd, &asd->params.css_param.ee_config); + asd->params.config.ee_config = &asd->params.css_param.ee_config; asd->params.css_update_params_needed = true; } @@ -2248,7 +2253,7 @@ int atomisp_gamma(struct atomisp_sub_device *asd, int flag, /* Set gamma table to isp parameters */ memcpy(&asd->params.css_param.gamma_table, config, sizeof(asd->params.css_param.gamma_table)); - atomisp_css_set_gamma_table(asd, &asd->params.css_param.gamma_table); + asd->params.config.gamma_table = &asd->params.css_param.gamma_table; } return 0; @@ -2288,7 +2293,7 @@ int atomisp_gamma_correction(struct atomisp_sub_device *asd, int flag, /* Set gamma correction params to isp parameters */ memcpy(&asd->params.css_param.gc_config, config, sizeof(asd->params.css_param.gc_config)); - atomisp_css_set_gc_config(asd, &asd->params.css_param.gc_config); + asd->params.config.gc_config = &asd->params.css_param.gc_config; asd->params.css_update_params_needed = true; } @@ -2309,7 +2314,7 @@ int atomisp_formats(struct atomisp_sub_device *asd, int flag, /* Set narrow gamma flag to isp parameters */ memcpy(&asd->params.css_param.formats_config, config, sizeof(asd->params.css_param.formats_config)); - atomisp_css_set_formats_config(asd, &asd->params.css_param.formats_config); + asd->params.config.formats_config = &asd->params.css_param.formats_config; } return 0; @@ -2320,7 +2325,7 @@ void atomisp_free_internal_buffers(struct atomisp_sub_device *asd) atomisp_free_css_parameters(&asd->params.css_param); if (asd->raw_output_frame) { - atomisp_css_frame_free(asd->raw_output_frame); + ia_css_frame_free(asd->raw_output_frame); asd->raw_output_frame = NULL; } } @@ -2472,7 +2477,7 @@ int atomisp_gdc_cac_table(struct atomisp_sub_device *asd, int flag, } asd->params.css_param.morph_table = tab; if (asd->params.gdc_cac_en) - atomisp_css_set_morph_table(asd, tab); + asd->params.config.morph_table = tab; } return 0; @@ -2514,7 +2519,7 @@ int atomisp_macc_table(struct atomisp_sub_device *asd, int flag, memcpy(macc_table, &config->table, sizeof(struct ia_css_macc_table)); if (config->color_effect == asd->params.color_effect) - atomisp_css_set_macc_table(asd, macc_table); + asd->params.config.macc_table = macc_table; } return 0; @@ -3151,84 +3156,82 @@ void atomisp_apply_css_parameters( struct atomisp_css_params *css_param) { if (css_param->update_flag.wb_config) - atomisp_css_set_wb_config(asd, &css_param->wb_config); + asd->params.config.wb_config = &css_param->wb_config; if (css_param->update_flag.ob_config) - atomisp_css_set_ob_config(asd, &css_param->ob_config); + asd->params.config.ob_config = &css_param->ob_config; if (css_param->update_flag.dp_config) - atomisp_css_set_dp_config(asd, &css_param->dp_config); + asd->params.config.dp_config = &css_param->dp_config; if (css_param->update_flag.nr_config) - atomisp_css_set_nr_config(asd, &css_param->nr_config); + asd->params.config.nr_config = &css_param->nr_config; if (css_param->update_flag.ee_config) - atomisp_css_set_ee_config(asd, &css_param->ee_config); + asd->params.config.ee_config = &css_param->ee_config; if (css_param->update_flag.tnr_config) - atomisp_css_set_tnr_config(asd, &css_param->tnr_config); + asd->params.config.tnr_config = &css_param->tnr_config; if (css_param->update_flag.a3a_config) - atomisp_css_set_3a_config(asd, &css_param->s3a_config); + asd->params.config.s3a_config = &css_param->s3a_config; if (css_param->update_flag.ctc_config) - atomisp_css_set_ctc_config(asd, &css_param->ctc_config); + asd->params.config.ctc_config = &css_param->ctc_config; if (css_param->update_flag.cnr_config) - atomisp_css_set_cnr_config(asd, &css_param->cnr_config); + asd->params.config.cnr_config = &css_param->cnr_config; if (css_param->update_flag.ecd_config) - atomisp_css_set_ecd_config(asd, &css_param->ecd_config); + asd->params.config.ecd_config = &css_param->ecd_config; if (css_param->update_flag.ynr_config) - atomisp_css_set_ynr_config(asd, &css_param->ynr_config); + asd->params.config.ynr_config = &css_param->ynr_config; if (css_param->update_flag.fc_config) - atomisp_css_set_fc_config(asd, &css_param->fc_config); + asd->params.config.fc_config = &css_param->fc_config; if (css_param->update_flag.macc_config) - atomisp_css_set_macc_config(asd, &css_param->macc_config); + asd->params.config.macc_config = &css_param->macc_config; if (css_param->update_flag.aa_config) - atomisp_css_set_aa_config(asd, &css_param->aa_config); + asd->params.config.aa_config = &css_param->aa_config; if (css_param->update_flag.anr_config) - atomisp_css_set_anr_config(asd, &css_param->anr_config); + asd->params.config.anr_config = &css_param->anr_config; if (css_param->update_flag.xnr_config) - atomisp_css_set_xnr_config(asd, &css_param->xnr_config); + asd->params.config.xnr_config = &css_param->xnr_config; if (css_param->update_flag.yuv2rgb_cc_config) - atomisp_css_set_yuv2rgb_cc_config(asd, - &css_param->yuv2rgb_cc_config); + asd->params.config.yuv2rgb_cc_config = &css_param->yuv2rgb_cc_config; if (css_param->update_flag.rgb2yuv_cc_config) - atomisp_css_set_rgb2yuv_cc_config(asd, - &css_param->rgb2yuv_cc_config); + asd->params.config.rgb2yuv_cc_config = &css_param->rgb2yuv_cc_config; if (css_param->update_flag.macc_table) - atomisp_css_set_macc_table(asd, &css_param->macc_table); + asd->params.config.macc_table = &css_param->macc_table; if (css_param->update_flag.xnr_table) - atomisp_css_set_xnr_table(asd, &css_param->xnr_table); + asd->params.config.xnr_table = &css_param->xnr_table; if (css_param->update_flag.r_gamma_table) - atomisp_css_set_r_gamma_table(asd, &css_param->r_gamma_table); + asd->params.config.r_gamma_table = &css_param->r_gamma_table; if (css_param->update_flag.g_gamma_table) - atomisp_css_set_g_gamma_table(asd, &css_param->g_gamma_table); + asd->params.config.g_gamma_table = &css_param->g_gamma_table; if (css_param->update_flag.b_gamma_table) - atomisp_css_set_b_gamma_table(asd, &css_param->b_gamma_table); + asd->params.config.b_gamma_table = &css_param->b_gamma_table; if (css_param->update_flag.anr_thres) atomisp_css_set_anr_thres(asd, &css_param->anr_thres); if (css_param->update_flag.shading_table) - atomisp_css_set_shading_table(asd, css_param->shading_table); + asd->params.config.shading_table = css_param->shading_table; if (css_param->update_flag.morph_table && asd->params.gdc_cac_en) - atomisp_css_set_morph_table(asd, css_param->morph_table); + asd->params.config.morph_table = css_param->morph_table; if (css_param->update_flag.dvs2_coefs) { struct ia_css_dvs_grid_info *dvs_grid_info = @@ -4363,18 +4366,18 @@ int atomisp_param(struct atomisp_sub_device *asd, int flag, asd->params.color_effect != V4L2_COLORFX_BW) { memcpy(&asd->params.css_param.cc_config, &config->cc_config, sizeof(struct ia_css_cc_config)); - atomisp_css_set_cc_config(asd, &asd->params.css_param.cc_config); + asd->params.config.cc_config = &asd->params.css_param.cc_config; } - atomisp_css_set_wb_config(asd, &asd->params.css_param.wb_config); - atomisp_css_set_ob_config(asd, &asd->params.css_param.ob_config); - atomisp_css_set_de_config(asd, &asd->params.css_param.de_config); - atomisp_css_set_dz_config(asd, &asd->params.css_param.dz_config); - atomisp_css_set_ce_config(asd, &asd->params.css_param.ce_config); - atomisp_css_set_dp_config(asd, &asd->params.css_param.dp_config); - atomisp_css_set_nr_config(asd, &asd->params.css_param.nr_config); - atomisp_css_set_ee_config(asd, &asd->params.css_param.ee_config); - atomisp_css_set_tnr_config(asd, &asd->params.css_param.tnr_config); + asd->params.config.wb_config = &asd->params.css_param.wb_config; + asd->params.config.ob_config = &asd->params.css_param.ob_config; + asd->params.config.de_config = &asd->params.css_param.de_config; + asd->params.config.dz_config = &asd->params.css_param.dz_config; + asd->params.config.ce_config = &asd->params.css_param.ce_config; + asd->params.config.dp_config = &asd->params.css_param.dp_config; + asd->params.config.nr_config = &asd->params.css_param.nr_config; + asd->params.config.ee_config = &asd->params.css_param.ee_config; + asd->params.config.tnr_config = &asd->params.css_param.tnr_config; asd->params.css_update_params_needed = true; return 0; @@ -4463,9 +4466,9 @@ int atomisp_color_effect(struct atomisp_sub_device *asd, int flag, atomisp_update_capture_mode(asd); if (cc_config) - atomisp_css_set_cc_config(asd, cc_config); + asd->params.config.cc_config = cc_config; if (macc_table) - atomisp_css_set_macc_table(asd, macc_table); + asd->params.config.macc_table = macc_table; if (ctc_table) atomisp_css_set_ctc_table(asd, ctc_table); asd->params.color_effect = (u32)*effect; @@ -4502,7 +4505,7 @@ int atomisp_bad_pixel_param(struct atomisp_sub_device *asd, int flag, /* Set bad pixel to isp parameters */ memcpy(&asd->params.css_param.dp_config, config, sizeof(asd->params.css_param.dp_config)); - atomisp_css_set_dp_config(asd, &asd->params.css_param.dp_config); + asd->params.config.dp_config = &asd->params.css_param.dp_config; asd->params.css_update_params_needed = true; } @@ -4595,7 +4598,7 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg, /* Note: the padded width on an ia_css_frame is in elements, not in bytes. The RAW frame we use here should always be a 16bit RAW frame. This is why we bytesperline/2 is equal to the padded with */ - if (atomisp_css_frame_allocate(&res, arg->fmt.width, arg->fmt.height, + if (ia_css_frame_allocate(&res, arg->fmt.width, arg->fmt.height, sh_format, padded_width, 0)) { ret = -ENOMEM; goto err; @@ -4619,7 +4622,7 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg, err: if (ret && res) - atomisp_css_frame_free(res); + ia_css_frame_free(res); if (tmp_buf) vfree(tmp_buf); if (ret == 0) @@ -4642,10 +4645,12 @@ int atomisp_fixed_pattern_table(struct atomisp_sub_device *asd, ret = atomisp_v4l2_framebuffer_to_css_frame(arg, &raw_black_frame); if (ret) return ret; - if (atomisp_css_set_black_frame(asd, raw_black_frame)) - ret = -ENOMEM; - atomisp_css_frame_free(raw_black_frame); + if (sh_css_set_black_frame(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, + raw_black_frame) != 0) + return -ENOMEM; + + ia_css_frame_free(raw_black_frame); return ret; } @@ -4663,10 +4668,10 @@ int atomisp_false_color(struct atomisp_sub_device *asd, int flag, /* Set nr config to isp parameters */ if (*value) { - atomisp_css_set_default_de_config(asd); + asd->params.config.de_config = NULL; } else { asd->params.css_param.de_config.pixelnoise = 0; - atomisp_css_set_de_config(asd, &asd->params.css_param.de_config); + asd->params.config.de_config = &asd->params.css_param.de_config; } asd->params.css_update_params_needed = true; asd->params.false_color = *value; @@ -4687,7 +4692,7 @@ int atomisp_false_color_param(struct atomisp_sub_device *asd, int flag, /* Set false color to isp parameters */ memcpy(&asd->params.css_param.de_config, config, sizeof(asd->params.css_param.de_config)); - atomisp_css_set_de_config(asd, &asd->params.css_param.de_config); + asd->params.config.de_config = &asd->params.css_param.de_config; asd->params.css_update_params_needed = true; } @@ -4708,7 +4713,7 @@ int atomisp_white_balance_param(struct atomisp_sub_device *asd, int flag, /* Set white balance to isp parameters */ memcpy(&asd->params.css_param.wb_config, config, sizeof(asd->params.css_param.wb_config)); - atomisp_css_set_wb_config(asd, &asd->params.css_param.wb_config); + asd->params.config.wb_config = &asd->params.css_param.wb_config; asd->params.css_update_params_needed = true; } @@ -4730,7 +4735,7 @@ int atomisp_3a_config_param(struct atomisp_sub_device *asd, int flag, /* Set white balance to isp parameters */ memcpy(&asd->params.css_param.s3a_config, config, sizeof(asd->params.css_param.s3a_config)); - atomisp_css_set_3a_config(asd, &asd->params.css_param.s3a_config); + asd->params.config.s3a_config = &asd->params.css_param.s3a_config; asd->params.css_update_params_needed = true; } @@ -5191,7 +5196,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, configure_pp_input_nop; u16 stream_index = atomisp_source_pad_to_stream_id(asd, source_pad); const struct atomisp_in_fmt_conv *fc; - int ret; + int ret, i; v4l2_fh_init(&fh.vfh, vdev); @@ -5288,8 +5293,9 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, } atomisp_css_input_set_mode(asd, IA_CSS_INPUT_MODE_BUFFERED_SENSOR); - atomisp_css_disable_vf_pp(asd, - asd->vfpp->val != ATOMISP_VFPP_ENABLE); + + for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) + asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].pipe_extra_configs[i].disable_vf_pp = asd->vfpp->val != ATOMISP_VFPP_ENABLE; /* ISP2401 new input system need to use copy pipe */ if (asd->copy_mode) { @@ -5434,12 +5440,12 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, atomisp_update_grid_info(asd, pipe_id, source_pad); /* Free the raw_dump buffer first */ - atomisp_css_frame_free(asd->raw_output_frame); + ia_css_frame_free(asd->raw_output_frame); asd->raw_output_frame = NULL; if (!asd->continuous_mode->val && !asd->params.online_process && !isp->sw_contex.file_input && - atomisp_css_frame_allocate_from_info(&asd->raw_output_frame, + ia_css_frame_allocate_from_info(&asd->raw_output_frame, raw_output_info)) return -ENOMEM; @@ -6086,7 +6092,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, return -EINVAL; if (!user_shading_table->enable) { - atomisp_css_set_shading_table(asd, NULL); + asd->params.config.shading_table = NULL; asd->params.sc_en = false; return 0; } @@ -6131,7 +6137,7 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, free_table = asd->params.css_param.shading_table; asd->params.css_param.shading_table = shading_table; - atomisp_css_set_shading_table(asd, shading_table); + asd->params.config.shading_table = shading_table; asd->params.sc_en = true; out: diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h index 87677e1117ff..2a4d1b469ebf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h @@ -243,30 +243,6 @@ int atomisp_css_input_configure_port(struct atomisp_sub_device *asd, unsigned int metadata_width, unsigned int metadata_height); -int atomisp_css_frame_allocate(struct ia_css_frame **frame, - unsigned int width, unsigned int height, - enum ia_css_frame_format format, - unsigned int padded_width, - unsigned int raw_bit_depth); - -int atomisp_css_frame_allocate_from_info(struct ia_css_frame **frame, - const struct ia_css_frame_info *info); - -void atomisp_css_frame_free(struct ia_css_frame *frame); - -int atomisp_css_frame_map(struct ia_css_frame **frame, - const struct ia_css_frame_info *info, - const void __user *data, uint16_t attribute, - unsigned int pgnr); - -int atomisp_css_set_black_frame(struct atomisp_sub_device *asd, - const struct ia_css_frame *raw_black_frame); - -int atomisp_css_allocate_continuous_frames(bool init_time, - struct atomisp_sub_device *asd); - -void atomisp_css_update_continuous_frames(struct atomisp_sub_device *asd); - void atomisp_create_pipes_stream(struct atomisp_sub_device *asd); void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd); @@ -277,9 +253,6 @@ int atomisp_css_continuous_set_num_raw_frames( struct atomisp_sub_device *asd, int num_frames); -void atomisp_css_disable_vf_pp(struct atomisp_sub_device *asd, - bool disable); - int atomisp_css_copy_configure_output(struct atomisp_sub_device *asd, unsigned int stream_index, unsigned int width, unsigned int height, @@ -388,61 +361,9 @@ int atomisp_css_exp_id_unlock(struct atomisp_sub_device *asd, int exp_id); int atomisp_css_capture_enable_xnr(struct atomisp_sub_device *asd, bool enable); -void atomisp_css_send_input_frame(struct atomisp_sub_device *asd, - unsigned short *data, unsigned int width, - unsigned int height); - -bool atomisp_css_isp_has_started(void); - -void atomisp_css_request_flash(struct atomisp_sub_device *asd); - -void atomisp_css_set_wb_config(struct atomisp_sub_device *asd, - struct ia_css_wb_config *wb_config); - -void atomisp_css_set_ob_config(struct atomisp_sub_device *asd, - struct ia_css_ob_config *ob_config); - -void atomisp_css_set_dp_config(struct atomisp_sub_device *asd, - struct ia_css_dp_config *dp_config); - -void atomisp_css_set_de_config(struct atomisp_sub_device *asd, - struct ia_css_de_config *de_config); - -void atomisp_css_set_dz_config(struct atomisp_sub_device *asd, - struct ia_css_dz_config *dz_config); - -void atomisp_css_set_default_de_config(struct atomisp_sub_device *asd); - -void atomisp_css_set_ce_config(struct atomisp_sub_device *asd, - struct ia_css_ce_config *ce_config); - -void atomisp_css_set_nr_config(struct atomisp_sub_device *asd, - struct ia_css_nr_config *nr_config); - -void atomisp_css_set_ee_config(struct atomisp_sub_device *asd, - struct ia_css_ee_config *ee_config); - -void atomisp_css_set_tnr_config(struct atomisp_sub_device *asd, - struct ia_css_tnr_config *tnr_config); - -void atomisp_css_set_cc_config(struct atomisp_sub_device *asd, - struct ia_css_cc_config *cc_config); - -void atomisp_css_set_macc_table(struct atomisp_sub_device *asd, - struct ia_css_macc_table *macc_table); - -void atomisp_css_set_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_gamma_table *gamma_table); - void atomisp_css_set_ctc_table(struct atomisp_sub_device *asd, struct ia_css_ctc_table *ctc_table); -void atomisp_css_set_gc_config(struct atomisp_sub_device *asd, - struct ia_css_gc_config *gc_config); - -void atomisp_css_set_3a_config(struct atomisp_sub_device *asd, - struct ia_css_3a_config *s3a_config); - void atomisp_css_video_set_dis_vector(struct atomisp_sub_device *asd, struct atomisp_dis_vector *vector); diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index 3dc5c4eeb8d3..76e5eda0a8a8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -2099,72 +2099,6 @@ int atomisp_css_input_configure_port( return 0; } -int atomisp_css_frame_allocate(struct ia_css_frame **frame, - unsigned int width, unsigned int height, - enum ia_css_frame_format format, - unsigned int padded_width, - unsigned int raw_bit_depth) -{ - if (ia_css_frame_allocate(frame, width, height, format, - padded_width, raw_bit_depth) != 0) - return -ENOMEM; - - return 0; -} - -int atomisp_css_frame_allocate_from_info(struct ia_css_frame **frame, - const struct ia_css_frame_info *info) -{ - if (ia_css_frame_allocate_from_info(frame, info)) - return -ENOMEM; - - return 0; -} - -void atomisp_css_frame_free(struct ia_css_frame *frame) -{ - ia_css_frame_free(frame); -} - -int atomisp_css_frame_map(struct ia_css_frame **frame, - const struct ia_css_frame_info *info, - const void __user *data, uint16_t attribute, - unsigned int pgnr) -{ - if (ia_css_frame_map(frame, info, data, attribute, pgnr) - != 0) - return -ENOMEM; - - return 0; -} - -int atomisp_css_set_black_frame(struct atomisp_sub_device *asd, - const struct ia_css_frame *raw_black_frame) -{ - if (sh_css_set_black_frame( - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, - raw_black_frame) != 0) - return -ENOMEM; - - return 0; -} - -int atomisp_css_allocate_continuous_frames(bool init_time, - struct atomisp_sub_device *asd) -{ - if (ia_css_alloc_continuous_frame_remain( - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream) - != 0) - return -EINVAL; - return 0; -} - -void atomisp_css_update_continuous_frames(struct atomisp_sub_device *asd) -{ - ia_css_update_continuous_frames( - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream); -} - int atomisp_css_stop(struct atomisp_sub_device *asd, enum ia_css_pipe_id pipe_id, bool in_reset) { @@ -2287,16 +2221,6 @@ int atomisp_css_continuous_set_num_raw_frames( return 0; } -void atomisp_css_disable_vf_pp(struct atomisp_sub_device *asd, - bool disable) -{ - int i; - - for (i = 0; i < IA_CSS_PIPE_ID_NUM; i++) - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL] - .pipe_extra_configs[i].disable_vf_pp = !!disable; -} - static enum ia_css_pipe_mode __pipe_id_to_pipe_mode( struct atomisp_sub_device *asd, enum ia_css_pipe_id pipe_id) @@ -3298,199 +3222,6 @@ int atomisp_css_capture_enable_xnr(struct atomisp_sub_device *asd, return 0; } -void atomisp_css_send_input_frame(struct atomisp_sub_device *asd, - unsigned short *data, unsigned int width, - unsigned int height) -{ - ia_css_stream_send_input_frame( - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, - data, width, height); -} - -bool atomisp_css_isp_has_started(void) -{ - return ia_css_isp_has_started(); -} - -void atomisp_css_request_flash(struct atomisp_sub_device *asd) -{ - ia_css_stream_request_flash( - asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream); -} - -void atomisp_css_set_wb_config(struct atomisp_sub_device *asd, - struct ia_css_wb_config *wb_config) -{ - asd->params.config.wb_config = wb_config; -} - -void atomisp_css_set_ob_config(struct atomisp_sub_device *asd, - struct ia_css_ob_config *ob_config) -{ - asd->params.config.ob_config = ob_config; -} - -void atomisp_css_set_dp_config(struct atomisp_sub_device *asd, - struct ia_css_dp_config *dp_config) -{ - asd->params.config.dp_config = dp_config; -} - -void atomisp_css_set_de_config(struct atomisp_sub_device *asd, - struct ia_css_de_config *de_config) -{ - asd->params.config.de_config = de_config; -} - -void atomisp_css_set_dz_config(struct atomisp_sub_device *asd, - struct ia_css_dz_config *dz_config) -{ - asd->params.config.dz_config = dz_config; -} - -void atomisp_css_set_default_de_config(struct atomisp_sub_device *asd) -{ - asd->params.config.de_config = NULL; -} - -void atomisp_css_set_ce_config(struct atomisp_sub_device *asd, - struct ia_css_ce_config *ce_config) -{ - asd->params.config.ce_config = ce_config; -} - -void atomisp_css_set_nr_config(struct atomisp_sub_device *asd, - struct ia_css_nr_config *nr_config) -{ - asd->params.config.nr_config = nr_config; -} - -void atomisp_css_set_ee_config(struct atomisp_sub_device *asd, - struct ia_css_ee_config *ee_config) -{ - asd->params.config.ee_config = ee_config; -} - -void atomisp_css_set_tnr_config(struct atomisp_sub_device *asd, - struct ia_css_tnr_config *tnr_config) -{ - asd->params.config.tnr_config = tnr_config; -} - -void atomisp_css_set_cc_config(struct atomisp_sub_device *asd, - struct ia_css_cc_config *cc_config) -{ - asd->params.config.cc_config = cc_config; -} - -void atomisp_css_set_macc_table(struct atomisp_sub_device *asd, - struct ia_css_macc_table *macc_table) -{ - asd->params.config.macc_table = macc_table; -} - -void atomisp_css_set_macc_config(struct atomisp_sub_device *asd, - struct ia_css_macc_config *macc_config) -{ - asd->params.config.macc_config = macc_config; -} - -void atomisp_css_set_ecd_config(struct atomisp_sub_device *asd, - struct ia_css_ecd_config *ecd_config) -{ - asd->params.config.ecd_config = ecd_config; -} - -void atomisp_css_set_ynr_config(struct atomisp_sub_device *asd, - struct ia_css_ynr_config *ynr_config) -{ - asd->params.config.ynr_config = ynr_config; -} - -void atomisp_css_set_fc_config(struct atomisp_sub_device *asd, - struct ia_css_fc_config *fc_config) -{ - asd->params.config.fc_config = fc_config; -} - -void atomisp_css_set_ctc_config(struct atomisp_sub_device *asd, - struct ia_css_ctc_config *ctc_config) -{ - asd->params.config.ctc_config = ctc_config; -} - -void atomisp_css_set_cnr_config(struct atomisp_sub_device *asd, - struct ia_css_cnr_config *cnr_config) -{ - asd->params.config.cnr_config = cnr_config; -} - -void atomisp_css_set_aa_config(struct atomisp_sub_device *asd, - struct ia_css_aa_config *aa_config) -{ - asd->params.config.aa_config = aa_config; -} - -void atomisp_css_set_baa_config(struct atomisp_sub_device *asd, - struct ia_css_aa_config *baa_config) -{ - asd->params.config.baa_config = baa_config; -} - -void atomisp_css_set_anr_config(struct atomisp_sub_device *asd, - struct ia_css_anr_config *anr_config) -{ - asd->params.config.anr_config = anr_config; -} - -void atomisp_css_set_xnr_config(struct atomisp_sub_device *asd, - struct ia_css_xnr_config *xnr_config) -{ - asd->params.config.xnr_config = xnr_config; -} - -void atomisp_css_set_yuv2rgb_cc_config(struct atomisp_sub_device *asd, - struct ia_css_cc_config *yuv2rgb_cc_config) -{ - asd->params.config.yuv2rgb_cc_config = yuv2rgb_cc_config; -} - -void atomisp_css_set_rgb2yuv_cc_config(struct atomisp_sub_device *asd, - struct ia_css_cc_config *rgb2yuv_cc_config) -{ - asd->params.config.rgb2yuv_cc_config = rgb2yuv_cc_config; -} - -void atomisp_css_set_xnr_table(struct atomisp_sub_device *asd, - struct ia_css_xnr_table *xnr_table) -{ - asd->params.config.xnr_table = xnr_table; -} - -void atomisp_css_set_r_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *r_gamma_table) -{ - asd->params.config.r_gamma_table = r_gamma_table; -} - -void atomisp_css_set_g_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *g_gamma_table) -{ - asd->params.config.g_gamma_table = g_gamma_table; -} - -void atomisp_css_set_b_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *b_gamma_table) -{ - asd->params.config.b_gamma_table = b_gamma_table; -} - -void atomisp_css_set_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_gamma_table *gamma_table) -{ - asd->params.config.gamma_table = gamma_table; -} - void atomisp_css_set_ctc_table(struct atomisp_sub_device *asd, struct ia_css_ctc_table *ctc_table) { @@ -3530,18 +3261,6 @@ void atomisp_css_set_dvs_6axis(struct atomisp_sub_device *asd, asd->params.config.dvs_6axis_config = dvs_6axis; } -void atomisp_css_set_gc_config(struct atomisp_sub_device *asd, - struct ia_css_gc_config *gc_config) -{ - asd->params.config.gc_config = gc_config; -} - -void atomisp_css_set_3a_config(struct atomisp_sub_device *asd, - struct ia_css_3a_config *s3a_config) -{ - asd->params.config.s3a_config = s3a_config; -} - void atomisp_css_video_set_dis_vector(struct atomisp_sub_device *asd, struct atomisp_dis_vector *vector) { diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h index e8b330dacba9..05f0d6aa72d1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.h @@ -140,18 +140,6 @@ void atomisp_css_set_yuv2rgb_cc_config(struct atomisp_sub_device *asd, void atomisp_css_set_rgb2yuv_cc_config(struct atomisp_sub_device *asd, struct ia_css_cc_config *rgb2yuv_cc_config); -void atomisp_css_set_xnr_table(struct atomisp_sub_device *asd, - struct ia_css_xnr_table *xnr_table); - -void atomisp_css_set_r_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *r_gamma_table); - -void atomisp_css_set_g_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *g_gamma_table); - -void atomisp_css_set_b_gamma_table(struct atomisp_sub_device *asd, - struct ia_css_rgb_gamma_table *b_gamma_table); - void atomisp_css_set_anr_thres(struct atomisp_sub_device *asd, struct ia_css_anr_thres *anr_thres); diff --git a/drivers/staging/media/atomisp/pci/atomisp_file.c b/drivers/staging/media/atomisp/pci/atomisp_file.c index 4ab0390316cf..ac2da7c34645 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_file.c +++ b/drivers/staging/media/atomisp/pci/atomisp_file.c @@ -50,11 +50,12 @@ static void file_work(struct work_struct *work) V4L2_SUBDEV_FORMAT_ACTIVE, ATOMISP_SUBDEV_PAD_SINK); - while (!atomisp_css_isp_has_started()) + while (!ia_css_isp_has_started()) usleep_range(1000, 1500); - atomisp_css_send_input_frame(asd, buf, isp_sink_fmt.width, - isp_sink_fmt.height); + ia_css_stream_send_input_frame(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream, + buf, isp_sink_fmt.width, + isp_sink_fmt.height); dev_dbg(isp->dev, "<%s: streaming done\n", __func__); } diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 3e5806403b31..8d85b3884ed2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -252,8 +252,7 @@ int atomisp_q_video_buffers_to_css(struct atomisp_sub_device *asd, err = atomisp_calculate_real_zoom_region(asd, ¶m->params.dz_config, css_pipe_id); if (!err) - atomisp_css_set_dz_config(asd, - ¶m->params.dz_config); + asd->params.config.dz_config = ¶m->params.dz_config; } atomisp_css_set_isp_config_applied_frame(asd, vm_mem->vaddr); diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index e5ade03e4749..72c953a6116e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -891,7 +891,7 @@ void atomisp_videobuf_free_buf(struct videobuf_buffer *vb) vm_mem = vb->priv; if (vm_mem && vm_mem->vaddr) { - atomisp_css_frame_free(vm_mem->vaddr); + ia_css_frame_free(vm_mem->vaddr); vm_mem->vaddr = NULL; } } @@ -1067,7 +1067,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, * memory management function */ for (i = 0; i < req->count; i++) { - if (atomisp_css_frame_allocate_from_info(&frame, &frame_info)) + if (ia_css_frame_allocate_from_info(&frame, &frame_info)) goto error; vm_mem = pipe->capq.bufs[i]->priv; vm_mem->vaddr = frame; @@ -1078,11 +1078,11 @@ int __atomisp_reqbufs(struct file *file, void *fh, error: while (i--) { vm_mem = pipe->capq.bufs[i]->priv; - atomisp_css_frame_free(vm_mem->vaddr); + ia_css_frame_free(vm_mem->vaddr); } if (asd->vf_frame) - atomisp_css_frame_free(asd->vf_frame); + ia_css_frame_free(asd->vf_frame); return -ENOMEM; } @@ -1200,7 +1200,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) goto error; } - ret = atomisp_css_frame_map(&handle, &frame_info, + ret = ia_css_frame_map(&handle, &frame_info, (void __user *)buf->m.userptr, 0, pgnr); if (ret) { @@ -1210,7 +1210,7 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) if (vm_mem->vaddr) { mutex_lock(&pipe->capq.vb_lock); - atomisp_css_frame_free(vm_mem->vaddr); + ia_css_frame_free(vm_mem->vaddr); vm_mem->vaddr = NULL; vb->state = VIDEOBUF_NEEDS_INIT; mutex_unlock(&pipe->capq.vb_lock); @@ -1758,8 +1758,7 @@ static int atomisp_streamon(struct file *file, void *fh, if (asd->params.css_update_params_needed) { atomisp_apply_css_parameters(asd, &asd->params.css_param); if (asd->params.css_param.update_flag.dz_config) - atomisp_css_set_dz_config(asd, - &asd->params.css_param.dz_config); + asd->params.config.dz_config = &asd->params.css_param.dz_config; atomisp_css_update_isp_params(asd); asd->params.css_update_params_needed = false; memset(&asd->params.css_param.update_flag, 0, From patchwork Sat May 30 06:55:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F246FC433E0 for ; Sat, 30 May 2020 06:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B169020776 for ; Sat, 30 May 2020 06:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821828; bh=Oyk1vXm1uatGUoTG7h+zDO23k3FvJgbQFqw1PbnWQIk=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=X033z8eXpce9u8PJ3YCv4/YOdPNJ13Q6Nr2cMwdTV9Zfde4SDP/Ad6ROphzznrb0F CWC5lr6ONJWirY4onSgVmFeRYKq45luQIkPbdxowx2PfoUggBe6psEVLXTJqM/oO5v 7zQbb84SJ46ckXbdyuYui4iBVIrtrZIlq+Bxw9Fo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729036AbgE3G5I (ORCPT ); Sat, 30 May 2020 02:57:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:44904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728872AbgE3G4I (ORCPT ); Sat, 30 May 2020 02:56:08 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4A6B5221EE; Sat, 30 May 2020 06:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=Oyk1vXm1uatGUoTG7h+zDO23k3FvJgbQFqw1PbnWQIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9U8Ve9JIteXE+jzQMfDWKqDLfT19NIOtAfR6aU8poDx7WtPVU0DsNsOGpSY/OiGt 5HCUcr0nVKh/O6T78TWDZd7zT9G/8M1sObpFjOciLrPsdDV5xpojtElQTGbu0wDHqh HQ2UeYFUO4unocAdZGG4OFjoWzj1j3ZNAqbTZqoQ= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPW-001hqm-7l; Sat, 30 May 2020 08:56:02 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH v2 34/41] media: atomisp: get rid of system_types.h Date: Sat, 30 May 2020 08:55:51 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is just a wrapper for system_local.h. Signed-off-by: Mauro Carvalho Chehab --- .../base/refcount/interface/ia_css_refcount.h | 2 +- .../input_formatter_global.h | 2 +- .../pci/hive_isp_css_common/irq_global.h | 2 +- .../pci/hive_isp_css_common/isp_global.h | 2 +- .../pci/hive_isp_css_common/sp_global.h | 2 +- .../device_access/device_access.h | 2 +- .../hive_isp_css_include/host/debug_public.h | 2 +- .../hive_isp_css_include/host/dma_public.h | 2 +- .../host/event_fifo_public.h | 2 +- .../host/fifo_monitor_public.h | 2 +- .../host/gp_device_public.h | 2 +- .../host/gp_timer_public.h | 2 +- .../hive_isp_css_include/host/gpio_public.h | 2 +- .../host/input_formatter_public.h | 2 +- .../hive_isp_css_include/host/irq_public.h | 2 +- .../hive_isp_css_include/host/isp_public.h | 2 +- .../host/isys_dma_public.h | 2 +- .../hive_isp_css_include/host/mmu_public.h | 2 +- .../pci/hive_isp_css_include/host/sp_public.h | 2 +- .../host/timed_ctrl_public.h | 2 +- .../pci/hive_isp_css_include/system_types.h | 24 ------------------- .../media/atomisp/pci/ia_css_acc_types.h | 2 +- .../media/atomisp/pci/ia_css_device_access.c | 2 +- .../media/atomisp/pci/ia_css_device_access.h | 2 +- .../frame/interface/ia_css_frame_comm.h | 2 +- .../runtime/rmgr/interface/ia_css_rmgr_vbuf.h | 2 +- .../media/atomisp/pci/sh_css_firmware.h | 2 +- .../staging/media/atomisp/pci/sh_css_struct.h | 2 +- 28 files changed, 27 insertions(+), 51 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/system_types.h diff --git a/drivers/staging/media/atomisp/pci/base/refcount/interface/ia_css_refcount.h b/drivers/staging/media/atomisp/pci/base/refcount/interface/ia_css_refcount.h index 9d2b7f3b6c01..72ec09dde256 100644 --- a/drivers/staging/media/atomisp/pci/base/refcount/interface/ia_css_refcount.h +++ b/drivers/staging/media/atomisp/pci/base/refcount/interface/ia_css_refcount.h @@ -16,7 +16,7 @@ #define _IA_CSS_REFCOUNT_H_ #include -#include +#include #include #include diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/input_formatter_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/input_formatter_global.h index 163521c53d4b..c0658972f9cb 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/input_formatter_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/input_formatter_global.h @@ -19,7 +19,7 @@ #define IS_INPUT_SWITCH_VERSION2 #include -#include +#include #include "if_defs.h" #include "str2mem_defs.h" #include "input_switch_2400_defs.h" diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/irq_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/irq_global.h index 64554d80dc0b..883754def2d8 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/irq_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/irq_global.h @@ -15,7 +15,7 @@ #ifndef __IRQ_GLOBAL_H_INCLUDED__ #define __IRQ_GLOBAL_H_INCLUDED__ -#include +#include #define IS_IRQ_VERSION_2 #define IS_IRQ_MAP_VERSION_2 diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h index 1a8547d58435..ad25597c4f03 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/isp_global.h @@ -15,7 +15,7 @@ #ifndef __ISP_GLOBAL_H_INCLUDED__ #define __ISP_GLOBAL_H_INCLUDED__ -#include +#include #if defined(HAS_ISP_2401_MAMOIADA) #define IS_ISP_2401_MAMOIADA diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h b/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h index 6ec4e590e3b4..252fe8c624eb 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/sp_global.h @@ -15,7 +15,7 @@ #ifndef __SP_GLOBAL_H_INCLUDED__ #define __SP_GLOBAL_H_INCLUDED__ -#include +#include #if defined(HAS_SP_2401) #define IS_SP_2401 diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/device_access/device_access.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/device_access/device_access.h index be031d41de7c..7168c3945772 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/device_access/device_access.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/device_access/device_access.h @@ -39,7 +39,7 @@ more details. * User provided file that defines the system address types: * - hrt_address a type that can hold the (sub)system address range */ -#include "system_types.h" +#include "system_local.h" /* * We cannot assume that the global system address size is the size of * a pointer because a (say) 64-bit host can be simulated in a 32-bit diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/debug_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/debug_public.h index aa386e4d4149..8128e40dcc67 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/debug_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/debug_public.h @@ -17,7 +17,7 @@ #include #include -#include "system_types.h" +#include "system_local.h" /*! brief * diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/dma_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/dma_public.h index 385b978b703b..b32cfde16b5a 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/dma_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/dma_public.h @@ -15,7 +15,7 @@ #ifndef __DMA_PUBLIC_H_INCLUDED__ #define __DMA_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" typedef struct dma_state_s dma_state_t; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/event_fifo_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/event_fifo_public.h index a84b74b3bc1e..f6a96401cc68 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/event_fifo_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/event_fifo_public.h @@ -16,7 +16,7 @@ #define __EVENT_FIFO_PUBLIC_H #include -#include "system_types.h" +#include "system_local.h" /*! Blocking read from an event source EVENT[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/fifo_monitor_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/fifo_monitor_public.h index e451d6f2a70d..9f01194184a7 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/fifo_monitor_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/fifo_monitor_public.h @@ -15,7 +15,7 @@ #ifndef __FIFO_MONITOR_PUBLIC_H_INCLUDED__ #define __FIFO_MONITOR_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" typedef struct fifo_channel_state_s fifo_channel_state_t; typedef struct fifo_switch_state_s fifo_switch_state_t; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_device_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_device_public.h index 7cc0799d49ed..5ec5d56457a7 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_device_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_device_public.h @@ -15,7 +15,7 @@ #ifndef __GP_DEVICE_PUBLIC_H_INCLUDED__ #define __GP_DEVICE_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" typedef struct gp_device_state_s gp_device_state_t; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_timer_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_timer_public.h index 2ddb8c40a5b2..0800280b7393 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_timer_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gp_timer_public.h @@ -15,7 +15,7 @@ #ifndef __GP_TIMER_PUBLIC_H_INCLUDED__ #define __GP_TIMER_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" /*! initialize mentioned timer param ID timer_id diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gpio_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gpio_public.h index d21aab3a179d..bd1350b8f9ee 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gpio_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/gpio_public.h @@ -15,7 +15,7 @@ #ifndef __GPIO_PUBLIC_H_INCLUDED__ #define __GPIO_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" /*! Write to a control register of GPIO[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/input_formatter_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/input_formatter_public.h index e5758cb8bedd..0a9e450af765 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/input_formatter_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/input_formatter_public.h @@ -16,7 +16,7 @@ #define __INPUT_FORMATTER_PUBLIC_H_INCLUDED__ #include -#include "system_types.h" +#include "system_local.h" /*! Reset INPUT_FORMATTER[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h index dfe2aa9ff257..cb210166b3b9 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/irq_public.h @@ -16,7 +16,7 @@ #define __IRQ_PUBLIC_H_INCLUDED__ #include -#include "system_types.h" +#include "system_local.h" /*! Read the control registers of IRQ[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isp_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isp_public.h index 0da2937b900e..09e209ed1847 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isp_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isp_public.h @@ -16,7 +16,7 @@ #define __ISP_PUBLIC_H_INCLUDED__ #include -#include "system_types.h" +#include "system_local.h" /*! Enable or disable the program complete irq signal of ISP[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h index 734634aedadf..96670c740a78 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h @@ -17,7 +17,7 @@ #ifdef USE_INPUT_SYSTEM_VERSION_2401 -#include "system_types.h" +#include "system_local.h" #include "type_support.h" STORAGE_CLASS_ISYS2401_DMA_H void isys2401_dma_reg_store( diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/mmu_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/mmu_public.h index 278f9cd85a00..7cdb270529f7 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/mmu_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/mmu_public.h @@ -15,7 +15,7 @@ #ifndef __MMU_PUBLIC_H_INCLUDED__ #define __MMU_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" #include "device_access.h" #include "assert_support.h" diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/sp_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/sp_public.h index b8db5469b592..b309890f5a76 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/sp_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/sp_public.h @@ -16,7 +16,7 @@ #define __SP_PUBLIC_H_INCLUDED__ #include -#include "system_types.h" +#include "system_local.h" typedef struct sp_state_s sp_state_t; typedef struct sp_stall_s sp_stall_t; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/timed_ctrl_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/timed_ctrl_public.h index 5f9277adb2ab..e59a1f8526af 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/timed_ctrl_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/timed_ctrl_public.h @@ -15,7 +15,7 @@ #ifndef __TIMED_CTRL_PUBLIC_H_INCLUDED__ #define __TIMED_CTRL_PUBLIC_H_INCLUDED__ -#include "system_types.h" +#include "system_local.h" /*! Write to a control register of TIMED_CTRL[ID] diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/system_types.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/system_types.h deleted file mode 100644 index 764fda8dd214..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/system_types.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ -#ifndef __SYSTEM_TYPES_H_INCLUDED__ -#define __SYSTEM_TYPES_H_INCLUDED__ - -/** -* @file -* Platform specific types. -*/ - -#include "system_local.h" - -#endif /* __SYSTEM_TYPES_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/ia_css_acc_types.h b/drivers/staging/media/atomisp/pci/ia_css_acc_types.h index d281846eeba5..55b4dc9bb5ea 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_acc_types.h +++ b/drivers/staging/media/atomisp/pci/ia_css_acc_types.h @@ -19,7 +19,7 @@ * This file contains types used for acceleration */ -#include /* HAS_IRQ_MAP_VERSION_# */ +#include /* HAS_IRQ_MAP_VERSION_# */ #include #include #include diff --git a/drivers/staging/media/atomisp/pci/ia_css_device_access.c b/drivers/staging/media/atomisp/pci/ia_css_device_access.c index 6ad8687cf08b..fe7556b59aef 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_device_access.c +++ b/drivers/staging/media/atomisp/pci/ia_css_device_access.c @@ -14,7 +14,7 @@ #include "ia_css_device_access.h" #include /* for uint*, size_t */ -#include /* for hrt_address */ +#include /* for hrt_address */ #include /* for ia_css_hw_access_env */ #include /* for assert */ diff --git a/drivers/staging/media/atomisp/pci/ia_css_device_access.h b/drivers/staging/media/atomisp/pci/ia_css_device_access.h index b2bf7d540b62..9445c3141db5 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_device_access.h +++ b/drivers/staging/media/atomisp/pci/ia_css_device_access.h @@ -20,7 +20,7 @@ */ #include /* for uint*, size_t */ -#include /* for hrt_address */ +#include /* for hrt_address */ #include /* for ia_css_hw_access_env */ void diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/interface/ia_css_frame_comm.h b/drivers/staging/media/atomisp/pci/runtime/frame/interface/ia_css_frame_comm.h index 138aaaf07854..0a98d363e2bf 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/interface/ia_css_frame_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/frame/interface/ia_css_frame_comm.h @@ -18,7 +18,7 @@ #include "type_support.h" #include "platform_support.h" #include "runtime/bufq/interface/ia_css_bufq_comm.h" -#include /* ia_css_ptr */ +#include /* ia_css_ptr */ /* * These structs are derived from structs defined in ia_css_types.h diff --git a/drivers/staging/media/atomisp/pci/runtime/rmgr/interface/ia_css_rmgr_vbuf.h b/drivers/staging/media/atomisp/pci/runtime/rmgr/interface/ia_css_rmgr_vbuf.h index be5d42bb3545..b3cf42c67187 100644 --- a/drivers/staging/media/atomisp/pci/runtime/rmgr/interface/ia_css_rmgr_vbuf.h +++ b/drivers/staging/media/atomisp/pci/runtime/rmgr/interface/ia_css_rmgr_vbuf.h @@ -18,7 +18,7 @@ #include "ia_css_rmgr.h" #include #include -#include +#include /** * @brief Data structure for the resource handle (host, vbuf) diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.h b/drivers/staging/media/atomisp/pci/sh_css_firmware.h index 68f389dcf3fc..22a58ab9cad7 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.h +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.h @@ -15,7 +15,7 @@ #ifndef _SH_CSS_FIRMWARE_H_ #define _SH_CSS_FIRMWARE_H_ -#include +#include #include #include diff --git a/drivers/staging/media/atomisp/pci/sh_css_struct.h b/drivers/staging/media/atomisp/pci/sh_css_struct.h index d4ea847d29ce..fd87c2c5c92c 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_struct.h +++ b/drivers/staging/media/atomisp/pci/sh_css_struct.h @@ -24,7 +24,7 @@ */ #include -#include +#include #include "ia_css_pipeline.h" #include "ia_css_pipe_public.h" #include "ia_css_frame_public.h" From patchwork Sat May 30 06:55:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209672 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2B43C433E0 for ; Sat, 30 May 2020 06:58:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA670206C3 for ; Sat, 30 May 2020 06:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821915; bh=scAvoLDDGn5cq3ZLD2TTb4DoukfwOFpBqOOQshZmdXg=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Mb3uIHk3ArgcAeygnlF51RZVSqQ4p/PfvauuR7cGoGc/n70O4voWflFgvVNHKrrAC fTc0arDooT0vp7ReWQCsIN8A8u7LhCZiJhiNp1rIVYIFwgIu2/8fUBbSDoqfyAz6DE oMDZ55BBEJw9M3H6Y/tkyp/da70o+bcBUAmf7W9Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728912AbgE3G6a (ORCPT ); Sat, 30 May 2020 02:58:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:44972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728864AbgE3G4H (ORCPT ); Sat, 30 May 2020 02:56:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6955E221F1; Sat, 30 May 2020 06:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=scAvoLDDGn5cq3ZLD2TTb4DoukfwOFpBqOOQshZmdXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtUjHPF4pvuZQE6KtrK5iJ+dYC5RdKOpOKuQABgncK4ZIvZB6erGclHUB9G7uwqyx W1EK+Xnve/unhrNMX1dDtbQpBYkQemW3gq87TjszuOU5ZKZ4jBhumXseOQIs5wkyFE qFkh761p5cNJoHoN7N5UDY8MsKXhem1rWb/jDRFM= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPW-001hqw-A6; Sat, 30 May 2020 08:56:02 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 36/41] media: atomisp: print firmware data during load Date: Sat, 30 May 2020 08:55:53 +0200 Message-Id: <0cad0cb793ea9946043b8a02112673165e24ec72.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org While there's a way to list the firmware binaries in runtime, it is worth to also print it during firmware load. One advantage is that this code also introduces additional checks with regards to invalid firmware types, which can be useful to identify problems. Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/sh_css_firmware.c | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/sh_css_firmware.c index 63415356c36d..7cd27707a35f 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/sh_css_firmware.c @@ -206,6 +206,20 @@ sh_css_check_firmware_version(struct device *dev, const char *fw_data) return 0; } +static const char *fw_type_name[] = { + [ia_css_sp_firmware] = "SP", + [ia_css_isp_firmware] = "ISP", + [ia_css_bootloader_firmware] = "BootLoader", + [ia_css_acc_firmware] = "accel", +}; + +static const char *fw_acc_type_name[] = { + [IA_CSS_ACC_NONE] = "Normal", + [IA_CSS_ACC_OUTPUT] = "Accel for output", + [IA_CSS_ACC_VIEWFINDER] = "Accel for viewfinder", + [IA_CSS_ACC_STANDALONE] = "Stand-alone accel", +}; + int sh_css_load_firmware(struct device *dev, const char *fw_data, unsigned int fw_size) { @@ -276,13 +290,45 @@ sh_css_load_firmware(struct device *dev, const char *fw_data, if (bi->blob.offset + bi->blob.size > fw_size) return -EINVAL; + switch (bd.header.type) { + case ia_css_isp_firmware: + if (bd.header.info.isp.type > IA_CSS_ACC_STANDALONE) { + dev_err(dev, "binary #%2d: invalid SP type\n", + i); + return -EINVAL; + } + + dev_dbg(dev, + "binary #%-2d type %s (%s), binary id is %2d: %s\n", + i, + fw_type_name[bd.header.type], + fw_acc_type_name[bd.header.info.isp.type], + bd.header.info.isp.sp.id, + bd.name); + break; + case ia_css_sp_firmware: + case ia_css_bootloader_firmware: + case ia_css_acc_firmware: + dev_dbg(dev, + "binary #%-2d type %s: %s\n", + i, fw_type_name[bd.header.type], + bd.name); + default: + if (bd.header.info.isp.type > IA_CSS_ACC_STANDALONE) { + dev_err(dev, + "binary #%2d: invalid firmware type\n", + i); + return -EINVAL; + } + break; + } + if (bi->type == ia_css_sp_firmware) { if (i != SP_FIRMWARE) return -EINVAL; err = setup_binary(bi, fw_data, &sh_css_sp_fw, i); if (err) return err; - dev_dbg(dev, "firmware #%d (SP), name %s\n", i, bd.name); } else { /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS) are ISP firmware */ From patchwork Sat May 30 06:55:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F269C433E2 for ; Sat, 30 May 2020 06:57:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B1AC206C3 for ; Sat, 30 May 2020 06:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821866; bh=LjjzFw3NkkZPnbm04q5U6LrJoSCasK1Q3wt7fXKXAI8=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ZnTBCegSoethx8uB15+63Jc7HMSmyiEsI+p25Mqo/4q73wBqZt41fLXfNpcy3HYuc LUtM14pXOI374vfW5v7dE5vN8laFWYqi4sF5Dsn99XOF0m9O9c/X5seARpwCH4UkEr eyLcFvCUzoF1LDCQw9I4SRjmQ52DOMD4JDy3BOAI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729106AbgE3G5o (ORCPT ); Sat, 30 May 2020 02:57:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:44956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728867AbgE3G4H (ORCPT ); Sat, 30 May 2020 02:56:07 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73456221F7; Sat, 30 May 2020 06:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=LjjzFw3NkkZPnbm04q5U6LrJoSCasK1Q3wt7fXKXAI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsAVHSpi58wzneYQNrOeArq/niTH89/+xIrnsFYxM51I4qyEDP6ZyhZckSdSHun0B Gl6OYiffK47eTtkRjg3wnk5CwTIGzhKHjEPrxwlCapPaD/nVXuvJdAYUZ2oljlpWJZ 8Ba78sllRqe9Tcx/aLwImVnLmLNofGXdk6G/GJSA= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPW-001hr1-B7; Sat, 30 May 2020 08:56:02 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 37/41] media: atomisp: allow passing firmware name at modprobe time Date: Sat, 30 May 2020 08:55:54 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It can be useful to be able to test different firmware files at modprobe time, in order to be able to test different variants without much efforts. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/atomisp_v4l2.c | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 891c990ab857..dea420a77f0a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -95,6 +95,10 @@ int mipicsi_flag; module_param(mipicsi_flag, int, 0644); MODULE_PARM_DESC(mipicsi_flag, "mipi csi compression predictor algorithm"); +static char firmware_name[256]; +module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0); +MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the default firmware name."); + /*set to 16x16 since this is the amount of lines and pixels the sensor exports extra. If these are kept at the 10x8 that they were on, in yuv downscaling modes incorrect resolutions where requested to the sensor @@ -1455,19 +1459,23 @@ atomisp_load_firmware(struct atomisp_device *isp) if (skip_fwload) return NULL; - if ((isp->media_dev.hw_revision >> ATOMISP_HW_REVISION_SHIFT) - == ATOMISP_HW_REVISION_ISP2401) - fw_path = "shisp_2401a0_v21.bin"; + if (firmware_name[0] != '\0') { + fw_path = firmware_name; + } else { + if ((isp->media_dev.hw_revision >> ATOMISP_HW_REVISION_SHIFT) + == ATOMISP_HW_REVISION_ISP2401) + fw_path = "shisp_2401a0_v21.bin"; - if (isp->media_dev.hw_revision == - ((ATOMISP_HW_REVISION_ISP2401_LEGACY << ATOMISP_HW_REVISION_SHIFT) - | ATOMISP_HW_STEPPING_A0)) - fw_path = "shisp_2401a0_legacy_v21.bin"; + if (isp->media_dev.hw_revision == + ((ATOMISP_HW_REVISION_ISP2401_LEGACY << ATOMISP_HW_REVISION_SHIFT) + | ATOMISP_HW_STEPPING_A0)) + fw_path = "shisp_2401a0_legacy_v21.bin"; - if (isp->media_dev.hw_revision == - ((ATOMISP_HW_REVISION_ISP2400 << ATOMISP_HW_REVISION_SHIFT) - | ATOMISP_HW_STEPPING_B0)) - fw_path = "shisp_2400b0_v21.bin"; + if (isp->media_dev.hw_revision == + ((ATOMISP_HW_REVISION_ISP2400 << ATOMISP_HW_REVISION_SHIFT) + | ATOMISP_HW_STEPPING_B0)) + fw_path = "shisp_2400b0_v21.bin"; + } if (!fw_path) { dev_err(isp->dev, "Unsupported hw_revision 0x%x\n", From patchwork Sat May 30 06:55:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 209678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D53E3C433E2 for ; Sat, 30 May 2020 06:57:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5F55206C3 for ; Sat, 30 May 2020 06:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821858; bh=OkGr1wyY4tvroJ3UDFTTFl/XE5q2AgcowgjQvdCNFUY=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=GKMHJCjXBWOESuHrDgbbos36V5C1cjsSrkEw56wfaUolt7tXlRxYsraPeBkan03Uz 2PGTPV/E9fnxoi0E4YmmyY2EEAlAuFO3Lb6flAx75+Ru0mkaAWZx5F2hPFj4MbTm2a LctHk8dp3yXok6ad/3IGte/mdKxD9N0dijTibQnI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729077AbgE3G53 (ORCPT ); Sat, 30 May 2020 02:57:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:44862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728878AbgE3G4I (ORCPT ); Sat, 30 May 2020 02:56:08 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89057221FC; Sat, 30 May 2020 06:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590821764; bh=OkGr1wyY4tvroJ3UDFTTFl/XE5q2AgcowgjQvdCNFUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqSlyh0EOqG1PlR+aG3Z1ccxe4NhvgiW+WBYm9TA4GM0oaps5HPinp8XQBTT1wbXG 4pTKDYjdMyrk00LqpRnf6HwuLYlDnc9g1klj4Wkj/eTtMt53zaDRCUY1pQgb6IYwzt NJZWme+GpGB7XlgMKOSCVGz6rK2NCdaGXBglSEe4= Received: from mchehab by mail.kernel.org with local (Exim 4.93) (envelope-from ) id 1jevPW-001hrF-Eg; Sat, 30 May 2020 08:56:02 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH v2 40/41] media: atomisp: get rid of set_fs() dirty hacks Date: Sat, 30 May 2020 08:55:57 +0200 Message-Id: <20234729bd1227640b0ba1976fec9e1121d3437c.1590821410.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This file was based on an older version of the V4L2 compat32 code, which had this ugly hack. Change the code to remove the hack. Yet, the entire compat32 code is currently commented out. So, let's add a FIXME note at the code, as we may need to check if some of the atomisp specific ioctls would require it. It is not worth to do such checks now, as we may get rid of several of them while cleaning up other things while at staging. Reported-by: Christoph Hellwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/TODO | 3 + .../atomisp/pci/atomisp_compat_ioctl32.c | 89 ++++++++++--------- 2 files changed, 52 insertions(+), 40 deletions(-) diff --git a/drivers/staging/media/atomisp/TODO b/drivers/staging/media/atomisp/TODO index e58643a9de43..9e46015ebcd5 100644 --- a/drivers/staging/media/atomisp/TODO +++ b/drivers/staging/media/atomisp/TODO @@ -161,6 +161,9 @@ TODO for this driver until the other work is done, as there will be a lot of code churn until this driver becomes functional again. +16. Fix the compat32 code and remove the comment preventing it to be + called. + Limitations =========== diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c index 3079043f1fac..e2e3a242b95d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c @@ -847,9 +847,17 @@ static long atomisp_do_compat_ioctl(struct file *file, struct atomisp_metadata_with_type md_with_type; struct atomisp_sensor_ae_bracketing_lut lut; } karg; - mm_segment_t old_fs; - void __user *up = compat_ptr(arg); + void __user *p32 = compat_ptr(arg); + void __user *new_p64 = NULL; long err = -ENOIOCTLCMD; + int compatible_arg = 1; + + /* + * FIXME: should verify if any of the functions below will be + * setting a pointer. If so, compatible_arg should be zeroed. + * + * Please see v4l2-compat-ioctl32.c for more details + */ /* First, convert the command. */ switch (cmd) { @@ -936,130 +944,131 @@ static long atomisp_do_compat_ioctl(struct file *file, switch (cmd) { case ATOMISP_IOC_G_HISTOGRAM: case ATOMISP_IOC_S_HISTOGRAM: - err = get_atomisp_histogram32(&karg.his, up); + err = get_atomisp_histogram32(&karg.his, p32); break; case ATOMISP_IOC_G_DIS_STAT: - err = get_atomisp_dis_statistics32(&karg.dis_s, up); + err = get_atomisp_dis_statistics32(&karg.dis_s, p32); break; case ATOMISP_IOC_S_DIS_COEFS: - err = get_atomisp_dis_coefficients32(&karg.dis_c, up); + err = get_atomisp_dis_coefficients32(&karg.dis_c, p32); break; case ATOMISP_IOC_S_DIS_VECTOR: - err = get_atomisp_dvs_6axis_config32(&karg.dvs_c, up); + err = get_atomisp_dvs_6axis_config32(&karg.dvs_c, p32); break; case ATOMISP_IOC_G_3A_STAT: - err = get_atomisp_3a_statistics32(&karg.s3a_s, up); + err = get_atomisp_3a_statistics32(&karg.s3a_s, p32); break; case ATOMISP_IOC_G_ISP_GDC_TAB: case ATOMISP_IOC_S_ISP_GDC_TAB: - err = get_atomisp_morph_table32(&karg.mor_t, up); + err = get_atomisp_morph_table32(&karg.mor_t, p32); break; case ATOMISP_IOC_S_ISP_FPN_TABLE: - err = get_v4l2_framebuffer32(&karg.v4l2_buf, up); + err = get_v4l2_framebuffer32(&karg.v4l2_buf, p32); break; case ATOMISP_IOC_G_ISP_OVERLAY: case ATOMISP_IOC_S_ISP_OVERLAY: - err = get_atomisp_overlay32(&karg.overlay, up); + err = get_atomisp_overlay32(&karg.overlay, p32); break; case ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP: - err = get_atomisp_calibration_group32(&karg.cal_grp, up); + err = get_atomisp_calibration_group32(&karg.cal_grp, p32); break; case ATOMISP_IOC_ACC_LOAD: - err = get_atomisp_acc_fw_load32(&karg.acc_fw_load, up); + err = get_atomisp_acc_fw_load32(&karg.acc_fw_load, p32); break; case ATOMISP_IOC_ACC_S_ARG: case ATOMISP_IOC_ACC_DESTAB: - err = get_atomisp_acc_fw_arg32(&karg.acc_fw_arg, up); + err = get_atomisp_acc_fw_arg32(&karg.acc_fw_arg, p32); break; case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: case ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA: - err = get_v4l2_private_int_data32(&karg.v4l2_pri_data, up); + err = get_v4l2_private_int_data32(&karg.v4l2_pri_data, p32); break; case ATOMISP_IOC_S_ISP_SHD_TAB: - err = get_atomisp_shading_table32(&karg.shd_tbl, up); + err = get_atomisp_shading_table32(&karg.shd_tbl, p32); break; case ATOMISP_IOC_ACC_MAP: case ATOMISP_IOC_ACC_UNMAP: - err = get_atomisp_acc_map32(&karg.acc_map, up); + err = get_atomisp_acc_map32(&karg.acc_map, p32); break; case ATOMISP_IOC_ACC_S_MAPPED_ARG: - err = get_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, up); + err = get_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, p32); break; case ATOMISP_IOC_S_PARAMETERS: - err = get_atomisp_parameters32(&karg.param, up); + err = get_atomisp_parameters32(&karg.param, p32); break; case ATOMISP_IOC_ACC_LOAD_TO_PIPE: err = get_atomisp_acc_fw_load_to_pipe32(&karg.acc_fw_to_pipe, - up); + p32); break; case ATOMISP_IOC_G_METADATA: - err = get_atomisp_metadata_stat32(&karg.md, up); + err = get_atomisp_metadata_stat32(&karg.md, p32); break; case ATOMISP_IOC_G_METADATA_BY_TYPE: err = get_atomisp_metadata_by_type_stat32(&karg.md_with_type, - up); + p32); break; case ATOMISP_IOC_S_SENSOR_AE_BRACKETING_LUT: - err = get_atomisp_sensor_ae_bracketing_lut(&karg.lut, up); + err = get_atomisp_sensor_ae_bracketing_lut(&karg.lut, p32); break; } if (err) return err; - old_fs = get_fs(); - set_fs(KERNEL_DS); - err = native_ioctl(file, cmd, (unsigned long)&karg); - set_fs(old_fs); + if (compatible_arg) + err = native_ioctl(file, cmd, (unsigned long)p32); + else + err = native_ioctl(file, cmd, (unsigned long)new_p64); + if (err) return err; switch (cmd) { case ATOMISP_IOC_G_HISTOGRAM: - err = put_atomisp_histogram32(&karg.his, up); + err = put_atomisp_histogram32(&karg.his, p32); break; case ATOMISP_IOC_G_DIS_STAT: - err = put_atomisp_dis_statistics32(&karg.dis_s, up); + err = put_atomisp_dis_statistics32(&karg.dis_s, p32); break; case ATOMISP_IOC_G_3A_STAT: - err = put_atomisp_3a_statistics32(&karg.s3a_s, up); + err = put_atomisp_3a_statistics32(&karg.s3a_s, p32); break; case ATOMISP_IOC_G_ISP_GDC_TAB: - err = put_atomisp_morph_table32(&karg.mor_t, up); + err = put_atomisp_morph_table32(&karg.mor_t, p32); break; case ATOMISP_IOC_G_ISP_OVERLAY: - err = put_atomisp_overlay32(&karg.overlay, up); + err = put_atomisp_overlay32(&karg.overlay, p32); break; case ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP: - err = put_atomisp_calibration_group32(&karg.cal_grp, up); + err = put_atomisp_calibration_group32(&karg.cal_grp, p32); break; case ATOMISP_IOC_ACC_LOAD: - err = put_atomisp_acc_fw_load32(&karg.acc_fw_load, up); + err = put_atomisp_acc_fw_load32(&karg.acc_fw_load, p32); break; case ATOMISP_IOC_ACC_S_ARG: case ATOMISP_IOC_ACC_DESTAB: - err = put_atomisp_acc_fw_arg32(&karg.acc_fw_arg, up); + err = put_atomisp_acc_fw_arg32(&karg.acc_fw_arg, p32); break; case ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA: case ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA: - err = put_v4l2_private_int_data32(&karg.v4l2_pri_data, up); + err = put_v4l2_private_int_data32(&karg.v4l2_pri_data, p32); break; case ATOMISP_IOC_ACC_MAP: case ATOMISP_IOC_ACC_UNMAP: - err = put_atomisp_acc_map32(&karg.acc_map, up); + err = put_atomisp_acc_map32(&karg.acc_map, p32); break; case ATOMISP_IOC_ACC_S_MAPPED_ARG: - err = put_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, up); + err = put_atomisp_acc_s_mapped_arg32(&karg.acc_map_arg, p32); break; case ATOMISP_IOC_ACC_LOAD_TO_PIPE: err = put_atomisp_acc_fw_load_to_pipe32(&karg.acc_fw_to_pipe, - up); + p32); break; case ATOMISP_IOC_G_METADATA: - err = put_atomisp_metadata_stat32(&karg.md, up); + err = put_atomisp_metadata_stat32(&karg.md, p32); break; case ATOMISP_IOC_G_METADATA_BY_TYPE: err = put_atomisp_metadata_by_type_stat32(&karg.md_with_type, - up); + p32); break; }