From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/3] Add HYPER-V apic access MSRs. Date: Wed, 13 Jan 2010 16:57:50 +0200 Message-ID: <4B4DDF6E.7030103@redhat.com> References: <1263391197-9883-1-git-send-email-gleb@redhat.com> <1263391197-9883-3-git-send-email-gleb@redhat.com> <4B4DD850.7010808@redhat.com> <20100113144059.GC7549@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55215 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755558Ab0AMO5w (ORCPT ); Wed, 13 Jan 2010 09:57:52 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0DEvqWi003576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jan 2010 09:57:52 -0500 In-Reply-To: <20100113144059.GC7549@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/13/2010 04:40 PM, Gleb Natapov wrote: > >>> +int kvm_hv_vapic_msr_read(struct kvm_vcpu *vcpu, u32 msr, u64 *data) >>> +{ >>> + struct kvm_lapic *apic = vcpu->arch.apic; >>> + u32 reg = kvm_hv_vapic_msr2reg(msr), low, high = 0; >>> + >>> + if (!irqchip_in_kernel(vcpu->kvm)) >>> + return 1; >>> + >>> + if (apic_reg_read(apic, reg, 4,&low)) >>> + return 1; >>> + if (reg == APIC_ICR) >>> + apic_reg_read(apic, APIC_ICR2, 4,&high); >>> + >>> + *data = (((u64)high)<< 32) | low; >>> + >>> + return 0; >>> +} >>> >> I think it's cleaner to put all this into the (set_msr and get_msr). >> You're just converting register numbers back and forth, while they >> are known at the call site. >> >> > I thought about it. It will bring apic internals into x86.c. If you are > OK with that I'll do it like you say. > I think it's better than that tangle. >> Space after if. >> > Forgot about checkpatch again :( > > Should be hardwired into your neurons by now... >>> + addr = gfn_to_hva(vcpu->kvm, data>> >>> + HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); >>> + if (kvm_is_error_hva(addr)) >>> + return 1; >>> >> But the spec actually permits addresses outside RAM? >> > Is says "in GPA space". Not sure how to interpret it. The guest I run > uses address in real RAM. > My interpretation is that it can be anywhere. But that will be difficult, let's stick with this and hope we don't run into trouble. -- error compiling committee.c: too many arguments to function