From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"John Snow" <jsnow@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [PATCH 05/14] ppc/vof: Fix unaligned FDT property access
Date: Thu, 27 Jun 2024 23:06:54 +0900 [thread overview]
Message-ID: <6fb59b79-88d4-44d9-bf57-127d6eada90a@daynix.com> (raw)
In-Reply-To: <4b713ad2-1f92-49d1-88b9-6185a1b50062@linaro.org>
On 2024/06/27 23:02, Philippe Mathieu-Daudé wrote:
> On 27/6/24 15:12, Akihiko Odaki wrote:
>> On 2024/06/26 21:03, Philippe Mathieu-Daudé wrote:
>>> On 26/6/24 13:06, Akihiko Odaki wrote:
>>>> FDT properties are aligned by 4 bytes, not 8 bytes.
>>>>
>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>> ---
>>>> hw/ppc/vof.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
>>>> index e3b430a81f4f..b5b6514d79fc 100644
>>>> --- a/hw/ppc/vof.c
>>>> +++ b/hw/ppc/vof.c
>>>> @@ -646,7 +646,7 @@ static void vof_dt_memory_available(void *fdt,
>>>> GArray *claimed, uint64_t base)
>>>> mem0_reg = fdt_getprop(fdt, offset, "reg", &proplen);
>>>> g_assert(mem0_reg && proplen == sizeof(uint32_t) * (ac + sc));
>>>> if (sc == 2) {
>>>> - mem0_end = be64_to_cpu(*(uint64_t *)(mem0_reg +
>>>> sizeof(uint32_t) * ac));
>>>> + mem0_end = ldq_be_p(mem0_reg + sizeof(uint32_t) * ac);
>>>> } else {
>>>> mem0_end = be32_to_cpu(*(uint32_t *)(mem0_reg +
>>>> sizeof(uint32_t) * ac));
>>>
>>> OK but please keep API uses consistent, so convert other uses please.
>>
>> This is the only unaligned access.
>
> What I mean with consistent API use is either use the be64_to_cpu and
> be32_to_cpu API, or ldq_be_p and ldl_be_p. A mix of both makes review
> more confusing.
The desired semantics are different in these two cases so I believe it
is natural to use different APIs; ldq_be_p() for an unaligned 64-bit
access and be32_to_cpu(*(uint32_t *)) for an aligned 32-bit access.
next prev parent reply other threads:[~2024-06-27 14:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 11:06 [PATCH 00/14] Fix check-qtest-ppc64 sanitizer errors Akihiko Odaki
2024-06-26 11:06 ` [PATCH 01/14] hw/core: Free CPUState allocations Akihiko Odaki
2024-06-26 12:04 ` Philippe Mathieu-Daudé
2024-06-26 11:06 ` [PATCH 02/14] hw/ide: Free macio-ide IRQs Akihiko Odaki
2024-06-26 12:59 ` Peter Maydell
2024-06-28 7:16 ` Mark Cave-Ayland
2024-06-26 11:06 ` [PATCH 03/14] hw/isa/vt82c686: Free irqs Akihiko Odaki
2024-06-26 12:57 ` Peter Maydell
2024-06-26 11:06 ` [PATCH 04/14] spapr: Free stdout path Akihiko Odaki
2024-06-26 12:02 ` Philippe Mathieu-Daudé
2024-06-26 11:06 ` [PATCH 05/14] ppc/vof: Fix unaligned FDT property access Akihiko Odaki
2024-06-26 12:03 ` Philippe Mathieu-Daudé
2024-06-27 13:12 ` Akihiko Odaki
2024-06-27 14:02 ` Philippe Mathieu-Daudé
2024-06-27 14:06 ` Akihiko Odaki [this message]
2024-06-26 11:06 ` [PATCH 06/14] hw/virtio: Free vqs before vhost_dev_cleanup() Akihiko Odaki
2024-06-26 11:21 ` Michael S. Tsirkin
2024-06-26 11:06 ` [PATCH 07/14] migration: Free removed SaveStateEntry Akihiko Odaki
2024-06-26 13:32 ` Peter Xu
2024-06-26 11:06 ` [PATCH 08/14] memory: Do not create circular reference with subregion Akihiko Odaki
2024-06-26 11:06 ` [PATCH 09/14] tests/qtest: Use qtest_add_data_func_full() Akihiko Odaki
2024-06-26 11:06 ` [PATCH 10/14] tests/qtest: Free unused QMP response Akihiko Odaki
2024-06-26 11:06 ` [PATCH 11/14] tests/qtest: Free old machine variable name Akihiko Odaki
2024-06-26 11:06 ` [PATCH 12/14] tests/qtest: Delete previous boot file Akihiko Odaki
2024-06-26 11:06 ` [PATCH 13/14] tests/qtest: Free paths Akihiko Odaki
2024-06-26 11:06 ` [PATCH 14/14] tests/qtest: Free GThread Akihiko Odaki
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=6fb59b79-88d4-44d9-bf57-127d6eada90a@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=aik@ozlabs.ru \
--cc=alex.bennee@linaro.org \
--cc=balaton@eik.bme.hu \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=harshpb@linux.ibm.com \
--cc=jiaxun.yang@flygoat.com \
--cc=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.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).