From: Marcelo Tosatti <mtosatti@redhat.com>
To: qemu-devel@nongnu.org, bochs-developers@lists.sourceforge.net
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Avi Kivity <avi@redhat.com>,
Alex Williamson <alex.williamson@hp.com>
Subject: [Qemu-devel] [patch 6/9] kvm: bios: cleanup/consolidate above 4G memory parsing
Date: Tue, 20 Jan 2009 00:30:46 -0200 [thread overview]
Message-ID: <20090120023057.871393430@amt.cnet> (raw)
In-Reply-To: 20090120023040.623163208@amt.cnet
[-- Attachment #1: 0007_mtrr_above_4g_clean.patch --]
[-- Type: text/plain, Size: 2085 bytes --]
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
From: Alex Williamson <alex.williamson@hp.com>
Index: bochs/bios/rombios32.c
===================================================================
--- bochs.orig/bios/rombios32.c
+++ bochs/bios/rombios32.c
@@ -427,7 +427,7 @@ uint32_t cpuid_signature;
uint32_t cpuid_features;
uint32_t cpuid_ext_features;
unsigned long ram_size;
-uint64_t above4g_ram_size;
+uint64_t ram_end;
uint8_t bios_uuid[16];
#ifdef BX_USE_EBDA_TABLES
unsigned long ebda_cur_addr;
@@ -562,9 +562,9 @@ void setup_mtrr(void)
wrmsr_smp(MTRRphysMask_MSR(i), (~vmask & 0xfffffff000ull) | 0x800);
vbase += vmask + 1;
}
- for (vbase = 1ull << 32; i < vcnt && vbase < above4g_ram_size; ++i) {
+ for (vbase = 1ull << 32; i < vcnt && vbase < ram_end; ++i) {
vmask = (1ull << 40) - 1;
- while (vbase + vmask + 1 > above4g_ram_size)
+ while (vbase + vmask + 1 > ram_end)
vmask >>= 1;
wrmsr_smp(MTRRphysBase_MSR(i), vbase | 6);
wrmsr_smp(MTRRphysMask_MSR(i), (~vmask & 0xfffffff000ull) | 0x800);
@@ -582,18 +582,19 @@ void ram_probe(void)
ram_size = (cmos_readb(0x30) | (cmos_readb(0x31) << 8)) * 1024 +
1 * 1024 * 1024;
if (cmos_readb(0x5b) | cmos_readb(0x5c) | cmos_readb(0x5d))
- above4g_ram_size = ((uint64_t)cmos_readb(0x5b) << 16) |
- ((uint64_t)cmos_readb(0x5c) << 24) | ((uint64_t)cmos_readb(0x5d) << 32);
+ ram_end = (((uint64_t)cmos_readb(0x5b) << 16) |
+ ((uint64_t)cmos_readb(0x5c) << 24) |
+ ((uint64_t)cmos_readb(0x5d) << 32)) + (1ull << 32);
+ else
+ ram_end = ram_size;
- if (above4g_ram_size)
- above4g_ram_size += 1ull << 32;
+ BX_INFO("end of ram=%ldMB\n", ram_end >> 20);
BX_INFO("ram_size=0x%08lx\n", ram_size);
#ifdef BX_USE_EBDA_TABLES
ebda_cur_addr = ((*(uint16_t *)(0x40e)) << 4) + 0x380;
BX_INFO("ebda_cur_addr: 0x%08lx\n", ebda_cur_addr);
#endif
- BX_INFO("top of ram %ldMB\n", above4g_ram_size >> 20);
setup_mtrr();
}
next prev parent reply other threads:[~2009-01-20 2:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-20 2:30 [Qemu-devel] [patch 0/9] Bochs BIOS MTRR support + SMBIOS updates Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 1/9] kvm: bios: update SMBIOS table to report memory above 4G Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 2/9] kvm: bios: generate mptable unconditionally Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 3/9] kvm: bios: add mtrr support Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 4/9] kvm: bios: smp " Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 5/9] kvm: bios: extend MTRRs to above 4G Marcelo Tosatti
2009-01-20 2:30 ` Marcelo Tosatti [this message]
2009-01-20 2:30 ` [Qemu-devel] [patch 7/9] kvm: bios: switch MTRRs to cover only the PCI range and default to WB Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 8/9] kvm: bios: resolve memory device roll over reporting issues with >32G guests Marcelo Tosatti
2009-01-20 2:30 ` [Qemu-devel] [patch 9/9] kvm: bios: fix smbios memory device length boundary condition Marcelo Tosatti
2009-01-21 21:47 ` [Qemu-devel] Re: [patch 0/9] Bochs BIOS MTRR support + SMBIOS updates 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=20090120023057.871393430@amt.cnet \
--to=mtosatti@redhat.com \
--cc=alex.williamson@hp.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=bochs-developers@lists.sourceforge.net \
--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).