From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Userspace MSR handling Date: Mon, 25 May 2009 14:20:35 +0300 Message-ID: <4A1A7F03.1020106@redhat.com> References: <9ae48b020905221311h1859d5a1v3653404721d5208b@mail.gmail.com> <790CB8FA-1660-4F6B-BEEC-AAB9724DDD64@suse.de> <4A193878.4030206@redhat.com> <4A1A7B14.5000205@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexander Graf , Ed Swierk , "kvm@vger.kernel.org" To: Gerd Hoffmann Return-path: Received: from mx2.redhat.com ([66.187.237.31]:58209 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbZEYLUj (ORCPT ); Mon, 25 May 2009 07:20:39 -0400 In-Reply-To: <4A1A7B14.5000205@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gerd Hoffmann wrote: > On 05/24/09 14:07, Avi Kivity wrote: >> I agree however that the Xen hypercall page protocol has no business in >> kvm.ko. But can't we implement it in emu? Xenner conveniently places a >> ring 0 stub in the guest, we could trap the MSR there and emulate it >> entirely in the guest. > > No. The case where handling the msr writes is needed is the pv-on-hvm > driver support. For pv kernels it could be handled by emu if it would > be needed, but pv kernels don't need the msr stuff in the first place. > There should be a longish mail about that in the list archive ... Yes, I forgot. Device drivers have no business writing to cpu model specific registers. I hate to bring that fugliness to kvm but I do want to support Xen guests. It should have been implemented as mmio. Maybe implement an ioctl that converts rdmsr/wrmsr to equivalent mmios? struct kvm_msr_mmio { __u32 msr; __u32 nr; __u64 mmio; __u32 flags; __u32 pad[3]; } In any case it should reject the standard msr ranges to prevent Alex from implementing cpu emulation in userspace. -- error compiling committee.c: too many arguments to function