From patchwork Mon Feb 26 08:27:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 206456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1952073dyb; Mon, 26 Feb 2024 01:09:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUdA5cDgsCQNWIYD2cZGfX734RJlnqo419Vj0VMAZoiGSsldzdgcftS1kS8OHNT8f1GhtWwQr02JA6+IzUp+UH+Xpt23g== X-Google-Smtp-Source: AGHT+IE/RQnBqEYwzwkDGpA8mXus1HjDIfW/HNZ3OG3J8SHmsSB8bJU0rwS79pBij8SgDPh7UAaF X-Received: by 2002:a05:620a:388a:b0:787:2606:14e2 with SMTP id qp10-20020a05620a388a00b00787260614e2mr5743518qkn.42.1708938595090; Mon, 26 Feb 2024 01:09:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708938595; cv=pass; d=google.com; s=arc-20160816; b=gN/J3LH8tIpYksq2jSwcawnMcXUeN72q3++09OsQKdVWey15VvbSV1N9UK4/XBDdLs QZCNDwrawtdt5b4z6OOiB/vsXtOHEc/CkQfCHR/unGlMIW6QF2D4kVYYsvjgM3h3hZPL JZwg+GVGKY6qfq3XOSXfxjifvByt0gwMXJxqPZSltk2cuDQkeuQnF17Mo6GGJHLUl31h xE1h2513GMuOQqVw6XZQDZYYAcFdYyIDXkKUuDMXzkLnP6yqApg6/K4Ti7D9xU8G1XSG iAfO2UNI/DWkTcujCO+grYZjh399j7FDoqJW5KqND73yCV5L1lBdW2XaWdNGnm/q7uJi W9Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Q1VsSBffwh0WIFTxUiVQYTQqSXasRH7ER1p49K0PGms=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=nY/O3lzrnXJqYvOFKxzKwt7af9iF488Haaa5JGtr0w3HbWKyl3r5rAk0eK6Ogt9piQ xsLNQbjZ6jzUANpG1qlT73d7af9aErc8IRP1OxlidmOEOrfqHUfxgTTKYIj6toL7lNep E1PM0nyAXXzYvhPpBve13KbHtbUTOmM2sAnQQdqftrnAXUm6Z/17kns2Obg7v9mYB9L2 Zr7L84TJJmJ29trPSaKye7FQh9N5DEYqBQDNPA/wZKDPgfR6xcAIlZ8L0fP3ieTvma2H 74CywFcZGNf+jqnS5gs9mybawcd13nRwacZhjR1ApeGkdDY6SteWafdlmovk0Z37T0XE f1Rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="E7g/7d/T"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80886-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80886-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x17-20020ae9f811000000b007879cae0480si4403699qkh.169.2024.02.26.01.09.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:09:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80886-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="E7g/7d/T"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80886-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80886-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DC6FA1C237BB for ; Mon, 26 Feb 2024 09:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB968130E20; Mon, 26 Feb 2024 08:29:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="E7g/7d/T" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 84AD112EBEE; Mon, 26 Feb 2024 08:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936159; cv=none; b=mKkrRLQgtADNlIc5OpAflLQBfydzZTMU26uaZRvI6+Smnm2FxfZcUhnIanJbNlmcIgdP3JZHfWv0r+z8+sWi8owu/Y2/i1beAvLza3Jovw5cDPBuJy3OI6qjCVmgsCbVNNVv3srdhqV34oUxr/3de54PlKNJT8fuqyE5UIO3BbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936159; c=relaxed/simple; bh=VTw9bzx7BOh5z8zeVoQCv87WXQmA2rn8M3JbvT++IJ4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Eg82KTqev14zqxTO1OrBPQcH2ZF2DRXdZ5T6BWI4wr14W3Qz7/agPMmPUZTQf/KOEEAtwUyF1mgarfmSNFrvjZ5NbZyRMbwBF2++rL6j79bKzv7GVtsw5C44t5DPyPGloEeNKnbWvTTwS2KgXiNMi/JRU79YnFWFBEgEbn1ONBs= 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=E7g/7d/T; arc=none smtp.client-ip=192.198.163.8 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708936157; x=1740472157; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VTw9bzx7BOh5z8zeVoQCv87WXQmA2rn8M3JbvT++IJ4=; b=E7g/7d/T7KT6NUDUMkVk6qcrhoR8jvLmq3tFPGcTagjl8wdihgJHNL6H W41QB9/8mMgIVeql9OI3T3c90hKmQK7XFRFvEBJ7nvIZACEStifKobWNH lZzTDGCO073r7Tc+pAKhYMwJDl1p4ogfXFpwCtNYW2OU2nx9VgTiRoBHw xnAgIQV6aUwB6DEhXCcc9NSv0pgmgD71DhxlZtbnWwYBwq5jCt5Cr8+5e Lj0U6KrFp6nnX2TprtPcnAg0DCnDmdGpKVYuExBLHQcOBT6XYlieEaUou QCn4+558BfFsjbZpDTt/s9a1e9hlAdZ2pSefA3qAdqK1IbPt61NGG6DZv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="20751400" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="20751400" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:29:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6735133" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:29:10 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v19 123/130] KVM: TDX: Ignore setting up mce Date: Mon, 26 Feb 2024 00:27:05 -0800 Message-Id: <52df2fcce3f44911ee736f0abfc62c1ab05c8620.1708933498.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791951996519254382 X-GMAIL-MSGID: 1791951996519254382 From: Isaku Yamahata Because vmx_set_mce function is VMX specific and it cannot be used for TDX. Add vt stub to ignore setting up mce for TDX. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index 9fcd71999bba..7c47b02d88d8 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -899,6 +899,14 @@ static void vt_cancel_hv_timer(struct kvm_vcpu *vcpu) } #endif +static void vt_setup_mce(struct kvm_vcpu *vcpu) +{ + if (is_td_vcpu(vcpu)) + return; + + vmx_setup_mce(vcpu); +} + static int vt_mem_enc_ioctl(struct kvm *kvm, void __user *argp) { if (!is_td(kvm)) @@ -1085,7 +1093,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = { .cancel_hv_timer = vt_cancel_hv_timer, #endif - .setup_mce = vmx_setup_mce, + .setup_mce = vt_setup_mce, #ifdef CONFIG_KVM_SMM .smi_allowed = vt_smi_allowed,