From 2dd9d8cfb4f3bd30d9cdfc2edba5cb7ee5917f4b Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 17 Mar 2021 10:56:21 +0100 Subject: [PATCH] s390x: add have_virtio_ccw Introduce a symbol which can be used to prevent ccw modules being loaded into system emulators without ccw support. Signed-off-by: Gerd Hoffmann Reviewed-by: Halil Pasic Tested-by: Halil Pasic Message-Id: <20210317095622.2839895-3-kraxel@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/s390x/virtio-ccw.c | 2 ++ hw/s390x/virtio-ccw.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 06c0605681..314ed7b245 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -35,6 +35,8 @@ #define NR_CLASSIC_INDICATOR_BITS 64 +bool have_virtio_ccw = true; + static int virtio_ccw_dev_post_load(void *opaque, int version_id) { VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(opaque); diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 49a2b8ca42..0168232e3b 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -63,6 +63,11 @@ typedef struct VirtioBusClass VirtioCcwBusClass; DECLARE_OBJ_CHECKERS(VirtioCcwBusState, VirtioCcwBusClass, VIRTIO_CCW_BUS, TYPE_VIRTIO_CCW_BUS) +/* + * modules can reference this symbol to avoid being loaded + * into system emulators without ccw support + */ +extern bool have_virtio_ccw; struct VirtIOCCWDeviceClass { CCWDeviceClass parent_class; -- 2.11.4.GIT