qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "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, "Gerd Hoffmann" <kraxel@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH 1/1] hw/s390x: modularize virtio-gpu-ccw
Date: Thu, 18 Feb 2021 11:34:38 +0100	[thread overview]
Message-ID: <20210218113438.3fe80078.pasic@linux.ibm.com> (raw)
In-Reply-To: <6c0f5acf-9ebb-ba04-1389-c6690796a6ad@redhat.com>

On Thu, 18 Feb 2021 10:23:16 +0100
Thomas Huth <thuth@redhat.com> wrote:

> > Since the virtio-gpu-ccw device depends on the hw-display-virtio-gpu
> > module, which provides the type virtio-gpu-device, packaging the
> > hw-display-virtio-gpu module as a separate package that may or may not
> > be installed along with the qemu package leads to problems. Namely if
> > the hw-display-virtio-gpu is absent, qemu continues to advertise
> > virtio-gpu-ccw, but it aborts not only when one attempts using
> > virtio-gpu-ccw, but also when libvirtd's capability probing tries
> > to instantiate the type to introspect it.
> > 
> > Let us thus introduce a module named hw-s390x-virtio-gpu-ccw that
> > is going to provide the virtio-gpu-ccw device. The hw-s390x prefix
> > was chosen because it is not a portable device.
> > 
> > With virtio-gpu-ccw built as a module, the correct way to package a
> > modularized qemu is to require that hw-display-virtio-gpu must be
> > installed whenever the module hw-s390x-virtio-gpu-ccw.
> > 
> > Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> > ---
> >   hw/s390x/meson.build | 17 ++++++++++++++++-
> >   util/module.c        |  1 +
> >   2 files changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build
> > index 2a7818d94b..153b1309fb 100644
> > --- a/hw/s390x/meson.build
> > +++ b/hw/s390x/meson.build
> > @@ -34,7 +34,6 @@ virtio_ss.add(files('virtio-ccw.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-ccw-balloon.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-ccw-blk.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-ccw-crypto.c'))
> > -virtio_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: files('virtio-ccw-gpu.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-ccw-input.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-ccw-net.c'))
> >   virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-ccw-rng.c'))
> > @@ -46,3 +45,19 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-ccw.c'
> >   s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)
> >   
> >   hw_arch += {'s390x': s390x_ss}
> > +
> > +if target.startswith('s390x')
> > +  hw_s390x_modules = {}
> > +
> > +  hw_s390x_modules_c_args = ['-DNEED_CPU_H',
> > +	      '-DCONFIG_TARGET="@0@-config-target.h"'.format(target)]
> > +  hw_s390x_modules_inc = [include_directories('../../target' / config_target['TARGET_BASE_ARCH'])]
> > +  hw_s390x_modules_dependencies = declare_dependency(
> > +	       include_directories: hw_s390x_modules_inc, compile_args: hw_s390x_modules_c_args)  
> 
> Basically the patch looks fine to me, but I wonder why all that above lines 
> (related to hw_s390x_modules_dependencies) are requred at all? The other 
> display modules in hw/display/meson.build also do not need to re-define 
> c_args for example?

The explanation is simple. Unlike most devices, the ccw devices aren't
portable. In particular both css.c and css.h includes "cpu.h", and
virtio-ccw-gpu.c includes "qemu/osdep.h". Furthermore osdep.h contains:
#ifdef NEED_CPU_H
#include CONFIG_TARGET
#else
#include "exec/poison.h"
#endif
so if we don't have NEED_CPU_H, among others CONFIG_KVM is poisoned, and
CONFIG_KVM is used in "css.h". Frankly, I can't tell under what circumstances
does css need "cpu.h". I managed to build the s390x-softmmu target
without it, but decided to put it back. Regarding "osdep.h", I just
assumed includes are done the way they are done for a good reason. Maybe
the includes can be changed in a way that the things you ask about become
unnecessary, but with the code as is they are necessary. Try to drop them
and check out what happens.

Regards,
Halil


  reply	other threads:[~2021-02-18 10:36 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 [this message]
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
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=20210218113438.3fe80078.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).