From: Hollis Blanchard Date: Mon, 12 Jan 2009 15:47:05 +0000 Subject: Re: [PATCH 2/5] qemu/kvm: E500 core emulation Message-Id: <200901120947.05760.hollisb@us.ibm.com> List-Id: References: <1231487809-1874-4-git-send-email-yu.liu@freescale.com> In-Reply-To: <1231487809-1874-4-git-send-email-yu.liu@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: kvm-ppc@vger.kernel.org On Monday 12 January 2009 03:02:10 Liu Yu wrote: > > -----Original Message----- > > From: kvm-ppc-owner@vger.kernel.org=20 > > [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Hollis Blanchard > > Sent: Saturday, January 10, 2009 4:16 AM > > To: Liu Yu-B13201 > > Cc: kvm-ppc@vger.kernel.org > > Subject: Re: [PATCH 2/5] qemu/kvm: E500 core emulation > >=20 > > On Fri, 2009-01-09 at 15:56 +0800, Liu Yu wrote: > > > Signed-off-by: Liu Yu > > > --- > > > =A0hw/ppce500.c | =A0 74=20 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > =A0hw/ppce500.h | =A0 66=20 > > +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > =A02 files changed, 140 insertions(+), 0 deletions(-) > > > =A0create mode 100644 hw/ppce500.c > > > =A0create mode 100644 hw/ppce500.h > > >=20 > > > diff --git a/hw/ppce500.c b/hw/ppce500.c > > > new file mode 100644 > > > index 0000000..13eab47 > > > --- /dev/null > > > +++ b/hw/ppce500.c > > > @@ -0,0 +1,74 @@ > > > +/* > > > + * Qemu PowerPC E500 core emualtion > > > + * > > > + * Copyright (C) 2009 Freescale Semiconductor, Inc. All=20 > > rights reserved. > > > + * > > > + * Author: Yu Liu, =A0 =A0 > > > + * > > > + * This file is derived from hw/ppc440.c > > > + * the copyright for that material belongs to the original owners. > >=20 > > I guess you based this off an old version of ppc440.c, which=20 > > isn't good > > because I improved that code a lot when merging in to qemu. > >=20 > > > + * This is free software; you can redistribute it and/or modify > > > + * it under the terms of =A0the GNU General =A0Public License=20 > > as published by > > > + * the Free Software Foundation; =A0either version 2 of the =A0 > > License, or > > > + * (at your option) any later version. > > > + */ > > > + > > > +#include "hw.h" > > > +#include "pc.h" > > > +#include "hw/isa.h" > > > +#include "ppce500.h" > > > +#include "sysemu.h" > > > + > > > +#define PPCE500_SERIAL0_REGS=A0=A0=A0=A0=A0=A0=A00x4500 > > > +#define PPCE500_SERIAL1_REGS=A0=A0=A0=A0=A0=A0=A00x4600 > > > +#define PPCE500_MPIC_REGS=A0=A00x40000 > > > +#define bytes_to_mb(a) (a>>20) > > > + > > > +CPUState *ppce500_init(ram_addr_t *ram_size, > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0qemu_irq **pic, > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0target_ulong ccsrbar_base) > > > +{ > > > + =A0 =A0qemu_irq *mpic_irq, *irqs; > > > + =A0 =A0SerialState * serial[2]; > > > + =A0 =A0int ram_stick_sizes[] =3D {512<<20, 256<<20}; /* in bytes */ > >=20 > > Your memory controller only supports 512M and 256M? >=20 > I don't emulate the memory controller, so I think qemu/e500 coulde > support all kinds capacities. >=20 >=20 > >=20 > > > + =A0 =A0int i; > > > + =A0 =A0ram_addr_t tmp_ram_size; > > > + =A0 =A0CPUState *env; > > > + > > > + =A0 =A0/* Setup Memory */ > > > + =A0 =A0tmp_ram_size =3D *ram_size; > > > + > > > + =A0 =A0for (i=3D0;=20 > > i<(sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); i++) > > > +=A0=A0=A0while ((tmp_ram_size/ram_stick_sizes[i]) > 0) > > > +=A0=A0=A0 =A0 =A0tmp_ram_size -=3D ram_stick_sizes[i]; > > > + > > > + =A0 =A0if (tmp_ram_size) > > > +=A0=A0=A0*ram_size -=3D tmp_ram_size; > >=20 > > This code was all refactored into a much nicer form. Look at > > ppc4xx_sdram_adjust(), and rename it if you need it too. >=20 > As I haven't emulated memory controller, do I need to do this? No, you don't. In that case you should remove this ram code entirely. (The only reason we emulated the memory controller is because some of the=20 early Linux bootwrapper code on 4xx uses it.) --=20 Hollis Blanchard IBM Linux Technology Center