All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Dave Jones <davej@redhat.com>, Avi Kivity <avi@redhat.com>,
	KVM list <kvm@vger.kernel.org>
Subject: [PATCH] x86info: mtrr.c return if MTRR registers are not accessible
Date: Sat, 30 May 2009 18:38:38 +0530	[thread overview]
Message-ID: <1243688918.3623.4.camel@localhost.localdomain> (raw)


In some virtualization systems like KVM where MTRR registers
are not accessible output looks like :

MTRR registers:
MTRRcap (0xfe): MTRRphysBase0 (0x200): MTRRphysMask0 (0x201): MTRRphysBase1 (0x202): MTRRphysMask1 (0x203): MTRRphysBase2 (0x204): MTRRphysMask2 (0x205): MTRRphysBase3 (0x206): MTRRphysMask3 (0x207): MTRRphysBase4 (0x208): MTRRphysMask4 (0x209): MTRRphysBase5 (0x20a): MTRRphysMask5 (0x20b): MTRRphysBase6 (0x20c): MTRRphysMask6 (0x20d): MTRRphysBase7 (0x20e): MTRRphysMask7 (0x20f): MTRRfix64K_00000 (0x250): MTRRfix16K_80000 (0x258): MTRRfix16K_A0000 (0x259): MTRRfix4K_C8000 (0x269): MTRRfix4K_D0000 0x26a: MTRRfix4K_D8000 0x26b: MTRRfix4K_E0000 0x26c: MTRRfix4K_E8000 0x26d: MTRRfix4K_F0000 0x26e: MTRRfix4K_F8000 0x26f: MTRRdefType (0x2ff):

So better return for those cases.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 mtrr.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mtrr.c b/mtrr.c
index 32b5959..b948f67 100644
--- a/mtrr.c
+++ b/mtrr.c
@@ -20,11 +20,19 @@ static void dump_mtrr(int cpu, int msr)
 
 void dump_mtrrs(struct cpudata *cpu)
 {
+	unsigned long long val = 0;
 	unsigned int i;
 
 	if (!(cpu->flags_edx & (X86_FEATURE_MTRR)))
 		return;
 
+	/*
+	 * If MTRR registers are not accessible like in some
+	 * virtualization systems then return
+	 */
+	if (!read_msr(cpu->number, 0xfe, &val))
+		return;
+
 	printf("MTRR registers:\n");
 
 	printf("MTRRcap (0xfe): ");
-- 
1.6.0.6




             reply	other threads:[~2009-05-30 13:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-30 13:08 Jaswinder Singh Rajput [this message]
2009-05-30 14:18 ` [PATCH] x86info: mtrr.c return if MTRR registers are not accessible Dave Jones

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=1243688918.3623.4.camel@localhost.localdomain \
    --to=jaswinder@kernel.org \
    --cc=avi@redhat.com \
    --cc=davej@redhat.com \
    --cc=kvm@vger.kernel.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 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.