From: Fabien Chouteau <chouteau@adacore.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Memory API conversion for mpic (openpic.c)
Date: Tue, 30 Aug 2011 15:46:39 +0200 [thread overview]
Message-ID: <4E5CE9BF.1070300@adacore.com> (raw)
In-Reply-To: <4E5CD594.40903@redhat.com>
On 30/08/2011 14:20, Avi Kivity wrote:
> On 08/29/2011 07:19 PM, Fabien Chouteau wrote:
>> This patch converts mpic to the new memory API.
>>
>> -static CPUReadMemoryFunc * const mpic_int_read[] = {
>> -&openpic_buggy_read,
>> -&openpic_buggy_read,
>> -&mpic_src_int_read,
>> -};
>> + switch (size) {
>> + case 4:
>
>
>> + default:
>> + DPRINTF("Invalid OPENPIC read access size:%d (must be 4)!\n", size);
>
> Here, you accept multiple sizes.
>
>> + }
>> + return retval;
>> +}
>>
>> -static CPUReadMemoryFunc * const mpic_msi_read[] = {
>> -&openpic_buggy_read,
>> -&openpic_buggy_read,
>> -&mpic_src_msi_read,
>> +static const MemoryRegionOps mpic_ops = {
>> + .read = mpic_read,
>> + .write = mpic_write,
>> + .endianness = DEVICE_BIG_ENDIAN,
>> + .impl = {
>> + .min_access_size = 4,
>> + .max_access_size = 4,
>> + },
>> };
>
> Here, you reject them. One of the two is redundant.
>
Right, I'll remove the second part and keep size handling in openpic.c as in
the current implementation.
>
>>
>> -qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,
>> - qemu_irq **irqs, qemu_irq irq_out)
>> +qemu_irq *mpic_init(MemoryRegion *address_space, target_phys_addr_t base,
>> + int nb_cpus, qemu_irq **irqs, qemu_irq irq_out)
>> {
>> openpic_t *mpp;
>> int i;
>> - struct {
>> - CPUReadMemoryFunc * const *read;
>> - CPUWriteMemoryFunc * const *write;
>> - target_phys_addr_t start_addr;
>> - ram_addr_t size;
>> - } const list[] = {
>> - {mpic_glb_read, mpic_glb_write, MPIC_GLB_REG_START, MPIC_GLB_REG_SIZE},
>> - {mpic_tmr_read, mpic_tmr_write, MPIC_TMR_REG_START, MPIC_TMR_REG_SIZE},
>> - {mpic_ext_read, mpic_ext_write, MPIC_EXT_REG_START, MPIC_EXT_REG_SIZE},
>> - {mpic_int_read, mpic_int_write, MPIC_INT_REG_START, MPIC_INT_REG_SIZE},
>> - {mpic_msg_read, mpic_msg_write, MPIC_MSG_REG_START, MPIC_MSG_REG_SIZE},
>> - {mpic_msi_read, mpic_msi_write, MPIC_MSI_REG_START, MPIC_MSI_REG_SIZE},
>> - {mpic_cpu_read, mpic_cpu_write, MPIC_CPU_REG_START, MPIC_CPU_REG_SIZE},
>> - };
>
> Why aren't you doing a 1:1 conversion? (i.e. generate a MemoryRegion for
>every cpu_register_io_memory). I prefer those as being easier to review.
And more efficient than my dispatching, I guess.
Is it OK to use MemoryRegionOps.old_mmio in this case or should we avoid this deprecated
interface?
--
Fabien Chouteau
next prev parent reply other threads:[~2011-08-30 13:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-29 16:19 [Qemu-devel] [PATCH] Memory API conversion for mpic (openpic.c) Fabien Chouteau
2011-08-30 12:20 ` Avi Kivity
2011-08-30 13:46 ` Fabien Chouteau [this message]
2011-08-30 13:48 ` Avi Kivity
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=4E5CE9BF.1070300@adacore.com \
--to=chouteau@adacore.com \
--cc=avi@redhat.com \
--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).