qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tan Siewert <tan@siewert.io>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-devel@nongnu.org
Cc: 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>,
	qemu-arm@nongnu.org
Subject: Re: [PATCH] hw/misc/aspeed_scu: Handle AST2600 protection key registers correctly
Date: Thu, 12 Jun 2025 16:01:37 +0200	[thread overview]
Message-ID: <e898d975-d03a-4858-a26c-5f6c9a9c80c7@siewert.io> (raw)
In-Reply-To: <418f66a3-f7de-45d1-a076-9f14447c6bd3@kaod.org>

On 12.06.25 08:58, Cédric Le Goater wrote:
> LGTM,
> 
> Jamin, Steven, Troy ?
> 

On 12.06.25 01:43, Tan Siewert wrote:
>> -    if (reg > PROT_KEY && !s->regs[PROT_KEY]) {
>> +    if ((reg != AST2600_PROT_KEY && reg != AST2600_PROT_KEY2) && ! 
>> unlocked) {
>>           qemu_log_mask(LOG_GUEST_ERROR, "%s: SCU is locked!\n", 
>> __func__);
>>       }

I just noticed that this never return when the SCU is locked, meaning 
you can still write to the SCU registers even though it is locked. I'll 
send a v2 in a few minutes that addresses this issue too.

The AST2500 SCU handles this correctly here.

Sorry for that!

Cheers,
Tan

>> @@ -738,7 +740,18 @@ static void aspeed_ast2600_scu_write(void 
>> *opaque, hwaddr offset,
>>       switch (reg) {
>>       case AST2600_PROT_KEY:
>> -        s->regs[reg] = (data == ASPEED_SCU_PROT_KEY) ? 1 : 0;
>> +    case AST2600_PROT_KEY2:
>> +        /*
>> +         * Writing a value other than the protection key will lock
>> +         * both protection registers, but unlocking must be done
>> +         * to each protection register individually.
>> +         */
>> +        if (data != ASPEED_SCU_PROT_KEY) {
>> +            s->regs[AST2600_PROT_KEY] = 0;
>> +            s->regs[AST2600_PROT_KEY2] = 0;
>> +        } else {
>> +            s->regs[reg] = (data == ASPEED_SCU_PROT_KEY) ? 1 : 0;
>> +        }
>>           return;
>>       case AST2600_HW_STRAP1:
>>       case AST2600_HW_STRAP2:
> 



      reply	other threads:[~2025-06-12 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 23:43 [PATCH] hw/misc/aspeed_scu: Handle AST2600 protection key registers correctly Tan Siewert
2025-06-12  6:58 ` Cédric Le Goater
2025-06-12 14:01   ` Tan Siewert [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=e898d975-d03a-4858-a26c-5f6c9a9c80c7@siewert.io \
    --to=tan@siewert.io \
    --cc=andrew@codeconstruct.com.au \
    --cc=clg@kaod.org \
    --cc=jamin_lin@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=leetroy@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=steven_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).