qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Boris Fiuczynski" <fiuczy@linux.ibm.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, "Bruce Rogers" <brogers@suse.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH 1/1] hw/s390x: modularize virtio-gpu-ccw
Date: Fri, 19 Feb 2021 10:42:52 +0100	[thread overview]
Message-ID: <20210219104252.38feac7c.pasic@linux.ibm.com> (raw)
In-Reply-To: <20210219084545.stb4wjn6ggwent4g@sirius.home.kraxel.org>

On Fri, 19 Feb 2021 09:45:45 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

> > but that "fixes" s390x at the expense
> > of breaking all the other targets. For example:
> > ./qemu-system-x86_64 -device help
> > Type 'virtio-gpu-ccw' is missing its parent 'virtio-ccw-device'
> > Aborted  
> 
> Hmm, this is a new failure variant.  In the PCI case (see other mail)
> the module doesn't load in the first place due to missing symbols.
> 
> Maybe we need a type_register_mayfail() variant which doesn't abort in
> case the parent isn't found (see also commit
> 501093207eb1ed4845e0a65ee1ce7db7b9676e0b).

I was also thinking along the same lines last night, and came up with
this workaround:

diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c
index c301e2586b..bbe591cd62 100644
--- a/hw/s390x/virtio-ccw-gpu.c
+++ b/hw/s390x/virtio-ccw-gpu.c
@@ -62,7 +62,16 @@ static const TypeInfo virtio_ccw_gpu = {
 
 static void virtio_ccw_gpu_register(void)
 {
+#ifdef CONFIG_MODULES
+    /*
+     * Ugly hack: Avoid targets that don't have it aborting when this module
+     * is loaded.
+    if (object_class_by_name(TYPE_VIRTIO_CCW_DEVICE)) {
+        type_register_static(&virtio_ccw_gpu);
+    }
+#else
     type_register_static(&virtio_ccw_gpu);
+#endif
 }
 
 type_init(virtio_ccw_gpu_register)

but then I decided it is too ugly to post. Something like
type_register_mayfail() would be certainly nicer, although I would still
prefer the failing type register if the device ain't built as a module.

Today I'm on a vacation so I will pick this up again next week. I will
also think some more of how the situation with virtio-ccw compares to pci
with respect to modularization.

Regards,
Halil


  reply	other threads:[~2021-02-19  9:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18  2:22 [PATCH 1/1] hw/s390x: modularize virtio-gpu-ccw Halil Pasic
2021-02-18  9:23 ` Thomas Huth
2021-02-18 10:34   ` Halil Pasic
2021-02-18 12:56     ` Cornelia Huck
2021-02-18 13:38       ` Gerd Hoffmann
2021-02-18 18:17         ` Halil Pasic
2021-02-19  8:34           ` Gerd Hoffmann
2021-02-19  2:52         ` Halil Pasic
2021-02-19  8:45           ` Gerd Hoffmann
2021-02-19  9:42             ` Halil Pasic [this message]
2021-02-19 13:58               ` Gerd Hoffmann
2021-02-18 14:44     ` Thomas Huth
2021-02-18 18:26       ` Halil Pasic

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=20210219104252.38feac7c.pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=brogers@suse.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=fiuczy@linux.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).