From: Pierre Morel <pmorel@linux.ibm.com>
To: Andrew Jones <drjones@redhat.com>, Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com,
imbrenda@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH 1/7] arm: virtio: move VIRTIO transport initialization inside virtio-mmio
Date: Mon, 8 Nov 2021 13:20:13 +0100 [thread overview]
Message-ID: <01ae5d24-8c9f-eed4-2023-ecd80938736e@linux.ibm.com> (raw)
In-Reply-To: <20211103074114.45cv5mkdcksxg4az@gator.home>
On 11/3/21 08:41, Andrew Jones wrote:
> On Wed, Nov 03, 2021 at 08:00:09AM +0100, Thomas Huth wrote:
>> Sorry for the late reply - still trying to get my Inbox under control again ...
>>
>> On 27/08/2021 12.17, Pierre Morel wrote:
>>> To be able to use different VIRTIO transport in the future we need
>>> the initialisation entry call of the transport to be inside the
>>> transport file and keep the VIRTIO level transport agnostic.
>>>
>>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>>> ---
>>> lib/virtio-mmio.c | 2 +-
>>> lib/virtio-mmio.h | 2 --
>>> lib/virtio.c | 5 -----
>>> 3 files changed, 1 insertion(+), 8 deletions(-)
>>>
>>> diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
>>> index e5e8f660..fb8a86a3 100644
>>> --- a/lib/virtio-mmio.c
>>> +++ b/lib/virtio-mmio.c
>>> @@ -173,7 +173,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
>>> return &vm_dev->vdev;
>>> }
>>> -struct virtio_device *virtio_mmio_bind(u32 devid)
>>> +struct virtio_device *virtio_bind(u32 devid)
>>> {
>>> return virtio_mmio_dt_bind(devid);
>>> }
>>> diff --git a/lib/virtio-mmio.h b/lib/virtio-mmio.h
>>> index 250f28a0..73ddbd23 100644
>>> --- a/lib/virtio-mmio.h
>>> +++ b/lib/virtio-mmio.h
>>> @@ -60,6 +60,4 @@ struct virtio_mmio_device {
>>> void *base;
>>> };
>>> -extern struct virtio_device *virtio_mmio_bind(u32 devid);
>>> -
>>> #endif /* _VIRTIO_MMIO_H_ */
>>> diff --git a/lib/virtio.c b/lib/virtio.c
>>> index 69054757..e10153b9 100644
>>> --- a/lib/virtio.c
>>> +++ b/lib/virtio.c
>>> @@ -123,8 +123,3 @@ void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len)
>>> return ret;
>>> }
>>> -
>>> -struct virtio_device *virtio_bind(u32 devid)
>>> -{
>>> - return virtio_mmio_bind(devid);
>>> -}
>>>
>>
>> I agree that this needs to be improved somehow, but I'm not sure whether
>> moving the function to virtio-mmio.c is the right solution. I guess the
>> original idea was that virtio_bind() could cope with multiple transports,
>> i.e. when there is support for virtio-pci, it could choose between mmio and
>> pci on ARM, or between CCW and PCI on s390x.
>
> That's right. If we wanted to use virtio-pci on ARM, then, after
> implementing virtio_pci_bind(), we'd change this to
>
> struct virtio_device *virtio_bind(u32 devid)
> {
> struct virtio_device *dev = virtio_mmio_bind(devid);
>
> if (!dev)
> dev = virtio_pci_bind(devid);
>
> return dev;
> }
>
> Then, we'd use config selection logic in the test harness to decide how to
> construct the QEMU command line in order to choose between mmio and pci.
OK, I understand.
>
>>
>> So maybe this should rather get an "#if defined(__arm__) ||
>> defined(__aarch64__)" instead? Drew, what's your opinion here?
>
> Yup, but I think I'd prefer we do it in the header, like below, and
> then also implement something like the above for virtio_bind().
>
> diff --git a/lib/virtio-mmio.h b/lib/virtio-mmio.h
> index 250f28a0d300..a0a3bf827156 100644
> --- a/lib/virtio-mmio.h
> +++ b/lib/virtio-mmio.h
> @@ -60,6 +60,13 @@ struct virtio_mmio_device {
> void *base;
> };
>
> +#if defined(__arm__) || defined(__aarch64__)
> extern struct virtio_device *virtio_mmio_bind(u32 devid);
> +#else
> +static inline struct virtio_device *virtio_mmio_bind(u32 devid)
> +{
> + return NULL;
> +}
> +#endif
>
> #endif /* _VIRTIO_MMIO_H_ */
>
>
> Thanks,
> drew
>
Thanks, I will modify accordingly.
Regards,
Pierre
--
Pierre Morel
IBM Lab Boeblingen
next prev parent reply other threads:[~2021-11-08 12:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 10:17 [kvm-unit-tests PATCH 0/7] Extending VIRTIO with a data transfer test Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 1/7] arm: virtio: move VIRTIO transport initialization inside virtio-mmio Pierre Morel
2021-11-03 7:00 ` Thomas Huth
2021-11-03 7:41 ` Andrew Jones
2021-11-08 12:20 ` Pierre Morel [this message]
2021-08-27 10:17 ` [kvm-unit-tests PATCH 2/7] s390x: css: add callback for emnumeration Pierre Morel
2021-11-03 7:29 ` Thomas Huth
2021-11-08 12:21 ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 3/7] s390x: virtio: CCW transport implementation Pierre Morel
2021-11-03 7:46 ` Andrew Jones
2021-11-08 12:35 ` Pierre Morel
2021-11-03 7:49 ` Thomas Huth
2021-11-08 12:34 ` Pierre Morel
2021-11-09 7:01 ` Thomas Huth
2021-11-09 8:51 ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 4/7] s390x: css: registering IRQ Pierre Morel
2021-11-03 8:01 ` Thomas Huth
2021-11-08 12:36 ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 5/7] virtio: implement the virtio_add_inbuf routine Pierre Morel
2021-11-03 7:51 ` Andrew Jones
2021-11-08 12:36 ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 6/7] s390x: virtio tests setup Pierre Morel
2021-11-03 7:56 ` Andrew Jones
2021-11-03 8:14 ` Thomas Huth
2021-11-08 13:00 ` Pierre Morel
2021-11-09 7:10 ` Thomas Huth
2021-11-09 8:42 ` Andrew Jones
2021-11-09 9:01 ` Pierre Morel
2021-11-08 12:53 ` Pierre Morel
2021-08-27 10:17 ` [kvm-unit-tests PATCH 7/7] s390x: virtio data transfer Pierre Morel
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=01ae5d24-8c9f-eed4-2023-ecd80938736e@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=david@redhat.com \
--cc=drjones@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.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