Skip to contentSkip to conversation

hw/s390x: Move S390_ADAPTER_SUPPRESSIBLE from 'css.h' to 's390_flic.h'

PATCH-for-5.2 Philippe Mathieu-Daudé 2 participants 3 messages Jul 15, 2020 – Jul 16, 2020

lore
Share & tools
lore
#0 lore raw

Not all s390x devices require to have access to the CPU internals.

To reduce the include dependencies on "s390x/css.h", move the S390_ADAPTER_SUPPRESSIBLE definition to "s390x/s390_flic.h".

---
 include/hw/s390x/css.h       | 7 -------
 include/hw/s390x/s390_flic.h | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/hw/s390x/css.h +0 -7
index 08c869ab0a..7858666307 100644
@@ -12,7 +12,6 @@
 #ifndef CSS_H
 #define CSS_H
 
-#include "cpu.h"
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/ioinst.h"
@@ -233,12 +232,6 @@ 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);
 
-#ifndef CONFIG_KVM
-#define S390_ADAPTER_SUPPRESSIBLE 0x01
-#else
-#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
-#endif
-
 #ifndef CONFIG_USER_ONLY
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
include/hw/s390x/s390_flic.h +7 -0
index 4687ecfe83..6bf9d73728 100644
@@ -17,6 +17,13 @@
 #include "hw/s390x/adapter.h"
 #include "hw/virtio/virtio.h"
 #include "qemu/queue.h"
+#include "cpu.h"
+
+#ifndef CONFIG_KVM
+#define S390_ADAPTER_SUPPRESSIBLE 0x01
+#else
+#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
+#endif
 
 /*
  * Reserve enough gsis to accommodate all virtio devices.
Signature · 1 line
2.21.3
#1 lore raw
Quoted 4 lines · On Wed, 15 Jul 2020 15:18:45 +0200 Philippe Mathieu-Daudé <[email protected]>…

Not all s390x devices require to have access to the CPU internals.

To reduce the include dependencies on "s390x/css.h", move the S390_ADAPTER_SUPPRESSIBLE definition to "s390x/s390_flic.h".

But css.h is not 'CPU internals', it is the main I/O subsystem?

Quoted 12 lines
---
 include/hw/s390x/css.h       | 7 -------
 include/hw/s390x/s390_flic.h | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/hw/s390x/css.h +0 -0
index 08c869ab0a..7858666307 100644

include/hw/s390x/css.h line 15

Quoted 4 lines
include/hw/s390x/css.h +0 -1
@@ -12,7 +12,6 @@
 #ifndef CSS_H
 #define CSS_H
 
-#include "cpu.h"

FWIW, we should just be able to remove this #include...

Quoted 21 lines
include/hw/s390x/css.h +0 -6
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/ioinst.h"
@@ -233,12 +232,6 @@ 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);
 
-#ifndef CONFIG_KVM
-#define S390_ADAPTER_SUPPRESSIBLE 0x01
-#else
-#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
-#endif
-
 #ifndef CONFIG_USER_ONLY
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
include/hw/s390x/s390_flic.h +0 -0
index 4687ecfe83..6bf9d73728 100644

include/hw/s390x/s390_flic.h line 20

Quoted 4 lines
include/hw/s390x/s390_flic.h +1 -0
@@ -17,6 +17,13 @@
 #include "hw/s390x/adapter.h"
 #include "hw/virtio/virtio.h"
 #include "qemu/queue.h"
+#include "cpu.h"

...and we do not need it here AFAICS.

include/hw/s390x/s390_flic.h line 29

Quoted 9 lines
include/hw/s390x/s390_flic.h +6 -0
+
+#ifndef CONFIG_KVM
+#define S390_ADAPTER_SUPPRESSIBLE 0x01
+#else
+#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
+#endif
 
 /*
  * Reserve enough gsis to accommodate all virtio devices.

Whether the definition of S390_ADAPTER_SUPPRESSIBLE belongs into css.h or s390_flic.h is probably a matter of taste: the definition of an I/O adapter is in css.h, and registration of an adapter is done via the FLIC.

I think removing the cpu.h include might already do what you wanted to do?

#2 lore raw
Quoted 9 lines · Cornelia Huck
Quoted 4 lines · On Wed, 15 Jul 2020 15:18:45 +0200 Philippe Mathieu-Daudé <[email protected]>…

Not all s390x devices require to have access to the CPU internals.

To reduce the include dependencies on "s390x/css.h", move the S390_ADAPTER_SUPPRESSIBLE definition to "s390x/s390_flic.h".

But css.h is not 'CPU internals', it is the main I/O subsystem?

I meant devices using the main I/O subsystem don't need to have access to the CPU internals (CPUS390XState and s390_cpu* helpers).

Quoted 16 lines
Quoted 16 lines
---
 include/hw/s390x/css.h       | 7 -------
 include/hw/s390x/s390_flic.h | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
include/hw/s390x/css.h +0 -0
index 08c869ab0a..7858666307 100644
@@ -12,7 +12,6 @@
 #ifndef CSS_H
 #define CSS_H
 
Quoted 3 lines

include/hw/s390x/css.h line 15

Quoted 1 line
include/hw/s390x/css.h +0 -1
-#include "cpu.h"

FWIW, we should just be able to remove this #include...

Odd it was not working yesterday (missing CONFIG_KVM) but today it works.

Quoted 44 lines
Quoted 22 lines
include/hw/s390x/css.h +0 -6
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/ioinst.h"
@@ -233,12 +232,6 @@ 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);
 
-#ifndef CONFIG_KVM
-#define S390_ADAPTER_SUPPRESSIBLE 0x01
-#else
-#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
-#endif
-
 #ifndef CONFIG_USER_ONLY
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
include/hw/s390x/s390_flic.h +0 -0
index 4687ecfe83..6bf9d73728 100644

include/hw/s390x/s390_flic.h line 20

Quoted 4 lines
include/hw/s390x/s390_flic.h +1 -0
@@ -17,6 +17,13 @@
 #include "hw/s390x/adapter.h"
 #include "hw/virtio/virtio.h"
 #include "qemu/queue.h"
+#include "cpu.h"

...and we do not need it here AFAICS.

include/hw/s390x/s390_flic.h line 29

Quoted 9 lines
include/hw/s390x/s390_flic.h +6 -0
+
+#ifndef CONFIG_KVM
+#define S390_ADAPTER_SUPPRESSIBLE 0x01
+#else
+#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
+#endif
 
 /*
  * Reserve enough gsis to accommodate all virtio devices.

Whether the definition of S390_ADAPTER_SUPPRESSIBLE belongs into css.h or s390_flic.h is probably a matter of taste: the definition of an I/O adapter is in css.h, and registration of an adapter is done via the FLIC.

Quoted 2 lines

I think removing the cpu.h include might already do what you wanted to do?

Yes :)

Thanks!