qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Laurent Vivier <laurent@vivier.eu>, Jason Wang <jasowang@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	qemu-block@nongnu.org, "Thomas Huth" <huth@tuxfamily.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Aleksandar Markovic" <amarkovic@wavecomp.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [Qemu-devel] [PATCH v8 03/10] dp8393x: manage big endian bus
Date: Wed, 26 Jun 2019 10:57:52 +0200	[thread overview]
Message-ID: <95e2e7c1-962d-3ac7-baba-467f0f6c4041@redhat.com> (raw)
In-Reply-To: <81f9a447-8305-9de5-8a81-3e29299dfa2a@vivier.eu>

On 6/25/19 7:09 PM, Laurent Vivier wrote:
> Le 25/06/2019 à 17:57, Philippe Mathieu-Daudé a écrit :
>> On 6/24/19 10:07 PM, Laurent Vivier wrote:
>>> Hi,
>>>
>>> Jason, Can I have an Acked-by from you (as network devices maintainer)?
>>
>> Hmm something seems odd here indeed...
>>
>> What a stable model! This file has no logical modification since its
>> introduction, a65f56eeba "Implement sonic netcard (MIPS Jazz)"
>>
>> Here we had:
>>
>> static void dp8393x_writeb(void *opaque, hwaddr addr, uint32_t val)
>> {
>>     uint16_t old_val = dp8393x_readw(opaque, addr & ~0x1);
>>
>>     switch (addr & 3) {
>>     case 0:
>>         val = val | (old_val & 0xff00);
>>         break;
>>     case 1:
>>         val = (val << 8) | (old_val & 0x00ff);
>>         break;
>>     }
>>     dp8393x_writew(opaque, addr & ~0x1, val);
>> }
>>
>> So we had 16-bit endian shifting there.
>>
>> And few lines below:
>>
>>     /* XXX: Check byte ordering */
>>     ...
>>     /* Calculate the ethernet checksum */
>>     #ifdef SONIC_CALCULATE_RXCRC
>>         checksum = cpu_to_le32(crc32(0, buf, rx_len));
>>     #else
>>         checksum = 0;
>>     #endif
>>
>> After various housekeeping, we get:
>>
>> 84689cbb97 "net/dp8393x: do not use old_mmio accesses"
>>
>> The MIPS Jazz is known to run in both endianess, but I haven't checked
>> if at that time both were available.
>>
>> Have you tried this patch?
>>
>> -- >8 --
>> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
>> index bdb0b3b2c2..646e11206f 100644
>> @@ -651,7 +651,7 @@ static const MemoryRegionOps dp8393x_ops = {
>>      .write = dp8393x_write,
>>      .impl.min_access_size = 2,
>>      .impl.max_access_size = 2,
>> -    .endianness = DEVICE_NATIVE_ENDIAN,
>> +    .endianness = DEVICE_LITTLE_ENDIAN,
>>  };
>> ---
>>
>> (but then mips64-softmmu Jazz would have networking broken).
>>
> 
> I doesn't help, the endianness is a MemoryRegion property (see
> memory_region_wrong_endianness()) so it is used when the CPU writes to
> the device MMIO, not when the device accesses the other memory.
> In this case, it reads from system_memory. Perhaps we can create the
> address_space with a system_memory in big endian mode?

Ah I missed that...

What about not using address_space_rw(data) but directly use
address_space_lduw_le() and address_space_stw_le() instead?


  reply	other threads:[~2019-06-26  8:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 22:19 [Qemu-devel] [PATCH v8 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 01/10] escc: introduce a selector for the register bit Laurent Vivier
2019-06-21 14:09   ` Philippe Mathieu-Daudé
2019-06-24 20:00   ` Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 02/10] esp: add pseudo-DMA as used by Macintosh Laurent Vivier
2019-06-24 20:04   ` Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 03/10] dp8393x: manage big endian bus Laurent Vivier
2019-06-24 20:07   ` Laurent Vivier
2019-06-25 15:57     ` Philippe Mathieu-Daudé
2019-06-25 17:09       ` Laurent Vivier
2019-06-26  8:57         ` Philippe Mathieu-Daudé [this message]
2019-06-26 10:11           ` Laurent Vivier
2019-06-26 17:49             ` Philippe Mathieu-Daudé
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 04/10] hw/m68k: add via support Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 05/10] hw/m68k: implement ADB bus support for via Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 06/10] hw/m68k: add macfb video card Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 07/10] hw/m68k: add Nubus support Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 08/10] hw/m68k: add Nubus support for macfb video card Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 09/10] hw/m68k: add a dummy SWIM floppy controller Laurent Vivier
2019-06-19 22:19 ` [Qemu-devel] [PATCH v8 10/10] hw/m68k: define Macintosh Quadra 800 Laurent Vivier
2019-06-25 16:30   ` Thomas Huth
2019-06-26 17:51     ` Philippe Mathieu-Daudé
2019-06-26 18:32       ` Thomas Huth
2019-06-19 22:42 ` [Qemu-devel] [PATCH v8 00/10] hw/m68k: add Apple Machintosh Quadra 800 machine no-reply
2019-06-22 14:22 ` Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95e2e7c1-962d-3ac7-baba-467f0f6c4041@redhat.com \
    --to=philmd@redhat.com \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=dgilbert@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=hpoussin@reactos.org \
    --cc=huth@tuxfamily.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).