From patchwork Mon Apr 9 09:48:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10330929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D22E6053B for ; Mon, 9 Apr 2018 09:48:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21D9A2887A for ; Mon, 9 Apr 2018 09:48:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15E5D288A9; Mon, 9 Apr 2018 09:48:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 769502887A for ; Mon, 9 Apr 2018 09:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbeDIJsK (ORCPT ); Mon, 9 Apr 2018 05:48:10 -0400 Received: from osg.samsung.com ([64.30.133.232]:40278 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbeDIJsJ (ORCPT ); Mon, 9 Apr 2018 05:48:09 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id A8E3F382B8; Mon, 9 Apr 2018 02:48:08 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at dev.s-opensource.com Received: from osg.samsung.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id meE-XOrYx9d3; Mon, 9 Apr 2018 02:48:07 -0700 (PDT) Received: from vento.lan (177.133.69.40.dynamic.adsl.gvt.net.br [177.133.69.40]) by osg.samsung.com (Postfix) with ESMTPSA id 01F22382AE; Mon, 9 Apr 2018 02:48:04 -0700 (PDT) Date: Mon, 9 Apr 2018 06:48:01 -0300 From: Mauro Carvalho Chehab To: Arnd Bergmann Cc: Laurent Pinchart , Linux Media Mailing List , Mauro Carvalho Chehab , Hans Verkuil , Stanimir Varbanov , Benjamin Gaignard , Philipp Zabel , Ramesh Shanmugasundaram Subject: Re: [PATCH 02/16] media: omap3isp: allow it to build with COMPILE_TEST Message-ID: <20180409064801.335def4f@vento.lan> In-Reply-To: References: <2233233.yQEdpcOfql@avalon> <20180405164444.441033be@vento.lan> <4086814.xXeFl5mgbc@avalon> <20180407101455.214bf849@vento.lan> Organization: Samsung X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP HI Arnd, Em Mon, 9 Apr 2018 10:50:13 +0200 Arnd Bergmann escreveu: > >> > That hardly seems to be an arch-specific iommu solution, but, instead, some > >> > hack used by only three drivers or some legacy iommu binding. > >> > >> It's more complex than that. There are multiple IOMMU-related APIs on ARM, so > >> more recent than others, with different feature sets. While I agree that > >> drivers should move away from arm_iommu_create_mapping(), doing so requires > >> coordination between the IOMMU driver and the bus master driver (for instance > >> the omap3isp driver). It's not a trivial matter, but I'd love if someone > >> submitted patches :-) > > > > If someone steps up to do that, it would be really helpful, but we > > should not trust that this will happen. OMAP3 is an old hardware, > > and not many developers are working on improving its support. > > Considering its age, I still see a lot of changes on the arch/arm side of > it, so I wouldn't give up the hope yet. Yeah, someone might still work on such fix. > > Arnd, > > > > What do you think? > > I think including a foreign architecture header is worse than your > earlier patch, I'd rather see a local hack in the driver. > > I haven't tried it, but how about something simpler like what > I have below. Actually, another #ifdef was needed, before include arch-specifi header :-) > > Arnd > > (in case it works and you want to pick it up with a proper > changelog): > > Signed-off-by: Arnd Bergmann Sounds a reasonable approach. Instead of using CONFIG_ARM, I would, instead check for CONFIG_ARM_DMA_USE_IOMMU, with is the actual dependency for such code, as otherwise it could cause some compilation breakages on ARM with COMPILE_TEST and some randconfig. An advantage is that it properly annotates the part of the code that depends on ARM_DMA_USE_IOMMU. Thanks, Mauro From: Arnd Bergmann media: omap3isp: allow it to build with COMPILE_TEST There aren't much things required for it to build with COMPILE_TEST. It just needs to not compile the code that depends on arm-specific iommu implementation. Co-developed-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 1ee915b794c0..2757b621091c 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -63,12 +63,10 @@ config VIDEO_MUX config VIDEO_OMAP3 tristate "OMAP 3 Camera support" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API - depends on ARCH_OMAP3 || COMPILE_TEST - depends on ARM + depends on ((ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST) depends on COMMON_CLK depends on HAS_DMA && OF - depends on OMAP_IOMMU - select ARM_DMA_USE_IOMMU + select ARM_DMA_USE_IOMMU if OMAP_IOMMU select VIDEOBUF2_DMA_CONTIG select MFD_SYSCON select V4L2_FWNODE diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 16c50099cccd..b8c8761a76b6 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -61,7 +61,9 @@ #include #include +#ifdef CONFIG_ARM_DMA_USE_IOMMU #include +#endif #include #include @@ -1938,12 +1940,15 @@ static int isp_initialize_modules(struct isp_device *isp) static void isp_detach_iommu(struct isp_device *isp) { +#ifdef CONFIG_ARM_DMA_USE_IOMMU arm_iommu_release_mapping(isp->mapping); isp->mapping = NULL; +#endif } static int isp_attach_iommu(struct isp_device *isp) { +#ifdef CONFIG_ARM_DMA_USE_IOMMU struct dma_iommu_mapping *mapping; int ret; @@ -1972,6 +1977,9 @@ static int isp_attach_iommu(struct isp_device *isp) error: isp_detach_iommu(isp); return ret; +#else + return -ENODEV; +#endif } /*