public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Umang Jain <umang.jain@ideasonboard.com>,
	Stefan Wahren <wahrenst@gmx.net>
Cc: gregkh@linuxfoundation.org, f.fainelli@gmail.com,
	athierry@redhat.com, error27@gmail.com,
	kieran.bingham@ideasonboard.com,
	laurent.pinchart@ideasonboard.com,
	dave.stevenson@raspberrypi.com, linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v10 1/5] staging: vc04_services: vchiq_arm: Add new bus type and device type
Date: Wed, 13 Sep 2023 13:08:14 +0100	[thread overview]
Message-ID: <cd242cf0-a7ae-d980-899e-b89e0cb2d1aa@arm.com> (raw)
In-Reply-To: <d006e31a-33df-51b1-c8cf-9c7e5590adb6@ideasonboard.com>

On 2023-09-12 06:50, Umang Jain wrote:
[...]
>>> +struct vchiq_device *
>>> +vchiq_device_register(struct device *parent, const char *name)
>>> +{
>>> +    struct vchiq_device *device;
>>> +    int ret;
>>> +
>>> +    device = kzalloc(sizeof(*device), GFP_KERNEL);
>>> +    if (!device) {
>>> +        dev_err(parent, "Cannot register %s: Insufficient memory\n",
>>> +            name);
>>> +        return NULL;
>>> +    }
>>> +
>>> +    device->dev.init_name = name;
>>> +    device->dev.parent = parent;
>>> +    device->dev.bus = &vchiq_bus_type;
>>> +    device->dev.release = vchiq_device_release;
>>> +
>>> +    of_dma_configure(&device->dev, parent->of_node, true);
>>> +    ret = dma_set_mask_and_coherent(&device->dev, DMA_BIT_MASK(32));
>>> +    if (ret) {
>>> +        dev_err(&device->dev, "32-bit DMA enable failed\n");
>>> +        return NULL;
>>> +    }
>>
>> Unfortunately the call of of_dma_configure() generates warnings likes
>> this (Raspberry Pi 3A+ with multi_v7_defconfig + VCHIQ):
>>
>> [    9.206802] vchiq-bus bcm2835-audio: DMA mask not set
>> [    9.206892] vchiq-bus bcm2835-camera: DMA mask not set
> 
> huh, really weird, as on my RPi-3-b I get these set correctly and I 
> don't any such warning.

Can you point to the code above where device->dev.dma_mask gets 
initialised between the initial kzalloc() and the call to 
of_dma_configure()? ;)

BTW, bus code shouldn't be calling dma_set_mask_and_coherent() on behalf 
of its children, that is for the individual drivers to do, if and when 
they intend to actually use DMA. Removing that here will save you 
needing to fix the memory leak as well...

Thanks,
Robin.

  parent reply	other threads:[~2023-09-13 12:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 14:07 [PATCH v10 0/5] staging: vc04_services: vchiq: Register devices with a custom bus_type Umang Jain
2023-09-11 14:07 ` [PATCH v10 1/5] staging: vc04_services: vchiq_arm: Add new bus type and device type Umang Jain
2023-09-11 20:22   ` Stefan Wahren
2023-09-12  5:50     ` Umang Jain
2023-09-12  7:23       ` Stefan Wahren
2023-09-13 11:31         ` Stefan Wahren
2023-09-13 12:08       ` Robin Murphy [this message]
2023-09-13 19:29         ` Umang Jain
2023-09-11 14:07 ` [PATCH v10 2/5] staging: vc04_services: vchiq_arm: Register vchiq_bus_type Umang Jain
2023-09-11 14:07 ` [PATCH v10 3/5] staging: bcm2835-camera: Register bcm2835-camera with vchiq_bus_type Umang Jain
2023-09-11 14:07 ` [PATCH v10 4/5] staging: bcm2835-audio: Register bcm2835-audio " Umang Jain
2023-09-11 14:07 ` [PATCH v10 5/5] staging: vc04_services: vchiq_arm: Remove vchiq_register_child() Umang Jain

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=cd242cf0-a7ae-d980-899e-b89e0cb2d1aa@arm.com \
    --to=robin.murphy@arm.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=umang.jain@ideasonboard.com \
    --cc=wahrenst@gmx.net \
    /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