[PATCH 14/18] target/s390x: Simplify S390_ADAPTER_SUPPRESSIBLE definition

Philippe Mathieu-Daudé posted 18 patches 1 month ago
Maintainers: Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>
There is a newer version of this series
[PATCH 14/18] target/s390x: Simplify S390_ADAPTER_SUPPRESSIBLE definition
Posted by Philippe Mathieu-Daudé 1 month ago
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é <philmd@linaro.org>
---
 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 aa931cb6748..75608b038f4 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


Re: [PATCH 14/18] target/s390x: Simplify S390_ADAPTER_SUPPRESSIBLE definition
Posted by Thomas Huth 1 month ago
On 07/01/2026 14.08, Philippe Mathieu-Daudé wrote:
> 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é <philmd@linaro.org>
> ---
>   include/hw/s390x/css.h | 2 ++
>   target/s390x/cpu.h     | 6 ------
>   target/s390x/kvm/kvm.c | 2 ++
>   3 files changed, 4 insertions(+), 6 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>