From: Ehrhardt Christian <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org
Cc: hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Subject: [PATCH 10 of 10] [PATCH] kvm-userspace: ppc: fix initial ppc memory setup
Date: Tue, 28 Oct 2008 16:52:38 +0100 [thread overview]
Message-ID: <4345c8a88ef1be5b0cae.1225209158@HelionPrime> (raw)
In-Reply-To: <patchbomb.1225209148@HelionPrime>
From: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
The old memory initialization code was broken for all cases not fitting in one
ram stick. This patch fixes the ram_stick calculation, now sets the proper
base adresses per stick and removes the old workaround.
Signed-off-by: Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
[diffstat]
ppc440.c | 12 +++++-------
ppc440.h | 8 ++++++--
ppc440_bamboo.c | 30 ++++++++++++++++++++----------
3 files changed, 31 insertions(+), 19 deletions(-)
[diff]
diff --git a/qemu/hw/ppc440.c b/qemu/hw/ppc440.c
--- a/qemu/hw/ppc440.c
+++ b/qemu/hw/ppc440.c
@@ -3,6 +3,7 @@
*
* Copyright 2007 IBM Corporation.
* Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
*
* This work is licensed under the GNU GPL license version 2 or later.
*
@@ -24,15 +25,15 @@
void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[2],
- target_phys_addr_t ram_sizes[2],
+ target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
+ target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
+ int nbanks,
qemu_irq **picp,
ppc4xx_pci_t **pcip,
int do_init)
{
ppc4xx_mmio_t *mmio;
qemu_irq *pic, *irqs;
- ram_addr_t offset;
ppc4xx_pci_t *pci;
int i;
@@ -55,10 +56,7 @@
/* SDRAM controller */
printf("trying to setup sdram controller\n");
/* XXX 440EP's ECC interrupts are on UIC1 */
- ppc405_sdram_init(env, pic[14], 2, ram_bases, ram_sizes, do_init);
- offset = 0;
- for (i = 0; i < 2; i++)
- offset += ram_sizes[i];
+ ppc405_sdram_init(env, pic[14], nbanks, ram_bases, ram_sizes, do_init);
/* PCI */
pci = ppc4xx_pci_init(env, pic,
diff --git a/qemu/hw/ppc440.h b/qemu/hw/ppc440.h
--- a/qemu/hw/ppc440.h
+++ b/qemu/hw/ppc440.h
@@ -3,6 +3,7 @@
*
* Copyright 2007 IBM Corporation.
* Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
*
* This work is licensed under the GNU GPL licence version 2 or later
*
@@ -20,9 +21,12 @@
#include "exec-all.h"
#include "boards.h"
+#define PPC440_MAX_RAM_SLOTS 4
+
void ppc440ep_init(CPUState *env,
- target_phys_addr_t ram_bases[2],
- target_phys_addr_t ram_sizes[2],
+ target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS],
+ target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS],
+ int nbanks,
qemu_irq **picp,
ppc4xx_pci_t **pcip,
int do_init);
diff --git a/qemu/hw/ppc440_bamboo.c b/qemu/hw/ppc440_bamboo.c
--- a/qemu/hw/ppc440_bamboo.c
+++ b/qemu/hw/ppc440_bamboo.c
@@ -2,7 +2,9 @@
* Qemu PowerPC 440 board emualtion
*
* Copyright 2007 IBM Corporation.
- * Authors: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ * Authors:
+ * Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+ * Christian Ehrhardt <ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
*
* This work is licensed under the GNU GPL license version 2 or later.
*
@@ -30,7 +32,8 @@
const char *cpu_model)
{
char *buf=NULL;
- target_phys_addr_t ram_bases[4], ram_sizes[4];
+ target_phys_addr_t ram_bases[PPC440_MAX_RAM_SLOTS];
+ target_phys_addr_t ram_sizes[PPC440_MAX_RAM_SLOTS];
NICInfo *nd;
qemu_irq *pic;
ppc4xx_pci_t *pci;
@@ -46,6 +49,8 @@
int ret;
int ram_stick_sizes[] = {256<<20, 128<<20, 64<<20,
32<<20, 16<<20, 8<<20 }; /* in bytes */
+ int nbanks = 0; /* number of used memory banks */
+ int next_bank_offset = 0;
ram_addr_t tmp_ram_size;
int i=0, k=0;
uint32_t cpu_freq;
@@ -55,15 +60,22 @@
printf("%s: START\n", __func__);
/* Setup Memory */
- printf("Ram size passed is: %i MB\n",
- bytes_to_mb((int)ram_size));
+ if (ram_size < 8<<20) {
+ printf("ERROR: ram size too small (min 8mb)\n");
+ exit(1);
+ } else
+ printf("Ram size passed is: %i MB\n",
+ bytes_to_mb((int)ram_size));
tmp_ram_size = ram_size;
- for (i=0; i < (sizeof(ram_sizes)/sizeof(ram_sizes[0])); i++) {
- for (k=0; k < (sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); k++) {
+ for (i = 0; i < PPC440_MAX_RAM_SLOTS; i++) {
+ for (k = 0; k < (sizeof(ram_stick_sizes)/sizeof(int)); k++) {
if ((tmp_ram_size/ram_stick_sizes[k]) > 0) {
ram_sizes[i] = ram_stick_sizes[k];
+ ram_bases[i] = next_bank_offset;
+ next_bank_offset += ram_stick_sizes[k];
+ nbanks++;
tmp_ram_size -= ram_stick_sizes[k];
break;
}
@@ -88,11 +100,8 @@
/* call init */
printf("Calling function ppc440_init\n");
- ppc440ep_init(env, ram_bases, ram_sizes, &pic, &pci, 1);
+ ppc440ep_init(env, ram_bases, ram_sizes, nbanks, &pic, &pci, 1);
printf("Done calling ppc440_init\n");
-
- /* Register mem */
- cpu_register_physical_memory(0, ram_size, 0);
/* load kernel with uboot loader */
printf("%s: load kernel\n", __func__);
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-10-28 15:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-28 15:52 [PATCH 00 of 10] kvm-userspace: ppc: userspace fixes for powerpc Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 01 of 10] [PATCH] kvm-userspace: powerpc: fix env->xer access Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 02 of 10] [PATCH] user: ppc: fix threading bugs in main-ppc.c Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 03 of 10] [PATCH] user: ppc: better error reporting in load_file Ehrhardt Christian
2008-10-29 9:33 ` Avi Kivity
2008-10-29 9:50 ` Christian Ehrhardt
2008-10-28 15:52 ` [PATCH 04 of 10] [PATCH] user: ppc: implement PowerPC 44x libcflat Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 05 of 10] [PATCH] libcflat: ppc: add timebase accessor Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 06 of 10] [PATCH] user: ppc: add stub nmi handler Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 07 of 10] [PATCH] qemu: ppc: define maximum SMP limit as 1 for Bamboo Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 08 of 10] [PATCH] qemu: ppc: if not a uImage, try to load kernel as ELF Ehrhardt Christian
2008-10-28 15:52 ` [PATCH 09 of 10] [PATCH] kvm: external module: Treat NONARCH_CONFIG as a list Ehrhardt Christian
2008-10-28 15:52 ` Ehrhardt Christian [this message]
2008-10-29 9:36 ` [PATCH 00 of 10] kvm-userspace: ppc: userspace fixes for powerpc Avi Kivity
2008-10-29 12:45 ` 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=4345c8a88ef1be5b0cae.1225209158@HelionPrime \
--to=ehrhardt-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.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