From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] KVM: Don't automatically expose the TSC deadline timer in cpuid Date: Sun, 25 Dec 2011 21:00:08 +0200 Message-ID: <1324839608.3261.10.camel@lappy> References: <1324818200-15660-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Jan Kiszka , Alexey Zaytsev , Marcelo Tosatti , jinsong.liu@intel.com, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:53805 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460Ab1LYTAO (ORCPT ); Sun, 25 Dec 2011 14:00:14 -0500 Received: by eekc4 with SMTP id c4so10670203eek.19 for ; Sun, 25 Dec 2011 11:00:13 -0800 (PST) In-Reply-To: <1324818200-15660-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2011-12-25 at 15:03 +0200, Avi Kivity wrote: > +The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned > +as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC > +support. Instead it is reported via > + > + ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER) > + > +if that returns true you use KVM_CREATE_IRQCHIP, or if emulate the > +feature in userspace, then you can enable the feature for KVM_SET_CPUID2. Thats a bit strange, it's going to be a somewhat ugly special case in userspace code. It also means we can't simply proxy through CPUID from kernel to the guest and only disable things we don't support, we now have to enable them as well. > + if (apic) { > + if (best->ecx & bit(X86_FEATURE_TSC_DEADLINE_TIMER)) > + apic->lapic_timer.timer_mode_mask = 3 << 17; > + else > + apic->lapic_timer.timer_mode_mask = 1 << 17; > + } Can we change these to be: if(...) apic->lapic_timer.timer_mode_mask = APIC_LVT_TIMER_PERIODIC | APIC_LVT_TIMER_TSCDEADLINE; else apic->lapic_timer.timer_mode_mask = APIC_LVT_TIMER_PERIODIC; -- Sasha.