From: Anthony PERARD <anthony.perard@citrix.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Alistair Francis" <alistair@alistair23.me>,
qemu-devel@nongnu.org,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Cédric Le Goater" <clg@kaod.org>,
pbonzini@redhat.com, "Igor Mammedov" <imammedo@redhat.com>,
"open list:PReP" <qemu-ppc@nongnu.org>,
"Joel Stanley" <joel@jms.id.au>
Subject: Re: [PATCH] acpi: Fix access to PM1 control and status registers
Date: Fri, 10 Jul 2020 10:42:58 +0100 [thread overview]
Message-ID: <20200710094258.GF2030@perard.uk.xensource.com> (raw)
In-Reply-To: <20200702063310-mutt-send-email-mst@kernel.org>
On Thu, Jul 02, 2020 at 07:12:08AM -0400, Michael S. Tsirkin wrote:
> memory: align to min access size
>
> If impl.min_access_size > valid.min_access_size access callbacks
> can get a misaligned access as size is increased.
> They don't expect that, let's fix it in the memory core.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ---
>
>
> diff --git a/memory.c b/memory.c
> index 9200b20130..ea489ce405 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -532,6 +532,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
> }
>
> /* FIXME: support unaligned access? */
> + addr &= ~(access_size_min - 1);
> access_size = MAX(MIN(size, access_size_max), access_size_min);
> access_mask = MAKE_64BIT_MASK(0, access_size * 8);
> if (memory_region_big_endian(mr)) {
I've tried this (and .impl.min_access_size=2) but that wasn't enough.
In the guest, I did `inb(base_addr + 1)`, but I've got back the value as
if `inb(base_addr)` was run.
The device emulation read callbacks did get addr=0 width=2, so that's
fine, but the result returned to the guest wasn't shifted. Same thing
for write access, the write value isn't shifted, so a write to the
second byte would be written to the first.
Thanks,
--
Anthony PERARD
next prev parent reply other threads:[~2020-07-10 9:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 11:05 [PATCH] acpi: Fix access to PM1 control and status registers Anthony PERARD
2020-07-01 12:01 ` Michael S. Tsirkin
2020-07-01 12:48 ` Anthony PERARD
2020-07-02 11:12 ` Michael S. Tsirkin
2020-07-10 9:42 ` Anthony PERARD [this message]
2020-07-23 12:44 ` Michael S. Tsirkin
2020-07-23 13:08 ` Anthony PERARD
2020-07-16 9:05 ` Cédric Le Goater
2020-07-23 12:46 ` Michael S. Tsirkin
2020-07-23 12:54 ` Michael Tokarev
2020-07-23 13:14 ` Anthony PERARD
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=20200710094258.GF2030@perard.uk.xensource.com \
--to=anthony.perard@citrix.com \
--cc=alistair@alistair23.me \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=hpoussin@reactos.org \
--cc=imammedo@redhat.com \
--cc=joel@jms.id.au \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.