qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"Peng, Chao P" <chao.p.peng@intel.com>
Subject: Re: [PATCH] vfio: Introduce helper vfio_device_to_vfio_pci()
Date: Thu, 31 Jul 2025 14:03:26 +0200	[thread overview]
Message-ID: <b0af165f-b464-4479-b2fb-bb9e7ebdb5be@redhat.com> (raw)
In-Reply-To: <a5b7729f-ca9b-44c8-9ec9-89fdf2636340@linaro.org>

On 7/31/25 13:24, Philippe Mathieu-Daudé wrote:
> On 31/7/25 10:49, Duan, Zhenzhong wrote:
>>
>>
>>> -----Original Message-----
>>> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>>> Subject: Re: [PATCH] vfio: Introduce helper vfio_device_to_vfio_pci()
>>>
>>> Hi,
>>>
>>> On 31/7/25 05:31, Zhenzhong Duan wrote:
>>>> Introduce helper vfio_device_to_vfio_pci() to transform from VFIODevice to
>>>> VFIOPCIDevice, also to hide low level VFIO_DEVICE_TYPE_PCI type check.
>>>>
>>>> Suggested-by: Cédric Le Goater <clg@redhat.com>
>>>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>>>> ---
>>>>    include/hw/vfio/vfio-device.h |  1 +
>>>>    hw/vfio/container.c           |  4 ++--
>>>>    hw/vfio/device.c              | 10 +++++++++-
>>>>    hw/vfio/iommufd.c             |  4 ++--
>>>>    hw/vfio/listener.c            |  4 ++--
>>>>    5 files changed, 16 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h
>>>> index 6e4d5ccdac..00df40d997 100644
>>>> --- a/include/hw/vfio/vfio-device.h
>>>> +++ b/include/hw/vfio/vfio-device.h
>>>> @@ -157,6 +157,7 @@ bool vfio_device_attach_by_iommu_type(const
>>> char *iommu_type, char *name,
>>>>                                          Error **errp);
>>>>    void vfio_device_detach(VFIODevice *vbasedev);
>>>>    VFIODevice *vfio_get_vfio_device(Object *obj);
>>>> +struct VFIOPCIDevice *vfio_device_to_vfio_pci(VFIODevice *vbasedev);
>>>
>>> Please return the typedef (like in the implementation), not the struct.
>>
>> That will break build. VFIOPCIDevice is defined in internal header hw/vfio/pci.h,
>> while include/hw/vfio/vfio-device.h is public header, I'm not sure if it's right way to include internal header in public header.
> 
> Moving the following line:
> 
>    OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE)
> 
> from hw/vfio/pci.h to include/hw/vfio/vfio-device.h should be enough.

I rather not. These are 2 differents subcomponents.

vfio_device_to_vfio_pci() could be moved.

Thanks,

C.



      reply	other threads:[~2025-07-31 12:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  3:31 [PATCH] vfio: Introduce helper vfio_device_to_vfio_pci() Zhenzhong Duan
2025-07-31  8:01 ` Cédric Le Goater
2025-07-31  8:26 ` Philippe Mathieu-Daudé
2025-07-31  8:49   ` Duan, Zhenzhong
2025-07-31 11:24     ` Philippe Mathieu-Daudé
2025-07-31 12:03       ` Cédric Le Goater [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=b0af165f-b464-4479-b2fb-bb9e7ebdb5be@redhat.com \
    --to=clg@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=chao.p.peng@intel.com \
    --cc=eric.auger@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhenzhong.duan@intel.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).