qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Jonah Palmer <jonah.palmer@oracle.com>,
	qemu-devel@nongnu.org, Thomas Huth <thuth@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Greg Kurz" <groug@kaod.org>
Subject: Re: [PATCH-for-8.0 v2 6/6] hw/virtio: Extract QMP related code virtio-qmp.c
Date: Thu, 22 Dec 2022 08:48:54 +0100	[thread overview]
Message-ID: <2f2cdcff-2433-4d41-ead4-62f0438bc45f@linaro.org> (raw)
In-Reply-To: <5698a91c-a181-a8a9-f19b-32ebe5ecb46d@oracle.com>

On 19/12/22 14:31, Jonah Palmer wrote:
> 
> On 12/13/22 06:17, Philippe Mathieu-Daudé wrote:
>> The monitor decoders are the only functions using the CONFIG_xxx
>> definitions declared in the target specific CONFIG_DEVICES header.
>>
>> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
>> ---
>>   hw/virtio/meson.build  |   2 +-
>>   hw/virtio/virtio-qmp.c | 659 +++++++++++++++++++++++++++++++++++++++++
>>   hw/virtio/virtio-qmp.h |  20 ++
>>   hw/virtio/virtio.c     | 635 +--------------------------------------
>>   4 files changed, 682 insertions(+), 634 deletions(-)
>>   create mode 100644 hw/virtio/virtio-qmp.c
>>   create mode 100644 hw/virtio/virtio-qmp.h

> I haven't tried this myself, but is there a reason why we're not also including
> the 'qmp_decode_vring_desc_flags' function here?

Because we use VirtQueue as an opaque forward-declared structure.

The structure is declared in hw/virtio/virtio.c, which is where
the internal fields are accessed.

If I move qmp_x_query_virtio_queue_status() and
qmp_x_query_virtio_queue_element(), which calls
qmp_decode_vring_desc_flags(), I get:

../hw/virtio/virtio-qmp.c:874:35: error: subscript of pointer to 
incomplete type 'VirtQueue' (aka 'struct VirtQueue')
     status->queue_index = vdev->vq[queue].queue_index;
                           ~~~~~~~~^
include/hw/virtio/virtio.h:39:8: note: forward declaration of 'struct 
VirtQueue'
struct VirtQueue;
        ^

Now you are right the QOM-generic functions (qmp_x_query_virtio,
qmp_x_query_virtio_status and qmp_x_query_virtio_vhost_queue_status)
can be moved.

Thanks for your review,

Phil.


      reply	other threads:[~2022-12-22  7:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 11:17 [PATCH-for-8.0 v2 0/6] hw/virtio: Split ioconfig / qmp code from virtio.c Philippe Mathieu-Daudé
2022-12-13 11:17 ` [PATCH-for-8.0 v2 1/6] hw/virtio: Add missing "hw/core/cpu.h" include Philippe Mathieu-Daudé
2022-12-13 11:17 ` [PATCH-for-8.0 v2 2/6] hw/virtio: Rename virtio_ss[] -> specific_virtio_ss[] Philippe Mathieu-Daudé
2022-12-13 11:17 ` [PATCH-for-8.0 v2 3/6] hw/virtio: Guard and restrict scope of qmp_virtio_feature_map_t[] Philippe Mathieu-Daudé
2022-12-19 12:59   ` Jonah Palmer
2022-12-13 11:17 ` [PATCH-for-8.0 v2 4/6] hw/virtio: Constify qmp_virtio_feature_map_t[] Philippe Mathieu-Daudé
2022-12-19 13:25   ` Jonah Palmer
2022-12-13 11:17 ` [PATCH-for-8.0 v2 5/6] hw/virtio: Extract config read/write accessors to virtio-config-io.c Philippe Mathieu-Daudé
2022-12-13 11:17 ` [PATCH-for-8.0 v2 6/6] hw/virtio: Extract QMP related code virtio-qmp.c Philippe Mathieu-Daudé
2022-12-19 13:31   ` Jonah Palmer
2022-12-22  7:48     ` Philippe Mathieu-Daudé [this message]

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=2f2cdcff-2433-4d41-ead4-62f0438bc45f@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=groug@kaod.org \
    --cc=jonah.palmer@oracle.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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).