From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Rayhan Faizel <rayhan.faizel@gmail.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org
Subject: Re: [PATCH 3/3] hw/misc: Implement mailbox properties for customer OTP and device specific private keys
Date: Mon, 13 May 2024 15:51:23 +0200 [thread overview]
Message-ID: <fd6de35c-dc98-4900-b542-946a132ca0f1@linaro.org> (raw)
In-Reply-To: <20240510141010.656561-4-rayhan.faizel@gmail.com>
On 10/5/24 16:10, Rayhan Faizel wrote:
> Four mailbox properties are implemented as follows:
> 1. Customer OTP: GET_CUSTOMER_OTP and SET_CUSTOMER_OTP
> 2. Device-specific private key: GET_PRIVATE_KEY and
> SET_PRIVATE_KEY.
>
> The customer OTP is located in the rows 36-43. The device-specific private key
> is located in the rows 56-63.
Better to define these instead of using magic values in the code,
i.e.:
#define OTP_PRIVATE_KEY_OFFSET 56
#define OTP_PRIVATE_KEY_LENGTH 8
> The customer OTP can be locked with the magic numbers 0xffffffff 0xaffe0000
> when running the SET_CUSTOMER_OTP mailbox command.
>
> P.S I am not sure if the magic lock combo applies to the private key as well.
>
> Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
> ---
> hw/arm/bcm2835_peripherals.c | 2 +
> hw/misc/bcm2835_property.c | 71 ++++++++++++++++++++++++++++
> include/hw/arm/raspberrypi-fw-defs.h | 2 +
> include/hw/misc/bcm2835_property.h | 2 +
> 4 files changed, 77 insertions(+)
> + /* Device-specific private key */
> +
> + case RPI_FWREQ_GET_PRIVATE_KEY:
> + start_num = ldl_le_phys(&s->dma_as, value + 12);
> + number = ldl_le_phys(&s->dma_as, value + 16);
> +
> + resplen = 8 + 4 * number;
> +
> + for (n = start_num; n < start_num + number && n < 8; n++) {
> + stl_le_phys(&s->dma_as,
> + value + 20 + ((n - start_num) << 2),
> + bcm2835_otp_read_row(s->otp, 56 + n));
> + }
> + break;
> + case RPI_FWREQ_SET_PRIVATE_KEY:
> + start_num = ldl_le_phys(&s->dma_as, value + 12);
> + number = ldl_le_phys(&s->dma_as, value + 16);
> +
> + resplen = 4;
> +
> + for (n = start_num; n < start_num + number && n < 8; n++) {
> + otp_row = ldl_le_phys(&s->dma_as,
> + value + 20 + ((n - start_num) << 2));
> + bcm2835_otp_write_row(s->otp, 56 + n, otp_row);
> + }
> + break;
prev parent reply other threads:[~2024-05-13 13:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 14:10 [PATCH 0/3] Initial support for One-Time Programmable Memory (OTP) in BCM2835 Rayhan Faizel
2024-05-10 14:10 ` [PATCH 1/3] hw/nvram: Add BCM2835 OTP device Rayhan Faizel
2024-05-13 13:30 ` Philippe Mathieu-Daudé
2024-05-13 13:49 ` Philippe Mathieu-Daudé
2024-05-10 14:10 ` [PATCH 2/3] hw/arm: Connect OTP device to BCM2835 Rayhan Faizel
2024-05-13 13:41 ` Philippe Mathieu-Daudé
2024-05-10 14:10 ` [PATCH 3/3] hw/misc: Implement mailbox properties for customer OTP and device specific private keys Rayhan Faizel
2024-05-13 13:51 ` Philippe Mathieu-Daudé [this message]
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=fd6de35c-dc98-4900-b542-946a132ca0f1@linaro.org \
--to=philmd@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rayhan.faizel@gmail.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).