From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Kane Chen <kane_chen@aspeedtech.com>,
Peter Maydell <peter.maydell@linaro.org>,
Steven Lee <steven_lee@aspeedtech.com>,
Troy Lee <leetroy@gmail.com>,
Jamin Lin <jamin_lin@aspeedtech.com>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Joel Stanley <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>,
troy_lee@aspeedtech.com
Subject: Re: [SPAM] [PATCH v4 4/5] hw/misc/aspeed_otp: Add 'drive' property to support block backend
Date: Tue, 22 Jul 2025 11:27:56 +0100 [thread overview]
Message-ID: <874iv4wmdv.fsf@draig.linaro.org> (raw)
In-Reply-To: <3da6275e-84d4-4911-8df1-6ed35bf63c07@kaod.org> ("Cédric Le Goater"'s message of "Tue, 22 Jul 2025 11:30:49 +0200")
Cédric Le Goater <clg@kaod.org> writes:
> On 7/8/25 07:57, Kane Chen wrote:
>> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
>> This patch introduces a 'drive' property to the Aspeed OTP device,
>> allowing it to be backed by a block device. Users can now preload
>> OTP data via QEMU CLI using a block backend.
>> Example usage:
>> ./qemu-system-arm \
>> -blockdev driver=file,filename=otpmem.img,node-name=otp \
>> -global aspeed-otp.drive=otp \
>> ...
>> If the drive is provided, its content will be loaded as the initial
>> OTP state.
>> Otherwise, an internal memory buffer will be used.
>> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
>
>
> Reviewed-by: Cédric Le Goater <clg@redhat.com>
Erm where is this email getting tagged as SPAM? The headers seem to
indicate its clear:
X-Spam_score_int: -39
X-Spam_score: -4.0
X-Spam_bar: ----
X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9,
HEADER_FROM_DIFFERENT_DOMAINS=0.157, RCVD_IN_DNSWL_MED=-2.3,
SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: qemu-arm@nongnu.org
X-Mailman-Version: 2.1.29
>
> Thanks,
>
> C.
>
>
>> ---
>> hw/nvram/aspeed_otp.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>> diff --git a/hw/nvram/aspeed_otp.c b/hw/nvram/aspeed_otp.c
>> index e41481d9bb..f018c58713 100644
>> --- a/hw/nvram/aspeed_otp.c
>> +++ b/hw/nvram/aspeed_otp.c
>> @@ -9,6 +9,7 @@
>> #include "qemu/osdep.h"
>> #include "qemu/log.h"
>> #include "qapi/error.h"
>> +#include "system/block-backend-global-state.h"
>> #include "system/block-backend-io.h"
>> #include "hw/qdev-properties.h"
>> #include "hw/nvram/aspeed_otp.h"
>> @@ -35,13 +36,25 @@ static bool aspeed_otp_init_storage(AspeedOTPState *s, Error **errp)
>> {
>> uint32_t *p;
>> int i, num;
>> + uint64_t perm;
>> + if (s->blk) {
>> + perm = BLK_PERM_CONSISTENT_READ |
>> + (blk_supports_write_perm(s->blk) ? BLK_PERM_WRITE : 0);
>> + if (blk_set_perm(s->blk, perm, BLK_PERM_ALL, errp) < 0) {
>> + return false;
>> + }
>> + if (blk_pread(s->blk, 0, s->size, s->storage, 0) < 0) {
>> + error_setg(errp, "Failed to read the initial flash content");
>> + return false;
>> + }
>> + } else {
>> num = s->size / sizeof(uint32_t);
>> p = (uint32_t *)s->storage;
>> for (i = 0; i < num; i++) {
>> p[i] = (i % 2 == 0) ? 0x00000000 : 0xFFFFFFFF;
>> }
>> -
>> + }
>> return true;
>> }
>> @@ -75,6 +88,7 @@ static void aspeed_otp_realize(DeviceState *dev,
>> Error **errp)
>> static const Property aspeed_otp_properties[] = {
>> DEFINE_PROP_UINT64("size", AspeedOTPState, size, 0),
>> + DEFINE_PROP_DRIVE("drive", AspeedOTPState, blk),
>> };
>> static void aspeed_otp_class_init(ObjectClass *klass, const void
>> *data)
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2025-07-22 10:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 5:57 [PATCH v4 0/5] ASPEED OTP QEMU model: block backend, machine alias, SoC integration Kane Chen via
2025-07-08 5:57 ` [PATCH v4 1/5] hw/misc/aspeed_otp: Add ASPEED OTP memory device model Kane Chen via
2025-07-22 9:30 ` [SPAM] " Cédric Le Goater
2025-07-22 9:54 ` Cédric Le Goater
2025-07-22 9:59 ` Kane Chen
2025-07-08 5:57 ` [PATCH v4 2/5] hw/misc/aspeed_sbc: Connect ASPEED OTP memory device to SBC Kane Chen via
2025-07-08 5:57 ` [PATCH v4 3/5] hw/arm: Integrate ASPEED OTP memory support into AST2600 SoCs Kane Chen via
2025-07-08 5:57 ` [PATCH v4 4/5] hw/misc/aspeed_otp: Add 'drive' property to support block backend Kane Chen via
2025-07-22 9:30 ` [SPAM] " Cédric Le Goater
2025-07-22 10:27 ` Alex Bennée [this message]
2025-07-22 11:27 ` Cédric Le Goater
2025-07-08 5:57 ` [PATCH v4 5/5] hw/misc/aspeed_sbc: Add machine parameter to alias OTP drive property Kane Chen via
2025-07-22 9:35 ` [SPAM] " Cédric Le Goater
2025-07-22 9:41 ` [SPAM] [PATCH v4 0/5] ASPEED OTP QEMU model: block backend, machine alias, SoC integration Cédric Le Goater
2025-07-22 10:03 ` Kane Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874iv4wmdv.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=kane_chen@aspeedtech.com \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).