|
From: | Mark Cave-Ayland |
Subject: | Re: [PATCH v6 1/4] memory: prevent dma-reentracy issues |
Date: | Fri, 10 Mar 2023 13:07:51 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 |
On 10/03/2023 12:45, Peter Maydell wrote:
On Fri, 10 Mar 2023 at 12:32, Alexander Bulekov <alxndr@bu.edu> wrote:This MR seems to be "lsi-ram". From hw/scsi/lsi53c895a.c: memory_region_init_io(&s->ram_io, OBJECT(s), &lsi_ram_ops, s, "lsi-ram", 0x2000); So the LSI device is reading an LSI "Script" from its own IO region.. In this particular case, I think there was no reason to use memory_region_init_io rather than memory_region_init_ram, but this makes me worried that there are other devices that use something like this.This particular device predates the entire MemoryRegion set of abstractions, so it might have seemed easier at the time. The endianness handling of the current code is also a bit confusing and might make it tricky to convert to a RAM MR.
Since the LSI controller is attached to a PCI BAR then the accesses from the host to the RAM should all be little endian (you can see the conversions in the driver I wrote for the 40p machine to allow it to boot Linux: https://github.com/openbios/openbios/blob/master/drivers/lsi.c).
I'm mildly curious that read_dword() which reads the SCRIPTS program internally returns the value via cpu_to_le32(), as at first glance I would expect that to be the other way around...
ATB, Mark.
[Prev in Thread] | Current Thread | [Next in Thread] |