diff mbox series

[RFC,15/35] hw/i386/xen/xen-hvm: Emit warning when old code is used

Message ID 20200608160044.15531-16-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/qdev: Warn when using pre-qdev/QOM devices | expand

Commit Message

Philippe Mathieu-Daudé June 8, 2020, 4 p.m. UTC
This code hasn't been QOM'ified yet. Warn the user.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/i386/xen/xen-hvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul Durrant June 8, 2020, 4:54 p.m. UTC | #1
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> Sent: 08 June 2020 17:00
> To: qemu-devel@nongnu.org
> Cc: qemu-arm@nongnu.org; Markus Armbruster <armbru@redhat.com>; Max Filippov <jcmvbkbc@gmail.com>;
> Marcel Apfelbaum <marcel.apfelbaum@gmail.com>; Peter Maydell <peter.maydell@linaro.org>; Michael Walle
> <michael@walle.cc>; Edgar E. Iglesias <edgar.iglesias@gmail.com>; Aurelien Jarno
> <aurelien@aurel32.net>; Gerd Hoffmann <kraxel@redhat.com>; Stafford Horne <shorne@gmail.com>; Andrzej
> Zaborowski <balrogg@gmail.com>; qemu-ppc@nongnu.org; Alistair Francis <alistair@alistair23.me>;
> Richard Henderson <rth@twiddle.net>; Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>; Marc-André
> Lureau <marcandre.lureau@redhat.com>; Daniel P . Berrange <berrange@redhat.com>; qemu-
> riscv@nongnu.org; Michael S. Tsirkin <mst@redhat.com>; xen-devel@lists.xenproject.org; Sagar
> Karandikar <sagark@eecs.berkeley.edu>; Anthony Perard <anthony.perard@citrix.com>; Palmer Dabbelt
> <palmer@dabbelt.com>; Stefano Stabellini <sstabellini@kernel.org>; Paul Durrant <paul@xen.org>; Paolo
> Bonzini <pbonzini@redhat.com>; Alistair Francis <Alistair.Francis@wdc.com>; Eduardo Habkost
> <ehabkost@redhat.com>; Thomas Huth <huth@tuxfamily.org>; Bastian Koppelmann <kbastian@mail.uni-
> paderborn.de>; David Gibson <david@gibson.dropbear.id.au>; Magnus Damm <magnus.damm@gmail.com>;
> Philippe Mathieu-Daudé <philmd@redhat.com>
> Subject: [RFC PATCH 15/35] hw/i386/xen/xen-hvm: Emit warning when old code is used
> 
> This code hasn't been QOM'ified yet. Warn the user.

"Based on today's IRC chat, this is a trivial RFC series
to anotate pre-qdev/QOM devices so developers using them
without knowing they are not QOM'ified yet can realize
it and convert them if they have time."

So, how should this be coded then? The XenIOState doesn't really qualify as a 'device', does it?

  Paul

> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/i386/xen/xen-hvm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 82ece6b9e7..a1163b1529 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -31,7 +31,7 @@
>  #include "sysemu/xen-mapcache.h"
>  #include "trace.h"
>  #include "exec/address-spaces.h"
> -
> +#include "hw/qdev-deprecated.h"
>  #include <xen/hvm/ioreq.h>
>  #include <xen/hvm/e820.h>
> 
> @@ -1401,6 +1401,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
>      xen_pfn_t ioreq_pfn;
>      XenIOState *state;
> 
> +    qdev_warn_deprecated_function_used();
> +
>      state = g_malloc0(sizeof (XenIOState));
> 
>      state->xce_handle = xenevtchn_open(NULL, 0);
> --
> 2.21.3
Philippe Mathieu-Daudé June 8, 2020, 5:37 p.m. UTC | #2
On 6/8/20 6:54 PM, Paul Durrant wrote:
>> -----Original Message-----
>> From: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>> This code hasn't been QOM'ified yet. Warn the user.
> 
> "Based on today's IRC chat, this is a trivial RFC series
> to anotate pre-qdev/QOM devices so developers using them
> without knowing they are not QOM'ified yet can realize
> it and convert them if they have time."
> 
> So, how should this be coded then? The XenIOState doesn't really qualify as a 'device', does it?

There is a pending question whether Machines are Devices or not.

Xen is a tricky case, it is created as a Q35 machine overloaded with Xen
features.

>> @@ -1401,6 +1401,8 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
>>      xen_pfn_t ioreq_pfn;
>>      XenIOState *state;
>>
>> +    qdev_warn_deprecated_function_used();
>> +
>>      state = g_malloc0(sizeof (XenIOState));

XenIOState is indeed not a device, it is allocated once, we won't gain
anything making it a QOM object... so this patch is incorrect.

Sorry for the noise :S

Regards,

Phil.

>>
>>      state->xce_handle = xenevtchn_open(NULL, 0);
>> --
>> 2.21.3
> 
>
diff mbox series

Patch

diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 82ece6b9e7..a1163b1529 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -31,7 +31,7 @@ 
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #include "exec/address-spaces.h"
-
+#include "hw/qdev-deprecated.h"
 #include <xen/hvm/ioreq.h>
 #include <xen/hvm/e820.h>
 
@@ -1401,6 +1401,8 @@  void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
     xen_pfn_t ioreq_pfn;
     XenIOState *state;
 
+    qdev_warn_deprecated_function_used();
+
     state = g_malloc0(sizeof (XenIOState));
 
     state->xce_handle = xenevtchn_open(NULL, 0);