From: Hollis Blanchard <hollisb@us.ibm.com>
To: Liu Yu <Yu.Liu@freescale.com>
Cc: qemu-devel@nongnu.org, kvm-ppc@vger.kernel.org
Subject: [Qemu-devel] RE: [PATCH 9/9] powerpc/kvm: Add MPC85xx board support
Date: Tue, 20 Jan 2009 11:23:05 -0600 [thread overview]
Message-ID: <1232472185.18665.1.camel@slate.austin.ibm.com> (raw)
In-Reply-To: <0A1FE637C2C7E148B9573BB60CC630E507D3BE@zch01exm26.fsl.freescale.net>
On Tue, 2009-01-20 at 11:09 +0800, Liu Yu wrote:
> > -----Original Message-----
> > From: kvm-ppc-owner@vger.kernel.org
> > [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Hollis Blanchard
> > Sent: Saturday, January 17, 2009 2:10 AM
> > To: Liu Yu-B13201
> > Cc: qemu-devel@nongnu.org; kvm-ppc@vger.kernel.org
> > Subject: RE: [PATCH 9/9] powerpc/kvm: Add MPC85xx board support
> >
> > Hmm, I have no idea why I didn't see this patch. Maybe it got
> > caught in
> > a spam filter.
>
> I should have cc to you...
>
> >
> > On Fri, 2009-01-16 at 16:22 +0800, Liu Yu wrote:
> > > > -----Original Message-----
> > > > From: Liu Yu-B13201
> > > > Sent: Thursday, January 15, 2009 8:34 PM
> > > > To: qemu-devel@nongnu.org
> > > > Cc: kvm-ppc@vger.kernel.org; Liu Yu-B13201
> > > > Subject: [PATCH 9/9] powerpc/kvm: Add MPC85xx board support
> > > >
> > > > MPC85xx adopts E500 core.
> > > > This patch hopes to support all MPC85xx boards.
> > > >
> > > > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > > > --- /dev/null
> > > > +++ b/hw/ppce500_mpc85xx.c
> > > > +static void mpc85xx_init(ram_addr_t ram_size, int vga_ram_size,
> > > > + const char *boot_device, DisplayState *ds,
> > > > + const char *kernel_filename,
> > > > + const char *kernel_cmdline,
> > > > + const char *initrd_filename,
> > > > + const char *cpu_model)
> > > > +{
> > > > + PCIBus *pci_bus;
> > > > + CPUState *env;
> > > > + uint64_t elf_entry;
> > > > + uint64_t elf_lowaddr;
> > > > + target_ulong entry=0;
> > > > + target_ulong loadaddr=UIMAGE_LOAD_BASE;
> > > > + target_long kernel_size=0;
> > > > + target_ulong dt_base=DTB_LOAD_BASE;
> > > > + target_ulong initrd_base=INITRD_LOAD_BASE;
> > > > + target_long initrd_size=0;
> > > > + void *fdt;
> > > > + int i=0;
> > > > + unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
> > > > + qemu_irq *irqs, *mpic, *pci_irqs;
> > > > + SerialState * serial[2];
> > > > +
> > > > + /* Setup CPU */
> > > > + env = ppce500_init(&ram_size);
> > > > +
> > > > + /* MPIC */
> > > > + irqs = qemu_mallocz(sizeof(qemu_irq) * MPIC_OUTPUT_NB);
> > > > + irqs[MPIC_OUTPUT_INT] = ((qemu_irq
> > > > *)env->irq_inputs)[PPCE500_INPUT_INT];
> > > > + irqs[MPIC_OUTPUT_CINT] = ((qemu_irq
> > > > *)env->irq_inputs)[PPCE500_INPUT_CINT];
> > > > + mpic = mpic_init(MPC85xx_MPIC_REGS_BASE, 1, &irqs, NULL);
> > > > +
> > > > + /* Serial */
> > > > + if (serial_hds[0])
> > > > + serial[0] = serial_mm_init(MPC85xx_SERIAL0_REGS_BASE,
> > > > + 0, mpic[12+26], 399193,
> > > > + serial_hds[0], 1);
> > > > +
> > > > + if (serial_hds[1])
> > > > + serial[0] = serial_mm_init(MPC85xx_SERIAL1_REGS_BASE,
> > > > + 0, mpic[12+26], 399193,
> > > > + serial_hds[0], 1);
> > > > +
> > > > + /* PCI */
> > > > + pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4);
> > > > + pci_irqs[0] = mpic[pci_irq_nrs[0]];
> > > > + pci_irqs[1] = mpic[pci_irq_nrs[1]];
> > > > + pci_irqs[2] = mpic[pci_irq_nrs[2]];
> > > > + pci_irqs[3] = mpic[pci_irq_nrs[3]];
> > > > + pci_bus = ppce500_pci_init(pci_irqs, MPC85xx_PCI_REGS_BASE);
> > > > + if (!pci_bus)
> > > > + printf("couldn't create PCI controller!\n");
> > > > +
> > > > + isa_mmio_init(MPC85xx_PCI_IO, MPC85xx_PCI_IOLEN);
> > > > +
> > > > + /* Register mem */
> > > > + cpu_register_physical_memory(0, ram_size, 0);
> > >
> > > Hollis, I didn't see the memeory register like this in 440 code.
> > > Is that a bug?
> >
> > RAM is allocated in vl.c (see the call to qemu_vmalloc()), so it looks
> > like you're actually allocating twice the amount of memory you should
> > be.
> >
>
> It's odd.
> I cannot make it work without cpu_register_physical_memory() which
> ultimately call kvm_set_phys_mem().
> But qemu_vmalloc() seems just to call mmap().
> Did I miss anything?
OK, I was *really* confused on this one for a while... you're correct,
you must call cpu_register_physical_memory().
On 4xx, that is done by the memory controller emulation
(sdram_set_bcr()). Since you aren't using that code, you do need to call
it yourself.
--
Hollis Blanchard
IBM Linux Technology Center
next prev parent reply other threads:[~2009-01-20 17:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 12:34 [Qemu-devel] [PATCH 0/9] powerpc/kvm: Add MPC85xx platform support Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 1/9] powerpc/kvm: Fix a uninitialized bug Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 2/9] powerpc/kvm: fix a openpic bug Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 3/9] powerpc/kvm: Enable mpic for E500 platform Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 4/9] powerpc/kvm: enable POWERPC_MMU_BOOKE_FSL when kvm is enabled Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 5/9] powerpc/kvm: Add freescale pci controller's support Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 6/9] powerpc/kvm: Add E500 irq support Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 7/9] powerpc/kvm: Add E500 core emulation Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 8/9] powerpc/kvm: extern one function for E500 code use Liu Yu
[not found] ` <1232022857-2315-10-git-send-email-yu.liu@freescale.com>
2009-01-16 8:22 ` [Qemu-devel] RE: [PATCH 9/9] powerpc/kvm: Add MPC85xx board support Liu Yu
2009-01-16 18:09 ` Hollis Blanchard
2009-01-20 3:09 ` Liu Yu
2009-01-20 17:23 ` Hollis Blanchard [this message]
2009-01-15 19:53 ` [Qemu-devel] Re: [PATCH 7/9] powerpc/kvm: Add E500 core emulation Hollis Blanchard
2009-01-16 7:51 ` [Qemu-devel] " Liu Yu
2009-01-16 18:02 ` Hollis Blanchard
2009-01-19 10:54 ` Liu Yu
2009-01-19 10:59 ` Liu Yu
2009-01-15 20:02 ` [Qemu-devel] Re: [PATCH 5/9] powerpc/kvm: Add freescale pci controller's support Hollis Blanchard
2009-01-16 7:37 ` [Qemu-devel] " Liu Yu
2009-01-15 21:22 ` [Qemu-devel] [PATCH 3/9] powerpc/kvm: Enable mpic for E500 platform Anthony Liguori
2009-01-16 5:34 ` Liu Yu
2009-01-16 18:17 ` Hollis Blanchard
2009-01-16 21:20 ` Aurelien Jarno
2009-01-15 20:06 ` [Qemu-devel] Re: [PATCH 0/9] powerpc/kvm: Add MPC85xx platform support Hollis Blanchard
2009-01-15 21:26 ` [Qemu-devel] " Anthony Liguori
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=1232472185.18665.1.camel@slate.austin.ibm.com \
--to=hollisb@us.ibm.com \
--cc=Yu.Liu@freescale.com \
--cc=kvm-ppc@vger.kernel.org \
--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).