mbox series

[v10,0/5] staging: vc04_services: vchiq: Register devices with a custom bus_type

Message ID 20230911140712.180751-1-umang.jain@ideasonboard.com (mailing list archive)
Headers show
Series staging: vc04_services: vchiq: Register devices with a custom bus_type | expand

Message

Umang Jain Sept. 11, 2023, 2:07 p.m. UTC
The patch series added a new bus type vchiq_bus_type and registers
child devices in order to move them away from using platform
device/driver.

Tested on RPi-3-b with media tree master branch.

Patch 1/5 and 2/5 adds a new bus_type and registers them to vchiq
interface

Patch 3/5 and 4/5 moves the bcm2835-camera and bcm2835-audio
to the new bus respectively

Patch 5/5 removes a platform registeration helper which is no
longer required.

Changes in v10:
- fix dma_attr WARN issue with bcm2835-audio module loading
- Unregister bus on parent platform device fails to register
- Reword commit to highlight bcm2835_audio to bcm2835-audio name change

Changes in v9:
- Fix module autoloading
- Implement bus_type's probe() callback to load drivers
- Implement bus_type's uevent() to make sure appropriate drivers are
  loaded when device are registed from vchiq.

Changes in v8:
- Drop dual licensing. Instead use GPL-2.0 only for patch 1/5

Changes in v7:
(5 out of 6 patches from v6 merged)
- Split the main patch (6/6) as requested.
- Use struct vchiq_device * instead of struct device * in
  all bus functions.
- Drop additional name attribute displayed in sysfs (redundant info)
- Document vchiq_interface doesn't enumerate device discovery
- remove EXPORT_SYMBOL_GPL(vchiq_bus_type)

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 (5):
  staging: vc04_services: vchiq_arm: Add new bus type and device type
  staging: vc04_services: vchiq_arm: Register vchiq_bus_type
  staging: bcm2835-camera: Register bcm2835-camera with vchiq_bus_type
  staging: bcm2835-audio: Register bcm2835-audio with vchiq_bus_type
  staging: vc04_services: vchiq_arm: Remove vchiq_register_child()

 drivers/staging/vc04_services/Makefile        |   1 +
 .../vc04_services/bcm2835-audio/bcm2835.c     |  20 ++--
 .../bcm2835-camera/bcm2835-camera.c           |  17 +--
 .../interface/vchiq_arm/vchiq_arm.c           |  52 ++++----
 .../interface/vchiq_arm/vchiq_device.c        | 111 ++++++++++++++++++
 .../interface/vchiq_arm/vchiq_device.h        |  54 +++++++++
 6 files changed, 208 insertions(+), 47 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


base-commit: 9a5d660fdb25d20748d7f9e9559c86073c3bb368

Comments

Stefan Wahren Sept. 11, 2023, 8:22 p.m. UTC | #1
Hi Umang,

Am 11.09.23 um 16:07 schrieb Umang Jain:
> The devices that the vchiq interface registers (bcm2835-audio,
> bcm2835-camera) are implemented and exposed by the VC04 firmware.
> The device tree describes the VC04 itself with the resources required
> to communicate with it through a mailbox interface. However, the
> vchiq interface registers these devices as platform devices. This
> also means the specific drivers for these devices are getting
> registered as platform drivers. This is not correct and a blatant
> abuse of platform device/driver.
>
> Add a new bus type, vchiq_bus_type and device type (struct vchiq_device)
> which will be used to migrate child devices that the vchiq interfaces
> creates/registers from the platform device/driver.
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   drivers/staging/vc04_services/Makefile        |   1 +
>   .../interface/vchiq_arm/vchiq_device.c        | 111 ++++++++++++++++++
>   .../interface/vchiq_arm/vchiq_device.h        |  54 +++++++++
>   3 files changed, 166 insertions(+)
>   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
>
> diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile
> index 44794bdf6173..2d071e55e175 100644
> --- a/drivers/staging/vc04_services/Makefile
> +++ b/drivers/staging/vc04_services/Makefile
> @@ -5,6 +5,7 @@ vchiq-objs := \
>      interface/vchiq_arm/vchiq_core.o  \
>      interface/vchiq_arm/vchiq_arm.o \
>      interface/vchiq_arm/vchiq_debugfs.o \
> +   interface/vchiq_arm/vchiq_device.o \
>      interface/vchiq_arm/vchiq_connected.o \
>
>   ifdef CONFIG_VCHIQ_CDEV
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
> new file mode 100644
> index 000000000000..aad55c461905
> --- /dev/null
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
> @@ -0,0 +1,111 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * vchiq_device.c - VCHIQ generic device and bus-type
> + *
> + * Copyright (c) 2023 Ideas On Board Oy
> + */
> +
> +#include <linux/device/bus.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/of_device.h>
> +#include <linux/slab.h>
> +#include <linux/string.h>
> +
> +#include "vchiq_device.h"
> +
> +static int vchiq_bus_type_match(struct device *dev, struct device_driver *drv)
> +{
> +	if (dev->bus == &vchiq_bus_type &&
> +	    strcmp(dev_name(dev), drv->name) == 0)
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static int vchiq_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
> +{
> +	const struct vchiq_device *device = container_of_const(dev, struct vchiq_device, dev);
> +
> +	return add_uevent_var(env, "MODALIAS=%s", dev_name(&device->dev));
> +}
> +
> +static int vchiq_bus_probe(struct device *dev)
> +{
> +	struct vchiq_device *device = to_vchiq_device(dev);
> +	struct vchiq_driver *driver = to_vchiq_driver(dev->driver);
> +	int ret;
> +
> +	ret = driver->probe(device);
> +	if (ret == 0)
> +		return 0;
> +
> +	return ret;
> +}
> +
> +struct bus_type vchiq_bus_type = {
> +	.name   = "vchiq-bus",
> +	.match  = vchiq_bus_type_match,
> +	.uevent = vchiq_bus_uevent,
> +	.probe  = vchiq_bus_probe,
> +};
> +
> +static void vchiq_device_release(struct device *dev)
> +{
> +	struct vchiq_device *device = to_vchiq_device(dev);
> +
> +	kfree(device);
> +}
> +
> +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

In the old platform driver code we had something like

   pdevinfo.dma_mask = DMA_BIT_MASK(32);

So there is still something missing for our new bus driver.

> +
> +	ret = device_register(&device->dev);
> +	if (ret) {
> +		dev_err(parent, "Cannot register %s: %d\n", name, ret);
> +		put_device(&device->dev);
> +		return NULL;
> +	}
> +
> +	return device;
> +}
> +
> +void vchiq_device_unregister(struct vchiq_device *vchiq_dev)
> +{
> +	device_unregister(&vchiq_dev->dev);
> +}
> +
> +int vchiq_driver_register(struct vchiq_driver *vchiq_drv)
> +{
> +	vchiq_drv->driver.bus = &vchiq_bus_type;
> +
> +	return driver_register(&vchiq_drv->driver);
> +}
> +EXPORT_SYMBOL_GPL(vchiq_driver_register);
> +
> +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv)
> +{
> +	driver_unregister(&vchiq_drv->driver);
> +}
> +EXPORT_SYMBOL_GPL(vchiq_driver_unregister);
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h
> new file mode 100644
> index 000000000000..7eaaf9a91cda
> --- /dev/null
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h
> @@ -0,0 +1,54 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2023 Ideas On Board Oy
> + */
> +
> +#ifndef _VCHIQ_DEVICE_H
> +#define _VCHIQ_DEVICE_H
> +
> +#include <linux/device.h>
> +
> +struct vchiq_device {
> +	struct device dev;
> +};
> +
> +struct vchiq_driver {
> +	int		(*probe)(struct vchiq_device *device);
> +	void		(*remove)(struct vchiq_device *device);
> +	int		(*resume)(struct vchiq_device *device);
> +	int		(*suspend)(struct vchiq_device *device,
> +				   pm_message_t state);
> +	struct device_driver driver;
> +};
> +
> +static inline struct vchiq_device *to_vchiq_device(struct device *d)
> +{
> +	return container_of(d, struct vchiq_device, dev);
> +}
> +
> +static inline struct vchiq_driver *to_vchiq_driver(struct device_driver *d)
> +{
> +	return container_of(d, struct vchiq_driver, driver);
> +}
> +
> +extern struct bus_type vchiq_bus_type;
> +
> +struct vchiq_device *
> +vchiq_device_register(struct device *parent, const char *name);
> +void vchiq_device_unregister(struct vchiq_device *dev);
> +
> +int vchiq_driver_register(struct vchiq_driver *vchiq_drv);
> +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv);
> +
> +/**
> + * module_vchiq_driver() - Helper macro for registering a vchiq driver
> + * @__vchiq_driver: vchiq driver struct
> + *
> + * Helper macro for vchiq drivers which do not do anything special in
> + * module init/exit. This eliminates a lot of boilerplate. Each module may only
> + * use this macro once, and calling it replaces module_init() and module_exit()
> + */
> +#define module_vchiq_driver(__vchiq_driver) \
> +	module_driver(__vchiq_driver, vchiq_driver_register, vchiq_driver_unregister)
> +
> +#endif /* _VCHIQ_DEVICE_H */
Umang Jain Sept. 12, 2023, 5:50 a.m. UTC | #2
Hi Stephan

On 9/12/23 1:52 AM, Stefan Wahren wrote:
> Hi Umang,
>
> Am 11.09.23 um 16:07 schrieb Umang Jain:
>> The devices that the vchiq interface registers (bcm2835-audio,
>> bcm2835-camera) are implemented and exposed by the VC04 firmware.
>> The device tree describes the VC04 itself with the resources required
>> to communicate with it through a mailbox interface. However, the
>> vchiq interface registers these devices as platform devices. This
>> also means the specific drivers for these devices are getting
>> registered as platform drivers. This is not correct and a blatant
>> abuse of platform device/driver.
>>
>> Add a new bus type, vchiq_bus_type and device type (struct vchiq_device)
>> which will be used to migrate child devices that the vchiq interfaces
>> creates/registers from the platform device/driver.
>>
>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
>> ---
>>   drivers/staging/vc04_services/Makefile        |   1 +
>>   .../interface/vchiq_arm/vchiq_device.c        | 111 ++++++++++++++++++
>>   .../interface/vchiq_arm/vchiq_device.h        |  54 +++++++++
>>   3 files changed, 166 insertions(+)
>>   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
>>
>> diff --git a/drivers/staging/vc04_services/Makefile 
>> b/drivers/staging/vc04_services/Makefile
>> index 44794bdf6173..2d071e55e175 100644
>> --- a/drivers/staging/vc04_services/Makefile
>> +++ b/drivers/staging/vc04_services/Makefile
>> @@ -5,6 +5,7 @@ vchiq-objs := \
>>      interface/vchiq_arm/vchiq_core.o  \
>>      interface/vchiq_arm/vchiq_arm.o \
>>      interface/vchiq_arm/vchiq_debugfs.o \
>> +   interface/vchiq_arm/vchiq_device.o \
>>      interface/vchiq_arm/vchiq_connected.o \
>>
>>   ifdef CONFIG_VCHIQ_CDEV
>> diff --git 
>> a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c 
>> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> new file mode 100644
>> index 000000000000..aad55c461905
>> --- /dev/null
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.c
>> @@ -0,0 +1,111 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * vchiq_device.c - VCHIQ generic device and bus-type
>> + *
>> + * Copyright (c) 2023 Ideas On Board Oy
>> + */
>> +
>> +#include <linux/device/bus.h>
>> +#include <linux/dma-mapping.h>
>> +#include <linux/of_device.h>
>> +#include <linux/slab.h>
>> +#include <linux/string.h>
>> +
>> +#include "vchiq_device.h"
>> +
>> +static int vchiq_bus_type_match(struct device *dev, struct 
>> device_driver *drv)
>> +{
>> +    if (dev->bus == &vchiq_bus_type &&
>> +        strcmp(dev_name(dev), drv->name) == 0)
>> +        return 1;
>> +
>> +    return 0;
>> +}
>> +
>> +static int vchiq_bus_uevent(const struct device *dev, struct 
>> kobj_uevent_env *env)
>> +{
>> +    const struct vchiq_device *device = container_of_const(dev, 
>> struct vchiq_device, dev);
>> +
>> +    return add_uevent_var(env, "MODALIAS=%s", dev_name(&device->dev));
>> +}
>> +
>> +static int vchiq_bus_probe(struct device *dev)
>> +{
>> +    struct vchiq_device *device = to_vchiq_device(dev);
>> +    struct vchiq_driver *driver = to_vchiq_driver(dev->driver);
>> +    int ret;
>> +
>> +    ret = driver->probe(device);
>> +    if (ret == 0)
>> +        return 0;
>> +
>> +    return ret;
>> +}
>> +
>> +struct bus_type vchiq_bus_type = {
>> +    .name   = "vchiq-bus",
>> +    .match  = vchiq_bus_type_match,
>> +    .uevent = vchiq_bus_uevent,
>> +    .probe  = vchiq_bus_probe,
>> +};
>> +
>> +static void vchiq_device_release(struct device *dev)
>> +{
>> +    struct vchiq_device *device = to_vchiq_device(dev);
>> +
>> +    kfree(device);
>> +}
>> +
>> +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.

I am even checking the ret value here, so if it can't set it, it will 
log an error. I don't that getting logged on my end. Can you share you 
entire dmesg output please?

Also, I have tested this against arm64 kernel, I assume you are using 
32-bit?

>
> In the old platform driver code we had something like
>
>   pdevinfo.dma_mask = DMA_BIT_MASK(32);
>
> So there is still something missing for our new bus driver.

>
>> +
>> +    ret = device_register(&device->dev);
>> +    if (ret) {
>> +        dev_err(parent, "Cannot register %s: %d\n", name, ret);
>> +        put_device(&device->dev);
>> +        return NULL;
>> +    }
>> +
>> +    return device;
>> +}
>> +
>> +void vchiq_device_unregister(struct vchiq_device *vchiq_dev)
>> +{
>> +    device_unregister(&vchiq_dev->dev);
>> +}
>> +
>> +int vchiq_driver_register(struct vchiq_driver *vchiq_drv)
>> +{
>> +    vchiq_drv->driver.bus = &vchiq_bus_type;
>> +
>> +    return driver_register(&vchiq_drv->driver);
>> +}
>> +EXPORT_SYMBOL_GPL(vchiq_driver_register);
>> +
>> +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv)
>> +{
>> +    driver_unregister(&vchiq_drv->driver);
>> +}
>> +EXPORT_SYMBOL_GPL(vchiq_driver_unregister);
>> diff --git 
>> a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h 
>> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h
>> new file mode 100644
>> index 000000000000..7eaaf9a91cda
>> --- /dev/null
>> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_device.h
>> @@ -0,0 +1,54 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/*
>> + * Copyright (c) 2023 Ideas On Board Oy
>> + */
>> +
>> +#ifndef _VCHIQ_DEVICE_H
>> +#define _VCHIQ_DEVICE_H
>> +
>> +#include <linux/device.h>
>> +
>> +struct vchiq_device {
>> +    struct device dev;
>> +};
>> +
>> +struct vchiq_driver {
>> +    int        (*probe)(struct vchiq_device *device);
>> +    void        (*remove)(struct vchiq_device *device);
>> +    int        (*resume)(struct vchiq_device *device);
>> +    int        (*suspend)(struct vchiq_device *device,
>> +                   pm_message_t state);
>> +    struct device_driver driver;
>> +};
>> +
>> +static inline struct vchiq_device *to_vchiq_device(struct device *d)
>> +{
>> +    return container_of(d, struct vchiq_device, dev);
>> +}
>> +
>> +static inline struct vchiq_driver *to_vchiq_driver(struct 
>> device_driver *d)
>> +{
>> +    return container_of(d, struct vchiq_driver, driver);
>> +}
>> +
>> +extern struct bus_type vchiq_bus_type;
>> +
>> +struct vchiq_device *
>> +vchiq_device_register(struct device *parent, const char *name);
>> +void vchiq_device_unregister(struct vchiq_device *dev);
>> +
>> +int vchiq_driver_register(struct vchiq_driver *vchiq_drv);
>> +void vchiq_driver_unregister(struct vchiq_driver *vchiq_drv);
>> +
>> +/**
>> + * module_vchiq_driver() - Helper macro for registering a vchiq driver
>> + * @__vchiq_driver: vchiq driver struct
>> + *
>> + * Helper macro for vchiq drivers which do not do anything special in
>> + * module init/exit. This eliminates a lot of boilerplate. Each 
>> module may only
>> + * use this macro once, and calling it replaces module_init() and 
>> module_exit()
>> + */
>> +#define module_vchiq_driver(__vchiq_driver) \
>> +    module_driver(__vchiq_driver, vchiq_driver_register, 
>> vchiq_driver_unregister)
>> +
>> +#endif /* _VCHIQ_DEVICE_H */
Stefan Wahren Sept. 12, 2023, 7:23 a.m. UTC | #3
Hi Umang,

Am 12.09.23 um 07:50 schrieb Umang Jain:
> Hi Stephan
>
> On 9/12/23 1:52 AM, Stefan Wahren wrote:
>> Hi Umang,
>>
>> Am 11.09.23 um 16:07 schrieb Umang Jain:
>>> ...
>>
>> 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.
This warning comes from this line [1]. Did you test with the mainline
devicetree from [2] which must be specified in the config.txt? Be aware
the arm dts files has moved into a sub directory just like arm64. I
don't use U-Boot, just the vendor bootloader from Raspberry Pi OS.
Please look at [3] for the details.
>
> I am even checking the ret value here, so if it can't set it, it will
> log an error. I don't that getting logged on my end. Can you share you
> entire dmesg output please?

Sure, see below

>
> Also, I have tested this against arm64 kernel, I assume you are using
> 32-bit?

Correct. This is what i meant with multi_v7_defconfig. It's my prefered
configuration to test BCM2837 for 32 bit ARM.

>
>>
>> In the old platform driver code we had something like
>>
>>   pdevinfo.dma_mask = DMA_BIT_MASK(32);
>>
>> So there is still something missing for our new bus driver.
>

[1] -
https://elixir.bootlin.com/linux/v6.6-rc1/source/drivers/of/device.c#L157
[2] -
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/broadcom?h=v6.6-rc1
[3] - https://gist.github.com/lategoodbye/c7317a42bf7f9c07f5a91baed8c68f75

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.6.0-rc1-00005-g87898f8cfe33
(stefanw@stefanw-SCHENKER) (arm-linux-gnueabihf-gcc (GCC) 11.3.1
20220604 [releases/gcc-11 revision
591c0f4b92548e3ae2e8173f4f93984b1c7f62bb], GNU ld
(Linaro_Binutils-2022.06) 2.37.20220122) #86 SMP Mon Sep 11 21:17:00
CEST 2023
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7),
cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model A Plus Rev 1.0
[    0.000000] random: crng init done
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x17800000,
size 64 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible
id shared-dma-pool
[    0.000000] OF: reserved mem: 0x17800000..0x1b7fffff (65536 KiB) map
reusable linux,cma
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000]   Normal   empty
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Initmem setup node 0 [mem
0x0000000000000000-0x000000001bffffff]
[    0.000000] percpu: Embedded 16 pages/cpu s36180 r8192 d21164 u65536
[    0.000000] pcpu-alloc: s36180 r8192 d21164 u65536 alloc=16*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[    0.000000] Kernel command line: video=HDMI-A-1:1920x1200M@60
dma.dmachans=0x7ff5 bcm2709.boardrev=0x9020e0 bcm2709.serial=0x48390b9c
bcm2709.uart_clock=48000000 bcm2709.disk_led_gpio=29
bcm2709.disk_led_active_low=0 smsc95xx.macaddr=B8:27:EB:39:0B:9C
vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 
console=ttyS1,115200 console=tty1 root=PARTUUID=a5c5156c-02
rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
plymouth.ignore-serial-consoles
[    0.000000] Kernel parameter elevator= does not have any effect anymore.
                Please use sysfs to set IO scheduler for individual devices.
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144
bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072
bytes, linear)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113792
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 361268K/458752K available (15360K kernel code,
2470K rwdata, 6440K rodata, 2048K init, 416K bss, 31948K reserved,
65536K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=16 to
nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay
is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on
contention.
[    0.000002] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps
every 2147483647500ns
[    0.000022] clocksource: timer: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000081] bcm2835: system timer (irq = 60)
[    0.002740] arch_timer: cp15 timer(s) running at 19.20MHz (phys).
[    0.002761] clocksource: arch_sys_counter: mask: 0xffffffffffffff
max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[    0.002778] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps
every 4398046511078ns
[    0.002795] Switching to timer-based delay loop, resolution 52ns
[    0.003698] Console: colour dummy device 80x30
[    0.003714] printk: console [tty1] enabled
[    0.004615] Calibrating delay loop (skipped), value calculated using
timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.004661] CPU: Testing write buffer coherency: ok
[    0.004724] pid_max: default: 32768 minimum: 301
[    0.004877] Mount-cache hash table entries: 1024 (order: 0, 4096
bytes, linear)
[    0.004918] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
bytes, linear)
[    0.005864] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.006739] Setting up static identity map for 0x300000 - 0x3000ac
[    0.007682] rcu: Hierarchical SRCU implementation.
[    0.007707] rcu:     Max phase no-delay instances is 1000.
[    0.010038] EFI services will not be available.
[    0.010319] smp: Bringing up secondary CPUs ...
[    0.011142] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.012181] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.013167] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.013406] smp: Brought up 1 node, 4 CPUs
[    0.013491] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.013518] CPU: All CPU(s) started in HYP mode.
[    0.013537] CPU: Virtualization extensions available.
[    0.014516] devtmpfs: initialized
[    0.022261] VFP support v0.3: implementor 41 architecture 3 part 40
variant 3 rev 4
[    0.022568] clocksource: jiffies: mask: 0xffffffff max_cycles:
0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.022621] futex hash table entries: 1024 (order: 4, 65536 bytes,
linear)
[    0.025174] pinctrl core: initialized pinctrl subsystem
[    0.027732] DMI not present or invalid.
[    0.028226] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.030852] DMA: preallocated 256 KiB pool for atomic coherent
allocations
[    0.035838] thermal_sys: Registered thermal governor 'step_wise'
[    0.035910] cpuidle: using governor menu
[    0.036454] No ATAGs?
[    0.036613] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4
watchpoint registers.
[    0.036651] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.039402] Serial: AMBA PL011 UART driver
[    0.067841] iommu: Default domain type: Translated
[    0.067886] iommu: DMA domain TLB invalidation policy: strict mode
[    0.068938] SCSI subsystem initialized
[    0.069165] libata version 3.00 loaded.
[    0.069441] usbcore: registered new interface driver usbfs
[    0.069502] usbcore: registered new interface driver hub
[    0.069568] usbcore: registered new device driver usb
[    0.069861] usb_phy_generic phy: dummy supplies not allowed for
exclusive requests
[    0.071286] pps_core: LinuxPPS API ver. 1 registered
[    0.071311] pps_core: Software ver. 5.3.6 - Copyright 2005-2007
Rodolfo Giometti <giometti@linux.it>
[    0.071358] PTP clock support registered
[    0.071579] EDAC MC: Ver: 3.0.0
[    0.072267] scmi_core: SCMI protocol bus registered
[    0.074843] vgaarb: loaded
[    1.884992] clocksource: Switched to clocksource arch_sys_counter
[    1.901738] NET: Registered PF_INET protocol family
[    1.901985] IP idents hash table entries: 8192 (order: 4, 65536
bytes, linear)
[    1.903408] tcp_listen_portaddr_hash hash table entries: 512 (order:
0, 4096 bytes, linear)
[    1.903467] Table-perturb hash table entries: 65536 (order: 6, 262144
bytes, linear)
[    1.903506] TCP established hash table entries: 4096 (order: 2, 16384
bytes, linear)
[    1.903590] TCP bind hash table entries: 4096 (order: 4, 65536 bytes,
linear)
[    1.903780] TCP: Hash tables configured (established 4096 bind 4096)
[    1.903903] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    1.903953] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes,
linear)
[    1.904097] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    1.904626] RPC: Registered named UNIX socket transport module.
[    1.904658] RPC: Registered udp transport module.
[    1.904680] RPC: Registered tcp transport module.
[    1.904699] RPC: Registered tcp-with-tls transport module.
[    1.904720] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.904752] PCI: CLS 0 bytes, default 64
[    1.906790] Initialise system trusted keyrings
[    1.907031] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[    1.907428] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.907895] NFS: Registering the id_resolver key type
[    1.907941] Key type id_resolver registered
[    1.907963] Key type id_legacy registered
[    1.908005] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.908032] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver
Registering...
[    1.908093] ntfs: driver 2.1.32 [Flags: R/O].
[    1.908391] Key type asymmetric registered
[    1.908416] Asymmetric key parser 'x509' registered
[    1.908511] Block layer SCSI generic (bsg) driver version 0.4 loaded
(major 246)
[    1.908545] io scheduler mq-deadline registered
[    1.908574] io scheduler kyber registered
[    1.908613] io scheduler bfq registered
[    1.929416] simple-framebuffer 1e330000.framebuffer: framebuffer at
0x1e330000, 0x8ca000 bytes
[    1.929483] simple-framebuffer 1e330000.framebuffer: format=a8r8g8b8,
mode=1920x1200x32, linelength=7680
[    1.960899] Console: switching to colour frame buffer device 240x75
[    1.991759] simple-framebuffer 1e330000.framebuffer: fb0: simplefb
registered!
[    2.068642] Serial: 8250/16550 driver, 5 ports, IRQ sharing enabled
[    2.072833] printk: console [ttyS1] disabled
[    2.073399] 3f215040.serial: ttyS1 at MMIO 0x3f215040 (irq = 86,
base_baud = 50000000) is a 16550
[    2.073651] printk: console [ttyS1] enabled
[    2.920538] SuperH (H)SCI(F) driver initialized
[    2.926208] msm_serial: driver initialized
[    2.930462] STMicroelectronics ASC driver initialized
[    2.936679] STM32 USART driver initialized
[    2.942745] bcm2835-rng 3f104000.rng: hwrng registered
[    2.963592] brd: module loaded
[    2.973113] loop: module loaded
[    2.978223] bcm2835-power bcm2835-power: Broadcom BCM2835 power
domains driver
[    2.998682] CAN device driver interface
[    3.003790] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
[    3.010882] e1000e: Intel(R) PRO/1000 Network Driver
[    3.016055] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    3.022233] igb: Intel(R) Gigabit Ethernet Network Driver
[    3.027849] igb: Copyright (c) 2007-2014 Intel Corporation.
[    3.037688] pegasus: Pegasus/Pegasus II USB Ethernet driver
[    3.043514] usbcore: registered new interface driver pegasus
[    3.049435] usbcore: registered new interface driver asix
[    3.055088] usbcore: registered new interface driver ax88179_178a
[    3.061433] usbcore: registered new interface driver cdc_ether
[    3.067537] usbcore: registered new interface driver smsc75xx
[    3.073532] usbcore: registered new interface driver smsc95xx
[    3.079540] usbcore: registered new interface driver net1080
[    3.085461] usbcore: registered new interface driver cdc_subset
[    3.091635] usbcore: registered new interface driver zaurus
[    3.097493] usbcore: registered new interface driver cdc_ncm
[    3.107490] usbcore: registered new interface driver usb-storage
[    3.118756] i2c_dev: i2c /dev entries driver
[    3.125053] i2c-bcm2835 3f805000.i2c: Could not read clock-frequency
property
[    3.143909] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    3.155422] sdhci: Secure Digital Host Controller Interface driver
[    3.161859] sdhci: Copyright(c) Pierre Ossman
[    3.168191] Synopsys Designware Multimedia Card Interface Driver
[    3.176079] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.186318] sdhci-iproc 3f300000.mmc: allocated mmc-pwrseq
[    3.192194] ledtrig-cpu: registered to indicate activity on CPUs
[    3.200162] usbcore: registered new interface driver usbhid
[    3.206009] usbhid: USB HID core driver
[    3.210952] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[    3.221958] NET: Registered PF_INET6 protocol family
[    3.228309] Segment Routing with IPv6
[    3.230085] mmc1: SDHCI controller on 3f300000.mmc [3f300000.mmc]
using PIO
[    3.235506] In-situ OAM (IOAM) with IPv6
[    3.264571] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    3.278548] NET: Registered PF_PACKET protocol family
[    3.290943] can: controller area network core
[    3.302686] NET: Registered PF_CAN protocol family
[    3.310422] sdhost-bcm2835 3f202000.mmc: loaded - DMA enabled (>1)
[    3.314775] can: raw protocol
[    3.338588] can: broadcast manager protocol
[    3.340768] mmc1: new high speed SDIO card at address 0001
[    3.345840] can: netlink gateway - max_hops=1
[    3.375015] Key type dns_resolver registered
[    3.386990] Registering SWP/SWPB emulation handler
[    3.410876] Loading compiled-in X.509 certificates
[    3.438851] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114,
base_baud = 0) is a PL011 rev2
[    3.439796] mmc0: host does not support reading read-only switch,
assuming write-enable
[    3.446571] serial serial0: tty port ttyAMA0 registered
[    3.456776] mmc0: new high speed SDHC card at address 0007
[    3.465830] raspberrypi-firmware soc:firmware: Attached to firmware
from 2022-08-26T14:04:36
[    3.469479] mmcblk0: mmc0:0007 SDCIT 14.6 GiB
[    3.526657]  mmcblk0: p1 p2
[    4.026948] dwc2 3f980000.usb: supply vusb_d not found, using dummy
regulator
[    4.039587] dwc2 3f980000.usb: supply vusb_a not found, using dummy
regulator
[    4.104176] dwc2 3f980000.usb: DWC OTG Controller
[    4.116471] dwc2 3f980000.usb: new USB bus registered, assigned bus
number 1
[    4.131137] dwc2 3f980000.usb: irq 66, io mem 0x3f980000
[    4.144958] hub 1-0:1.0: USB hub found
[    4.152675] hub 1-0:1.0: 1 port detected
[    4.164850] clk: Disabling unused clocks
[    4.184045] EXT4-fs (mmcblk0p2): mounted filesystem
3857a514-b0f4-49ce-8430-34762068bb6f ro with ordered data mode. Quota
mode: disabled.
[    4.201851] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    4.214447] devtmpfs: mounted
[    4.222679] Freeing unused kernel image (initmem) memory: 2048K
[    4.232336] Run /sbin/init as init process
[    4.239831]   with arguments:
[    4.239834]     /sbin/init
[    4.239838]   with environment:
[    4.239841]     HOME=/
[    4.239844]     TERM=linux
[    4.843914] systemd[1]: System time before build time, advancing clock.
[    4.953515] systemd[1]: systemd 241 running in system mode. (+PAM
+AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP
+GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN
-PCRE2 default-hierarchy=hybrid)
[    4.989282] systemd[1]: Detected architecture arm.
[    5.020664] systemd[1]: Set hostname to <raspberrypi>.
[    5.432605] systemd[1]: File
/lib/systemd/system/systemd-journald.service:12 configures an IP
firewall (IPAddressDeny=any), but the local system does not support
BPF/cgroup based firewalling.
[    5.456249] systemd[1]: Proceeding WITHOUT firewalling in effect!
(This warning is only shown for the first loaded unit using IP firewalling.)
[    5.842271] systemd[1]: Listening on Journal Socket (/dev/log).
[    5.860471] systemd[1]: Listening on fsck to fsckd communication Socket.
[    5.876658] systemd[1]: Listening on udev Control Socket.
[    5.890786] systemd[1]: Listening on udev Kernel Socket.
[    5.905241] systemd[1]: Created slice User and Session Slice.
[    8.050246] EXT4-fs (mmcblk0p2): re-mounted
3857a514-b0f4-49ce-8430-34762068bb6f r/w. Quota mode: disabled.
[    8.167738] systemd-journald[105]: Received request to flush runtime
journal from PID 1
[    9.190328] vchiq: module is from the staging directory, the quality
is unknown, you have been warned.
[    9.206802] vchiq-bus bcm2835-audio: DMA mask not set
[    9.206892] vchiq-bus bcm2835-camera: DMA mask not set
[    9.427708] Bluetooth: Core ver 2.22
[    9.427791] NET: Registered PF_BLUETOOTH protocol family
[    9.427800] Bluetooth: HCI device and connection manager initialized
[    9.427824] Bluetooth: HCI socket layer initialized
[    9.427833] Bluetooth: L2CAP socket layer initialized
[    9.427847] Bluetooth: SCO socket layer initialized
[    9.547412] Bluetooth: HCI UART driver ver 2.3
[    9.547448] Bluetooth: HCI UART protocol H4 registered
[    9.547942] Bluetooth: HCI UART protocol Broadcom registered
[    9.549244] hci_uart_bcm serial0-0: supply vbat not found, using
dummy regulator
[    9.549456] hci_uart_bcm serial0-0: supply vddio not found, using
dummy regulator
[    9.549522] hci_uart_bcm serial0-0: No reset resource, using default
baud rate
[    9.554412] cfg80211: Loading compiled-in X.509 certificates for
regulatory database
[    9.665377] uart-pl011 3f201000.serial: no DMA platform data
[    9.868055] Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    9.932284] Bluetooth: hci0: BCM: chip id 107
[    9.934550] Bluetooth: hci0: BCM: features 0x2f
[    9.939239] brcmfmac: brcmf_fw_alloc_request: using
brcm/brcmfmac43455-sdio for chip BCM4345/6
[    9.957852] Bluetooth: hci0: BCM4345C0
[    9.957877] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0000
[    9.967333] brcmfmac mmc1:0001:1: Direct firmware load for
brcm/brcmfmac43455-sdio.raspberrypi,3-model-a-plus.bin failed with error -2
[   10.053005] Bluetooth: hci0: BCM4345C0 'brcm/BCM4345C0.hcd' Patch
[   10.061320] Console: switching to colour dummy device 80x30
[   10.084466] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[   10.122320] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[   10.122547] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[   10.122730] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[   10.122872] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops
vc4_crtc_ops [vc4])
[   10.123004] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops
vc4_crtc_ops [vc4])
[   10.123133] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops
vc4_crtc_ops [vc4])
[   10.123258] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[   10.128918] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[   10.218980] Console: switching to colour frame buffer device 240x75
[   10.245316] vc4-drm soc:gpu: [drm] fb0: vc4drmfb frame buffer device
[   10.274786] snd_bcm2835: module is from the staging directory, the
quality is unknown, you have been warned.
[   10.277567] bcm2835-audio bcm2835-audio: card created with 8 channels
[   10.330733] mc: Linux media interface: v0.10
[   10.341921] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob
available (err=-2)
[   10.342362] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0:
Jan  4 2021 19:56:29 version 7.45.229 (617f1f5 CY) FWID 01-2dbd9d2e
[   10.407854] videodev: Linux video capture interface: v2.00
[   10.459897] bcm2835_mmal_vchiq: module is from the staging directory,
the quality is unknown, you have been warned.
[   10.470977] bcm2835_v4l2: module is from the staging directory, the
quality is unknown, you have been warned.
[   10.780230] alsactl[236]: memfd_create() called without MFD_EXEC or
MFD_NOEXEC_SEAL set
[   10.780230] alsactl[216]: memfd_create() called without MFD_EXEC or
MFD_NOEXEC_SEAL set
[   13.854105] Adding 102396k swap on /var/swap.  Priority:-2 extents:1
across:102396k SS
[   15.909255] Bluetooth: hci0: BCM: features 0x2f
[   15.932508] Bluetooth: hci0: BCM43455 37.4MHz Raspberry Pi 3+
[   15.932532] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0342
[   16.593213] Bluetooth: MGMT ver 1.22
[   22.184944] usb 1-1: new low-speed USB device number 2 using dwc2
[   22.446694] input: PixArt Microsoft USB Optical Mouse as
/devices/platform/soc/3f980000.usb/usb1/1-1/1-1:1.0/0003:045E:00CB.0001/input/input0
[   22.447000] hid-generic 0003:045E:00CB.0001: input: USB HID v1.11
Mouse [PixArt Microsoft USB Optical Mouse] on usb-3f980000.usb-1/input0
[   41.545014] usb 1-1: USB disconnect, device number 2
[   44.954930] usb 1-1: new low-speed USB device number 3 using dwc2
[   45.226584] input: HID 046a:0011 as
/devices/platform/soc/3f980000.usb/usb1/1-1/1-1:1.0/0003:046A:0011.0002/input/input1
[   45.295525] hid-generic 0003:046A:0011.0002: input: USB HID v1.11
Keyboard [HID 046a:0011] on usb-3f980000.usb-1/input0
Stefan Wahren Sept. 13, 2023, 11:31 a.m. UTC | #4
Hi Umang,

Am 12.09.23 um 09:23 schrieb Stefan Wahren:
> Hi Umang,
>
> Am 12.09.23 um 07:50 schrieb Umang Jain:
>> Hi Stephan
>>
>> On 9/12/23 1:52 AM, Stefan Wahren wrote:
>>> Hi Umang,
>>>
>>> Am 11.09.23 um 16:07 schrieb Umang Jain:
>>>> ...
>>>
>>> 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.
> This warning comes from this line [1]. Did you test with the mainline
> devicetree from [2] which must be specified in the config.txt? Be
> aware the arm dts files has moved into a sub directory just like
> arm64. I don't use U-Boot, just the vendor bootloader from Raspberry
> Pi OS. Please look at [3] for the details.
please look at [4], which is possible a solution. AFAIK the dwc2 also
had the same problem.

[4] -
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc2/platform.c#L448
Robin Murphy Sept. 13, 2023, 12:08 p.m. UTC | #5
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.
Umang Jain Sept. 13, 2023, 7:29 p.m. UTC | #6
Hi Robin

On 9/13/23 5:38 PM, Robin Murphy wrote:
> 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 for this suggestion. I have now set the dma_mask within the child 
itself!
>
> Thanks,
> Robin.