From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 2/2] kvm: x86: emulate MSR_PLATFORM_INFO Date: Tue, 18 Jun 2013 16:07:16 +0200 Message-ID: <51C06994.1060807@redhat.com> References: <1370361738-4277-1-git-send-email-bsd@redhat.com> <1370361738-4277-3-git-send-email-bsd@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Gleb Natapov , Marcelo Tosatti To: Bandan Das Return-path: Received: from mx1.redhat.com ([209.132.183.28]:25663 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932822Ab3FROHV (ORCPT ); Tue, 18 Jun 2013 10:07:21 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5IE7L0F026646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Jun 2013 10:07:21 -0400 In-Reply-To: <1370361738-4277-3-git-send-email-bsd@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 04/06/2013 18:02, Bandan Das ha scritto: > +static u64 kvm_get_platform_info(struct kvm_vcpu *vcpu) > +{ > + u8 cpumodel; > + u32 bclk; > + > + /* > + * Programmable Ratio Limit for Turbo Mode (bit 28): 0 > + * Programmable TDC-TDP Limit for Turbo Mode (bit 29): 0 > + */ > + u64 platform_info = 0, max_nonturbo_ratio = 0, max_effi_ratio = 0; > + > + cpumodel = kvm_cpuid_get_intel_model(vcpu); > + > + switch (cpumodel) { > + case MODEL_NEHALEM_CLARKSFIELD: > + case MODEL_NEHALEM_BLOOMFIELD: > + case MODEL_NEHALEM_EX: > + case MODEL_WESTMERE_ARRANDALE: > + case MODEL_WESTMERE_GULFTOWN: > + case MODEL_WESTMERE_EX: > + bclk = BCLK_133_DEFAULT; Just one change: please rename this to base_clock_khz and remove the BCLK_*_DEFAULT constants please. Paolo > + break; > + case MODEL_SANDYBRIDGE_SANDY: > + case MODEL_SANDYBRIDGE_E: > + case MODEL_IVYBRIDGE_IVY: > + case MODEL_HASWELL_HASWELL: > + bclk = BCLK_100_DEFAULT; > + break; > + default: > + bclk = 0; > + break; > + } > + > + if (bclk) { > + max_nonturbo_ratio = max_effi_ratio > + = (u8)(vcpu->arch.virtual_tsc_khz / bclk); > + platform_info = (max_effi_ratio << 40) > + | (max_nonturbo_ratio << 8); > + }