Re: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable MPIC for E500 platform.

2009-02-20 Thread Blue Swirl
On 2/20/09, Aurelien Jarno  wrote:
> On Tue, Feb 17, 2009 at 04:55:51PM +0200, Blue Swirl wrote:
>  > On 2/17/09, Liu Yu  wrote:
>  > > MPIC and OpenPIC have very similar design.
>  > >  So a lot of code can be reused.
>  > >
>  > >  Modification mainly include:
>  > >  1. keep struct openpic_t to the maximum size of both MPIC and OpenPIC.
>  > >  2. endianess swap.
>  > >MPIC has the same endianess as target, so no need to swap for MPIC.
>  >
>  > I don't think this is correct, the host can still be different endian
>  > from target.
>  >
>
>
> I do not agree. As long as we don't manipulate host memory, the host
>  endianess has nothing to do. The values are simply passed by value, they
>  don't need to be swapped.

Sorry, I stand corrected.
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable MPIC for E500 platform.

2009-02-19 Thread Aurelien Jarno
On Tue, Feb 17, 2009 at 04:55:51PM +0200, Blue Swirl wrote:
> On 2/17/09, Liu Yu  wrote:
> > MPIC and OpenPIC have very similar design.
> >  So a lot of code can be reused.
> >
> >  Modification mainly include:
> >  1. keep struct openpic_t to the maximum size of both MPIC and OpenPIC.
> >  2. endianess swap.
> >MPIC has the same endianess as target, so no need to swap for MPIC.
> 
> I don't think this is correct, the host can still be different endian
> from target.
> 

I do not agree. As long as we don't manipulate host memory, the host
endianess has nothing to do. The values are simply passed by value, they
don't need to be swapped.

-- 
Aurelien Jarno  GPG: 1024D/F1BCDB73
aurel...@aurel32.net http://www.aurel32.net
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable MPIC for E500 platform.

2009-02-17 Thread Liu Yu-B13201

> -Original Message-
> From: Blue Swirl [mailto:blauwir...@gmail.com] 
> Sent: Tuesday, February 17, 2009 10:56 PM
> To: qemu-de...@nongnu.org
> Cc: aurel...@aurel32.net; holl...@us.ibm.com; Liu Yu-B13201; 
> kvm-ppc@vger.kernel.org
> Subject: Re: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable 
> MPIC for E500 platform.
> 
> On 2/17/09, Liu Yu  wrote:
> > MPIC and OpenPIC have very similar design.
> >  So a lot of code can be reused.
> >
> >  Modification mainly include:
> >  1. keep struct openpic_t to the maximum size of both MPIC 
> and OpenPIC.
> >  2. endianess swap.
> >MPIC has the same endianess as target, so no need to 
> swap for MPIC.
> 
> I don't think this is correct, the host can still be different endian
> from target.
> 

How does host endian involve?
Test a certain bit written by guest?


> >  3. using different init functions and function pointers 
> for reset and irq raise.
> 
> You didn't register the reset handler with qemu_register_reset.
> 

Fixed.

> >  Haven't test OpenPIC.
> >
> >  Signed-off-by: Liu Yu 
> 
> >  +static void mpic_src_write (void *opaque, uint32_t addr, 
> uint32_t val)
> 
> >  +if (addr < 0x180) {
> >  +idx = MPIC_EXT_IRQ;
> >  +} else if (addr >= 0x200 && addr < 0xa00) {
> >  +idx = MPIC_INT_IRQ;
> >  +addr -= 0x200;
> >  +} else if (addr >= 0x1600 && addr < 0x1700) {
> >  +idx = MPIC_MSG_IRQ;
> >  +addr -= 0x1600;
> >  +} else if (addr >= 0x1C00 && addr < 0x1D00) {
> >  +idx = MPIC_MSI_IRQ;
> >  +addr -= 0x1C00;
> >  +} else {
> >  +return;
> 
> It would be faster and simpler to register different handlers for
> these memory areas, same goes for mpic_src_read, mpic_writel and
> mpic_readl.
> 
Hmmm, will fix.

> >  +register_savevm("mpic", 0, 1, openpic_save, 
> openpic_load,  mpp);
> 
> When the save format changes, the version number should be bumped.
> 

Fixed. 


Re: [Qemu-devel] [PATCH 1/5] kvm/powerpc: Enable MPIC for E500 platform.

2009-02-17 Thread Blue Swirl
On 2/17/09, Liu Yu  wrote:
> MPIC and OpenPIC have very similar design.
>  So a lot of code can be reused.
>
>  Modification mainly include:
>  1. keep struct openpic_t to the maximum size of both MPIC and OpenPIC.
>  2. endianess swap.
>MPIC has the same endianess as target, so no need to swap for MPIC.

I don't think this is correct, the host can still be different endian
from target.

>  3. using different init functions and function pointers for reset and irq 
> raise.

You didn't register the reset handler with qemu_register_reset.

>  Haven't test OpenPIC.
>
>  Signed-off-by: Liu Yu 

>  +static void mpic_src_write (void *opaque, uint32_t addr, uint32_t val)

>  +if (addr < 0x180) {
>  +idx = MPIC_EXT_IRQ;
>  +} else if (addr >= 0x200 && addr < 0xa00) {
>  +idx = MPIC_INT_IRQ;
>  +addr -= 0x200;
>  +} else if (addr >= 0x1600 && addr < 0x1700) {
>  +idx = MPIC_MSG_IRQ;
>  +addr -= 0x1600;
>  +} else if (addr >= 0x1C00 && addr < 0x1D00) {
>  +idx = MPIC_MSI_IRQ;
>  +addr -= 0x1C00;
>  +} else {
>  +return;

It would be faster and simpler to register different handlers for
these memory areas, same goes for mpic_src_read, mpic_writel and
mpic_readl.

>  +register_savevm("mpic", 0, 1, openpic_save, openpic_load,  mpp);

When the save format changes, the version number should be bumped.
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html