From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com,
stefano.stabellini@eu.citrix.com, Ian.Campbell@citrix.com,
jbeulich@suse.com
Cc: konrad.wilk@oracle.com
Subject: [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it
Date: Mon, 02 Apr 2012 16:27:26 -0400 [thread overview]
Message-ID: <caefa03c38366c3e70d9.1333398446@phenom.dumpdata.com> (raw)
In-Reply-To: <patchbomb.1333398444@phenom.dumpdata.com>
# HG changeset patch
# User Simon Graham <simon.graham@virtualcomputer.com>
# Date 1333398413 14400
# Node ID caefa03c38366c3e70d937bc95740c5d33c0892a
# Parent f1da2ce71ed41d1b74ebe6916ff7710d6579438e
xen/pat: After suspend re-write PAT if BIOS changed it.
Certain AMD machines (this was a MSI or GigaBYTE BIOS) after resume
would reset the PAT MSR causing rather weird issues - where
the pages would (say they would be set to WC) would end up with the
wrong type (as they would use the BIOS PAT instead of the one set by
the hypervisor). And in some cases the PAT was stuck and needed
a couple of WRMSRL to actually take.
Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff -r f1da2ce71ed4 -r caefa03c3836 xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c Mon Apr 02 16:26:48 2012 -0400
+++ b/xen/arch/x86/acpi/power.c Mon Apr 02 16:26:53 2012 -0400
@@ -41,8 +41,27 @@ static DEFINE_SPINLOCK(pm_lock);
struct acpi_sleep_info acpi_sinfo;
+static void pat_resume(void);
void do_suspend_lowlevel(void);
+static void
+pat_resume()
+{
+ u64 pat;
+ if (!cpu_has_pat)
+ return;
+
+ rdmsrl(MSR_IA32_CR_PAT, pat);
+ if (pat != host_pat) {
+ printk(KERN_INFO PREFIX "Found PAT MSR: 0x%"PRIx64"\n", pat);
+ printk(KERN_INFO PREFIX "reseting to 0x%"PRIx64"\n", host_pat);
+ wrmsrl(MSR_IA32_CR_PAT, host_pat);
+ rdmsrl(MSR_IA32_CR_PAT, pat);
+ if (pat != host_pat)
+ printk(KERN_WARNING PREFIX "PAT MSR stuck on: 0x%"PRIx64"\n", pat);
+ }
+}
+
static int device_power_down(void)
{
console_suspend();
@@ -194,6 +213,7 @@ static int enter_state(u32 state)
if ( cpu_has_efer )
write_efer(read_efer());
+ pat_resume();
device_power_up();
mcheck_init(&boot_cpu_data, 0);
next prev parent reply other threads:[~2012-04-02 20:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 20:27 [PATCH 0 of 3] Patches for Xen 4.2 (v2) Konrad Rzeszutek Wilk
2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
2012-04-03 7:14 ` Jan Beulich
2012-04-03 8:07 ` Ian Campbell
2012-04-02 20:27 ` Konrad Rzeszutek Wilk [this message]
2012-04-03 7:16 ` [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it Jan Beulich
2012-04-02 20:27 ` [PATCH 3 of 3] xend: Don't crash due to weird PCI devices Konrad Rzeszutek Wilk
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=caefa03c38366c3e70d9.1333398446@phenom.dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.