public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Phil Elwell <phil@raspberrypi.com>
To: Stefan Wahren <stefan.wahren@i2se.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Umang Jain <umang.jain@ideasonboard.com>
Cc: 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,
	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>,
	Paul Elder <paul.elder@ideasonboard.com>
Subject: Re: [PATCH v6 0/6] staging: vc04_services: vchiq: Register devices with a custom bus_type
Date: Tue, 24 Jan 2023 19:47:23 +0000	[thread overview]
Message-ID: <2ad50d65-9ce2-de4c-b14f-98c086b2d8c0@raspberrypi.com> (raw)
In-Reply-To: <39f438f8-c41b-17e6-42ba-9d87098a1eee@i2se.com>

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


  reply	other threads:[~2023-01-24 19:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 20:10 [PATCH v6 0/6] staging: vc04_services: vchiq: Register devices with a custom bus_type Umang Jain
2023-01-20 20:10 ` [PATCH v6 1/6] staging: vc04_services: Drop __VCCOREVER__ remnants Umang Jain
2023-01-20 20:11 ` [PATCH v6 2/6] staging: vc04_services: bcm2835-audio: Drop include Makefile directive Umang Jain
2023-01-20 20:11 ` [PATCH v6 3/6] staging: vc04_services: bcm2835-camera: " Umang Jain
2023-01-20 20:11 ` [PATCH v6 4/6] staging: vc04_services: vchiq-mmal: " Umang Jain
2023-01-20 20:11 ` [PATCH v6 5/6] staging: vc04_services: interface: " Umang Jain
2023-01-20 20:11 ` [PATCH v6 6/6] staging: vc04_services: vchiq: Register devices with a custom bus_type Umang Jain
2023-01-22 23:50   ` Stefan Wahren
2023-01-23 18:11   ` Greg Kroah-Hartman
2023-01-23 18:22     ` Laurent Pinchart
2023-01-22 23:34 ` [PATCH v6 0/6] " Stefan Wahren
2023-01-23  7:48   ` Umang Jain
2023-01-23  8:58     ` Laurent Pinchart
2023-01-24  8:41       ` Stefan Wahren
2023-01-24 19:47         ` Phil Elwell [this message]
2023-01-26 13:33           ` Umang Jain
2023-01-23 11:46     ` Stefan Wahren
2023-01-23 14:12       ` Umang Jain
2023-01-23 15:28         ` Stefan Wahren
2023-01-23 17:28     ` Stefan Wahren
2023-01-24  5:39       ` Umang Jain
2023-01-24  8:26         ` Laurent Pinchart
2023-01-24  8:39         ` Stefan Wahren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ad50d65-9ce2-de4c-b14f-98c086b2d8c0@raspberrypi.com \
    --to=phil@raspberrypi.com \
    --cc=athierry@redhat.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=error27@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=paul.elder@ideasonboard.com \
    --cc=stefan.wahren@i2se.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox