From nobody Sat Feb 7 06:55:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1505825811008162.65953124440387; Tue, 19 Sep 2017 05:56:51 -0700 (PDT) Received: from localhost ([::1]:42682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duI54-0000qu-55 for importer@patchew.org; Tue, 19 Sep 2017 08:56:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duHfI-00042R-B0 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duHfC-0005L3-G4 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:12 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38516) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duHfC-0005Kw-98 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 08:30:06 -0400 Received: by mail-wm0-x241.google.com with SMTP id x17so3721997wmd.5 for ; Tue, 19 Sep 2017 05:30:06 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-246-117.clienti.tiscali.it. [78.12.246.117]) by smtp.gmail.com with ESMTPSA id k18sm1292878wmd.22.2017.09.19.05.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Sep 2017 05:30:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1vEZEx+i1lx8vLsJ+Qn1ZThn8hBBfpzWzkV1HE4C6+Y=; b=LVUGUSBha/O3HGCv0ht+h6o1i2nBSUTEsGtGkb4LL2Apf/6Cq9Dt5dnmb8/J6nnH04 mJZv4J+Jw6sTaMpHWhYGUrAutBs7akahqmueZcCAT7o1tcQoE+P7vMiaqdUCxFPSX3RI uYCo7bSSG25lygO4SOYJirPbcwDCaSlqAqXjt/by7d84UF8VcSq4g72zhuRIAEILA8N0 unF41e/ArV4gjeYUXZXvqDV/zDSuj7KVkt41BSov9tT6626bk30pzJ4wdZ/kPzz52OMD j7JlbLmZluGUxaw8VVRZYCqFt1xmr7i13Ji0lxVK5pLE5jjFa1JBS+R8qTvLAby/KZ+V hxLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1vEZEx+i1lx8vLsJ+Qn1ZThn8hBBfpzWzkV1HE4C6+Y=; b=DmZ2oPI6TPUZRg+K/0k1QCsO2YhNvS/4sXju3/UiQrc9/GvDnwoJPndU9H3b9gBqdp KVwqEicvtvguWRJs1Dxm+/pxOEt4RBBCUFPDum5b7ap3Le29bQyp0rH3xtA/OKoDKuy2 p73TMyTKLLcl3llwTM5q0iiXsioTfT8sKS8qGagi1Gk894jrEFJE2zplXfcr1ACMCXPZ aFdSSA5u0MzMmaMtbBJLG/W/pNgopbPv7X6JbqA2izNe6YrgNgUzIzmtHuOdq2yz0/v7 jMEwS+3Q+x8cfUQDXSG00A20UZQLvdm4v1N15YA5jdMqhUmTq9+R72m0ooeIN6w/oF5+ Ib/w== X-Gm-Message-State: AHPjjUhHLpK/ZsdDgRx5K01YZOg7H9N/KGGgNGjRh2Prz097F0UHmSfl 6R91F8zigfcsOd/zveHyW2nFLgb5 X-Google-Smtp-Source: AOwi7QAHDrai+iRASdGByPpob3eQimfFjZ1+Zx5wNIUsEywgZIxRAnBwQD0u3kkbBZlEiYdou3OfKA== X-Received: by 10.28.143.138 with SMTP id r132mr925195wmd.18.1505824204938; Tue, 19 Sep 2017 05:30:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 14:29:08 +0200 Message-Id: <1505824179-21541-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1505824179-21541-1-git-send-email-pbonzini@redhat.com> References: <1505824179-21541-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 19/50] i386/kvm: set tsc_khz before configuring Hyper-V CPUID X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ladi Prosek Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ladi Prosek Timing-related Hyper-V enlightenments will benefit from knowing the final tsc_khz value. This commit just moves the code in preparation for further changes. Signed-off-by: Ladi Prosek Message-Id: <20170807085703.32267-3-lprosek@redhat.com> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index b14a0db..15d56ae 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -695,6 +695,25 @@ int kvm_arch_init_vcpu(CPUState *cs) =20 cpuid_i =3D 0; =20 + r =3D kvm_arch_set_tsc_khz(cs); + if (r < 0) { + goto fail; + } + + /* vcpu's TSC frequency is either specified by user, or following + * the value used by KVM if the former is not present. In the + * latter case, we query it from KVM and record in env->tsc_khz, + * so that vcpu's TSC frequency can be migrated later via this field. + */ + if (!env->tsc_khz) { + r =3D kvm_check_extension(cs->kvm_state, KVM_CAP_GET_TSC_KHZ) ? + kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) : + -ENOTSUP; + if (r > 0) { + env->tsc_khz =3D r; + } + } + /* Paravirtualization CPUIDs */ if (hyperv_enabled(cpu)) { c =3D &cpuid_data.entries[cpuid_i++]; @@ -961,25 +980,6 @@ int kvm_arch_init_vcpu(CPUState *cs) } } =20 - r =3D kvm_arch_set_tsc_khz(cs); - if (r < 0) { - goto fail; - } - - /* vcpu's TSC frequency is either specified by user, or following - * the value used by KVM if the former is not present. In the - * latter case, we query it from KVM and record in env->tsc_khz, - * so that vcpu's TSC frequency can be migrated later via this field. - */ - if (!env->tsc_khz) { - r =3D kvm_check_extension(cs->kvm_state, KVM_CAP_GET_TSC_KHZ) ? - kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ) : - -ENOTSUP; - if (r > 0) { - env->tsc_khz =3D r; - } - } - if (cpu->vmware_cpuid_freq /* Guests depend on 0x40000000 to detect this feature, so only exp= ose * it if KVM exposes leaf 0x40000000. (Conflicts with Hyper-V) */ --=20 1.8.3.1