qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false
@ 2018-03-07 14:22 Thomas Huth
  2018-03-07 18:47 ` Mark Cave-Ayland
  2018-03-08  2:06 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2018-03-07 14:22 UTC (permalink / raw)
  To: qemu-ppc; +Cc: qemu-devel, Alexander Graf, David Gibson, Mark Cave-Ayland

The macio devices currently cause a crash when the user tries to
instantiate them on a different machine:

$ ppc64-softmmu/qemu-system-ppc64 -device macio-newworld
Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
qemu-system-ppc64: -device macio-newworld: Device 'serial0' is in use
Aborted (core dumped)

These devices are clearly not intended to be creatable by the user
since they are using serial_hds[] directly in their instance_init
function. So let's mark them with user_creatable = false.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/misc/macio/macio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index af1bd46..454244f 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -406,6 +406,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_OTHERS << 8;
     dc->props = macio_properties;
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+    /* Reason: Uses serial_hds in macio_instance_init */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo macio_oldworld_type_info = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false
  2018-03-07 14:22 [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false Thomas Huth
@ 2018-03-07 18:47 ` Mark Cave-Ayland
  2018-03-08  2:06 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2018-03-07 18:47 UTC (permalink / raw)
  To: Thomas Huth, qemu-ppc; +Cc: David Gibson, qemu-devel, Alexander Graf

On 07/03/18 14:22, Thomas Huth wrote:

> The macio devices currently cause a crash when the user tries to
> instantiate them on a different machine:
> 
> $ ppc64-softmmu/qemu-system-ppc64 -device macio-newworld
> Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
> qemu-system-ppc64: -device macio-newworld: Device 'serial0' is in use
> Aborted (core dumped)
> 
> These devices are clearly not intended to be creatable by the user
> since they are using serial_hds[] directly in their instance_init
> function. So let's mark them with user_creatable = false.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/misc/macio/macio.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index af1bd46..454244f 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -406,6 +406,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
>       k->class_id = PCI_CLASS_OTHERS << 8;
>       dc->props = macio_properties;
>       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +    /* Reason: Uses serial_hds in macio_instance_init */
> +    dc->user_creatable = false;
>   }
>   
>   static const TypeInfo macio_oldworld_type_info = {

Looks like both Daniel and Peter also agree this is the correct 
approach, so:

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false
  2018-03-07 14:22 [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false Thomas Huth
  2018-03-07 18:47 ` Mark Cave-Ayland
@ 2018-03-08  2:06 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2018-03-08  2:06 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-ppc, qemu-devel, Alexander Graf, Mark Cave-Ayland

[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]

On Wed, Mar 07, 2018 at 03:22:54PM +0100, Thomas Huth wrote:
> The macio devices currently cause a crash when the user tries to
> instantiate them on a different machine:
> 
> $ ppc64-softmmu/qemu-system-ppc64 -device macio-newworld
> Unexpected error in qemu_chr_fe_init() at chardev/char-fe.c:222:
> qemu-system-ppc64: -device macio-newworld: Device 'serial0' is in use
> Aborted (core dumped)
> 
> These devices are clearly not intended to be creatable by the user
> since they are using serial_hds[] directly in their instance_init
> function. So let's mark them with user_creatable = false.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Applied, thanks.

> ---
>  hw/misc/macio/macio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index af1bd46..454244f 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -406,6 +406,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
>      k->class_id = PCI_CLASS_OTHERS << 8;
>      dc->props = macio_properties;
>      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +    /* Reason: Uses serial_hds in macio_instance_init */
> +    dc->user_creatable = false;
>  }
>  
>  static const TypeInfo macio_oldworld_type_info = {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-08  2:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07 14:22 [Qemu-devel] [PATCH] hw/misc/macio: Mark the macio devices with user_creatable = false Thomas Huth
2018-03-07 18:47 ` Mark Cave-Ayland
2018-03-08  2:06 ` David Gibson

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).