RE: [PATCH 7/9] powerpc/kvm: Add E500 core emulation

2009-01-19 Thread Liu Yu


 -Original Message-
 From: kvm-ppc-ow...@vger.kernel.org 
 [mailto:kvm-ppc-ow...@vger.kernel.org] On Behalf Of Liu Yu-B13201
 Sent: Monday, January 19, 2009 6:55 PM
 To: Hollis Blanchard
 Cc: qemu-de...@nongnu.org; kvm-ppc@vger.kernel.org
 Subject: RE: [PATCH 7/9] powerpc/kvm: Add E500 core emulation
 
 
  -Original Message-
  From: kvm-ppc-ow...@vger.kernel.org 
  [mailto:kvm-ppc-ow...@vger.kernel.org] On Behalf Of Hollis Blanchard
  Sent: Saturday, January 17, 2009 2:03 AM
  To: Liu Yu-B13201
  Cc: qemu-de...@nongnu.org; kvm-ppc@vger.kernel.org
  Subject: RE: [PATCH 7/9] powerpc/kvm: Add E500 core emulation
  
  On Fri, 2009-01-16 at 15:51 +0800, Liu Yu wrote:
   
   I still want to fixup guest memory size at certain 
  alignment boundary,
   so that KVM can handle the mmu easily.
  
  How about ram_size = ~(25620) then?
  
  The code that you copied is more complicated because it's 
  trying to fill
  in SDRAM banks which can only support a small range of fixed sizes.
  Since you don't have that problem, I think you should simplify.
  
 
 I am not sure should I support more complicated sizes such as 
 256 + 128
 + 64 = 448 MB

Hmm...,  I could use ram_size = ~(6420)
--
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


[PATCH 7/9] powerpc/kvm: Add E500 core emulation

2009-01-15 Thread Liu Yu
Signed-off-by: Liu Yu yu@freescale.com
---
 Makefile.target |1 +
 hw/ppce500.c|   49 +
 hw/ppce500.h|   44 
 3 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 hw/ppce500.c
 create mode 100644 hw/ppce500.h

diff --git a/Makefile.target b/Makefile.target
index 2079fcb..223d294 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -651,6 +651,7 @@ OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o 
ppc405_uc.o ppc405_boards.o
 OBJS+= ppc440.o ppc440_bamboo.o
 # PowerPC E500 boards
 OBJS+= ppce500_pci.o
+OBJS+= ppce500.o
 ifdef FDT_LIBS
 OBJS+= device_tree.o
 LIBS+= $(FDT_LIBS)
diff --git a/hw/ppce500.c b/hw/ppce500.c
new file mode 100644
index 000..856cce2
--- /dev/null
+++ b/hw/ppce500.c
@@ -0,0 +1,49 @@
+/*
+ * Qemu PowerPC E500 core emualtion
+ *
+ * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Yu Liu, yu@freescale.com
+ *
+ * This file is derived from hw/ppc440.c
+ * the copyright for that material belongs to the original owners.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of  the GNU General  Public License as published by
+ * the Free Software Foundation;  either version 2 of the  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 bytes_to_mb(a) (a20)
+
+CPUState *ppce500_init(ram_addr_t *ram_size)
+{
+int i;
+ram_addr_t tmp_ram_size;
+CPUState *env;
+int ram_stick_sizes[] = {51220, 25620, 12820, 6420}; /* in bytes */
+
+/* Setup Memory */
+tmp_ram_size = *ram_size;
+
+for (i=0; i(sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); i++)
+   while ((tmp_ram_size/ram_stick_sizes[i])  0)
+   tmp_ram_size -= ram_stick_sizes[i];
+
+if (tmp_ram_size)
+   *ram_size -= tmp_ram_size;
+
+env = cpu_ppc_init(e500v2_v30);
+if (!env) {
+   fprintf(stderr, Unable to initilize CPU!\n);
+   exit(1);
+}
+
+return env;
+}
diff --git a/hw/ppce500.h b/hw/ppce500.h
new file mode 100644
index 000..37c4375
--- /dev/null
+++ b/hw/ppce500.h
@@ -0,0 +1,44 @@
+/*
+ * QEMU PowerPC E500 emulation shared definitions
+ *
+ * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Yu Liu, yu@freescale.com
+ *
+ * This file is derived from hw/ppc440.h
+ * the copyright for that material belongs to the original owners.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of  the GNU General  Public License as published by
+ * the Free Software Foundation;  either version 2 of the  License, or
+ * (at your option) any later version.
+ */
+
+#if !defined(PPC_E500_H)
+#define PPC_E500_H
+
+#include hw.h
+#include pc.h
+#include qemu-timer.h
+#include sysemu.h
+#include exec-all.h
+#include boards.h
+
+/* PowerPC E500 XXX  initialization */
+extern CPUState *ppce500_init(ram_addr_t *ram_size);
+
+PCIBus *ppce500_pci_init(qemu_irq *pic, target_phys_addr_t registers);
+
+/* mpic.c */
+/* MPIC have 5 outputs per CPU connected and one IRQ out single output */
+enum {
+MPIC_OUTPUT_INT = 0, /* IRQ   */
+MPIC_OUTPUT_CINT,/* critical IRQ  */
+MPIC_OUTPUT_MCK, /* Machine check event   */
+MPIC_OUTPUT_DEBUG,   /* Inconditional debug event */
+MPIC_OUTPUT_RESET,   /* Core reset event  */
+MPIC_OUTPUT_NB,
+};
+qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,
+qemu_irq **irqs, qemu_irq irq_out);
+#endif /* !defined(PPC_E500_H) */
-- 
1.5.4

--
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: [PATCH 7/9] powerpc/kvm: Add E500 core emulation

2009-01-15 Thread Hollis Blanchard
On Thu, 2009-01-15 at 20:34 +0800, Liu Yu wrote:
 Signed-off-by: Liu Yu yu@freescale.com
 ---
  Makefile.target |1 +
  hw/ppce500.c|   49 +
  hw/ppce500.h|   44 
  3 files changed, 94 insertions(+), 0 deletions(-)
  create mode 100644 hw/ppce500.c
  create mode 100644 hw/ppce500.h
 
 diff --git a/Makefile.target b/Makefile.target
 index 2079fcb..223d294 100644
 --- a/Makefile.target
 +++ b/Makefile.target
 @@ -651,6 +651,7 @@ OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o 
 ppc405_uc.o ppc405_boards.o
  OBJS+= ppc440.o ppc440_bamboo.o
  # PowerPC E500 boards
  OBJS+= ppce500_pci.o
 +OBJS+= ppce500.o
  ifdef FDT_LIBS
  OBJS+= device_tree.o
  LIBS+= $(FDT_LIBS)
 diff --git a/hw/ppce500.c b/hw/ppce500.c
 new file mode 100644
 index 000..856cce2
 --- /dev/null
 +++ b/hw/ppce500.c
 @@ -0,0 +1,49 @@
 +/*
 + * Qemu PowerPC E500 core emualtion

emulation

 + * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
 + *
 + * Author: Yu Liu, yu@freescale.com
 + *
 + * This file is derived from hw/ppc440.c
 + * the copyright for that material belongs to the original owners.
 + *
 + * This is free software; you can redistribute it and/or modify
 + * it under the terms of  the GNU General  Public License as published by
 + * the Free Software Foundation;  either version 2 of the  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 bytes_to_mb(a) (a20)

Doesn't look like this is used.

 +CPUState *ppce500_init(ram_addr_t *ram_size)
 +{
 +int i;
 +ram_addr_t tmp_ram_size;
 +CPUState *env;
 +int ram_stick_sizes[] = {51220, 25620, 12820, 6420}; /* in bytes 
 */
 +
 +/* Setup Memory */
 +tmp_ram_size = *ram_size;
 +
 +for (i=0; i(sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); i++)
 + while ((tmp_ram_size/ram_stick_sizes[i])  0)
 + tmp_ram_size -= ram_stick_sizes[i];
 +
 +if (tmp_ram_size)
 + *ram_size -= tmp_ram_size;

Since you said you don't actually have a memory controller you're
emulating, I think you should completely remove all this ram_size stuff.
Once you do that, this whole function becomes just cpu_ppc_init(), so
you can just call that instead.

 +env = cpu_ppc_init(e500v2_v30);
 +if (!env) {
 + fprintf(stderr, Unable to initilize CPU!\n);

initialize

-- 
Hollis Blanchard
IBM Linux Technology Center

--
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