]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
s390/cio: add union/struct to access tpi_info
authorSven Schnelle <svens@linux.ibm.com>
Wed, 5 May 2021 20:01:15 +0000 (22:01 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 26 May 2021 21:18:18 +0000 (23:18 +0200)
gcc-11 warns:
In file included from include/trace/define_trace.h:103,
                 from drivers/s390/cio/trace.h:403,
                 from drivers/s390/cio/trace.c:13:
drivers/s390/cio/./trace.h: In function perf_trace_s390_cio_tpi:
drivers/s390/cio/./trace.h:172:25: warning: memcpy reading 16 bytes from a region of size 0 [-Wstringop-overread]
  172 |                         memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173 |                                sizeof(struct tpi_info));
      |                                ~~~~~~~~~~~~~~~~~~~~~~~~
include/trace/perf.h:66:11: note: in definition of macro DECLARE_EVENT_CLASS
   66 |         { assign; }                                                     \
      |           ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro PARAMS
   79 |                              PARAMS(assign),                   \
      |                              ^~~~~~
drivers/s390/cio/./trace.h:152:1: note: in expansion of macro TRACE_EVENT
  152 | TRACE_EVENT(s390_cio_tpi,
      | ^~~~~~~~~~~
drivers/s390/cio/./trace.h:165:9: note: in expansion of macro TP_fast_assign
  165 |         TP_fast_assign(
      |         ^~~~~~~~~~~~~~

Fix this by adding a struct for the tpi data to struct lowcore.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/lowcore.h
drivers/s390/cio/cio.h
drivers/s390/cio/trace.h

index 8f58c28277730b9004b7d359bed395b7cbdd4acf..8a9fc0226ed34707acaf8b8e0f2a062cf0de9ade 100644 (file)
 #include <asm/ptrace.h>
 #include <asm/cpu.h>
 #include <asm/types.h>
+#include <asm/schid.h>
 
 #define LC_ORDER 1
 #define LC_PAGES 2
 
+/* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */
+struct tpi_info {
+       struct subchannel_id schid;
+       u32 intparm;
+       u32 adapter_IO:1;
+       u32 directed_irq:1;
+       u32 isc:3;
+       u32 :27;
+       u32 type:3;
+       u32 :12;
+} __packed __aligned(4);
+
 struct lowcore {
        __u8    pad_0x0000[0x0014-0x0000];      /* 0x0000 */
        __u32   ipl_parmblock_ptr;              /* 0x0014 */
@@ -46,14 +59,19 @@ struct lowcore {
        __u64   monitor_code;                   /* 0x00b0 */
        union {
                struct {
-                       __u16   subchannel_id;  /* 0x00b8 */
-                       __u16   subchannel_nr;  /* 0x00ba */
+                       union {
+                               struct {
+                                       __u16   subchannel_id;  /* 0x00b8 */
+                                       __u16   subchannel_nr;  /* 0x00ba */
+                               } __packed;
+                               __u32 subchannel;               /* 0x00b8 */
+                       } __packed;
+                       __u32   io_int_parm;                    /* 0x00bc */
+                       __u32   io_int_word;                    /* 0x00c0 */
+                       __u8    pad_0x00c4[0x00c8-0x00c4];      /* 0x00c4 */
                } __packed;
-               __u32 subchannel;
-       } __packed;
-       __u32   io_int_parm;                    /* 0x00bc */
-       __u32   io_int_word;                    /* 0x00c0 */
-       __u8    pad_0x00c4[0x00c8-0x00c4];      /* 0x00c4 */
+               struct tpi_info tpi_info;                       /* 0x00b8 */
+       } __packed __aligned(4);
        __u32   stfl_fac_list;                  /* 0x00c8 */
        __u8    pad_0x00cc[0x00e8-0x00cc];      /* 0x00cc */
        __u64   mcck_interruption_code;         /* 0x00e8 */
index dcdaba689b20cf5592f8249a9cf163fd9f404962..84d1907ad94a21527952d120fa27013240605504 100644 (file)
@@ -46,18 +46,6 @@ struct pmcw {
                                /*  ... in an operand exception.       */
 } __attribute__ ((packed));
 
-/* I/O-Interruption Code as stored by TEST PENDING INTERRUPTION (TPI). */
-struct tpi_info {
-       struct subchannel_id schid;
-       u32 intparm;
-       u32 adapter_IO:1;
-       u32 directed_irq:1;
-       u32 isc:3;
-       u32 :27;
-       u32 type:3;
-       u32 :12;
-} __packed __aligned(4);
-
 /* Target SCHIB configuration. */
 struct schib_config {
        u64 mba;
index 4803139bce14934e052d7b6bee9ae3f152fb58cc..6fc2029bd7284dbf6dcd6f7936f366b90e9fe778 100644 (file)
@@ -169,8 +169,7 @@ TRACE_EVENT(s390_cio_tpi,
                else if (addr)
                        __entry->tpi_info = *addr;
                else {
-                       memcpy(&__entry->tpi_info, &S390_lowcore.subchannel_id,
-                              sizeof(struct tpi_info));
+                       __entry->tpi_info = S390_lowcore.tpi_info;
                }
                __entry->cssid = __entry->tpi_info.schid.cssid;
                __entry->ssid = __entry->tpi_info.schid.ssid;