Skip to contentSkip to conversation

memory: Fix 'Kill old-style I/O dispatch'

PATCH Applied Andreas Färber 3 participants 6 messages Jan 7, 2012 – Jan 8, 2012

lore
Share & tools
lore
#0 lore raw

cover memory: Fix 'Kill old-style I/O dispatch'

Hello,

This series fixes endianness issues in the memory core. Apparently the actual byte swapping had not yet been tested.

Together with the BIOS MemoryRegion patch and revert of m48t59 I/O base this restores the PReP machine to previous behavior.

Regards,
Andreas

Cc Avi Kivity <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Alexander Graf <[email protected]>
Cc Hervé Poussineau <[email protected]>

Andreas Färber (2):
memory: Fix memory_region_wrong_endianness()
memory: Fix adjust_endianness()

 memory.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.7
#1 lore raw

PATCH 1/2 memory: Fix memory_region_wrong_endianness()

Since commit be675c972088eba210e18dc125613e9f205a6bfb (memory: move endianness compensation to memory core) it was checking for TARGET_BIG_ENDIAN instead of TARGET_WORDS_BIGENDIAN, thereby not swapping correctly for Big Endian targets.

---
 memory.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
memory.c +1 -1
index 394cbab..5e55a90 100644
@@ -843,7 +843,7 @@ static void memory_region_destructor_rom_device(MemoryRegion *mr)
 
 static bool memory_region_wrong_endianness(MemoryRegion *mr)
 {
-#ifdef TARGET_BIG_ENDIAN
+#ifdef TARGET_WORDS_BIGENDIAN
     return mr->ops->endianness == DEVICE_LITTLE_ENDIAN;
 #else
     return mr->ops->endianness == DEVICE_BIG_ENDIAN;
Signature · 1 line
1.7.7
#2 lore raw

PATCH 2/2 memory: Fix adjust_endianness()

In reply to Andreas Färber

Commit a621f38de85598a13d8d8524d1a94fc6a1818215 (Direct dispatch through MemoryRegion) moved byte swaps to a central function.

Add a missing break, so that long-sized byte swaps don't abort.

---
 memory.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
memory.c +1 -0
index 5e55a90..5ab2112 100644
@@ -942,6 +942,7 @@ static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size)
             break;
         case 4:
             *data = bswap32(*data);
+            break;
         default:
             abort();
         }
Signature · 1 line
1.7.7
Reviewed-by on the v1 series
#3 lore raw
In reply to Andreas Färber
Quoted 7 lines · Andreas Färber

Hello,

This series fixes endianness issues in the memory core. Apparently the actual byte swapping had not yet been tested.

Together with the BIOS MemoryRegion patch and revert of m48t59 I/O base this restores the PReP machine to previous behavior.

I confirm this totally break the big endian targets. At least MIPS and PowerPC are affected.

Both patches are:

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
Applied
#4 lore raw
In reply to Andreas Färber
Quoted 4 lines · Andreas Färber

Hello,

This series fixes endianness issues in the memory core. Apparently the actual byte swapping had not yet been tested.

/me hangs head. But strangely, sparc-test, mips-test, and ppc-virtex-ml507 (after the idstr fix) all boot for me.

Quoted 3 lines

Together with the BIOS MemoryRegion patch and revert of m48t59 I/O base this restores the PReP machine to previous behavior.

Thanks, applied.

Signature · 1 line
error compiling committee.c: too many arguments to function
#5 lore raw

Am 08.01.2012 12:11, schrieb Avi Kivity:

Quoted 6 lines · Andreas Färber
Quoted 2 lines

This series fixes endianness issues in the memory core. Apparently the actual byte swapping had not yet been tested.

/me hangs head. But strangely, sparc-test, mips-test, and ppc-virtex-ml507 (after the idstr fix) all boot for me.

IIUC the byte swaps only have to happen when some MemoryRegion has an endianness other than the target.

So when CHRP uses BE and native I/O exclusively it may work, whereas someone once summarized PReP as "a PC with a PowerPC CPU". ;)

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg