diff mbox

[PULL,00/10] Fix device introspection regressions

Message ID 87612k35yf.fsf@blackfin.pond.sub.org
State New
Headers show

Commit Message

Markus Armbruster Oct. 6, 2015, 5:46 a.m. UTC
Peter Maydell <peter.maydell@linaro.org> writes:

> On 5 October 2015 at 20:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>>
>> On 05/10/2015 20:46, Peter Maydell wrote:
>>> The easy fix is to have some suitable ifdeffery in virtio-pci.c,
>>> similar to how we only register the virtio_9p_pci and virtio_scsi_pci
>>
>> (vhost_scsi_pci)
>>
>>> types if they've been configured into this build.
>>
>> Hmm, actually there's no reason to limit
>>
>> common-obj-$(CONFIG_VIRTIO) += virtio-input.o
>> common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
>>
>> to CONFIG_LINUX.  Does it work to extract them out of the if (which is
>> only correct for virtio-input-host.o)?
>
> Yes, though as you predicted we then fall over on virtio-input-host-pci.
> If I bodge that one out in virtio-pci.c then the device-introspect-test
> passes.

Does this do the trick?  If yes, I'll fill out the commit message and
post it properly.

From e5ebf2f0680fcf145455db048b82cf8e5d9d6b9f Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Tue, 6 Oct 2015 07:43:18 +0200
Subject: [PATCH] virtio-input: Fix device introspection on non-Linux hosts WIP

---
 hw/input/Makefile.objs | 2 +-
 hw/virtio/virtio-pci.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Peter Maydell Oct. 6, 2015, 8:05 a.m. UTC | #1
On 6 October 2015 at 06:46, Markus Armbruster <armbru@redhat.com> wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:
>
>> On 5 October 2015 at 20:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>>
>>> On 05/10/2015 20:46, Peter Maydell wrote:
>>>> The easy fix is to have some suitable ifdeffery in virtio-pci.c,
>>>> similar to how we only register the virtio_9p_pci and virtio_scsi_pci
>>>
>>> (vhost_scsi_pci)
>>>
>>>> types if they've been configured into this build.
>>>
>>> Hmm, actually there's no reason to limit
>>>
>>> common-obj-$(CONFIG_VIRTIO) += virtio-input.o
>>> common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
>>>
>>> to CONFIG_LINUX.  Does it work to extract them out of the if (which is
>>> only correct for virtio-input-host.o)?
>>
>> Yes, though as you predicted we then fall over on virtio-input-host-pci.
>> If I bodge that one out in virtio-pci.c then the device-introspect-test
>> passes.
>
> Does this do the trick?  If yes, I'll fill out the commit message and
> post it properly.

This is what I tested, yes, but...

> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index eda8205..23f131b 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2228,7 +2228,9 @@ static void virtio_pci_register_types(void)
>      type_register_static(&virtio_keyboard_pci_info);
>      type_register_static(&virtio_mouse_pci_info);
>      type_register_static(&virtio_tablet_pci_info);
> +#ifdef CONFIG_LINUX
>      type_register_static(&virtio_host_pci_info);
> +#endif
>      type_register_static(&virtio_pci_bus_info);
>      type_register_static(&virtio_pci_info);
>  #ifdef CONFIG_VIRTFS

...this will get you warnings about unused variables/data -- you
need to #ifdef out the definition of virtio_host_pci_info and
all the static functions it references too.

thanks
-- PMM
Markus Armbruster Oct. 6, 2015, 8:45 a.m. UTC | #2
Peter Maydell <peter.maydell@linaro.org> writes:

> On 6 October 2015 at 06:46, Markus Armbruster <armbru@redhat.com> wrote:
>> Peter Maydell <peter.maydell@linaro.org> writes:
>>
>>> On 5 October 2015 at 20:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>
>>>>
>>>> On 05/10/2015 20:46, Peter Maydell wrote:
>>>>> The easy fix is to have some suitable ifdeffery in virtio-pci.c,
>>>>> similar to how we only register the virtio_9p_pci and virtio_scsi_pci
>>>>
>>>> (vhost_scsi_pci)
>>>>
>>>>> types if they've been configured into this build.
>>>>
>>>> Hmm, actually there's no reason to limit
>>>>
>>>> common-obj-$(CONFIG_VIRTIO) += virtio-input.o
>>>> common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
>>>>
>>>> to CONFIG_LINUX.  Does it work to extract them out of the if (which is
>>>> only correct for virtio-input-host.o)?
>>>
>>> Yes, though as you predicted we then fall over on virtio-input-host-pci.
>>> If I bodge that one out in virtio-pci.c then the device-introspect-test
>>> passes.
>>
>> Does this do the trick?  If yes, I'll fill out the commit message and
>> post it properly.
>
> This is what I tested, yes, but...
>
>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
>> index eda8205..23f131b 100644
>> --- a/hw/virtio/virtio-pci.c
>> +++ b/hw/virtio/virtio-pci.c
>> @@ -2228,7 +2228,9 @@ static void virtio_pci_register_types(void)
>>      type_register_static(&virtio_keyboard_pci_info);
>>      type_register_static(&virtio_mouse_pci_info);
>>      type_register_static(&virtio_tablet_pci_info);
>> +#ifdef CONFIG_LINUX
>>      type_register_static(&virtio_host_pci_info);
>> +#endif
>>      type_register_static(&virtio_pci_bus_info);
>>      type_register_static(&virtio_pci_info);
>>  #ifdef CONFIG_VIRTFS
>
> ...this will get you warnings about unused variables/data -- you
> need to #ifdef out the definition of virtio_host_pci_info and
> all the static functions it references too.

I'll finish the job and post for real.  Thanks!
diff mbox

Patch

diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs
index 624ba7e..7715d72 100644
--- a/hw/input/Makefile.objs
+++ b/hw/input/Makefile.objs
@@ -8,9 +8,9 @@  common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
 common-obj-$(CONFIG_TSC2005) += tsc2005.o
 common-obj-$(CONFIG_VMMOUSE) += vmmouse.o
 
-ifeq ($(CONFIG_LINUX),y)
 common-obj-$(CONFIG_VIRTIO) += virtio-input.o
 common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
+ifeq ($(CONFIG_LINUX),y)
 common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o
 endif
 
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index eda8205..23f131b 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -2228,7 +2228,9 @@  static void virtio_pci_register_types(void)
     type_register_static(&virtio_keyboard_pci_info);
     type_register_static(&virtio_mouse_pci_info);
     type_register_static(&virtio_tablet_pci_info);
+#ifdef CONFIG_LINUX
     type_register_static(&virtio_host_pci_info);
+#endif
     type_register_static(&virtio_pci_bus_info);
     type_register_static(&virtio_pci_info);
 #ifdef CONFIG_VIRTFS