[PATCH v2-for-5.2] macio: set user_creatable to false in macio_class_init()

Mark Cave-Ayland posted 1 patch 3 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201110103111.18395-1-mark.cave-ayland@ilande.co.uk
Test checkpatch passed
hw/misc/macio/macio.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH v2-for-5.2] macio: set user_creatable to false in macio_class_init()
Posted by Mark Cave-Ayland 3 years, 5 months ago
Commit 348b8d1a76 "macio: don't reference serial_hd() directly within the device"
removed the setting of user_creatable to false on the basis that the restriction
was due to the use of serial_hd() in macio_instance_init().

Unfortunately this isn't the full story since the PIC object property links
must still be set before the device is realized. Whilst it is possible to update
the macio device and Mac machines to resolve this, the fix is too invasive at
this point in the release cycle.

For now simply set user_creatable back to false in macio_class_init() to
prevent QEMU from segfaulting in anticipation of the proper fix arriving in
QEMU 6.0.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 hw/misc/macio/macio.c | 2 ++
 1 file changed, 2 insertions(+)

v2:
- Rebase onto master
- Add for-5.2 into subject prefix
- Add R-B tags from Philippe and Thomas


diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 51368884d0..bb601f782c 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -456,6 +456,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_OTHERS << 8;
     device_class_set_props(dc, macio_properties);
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+    /* Reason: requires PIC property links to be set in macio_*_realize() */
+    dc->user_creatable = false;
 }
 
 static const TypeInfo macio_bus_info = {
-- 
2.20.1


Re: [PATCH v2-for-5.2] macio: set user_creatable to false in macio_class_init()
Posted by Mark Cave-Ayland 3 years, 5 months ago
On 10/11/2020 10:31, Mark Cave-Ayland wrote:

> Commit 348b8d1a76 "macio: don't reference serial_hd() directly within the device"
> removed the setting of user_creatable to false on the basis that the restriction
> was due to the use of serial_hd() in macio_instance_init().
> 
> Unfortunately this isn't the full story since the PIC object property links
> must still be set before the device is realized. Whilst it is possible to update
> the macio device and Mac machines to resolve this, the fix is too invasive at
> this point in the release cycle.
> 
> For now simply set user_creatable back to false in macio_class_init() to
> prevent QEMU from segfaulting in anticipation of the proper fix arriving in
> QEMU 6.0.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/misc/macio/macio.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> v2:
> - Rebase onto master
> - Add for-5.2 into subject prefix
> - Add R-B tags from Philippe and Thomas
> 
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 51368884d0..bb601f782c 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -456,6 +456,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
>       k->class_id = PCI_CLASS_OTHERS << 8;
>       device_class_set_props(dc, macio_properties);
>       set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +    /* Reason: requires PIC property links to be set in macio_*_realize() */
> +    dc->user_creatable = false;
>   }
>   
>   static const TypeInfo macio_bus_info = {

Applied to my qemu-macppc branch.


ATB,

Mark.

Re: [PATCH v2-for-5.2] macio: set user_creatable to false in macio_class_init()
Posted by David Gibson 3 years, 5 months ago
On Tue, Nov 10, 2020 at 10:31:11AM +0000, Mark Cave-Ayland wrote:
> Commit 348b8d1a76 "macio: don't reference serial_hd() directly within the device"
> removed the setting of user_creatable to false on the basis that the restriction
> was due to the use of serial_hd() in macio_instance_init().
> 
> Unfortunately this isn't the full story since the PIC object property links
> must still be set before the device is realized. Whilst it is possible to update
> the macio device and Mac machines to resolve this, the fix is too invasive at
> this point in the release cycle.
> 
> For now simply set user_creatable back to false in macio_class_init() to
> prevent QEMU from segfaulting in anticipation of the proper fix arriving in
> QEMU 6.0.
> 
> Reported-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/misc/macio/macio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> v2:
> - Rebase onto master
> - Add for-5.2 into subject prefix
> - Add R-B tags from Philippe and Thomas
> 
> 
> diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
> index 51368884d0..bb601f782c 100644
> --- a/hw/misc/macio/macio.c
> +++ b/hw/misc/macio/macio.c
> @@ -456,6 +456,8 @@ static void macio_class_init(ObjectClass *klass, void *data)
>      k->class_id = PCI_CLASS_OTHERS << 8;
>      device_class_set_props(dc, macio_properties);
>      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
> +    /* Reason: requires PIC property links to be set in macio_*_realize() */
> +    dc->user_creatable = false;
>  }
>  
>  static const TypeInfo macio_bus_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