Skip to contentSkip to conversation

dma: imx-sdma: clarify firmare not found warning

PATCH Superseded Sascha Hauer 5 participants 19 messages Jan 20, 2014 – Nov 12, 2014

Subsystems (2)
lore
Share & tools
lore

Sascha Hauer

author maintainer
#0 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

Cc Vinod Koul <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Shawn Guo <[email protected]>

---

changes since v1:
- instead of removing the message make it more clear

 drivers/dma/imx-sdma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +4 -1
index c75679d..d79eaad 100644
@@ -1259,7 +1259,10 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
 	unsigned short *ram_code;
 
 	if (!fw) {
-		dev_err(sdma->dev, "firmware not found\n");
+		dev_info(sdma->dev, "external firmware not found, using ROM firmware\n");
+		/*
+		 * In this case we just use the ROM firmware.
+		 */
 		return;
 	}
 
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 7 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

In case user space firmware loading

Quoted 28 lines
Cc Vinod Koul <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Shawn Guo <[email protected]>

---

changes since v1:
- instead of removing the message make it more clear

 drivers/dma/imx-sdma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +4 -1
index c75679d..d79eaad 100644
@@ -1259,7 +1259,10 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
 	unsigned short *ram_code;
 
 	if (!fw) {
-		dev_err(sdma->dev, "firmware not found\n");
+		dev_info(sdma->dev, "external firmware not found, using ROM firmware\n");
+		/*
+		 * In this case we just use the ROM firmware.
+		 */
 		return;
 	}
 
Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#2 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 2 lines · Lothar Wa?mann

Hi,

erroneously pressed the 'Send' button...

Quoted 8 lines
Quoted 7 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#3 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#4 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

In that case why don't we use async version and wait till the userspace is availble and firmware is loaded.

So request_firmware_nowait() seems to do the job, I have used in a device where I call it in probe() so that not to slow booting and make firmware bloc availble userpsace is availble.

Sounds too good, did I miss anything obvious for this case here?

Signature · 1 line
~Vinod
author maintainer
#5 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 10 lines · Vinod Koul
Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

Quoted 8 lines

In that case why don't we use async version and wait till the userspace is availble and firmware is loaded.

So request_firmware_nowait() seems to do the job, I have used in a device where I call it in probe() so that not to slow booting and make firmware bloc availble userpsace is availble.

Sounds too good, did I miss anything obvious for this case here?

Been there, done that. This would make the RAM Firmware mandatory.

The Linux firmware loading mechanism is not very suitable for the SDMA engine. The firmware loading mechanism expects that a driver cannot work without a firmware. Normally this is true, but The SDMA engine can run with the ROM firmware or a RAM firmware loaded during runtime. In fact the firmware consists of Program code, so the SDMA engine could even run with a combination of the ROM firmware and 0..n dynamically loaded firmware modules.

Maybe using the firmware loading mechanism for the SDMA engine was the wrong approach from the start.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#6 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

In reply to Russell King - ARM Linux

Hi,

Quoted 10 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

I can confirm that it does work, since I'm using it. I have the following in my /etc/init.d/mdev.sh script:

|        [ "$VERBOSE" = no ] || echo -n "Triggering firmware load"
|        for dir in $(find /sys/class/firmware/ -type l);do
|            echo add > "$dir/uevent"
|        done

Lothar

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#7 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 13 lines · Lothar Wa?mann

Hi,

Quoted 10 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

Quoted 6 lines

I can confirm that it does work, since I'm using it. I have the following in my /etc/init.d/mdev.sh script:

|        [ "$VERBOSE" = no ] || echo -n "Triggering firmware load"
|        for dir in $(find /sys/class/firmware/ -type l);do
|            echo add > "$dir/uevent"
|        done

I can't check on iMX6 at the moment, but I did look in that directory after the iMX6 SDMA reported that it hadn't found any firmware, and it was empty apart from the "timeout" file.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#8 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 21 lines · Russell King - ARM Linux
Quoted 13 lines · Lothar Wa?mann

Hi,

Quoted 10 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

I haven't worked out whether that's actually possible - I saw no way to re-trigger the firmware request, and once the firmware request expires, there seems to be no way for userspace to say "okay, the firmware is now available, please load it".

Quoted 6 lines

I can confirm that it does work, since I'm using it. I have the following in my /etc/init.d/mdev.sh script:

|        [ "$VERBOSE" = no ] || echo -n "Triggering firmware load"
|        for dir in $(find /sys/class/firmware/ -type l);do
|            echo add > "$dir/uevent"
|        done
Quoted 4 lines

I can't check on iMX6 at the moment, but I did look in that directory after the iMX6 SDMA reported that it hadn't found any firmware, and it was empty apart from the "timeout" file.

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#9 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 3 lines · Lothar Wa?mann

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

... which is impossible if imx-sdma is built into the kernel - it expires while the initramfs has only just started running, giving a very narrow window for userspace to load firmware.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#10 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

... which is impossible if imx-sdma is built into the kernel - it expires while the initramfs has only just started running, giving a very narrow window for userspace to load firmware.

It works for me, but I'm not using initramfs.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#11 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 8 lines · Lothar Wa?mann

Hi,

Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

Quoted 5 lines
Quoted 4 lines

... which is impossible if imx-sdma is built into the kernel - it expires while the initramfs has only just started running, giving a very narrow window for userspace to load firmware.

It works for me, but I'm not using initramfs.

You can take my email as a report of "it doesn't work for everyone." The *only* way I can get firmware to load is to build imx-sdma as a module. Building it in is a hopeless case here.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#12 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 13 lines · Russell King - ARM Linux
Quoted 12 lines · Lothar Wa?mann

Hi,

Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

... which is impossible if imx-sdma is built into the kernel - it expires while the initramfs has only just started running, giving a very narrow window for userspace to load firmware.

Quoted 6 lines
Quoted 1 line

It works for me, but I'm not using initramfs.

You can take my email as a report of "it doesn't work for everyone." The *only* way I can get firmware to load is to build imx-sdma as a module. Building it in is a hopeless case here.

You could change the timeout from your initramfs as soon as sysfs has been mounted by writing the number of seconds to /sys/class/firmware/timeout. A timeout of '0' means 'wait forever' which should be long enough for any boot case. ;)

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
#13 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 18 lines · Lothar Wa?mann

Hi,

Quoted 15 lines · Russell King - ARM Linux
Quoted 13 lines · Lothar Wa?mann

Hi,

Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Lothar Wa?mann

The file is automatically removed after the timeout has expired (or the frimware has been loaded).
Thus you must check for it within the timeout period during boot.

... which is impossible if imx-sdma is built into the kernel - it expires while the initramfs has only just started running, giving a very narrow window for userspace to load firmware.

It works for me, but I'm not using initramfs.

Quoted 8 lines
Quoted 4 lines

You can take my email as a report of "it doesn't work for everyone." The *only* way I can get firmware to load is to build imx-sdma as a module. Building it in is a hopeless case here.

You could change the timeout from your initramfs as soon as sysfs has been mounted by writing the number of seconds to /sys/class/firmware/timeout. A timeout of '0' means 'wait forever' which should be long enough for any boot case. ;)

Err, no. Let's walk through the code, shall we?

imx-sdma calls request_firmware_nowait() for the firmware.

request_firmware_nowait() allocates a work structure, saves all the details, puts it on a queue, and triggers a workqueue to process this.

When the work structure is dequeued, request_firmware_work_func() is called. This calls _request_firmware() with the appropriate parameters, including nowait = true.

_request_firmware() reads the timeout, and then calls usermodehelper_read_lock_wait() with it. (Once this has happened, changing the timeout has no effect.) This waits for the requisit amount of time for usermodehelper_disabled.

Once that happens, fw_get_filesystem_firmware() is called by _request_firmware(), which attempts to read the file from the mounted filesystem.

If that fails, the kernel falls back to fw_load_from_user_helper() to invoke a usermode helper to load the firmware.

This creates a file in /sys/class/firmware, and issues a uevent, sets a timeout using the timeout value read above, and waits either for the request to be satisfied or a timeout to happen.

So... increasing the timeout can _only_ have an effect if it is done before the request is created - which, if imx-sdma is built into the kernel will be impossible to achieve.

What I suspect is happening is that ubuntu's initramfs doesn't contain the firmware, but it unblocks the user helper (since it contains and runs udev) which also fails to find the firmware - and there's no provision for the firmware to be included in ubuntu's initramfs.

So, let's go back to the point I've been making. If you build imx-sdma into the kernel, there are situations where it is impossible to load replacement firmware, because the attempt to load firmware expires long before there is any chance for it to be loaded.

Maybe you don't personally care about ubuntu. Good for you, that's your personal choice. That has absolutely no bearing on this issue though.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
author maintainer
#14 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

In reply to Lothar Waßmann

Hi Lothar,

Quoted 11 lines · Lothar Wa?mann

Hi,

Quoted 2 lines · Lothar Wa?mann

Hi,

erroneously pressed the 'Send' button...

Quoted 4 lines
Quoted 3 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

Then at least until the RAM firmware is loaded the message is still adequate, no? We could add an addional message when the firmware is loaded if you like.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#15 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Hi,

Quoted 18 lines · Sascha Hauer

Hi Lothar,

Quoted 15 lines · Lothar Wa?mann

Hi,

Quoted 2 lines · Lothar Wa?mann

Hi,

erroneously pressed the 'Send' button...

Quoted 8 lines
Quoted 7 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

Quoted 8 lines
Quoted 3 lines

In case user space firmware loading support (CONFIG_FW_LOADER) is enabled, this message may still be inadequate, since the firmware may very well be loaded lateron.

Then at least until the RAM firmware is loaded the message is still adequate, no? We could add an addional message when the firmware is loaded if you like.

There is already a message printed upon successful firmware load:
|imx-sdma 63fb0000.sdma: loaded firmware 1.1

But one message saying 'firmware load failed' and another saying the opposite is a bit confusing. There actually is also a message saying 'firmware not found' when the timeout expires without any firmware being loaded. Thus at least in case CONFIG_FW_LOADER is enabled the message 'Direct firmware load failed' could be omitted.

Lothar Wa?mann

Signature · 9 lines
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
reviewer
#16 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

In reply to Sascha Hauer
Quoted 7 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

Quoted 8 lines
Cc Vinod Koul <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Shawn Guo <[email protected]>

---

changes since v1:
- instead of removing the message make it more clear

I know this has been posted a long time ago and agree that it would be useful to change this dev_err code into dev_info:

Quoted 22 lines
 drivers/dma/imx-sdma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +4 -2
index c75679d..d79eaad 100644
@@ -1259,7 +1259,10 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
        unsigned short *ram_code;
 
        if (!fw) {
-               dev_err(sdma->dev, "firmware not found\n");
+               dev_info(sdma->dev, "external firmware not found, using ROM firmware\n");
+               /*
+                * In this case we just use the ROM firmware.
+                */
                return;
        }
 
--

1.8.5.2

#17 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 14 lines · Fabio Estevam
Quoted 13 lines · Sascha Hauer

When a firmware cannot be found for the SDMA engine then we can continue with the inernal ROM firmware.

The meaning of this message is frequently asked for, so make clear that the driver still works with the internal ROM firmware and reduce the loglevel from err to info.

Cc Vinod Koul <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Shawn Guo <[email protected]>

---

Quoted 5 lines
Quoted 2 lines

changes since v1:
- instead of removing the message make it more clear

I know this has been posted a long time ago and agree that it would be useful to change this dev_err code into dev_info:

In that case cn someone pls repost this...

Signature · 1 line
~Vinod
Quoted 25 lines
Quoted 22 lines
 drivers/dma/imx-sdma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma/imx-sdma.c +4 -2
index c75679d..d79eaad 100644
@@ -1259,7 +1259,10 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
        unsigned short *ram_code;
 
        if (!fw) {
-               dev_err(sdma->dev, "firmware not found\n");
+               dev_info(sdma->dev, "external firmware not found, using ROM firmware\n");
+               /*
+                * In this case we just use the ROM firmware.
+                */
                return;
        }
 
--

1.8.5.2

reviewer
#18 lore raw

PATCH v2 1/1 dma: imx-sdma: clarify firmare not found warning

Quoted 1 line · Vinod Koul

In that case cn someone pls repost this...

Sure, just resent it. Thanks