Message ID | 20230120201104.606876-1-umang.jain@ideasonboard.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp403901wrn; Fri, 20 Jan 2023 12:11:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzHUfOU8HQZzdflm0lK+QKytsUg8EzLyUXLdaLreUojkub0Di1iw2EsZUJZtuqZiAJ2EcH X-Received: by 2002:aa7:8a52:0:b0:58d:b244:967f with SMTP id n18-20020aa78a52000000b0058db244967fmr16322260pfa.22.1674245513806; Fri, 20 Jan 2023 12:11:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674245513; cv=none; d=google.com; s=arc-20160816; b=GHR1OhHWAF4A/iMPJ8NGPbs7QIes6cjPRQLGUmOhdyWn2mpoJoCX8o6xsx6q0/Tj2o KQySMp7i6Tm60vOVylDz+fEaoKCgZ2KJ+rUPjGk8p2XOHjC85wlQcSCDRkZpALzHK6hq cLU7KlsmMotlQSG+W5ObNkj5KoPqoDz/b9GnexZxseeZcj2unuXBWe8RFPcGjcT572jh P2/JtaXuLqIkX4+BnnB03dGGzl1ZQq0si+nwukJz74gH6gmWfVXqmHOoiqo8tB4se3fI 6Q58nFyN4y+DpW3xEJWwFwv5AWkYdr6FRdrVTyMs/Oj4RtjxxfLhVLA4vCFe5HokKxTZ jjnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=92fSlHlAXqXRfqRTv7Te/jGz/edbnPZP++5KhixkaoA=; b=MvufxcYB4e0TpB5aFYaZ39yLi/8Vz1X8hD8OwMNKGwzPwPRCV8LehDBeI+QBlfuIUI AcSimjJsfi9qkWtYw0i+hb9QpA0gbuq9y2DI7pCQiewRnlWvXm6SvVEWbi40bNt7AIol k0TjUYm/lENKHlZfnmqLycyt3Hwkx0qS1VbZVU4AcnOACg5naP91t27WyyjK5HYvMlOO PUlgKalkYEH7SXyT+9dzQQjBfucMKmzMNt17Vy2iRFFrKWMKbEyrR+AGcjRFjcjgm72v 0m+x15M/Ew5cxn76/oquxMJCJ8LATWTOeeeN95LJUplCo/Kf2TznpM/RKPL9t2hzIhk4 CuiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Hzgs14ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z18-20020aa79e52000000b0058de174b73dsi9484922pfq.187.2023.01.20.12.11.41; Fri, 20 Jan 2023 12:11:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Hzgs14ik; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjATULV (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Fri, 20 Jan 2023 15:11:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjATULU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Jan 2023 15:11:20 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D233B2D01; Fri, 20 Jan 2023 12:11:19 -0800 (PST) Received: from umang.jainideasonboard.com (unknown [103.251.226.6]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89C13514; Fri, 20 Jan 2023 21:11:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1674245476; bh=rV0RzFrPgZZu5H2m9myQYMHozrqwVyb+7LNA1fbwCZY=; h=From:To:Cc:Subject:Date:From; b=Hzgs14ikjisQdQx+Ia/rqr24jn+6b6OjhM9FEmAz+1geSWGMcFlX0MgE9abFe7dhF YOTbmdbATXHDXMA/3CBB50gOWKYkzFaoSiVYhE9IJVKf3FPu8SiBfZ3w1NfwFoqf/n iJPj3FKGX2lRMlbnZuGyMRQN5dTECB59tQNYplFA= From: Umang Jain <umang.jain@ideasonboard.com> To: linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stefan Wahren <stefan.wahren@i2se.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Florian Fainelli <f.fainelli@gmail.com>, Adrien Thierry <athierry@redhat.com>, Dan Carpenter <error27@gmail.com>, Dave Stevenson <dave.stevenson@raspberrypi.com>, Kieran Bingham <kieran.bingham@ideasonboard.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Paul Elder <paul.elder@ideasonboard.com>, Umang Jain <umang.jain@ideasonboard.com> Subject: [PATCH v6 0/6] staging: vc04_services: vchiq: Register devices with a custom bus_type Date: Sat, 21 Jan 2023 01:40:58 +0530 Message-Id: <20230120201104.606876-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755573663873393202?= X-GMAIL-MSGID: =?utf-8?q?1755573663873393202?= |
Series |
staging: vc04_services: vchiq: Register devices with a custom bus_type
|
|
Message
Umang Jain
Jan. 20, 2023, 8:10 p.m. UTC
This series just introduces five extra patches for dropping include directives from Makefiles (suggested by Greg KH) and rebased. The main patch (6/6) removes platform device/driver abuse and moves things to standard device/driver model using a custom_bus. Specific details are elaborated in the commit message. The patch series is based on top of d514392f17fd (tag: next-20230120) of linux-next. Changes in v6: - Split struct device and struct driver wrappers in vchiq_device.[ch] - Move vchiq_bus_type definition to vchiq_device.[ch] as well - return error on bus_register() failure - drop dma_set_mask_and_coherent - trivial variable name change Changes in v5: - Fixup missing "staging: " in commits' subject line - No code changes from v4 Changes in v4: - Introduce patches to drop include directives from Makefile Changes in v3: - Rework entirely to replace platform devices/driver model -v2: https://lore.kernel.org/all/20221222191500.515795-1-umang.jain@ideasonboard.com/ -v1: https://lore.kernel.org/all/20221220084404.19280-1-umang.jain@ideasonboard.com/ Umang Jain (6): staging: vc04_services: Drop __VCCOREVER__ remnants staging: vc04_services: bcm2835-audio: Drop include Makefile directive staging: vc04_services: bcm2835-camera: Drop include Makefile directive staging: vc04_services: vchiq-mmal: Drop include Makefile directive staging: vc04_services: interface: Drop include Makefile directive staging: vc04_services: vchiq: Register devices with a custom bus_type drivers/staging/vc04_services/Makefile | 3 +- .../vc04_services/bcm2835-audio/Makefile | 2 - .../vc04_services/bcm2835-audio/bcm2835.c | 27 +++-- .../vc04_services/bcm2835-audio/bcm2835.h | 3 +- .../vc04_services/bcm2835-camera/Makefile | 5 - .../bcm2835-camera/bcm2835-camera.c | 35 +++--- .../vc04_services/bcm2835-camera/controls.c | 6 +- .../interface/vchiq_arm/vchiq_arm.c | 52 +++++---- .../interface/vchiq_arm/vchiq_core.h | 2 +- .../interface/vchiq_arm/vchiq_device.c | 102 ++++++++++++++++++ .../interface/vchiq_arm/vchiq_device.h | 39 +++++++ .../interface/vchiq_arm/vchiq_ioctl.h | 3 +- .../staging/vc04_services/vchiq-mmal/Makefile | 5 - .../vc04_services/vchiq-mmal/mmal-vchiq.c | 2 +- 14 files changed, 206 insertions(+), 80 deletions(-) create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c create mode 100644 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h
Comments
Hi Umang, Am 20.01.23 um 21:10 schrieb Umang Jain: > This series just introduces five extra patches for dropping include > directives from Makefiles (suggested by Greg KH) and rebased. > > The main patch (6/6) removes platform device/driver abuse and moves > things to standard device/driver model using a custom_bus. Specific > details are elaborated in the commit message. > > The patch series is based on top of d514392f17fd (tag: next-20230120) > of linux-next. applied this series on top of linux-next and build it with arm/multi_v7_defconfig plus the following: CONFIG_BCM_VIDEOCORE=y CONFIG_BCM2835_VCHIQ=m CONFIG_VCHIQ_CDEV=y CONFIG_SND_BCM2835=m CONFIG_VIDEO_BCM2835=m CONFIG_BCM2835_VCHIQ_MMAL=m and the devices doesn't register on Raspberry Pi 3 B Plus: [ 25.523337] vchiq: module is from the staging directory, the quality is unknown, you have been warned. [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835_audio vchiq device [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835-camera vchiq device
Hi Stefan, Thank for the testing. On 1/23/23 5:04 AM, Stefan Wahren wrote: > Hi Umang, > > Am 20.01.23 um 21:10 schrieb Umang Jain: >> This series just introduces five extra patches for dropping include >> directives from Makefiles (suggested by Greg KH) and rebased. >> >> The main patch (6/6) removes platform device/driver abuse and moves >> things to standard device/driver model using a custom_bus. Specific >> details are elaborated in the commit message. >> >> The patch series is based on top of d514392f17fd (tag: next-20230120) >> of linux-next. > > applied this series on top of linux-next and build it with > arm/multi_v7_defconfig plus the following: > > CONFIG_BCM_VIDEOCORE=y > CONFIG_BCM2835_VCHIQ=m > CONFIG_VCHIQ_CDEV=y > CONFIG_SND_BCM2835=m > CONFIG_VIDEO_BCM2835=m > CONFIG_BCM2835_VCHIQ_MMAL=m > > and the devices doesn't register on Raspberry Pi 3 B Plus: > > [ 25.523337] vchiq: module is from the staging directory, the > quality is unknown, you have been warned. > [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register > bcm2835_audio vchiq device > [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register > bcm2835-camera vchiq device I was able to reproduce and it seems the issue here is the change mentioned in the cover - drop dma_set_mask_and_coherent in V6. (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp applied so my branch has the DMA hunk included while I was testing V6) Below is the hunk which should resolve the issue. --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c @@ -6,6 +6,7 @@ */ #include <linux/device/bus.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <linux/string.h> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, const char *name) device->dev.type = &vchiq_device_type; device->dev.release = vchiq_device_release; + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); + if (ret < 0) { + vchiq_device_release(&device->dev); + return ret; + } + ret = device_register(&device->dev); if (ret) { put_device(&device->dev); It seems we need to include the dma_set_mask_and_coherent() even if bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look into why is that/ Laurent, any thoughts on this please?
On Mon, Jan 23, 2023 at 01:18:30PM +0530, Umang Jain wrote: > Hi Stefan, > > Thank for the testing. > > On 1/23/23 5:04 AM, Stefan Wahren wrote: > > Hi Umang, > > > > Am 20.01.23 um 21:10 schrieb Umang Jain: > >> This series just introduces five extra patches for dropping include > >> directives from Makefiles (suggested by Greg KH) and rebased. > >> > >> The main patch (6/6) removes platform device/driver abuse and moves > >> things to standard device/driver model using a custom_bus. Specific > >> details are elaborated in the commit message. > >> > >> The patch series is based on top of d514392f17fd (tag: next-20230120) > >> of linux-next. > > > > applied this series on top of linux-next and build it with > > arm/multi_v7_defconfig plus the following: > > > > CONFIG_BCM_VIDEOCORE=y > > CONFIG_BCM2835_VCHIQ=m > > CONFIG_VCHIQ_CDEV=y > > CONFIG_SND_BCM2835=m > > CONFIG_VIDEO_BCM2835=m > > CONFIG_BCM2835_VCHIQ_MMAL=m > > > > and the devices doesn't register on Raspberry Pi 3 B Plus: > > > > [ 25.523337] vchiq: module is from the staging directory, the quality is unknown, you have been warned. > > [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835_audio vchiq device > > [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835-camera vchiq device > > I was able to reproduce and it seems the issue here is the change > mentioned in the cover > > - drop dma_set_mask_and_coherent > > in V6. > > (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp applied > so my branch has the DMA hunk included while I was testing V6) > > Below is the hunk which should resolve the issue. > > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > @@ -6,6 +6,7 @@ > */ > > #include <linux/device/bus.h> > +#include <linux/dma-mapping.h> > #include <linux/slab.h> > #include <linux/string.h> > > @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, > const char *name) > device->dev.type = &vchiq_device_type; > device->dev.release = vchiq_device_release; > > + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); > + if (ret < 0) { > + vchiq_device_release(&device->dev); > + return ret; > + } > + > ret = device_register(&device->dev); > if (ret) { > put_device(&device->dev); > > It seems we need to include the dma_set_mask_and_coherent() even if > bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look into > why is that/ > > Laurent, any thoughts on this please? Nothing that immediately springs to my mind. Can you investigate ?
Hi Umang, Am 23.01.23 um 08:48 schrieb Umang Jain: > Hi Stefan, > > Thank for the testing. > > On 1/23/23 5:04 AM, Stefan Wahren wrote: >> Hi Umang, >> >> Am 20.01.23 um 21:10 schrieb Umang Jain: >>> This series just introduces five extra patches for dropping include >>> directives from Makefiles (suggested by Greg KH) and rebased. >>> >>> The main patch (6/6) removes platform device/driver abuse and moves >>> things to standard device/driver model using a custom_bus. Specific >>> details are elaborated in the commit message. >>> >>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>> of linux-next. >> >> applied this series on top of linux-next and build it with >> arm/multi_v7_defconfig plus the following: >> >> CONFIG_BCM_VIDEOCORE=y >> CONFIG_BCM2835_VCHIQ=m >> CONFIG_VCHIQ_CDEV=y >> CONFIG_SND_BCM2835=m >> CONFIG_VIDEO_BCM2835=m >> CONFIG_BCM2835_VCHIQ_MMAL=m >> >> and the devices doesn't register on Raspberry Pi 3 B Plus: >> >> [ 25.523337] vchiq: module is from the staging directory, the >> quality is unknown, you have been warned. >> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >> bcm2835_audio vchiq device >> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >> bcm2835-camera vchiq device > > I was able to reproduce and it seems the issue here is the change > mentioned in the cover > > - drop dma_set_mask_and_coherent > > in V6. > > (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp > applied so my branch has the DMA hunk included while I was testing V6) just to avoid misunderstandings, did you read drivers/staging/vc04_services/interface/TESTING ? The Raspberry Pi 4 is currently not fully supported for VCHIQ in mainline. From my limited understanding the DMA controller driver needs 40 bit support, so VCHIQ on BCM2711 can use it. This part is currently only available in the vendor tree. The reason why the driver is unexpectedly probing is a historical issue in the devicetree :-( Raspberry Pi 4 support is not considered as necessary for moving out of staging. > > Below is the hunk which should resolve the issue. > > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > @@ -6,6 +6,7 @@ > */ > > #include <linux/device/bus.h> > +#include <linux/dma-mapping.h> > #include <linux/slab.h> > #include <linux/string.h> > > @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, > const char *name) > device->dev.type = &vchiq_device_type; > device->dev.release = vchiq_device_release; > > + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); > + if (ret < 0) { > + vchiq_device_release(&device->dev); > + return ret; > + } > + > ret = device_register(&device->dev); > if (ret) { > put_device(&device->dev); > > It seems we need to include the dma_set_mask_and_coherent() even if > bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look > into why is that/ > > Laurent, any thoughts on this please?
Hi Stefan On 1/23/23 5:16 PM, Stefan Wahren wrote: > Hi Umang, > > Am 23.01.23 um 08:48 schrieb Umang Jain: >> Hi Stefan, >> >> Thank for the testing. >> >> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>> Hi Umang, >>> >>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>> This series just introduces five extra patches for dropping include >>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>> >>>> The main patch (6/6) removes platform device/driver abuse and moves >>>> things to standard device/driver model using a custom_bus. Specific >>>> details are elaborated in the commit message. >>>> >>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>> of linux-next. >>> >>> applied this series on top of linux-next and build it with >>> arm/multi_v7_defconfig plus the following: >>> >>> CONFIG_BCM_VIDEOCORE=y >>> CONFIG_BCM2835_VCHIQ=m >>> CONFIG_VCHIQ_CDEV=y >>> CONFIG_SND_BCM2835=m >>> CONFIG_VIDEO_BCM2835=m >>> CONFIG_BCM2835_VCHIQ_MMAL=m >>> >>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>> >>> [ 25.523337] vchiq: module is from the staging directory, the >>> quality is unknown, you have been warned. >>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>> bcm2835_audio vchiq device >>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>> bcm2835-camera vchiq device >> >> I was able to reproduce and it seems the issue here is the change >> mentioned in the cover >> >> - drop dma_set_mask_and_coherent >> >> in V6. >> >> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp >> applied so my branch has the DMA hunk included while I was testing V6) > > just to avoid misunderstandings, did you read > drivers/staging/vc04_services/interface/TESTING ? Yes, but it's not geared towards the hardware I have (Rpi Model 4B) > > The Raspberry Pi 4 is currently not fully supported for VCHIQ in > mainline. From my limited understanding the DMA controller driver > needs 40 bit support, so VCHIQ on BCM2711 can use it. This part is > currently only available in the vendor tree. The reason why the driver > is unexpectedly probing is a historical issue in the devicetree :-( > > Raspberry Pi 4 support is not considered as necessary for moving out > of staging. > While I am looking into what's the reason behind the hunk, without which the devices cannot get registered... This is not related to the 40bit support for DMA. I remember that it worked without it during the bcm2835-isp development. Are you implying that I should not use RPi Model 4B for testing ? Because that's the only RPi hardware I own. >> >> Below is the hunk which should resolve the issue. >> >> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> @@ -6,6 +6,7 @@ >> */ >> >> #include <linux/device/bus.h> >> +#include <linux/dma-mapping.h> >> #include <linux/slab.h> >> #include <linux/string.h> >> >> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >> const char *name) >> device->dev.type = &vchiq_device_type; >> device->dev.release = vchiq_device_release; >> >> + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); >> + if (ret < 0) { >> + vchiq_device_release(&device->dev); >> + return ret; >> + } >> + >> ret = device_register(&device->dev); >> if (ret) { >> put_device(&device->dev); >> >> It seems we need to include the dma_set_mask_and_coherent() even if >> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look >> into why is that/ >> >> Laurent, any thoughts on this please?
Hi Umang, Am 23.01.23 um 15:12 schrieb Umang Jain: > Hi Stefan > > On 1/23/23 5:16 PM, Stefan Wahren wrote: >> Hi Umang, >> >> Am 23.01.23 um 08:48 schrieb Umang Jain: >>> Hi Stefan, >>> >>> Thank for the testing. >>> >>> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>>> Hi Umang, >>>> >>>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>>> This series just introduces five extra patches for dropping include >>>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>>> >>>>> The main patch (6/6) removes platform device/driver abuse and moves >>>>> things to standard device/driver model using a custom_bus. Specific >>>>> details are elaborated in the commit message. >>>>> >>>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>>> of linux-next. >>>> >>>> applied this series on top of linux-next and build it with >>>> arm/multi_v7_defconfig plus the following: >>>> >>>> CONFIG_BCM_VIDEOCORE=y >>>> CONFIG_BCM2835_VCHIQ=m >>>> CONFIG_VCHIQ_CDEV=y >>>> CONFIG_SND_BCM2835=m >>>> CONFIG_VIDEO_BCM2835=m >>>> CONFIG_BCM2835_VCHIQ_MMAL=m >>>> >>>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>>> >>>> [ 25.523337] vchiq: module is from the staging directory, the >>>> quality is unknown, you have been warned. >>>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>> bcm2835_audio vchiq device >>>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>> bcm2835-camera vchiq device >>> >>> I was able to reproduce and it seems the issue here is the change >>> mentioned in the cover >>> >>> - drop dma_set_mask_and_coherent >>> >>> in V6. >>> >>> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp >>> applied so my branch has the DMA hunk included while I was testing V6) >> >> just to avoid misunderstandings, did you read >> drivers/staging/vc04_services/interface/TESTING ? > > Yes, but it's not geared towards the hardware I have (Rpi Model 4B) >> >> The Raspberry Pi 4 is currently not fully supported for VCHIQ in >> mainline. From my limited understanding the DMA controller driver >> needs 40 bit support, so VCHIQ on BCM2711 can use it. This part is >> currently only available in the vendor tree. The reason why the >> driver is unexpectedly probing is a historical issue in the >> devicetree :-( >> >> Raspberry Pi 4 support is not considered as necessary for moving out >> of staging. >> > > While I am looking into what's the reason behind the hunk, without > which the devices cannot get registered... This is not related to the > 40bit support for DMA. I remember that it worked without it during the > bcm2835-isp development. > > Are you implying that I should not use RPi Model 4B for testing ? > Because that's the only RPi hardware I own. No, i didn't want to imply this. It's just a warning that's currently not the best platform for testing. But i also understand that nowadays users have a BCM2711 based Raspberry Pi. This leads to another question which device tree do you use for testing, since the mainline one doesn't have the right compatible for BCM2711? >>> >>> Below is the hunk which should resolve the issue. >>> >>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> @@ -6,6 +6,7 @@ >>> */ >>> >>> #include <linux/device/bus.h> >>> +#include <linux/dma-mapping.h> >>> #include <linux/slab.h> >>> #include <linux/string.h> >>> >>> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >>> const char *name) >>> device->dev.type = &vchiq_device_type; >>> device->dev.release = vchiq_device_release; >>> >>> + ret = dma_set_mask_and_coherent(&device->dev, >>> DMA_BIT_MASK(32)); >>> + if (ret < 0) { >>> + vchiq_device_release(&device->dev); >>> + return ret; >>> + } >>> + >>> ret = device_register(&device->dev); >>> if (ret) { >>> put_device(&device->dev); >>> >>> It seems we need to include the dma_set_mask_and_coherent() even if >>> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look >>> into why is that/ >>> >>> Laurent, any thoughts on this please? > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Umang, Am 23.01.23 um 08:48 schrieb Umang Jain: > Hi Stefan, > > Thank for the testing. > > On 1/23/23 5:04 AM, Stefan Wahren wrote: >> Hi Umang, >> >> Am 20.01.23 um 21:10 schrieb Umang Jain: >>> This series just introduces five extra patches for dropping include >>> directives from Makefiles (suggested by Greg KH) and rebased. >>> >>> The main patch (6/6) removes platform device/driver abuse and moves >>> things to standard device/driver model using a custom_bus. Specific >>> details are elaborated in the commit message. >>> >>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>> of linux-next. >> >> applied this series on top of linux-next and build it with >> arm/multi_v7_defconfig plus the following: >> >> CONFIG_BCM_VIDEOCORE=y >> CONFIG_BCM2835_VCHIQ=m >> CONFIG_VCHIQ_CDEV=y >> CONFIG_SND_BCM2835=m >> CONFIG_VIDEO_BCM2835=m >> CONFIG_BCM2835_VCHIQ_MMAL=m >> >> and the devices doesn't register on Raspberry Pi 3 B Plus: >> >> [ 25.523337] vchiq: module is from the staging directory, the >> quality is unknown, you have been warned. >> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >> bcm2835_audio vchiq device >> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >> bcm2835-camera vchiq device > > I was able to reproduce and it seems the issue here is the change > mentioned in the cover > > - drop dma_set_mask_and_coherent > > in V6. > > (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp > applied so my branch has the DMA hunk included while I was testing V6) > > Below is the hunk which should resolve the issue. > > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > @@ -6,6 +6,7 @@ > */ > > #include <linux/device/bus.h> > +#include <linux/dma-mapping.h> > #include <linux/slab.h> > #include <linux/string.h> > > @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, > const char *name) > device->dev.type = &vchiq_device_type; > device->dev.release = vchiq_device_release; > > + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); > + if (ret < 0) { > + vchiq_device_release(&device->dev); > + return ret; > + } > + > ret = device_register(&device->dev); > if (ret) { > put_device(&device->dev); Yes, this patch fixes the errors above. But i noticed that the series also break autoprobing of bcm2835-audio and bcm2835-camera. > > It seems we need to include the dma_set_mask_and_coherent() even if > bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look > into why is that/ > > Laurent, any thoughts on this please? > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Stefan On 1/23/23 10:58 PM, Stefan Wahren wrote: > Hi Umang, > > Am 23.01.23 um 08:48 schrieb Umang Jain: >> Hi Stefan, >> >> Thank for the testing. >> >> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>> Hi Umang, >>> >>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>> This series just introduces five extra patches for dropping include >>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>> >>>> The main patch (6/6) removes platform device/driver abuse and moves >>>> things to standard device/driver model using a custom_bus. Specific >>>> details are elaborated in the commit message. >>>> >>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>> of linux-next. >>> >>> applied this series on top of linux-next and build it with >>> arm/multi_v7_defconfig plus the following: >>> >>> CONFIG_BCM_VIDEOCORE=y >>> CONFIG_BCM2835_VCHIQ=m >>> CONFIG_VCHIQ_CDEV=y >>> CONFIG_SND_BCM2835=m >>> CONFIG_VIDEO_BCM2835=m >>> CONFIG_BCM2835_VCHIQ_MMAL=m >>> >>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>> >>> [ 25.523337] vchiq: module is from the staging directory, the >>> quality is unknown, you have been warned. >>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>> bcm2835_audio vchiq device >>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>> bcm2835-camera vchiq device >> >> I was able to reproduce and it seems the issue here is the change >> mentioned in the cover >> >> - drop dma_set_mask_and_coherent >> >> in V6. >> >> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp >> applied so my branch has the DMA hunk included while I was testing V6) >> >> Below is the hunk which should resolve the issue. >> >> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> @@ -6,6 +6,7 @@ >> */ >> >> #include <linux/device/bus.h> >> +#include <linux/dma-mapping.h> >> #include <linux/slab.h> >> #include <linux/string.h> >> >> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >> const char *name) >> device->dev.type = &vchiq_device_type; >> device->dev.release = vchiq_device_release; >> >> + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); >> + if (ret < 0) { >> + vchiq_device_release(&device->dev); >> + return ret; >> + } >> + >> ret = device_register(&device->dev); >> if (ret) { >> put_device(&device->dev); > Yes, this patch fixes the errors above. But i noticed that the series > also break autoprobing of bcm2835-audio and bcm2835-camera. For the diff concerned, I am still looking into why is this needed. Regarding the autoprobing, I have noticed that as well. It seems the probing is automatic for platform driver/devices and we are moving away from the platform driver/devices. So, this is expected I suppose? Reading from Documentation/driver-api/driver-model/platform.rst """ Driver binding is performed automatically by the driver core, invoking driver probe() after finding a match between device and driver. If the probe() succeeds, the driver and device are bound as usual """ Should we retain this behavior ? >> >> It seems we need to include the dma_set_mask_and_coherent() even if >> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look >> into why is that/ >> >> Laurent, any thoughts on this please? >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Umang, On Tue, Jan 24, 2023 at 11:09:31AM +0530, Umang Jain wrote: > On 1/23/23 10:58 PM, Stefan Wahren wrote: > > Am 23.01.23 um 08:48 schrieb Umang Jain: > >> On 1/23/23 5:04 AM, Stefan Wahren wrote: > >>> Am 20.01.23 um 21:10 schrieb Umang Jain: > >>>> This series just introduces five extra patches for dropping include > >>>> directives from Makefiles (suggested by Greg KH) and rebased. > >>>> > >>>> The main patch (6/6) removes platform device/driver abuse and moves > >>>> things to standard device/driver model using a custom_bus. Specific > >>>> details are elaborated in the commit message. > >>>> > >>>> The patch series is based on top of d514392f17fd (tag: next-20230120) > >>>> of linux-next. > >>> > >>> applied this series on top of linux-next and build it with > >>> arm/multi_v7_defconfig plus the following: > >>> > >>> CONFIG_BCM_VIDEOCORE=y > >>> CONFIG_BCM2835_VCHIQ=m > >>> CONFIG_VCHIQ_CDEV=y > >>> CONFIG_SND_BCM2835=m > >>> CONFIG_VIDEO_BCM2835=m > >>> CONFIG_BCM2835_VCHIQ_MMAL=m > >>> > >>> and the devices doesn't register on Raspberry Pi 3 B Plus: > >>> > >>> [ 25.523337] vchiq: module is from the staging directory, the > >>> quality is unknown, you have been warned. > >>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register > >>> bcm2835_audio vchiq device > >>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register > >>> bcm2835-camera vchiq device > >> > >> I was able to reproduce and it seems the issue here is the change > >> mentioned in the cover > >> > >> - drop dma_set_mask_and_coherent > >> > >> in V6. > >> > >> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp > >> applied so my branch has the DMA hunk included while I was testing V6) > >> > >> Below is the hunk which should resolve the issue. > >> > >> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > >> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c > >> @@ -6,6 +6,7 @@ > >> */ > >> > >> #include <linux/device/bus.h> > >> +#include <linux/dma-mapping.h> > >> #include <linux/slab.h> > >> #include <linux/string.h> > >> > >> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, > >> const char *name) > >> device->dev.type = &vchiq_device_type; > >> device->dev.release = vchiq_device_release; > >> > >> + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); > >> + if (ret < 0) { > >> + vchiq_device_release(&device->dev); > >> + return ret; > >> + } > >> + > >> ret = device_register(&device->dev); > >> if (ret) { > >> put_device(&device->dev); > > > > Yes, this patch fixes the errors above. But i noticed that the series > > also break autoprobing of bcm2835-audio and bcm2835-camera. > > For the diff concerned, I am still looking into why is this needed. > > Regarding the autoprobing, I have noticed that as well. It seems the > probing is automatic for platform driver/devices and we are moving away > from the platform driver/devices. So, this is expected I suppose? > > Reading from Documentation/driver-api/driver-model/platform.rst > > """ > Driver binding is performed automatically by the driver core, invoking > driver probe() after finding a match between device and driver. If the > probe() succeeds, the driver and device are bound as usual > """ > > Should we retain this behavior ? Why shouldn't we ? :-) > >> It seems we need to include the dma_set_mask_and_coherent() even if > >> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look > >> into why is that/ > >> > >> Laurent, any thoughts on this please?
Hi Umang, Am 24.01.23 um 06:39 schrieb Umang Jain: > Hi Stefan > > On 1/23/23 10:58 PM, Stefan Wahren wrote: >> Hi Umang, >> >> Am 23.01.23 um 08:48 schrieb Umang Jain: >>> Hi Stefan, >>> >>> Thank for the testing. >>> >>> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>>> Hi Umang, >>>> >>>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>>> This series just introduces five extra patches for dropping include >>>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>>> >>>>> The main patch (6/6) removes platform device/driver abuse and moves >>>>> things to standard device/driver model using a custom_bus. Specific >>>>> details are elaborated in the commit message. >>>>> >>>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>>> of linux-next. >>>> >>>> applied this series on top of linux-next and build it with >>>> arm/multi_v7_defconfig plus the following: >>>> >>>> CONFIG_BCM_VIDEOCORE=y >>>> CONFIG_BCM2835_VCHIQ=m >>>> CONFIG_VCHIQ_CDEV=y >>>> CONFIG_SND_BCM2835=m >>>> CONFIG_VIDEO_BCM2835=m >>>> CONFIG_BCM2835_VCHIQ_MMAL=m >>>> >>>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>>> >>>> [ 25.523337] vchiq: module is from the staging directory, the >>>> quality is unknown, you have been warned. >>>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>> bcm2835_audio vchiq device >>>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>> bcm2835-camera vchiq device >>> >>> I was able to reproduce and it seems the issue here is the change >>> mentioned in the cover >>> >>> - drop dma_set_mask_and_coherent >>> >>> in V6. >>> >>> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp >>> applied so my branch has the DMA hunk included while I was testing V6) >>> >>> Below is the hunk which should resolve the issue. >>> >>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> @@ -6,6 +6,7 @@ >>> */ >>> >>> #include <linux/device/bus.h> >>> +#include <linux/dma-mapping.h> >>> #include <linux/slab.h> >>> #include <linux/string.h> >>> >>> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >>> const char *name) >>> device->dev.type = &vchiq_device_type; >>> device->dev.release = vchiq_device_release; >>> >>> + ret = dma_set_mask_and_coherent(&device->dev, >>> DMA_BIT_MASK(32)); >>> + if (ret < 0) { >>> + vchiq_device_release(&device->dev); >>> + return ret; >>> + } >>> + >>> ret = device_register(&device->dev); >>> if (ret) { >>> put_device(&device->dev); >> Yes, this patch fixes the errors above. But i noticed that the series >> also break autoprobing of bcm2835-audio and bcm2835-camera. > > For the diff concerned, I am still looking into why is this needed. > > Regarding the autoprobing, I have noticed that as well. It seems the > probing is automatic for platform driver/devices and we are moving > away from the platform driver/devices. So, this is expected I suppose? > > Reading from Documentation/driver-api/driver-model/platform.rst > > """ > Driver binding is performed automatically by the driver core, invoking > driver probe() after finding a match between device and driver. If the > probe() succeeds, the driver and device are bound as usual > """ > > Should we retain this behavior ? From user perspective this behavior change is a regression. So we need automatic probing to convince user to use the mainline kernel. >>> >>> It seems we need to include the dma_set_mask_and_coherent() even if >>> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look >>> into why is that/ >>> >>> Laurent, any thoughts on this please? >>> >>> _______________________________________________ >>> linux-arm-kernel mailing list >>> linux-arm-kernel@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >
Hi Phil, Am 23.01.23 um 09:58 schrieb Laurent Pinchart: > On Mon, Jan 23, 2023 at 01:18:30PM +0530, Umang Jain wrote: >> Hi Stefan, >> >> Thank for the testing. >> >> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>> Hi Umang, >>> >>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>> This series just introduces five extra patches for dropping include >>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>> >>>> The main patch (6/6) removes platform device/driver abuse and moves >>>> things to standard device/driver model using a custom_bus. Specific >>>> details are elaborated in the commit message. >>>> >>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>> of linux-next. >>> applied this series on top of linux-next and build it with >>> arm/multi_v7_defconfig plus the following: >>> >>> CONFIG_BCM_VIDEOCORE=y >>> CONFIG_BCM2835_VCHIQ=m >>> CONFIG_VCHIQ_CDEV=y >>> CONFIG_SND_BCM2835=m >>> CONFIG_VIDEO_BCM2835=m >>> CONFIG_BCM2835_VCHIQ_MMAL=m >>> >>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>> >>> [ 25.523337] vchiq: module is from the staging directory, the quality is unknown, you have been warned. >>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835_audio vchiq device >>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835-camera vchiq device >> I was able to reproduce and it seems the issue here is the change >> mentioned in the cover >> >> - drop dma_set_mask_and_coherent >> >> in V6. >> >> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp applied >> so my branch has the DMA hunk included while I was testing V6) >> >> Below is the hunk which should resolve the issue. >> >> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >> @@ -6,6 +6,7 @@ >> */ >> >> #include <linux/device/bus.h> >> +#include <linux/dma-mapping.h> >> #include <linux/slab.h> >> #include <linux/string.h> >> >> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >> const char *name) >> device->dev.type = &vchiq_device_type; >> device->dev.release = vchiq_device_release; >> >> + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); >> + if (ret < 0) { >> + vchiq_device_release(&device->dev); >> + return ret; >> + } >> + >> ret = device_register(&device->dev); >> if (ret) { >> put_device(&device->dev); >> >> It seems we need to include the dma_set_mask_and_coherent() even if >> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look into >> why is that/ Do you have an answer for this? Thanks >> >> Laurent, any thoughts on this please? > Nothing that immediately springs to my mind. Can you investigate ? >
On 24/01/2023 8:41, Stefan Wahren wrote: > Hi Phil, > > Am 23.01.23 um 09:58 schrieb Laurent Pinchart: >> On Mon, Jan 23, 2023 at 01:18:30PM +0530, Umang Jain wrote: >>> Hi Stefan, >>> >>> Thank for the testing. >>> >>> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>>> Hi Umang, >>>> >>>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>>> This series just introduces five extra patches for dropping include >>>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>>> >>>>> The main patch (6/6) removes platform device/driver abuse and moves >>>>> things to standard device/driver model using a custom_bus. Specific >>>>> details are elaborated in the commit message. >>>>> >>>>> The patch series is based on top of d514392f17fd (tag: next-20230120) >>>>> of linux-next. >>>> applied this series on top of linux-next and build it with >>>> arm/multi_v7_defconfig plus the following: >>>> >>>> CONFIG_BCM_VIDEOCORE=y >>>> CONFIG_BCM2835_VCHIQ=m >>>> CONFIG_VCHIQ_CDEV=y >>>> CONFIG_SND_BCM2835=m >>>> CONFIG_VIDEO_BCM2835=m >>>> CONFIG_BCM2835_VCHIQ_MMAL=m >>>> >>>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>>> >>>> [ 25.523337] vchiq: module is from the staging directory, the quality is unknown, you have been warned. >>>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835_audio vchiq device >>>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register bcm2835-camera vchiq device >>> I was able to reproduce and it seems the issue here is the change >>> mentioned in the cover >>> >>> - drop dma_set_mask_and_coherent >>> >>> in V6. >>> >>> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp applied >>> so my branch has the DMA hunk included while I was testing V6) >>> >>> Below is the hunk which should resolve the issue. >>> >>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>> @@ -6,6 +6,7 @@ >>> */ >>> >>> #include <linux/device/bus.h> >>> +#include <linux/dma-mapping.h> >>> #include <linux/slab.h> >>> #include <linux/string.h> >>> >>> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >>> const char *name) >>> device->dev.type = &vchiq_device_type; >>> device->dev.release = vchiq_device_release; >>> >>> + ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32)); >>> + if (ret < 0) { >>> + vchiq_device_release(&device->dev); >>> + return ret; >>> + } >>> + >>> ret = device_register(&device->dev); >>> if (ret) { >>> put_device(&device->dev); >>> >>> It seems we need to include the dma_set_mask_and_coherent() even if >>> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look into >>> why is that/ > > Do you have an answer for this? That's because vchiq does use DMA for bulk transfers, it's just that the DMA hardware is driven from the VPU side. And even though the VPU can only address 1GB, it uses the upper address bits to determine cacheability of accesses, hence the need for 32-bit DMA addresses. Phil
Hi Phil, Thank you for the response On 1/25/23 1:17 AM, Phil Elwell wrote: > On 24/01/2023 8:41, Stefan Wahren wrote: >> Hi Phil, >> >> Am 23.01.23 um 09:58 schrieb Laurent Pinchart: >>> On Mon, Jan 23, 2023 at 01:18:30PM +0530, Umang Jain wrote: >>>> Hi Stefan, >>>> >>>> Thank for the testing. >>>> >>>> On 1/23/23 5:04 AM, Stefan Wahren wrote: >>>>> Hi Umang, >>>>> >>>>> Am 20.01.23 um 21:10 schrieb Umang Jain: >>>>>> This series just introduces five extra patches for dropping include >>>>>> directives from Makefiles (suggested by Greg KH) and rebased. >>>>>> >>>>>> The main patch (6/6) removes platform device/driver abuse and moves >>>>>> things to standard device/driver model using a custom_bus. Specific >>>>>> details are elaborated in the commit message. >>>>>> >>>>>> The patch series is based on top of d514392f17fd (tag: >>>>>> next-20230120) >>>>>> of linux-next. >>>>> applied this series on top of linux-next and build it with >>>>> arm/multi_v7_defconfig plus the following: >>>>> >>>>> CONFIG_BCM_VIDEOCORE=y >>>>> CONFIG_BCM2835_VCHIQ=m >>>>> CONFIG_VCHIQ_CDEV=y >>>>> CONFIG_SND_BCM2835=m >>>>> CONFIG_VIDEO_BCM2835=m >>>>> CONFIG_BCM2835_VCHIQ_MMAL=m >>>>> >>>>> and the devices doesn't register on Raspberry Pi 3 B Plus: >>>>> >>>>> [ 25.523337] vchiq: module is from the staging directory, the >>>>> quality is unknown, you have been warned. >>>>> [ 25.541647] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>>> bcm2835_audio vchiq device >>>>> [ 25.553692] bcm2835_vchiq 3f00b840.mailbox: Failed to register >>>>> bcm2835-camera vchiq device >>>> I was able to reproduce and it seems the issue here is the change >>>> mentioned in the cover >>>> >>>> - drop dma_set_mask_and_coherent >>>> >>>> in V6. >>>> >>>> (I usually test patches on RPi 4B with vcsm-cma and bcm2835-isp >>>> applied >>>> so my branch has the DMA hunk included while I was testing V6) >>>> >>>> Below is the hunk which should resolve the issue. >>>> >>>> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c >>>> @@ -6,6 +6,7 @@ >>>> */ >>>> >>>> #include <linux/device/bus.h> >>>> +#include <linux/dma-mapping.h> >>>> #include <linux/slab.h> >>>> #include <linux/string.h> >>>> >>>> @@ -72,6 +73,12 @@ int vchiq_device_register(struct device *parent, >>>> const char *name) >>>> device->dev.type = &vchiq_device_type; >>>> device->dev.release = vchiq_device_release; >>>> >>>> + ret = dma_set_mask_and_coherent(&device->dev, >>>> DMA_BIT_MASK(32)); >>>> + if (ret < 0) { >>>> + vchiq_device_release(&device->dev); >>>> + return ret; >>>> + } >>>> + >>>> ret = device_register(&device->dev); >>>> if (ret) { >>>> put_device(&device->dev); >>>> >>>> It seems we need to include the dma_set_mask_and_coherent() even if >>>> bcm2835-audio, bcm2835-camera device doesn't do DMA? I need to look >>>> into >>>> why is that/ >> >> Do you have an answer for this? > > That's because vchiq does use DMA for bulk transfers, it's just that > the DMA hardware > is driven from the VPU side. And even though the VPU can only address > 1GB, it uses the > upper address bits to determine cacheability of accesses, hence the > need for 32-bit > DMA addresses. Is it worth recording this as a comment in the patch? > > Phil >