From: Glauber Costa Subject: [PATCH 3/4] [PATCH] kvmclock: allow it to be turned off Date: Wed, 5 Mar 2008 15:41:31 -0300 Message-ID: <1204742492-20738-4-git-send-email-gcosta@redhat.com> References: <1204742492-20738-1-git-send-email-gcosta@redhat.com> <1204742492-20738-2-git-send-email-gcosta@redhat.com> <1204742492-20738-3-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: chrisw@sous-sol.org, avi@qumranet.com, Glauber Costa To: kvm-devel@lists.sourceforge.net Return-path: In-Reply-To: <1204742492-20738-3-git-send-email-gcosta@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Use the lower 3 lower bits of the system time msr to turn off the clock. This means that all clock registration has to be aligned in a 4-byte boundary Signed-off-by: Glauber Costa --- arch/x86/kvm/x86.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6abd784..7ce14ce 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -591,6 +591,11 @@ int kvm_set_msr_common(struct kvm_vcpu * if (vcpu->arch.time_page) kvm_release_page_dirty(vcpu->arch.time_page); + /* 4-byte unaligned accesses are invalid */ + if (data & 0x7) { + vcpu->arch.time_page = NULL; + break; + } vcpu->arch.time = data & PAGE_MASK; vcpu->arch.time_offset = data & ~PAGE_MASK; -- 1.4.2 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/