From patchwork Thu Jan 25 03:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 13529910 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 091E28472 for ; Thu, 25 Jan 2024 03:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706153474; cv=none; b=Ub8qi93kKME0u+KqRASqiLYpS6P+/OmApWs9++SHw+FdaH3NUXDJ+s69Ag08HeoBcROTq+YJwP+i7SmdGqTLHT2CO4EZmF393xZ7fpjPTofLZ62oGo5Imzf4cBF2SIMSz1uTvUcPKltgo7B9bDLDemosi0KlybZk2sfqMHrJT+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706153474; c=relaxed/simple; bh=kAhbpSvf5mcqCqnuUHwzUyFR0bBkU6DMg1Kt+jDOu9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=T7uuDg0tJdozihMP6D10nr2M177TmOMxa+aFrztGwL9x8gmHcna1b6tLgO6xC4U7WYIYFK4Gx+vb8VJrqPmp3nfvAWcfF//z5doSK6aj5iUCKACxDg6U8vI9+4FMNVKigyZRfgRiIEHnuWzdRFsCnN9iwq0FllVvt4NSAJaCOw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iGZXsVRi; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iGZXsVRi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706153473; x=1737689473; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kAhbpSvf5mcqCqnuUHwzUyFR0bBkU6DMg1Kt+jDOu9k=; b=iGZXsVRix4tpoiDPn0j9uoPBGkc3/d/SWfEE8M4VZaVG7TY8fDM/4LKg wDs/BGIfeq0E/mbCOQiaLxbAwjDnUblyZlyABRZui0wogl+E5LUZcEHfa M5Bzbn7aO0xLUkts5DEyJwf2z46nbYXoDVYO25sOpzGNgkYW9MNgLRxMf e40s86RD4gQilOy7Ex/9LwPQkwywHzMrS9NFoXGiR+GxaD4YU7xbh2QNy EyVEN/YpDhEA1p6vdpRyECgMSVQio203X/K2LCooDnrF5xBZ6K73pR1e4 R3Iz4WQvyNZhuM+79e+giAWguA1ucJGFY5/ZS78ayd/N5esfallSdVM91 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="9430409" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="9430409" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 19:29:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2086471" Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by orviesa005.jf.intel.com with ESMTP; 24 Jan 2024 19:28:55 -0800 From: Xiaoyao Li To: Paolo Bonzini , David Hildenbrand , Igor Mammedov , "Michael S . Tsirkin" , Marcel Apfelbaum , Richard Henderson , Peter Xu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cornelia Huck , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Eric Blake , Markus Armbruster , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoyao.li@intel.com, Michael Roth , Sean Christopherson , Claudio Fontana , Gerd Hoffmann , Isaku Yamahata , Chenyi Qiang Subject: [PATCH v4 59/66] i386/tdx: LMCE is not supported for TDX Date: Wed, 24 Jan 2024 22:23:21 -0500 Message-Id: <20240125032328.2522472-60-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240125032328.2522472-1-xiaoyao.li@intel.com> References: <20240125032328.2522472-1-xiaoyao.li@intel.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 LMCE is not supported TDX since KVM doesn't provide emulation for MSR_IA32_FEAT_CTL. Signed-off-by: Xiaoyao Li --- target/i386/kvm/kvm-cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 9c791b7b0520..8c618869533c 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -15,6 +15,7 @@ #include "sysemu/sysemu.h" #include "hw/boards.h" +#include "tdx.h" #include "kvm_i386.h" #include "hw/core/accel-cpu.h" @@ -60,6 +61,10 @@ static bool lmce_supported(void) if (kvm_ioctl(kvm_state, KVM_X86_GET_MCE_CAP_SUPPORTED, &mce_cap) < 0) { return false; } + + if (is_tdx_vm()) + return false; + return !!(mce_cap & MCG_LMCE_P); }