From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145386; cv=none; d=zohomail.com; s=zohoarc; b=IV9zIP07vMg6A9fmr+v8Qe8PoWxkvpBXFpUKD8B7V2GKkL/vM4E3MsIoKcFc/QqKnkW4k3lTK7OSFUFFdHmE5TQa40xRPdUk5PqA0QM8UQfhskKo6HcX9fcxgJFPlzqo3pS15XqrECyQjAmuthyTDYsmRwseNpgfmba3hPbFG5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145386; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tIy/5t6EewrCzR8lDouW0qeaTjwrR+owDQjz9nCuDjA=; b=fdu0woqnyO1CHPvnHpkHZMRGgik7FQ5+jisM6YEq5+m1hOPEg2YpQNYLENY+1eF04A5GFUxsX8nPJAuTfVy/NHHMIql5xZl2Ccj9R5V5Lk6dZcvYR/J8rDEE//3kUfF1Pc+AHFBammG0nHZNlVVGiiVENmdbXoDt5rNMoKyXa6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145386924788.8900750737106; Tue, 16 Jul 2024 08:56:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWf-0000L3-W5; Tue, 16 Jul 2024 11:55:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWO-00006E-Do for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:24 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWH-0007SD-Tg for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:17 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:54:49 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:54:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145314; x=1752681314; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aSztLg0iNMT3uyyClDjLkfY1lXlQlvk27Z83Xiyv+UE=; b=k8cwPylhuCQVUrv25M94lsHbYSB33ZzN+597OiMhEiK//zZ7XhWDi+NQ Yk0ldLBQZb5GpGhstZ9kgiTgl7qU4+0F87qIbp6BY2OSjjJKAH4n2Ylzl uSR7fgzkQdL5vUNJbdhP8+7B7472BjKCmePq37YWN3hBvDVN04zIymAxP BUbwomOMsJSwLct7jTpreOH4iQ7H9qjMC0jJ2FvD6vBxUgcXVjllKkD6J ABq4mx3tWqpBWdahIq3TiWWuOniEUPrPXsyR8zVG7TDlv1NRDR2NmkY1b cH/CV89qAgwRoDSgLby/dctfDOvqRbznqCiWxaW3WlZA3k21Py10eiQm6 Q==; X-CSE-ConnectionGUID: 67IptE0RRFez/L42MmLe2Q== X-CSE-MsgGUID: fN8UyYZ3Qqes8IY7rD2f6g== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743682" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743682" X-CSE-ConnectionGUID: C5k4/VhcSmOzD31a0n95Pw== X-CSE-MsgGUID: 7LQz5i87Sf6SSYe7NAa9VA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788258" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 1/9] target/i386/kvm: Add feature bit definitions for KVM CPUID Date: Wed, 17 Jul 2024 00:10:07 +0800 Message-Id: <20240716161015.263031-2-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145388443116300 Content-Type: text/plain; charset="utf-8" Add feature definitions for KVM_CPUID_FEATURES in CPUID ( CPUID[4000_0001].EAX and CPUID[4000_0001].EDX), to get rid of lots of offset calculations. Signed-off-by: Zhao Liu Reviewed-by: zide.chen@intel.com --- v3: Resolved a rebasing conflict. v2: Changed the prefix from CPUID_FEAT_KVM_* to CPUID_KVM_*. (Xiaoyao) --- hw/i386/kvm/clock.c | 5 ++--- target/i386/cpu.h | 23 +++++++++++++++++++++++ target/i386/kvm/kvm.c | 28 ++++++++++++++-------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 40aa9a32c32c..ce416c05a3d0 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -27,7 +27,6 @@ #include "qapi/error.h" =20 #include -#include "standard-headers/asm-x86/kvm_para.h" #include "qom/object.h" =20 #define TYPE_KVM_CLOCK "kvmclock" @@ -334,8 +333,8 @@ void kvmclock_create(bool create_always) =20 assert(kvm_enabled()); if (create_always || - cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) | - (1ULL << KVM_FEATURE_CLOCKSOURCE2))= ) { + cpu->env.features[FEAT_KVM] & (CPUID_KVM_CLOCK | + CPUID_KVM_CLOCK2)) { sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL); } } diff --git a/target/i386/cpu.h b/target/i386/cpu.h index c43ac01c794a..b59bdc1c9d9d 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -28,6 +28,7 @@ #include "qapi/qapi-types-common.h" #include "qemu/cpu-float.h" #include "qemu/timer.h" +#include "standard-headers/asm-x86/kvm_para.h" =20 #define XEN_NR_VIRQS 24 =20 @@ -988,6 +989,28 @@ uint64_t x86_cpu_get_supported_feature_word(X86CPU *cp= u, FeatureWord w); #define CPUID_8000_0007_EBX_OVERFLOW_RECOV (1U << 0) #define CPUID_8000_0007_EBX_SUCCOR (1U << 1) =20 +/* (Old) KVM paravirtualized clocksource */ +#define CPUID_KVM_CLOCK (1U << KVM_FEATURE_CLOCKSOURCE) +/* (New) KVM specific paravirtualized clocksource */ +#define CPUID_KVM_CLOCK2 (1U << KVM_FEATURE_CLOCKSOURCE2) +/* KVM asynchronous page fault */ +#define CPUID_KVM_ASYNCPF (1U << KVM_FEATURE_ASYNC_PF) +/* KVM stolen (when guest vCPU is not running) time accounting */ +#define CPUID_KVM_STEAL_TIME (1U << KVM_FEATURE_STEAL_TIME) +/* KVM paravirtualized end-of-interrupt signaling */ +#define CPUID_KVM_PV_EOI (1U << KVM_FEATURE_PV_EOI) +/* KVM paravirtualized spinlocks support */ +#define CPUID_KVM_PV_UNHALT (1U << KVM_FEATURE_PV_UNHALT) +/* KVM host-side polling on HLT control from the guest */ +#define CPUID_KVM_POLL_CONTROL (1U << KVM_FEATURE_POLL_CONTROL) +/* KVM interrupt based asynchronous page fault*/ +#define CPUID_KVM_ASYNCPF_INT (1U << KVM_FEATURE_ASYNC_PF_INT) +/* KVM 'Extended Destination ID' support for external interrupts */ +#define CPUID_KVM_MSI_EXT_DEST_ID (1U << KVM_FEATURE_MSI_EXT_DEST_ID) + +/* Hint to KVM that vCPUs expect never preempted for an unlimited time */ +#define CPUID_KVM_HINTS_REALTIME (1U << KVM_HINTS_REALTIME) + /* CLZERO instruction */ #define CPUID_8000_0008_EBX_CLZERO (1U << 0) /* Always save/restore FP error pointers */ diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index becca2efa5b4..86e42beb78bf 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -539,13 +539,13 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, ui= nt32_t function, * be enabled without the in-kernel irqchip */ if (!kvm_irqchip_in_kernel()) { - ret &=3D ~(1U << KVM_FEATURE_PV_UNHALT); + ret &=3D ~CPUID_KVM_PV_UNHALT; } if (kvm_irqchip_is_split()) { - ret |=3D 1U << KVM_FEATURE_MSI_EXT_DEST_ID; + ret |=3D CPUID_KVM_MSI_EXT_DEST_ID; } } else if (function =3D=3D KVM_CPUID_FEATURES && reg =3D=3D R_EDX) { - ret |=3D 1U << KVM_HINTS_REALTIME; + ret |=3D CPUID_KVM_HINTS_REALTIME; } =20 if (current_machine->cgs) { @@ -3424,20 +3424,20 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, MSR_IA32_TSC, env->tsc); kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_msr); kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr); - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) { + if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, env->async_pf_int= _msr); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) { + if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_en_m= sr); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) { + if (env->features[FEAT_KVM] & CPUID_KVM_PV_EOI) { kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, env->pv_eoi_en_msr); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_STEAL_TIME)) { + if (env->features[FEAT_KVM] & CPUID_KVM_STEAL_TIME) { kvm_msr_entry_add(cpu, MSR_KVM_STEAL_TIME, env->steal_time_msr= ); } =20 - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_POLL_CONTROL)) { + if (env->features[FEAT_KVM] & CPUID_KVM_POLL_CONTROL) { kvm_msr_entry_add(cpu, MSR_KVM_POLL_CONTROL, env->poll_control= _msr); } =20 @@ -3900,19 +3900,19 @@ static int kvm_get_msrs(X86CPU *cpu) #endif kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0); kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0); - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) { + if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, 0); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) { + if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, 0); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) { + if (env->features[FEAT_KVM] & CPUID_KVM_PV_EOI) { kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, 0); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_STEAL_TIME)) { + if (env->features[FEAT_KVM] & CPUID_KVM_STEAL_TIME) { kvm_msr_entry_add(cpu, MSR_KVM_STEAL_TIME, 0); } - if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_POLL_CONTROL)) { + if (env->features[FEAT_KVM] & CPUID_KVM_POLL_CONTROL) { kvm_msr_entry_add(cpu, MSR_KVM_POLL_CONTROL, 1); } if (has_architectural_pmu_version > 0) { @@ -5613,7 +5613,7 @@ uint64_t kvm_swizzle_msi_ext_dest_id(uint64_t address) return address; } env =3D &X86_CPU(first_cpu)->env; - if (!(env->features[FEAT_KVM] & (1 << KVM_FEATURE_MSI_EXT_DEST_ID))) { + if (!(env->features[FEAT_KVM] & CPUID_KVM_MSI_EXT_DEST_ID)) { return address; } =20 --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145379; cv=none; d=zohomail.com; s=zohoarc; b=bJNuJB+uDS2/yOvOVHsuMlZ4eZejdLF7Yf4NIw9/k/2banggryBGmL5F+z6vgFnnWYo2cM3MOHDV6a3GmKqlQi/PBJwl1jnQGzDARwQl0a0CaZPwoSeOn08YBQMFnF2pXaNRgMLE/UDB+ccFSPRlXGkI2NBrY5rHOH+E7PBpQCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZlKKZ/ERJ4gYkujlTDKJyFw+BZTY0X2ZITZvGYVKhbs=; b=NohwCjvQSAtJp5avPVL1HFu4YwVN5kA8WFX89svEmx52YV2iVP+UTMcSjxkL6VPeWK/EikP36iq70tKRh/sXmNZCxGkrTUwwr5eJZAkkr7i3NSr5Bb21+jfJOgBF4R+BTpkVsiWDGperSxnWV/NQErURj2tG6t6CxIhpAA65B8Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145379262654.4407203170027; Tue, 16 Jul 2024 08:56:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWe-0000B1-72; Tue, 16 Jul 2024 11:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWN-000064-8i for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:24 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWI-0007SW-Bi for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:17 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:54:52 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:54:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145315; x=1752681315; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ORQtPOUjRaH7fq192/3Uf+CcJuvKVSUruZo9xOxKbJw=; b=UyfVZ7bnkBlv/IWk4o4cBXhK6e/YbYQJ+8reW3uVfkDM38Cl0pGsu67r xciI1OhuDwCfoNDBEXzxM4+yRFcYBUYdw3dmp0ROwfHR4zaO3WPm+XQJs 2lpqI+7BcxfrPx6qvqWVsGMMcRGG4KmdslomAVEbfhjW7iCBkGvC5dyQJ TtsJRnqMt2HgCHmzWkXDA0LUw7wW4ocXXXBgBU/ePlld3krlhww5arN4O RnZfpkPENlxTghEAdx7YBdQ1lwYCnsh7FgY1cwEHWwH6UPsijQrHvBXWH HEvulm5H5MatMMHNPbA9ZAd83M4XK3bESmgyZ0xjEkYtTo7EKBlOw7T03 g==; X-CSE-ConnectionGUID: tTLxJbjxR6ylfQ7wRd6B7g== X-CSE-MsgGUID: wvkroJ5NSYS1k/a8Oqa+FQ== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743697" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743697" X-CSE-ConnectionGUID: sX48Ry9oS9a3ksiDhRNKcg== X-CSE-MsgGUID: IzrrmODeTFCDv39AExZSaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788277" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 2/9] target/i386/kvm: Remove local MSR_KVM_WALL_CLOCK and MSR_KVM_SYSTEM_TIME definitions Date: Wed, 17 Jul 2024 00:10:08 +0800 Message-Id: <20240716161015.263031-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145380427116300 Content-Type: text/plain; charset="utf-8" These 2 MSRs have been already defined in kvm_para.h (standard-headers/ asm-x86/kvm_para.h). Remove QEMU local definitions to avoid duplication. Reviewed-by: Xiaoyao Li Signed-off-by: Zhao Liu Reviewed-by: zide.chen@intel.com --- target/i386/kvm/kvm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 86e42beb78bf..6ad5a7dbf1fd 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -81,9 +81,6 @@ #define KVM_APIC_BUS_CYCLE_NS 1 #define KVM_APIC_BUS_FREQUENCY (1000000000ULL / KVM_APIC_BUS_CYCLE_NS) =20 -#define MSR_KVM_WALL_CLOCK 0x11 -#define MSR_KVM_SYSTEM_TIME 0x12 - /* A 4096-byte buffer can hold the 8-byte kvm_msrs header, plus * 255 kvm_msr_entry structs */ #define MSR_BUF_SIZE 4096 --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145367; cv=none; d=zohomail.com; s=zohoarc; b=Kf1Egbkx4zYtGbETqJv2ve1HCHIjWmuDBrqt6tKhLYRUfs97DkPvwnbLiC+EloWWNgRf1ghIHOjfqbvQmDgSvv7kB2e7RHg3PPCAXK4GaSt20gypdHaUms/RT7JbRwJUuNCiIiEk6oRYJjKw3F2nkkxXkKrf9VYTRUAhmAVbxZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145367; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/j+bHgVx+lfLulIxzYAhkq5sXLp34wHYRFNXMMePigM=; b=oAdVyKyK1cc0+y2CHYGHqFlgkriLnts+VQqCqaTIKQbnjSwBVoy5t0q2TodUFZr6idwTbByi12qcYnC47pTGasYU/yOcZ5ATLDr4esB8WlufxVJJx52Ppf8Dmpf5oWyHkPQmlLCAHU3s5N/psa73rXAgMgm3OUmxyIpDC+Ustck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145367447539.0927704818544; Tue, 16 Jul 2024 08:56:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWe-0000Au-7B; Tue, 16 Jul 2024 11:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWR-00006O-Uz for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:26 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWO-0007Rv-Rh for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:22 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:54:55 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:54:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145321; x=1752681321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tKr89zQ0Ud3Nsxehy7urxxT9zgviuntFd5ByL5dN0Dg=; b=EDwqMmzYz1IUo+Lr5LQLzgQ6MnmICnOK/4nQugAOS9WTrhk0OyDaH/so bVNsDmCEff01OgY5Q+9vmNjIokAwW0GGic4eW3IGlUxpKl4fN9zDoncR4 YQH1J30ZNO3FvtxP1Mhw1+3AUDk0/4A5hBP39c9TIC/kCnAQRpncWUrcZ 79lj98VPM6C5qOF2ZtuGrwgElmXO3prNX3hJMyPwwVS/kbC+3Exq8BRfg bV0PipXdfrikF2gPUI8JL3wSJPNZPFxp22tV9zRt2+3XAdTg5M/EdSrNp WN0sK1J3oYS3evjPZoQ4oADO7iHP1Gb45bHY9WJuyk624EEsGaSnWXf1f g==; X-CSE-ConnectionGUID: Ry8xn4d/R/GoTa98txx+dw== X-CSE-MsgGUID: rjOCn6VgTGKbj0L6NY7s2A== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743708" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743708" X-CSE-ConnectionGUID: j3gcA0gTTA2+0HOhBi+S3A== X-CSE-MsgGUID: YP2sYcn8QyKJ8X4hGTs2/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788304" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 3/9] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled Date: Wed, 17 Jul 2024 00:10:09 +0800 Message-Id: <20240716161015.263031-4-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145369107116300 Content-Type: text/plain; charset="utf-8" MSR_KVM_SYSTEM_TIME and MSR_KVM_WALL_CLOCK are attached with the (old) kvmclock feature (KVM_FEATURE_CLOCKSOURCE). So, just save/load them only when kvmclock (KVM_FEATURE_CLOCKSOURCE) is enabled. Signed-off-by: Zhao Liu --- target/i386/kvm/kvm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 6ad5a7dbf1fd..ac434e83b64c 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -3419,8 +3419,10 @@ static int kvm_put_msrs(X86CPU *cpu, int level) */ if (level >=3D KVM_PUT_RESET_STATE) { kvm_msr_entry_add(cpu, MSR_IA32_TSC, env->tsc); - kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_msr); - kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr); + if (env->features[FEAT_KVM] & CPUID_KVM_CLOCK) { + kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_m= sr); + kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr= ); + } if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, env->async_pf_int= _msr); } @@ -3895,8 +3897,10 @@ static int kvm_get_msrs(X86CPU *cpu) } } #endif - kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0); - kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0); + if (env->features[FEAT_KVM] & CPUID_KVM_CLOCK) { + kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0); + kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0); + } if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, 0); } --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145382; cv=none; d=zohomail.com; s=zohoarc; b=DO1L/lFkOh5/hnOKxDugP6hdv6zcQhZXKuUQ/5D7CUKZAUcECAOWghRelBtEJBK/uvtukjjFGcqz81suKU1u1XBjE5cwcPHAqPlAiT/LNgfF+NiGo6O4J8v33tl1IBLPoX/RkTY1PT17rb/VaDoWaj0B2WpV9MWKw+dzqmCn5iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145382; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VfK2C/ZR7poBw1aU8/aLIU0zjKFlKlf94IWvBEst9p4=; b=kFofd514mEY0vlULK4VclVHZ9AEENMSuFGEPn8ojjkW+p2S7BoeBo6l1qMXLGAHXFkNQa4PeDlvTnRXLhDKKOKhGa4la6WlDzD8N4aSxhzCSik9JEGkbKvOCH+F+VjrTg0duepD/JxUIuFnzDxpd/xBuAA19Z8cVYuxUFQB89+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145382233235.61592588090025; Tue, 16 Jul 2024 08:56:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWc-0000Av-Br; Tue, 16 Jul 2024 11:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWT-00006a-TR for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:26 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWO-0007SW-T2 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:24 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:54:58 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:54:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145321; x=1752681321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M+INEDceyzqNpPErcKN6L7u48TTH5fEDjgdcYW5fAXE=; b=RmSdTa8u6fKU4Hwykhzlr+HD0az6CDdVnSRLWHWuRu6rPX2oPo475nQ4 2Snv11i0eCwf3PUk5kUaPsr7sc9+AEuN5zdslJe6x2KX7lMUAJGlWqpzn lo8CC9NsUzIigJ3sHnZwtzVQU5romzRfn3PA59WCLGIC+S3V/H8tSfISd YQ7sWZwlqSYs9wBnZqwbYGYDOBCnZuxvBrYRXSaC1QeqZE3FQE66Zed54 gTwSghJZzW2uXRMYDIq+yc6n5ZyS7Tt4VFHwXDitZH/DI0wc+Rb2paCeG bjOAJtDNB6Racn5rVjlzHWik1ukzoMpLhnIEHXl+mzvZCTQxlQFqICq4V Q==; X-CSE-ConnectionGUID: KhCsjZsxTc6km0F4SgipXg== X-CSE-MsgGUID: 8i+vroKPSOC+Hhm5aj5TlA== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743719" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743719" X-CSE-ConnectionGUID: yaG6rVfWQRio/3iUZpNdng== X-CSE-MsgGUID: NRCi32nqSbSgQyQJ9+MGCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788325" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 4/9] target/i386/kvm: Save/load MSRs of kvmclock2 (KVM_FEATURE_CLOCKSOURCE2) Date: Wed, 17 Jul 2024 00:10:10 +0800 Message-Id: <20240716161015.263031-5-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145382439116300 Content-Type: text/plain; charset="utf-8" MSR_KVM_SYSTEM_TIME_NEW and MSR_KVM_WALL_CLOCK_NEW are bound to kvmclock2 (KVM_FEATURE_CLOCKSOURCE2). Add the save/load support for these 2 MSRs just like kvmclock MSRs. Signed-off-by: Zhao Liu Reviewed-by: Zide Chen --- target/i386/cpu.h | 2 ++ target/i386/kvm/kvm.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index b59bdc1c9d9d..35dc68631989 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1826,6 +1826,8 @@ typedef struct CPUArchState { =20 uint64_t system_time_msr; uint64_t wall_clock_msr; + uint64_t system_time_new_msr; + uint64_t wall_clock_new_msr; uint64_t steal_time_msr; uint64_t async_pf_en_msr; uint64_t async_pf_int_msr; diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index ac434e83b64c..64e54beac7b3 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -3423,6 +3423,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_m= sr); kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr= ); } + if (env->features[FEAT_KVM] & CPUID_KVM_CLOCK2) { + kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME_NEW, + env->system_time_new_msr); + kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK_NEW, + env->wall_clock_new_msr); + } if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, env->async_pf_int= _msr); } @@ -3901,6 +3907,10 @@ static int kvm_get_msrs(X86CPU *cpu) kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0); kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0); } + if (env->features[FEAT_KVM] & CPUID_KVM_CLOCK2) { + kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME_NEW, 0); + kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK_NEW, 0); + } if (env->features[FEAT_KVM] & CPUID_KVM_ASYNCPF_INT) { kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, 0); } @@ -4167,6 +4177,12 @@ static int kvm_get_msrs(X86CPU *cpu) case MSR_KVM_WALL_CLOCK: env->wall_clock_msr =3D msrs[i].data; break; + case MSR_KVM_SYSTEM_TIME_NEW: + env->system_time_new_msr =3D msrs[i].data; + break; + case MSR_KVM_WALL_CLOCK_NEW: + env->wall_clock_new_msr =3D msrs[i].data; + break; case MSR_MCG_STATUS: env->mcg_status =3D msrs[i].data; break; --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145412; cv=none; d=zohomail.com; s=zohoarc; b=THutb1/Q9k88JoR5fBXGsEqpg8auuvRhOCS66j7+yUUjpgttUbX7xRQ0MfK1JTHkT2GM5uoDvWAPbakW1RKQ6RxhqYzYfqEpxBSC5VWxpNbWJBk+0t/1KjZI/VbZPCgfAl+21CWzk0068SqZq1//P5esnat/THHO+vp5Yw4Slss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145412; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iv7BjV2pj47yj5NSzRn+32WIwmQBXkw/k5Kuu7ikTgs=; b=kEo5tVY7PzUfLfme+13kY3HcWzymwprjskIKgJATvc1BsUa4pxRKul+5UknGlxLIZ/8lDNSvMZZXOCZIsFnt7H/IaW2IsYJrXvZ5ZC7tE79GRXp6B6qrW9eNX2DkSRw7nceGkRgAtEv0N2N/ObI3VHB2+RsxxKm49xT6Wi6Pl8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145412409401.8769730193683; Tue, 16 Jul 2024 08:56:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWg-0000NQ-IK; Tue, 16 Jul 2024 11:55:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWT-00006b-Th for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:26 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWO-0007SD-S0 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:24 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:55:01 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:54:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145321; x=1752681321; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B5vJZl3GqGpi4ZMN7bXhTOBiKFTJgl07sNS3UgXe2sI=; b=j8Er6cVeAZPu47Zpfq8kUmytK6UOS5rK7zJLMzswHY7AzANi5S74QNnA blk+NdvJkgwq3LRc3OWQXTBIY5v6m420YK45kfEi8yMn8jnlKTHtSa5dJ r2CprWeFemu7M773Eq95hrdR0N553GsxxJ+/pi3wWkjNWjiGgdi1HMWkv bwBlCNVlZ1VY7Ws0r8bAXU0UHnTMT7QvoZdjvIjokG5RcJLIKsPhHMHDb VxfqznAZ8EQ3CW47qn/HWgsRXfWlTuEtMr4WSRR+FWkTCkqMeIhX4dYIR NKjuAs2xtB6EYEmgWKXjirNNHdgploGBJ7h0PD+62xsXgEEjMjl4xv4JA A==; X-CSE-ConnectionGUID: MPHF9G6YTyK61C5KK4TVzQ== X-CSE-MsgGUID: dk47ehrwS8idmB9VYiVpWg== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743737" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743737" X-CSE-ConnectionGUID: 2Us6OEw8Rd6FZEhJVEzsuw== X-CSE-MsgGUID: 5U/udOlBQVeQubgAu3I7zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788355" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 5/9] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo Date: Wed, 17 Jul 2024 00:10:11 +0800 Message-Id: <20240716161015.263031-6-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145414553116300 Content-Type: text/plain; charset="utf-8" The KVM_X86_DISABLE_EXITS_HTL typo has been fixed in commit 77d361b13c19 ("linux-headers: Update to kernel mainline commit b357bf602"). Drop the related workaround. Signed-off-by: Zhao Liu Reviewed-by: Zide Chen --- target/i386/kvm/kvm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 64e54beac7b3..4aae4ffc9ccd 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2728,10 +2728,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s) =20 if (enable_cpu_pm) { int disable_exits =3D kvm_check_extension(s, KVM_CAP_X86_DISABLE_E= XITS); -/* Work around for kernel header with a typo. TODO: fix header and drop. */ -#if defined(KVM_X86_DISABLE_EXITS_HTL) && !defined(KVM_X86_DISABLE_EXITS_H= LT) -#define KVM_X86_DISABLE_EXITS_HLT KVM_X86_DISABLE_EXITS_HTL -#endif if (disable_exits) { disable_exits &=3D (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145391; cv=none; d=zohomail.com; s=zohoarc; b=nNY2n58+GmB8ABfvEW2XDKQzI91epUN1fNMwk+KhedfCN0qR/nBdL7dLMVVRrFinwK4BmAfdla4Y0gPLAmzMKQee/9XHe15miLHg/jecjJGW4yNxrEdfptZqxUcksgYj0iTScmklmQc4z9PmmajCY386W9fd65gFg4SBErCJWVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145391; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0nbvAqPYvAe81f0Ib3eaF7VdcI1vSQ3lAjKWcJ70KCU=; b=f340N1ZmaUIOdPTh4+043xDDc2+USMwi6aXdt/+0nBOiwgouIuPVlWFt7R+xKCKdEYTOaqIbk98/z1ngE1mY9P+L/EIDLbTDPJLXGNtrkpft587AXvCkPGaE4lvSKp8IPbEmNDgZjdioAYjkCnkzDZvvbee/WSyVrVDrkgQzbgM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145391147608.4288450282403; Tue, 16 Jul 2024 08:56:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWk-0000iZ-RQ; Tue, 16 Jul 2024 11:55:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWY-00009y-GR for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:32 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWT-0007Rv-OX for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:28 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:55:04 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:55:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145326; x=1752681326; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u1cSsKiZS4LgVHWKLVbqsnZaR8V7g5t3vC4cMVukk+s=; b=DID1LkcuDGnLueL+Qcl8T8vZryA+hq95nmfOAFaPk9t79uycX6ZHF5tF qfXiXKf8+Eu6tmdGzpb1hQAW97IPcyPzBZdCQ2p3hW4snWcJOYrwcNNKW 8KVU33F88T78poXIC1psRiV9g75taqo0EbEdvfqlBZJAWOEDlMiWt3hIW kJuyIKvgJvjQ6pGgrdOaMq1qKrdi5nb6q3WCE7X4U0HqEZLNrjTei9EpW QmtqIFeWsXSGP9uss70WlM0guDW/GyydQ+/misb1H4alK4ykc0NlrdOPV ofJuoRbpEJ4MwiKTqRXeRYeb51braK879rX8rcKXbRcYgeg30NX0I2vnY A==; X-CSE-ConnectionGUID: jNcrg3AlTo6zvTB8Ig1Q7A== X-CSE-MsgGUID: S012HEDCT7GxRLgRND1S5w== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743751" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743751" X-CSE-ConnectionGUID: AvJVzMyPQc68UJx2aqmsgg== X-CSE-MsgGUID: L5VZ5PCHQ5u211w+4a4pKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788394" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 6/9] target/i386/confidential-guest: Fix comment of x86_confidential_guest_kvm_type() Date: Wed, 17 Jul 2024 00:10:12 +0800 Message-Id: <20240716161015.263031-7-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145392424116300 Content-Type: text/plain; charset="utf-8" Update the comment to match the X86ConfidentialGuestClass implementation. Reported-by: Xiaoyao Li Signed-off-by: Zhao Liu Reviewed-by: Pankaj Gupta --- target/i386/confidential-guest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/confidential-guest.h b/target/i386/confidential-gu= est.h index 7342d2843aa5..c90a59bac41a 100644 --- a/target/i386/confidential-guest.h +++ b/target/i386/confidential-guest.h @@ -46,7 +46,7 @@ struct X86ConfidentialGuestClass { /** * x86_confidential_guest_kvm_type: * - * Calls #X86ConfidentialGuestClass.unplug callback of @plug_handler. + * Calls #X86ConfidentialGuestClass.kvm_type() callback. */ static inline int x86_confidential_guest_kvm_type(X86ConfidentialGuest *cg) { --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145450; cv=none; d=zohomail.com; s=zohoarc; b=NXq5eOXRpLDASuLD2uqVs0tpagm6C8BQPQZpmzisM+1dqMAVvQNJVhAxTqEafurerRyV99ZKKolKEuWfIDMXllSvz+kAdM0uZaU64Dnt29YgnfjG9S+lAprIvgrGT6UXfQ3XnZ7hHmPQ1zBUt2kHy8hFXul+4Vcl+FSQEWTU3LU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145450; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PvfRWsW2GKoxeeeyFi9s+PxB8H95ZazM0RkReheskUQ=; b=LzPUmOLXgYllKAzhkgy7EtF2Vp9Ui1wrgx9fdUY48LW4jINVsCkswFaXBICoalpEVnVfKPvFz2BwAm7AuuANMgVgbOzs0iq09BsiRc4Kwm7M7ltbiQ5dzn+3brBwQ8W4/dDyU1XbEv7Ekl5ByMMw/VrhM0eDTV6Sk7NuRXvHWPc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145450149479.08023984937233; Tue, 16 Jul 2024 08:57:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWl-0000ju-Ge; Tue, 16 Jul 2024 11:55:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWc-0000BK-Ay for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:35 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWV-0007SW-G1 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:33 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:55:07 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:55:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145328; x=1752681328; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o17ZIKIksTITRMcAguc7dJOs/NSuZsgFkBWTlPrKm8w=; b=YKOajdTYThucNjGmATYyFoQaKLnGidbMDok7XqsGRUjFeH0QlJB1i5lX XTCnRFmUwx3b72mZQnnMlQq2PU+lyABQpYl7+TDDyXSdDS3nzXqvqg5Jf dBM4B6/BTAoI0Rbx6iPJ7FemIP/tsskG8UvpEpaQUx7fUaQqsNBWph7ER WUMBp89hiYonyzq1XetDyRkiJ9PXXQAAxQQdbZPMXDjjE2xHGOHoIKvr4 oHilhyU/2rMvzTVmDRwdzyItRGCOCIpYiIGPOAvb+kPZBDwQNV5uShSWN mvkGUONwm08PVqVI6v1askHNnUOoBwfwaHm5TzoZOFYYBY3q9HCwf9z2+ A==; X-CSE-ConnectionGUID: NO2B+Lv+StiUbzFRMZkrIA== X-CSE-MsgGUID: sUSHpqiaTWWAbcZNMNdIRw== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743770" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743770" X-CSE-ConnectionGUID: s2dEqft1QrKII9T29SAtSg== X-CSE-MsgGUID: MX4+2bZTRHqNYc+Y7yZYCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788416" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 7/9] target/i386/kvm: Clean up return values of MSR filter related functions Date: Wed, 17 Jul 2024 00:10:13 +0800 Message-Id: <20240716161015.263031-8-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145450890116300 Content-Type: text/plain; charset="utf-8" At present, the error code of MSR filter enablement attempts to print in error_report(). Unfortunately, this behavior doesn't work because the MSR filter-related functions return the boolean and current error_report() use the wrong return value. So fix this by making MSR filter related functions return int type and printing such returned value in error_report(). Signed-off-by: Zhao Liu --- v4: Returned kvm_vm_ioctl() directly. (Zide) v3: new commit. --- target/i386/kvm/kvm.c | 34 ++++++++++++++-------------------- target/i386/kvm/kvm_i386.h | 4 ++-- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 4aae4ffc9ccd..f68be68eb411 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2780,8 +2780,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } if (kvm_vm_check_extension(s, KVM_CAP_X86_USER_SPACE_MSR)) { - bool r; - ret =3D kvm_vm_enable_cap(s, KVM_CAP_X86_USER_SPACE_MSR, 0, KVM_MSR_EXIT_REASON_FILTER); if (ret) { @@ -2790,9 +2788,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s) exit(1); } =20 - r =3D kvm_filter_msr(s, MSR_CORE_THREAD_COUNT, - kvm_rdmsr_core_thread_count, NULL); - if (!r) { + ret =3D kvm_filter_msr(s, MSR_CORE_THREAD_COUNT, + kvm_rdmsr_core_thread_count, NULL); + if (ret) { error_report("Could not install MSR_CORE_THREAD_COUNT handler:= %s", strerror(-ret)); exit(1); @@ -5274,13 +5272,13 @@ void kvm_arch_update_guest_debug(CPUState *cpu, str= uct kvm_guest_debug *dbg) } } =20 -static bool kvm_install_msr_filters(KVMState *s) +static int kvm_install_msr_filters(KVMState *s) { uint64_t zero =3D 0; struct kvm_msr_filter filter =3D { .flags =3D KVM_MSR_FILTER_DEFAULT_ALLOW, }; - int r, i, j =3D 0; + int i, j =3D 0; =20 for (i =3D 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) { KVMMSRHandlers *handler =3D &msr_handlers[i]; @@ -5304,18 +5302,13 @@ static bool kvm_install_msr_filters(KVMState *s) } } =20 - r =3D kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter); - if (r) { - return false; - } - - return true; + return kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter); } =20 -bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr, - QEMUWRMSRHandler *wrmsr) +int kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr, + QEMUWRMSRHandler *wrmsr) { - int i; + int i, ret; =20 for (i =3D 0; i < ARRAY_SIZE(msr_handlers); i++) { if (!msr_handlers[i].msr) { @@ -5325,16 +5318,17 @@ bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMU= RDMSRHandler *rdmsr, .wrmsr =3D wrmsr, }; =20 - if (!kvm_install_msr_filters(s)) { + ret =3D kvm_install_msr_filters(s); + if (ret) { msr_handlers[i] =3D (KVMMSRHandlers) { }; - return false; + return ret; } =20 - return true; + return 0; } } =20 - return false; + return 0; } =20 static int kvm_handle_rdmsr(X86CPU *cpu, struct kvm_run *run) diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h index 34fc60774b86..91c2d6e69163 100644 --- a/target/i386/kvm/kvm_i386.h +++ b/target/i386/kvm/kvm_i386.h @@ -74,8 +74,8 @@ typedef struct kvm_msr_handlers { QEMUWRMSRHandler *wrmsr; } KVMMSRHandlers; =20 -bool kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr, - QEMUWRMSRHandler *wrmsr); +int kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDMSRHandler *rdmsr, + QEMUWRMSRHandler *wrmsr); =20 #endif /* CONFIG_KVM */ =20 --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145366; cv=none; d=zohomail.com; s=zohoarc; b=oJDvE6oiJZS6L82JOgABPqcVHt3Ykr8lT2oKEC1wv8rOCJJJRtj1K7tTLNId3dDiPEZdeNKblAPikget4VA7kTsPbfmKel9zVScQqI4xkjaJrNNYdOxw2QWG9NqHOb0YMjUgdLVaWLz32vrA3SqrbGLmgWg7bET8XFg9b6mtjCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145366; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1kEGXXuEV6WPXkHSjCYP0sjtT/kFoVxa20x63PopNco=; b=UAqi4as/9edtLe/BPDLx08h/14btq8bQ+ZzwXXs+FU7Jtwn1efBoSneeeO3Y1gblGljwgOWlY8eOPH1wa/Up6TZ4D84opzPgVVD8DB3wYB2pamr5HKTilzgeaa0/EcbTCI4kBwnU5Chz7zkw80HwnWLoB08zgHhyoP0GI0QU1K0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145366466655.049504647245; Tue, 16 Jul 2024 08:56:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWh-0000Pk-2D; Tue, 16 Jul 2024 11:55:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWc-0000BM-BS for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:36 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWV-0007SD-G9 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:33 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:55:10 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:55:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145328; x=1752681328; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vTmyNpbDyAccpoxjesc1nPYTdmEkK+BCLqrSMM8iBwc=; b=lBzjOenqNzeGQx1pbNAklWInOr8GicgCSYkumxK/Zwphti0NsPtXbnRe sgpNliwQeGNlbFYDb19L0Gh1s++bakJI4ALb46Hj4vP/rmvRaNVE+XdeN 4TAHqL97FxKTz7EuN3sxx1dSaekfqo0jvgHVnfq/hvFhC71NOj2veZywP 4CEpj344gUZfe732IX2GggQtXckKCncaOvosPg8FACea1CvNGzB3Juwx4 WvdaRaIafVWocukYhYiSCDH+mhcH7lhDrvftwJTwqeF+5PnBu/LehFYlh 62NvQ4fox+s14VqPn/4RjwPLVpKo6bH7LdoLOq1twMPV0VdG+GSdYf4rv w==; X-CSE-ConnectionGUID: hzogeEAJRMiKUvwndOWygw== X-CSE-MsgGUID: oUCTECAPTwCk+u1yxNs/0w== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743785" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743785" X-CSE-ConnectionGUID: EyfZj4RlTmiRaGugfiETwg== X-CSE-MsgGUID: Wo36Cj7EQ5S5E4YUst8iYQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788450" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 8/9] target/i386/kvm: Clean up error handling in kvm_arch_init() Date: Wed, 17 Jul 2024 00:10:14 +0800 Message-Id: <20240716161015.263031-9-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145369113116300 Content-Type: text/plain; charset="utf-8" Currently, there're following incorrect error handling cases in kvm_arch_init(): * Missed to handle failure of kvm_get_supported_feature_msrs(). * Missed to return when KVM_CAP_X86_DISABLE_EXITS enabling fails. * MSR filter related cases called exit() directly instead of returning to kvm_init(). Fix the above cases. Signed-off-by: Zhao Liu Reviewed-by: Zide Chen --- v3: new commit. --- target/i386/kvm/kvm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index f68be68eb411..d47476e96813 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -2682,7 +2682,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return ret; } =20 - kvm_get_supported_feature_msrs(s); + ret =3D kvm_get_supported_feature_msrs(s); + if (ret < 0) { + return ret; + } =20 uname(&utsname); lm_capable_kernel =3D strcmp(utsname.machine, "x86_64") =3D=3D 0; @@ -2740,6 +2743,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) if (ret < 0) { error_report("kvm: guest stopping CPU not supported: %s", strerror(-ret)); + return ret; } } =20 @@ -2785,7 +2789,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) if (ret) { error_report("Could not enable user space MSRs: %s", strerror(-ret)); - exit(1); + return ret; } =20 ret =3D kvm_filter_msr(s, MSR_CORE_THREAD_COUNT, @@ -2793,7 +2797,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) if (ret) { error_report("Could not install MSR_CORE_THREAD_COUNT handler:= %s", strerror(-ret)); - exit(1); + return ret; } } =20 --=20 2.34.1 From nobody Sat Dec 28 09:52:42 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721145444; cv=none; d=zohomail.com; s=zohoarc; b=btO8DFSjF94Z+gihq0l1ECUbjkFEZs6Ih8w4mXqOFdpqU3CUHYU4HXo/2yvovSO/j03qVooE/99DgDSuta+Jv/Jr9AHB/rn86cekj52Rl1NS5C3S3LhlEKy3GhFrZ2KZbCZKXMozcUnyJYRrVPlWHX2iO0Q8uA5yTz1blnneZdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721145444; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GNyPECkieMxPOteYxD10W2sd4LVqgKc4zb9qB/yl3AM=; b=dxViIwEc5muSMlPyLvWPhr0ZTxpOdT5mxgFxEHeDCeQd63dghdr3CGcvopy6Y7dmUVibOb/OzF2p1v98sjlnZyBByrgc4CvSp+d8JhPL5kmXOCO9c/fmH+zYDMSpO4sApGZtHLEGfVMVl1wfBCi92yvzb7IQZoHGfBCdrniBQfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721145444664991.69287631851; Tue, 16 Jul 2024 08:57:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTkWj-0000Ys-2K; Tue, 16 Jul 2024 11:55:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWc-0000BN-Bx for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:36 -0400 Received: from mgamail.intel.com ([192.198.163.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTkWY-0007Rv-QX for qemu-devel@nongnu.org; Tue, 16 Jul 2024 11:55:32 -0400 Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 08:55:22 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orviesa008.jf.intel.com with ESMTP; 16 Jul 2024 08:55:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721145331; x=1752681331; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tdtgldsaF/+mVcySq07MM+0QKRZwCNCIky3jLeqq+yU=; b=SeTwgmpYcoodVYpWXmOAxIruboZfcLU5//XaJgJgD2yEc9nwOglL/nOy 13KufpFd1w8F2Nrk7xXW09rpQ6UW/5Kb/slLgJJtI4i1vQhOLtH6Cse1x nMtEgzC2PkINZTk13b+EifHVn3UVEmN62e9xdEn33rapScC8s1jjuaI/j ZZN//3fNYGruDW6AFWeRZVkiXdkWK+N8OjB9d3MyOTytBf2U2t1APrcWx 8HH8D9rXX4pbGJTTY4f+YUEm1Vm5OZXxMO6sagKlROzOv8h3qsUt9R2Md hm9bRqZtGonxFoN/okMPETusy3x25RewRsuXV0DvogIAfN+vD/RucwTYr g==; X-CSE-ConnectionGUID: 7VyvnZhyQ8ai5W6V9P3n1w== X-CSE-MsgGUID: X4SPtY1DRvam0eZ2WYhleA== X-IronPort-AV: E=McAfee;i="6700,10204,11135"; a="18743847" X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="18743847" X-CSE-ConnectionGUID: VMJ6NDNcQHG83f2ZFWlZ7Q== X-CSE-MsgGUID: 6r8tifxbTPWlPASAB/PxKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,212,1716274800"; d="scan'208";a="50788551" From: Zhao Liu To: Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S . Tsirkin" , Marcel Apfelbaum , Marcelo Tosatti Cc: Xiaoyao Li , Pankaj Gupta , Zide Chen , qemu-devel@nongnu.org, kvm@vger.kernel.org, Zhao Liu Subject: [PATCH v4 9/9] target/i386/kvm: Replace ARRAY_SIZE(msr_handlers) with KVM_MSR_FILTER_MAX_RANGES Date: Wed, 17 Jul 2024 00:10:15 +0800 Message-Id: <20240716161015.263031-10-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240716161015.263031-1-zhao1.liu@intel.com> References: <20240716161015.263031-1-zhao1.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.198.163.15; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721145446624116300 Content-Type: text/plain; charset="utf-8" kvm_install_msr_filters() uses KVM_MSR_FILTER_MAX_RANGES as the bound when traversing msr_handlers[], while other places still compute the size by ARRAY_SIZE(msr_handlers). In fact, msr_handlers[] is an array with the fixed size KVM_MSR_FILTER_MAX_RANGES, so there is no difference between the two ways. For the code consistency and to avoid additional computational overhead, use KVM_MSR_FILTER_MAX_RANGES instead of ARRAY_SIZE(msr_handlers). Suggested-by: Zide Chen Signed-off-by: Zhao Liu Reviewed-by: Zide Chen --- v4: new commit. --- target/i386/kvm/kvm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index d47476e96813..43b2ea63d584 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -5314,7 +5314,7 @@ int kvm_filter_msr(KVMState *s, uint32_t msr, QEMURDM= SRHandler *rdmsr, { int i, ret; =20 - for (i =3D 0; i < ARRAY_SIZE(msr_handlers); i++) { + for (i =3D 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) { if (!msr_handlers[i].msr) { msr_handlers[i] =3D (KVMMSRHandlers) { .msr =3D msr, @@ -5340,7 +5340,7 @@ static int kvm_handle_rdmsr(X86CPU *cpu, struct kvm_r= un *run) int i; bool r; =20 - for (i =3D 0; i < ARRAY_SIZE(msr_handlers); i++) { + for (i =3D 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) { KVMMSRHandlers *handler =3D &msr_handlers[i]; if (run->msr.index =3D=3D handler->msr) { if (handler->rdmsr) { @@ -5360,7 +5360,7 @@ static int kvm_handle_wrmsr(X86CPU *cpu, struct kvm_r= un *run) int i; bool r; =20 - for (i =3D 0; i < ARRAY_SIZE(msr_handlers); i++) { + for (i =3D 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) { KVMMSRHandlers *handler =3D &msr_handlers[i]; if (run->msr.index =3D=3D handler->msr) { if (handler->wrmsr) { --=20 2.34.1