qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tomoyuki HIROSE <tomoyuki.hirose@igel.co.jp>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, kbusch@kernel.org, its@irrelevant.dk,
	foss@defmacro.it, qemu-block@nongnu.org, pbonzini@redhat.com,
	peterx@redhat.com, david@redhat.com, philmd@linaro.org,
	farosas@suse.de, lvivier@redhat.com
Subject: Re: [RFC PATCH 0/5] support unaligned access to xHCI Capability
Date: Fri, 29 Nov 2024 12:33:35 +0900	[thread overview]
Message-ID: <ce5fc614-a54c-4003-b27f-6f08e56dbf08@igel.co.jp> (raw)
In-Reply-To: <CAFEAcA85NOxbmzpCT-5jv5uvcFH2WU5zm+fRTAK-VVG6LQRLbQ@mail.gmail.com>

On 2024/11/28 20:15, Peter Maydell wrote:

> On Thu, 28 Nov 2024 at 06:19, Tomoyuki HIROSE
> <tomoyuki.hirose@igel.co.jp> wrote:
>> Hi, thank you for your comment.
>>
>> On 2024/11/27 20:23, Peter Maydell wrote:
>>> On Wed, 27 Nov 2024 at 04:34, Tomoyuki HIROSE
>>> <tomoyuki.hirose@igel.co.jp> wrote:
>>>> I would be happy to receive your comments.
>>>> ping.
>>> Hi; this one is on my to-review list (along, sadly, with 23 other
>>> series); I had a quick look a while back and it seemed good
>>> (the testing support you've added looks great), but I need
>>> to sit down and review the implementation more carefully.
>>>
>>> The one concern I did have was the big long list of macro
>>> invocations in the memaccess-testdev device. I wonder if it
>>> would be more readable and more compact to fill in MemoryRegionOps
>>> structs at runtime using loops in C code, rather than trying to do
>>> it all at compile time with macros ?
>> I also want to do as you say. But I don't know how to generate
>> MemoryRegionOps structs at runtime. We need to set read/write function
>> to each structs, but I don't know a simple method how to generate a
>> function at runtime. Sorry for my lack C knowledge. Do you know about
>> any method how to generate a function at runtime in C ?
> Your code doesn't generate any functions in the macros, though --
> the functions are always memaccess_testdev_{read,write}_{big,little},
> which are defined outside any macro.
>
> The macros are only creating structures. Those you can populate
> at runtime using normal assignments:
>
>     for (valid_max = 1; valid_max < 16; valid_max <<= 1) {
>         [other loops on valid_min, impl_max, etc, go here]
>         MemoryRegionOps *memops = whatever;
>         memops->read = memaccess_testdev_read_little;
>         memops->write = memaccess_testdev_write_little;
>         memops->valid.max_access_size = valid_max;
>         etc...
>     }
>
> It just happens that for almost all MemoryRegionOps in
> QEMU the contents are known at compile time and so we
> make them static const at file scope.

OK, thanks! I got understand. I thought MemoryRegionOps had to be
'static const' .
I will try to improve code so that it does not require the use of
memaccess-testdev.h.inc .

thanks,
Tomoyuki HIROSE



  reply	other threads:[~2024-11-29  3:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  3:29 [RFC PATCH 0/5] support unaligned access to xHCI Capability Tomoyuki HIROSE
2024-11-08  3:29 ` [RFC PATCH 1/5] hw/nvme/ctrl: specify the 'valid' field in MemoryRegionOps Tomoyuki HIROSE
2024-11-08  3:29 ` [RFC PATCH 2/5] system/memory: support unaligned access Tomoyuki HIROSE
2024-12-02 21:23   ` Peter Xu
2024-12-06  8:31     ` Tomoyuki HIROSE
2024-12-06 16:42       ` Peter Xu
2024-12-11  9:35         ` Tomoyuki HIROSE
2024-12-11 22:54           ` Peter Xu
2024-12-12  5:39             ` Tomoyuki HIROSE
2024-12-12 15:46               ` Peter Xu
2025-01-08  2:58                 ` Tomoyuki HIROSE
2025-01-08 16:50                   ` Peter Xu
2025-01-10 10:11                     ` Tomoyuki HIROSE
2025-01-10 15:08                       ` Peter Xu
2025-01-15  2:01                         ` Tomoyuki HIROSE
2024-12-11  9:56         ` Peter Maydell
2024-12-11 22:25           ` Peter Xu
2024-11-08  3:29 ` [RFC PATCH 3/5] hw/misc: add test device for memory access Tomoyuki HIROSE
2024-11-08  3:29 ` [RFC PATCH 4/5] tests/qtest: add test for memory region access Tomoyuki HIROSE
2024-11-08  3:29 ` [RFC PATCH 5/5] hw/usb/hcd-xhci: allow unaligned access to Capability Registers Tomoyuki HIROSE
2024-11-27  4:32 ` [RFC PATCH 0/5] support unaligned access to xHCI Capability Tomoyuki HIROSE
2024-11-27 11:23   ` Peter Maydell
2024-11-28  6:19     ` Tomoyuki HIROSE
2024-11-28 11:15       ` Peter Maydell
2024-11-29  3:33         ` Tomoyuki HIROSE [this message]
2024-12-02 14:17           ` Peter Maydell
2024-12-04 10:04             ` Tomoyuki HIROSE

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=ce5fc614-a54c-4003-b27f-6f08e56dbf08@igel.co.jp \
    --to=tomoyuki.hirose@igel.co.jp \
    --cc=david@redhat.com \
    --cc=farosas@suse.de \
    --cc=foss@defmacro.it \
    --cc=its@irrelevant.dk \
    --cc=kbusch@kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.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 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).