From: Philippe Mathieu-Daudé <[email protected]>

Commit 1497c160661 ("s390x: add flags field for registering I/O
adapter") defined S390_ADAPTER_SUPPRESSIBLE twice, one when
KVM is available and another when it isn't. However both
definitions expand to the same value. Unify them, adding an
extra safety check in KVM-specific file.

This allows removing the target-specific 'CONFIG_KVM'
definition in "cpu.h".

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
---
 include/hw/s390x/css.h | 2 ++
 target/s390x/cpu.h     | 6 ------
 target/s390x/kvm/kvm.c | 2 ++
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index 0b0400a9d4f..d3326237c9f 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -238,6 +238,8 @@ uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t 
isc);
 void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,
                               uint8_t flags, Error **errp);
 
+#define S390_ADAPTER_SUPPRESSIBLE 0x01
+
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
 bool css_subch_visible(SubchDev *sch);
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index ba2bf177e8f..40bc1f0741d 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -39,12 +39,6 @@
 
 #define S390_MAX_CPUS 248
 
-#ifndef CONFIG_KVM
-#define S390_ADAPTER_SUPPRESSIBLE 0x01
-#else
-#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
-#endif
-
 typedef struct PSW {
     uint64_t mask;
     uint64_t addr;
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index bd6c440aefb..54d28e37d4d 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -2082,6 +2082,8 @@ int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
     return r;
 }
 
+QEMU_BUILD_BUG_ON(S390_ADAPTER_SUPPRESSIBLE != KVM_S390_ADAPTER_SUPPRESSIBLE);
+
 int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
                              uint64_t address, uint32_t data, PCIDevice *dev)
 {
-- 
2.52.0


Reply via email to