[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 11/14] ioport: Switch dispatching to memory c
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [PATCH v3 11/14] ioport: Switch dispatching to memory core layer |
Date: |
Fri, 12 Jul 2013 14:36:02 -0500 |
User-agent: |
Notmuch/0.15.2+202~g0c4b8aa (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) |
Hervé Poussineau <address@hidden> writes:
> Jan Kiszka a écrit :
>> From: Jan Kiszka <address@hidden>
>>
>> The current ioport dispatcher is a complex beast, mostly due to the
>> need to deal with old portio interface users. But we can overcome it
>> without converting all portio users by embedding the required base
>> address of a MemoryRegionPortio access into that data structure. That
>> removes the need to have the additional MemoryRegionIORange structure
>> in the loop on every access.
>>
>> To handle old portio memory ops, we simply install dispatching handlers
>> for portio memory regions when registering them with the memory core.
>> This removes the need for the old_portio field.
>>
>> We can drop the additional aliasing of ioport regions and also the
>> special address space listener. cpu_in and cpu_out now simply call
>> address_space_read/write. And we can concentrate portio handling in a
>> single source file.
>>
>> Signed-off-by: Jan Kiszka <address@hidden>
>> ---
>
> ...
>
>> +
>> +static void portio_write(void *opaque, hwaddr addr, uint64_t data,
>> + unsigned size)
>> +{
>> + MemoryRegionPortioList *mrpio = opaque;
>> + const MemoryRegionPortio *mrp = find_portio(mrpio, addr, size, true);
>> +
>> + if (mrp) {
>> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data);
>> + } else if (size == 2) {
>> + mrp = find_portio(mrpio, addr, 1, true);
>> + assert(mrp);
>> + mrp->write(mrpio->portio_opaque, mrp->base + addr, data & 0xff);
>> + mrp->write(mrpio->portio_opaque, mrp->base + addr + 1, data >> 8);
>> + }
>> +}
>> +
>> +static const MemoryRegionOps portio_ops = {
>> + .read = portio_read,
>> + .write = portio_write,
>> + .valid.unaligned = true,
>> + .impl.unaligned = true,
>> +};
>> +
>
> You need to mark these operations as DEVICE_LITTLE_ENDIAN.
> In portio_write above, you clearly assume that data is in LE format.
>
> This fixes PPC PReP emulation, which would otherwise be broken with this
> patchset.
Did you actually test that as this is how the code behaved previously?
Regards,
Anthony Liguori
>
> Hervé
- Re: [Qemu-devel] [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, (continued)
- [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Alexey Kardashevskiy, 2013/07/19
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Paolo Bonzini, 2013/07/19
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Alexey Kardashevskiy, 2013/07/19
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Alexey Kardashevskiy, 2013/07/19
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Alexey Kardashevskiy, 2013/07/19
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Paolo Bonzini, 2013/07/20
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Edgar E. Iglesias, 2013/07/20
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Hervé Poussineau, 2013/07/21
- Re: [Qemu-devel] BUG: Re: [PATCH v3 11/14] ioport: Switch dispatching to memory core layer, Paolo Bonzini, 2013/07/22
Re: [Qemu-devel] [PATCH v3 11/14] ioport: Switch dispatching to memory core layer,
Anthony Liguori <=