From: Richard Henderson <rth@twiddle.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Anthony Liguori <aliguori@amazon.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw/i386: Use unaligned store functions building acpi tables
Date: Thu, 13 Mar 2014 06:30:01 -0700 [thread overview]
Message-ID: <5321B2D9.1000704@twiddle.net> (raw)
In-Reply-To: <CAFEAcA-bcy_g90ikRKzopbUaqMCsqvwBb99xnFhL5e90pT1KMA@mail.gmail.com>
On 03/12/2014 04:26 PM, Peter Maydell wrote:
> On 12 March 2014 22:25, Richard Henderson <rth@twiddle.net> wrote:
>> Hosts that don't support native unaligned stores will SIGBUS
>> without additional help.
>>
>> Signed-off-by: Richard Henderson <rth@twiddle.net>
>> ---
>> hw/i386/acpi-build.c | 29 +++++++++++++++--------------
>> 1 file changed, 15 insertions(+), 14 deletions(-)
>>
>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
>> index b1a7ebb..d636115 100644
>> --- a/hw/i386/acpi-build.c
>> +++ b/hw/i386/acpi-build.c
>> @@ -886,22 +886,24 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state)
>>
>> static void patch_pci_windows(PcPciInfo *pci, uint8_t *start, unsigned size)
>> {
>> - *ACPI_BUILD_PTR(start, size, acpi_pci32_start[0], uint32_t) =
>> - cpu_to_le32(pci->w32.begin);
>> + /* Note that these pointers are unaligned, so we must use routines
>> + that take care for unaligned stores on the host. */
>>
>> - *ACPI_BUILD_PTR(start, size, acpi_pci32_end[0], uint32_t) =
>> - cpu_to_le32(pci->w32.end - 1);
>> + stl_le_p(ACPI_BUILD_PTR(start, size, acpi_pci32_start[0], uint32_t),
>> + pci->w32.begin);
>> + stl_le_p(ACPI_BUILD_PTR(start, size, acpi_pci32_end[0], uint32_t),
>> + pci->w32.end - 1);
>
> See the mail thread on Michael's original patch -- he didn't like
> this because we end up writing the size of the store twice
> (once in the "l" suffix in the function name and once by passing
> a type to the ACP_BUILD_PTR function.
I missed the original thread somewhere.
> (That thread also has my personal preferred option in the comments,
> which uses stl_le_p and friends but via a wrapping macro.)
I'm in favour of any solution that doesn't duplicate the bswap logic, like the
version I responded to did.
r~
>
> Also you'll find this doesn't apply because a fix has already been
> committed on master...
>
>> - *(uint16_t *)(ssdt_ptr + *ssdt_isa_pest) =
>> - cpu_to_le16(misc->pvpanic_port);
>> + stw_le_p(ssdt_ptr + *ssdt_isa_pest, misc->pvpanic_port);
>
> Patch on list to fix this too I think.
>
> thanks
> -- PMM
>
next prev parent reply other threads:[~2014-03-13 13:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 19:43 [Qemu-devel] [PATCH 1/2] bswap.h: export bswap_le Michael S. Tsirkin
2014-03-10 19:43 ` [Qemu-devel] [PATCH 2/2] acpi-build: don't access unaligned addresses Michael S. Tsirkin
2014-03-12 22:24 ` Richard Henderson
2014-03-12 22:25 ` [Qemu-devel] [PATCH] hw/i386: Use unaligned store functions building acpi tables Richard Henderson
2014-03-12 23:26 ` Peter Maydell
2014-03-13 13:30 ` Richard Henderson [this message]
2014-03-12 22:21 ` [Qemu-devel] [PATCH 1/2] bswap.h: export bswap_le Richard Henderson
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=5321B2D9.1000704@twiddle.net \
--to=rth@twiddle.net \
--cc=aliguori@amazon.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--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 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.