From patchwork Thu Oct 27 11:28:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9399581 X-Patchwork-Delegate: geert@linux-m68k.org 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 10FD960233 for ; Thu, 27 Oct 2016 14:43:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF7F42A0D7 for ; Thu, 27 Oct 2016 14:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E483C2A304; Thu, 27 Oct 2016 14:43:21 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 CD8D92A311 for ; Thu, 27 Oct 2016 14:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936325AbcJ0Oma (ORCPT ); Thu, 27 Oct 2016 10:42:30 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34457 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966105AbcJ0Om2 (ORCPT ); Thu, 27 Oct 2016 10:42:28 -0400 Received: by mail-pf0-f179.google.com with SMTP id n85so19073874pfi.1; Thu, 27 Oct 2016 07:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=a2WbSH3f/+u8aoduLmMsg9pXhHxxJEqYVFT7QkqEspM=; b=mc6UyqLEN5FgZgDe+VBLceQk90u+CB3My91VM1ZqNZ6ciYLZN/lqF1OAgU4IS1rLr2 +VNCoFCR3wBf0TT/nCpAU4kkLYjPZvylXSEjEvEknrY4ALisTPL71FdQPPv9f7IdpAca 6i9ayXkV0VZZfFifOfotr76kTf+3m+XEyK8EhrOTv29uvWvMf32nsE7ZG+m5N7hYu4Ax xaWLL+sCZyLoMMg4HPLnhy0RqqOhRMBfCiUTlUQfC9Ii3TZWbAfXkrxF5H+OMdDE71M3 KQYsC8JQHhzcqUWHeCNxgMeVB5TPxmPHHOkZZOXosz3jq5iEjqS6kX6QVwyNpBoLHXWp GcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:subject; bh=a2WbSH3f/+u8aoduLmMsg9pXhHxxJEqYVFT7QkqEspM=; b=UVudKm1CR5c9g79WSoe/Rf2P2MMhy9ATDNNl3SQuXiYS6CH+0fy4EwgLbmAoxlmmqn 5t9U1EZLegW46CbUqx4vDEmY0nRJr38fGuYGHCzfMEV3CH0nF3Jqrf7HCAeGMiapfN9Y l2C25SrCZLTULPFlIPghZg/wbyAl3Bd+cngWjw8GAQ7dfbYuQ+pj8PuVu4vgPKUwSUTj y2lf3wxMw6YE63eGVO/4PeFxiuq1v+driH0YlMF0D8Qmb+isM+FGU0bLC0vmrN4D94fN iOhr/KhY6NELRthZGSZTBjtWQiGlBe1OO259htGZ4VCP8v5wa3PwJYJgr4MTdzwpNKAU oP/g== X-Gm-Message-State: ABUngveDiaFhoMGE0lT2ebpOou51H086Q+CkJx8koEf/IFMt78C6CPJDe4qVxNwOaTdp2A== X-Received: by 10.98.76.7 with SMTP id z7mr13457887pfa.143.1477568182051; Thu, 27 Oct 2016 04:36:22 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id p3sm11182797pfg.48.2016.10.27.04.36.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 04:36:20 -0700 (PDT) From: Magnus Damm To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Magnus Damm , laurent.pinchart+renesas@ideasonboard.com, mchehab@osg.samsung.com Date: Thu, 27 Oct 2016 20:28:36 +0900 Message-Id: <20161027112836.11613.13334.sendpatchset@little-apple> Subject: [PATCH/RFC] v4l: vsp1: Use FCP device for DisplayList and VB2 queue Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Incrementally fix up parts of the code not yet covered by the IOMMU patches by Laurent: [PATCH 0/6] R-Car DU: Fix IOMMU operation when connected to VSP This patch simply uses the recently introduced function rcar_fcp_get_device() on the VSP device to retrieve the FCP device that needs to be used with the DMA MAP API when IOMMU is enabled. Without this patch the DU/VSP/FCP devices on R-Car Gen3 will generate traps during boot when IOMMU is enabled. Signed-off-by: Magnus Damm --- drivers/media/platform/vsp1/vsp1_dl.c | 13 +++++++++---- drivers/media/platform/vsp1/vsp1_video.c | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) --- 0001/drivers/media/platform/vsp1/vsp1_dl.c +++ work/drivers/media/platform/vsp1/vsp1_dl.c 2016-09-01 06:18:17.140607110 +0900 @@ -17,6 +17,8 @@ #include #include +#include + #include "vsp1.h" #include "vsp1_dl.h" @@ -130,12 +132,12 @@ static int vsp1_dl_body_init(struct vsp1 size_t extra_size) { size_t size = num_entries * sizeof(*dlb->entries) + extra_size; + struct device *fcp = rcar_fcp_get_device(vsp1->fcp); dlb->vsp1 = vsp1; dlb->size = size; - - dlb->entries = dma_alloc_wc(vsp1->dev, dlb->size, &dlb->dma, - GFP_KERNEL); + dlb->entries = dma_alloc_wc(fcp ? fcp : vsp1->dev, + dlb->size, &dlb->dma, GFP_KERNEL); if (!dlb->entries) return -ENOMEM; @@ -147,7 +149,10 @@ static int vsp1_dl_body_init(struct vsp1 */ static void vsp1_dl_body_cleanup(struct vsp1_dl_body *dlb) { - dma_free_wc(dlb->vsp1->dev, dlb->size, dlb->entries, dlb->dma); + struct device *fcp = rcar_fcp_get_device(dlb->vsp1->fcp); + + dma_free_wc(fcp ? fcp : dlb->vsp1->dev, + dlb->size, dlb->entries, dlb->dma); } /** --- 0001/drivers/media/platform/vsp1/vsp1_video.c +++ work/drivers/media/platform/vsp1/vsp1_video.c 2016-09-01 06:20:02.940607110 +0900 @@ -27,6 +27,8 @@ #include #include +#include + #include "vsp1.h" #include "vsp1_bru.h" #include "vsp1_dl.h" @@ -939,6 +941,7 @@ struct vsp1_video *vsp1_video_create(str { struct vsp1_video *video; const char *direction; + struct device *fcp; int ret; video = devm_kzalloc(vsp1->dev, sizeof(*video), GFP_KERNEL); @@ -996,7 +999,8 @@ struct vsp1_video *vsp1_video_create(str video->queue.ops = &vsp1_video_queue_qops; video->queue.mem_ops = &vb2_dma_contig_memops; video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; - video->queue.dev = video->vsp1->dev; + fcp = rcar_fcp_get_device(vsp1->fcp); + video->queue.dev = fcp ? fcp : video->vsp1->dev; ret = vb2_queue_init(&video->queue); if (ret < 0) { dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n");