Message ID | 20231117-feature_firmware_error_code-v1-1-92c973a50847@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp429930vqn; Fri, 17 Nov 2023 02:28:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IERFCmwIDZiH0DOcQKxWTD9qBQ3mfv8Gl0MSzf538NIWpYMcgdrxsjFpA03Crs1ivouSNt/ X-Received: by 2002:a17:903:2312:b0:1ce:5bb1:4e19 with SMTP id d18-20020a170903231200b001ce5bb14e19mr2180492plh.66.1700216929888; Fri, 17 Nov 2023 02:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700216929; cv=none; d=google.com; s=arc-20160816; b=smm9cMuB7Sj4ELwQ+X5+bwlamhJFzUBU1fmaQNeCabJaEHNkOC56y43Cu7bZn8K9LS OM7EUg2Nkbj2Of9M0YNCvCyBZMXGPXWHBNdVn8Svt22SivJN0PivdZs41Fi1W5rzG015 Dvtp6UfjazP+LTjSncyjQAV8qZ89FnwaN9ZDeY5i3cIGYCghuzV0FOdfO+QysTS6YLsi pllOE0KXuK9uGKBoNSC65J2bTGmu4Rj/i1Zq71/N7Q5Y3EunZFaH97Ae8+7hmFpG969E OzST1BHrBEB5o8Jb4tKmaQRYEzVGTgjnoBsejnYLZtZQTmMSNv4IPadoTjGDZqqylQjU QLwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=hssYZxQ7oYF62vZivWNVQkuQ1Tob1SL3kJykunvJ4/0=; fh=Avs0nA1edBJBlzsDKSjKkRZ9u0UC21Sdr9dOq4MNZwQ=; b=VEdTExbWJCCXnEgfk+Vu6nsqf5fDgK0OFgeMODOHnhQ1nk0oWBDVdT1LyTcT7ZwAfZ b9sO4z4CMjXlyyj2goavyubFZRIteRF0fG2R8BXtOGabqda8v3bZeVR4D+/P6HBmUStn eXXB3bK3ei1K0ipyEVK772OmTKxLCoFKuQmebGSGkZO3CmDHiOhqVGxyxX3z93ZOY/31 HjIS6gjVEcQTQX4rFVSXUjBZG43/0dJrhKMgR4+HgqNIRVy45DxTxdVNhdx7WHcBf5cc yFvKNg2SmovWvALpX8Jd8g13vvCDIbyaVxRAo/P1oXRmSIuYurUmhySxOMsc7tKAF60Q Grig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OojY2ahI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l18-20020a170902eb1200b001bf1d1d99b0si1473337plb.568.2023.11.17.02.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 02:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OojY2ahI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 396DB82AA650; Fri, 17 Nov 2023 02:28:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345888AbjKQK23 (ORCPT <rfc822;jaysivo@gmail.com> + 30 others); Fri, 17 Nov 2023 05:28:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235027AbjKQK20 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 17 Nov 2023 05:28:26 -0500 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA65FD49 for <linux-kernel@vger.kernel.org>; Fri, 17 Nov 2023 02:28:20 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id CAE89240002; Fri, 17 Nov 2023 10:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1700216899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=hssYZxQ7oYF62vZivWNVQkuQ1Tob1SL3kJykunvJ4/0=; b=OojY2ahINfBpf0qydeGz+bModeIomJL0J4gdEXqwOR1DsOnBHPiIYI0KVvFUejAunfsP80 zJXmFqNOKAZG2Bei5aTGSIChuBwW3qQKRj/REPrcRrdB3mZHqM8OPTJeNBSoA6QS6AnPBr zOctfr0ClJRANXoKsGTHeez5FNXau/+7W0nXD83Eyv6tC6bOw9vk3sLLin1eVFM2LKBfkP MvWCTSf1Oxe4vNoOSDlf8Oxb7qj+SUNIN2SO/FdzkdzpnzZA0vlyYRDfkK6a+2P8YVuKLv T6bdW4t1azyXiEaNtwpwLnTa4Eg6fvO1sUWtL4phXmhZ/VFu0vRfuyizAyRjqw== From: Kory Maincent <kory.maincent@bootlin.com> Date: Fri, 17 Nov 2023 11:27:53 +0100 Subject: [PATCH] firmware_loader: Expand Firmware upload error codes with firmware invalid error MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231117-feature_firmware_error_code-v1-1-92c973a50847@bootlin.com> X-B4-Tracking: v=1; b=H4sIAChAV2UC/x3MQQqDMBBG4avIrBswdmHwKkVkNP+0s9CUidWCe HeDu/dt3kEZpsjUVQcZNs2algL/qGj68PKG01hMTd08vfetE/D6MwyiNu9cAmbJhilFuDHElqU OHARUDl+D6P++v/rzvAA6CmJwbQAAAA== To: Luis Chamberlain <mcgrof@kernel.org>, Russ Weight <russ.weight@linux.dev>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>, linux-kernel@vger.kernel.org, Conor Dooley <conor@kernel.org>, Andrew Lunn <andrew@lunn.ch>, Kory Maincent <kory.maincent@bootlin.com> X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 02:28:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782806667849027621 X-GMAIL-MSGID: 1782806667849027621 |
Series |
firmware_loader: Expand Firmware upload error codes with firmware invalid error
|
|
Commit Message
Köry Maincent
Nov. 17, 2023, 10:27 a.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 Acked-by: Luis Chamberlain <mcgrof@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> --- This patch was initially submitted as part of a net patch series. Conor expressed interest in using it in a different subsystem. Consequently, I extracted it from the series and submitted it separately to the main tree, driver-core. https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/ --- drivers/base/firmware_loader/sysfs_upload.c | 1 + include/linux/firmware.h | 2 ++ 2 files changed, 3 insertions(+) --- base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 change-id: 20231117-feature_firmware_error_code-b8d7af08a8fe Best regards,
Comments
On Fri, Nov 17, 2023 at 11:27:53AM +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 > > Acked-by: Luis Chamberlain <mcgrof@kernel.org> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> > --- > > This patch was initially submitted as part of a net patch series. > Conor expressed interest in using it in a different subsystem. > Consequently, I extracted it from the series and submitted it separately > to the main tree, driver-core. > https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/ So you want me to take it through my tree? Sure, but if you are relying on this for any other code, it will be a while before it gets into Linus's tree, not until 6.8-rc1, is that ok? thanks, greg k-h
On Fri, Nov 17, 2023 at 08:45:59AM -0500, Greg Kroah-Hartman wrote: > On Fri, Nov 17, 2023 at 11:27:53AM +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 > > > > Acked-by: Luis Chamberlain <mcgrof@kernel.org> > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> > > --- > > > > This patch was initially submitted as part of a net patch series. > > Conor expressed interest in using it in a different subsystem. > > Consequently, I extracted it from the series and submitted it separately > > to the main tree, driver-core. > > https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/ > > So you want me to take it through my tree? Sure, but if you are relying > on this for any other code, it will be a while before it gets into > Linus's tree, not until 6.8-rc1, is that ok? My idea was that you could create a stable branch, which can then be pulled into netdev and arm-soc. If you don't want to do that, we can ask Arnd to take it, and he can create a stable branch which we pull into netdev. Andrew
On Fri, Nov 17, 2023 at 03:06:44PM +0100, Andrew Lunn wrote: > On Fri, Nov 17, 2023 at 08:45:59AM -0500, Greg Kroah-Hartman wrote: > > On Fri, Nov 17, 2023 at 11:27:53AM +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 > > > > > > Acked-by: Luis Chamberlain <mcgrof@kernel.org> > > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> > > > --- > > > > > > This patch was initially submitted as part of a net patch series. > > > Conor expressed interest in using it in a different subsystem. > > > Consequently, I extracted it from the series and submitted it separately > > > to the main tree, driver-core. > > > https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/ > > > > So you want me to take it through my tree? Sure, but if you are relying > > on this for any other code, it will be a while before it gets into > > Linus's tree, not until 6.8-rc1, is that ok? > > My idea was that you could create a stable branch, which can then be > pulled into netdev and arm-soc. I'll be glad to do so, you just need to ask me to do that, I don't see that request here :) > If you don't want to do that, we can ask Arnd to take it, and he can > create a stable branch which we pull into netdev. You want a stable tag to pull from, right? But really, why not just take this through netdev? It's just one commit, I have no problem with it going that way at all. If the odd chance there's a merge conflict in the future, I can handle it. thanks, greg k-h
On Fri, 17 Nov 2023 14:48:32 -0500 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > > > This patch was initially submitted as part of a net patch series. > > > > Conor expressed interest in using it in a different subsystem. > > > > Consequently, I extracted it from the series and submitted it separately > > > > to the main tree, driver-core. > > > > https://lore.kernel.org/netdev/20231116-feature_poe-v1-7-be48044bf249@bootlin.com/ > > > > > > > > > > So you want me to take it through my tree? Sure, but if you are relying > > > on this for any other code, it will be a while before it gets into > > > Linus's tree, not until 6.8-rc1, is that ok? > > > > My idea was that you could create a stable branch, which can then be > > pulled into netdev and arm-soc. > > I'll be glad to do so, you just need to ask me to do that, I don't see > that request here :) Sorry, my fault, I did not know well the merge actions that were needed for this particular case. > > If you don't want to do that, we can ask Arnd to take it, and he can > > create a stable branch which we pull into netdev. > > You want a stable tag to pull from, right? > > But really, why not just take this through netdev? It's just one > commit, I have no problem with it going that way at all. If the odd > chance there's a merge conflict in the future, I can handle it. Seems a good and simple idea to me, Andrew any thoughts about it? Do I send a single patch to net-next and ask Conor to pull it in his subsystem for his patch series? Regards,
> Sorry, my fault, I did not know well the merge actions that were needed for > this particular case. > > > > If you don't want to do that, we can ask Arnd to take it, and he can > > > create a stable branch which we pull into netdev. > > > > You want a stable tag to pull from, right? > > > > But really, why not just take this through netdev? It's just one > > commit, I have no problem with it going that way at all. If the odd > > chance there's a merge conflict in the future, I can handle it. > > Seems a good and simple idea to me, Andrew any thoughts about it? > Do I send a single patch to net-next and ask Conor to pull it in his > subsystem for his patch series? Yes, send a single patch to netdev. Under the ---, ask for a stable branch. Jakub should then hopefully reply with information about the branch, which other Maintainers can then pull. Andrew
On Mon, Nov 20, 2023 at 05:52:09PM +0100, Andrew Lunn wrote: > > Sorry, my fault, I did not know well the merge actions that were needed for > > this particular case. > > > > > > If you don't want to do that, we can ask Arnd to take it, and he can > > > > create a stable branch which we pull into netdev. > > > > > > You want a stable tag to pull from, right? > > > > > > But really, why not just take this through netdev? It's just one > > > commit, I have no problem with it going that way at all. If the odd > > > chance there's a merge conflict in the future, I can handle it. > > > > Seems a good and simple idea to me, Andrew any thoughts about it? > > Do I send a single patch to net-next and ask Conor to pull it in his > > subsystem for his patch series? > > Yes, send a single patch to netdev. Under the ---, ask for a stable > branch. Jakub should then hopefully reply with information about the > branch, which other Maintainers can then pull. Sry, lost track of this a little with catching up on life after being in the US for a week. Obv. stable branch doesn't matter to me where it comes from, so that'd be neat. Cheers, Conor.
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 };