diff mbox series

[net-next,7/9] firmware_loader: Expand Firmware upload error codes

Message ID 20231116-feature_poe-v1-7-be48044bf249@bootlin.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: Add support for Power over Ethernet (PoE) | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3523 this patch: 3523
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang fail Errors and warnings before: 1364 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3900 this patch: 3900
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kory Maincent Nov. 16, 2023, 2:01 p.m. UTC
No error code are available to signal an invalid firmware content.
Drivers that can check the firmware content validity can not return this
specific failure to the user-space

Expand the firmware error code with an additional code:
- "firmware invalid" code which can be used when the provided firmware
  is invalid

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 drivers/base/firmware_loader/sysfs_upload.c | 1 +
 include/linux/firmware.h                    | 2 ++
 2 files changed, 3 insertions(+)

Comments

Luis Chamberlain Nov. 16, 2023, 4:30 p.m. UTC | #1
On Thu, Nov 16, 2023 at 03:01:39PM +0100, Kory Maincent wrote:
> No error code are available to signal an invalid firmware content.
> Drivers that can check the firmware content validity can not return this
> specific failure to the user-space
> 
> Expand the firmware error code with an additional code:
> - "firmware invalid" code which can be used when the provided firmware
>   is invalid
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

Acked-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis
Greg KH Nov. 16, 2023, 4:37 p.m. UTC | #2
On Thu, Nov 16, 2023 at 03:01:39PM +0100, Kory Maincent wrote:
> No error code are available to signal an invalid firmware content.
> Drivers that can check the firmware content validity can not return this
> specific failure to the user-space
> 
> Expand the firmware error code with an additional code:
> - "firmware invalid" code which can be used when the provided firmware
>   is invalid
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  drivers/base/firmware_loader/sysfs_upload.c | 1 +
>  include/linux/firmware.h                    | 2 ++
>  2 files changed, 3 insertions(+)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conor Dooley Nov. 16, 2023, 5:44 p.m. UTC | #3
On Thu, Nov 16, 2023 at 03:01:39PM +0100, Kory Maincent wrote:
> No error code are available to signal an invalid firmware content.
> Drivers that can check the firmware content validity can not return this
> specific failure to the user-space
> 
> Expand the firmware error code with an additional code:
> - "firmware invalid" code which can be used when the provided firmware
>   is invalid
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

This would be rather helpful to me for some stuff that I am currently
working on and was hoping to send to Arnd for inclusion in 6.8:
https://lore.kernel.org/all/20231020-series-uncooked-077b107af3ae@spud/

I'm currently returning a "HW_ERROR" for something that this would fit
the bill for (in mpfs_auto_update_write()). What would the ETA for this
stuff landing via the net tree be?
Since I am not a netdev contributor its hard to tell how controversial
these patches are!

Cheers,
Conor.
Andrew Lunn Nov. 16, 2023, 9:56 p.m. UTC | #4
> This would be rather helpful to me for some stuff that I am currently
> working on and was hoping to send to Arnd for inclusion in 6.8:
> https://lore.kernel.org/all/20231020-series-uncooked-077b107af3ae@spud/
> 
> I'm currently returning a "HW_ERROR" for something that this would fit
> the bill for (in mpfs_auto_update_write()). What would the ETA for this
> stuff landing via the net tree be?
> Since I am not a netdev contributor its hard to tell how controversial
> these patches are!

It already has the needed ACKs, so it could be merged
anytime. However, it seems like two different subsystems are
interested in it. So rather than merge it via netdev, it might make
sense to merge it via its normal tree, driver-core. Then ask for a
stable branch which can be pulled into netdev and arm-soc.

      Andrew
Kory Maincent Nov. 17, 2023, 8:56 a.m. UTC | #5
On Thu, 16 Nov 2023 22:56:10 +0100
Andrew Lunn <andrew@lunn.ch> wrote:

> > This would be rather helpful to me for some stuff that I am currently
> > working on and was hoping to send to Arnd for inclusion in 6.8:
> > https://lore.kernel.org/all/20231020-series-uncooked-077b107af3ae@spud/
> > 
> > I'm currently returning a "HW_ERROR" for something that this would fit
> > the bill for (in mpfs_auto_update_write()). What would the ETA for this
> > stuff landing via the net tree be?
> > Since I am not a netdev contributor its hard to tell how controversial
> > these patches are!  
> 
> It already has the needed ACKs, so it could be merged
> anytime. However, it seems like two different subsystems are
> interested in it. So rather than merge it via netdev, it might make
> sense to merge it via its normal tree, driver-core. Then ask for a
> stable branch which can be pulled into netdev and arm-soc.

Ok, I will remove this patch from this series in v2 and send it through normal
tree.

Regards,
diff mbox series

Patch

diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index a0af8f5f13d8..829270067d16 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -27,6 +27,7 @@  static const char * const fw_upload_err_str[] = {
 	[FW_UPLOAD_ERR_INVALID_SIZE] = "invalid-file-size",
 	[FW_UPLOAD_ERR_RW_ERROR]     = "read-write-error",
 	[FW_UPLOAD_ERR_WEAROUT]	     = "flash-wearout",
+	[FW_UPLOAD_ERR_FW_INVALID]   = "firmware-invalid",
 };
 
 static const char *fw_upload_progress(struct device *dev,
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index de7fea3bca51..0311858b46ce 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -27,6 +27,7 @@  struct firmware {
  * @FW_UPLOAD_ERR_INVALID_SIZE: invalid firmware image size
  * @FW_UPLOAD_ERR_RW_ERROR: read or write to HW failed, see kernel log
  * @FW_UPLOAD_ERR_WEAROUT: FLASH device is approaching wear-out, wait & retry
+ * @FW_UPLOAD_ERR_FW_INVALID: invalid firmware file
  * @FW_UPLOAD_ERR_MAX: Maximum error code marker
  */
 enum fw_upload_err {
@@ -38,6 +39,7 @@  enum fw_upload_err {
 	FW_UPLOAD_ERR_INVALID_SIZE,
 	FW_UPLOAD_ERR_RW_ERROR,
 	FW_UPLOAD_ERR_WEAROUT,
+	FW_UPLOAD_ERR_FW_INVALID,
 	FW_UPLOAD_ERR_MAX
 };