Skip to contentSkip to conversation

powerpc pci: fixed packing of ranges[]

PATCH Applied Alexey Kardashevskiy 4 participants 4 messages Jul 18, 2012 – Jul 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc pci: fixed packing of ranges[]

By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in the PCI bus ranges property of the sPAPR PHB.

The patch replaces __attribute__((packed)) with more strict QEMU_PACKED which actually is __attribute__((gcc_struct, packed)) on Windows.

---
 hw/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +1 -1
index b3032d2..0261d2e 100644
@@ -418,7 +418,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
         uint64_t child;
         uint64_t parent;
         uint64_t size;
-    } __attribute__((packed)) ranges[] = {
+    } QEMU_PACKED ranges[] = {
         {
             cpu_to_be32(b_ss(1)), cpu_to_be64(0),
             cpu_to_be64(phb->io_win_addr),
Signature · 1 line
1.7.10.4
Tested-by Reviewed-by on v1 1/1
#1 lore raw

Am 18.07.2012 10:22, schrieb Alexey Kardashevskiy:

Quoted 18 lines

By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in the PCI bus ranges property of the sPAPR PHB.

The patch replaces __attribute__((packed)) with more strict QEMU_PACKED which actually is __attribute__((gcc_struct, packed)) on Windows.

---
  hw/spapr_pci.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +0 -0
index b3032d2..0261d2e 100644

hw/spapr_pci.c int spapr_populate_pci_dt(sPAPRPHBState *phb, · line 424

Quoted 8 lines
hw/spapr_pci.c +1 -1
@@ -418,7 +418,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
          uint64_t child;
          uint64_t parent;
          uint64_t size;
-    } __attribute__((packed)) ranges[] = {
+    } QEMU_PACKED ranges[] = {
          {
              cpu_to_be32(b_ss(1)), cpu_to_be64(0),
              cpu_to_be64(phb->io_win_addr),

The patch changes sizeof(ranges[0]) from 32 to 28 bytes and can be applied as a trivial patch.

#2 lore raw
Quoted 32 lines · Stefan Weil

Am 18.07.2012 10:22, schrieb Alexey Kardashevskiy:

Quoted 18 lines

By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in the PCI bus ranges property of the sPAPR PHB.

The patch replaces __attribute__((packed)) with more strict QEMU_PACKED which actually is __attribute__((gcc_struct, packed)) on Windows.

---
  hw/spapr_pci.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +0 -0
index b3032d2..0261d2e 100644

hw/spapr_pci.c int spapr_populate_pci_dt(sPAPRPHBState *phb, · line 424

Quoted 8 lines
hw/spapr_pci.c +1 -1
@@ -418,7 +418,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
          uint64_t child;
          uint64_t parent;
          uint64_t size;
-    } __attribute__((packed)) ranges[] = {
+    } QEMU_PACKED ranges[] = {
          {
              cpu_to_be32(b_ss(1)), cpu_to_be64(0),
              cpu_to_be64(phb->io_win_addr),

The patch changes sizeof(ranges[0]) from 32 to 28 bytes and can be applied as a trivial patch.

Quoted 3 lines

So do you want to take it through the trivial queue? I'm fine either way.

Alex

#3 lore raw
Quoted 33 lines · Alexander Graf
Quoted 32 lines · Stefan Weil

Am 18.07.2012 10:22, schrieb Alexey Kardashevskiy:

Quoted 18 lines

By default mingw-gcc is trying to pack structures the way to preserve binary compatibility with MS Visual C what leads to incorrect and unexpected padding in the PCI bus ranges property of the sPAPR PHB.

The patch replaces __attribute__((packed)) with more strict QEMU_PACKED which actually is __attribute__((gcc_struct, packed)) on Windows.

---
 hw/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +0 -0
index b3032d2..0261d2e 100644

hw/spapr_pci.c int spapr_populate_pci_dt(sPAPRPHBState *phb, · line 424

Quoted 8 lines
hw/spapr_pci.c +1 -1
@@ -418,7 +418,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
         uint64_t child;
         uint64_t parent;
         uint64_t size;
-    } __attribute__((packed)) ranges[] = {
+    } QEMU_PACKED ranges[] = {
         {
             cpu_to_be32(b_ss(1)), cpu_to_be64(0),
             cpu_to_be64(phb->io_win_addr),

The patch changes sizeof(ranges[0]) from 32 to 28 bytes and can be applied as a trivial patch.

Quoted 7 lines
Quoted 3 lines

So do you want to take it through the trivial queue? I'm fine either way.

Merged into the trivial patches tree with your Acked-by:.

Stefan