Skip to contentSkip to conversation

ioport: remove LITTLE_ENDIAN mark for portio

PATCH Applied Anthony Liguori 2 participants 3 messages Jul 12, 2013 – Jul 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioport: remove LITTLE_ENDIAN mark for portio

Setting it to LE forces a byte swap when host != guest endian but this makes no sense at all.

Herve made the suggestion upon observing that word writes/reads were broken into byte writes/reads in such a way as to assume devices are interpret registers as LE.

However, even if this were a problem, marking the region as LE is not useful because what's essentially happening here is that LE is open coded. So by marking it LE in MemoryRegionOps, we're doing a superflous swap.

Now, the portio code is suspicious to begin with. The dispatch layer really has no purpose in splitting I/O requests in the first place...

Cc Hervé Poussineau <[email protected]>
Cc Alex Graf <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 ioport.c | 1 -
 1 file changed, 1 deletion(-)
ioport.c +0 -1
index 79b7f1a..89b17d6 100644
@@ -183,7 +183,6 @@ static void portio_write(void *opaque, hwaddr addr, uint64_t data,
 static const MemoryRegionOps portio_ops = {
     .read = portio_read,
     .write = portio_write,
-    .endianness = DEVICE_LITTLE_ENDIAN,
     .valid.unaligned = true,
     .impl.unaligned = true,
 };
Signature · 1 line
1.8.0
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Anthony Liguori

Setting it to LE forces a byte swap when host != guest endian but this makes no sense at all.

Herve made the suggestion upon observing that word writes/reads were broken into byte writes/reads in such a way as to assume devices are interpret registers as LE.

However, even if this were a problem, marking the region as LE is not useful because what's essentially happening here is that LE is open coded. So by marking it LE in MemoryRegionOps, we're doing a superflous swap.

Quoted 8 lines

Now, the portio code is suspicious to begin with. The dispatch layer really has no purpose in splitting I/O requests in the first place...

Cc Hervé Poussineau <[email protected]>
Cc Alex Graf <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

Let's take a look at the PReP breakage with a test case after we fixed everyone else again.

Alex

Quoted 19 lines

---
ioport.c | 1 -

1 file changed, 1 deletion(-)
ioport.c +0 -1
index 79b7f1a..89b17d6 100644
@@ -183,7 +183,6 @@ static void portio_write(void *opaque, hwaddr addr, uint64_t data,
 static const MemoryRegionOps portio_ops = {
    .read = portio_read,
    .write = portio_write,
-    .endianness = DEVICE_LITTLE_ENDIAN,
    .valid.unaligned = true,
    .impl.unaligned = true,
 };
Signature · 1 line
1.8.0