qemu-patch-raspberry4/target-i386
aliguori 165d9b82eb MTRR support on x86 (Carl-Daniel Hailfinger)
The current codebase ignores MTRR (Memory Type Range Register)
configuration writes and reads because Qemu does not implement caching.
All BIOS/firmware in know of for x86 do implement a mode called
Cache-as-RAM (CAR) which locks down the CPU cache lines and uses the CPU
cache like RAM before RAM is enabled. Qemu assumes RAM is accessible
from the start, but it would be nice to be able to run real
BIOS/firmware in Qemu. For that, we need CAR support and for CAR support
we have to support MTRRs.

This patch is a first step in that direction. MTRRs are MSRs supported
by all recent x86 CPUs, even old i586. Besides influencing cache, the
MTRRs can be written and read back, so discarding MTRR writes violates
the expectations of existing code out there.

An added benefit of this patch is that it fixes the following Linux
kernel error message present in recent kernels (provided the BIOS has
the recent MTRR patches applied):
 ------------[ cut here ]------------
WARNING: at arch/x86/kernel/cpu/mtrr/main.c:1500 mtrr_trim_uncached_memory+0x382/0x384()
WARNING: strange, CPU MTRRs all blank?
Modules linked in:
Supported: Yes
Pid: 0, comm: swapper Not tainted 2.6.27.7-9-default #1
 [<c0106570>] dump_trace+0x6b/0x249
 [<c01070a5>] show_trace+0x20/0x39
 [<c0343c02>] dump_stack+0x71/0x76
 [<c012acb2>] warn_slowpath+0x6f/0x90
 [<c0542f8f>] mtrr_trim_uncached_memory+0x382/0x384
 [<c053f24d>] setup_arch+0x40d/0x639
 [<c053a6ac>] start_kernel+0x6b/0x31f
 =======================
 ---[ end trace 4eaa2a86a8e2da22 ]---

Handle common x86 MTRR reads and writes, but don't act on them.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6449 c046a42c-6fe2-441c-8c8c-71466251a162
2009-01-26 17:53:04 +00:00
..
cpu.h MTRR support on x86 (Carl-Daniel Hailfinger) 2009-01-26 17:53:04 +00:00
exec.h Add noreturn function attribute 2009-01-14 19:00:36 +00:00
helper.c Update FSF address in GPL/LGPL boilerplate 2009-01-04 22:05:52 +00:00
helper.h TCG variable type checking. 2008-11-17 14:43:54 +00:00
helper_template.h Update FSF address in GPL/LGPL boilerplate 2009-01-04 22:05:52 +00:00
kvm.c Initialize msr list size properly in KVM 2008-12-13 20:49:31 +00:00
machine.c x86: Debug register emulation (Jan Kiszka) 2008-11-18 21:08:15 +00:00
op_helper.c MTRR support on x86 (Carl-Daniel Hailfinger) 2009-01-26 17:53:04 +00:00
ops_sse.h Update FSF address in GPL/LGPL boilerplate 2009-01-04 22:05:52 +00:00
ops_sse_header.h Update FSF address in GPL/LGPL boilerplate 2009-01-04 22:05:52 +00:00
svm.h reworked SVM interrupt handling logic - fixed vmrun EIP saved value - reworked cr8 handling - added CPUState.hflags2 2008-06-04 17:02:19 +00:00
TODO SVM rework 2008-05-28 16:16:54 +00:00
translate.c global s/loglevel & X/qemu_loglevel_mask(X)/ (Eduardo Habkost) 2009-01-15 22:36:53 +00:00