From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>, patches@linaro.org
Subject: [Qemu-devel] [PATCH v3 5/7] hw/sun4m: Use the QEMUMachine max_ram to implement memory limit
Date: Tue, 29 Mar 2011 15:08:22 +0100 [thread overview]
Message-ID: <1301407704-24541-6-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1301407704-24541-1-git-send-email-peter.maydell@linaro.org>
Use the max_ram field in QEMUMachine to indicate maximum memory,
rather than a field in the sun4*_hwdef structure. This allows us
to use the vl.c check on RAM specifications rather than having to
code our own.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/sun4m.c | 42 ++++++++++++++++--------------------------
1 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/hw/sun4m.c b/hw/sun4m.c
index bd9ef91..2ae8c45 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -102,7 +102,6 @@ struct sun4m_hwdef {
uint8_t nvram_machine_id;
uint16_t machine_id;
uint32_t iommu_version;
- uint64_t max_mem;
const char * const default_cpu_model;
};
@@ -120,7 +119,6 @@ struct sun4d_hwdef {
uint8_t nvram_machine_id;
uint16_t machine_id;
uint32_t iounit_version;
- uint64_t max_mem;
const char * const default_cpu_model;
};
@@ -134,7 +132,6 @@ struct sun4c_hwdef {
uint8_t nvram_machine_id;
uint16_t machine_id;
uint32_t iommu_version;
- uint64_t max_mem;
const char * const default_cpu_model;
};
@@ -746,13 +743,6 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size,
RamDevice *d;
/* allocate RAM */
- if ((uint64_t)RAM_size > max_mem) {
- fprintf(stderr,
- "qemu: Too much memory for this machine: %d, maximum %d\n",
- (unsigned int)(RAM_size / (1024 * 1024)),
- (unsigned int)(max_mem / (1024 * 1024)));
- exit(1);
- }
dev = qdev_create(NULL, "memory");
s = sysbus_from_qdev(dev);
@@ -833,10 +823,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
/* set up devices */
- ram_init(0, RAM_size, hwdef->max_mem);
+ ram_init(0, RAM_size, hwdef->machine.max_ram);
/* models without ECC don't trap when missing ram is accessed */
if (!hwdef->ecc_base) {
- empty_slot_init(RAM_size, hwdef->max_mem - RAM_size);
+ empty_slot_init(RAM_size, hwdef->machine.max_ram - RAM_size);
}
prom_init(hwdef->slavio_base, bios_name);
@@ -1110,6 +1100,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCstation 5",
.init = ss5_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
.is_default = 1,
},
.iommu_base = 0x10000000,
@@ -1135,7 +1126,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = ss5_id,
.iommu_version = 0x05000000,
- .max_mem = 0x10000000,
.default_cpu_model = "Fujitsu MB86904",
},
/* SS-10 */
@@ -1146,6 +1136,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.init = ss10_init,
.use_scsi = 1,
.max_cpus = 4,
+ .max_ram = 0xf00000000ULL,
},
.iommu_base = 0xfe0000000ULL,
.tcx_base = 0xe20000000ULL,
@@ -1168,7 +1159,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x72,
.machine_id = ss10_id,
.iommu_version = 0x03000000,
- .max_mem = 0xf00000000ULL,
.default_cpu_model = "TI SuperSparc II",
},
/* SS-600MP */
@@ -1179,6 +1169,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.init = ss600mp_init,
.use_scsi = 1,
.max_cpus = 4,
+ .max_ram = 0xf00000000ULL,
},
.iommu_base = 0xfe0000000ULL,
.tcx_base = 0xe20000000ULL,
@@ -1199,7 +1190,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x71,
.machine_id = ss600mp_id,
.iommu_version = 0x01000000,
- .max_mem = 0xf00000000ULL,
.default_cpu_model = "TI SuperSparc II",
},
/* SS-20 */
@@ -1210,6 +1200,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.init = ss20_init,
.use_scsi = 1,
.max_cpus = 4,
+ .max_ram = 0xf00000000ULL,
},
.iommu_base = 0xfe0000000ULL,
.tcx_base = 0xe20000000ULL,
@@ -1248,7 +1239,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x72,
.machine_id = ss20_id,
.iommu_version = 0x13000000,
- .max_mem = 0xf00000000ULL,
.default_cpu_model = "TI SuperSparc II",
},
/* Voyager */
@@ -1258,6 +1248,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCstation Voyager",
.init = vger_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0x10000000,
.tcx_base = 0x50000000,
@@ -1278,7 +1269,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = vger_id,
.iommu_version = 0x05000000,
- .max_mem = 0x10000000,
.default_cpu_model = "Fujitsu MB86904",
},
/* LX */
@@ -1288,6 +1278,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCstation LX",
.init = ss_lx_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0x10000000,
.iommu_pad_base = 0x10004000,
@@ -1309,7 +1300,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = lx_id,
.iommu_version = 0x04000000,
- .max_mem = 0x10000000,
.default_cpu_model = "TI MicroSparc I",
},
/* SS-4 */
@@ -1319,6 +1309,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCstation 4",
.init = ss4_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0x10000000,
.tcx_base = 0x50000000,
@@ -1340,7 +1331,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = ss4_id,
.iommu_version = 0x05000000,
- .max_mem = 0x10000000,
.default_cpu_model = "Fujitsu MB86904",
},
/* SPARCClassic */
@@ -1350,6 +1340,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCClassic",
.init = scls_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0x10000000,
.tcx_base = 0x50000000,
@@ -1370,7 +1361,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = scls_id,
.iommu_version = 0x05000000,
- .max_mem = 0x10000000,
.default_cpu_model = "TI MicroSparc I",
},
/* SPARCbook */
@@ -1380,6 +1370,7 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.desc = "Sun4m platform, SPARCbook",
.init = sbook_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0x10000000,
.tcx_base = 0x50000000, // XXX
@@ -1400,7 +1391,6 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = sbook_id,
.iommu_version = 0x05000000,
- .max_mem = 0x10000000,
.default_cpu_model = "TI MicroSparc I",
},
};
@@ -1452,7 +1442,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS);
/* set up devices */
- ram_init(0, RAM_size, hwdef->max_mem);
+ ram_init(0, RAM_size, hwdef->machine.max_ram);
prom_init(hwdef->slavio_base, bios_name);
@@ -1571,6 +1561,7 @@ static const struct sun4d_hwdef sun4d_hwdefs[] = {
.init = ss1000_init,
.use_scsi = 1,
.max_cpus = 8,
+ .max_ram = 0xf00000000ULL,
},
.iounit_bases = {
0xfe0200000ULL,
@@ -1593,7 +1584,6 @@ static const struct sun4d_hwdef sun4d_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = ss1000_id,
.iounit_version = 0x03000000,
- .max_mem = 0xf00000000ULL,
.default_cpu_model = "TI SuperSparc II",
},
/* SS-2000 */
@@ -1604,6 +1594,7 @@ static const struct sun4d_hwdef sun4d_hwdefs[] = {
.init = ss2000_init,
.use_scsi = 1,
.max_cpus = 20,
+ .max_ram = 0xf00000000ULL,
},
.iounit_bases = {
0xfe0200000ULL,
@@ -1626,7 +1617,6 @@ static const struct sun4d_hwdef sun4d_hwdefs[] = {
.nvram_machine_id = 0x80,
.machine_id = ss2000_id,
.iounit_version = 0x03000000,
- .max_mem = 0xf00000000ULL,
.default_cpu_model = "TI SuperSparc II",
},
};
@@ -1674,7 +1664,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
cpu_devinit(cpu_model, 0, hwdef->slavio_base, &cpu_irqs);
/* set up devices */
- ram_init(0, RAM_size, hwdef->max_mem);
+ ram_init(0, RAM_size, hwdef->machine.max_ram);
prom_init(hwdef->slavio_base, bios_name);
@@ -1784,6 +1774,7 @@ static const struct sun4c_hwdef sun4c_hwdefs[] = {
.desc = "Sun4c platform, SPARCstation 2",
.init = ss2_init,
.use_scsi = 1,
+ .max_ram = 0x10000000,
},
.iommu_base = 0xf8000000,
.tcx_base = 0xfe000000,
@@ -1800,7 +1791,6 @@ static const struct sun4c_hwdef sun4c_hwdefs[] = {
.aux1_base = 0xf7400003,
.nvram_machine_id = 0x55,
.machine_id = ss2_id,
- .max_mem = 0x10000000,
.default_cpu_model = "Cypress CY7C601",
},
};
--
1.7.1
next prev parent reply other threads:[~2011-03-29 14:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 14:08 [Qemu-devel] [PATCH v3 0/7] Let boards state maximum RAM limits in QEMUMachine struct Peter Maydell
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 1/7] Allow boards to specify maximum RAM size Peter Maydell
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 2/7] hw: Add maximum RAM specifications for ARM devboard models Peter Maydell
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 3/7] vl.c: Fix machine registration so QEMUMachine structs can be const Peter Maydell
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 4/7] hw/sun4m: Move QEMUMachine structs into sun4*_hwdef structs Peter Maydell
2011-03-29 14:08 ` Peter Maydell [this message]
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 6/7] hw/sun4m: Use a macro to hide the repetitive board init functions Peter Maydell
2011-03-29 14:08 ` [Qemu-devel] [PATCH v3 7/7] hw: Make QEMUMachine structure definitions const Peter Maydell
2011-03-30 7:48 ` [Qemu-devel] [PATCH v3 0/7] Let boards state maximum RAM limits in QEMUMachine struct Jes Sorensen
2011-03-30 8:09 ` Peter Maydell
2011-03-30 10:51 ` Jes Sorensen
2011-03-30 13:22 ` Peter Maydell
2011-03-30 13:55 ` Jes Sorensen
2011-03-30 13:56 ` Anthony Liguori
2011-03-30 14:07 ` Peter Maydell
2011-04-04 14:29 ` Jes Sorensen
2011-04-04 14:42 ` Peter Maydell
2011-04-04 14:53 ` Jes Sorensen
2011-04-04 16:54 ` Blue Swirl
2011-04-12 13:58 ` Jes Sorensen
2011-04-04 17:26 ` Peter Maydell
2011-04-12 13:55 ` Jes Sorensen
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=1301407704-24541-6-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=blauwirbel@gmail.com \
--cc=patches@linaro.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).