From nobody Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018161; cv=none; d=zohomail.com; s=zohoarc; b=jPvj9dhDLwHfKkzgjpB6nkOkAttEO0zeEs7JWuoEXGlJj0y6TIGKahaoMeFGnifPdXkcU/aVZfIEesgbPWGS1TpNqBaVfUhVlIdizBRclVPJWWAUW/xCwpDf9Jteu0VQty7E66qz9QmSfzw7F580sYKpqab2SW+z0O15i74Ul2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018161; 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=dOoAxq7lg6ycJyIg6CG/XfXbrDt2FGSxllIwWNfpU8qEGGgEsXSyleIlJCohkct6PteCXGDsKxSOYFxHOr3HvT9nUA8a0nf6tJroeJoxVcDx1+CjGvMs1lWafonBwWgWwAsA8qFKW85pQnqX6uixfrYVTmeMk6qv0vZfIypnkDo= 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+importer=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 1721018160997141.71886885335778; Sun, 14 Jul 2024 21:36:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDPx-0008Fd-15; Mon, 15 Jul 2024 00:34:29 -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 1sTDPu-0008C1-OD for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:26 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDPs-0004F3-R9 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:26 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:23 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018065; x=1752554065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aSztLg0iNMT3uyyClDjLkfY1lXlQlvk27Z83Xiyv+UE=; b=kawEz8eFD0SmY8PAjPoXBhoH7UNm6Pnfts3rZCjinHlCd9CnMMEFaXQg iAErJlImqPO4RsvzZDKYsidCAVZWzAYiv0y51nfW5ZpHLwXlTqSp84UxC L3pck1zjOslHZCpdhePeyLmDR6uQIQBUvV3nB1vPgqAKoFOM984Ev/psh Aj8PwoVGzlcR2NWKB5w1QcwBait45sq/RsW8gaQMxp7H65NbXQOmkDHI6 hB6DDVEnze4jCpThNBEovHqotlJj1K5ZaGBEyhvLYEwUIZ8UGGh5/0riS FK1ipTt8ELeyBCKBAPACSs2qqTHhvkmIx1OhqjliBGJ4OVZFDYj72+PuG Q==; X-CSE-ConnectionGUID: fuChLKi7TceFiQwWiUS9Vg== X-CSE-MsgGUID: 59X9dFbXT666Jujfi0w1mA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809804" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809804" X-CSE-ConnectionGUID: qLMAMfovQ4at0ONxQWqhBA== X-CSE-MsgGUID: mqDUxjmfQVuAsdrJZBP1xA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043035" 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 v3 1/8] target/i386/kvm: Add feature bit definitions for KVM CPUID Date: Mon, 15 Jul 2024 12:49:48 +0800 Message-Id: <20240715044955.3954304-2-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018162624116600 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 --- 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018201; cv=none; d=zohomail.com; s=zohoarc; b=GVs/iF66+wTxad3K7omm+suN/4LbzB74Tt1yA446TJ9V9Riy78D5HzdKOqNicBezU0FxH7AYU4Fzt46IlthtMl8DEZhrRuQPpc+YZmCo0p3+A5rdC+WoBcL+q8TRdTB36NX9QRV7NSZm8LRkTKgx7xzu/TrM8Zk5julZG833+a0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018201; 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=RB8QoXzjsoWZEf08YwzBSfPP4eEswi5RRXbEb09egmdKx9reYt7kVScozhVN8SMH01iIlxTCx8LHa2UWts0/Tfa+eeWylXIdAsRSTY8rMv3RZpqHuQPBj7FWbYLPuBr0wfaiNMSUi1+cAe3o+OIL404mgVlv0vd8nRDWJrgZrA0= 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+importer=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 172101820146961.39313671822549; Sun, 14 Jul 2024 21:36:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDPy-0008LG-EM; Mon, 15 Jul 2024 00:34:30 -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 1sTDPw-0008EU-Lv for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:28 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDPv-0004FI-1h for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:28 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:26 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018068; x=1752554068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ORQtPOUjRaH7fq192/3Uf+CcJuvKVSUruZo9xOxKbJw=; b=U7cfQYPuFla3FoEfXEZIKA2F66OU+vB/OBJefMFRgiD3rmlJm+STD+FH joSRccbG8H2PQZvf7nVbeJdBQrjts6GEZegCXX7G6Qe6hjZp2veCSBReU ojv6uYKuL7mQhdmM/HS8V6ZaJQA9hBdrXUo85TcYaBmSTyvo9nEkAX7HL kt8/T61EBPap0JNdY9DEPDYKlRaBqx3DPbZ86feGAwf/Zc0ftNmLnvUvB 7/rjVOPVTnZYq65K7mmwdLidDGgHZbAIu87izsec+f7GAa/JOy9tURLm3 iZ7kuE8obNcphffGddB9Y1PxDOzQkWxdIe6JUIArzH7bxE21t1jDVZzsl A==; X-CSE-ConnectionGUID: vNxBxKNuTIeQ/BZBhZzyPw== X-CSE-MsgGUID: gYCamMGxSkCjN7BEajVJAg== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809816" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809816" X-CSE-ConnectionGUID: 1TK6ChxeSL2fX8CDCR/HwQ== X-CSE-MsgGUID: 4lGA0LgxTMmECm7U3JD7IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043046" 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 v3 2/8] target/i386/kvm: Remove local MSR_KVM_WALL_CLOCK and MSR_KVM_SYSTEM_TIME definitions Date: Mon, 15 Jul 2024 12:49:49 +0800 Message-Id: <20240715044955.3954304-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018202831116600 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 --- 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018156; cv=none; d=zohomail.com; s=zohoarc; b=IvfCvC5MBsaOtaQ0rJIMVm+5uHHoyD7cHH9RflyfRK+JcIlBLYbRwFvT8UeCJGrBJC2tHQeLvd5rLpM53KTnU/Xg5NfhmeJkeo5rN4vVOV45f10erRmphihmv2dzS7Dh6Cah2AbDNReMQiaPK23V4YsvOvvOu/gzDpfoTesXTaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018156; 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=Gpn9fGleGy3CGTNpB2M7V7jB/OXkSuNjsWb6Pw1SL/hcqws/v7Xp7af6PtcZe/xoa89HbDt0W7SRjXgguhNmCk1nV2nD+2oASJEBjAIctMeneYCPLysvN+itlCvDLnzKGaLYyV58lKM7Tm088/0h1D5xDqf9VwS9f+uB3IyjVoI= 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+importer=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 1721018156840759.4401699596282; Sun, 14 Jul 2024 21:35:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQ0-0008Rt-3J; Mon, 15 Jul 2024 00:34:32 -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 1sTDPy-0008MY-L3 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:30 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDPx-0004FI-1J for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:30 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:28 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018070; x=1752554070; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tKr89zQ0Ud3Nsxehy7urxxT9zgviuntFd5ByL5dN0Dg=; b=lUt2b5b1ICKpMrpB8P2FcdNt86YdQf1oWHnoP41BtilYfO4ILVBUuKY8 24rWQdBI0DGR+mI6bHwfod1tVK1jBsT2nhAbDsTiGpK9Mc+adZkJjEZ9X ICxOZrtkZ85F2Gbu74gdfS1A49F1MKAqkgMKnDWgIpOOlB/1n6hexx0ir 23Hv2sTn59fgXYxeYb3yNh83bEef8eqvFebb5/YMI0Z5ARxhGMKdGl380 x8qZ7AUPIPtBhqNEr1gj3Qg6VNQi4ZRs5depbEAJ24zB1uZdxoq3MB10q 7p1eJ2sfcdRjzR2XlxTsOB8c/MhGxWQ7oCOYveqe58/hwPS3jGFw3tt3t Q==; X-CSE-ConnectionGUID: r6JyMEQoQ1OHb6As3mRvZA== X-CSE-MsgGUID: UHo/i+WNSXmmGc4TqgBGTA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809829" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809829" X-CSE-ConnectionGUID: d46rdVzSQbq2gUIPsr/NmA== X-CSE-MsgGUID: Bdj/zOvLSmGvktFde+KVAQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043070" 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 v3 3/8] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled Date: Mon, 15 Jul 2024 12:49:50 +0800 Message-Id: <20240715044955.3954304-4-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018159638116600 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018173; cv=none; d=zohomail.com; s=zohoarc; b=XHt91xWnPe1KbmMKtAAhKCPPo3U7xHRTlMMkoAsS+i934eLKXO359YBg3teTO6poTLAnz7TiAodHyWg8KVAYHEXrRiysONPtWUmMqf6N8gzxSFma2+KwbIucIHHVWkF2TYJBMWuJXY8oJIqHXzHZjmVKAlIzBQFTWxk3a8km9G4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018173; 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=XMXVR6CmMYWqFWW7N3FbMcywANrFq5nGIK8ZEaGzvINnuhvIi61pFgUbgPe/SW0qkKM4BnzSaCscflZ9UCh7nv+qVNrZvux7OHqQD4H7H9H7kmJ73HP6qkTOBdgGnbHwMrZNk07qpu9toJYao6RtMUD9pQu2pz1nMGjxkho4MAE= 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+importer=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 1721018173132981.3319498127879; Sun, 14 Jul 2024 21:36:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQ3-0000GP-Mn; Mon, 15 Jul 2024 00:34:35 -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 1sTDQ2-00008m-27 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:34 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDQ0-0004GK-DW for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:33 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:31 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018073; x=1752554073; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M+INEDceyzqNpPErcKN6L7u48TTH5fEDjgdcYW5fAXE=; b=L9WJ0znE42sAFxwHjkyiXzrs9i0BgVuG+3NoiKzza+gw83Yd8wRq+PWv UvUMZqzvL8m8t6iiRXvoAN6Vj1cFdfUafeuwwdXPmVTJGG6bvUGKc/4pq 3bJd6liHN8a8D7q2PJqs46R5okk9vwTRx9yDRr15CqyUdb3gUMe1wuEyq UoU1w6c1JDPFnq44M9iDcHa6kHjDkSolKY3MJ+WrPRL+8oyJWxF0Tdtzp h5DOSlPzUWuxIzxhw2NFXQIrv+GO3PzgaHejIwWkC5xPUkwFl4a7pAS0c wgQOpgyZWBUR8hfFWU2ouaOtYs5tNpPQ2UrnxiLwNiaqNxcWqULIhgPpJ g==; X-CSE-ConnectionGUID: Z6n9XoLlQsue3ig7mHUeUg== X-CSE-MsgGUID: fQnIs3QYQcKi3TPcY49KzA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809839" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809839" X-CSE-ConnectionGUID: IUZVOMfsSeuOAnE6OaYd3g== X-CSE-MsgGUID: FrKreY+VTgumQl8oR9BvwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043083" 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 v3 4/8] target/i386/kvm: Save/load MSRs of kvmclock2 (KVM_FEATURE_CLOCKSOURCE2) Date: Mon, 15 Jul 2024 12:49:51 +0800 Message-Id: <20240715044955.3954304-5-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018174657116600 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 --- 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018165; cv=none; d=zohomail.com; s=zohoarc; b=BzR+l+DGn0BaWz/ScxJQPZ1YnySsmqWvDqNLqH74HtKwHCLb0pieopqP6vteuynKJpx2TPEPITJFZXs9KeFzO9CKU+D5MS2Y2dpQl7mZDETSXrnCo/W47+L4nURF/prwsBau7hpvP0VmSvs2yh8q+otGVID/aV12msahjTb8gfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018165; 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=ha/7PEpJyBs42x8M6UcDy08GLvzPDpRIQu7WSrLF0M00DNyzHlWwU5oKSuhOUFhaR+uiQvrB3vIHQ7LUW5dhRlrfDxCuDKTqGvkXXbojBvPQ/qVSrtSVZODy1kB3we2VDdZPJC90VlXtCroRDkEWir0PO8Z1L/998Iy6uMCWxBE= 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+importer=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 1721018165100390.3571934631474; Sun, 14 Jul 2024 21:36:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQ4-0000M6-OI; Mon, 15 Jul 2024 00:34: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 1sTDQ4-0000J5-1N for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:36 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDQ2-0004GK-DD for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:35 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:34 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018075; x=1752554075; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B5vJZl3GqGpi4ZMN7bXhTOBiKFTJgl07sNS3UgXe2sI=; b=dfRrKrO0hgeYdgw96aKjsfTsBBE/UhqBBZmg0mpTkPXD6oEo8EzlfKMi Hd5hgJxq7idP4t7ZfTpQySSrhirXi3w1R6Tl/WgrEonofZ0VepyPORAcd DrspS+E6P7ceM3ROr+YJkkt1Akl5MM1FV2TpR6Wfb9E/cILhx43rHpT1F iGXDi2xhCqddahmG8KpZyd2e33Z+2AhuwjZyfuKxiXIfy+4epxaS2mD1a wkW7SzPn3wJ66wu629dyx9BZkSKueKyIPfZPA9v+B9k86CvfPzPXnsKv6 AVSf+bIbS5SVgXRsN7ALH55WRjSBGjUHogprDrnC5TKIsiEnTYVL34M7r g==; X-CSE-ConnectionGUID: BloG1NgBT32J0TDUOJ/pWw== X-CSE-MsgGUID: pdLFbqADQ3+jogu/lgyrhg== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809847" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809847" X-CSE-ConnectionGUID: DAhLR5M+Q0abt/CaMlwelw== X-CSE-MsgGUID: AWjyEK+EQ8GMdR/vy4ioEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043088" 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 v3 5/8] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo Date: Mon, 15 Jul 2024 12:49:52 +0800 Message-Id: <20240715044955.3954304-6-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018166617116601 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 --- 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018165; cv=none; d=zohomail.com; s=zohoarc; b=atXUY7N3W0VeJGD43NRFiNTFHivwio/63en8tF+xwt0eX2QveZIifNT+NUhlhLOB5ZbigJBLRXE1e4GCKtwdN0gjFwGBFTbYt5nCBs4ev4JVYRP/M9kBkNWpqIb1BL4AeHNPFAyogfZSXcZYUN/wjtqV5yCm9xl/TuqLPypfnd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018165; 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=eoRXXfJ8j9fwHjjbHRaQQ1SN2SFpQM5DA7G2LCTSF3wwRCYOrRE4277udQ75plYPMXimVW9HqAP/qXhAFKsKXboHZPHUlkHbIFWdXt/K5HG72Raz4Q2MJzi3QIwsBQCQGiiXELL2AFqfXr8AbBGVl+f+BL+6120RHPIWwXkFQtU= 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+importer=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 1721018165340398.02147890722915; Sun, 14 Jul 2024 21:36:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQ8-0000ZX-54; Mon, 15 Jul 2024 00:34:40 -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 1sTDQ6-0000Tg-LE for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:38 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDQ5-0004GK-5R for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:38 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:37 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018078; x=1752554078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u1cSsKiZS4LgVHWKLVbqsnZaR8V7g5t3vC4cMVukk+s=; b=DBN1PcuTae0rhh2hHDJRRqrWTIzwk3uhxYpvUHUeko1rkb/T1eM7kOAz Gv6sv7Jlyxdn36TxdVkuaknKfEpboux/HgyP1FtddmrJbYLrUoT7xESGX YUmnLVmWzNpPlBm9Gyvr3uEA0SugCXVr5nmBWb1sSpJBn6d4bF6Uhu+g7 F5inb5Sz3C5bsV1ExQuIsdxkEj2hcaTYTur04yDBRqcc/0eWQKzW4/rQp xGxykv/SKr8uNOFDuZjOD3dt/9j35kFyHs5CXEKTgA0Va6m4oCSfznW+o xP15EyCWYjLnQ9FVbJGPK72CsfuwTOd3OFcJPElqwAIsFnoolZ2y9ahvO g==; X-CSE-ConnectionGUID: HhsjA49ESvKK5DUlDBnJ9w== X-CSE-MsgGUID: ow6KPQ+uQXydLwnImSoiGQ== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809854" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809854" X-CSE-ConnectionGUID: mkQ7gO4nQv6RF0012GTDWg== X-CSE-MsgGUID: C+xQ9yLOT4aENov63PuQ8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043096" 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 v3 6/8] target/i386/confidential-guest: Fix comment of x86_confidential_guest_kvm_type() Date: Mon, 15 Jul 2024 12:49:53 +0800 Message-Id: <20240715044955.3954304-7-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018166615116600 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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018165; cv=none; d=zohomail.com; s=zohoarc; b=Wmyy4tcg5KXM0MzqgL9O3+yuh0j8/ROLt+ljt843XxY2bdDwao1Km6L3BdNwnTJR/Q3F4TvxqDwJtRjLCuS9iUBvhVhBQZhfsIWQPAXvYfR6qdb9Wy69z5pLToDxqOb7rYrIYdIxgaCj00NWCPAYQnZ7USpThZxmv/l51lROmus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018165; 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=taCql5EC4jDwM3wwLtjvuSK7louCcXby+CujEmSUB00=; b=O0rYszo0cKpNJq2vandYxde3alvKyMjSS60PL0Bq4LEElYB3flyCxs2w95gcgA3tTEGkQY1omeL+ow9ncvu6RgZZkH/iLCquu2uUlSYLpf3NqyoQv51nxLIwA+hL8zyczCOrhuDtOoDl8szaxOSmch3QrtFtJvs+KUMk8mWyYo4= 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+importer=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 1721018165386509.7802816214928; Sun, 14 Jul 2024 21:36:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQE-0000rP-GR; Mon, 15 Jul 2024 00:34:46 -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 1sTDQ9-0000ga-TD for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:41 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDQ8-0004GK-3t for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:41 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:40 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018081; x=1752554081; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yLNWhHrtOyoeQooeafFrZVJbCO/Btc3+xL/n3wetEgs=; b=l0rcEghBeg8uU3xqnwNYd1CeZNpNWj7K/Z0dkZXdiyqQxAT8I97pXhSl KBMr0IMEvkCTcMYtPzBEHW1ReYpr/btTQwALuPthdqhGE2PjHe1/kulRD jtsNWQGA8K5tN0WqtdxFF4D0T0AuZ4PMc6sMEwrXVVDwiL7B41EHtPrxc P7fc3ysekshICbKgfp8LpJ5XwvAARg25IqCYN7y6df+A+Bm6zVolc/WdK hDGIJ07gNGjZrmiGec/vRaP95QbTIfE5mqkmKfIcrStFGICcJYcFDSltM De4AxZOaYEHHJM+gnTU1mBf1eGF0oWuCANDD+L9yz6jCaaIH1eWk0OXmP g==; X-CSE-ConnectionGUID: soo1hmwQRzqQLQQrVJWwqg== X-CSE-MsgGUID: rw+xOnigTLOjeYq8QhdqBA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809862" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809862" X-CSE-ConnectionGUID: VWjhGhwBQdCqLgABca1ilg== X-CSE-MsgGUID: 6DEZMmFoTTOlfpcrOYp8jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043137" 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 v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions Date: Mon, 15 Jul 2024 12:49:54 +0800 Message-Id: <20240715044955.3954304-8-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018166617116600 Content-Type: text/plain; charset="utf-8" At present, the error code of MSR filter enablement is attempted to be printed 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 --- target/i386/kvm/kvm.c | 35 +++++++++++++++++------------------ target/i386/kvm/kvm_i386.h | 4 ++-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 4aae4ffc9ccd..0fd1d099ae4c 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 ret, 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,18 @@ 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; + ret =3D kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter); + if (ret) { + return ret; } =20 - return true; + return 0; } =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 +5323,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 Sun Nov 24 18:34:51 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721018191; cv=none; d=zohomail.com; s=zohoarc; b=OtcBa1UdKyG4F1nTYGz2tTQw9zfeR3qQSAXzfYWtzdrhC6YdluLkujyrAw5IspTh6P9j6z536BvUD9+vyPRVmTnwFDkc+m1LRHKEh2alhHjHicjwUIWb2J2hc9lNF/UWU886DtIW5Kv2VlV75lXw3BKDWIhw9WZ1VHoU0Or80a4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721018191; 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=0VPzSnzw+KMreUFj0uQaSuv12mIoIdmpocrFmpUbAsU=; b=eQQDe9mYEens4TFJIqMirV6mL87uiFw2z3v18VGhj56mAjhhRP8/vjS+n8gqWgj+sr2Vt5nceEa92DlNNdWhW76qMY4yExqTokEbIhLKPU2iT3XPNn8zvr9M9PgOgiYe1EWf3wg5YpZI2I8CBain7njmRryuYspeUnqKy6v7tzc= 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+importer=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 1721018191743582.8061925538657; Sun, 14 Jul 2024 21:36:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTDQI-00015X-KM; Mon, 15 Jul 2024 00:34:50 -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 1sTDQC-0000qX-Fo for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:45 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTDQA-0004GK-Tz for qemu-devel@nongnu.org; Mon, 15 Jul 2024 00:34:44 -0400 Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2024 21:34:43 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa004.fm.intel.com with ESMTP; 14 Jul 2024 21:34:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721018084; x=1752554084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zkaR53NTxYfZ7vr3XibkLp9FDRnY38s2Fxjaq5MK80o=; b=OlKHLkO0sDfYT+4aWHaHvxUSHqlTU8x9Dh9dG6LlJ6cXgKihFaUPupKQ X4rlVMxx7Qhdw/vo3H9of0d85PYoJwF1EPtUe8Shzq9U7nuRKHZ3BaVJy mBIAf/0mhXYskWQd2rVwc6g6EP6lr1n72ZUsot9lyeULGbPGM842B4ht5 EB2TNIvMHf0rt6Y2xw5j/nqB7Gx9t4H9tjVm2Ki0pPYEU2xUhnGmKmcC8 3hNJvCsjASTTHisvNQ25bSxwgtFD72+Mu5CdqFs751aJcbsVU+E6g/uWS gLOBv3XjzZUoS6Hl5hAskAmXDJLFvHCfLmbaGHnQ4uMxAmKneQLhRb80y w==; X-CSE-ConnectionGUID: vYJGBbowQ/WYGEd45DJVow== X-CSE-MsgGUID: 4q2YJVxnQSC1y+EE65ut+A== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35809869" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35809869" X-CSE-ConnectionGUID: k7iJzDdDTD2Rgyq/0IMfyw== X-CSE-MsgGUID: 1K2khsfRRb6jkzlWCBsdZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="54043151" 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 v3 8/8] target/i386/kvm: Clean up error handling in kvm_arch_init() Date: Mon, 15 Jul 2024 12:49:55 +0800 Message-Id: <20240715044955.3954304-9-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715044955.3954304-1-zhao1.liu@intel.com> References: <20240715044955.3954304-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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.10; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721018192721116600 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 --- 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 0fd1d099ae4c..246fe12ae411 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