[PATCH v2 1/3] s390/pci: Adjust alignment in insn trace
From: Gerd Bayer
Date: Mon Oct 12 2026 - 10:32:10 EST
Currently we have 64bit wide fields start at odd byte-offsets in the
insn traces for pci_error in the s390dbf debug area, which are hard to
decode in hex dumps. At the same time, trace entries are padded at the
end.
Drop the packed attribute on the struct definition to exploit the
compiler's natural alignment, introduce explicit padding before and
after the 64bit fields for humans, and add a static assertion to avoid
accidential overruns of 2 lines in the s390dbf trace.
Signed-off-by: Gerd Bayer <gbayer@xxxxxxxxxxxxx>
Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx>
---
arch/s390/pci/pci_insn.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/s390/pci/pci_insn.c b/arch/s390/pci/pci_insn.c
index 35ceb1bea1c6..1089b539aeb6 100644
--- a/arch/s390/pci/pci_insn.c
+++ b/arch/s390/pci/pci_insn.c
@@ -18,11 +18,13 @@
#include <asm/asm.h>
#define ZPCI_INSN_BUSY_DELAY 1 /* 1 microsecond */
+#define ZPCI_ERR_INSN_DATA_SIZE 32
struct zpci_err_insn_data {
u8 insn;
u8 cc;
u8 status;
+ u8 pad0[5];
union {
struct {
u64 req;
@@ -33,7 +35,10 @@ struct zpci_err_insn_data {
u64 len;
};
};
-} __packed;
+ u64 pad1;
+};
+
+static_assert(sizeof(struct zpci_err_insn_data) <= ZPCI_ERR_INSN_DATA_SIZE);
static inline void zpci_err_insn_req(int lvl, u8 insn, u8 cc, u8 status,
u64 req, u64 offset)
--
2.53.0