qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andrew Jeffery" <andrew@aj.id.au>
To: "Peter Delevoryas" <peter@pjd.dev>
Cc: "Cameron Esfahani via" <qemu-devel@nongnu.org>
Subject: Re: [PATCH 1/2] hw/gpio/aspeed: Don't let guests modify input pins
Date: Mon, 18 Jul 2022 10:37:50 +0930	[thread overview]
Message-ID: <fb2f74b4-67c9-4b0a-89a8-0704e7d446bb@www.fastmail.com> (raw)
In-Reply-To: <YszVIJrPXFmMMZ/A@pdel-mbp.dhcp.thefacebook.com>

I think we've sorted this out, but replying to finalise the conversation

On Tue, 12 Jul 2022, at 11:27, Peter Delevoryas wrote:
> On Mon, Jul 11, 2022 at 10:56:08PM +0930, Andrew Jeffery wrote:
>>  
>>  /*
>> @@ -607,7 +608,7 @@ static void aspeed_gpio_write(void *opaque, hwaddr offset, uint64_t data,
>>          data &= props->output;
>>          data = update_value_control_source(set, set->data_value, data);
>>          set->data_read = data;
>> -        aspeed_gpio_update(s, set, data);
>> +        aspeed_gpio_update(s, set, data, set->direction);
>>          return;
>>      case gpio_reg_direction:
>>          /*
>> @@ -683,7 +684,7 @@ static void aspeed_gpio_write(void *opaque, hwaddr offset, uint64_t data,
>>                        HWADDR_PRIx"\n", __func__, offset);
>>          return;
>>      }
>> -    aspeed_gpio_update(s, set, set->data_value);
>> +    aspeed_gpio_update(s, set, set->data_value, UINT32_MAX);
>
> Looks great overall, but why is the mode_mask UINT32_MAX here? Shouldn't it be
> set->direction? We only want to let the guest OS write to output pins, right?
> Or is that not how the register works?

The set->direction case is handled in the top hunk which handles the 
data register write. Note that it performs an early return.

The bottom hunk deals with making the value register consistent when 
we've updated any register that isn't the data register.

Andrew


  reply	other threads:[~2022-07-18  1:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220707071731.34047-1-peter@pjd.dev>
2022-07-07  7:17 ` [PATCH 1/2] hw/gpio/aspeed: Don't let guests modify input pins Peter Delevoryas
2022-07-07  8:20   ` Joel Stanley
2022-07-07 17:50     ` Peter Delevoryas
2022-07-11 12:25     ` Andrew Jeffery
2022-07-07  8:56   ` Cédric Le Goater
2022-07-07 17:53     ` Peter Delevoryas
2022-07-07 19:04       ` Peter Delevoryas
2022-07-11  8:13         ` Cédric Le Goater
2022-07-11 13:26         ` Andrew Jeffery
2022-07-12  1:57           ` Peter Delevoryas
2022-07-18  1:07             ` Andrew Jeffery [this message]
2022-07-07  7:17 ` [PATCH 2/2] aspeed: Add fby35-bmc slot GPIO's Peter Delevoryas
2022-07-07  7:26 ` [PATCH 0/2] hw/gpio/aspeed: Don't let guests modify input pins Peter Delevoryas

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=fb2f74b4-67c9-4b0a-89a8-0704e7d446bb@www.fastmail.com \
    --to=andrew@aj.id.au \
    --cc=peter@pjd.dev \
    --cc=qemu-devel@nongnu.org \
    /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).