From patchwork Fri Aug 21 04:14:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 11728063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D40F138C for ; Fri, 21 Aug 2020 04:18:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DC542076E for ; Fri, 21 Aug 2020 04:18:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VBgNrK5X"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kUGCGos3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DC542076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=D6rL6AFTbTGiEiAWxXgxF5vsLJkU2ocJsbD5HE/UVwE=; b=VBgNrK5XRZce4Fv2yVsJrti4xX M4L+ODbXKJP9Z6UjSCHBFe6baAWwy0bSdUNhCjP34TzHZPafIPG9DNvqPFNmG4YPOM81wMRZRJRlh tNdInzAM5mtqdjCv6L0rJv8e2mmSPYpKU5bM/TCyGsvQKqewGCK1g1zoy5uGSsdJT9s04UYGOjK/3 7+ttJ92V1ecVfdvovF5fVUr27Vibg5NYH3ICav6HARpdrXroa8CBZo7KcBS5D04IRAjEVjqGfpah8 HwPmMBhADsR/PAWfVFEws4XLtnl9xtvk6ieEeA2tVx7MfztMFqq8EZc+Y0SYsohxbMtPF6eb898nu 9PpGDtNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8yVX-0007nk-SH; Fri, 21 Aug 2020 04:18:27 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k8yRf-0005JK-Ng for linux-arm-kernel@lists.infradead.org; Fri, 21 Aug 2020 04:14:29 +0000 Received: by mail-pl1-x643.google.com with SMTP id k13so291289plk.13 for ; Thu, 20 Aug 2020 21:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R+6PqGDmju1P8TUKui985wN5cTC8kMP9k9WSWy+URa0=; b=kUGCGos3WLE1bpbh6O7msg86bx9Ao0Sf5P1qcz6SN4hewmUEXGH6Ajt8gkbFzrBxaQ Es1FJMpwyGCUmrZm7c9k6z+Gqp55q/SGRmM3MlvJAgIPFl6wrGT39ZPOVYBWVT/janLp 3bzNMPXsvnVEXRD/Un5qzVTWvtrATK8365Zlw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R+6PqGDmju1P8TUKui985wN5cTC8kMP9k9WSWy+URa0=; b=Atk6CS0Ld0/4NDTB+1PTsZ1W0NuzYqV8DsxXAFAfCXdgW5g77UjQ25XASOHqh1qCRj gkROzEwWDUfggK0MKKBaWRPFLFax8bfwjCuIw0YnPzEODoJvDeCUJeDswhG+umVtMJUT +u+LoSxwtkIQr4am/pv53hJl6QvqmlBIkHYkxHdrxC/diVmcatm0dxEPZPzz8fXdE8jA qZU98zbVaQS55KWczM58y15tIe6l7FBXbfUUNvFSqxjV6Y0J4x1TE/BPZgkr/yjDKlFr GqR0CWhm0ciy7TszoUqhgMet/kkixX3VxzMCPCCeU1by1tQDeTgHJmeNPzPr9WZQlhQU cWdQ== X-Gm-Message-State: AOAM532WO27+3Yy2Rf1lX4DfD2nBeCN7YpOVDuEbcHxF59MdqXUYXF64 RV20FMdHy5RQrcFG2/xPysTlrQ== X-Google-Smtp-Source: ABdhPJyoE4QtlNetKdTpBD0mBXP4WeZ4fIV/NQsjOJ7MyXGse2cOOLja6gdF5h7neoQfxkWjQuiN6A== X-Received: by 2002:a17:90a:ea8e:: with SMTP id h14mr956670pjz.105.1597983262635; Thu, 20 Aug 2020 21:14:22 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:1a60:24ff:fe89:3e93]) by smtp.gmail.com with ESMTPSA id 30sm419936pjz.24.2020.08.20.21.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 21:14:22 -0700 (PDT) From: Hsin-Yi Wang To: linux-mediatek@lists.infradead.org Subject: [PATCH] media: mtk-vcodec: set dma max segment size Date: Fri, 21 Aug 2020 12:14:14 +0800 Message-Id: <20200821041414.1560707-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_001427_897409_873924C5 X-CRM114-Status: GOOD ( 13.58 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Tiffany Lin , Alexandre Courbot , Irui Wang , linux-kernel@vger.kernel.org, Anand K Mistry , Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Set dma max segment size for encoder and decoder driver. Fix following warning with CONFIG_DMA_API_DEBUG_SG=y [ 75.147825] ------------[ cut here ]------------ [ 75.147844] mtk-vcodec-enc 19002000.vcodec: DMA-API: mapping sg segment longer than device claims to support [len=983040] [max=65536] [ 75.147876] WARNING: CPU: 2 PID: 4069 at kernel/dma/debug.c:1302 debug_dma_map_sg+0x1a8/0x2c4 ... [ 75.148139] Call trace: [ 75.148149] debug_dma_map_sg+0x1a8/0x2c4 [ 75.148165] vb2_dc_get_userptr+0x228/0x364 [videobuf2_dma_contig] [ 75.148178] __buf_prepare+0x3ac/0x8c0 [videobuf2_common] [ 75.148188] vb2_core_qbuf+0xa4/0x58c [videobuf2_common] [ 75.148199] vb2_qbuf+0x88/0xe4 [videobuf2_v4l2] [ 75.148211] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] [ 75.148221] vidioc_venc_qbuf+0x3c/0x70 [mtk_vcodec_enc] [ 75.148234] v4l_qbuf+0x48/0x58 [ 75.148242] __video_do_ioctl+0x200/0x37c [ 75.148250] video_usercopy+0x360/0x834 [ 75.148259] video_ioctl2+0x38/0x48 [ 75.148267] v4l2_ioctl+0x6c/0x80 [ 75.148276] do_video_ioctl+0xefc/0x4b70 [ 75.148284] v4l2_compat_ioctl32+0x5c/0xcc [ 75.148294] __arm64_compat_sys_ioctl+0xf4/0x240 [ 75.148304] el0_svc_common+0xac/0x198 [ 75.148312] el0_svc_compat_handler+0x2c/0x40 [ 75.148321] el0_svc_compat+0x8/0x18 [ 75.148328] irq event stamp: 0 [ 75.148337] hardirqs last enabled at (0): [<0000000000000000>] (null) [ 75.148347] hardirqs last disabled at (0): [] copy_process+0x380/0x115c [ 75.148356] softirqs last enabled at (0): [] copy_process+0x398/0x115c [ 75.148364] softirqs last disabled at (0): [<0000000000000000>] (null) [ 75.148372] ---[ end trace 588bf529451e3531 ]--- Reported-by: Anand K Mistry Signed-off-by: Hsin-Yi Wang --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 8 ++++++++ drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c index 97a1b6664c20..3bbd0bac56d6 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c @@ -242,6 +242,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_err("[VPU] vpu device in not ready"); return -EPROBE_DEFER; } + if (!pdev->dev.dma_parms) { + pdev->dev.dma_parms = devm_kzalloc(&pdev->dev, + sizeof(*pdev->dev.dma_parms), + GFP_KERNEL); + if (!pdev->dev.dma_parms) + return -ENOMEM; + } + dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); vpu_wdt_reg_handler(dev->vpu_plat_dev, mtk_vcodec_dec_reset_handler, dev, VPU_RST_DEC); diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 4d31f1ed113f..ff4a87485d69 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -249,6 +249,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_err("[VPU] vpu device in not ready"); return -EPROBE_DEFER; } + if (!pdev->dev.dma_parms) { + pdev->dev.dma_parms = devm_kzalloc(&pdev->dev, + sizeof(*pdev->dev.dma_parms), + GFP_KERNEL); + if (!pdev->dev.dma_parms) + return -ENOMEM; + } + dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); vpu_wdt_reg_handler(dev->vpu_plat_dev, mtk_vcodec_enc_reset_handler, dev, VPU_RST_ENC);