All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Avi Kivity <avi@redhat.com>, Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@osdl.org>, Zachary Amsden <zach@vmware.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	kvm@vger.kernel.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Haren Myneni <hbabu@us.ibm.com>,
	Simon Horman <horms@verge.net.au>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andrey Borzenkov <arvidjaar@mail.ru>,
	mingo@redhat.com, Vivek Goyal <vgoyal@redhat.com>
Subject: [PATCH 09/12] kvm: svm: move svm_hardware_disable() code to asm/virtext.h
Date: Mon, 17 Nov 2008 19:03:21 -0200	[thread overview]
Message-ID: <1226955804-16802-10-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1226955804-16802-1-git-send-email-ehabkost@redhat.com>

Create cpu_svm_disable() function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/include/asm/virtext.h |   14 ++++++++++++++
 arch/x86/kvm/svm.c             |    6 +-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
index 6f0d409..2cfe363 100644
--- a/arch/x86/include/asm/virtext.h
+++ b/arch/x86/include/asm/virtext.h
@@ -107,4 +107,18 @@ static inline int cpu_has_svm(const char **msg)
 	return 1;
 }
 
+
+/** Disable SVM on the current CPU
+ *
+ * You should call this only if cpu_has_svm() returned true.
+ */
+static inline void cpu_svm_disable(void)
+{
+	uint64_t efer;
+
+	wrmsrl(MSR_VM_HSAVE_PA, 0);
+	rdmsrl(MSR_EFER, efer);
+	wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
+}
+
 #endif /* _ASM_X86_VIRTEX_H */
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 64241f5..7ded2ee 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -259,11 +259,7 @@ static int has_svm(void)
 
 static void svm_hardware_disable(void *garbage)
 {
-	uint64_t efer;
-
-	wrmsrl(MSR_VM_HSAVE_PA, 0);
-	rdmsrl(MSR_EFER, efer);
-	wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
+	cpu_svm_disable();
 }
 
 static void svm_hardware_enable(void *garbage)
-- 
1.5.5.GIT


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com>
To: Avi Kivity <avi@redhat.com>, Ingo Molnar <mingo@elte.hu>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Simon Horman <horms@verge.net.au>, Andrew Morton <akpm@osdl.org>,
	Vivek Goyal <vgoyal@redhat.com>, Haren Myneni <hbabu@us.ibm.com>,
	Andrey Borzenkov <arvidjaar@mail.ru>,
	mingo@redhat.com, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Zachary Amsden <zach@vmware.com>,
	kexec@lists.infradead.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: [PATCH 09/12] kvm: svm: move svm_hardware_disable() code to asm/virtext.h
Date: Mon, 17 Nov 2008 19:03:21 -0200	[thread overview]
Message-ID: <1226955804-16802-10-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1226955804-16802-1-git-send-email-ehabkost@redhat.com>

Create cpu_svm_disable() function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch/x86/include/asm/virtext.h |   14 ++++++++++++++
 arch/x86/kvm/svm.c             |    6 +-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
index 6f0d409..2cfe363 100644
--- a/arch/x86/include/asm/virtext.h
+++ b/arch/x86/include/asm/virtext.h
@@ -107,4 +107,18 @@ static inline int cpu_has_svm(const char **msg)
 	return 1;
 }
 
+
+/** Disable SVM on the current CPU
+ *
+ * You should call this only if cpu_has_svm() returned true.
+ */
+static inline void cpu_svm_disable(void)
+{
+	uint64_t efer;
+
+	wrmsrl(MSR_VM_HSAVE_PA, 0);
+	rdmsrl(MSR_EFER, efer);
+	wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
+}
+
 #endif /* _ASM_X86_VIRTEX_H */
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 64241f5..7ded2ee 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -259,11 +259,7 @@ static int has_svm(void)
 
 static void svm_hardware_disable(void *garbage)
 {
-	uint64_t efer;
-
-	wrmsrl(MSR_VM_HSAVE_PA, 0);
-	rdmsrl(MSR_EFER, efer);
-	wrmsrl(MSR_EFER, efer & ~MSR_EFER_SVME_MASK);
+	cpu_svm_disable();
 }
 
 static void svm_hardware_enable(void *garbage)
-- 
1.5.5.GIT


  parent reply	other threads:[~2008-11-17 21:04 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17 21:03 [PATCH 00/12] x86: disable virt on kdump and emergency_restart (v4) Eduardo Habkost
2008-11-17 21:03 ` Eduardo Habkost
2008-11-17 21:03 ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 01/12] kvm: vmx: move vmx.h to include/asm Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 02/12] kvm: svm: move svm.h " Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 03/12] kvm: vmx: move ASM_VMX_* definitions from asm/kvm_host.h to asm/vmx.h Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 04/12] kvm: vmx: move cpu_has_kvm_support() to an inline on asm/virtext.h Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 05/12] x86: asm/virtext.h: add cpu_vmxoff() inline function Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 06/12] kvm: vmx: extract kvm_cpu_vmxoff() from hardware_disable() Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 07/12] x86: cpu_emergency_vmxoff() function Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 08/12] kvm: svm: move has_svm() code to asm/virtext.h Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` Eduardo Habkost [this message]
2008-11-17 21:03   ` [PATCH 09/12] kvm: svm: move svm_hardware_disable() " Eduardo Habkost
2008-11-17 21:03 ` [PATCH 10/12] x86: cpu_emergency_svm_disable() function Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 11/12] kdump: forcibly disable VMX and SVM on machine_crash_shutdown() Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-17 21:03 ` [PATCH 12/12] x86: disable VMX on all CPUs on reboot Eduardo Habkost
2008-11-17 21:03   ` Eduardo Habkost
2008-11-18  8:15 ` [PATCH 00/12] x86: disable virt on kdump and emergency_restart (v4) Ingo Molnar
2008-11-18  8:15   ` Ingo Molnar
2008-11-18  8:15   ` Ingo Molnar
2008-11-21 16:07   ` Avi Kivity
2008-11-21 16:07     ` Avi Kivity
2008-11-21 16:07     ` Avi Kivity
2008-11-21 16:18     ` Ingo Molnar
2008-11-21 16:18       ` Ingo Molnar
2008-11-21 16:18       ` Ingo Molnar
2008-11-24 14:58     ` Eduardo Habkost
2008-11-24 14:58       ` Eduardo Habkost
2008-11-24 14:58       ` Eduardo Habkost

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=1226955804-16802-10-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=akpm@osdl.org \
    --cc=arvidjaar@mail.ru \
    --cc=avi@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hbabu@us.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=rjw@sisk.pl \
    --cc=vgoyal@redhat.com \
    --cc=zach@vmware.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.