From patchwork Thu Feb 29 06:36:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoyao Li X-Patchwork-Id: 13576550 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 8528D4EB3A for ; Thu, 29 Feb 2024 06:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709188839; cv=none; b=TaCj15QNBTxFtNasW+wxA/9dU+4bJyHgfVKyHfbqP8oPWU+Cu/qh9XJirdy5sXmB6CetYevWZvcCRf2Vtk9A7gc2FDQua2g7ZJg4c2dAQA7ZQrndvWaWPvAK+3FIWmBezVrcNfq2jGNoFdLxjHpLV6KJes0/2Y6gMKhdB/Q0Cq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709188839; c=relaxed/simple; bh=RcN1i+VyxCmuAxfc7aZKC9U7QFVpxrbixJ8jY8jiEdY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QTu5ykvijBjUZYMPLbr8Vau0mjsvi64n8ndL3ICmlUoIzXrHnkkGUDRxkH3Di6Q2DIqptCzXIErtcPFmBxQswH9OQj/gC5dk6+rzcIWxAxSvF8RLKf/Qpq5h9VDMwSYHAtQTAElelCAS+SZT06/IrFAsrqhvV2MzVCiOqbHMxjw= 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=SPiLptnX; arc=none smtp.client-ip=192.198.163.15 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="SPiLptnX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709188838; x=1740724838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RcN1i+VyxCmuAxfc7aZKC9U7QFVpxrbixJ8jY8jiEdY=; b=SPiLptnXpm4Gs8J2sNQCeGtzBIsFwYBdyWJRKQRUOHhHXaC8ngrGyeUT R3ZGYM4MViznLKLU5HH8dhXlcWaH5oP7bV7wX/7Zjs6trNw4oe5WhpGIq C+XA+bKWSMTaR4PT5yvblvzeZhmIB29PhwxL1XwXIezXZHZS5b5TbXSl9 Nsns3jzL1HfKpQvPZRgjnTUXkEYrrktTxbqt8v2AuLULwBb3/eLh5fd5V 22nnsEVOy14PaCf5oci8p5mO1yyGVju96L3kAiIfQDjajDQYMc8sCdGF6 SJxTHaQuRA+xx3H3hmt+sDP3VMz1xM/R7GAQ0gtBr0MwxWtEyBdFA75vF Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="3802788" X-IronPort-AV: E=Sophos;i="6.06,192,1705392000"; d="scan'208";a="3802788" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 22:40:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,192,1705392000"; d="scan'208";a="8075543" Received: from lxy-clx-4s.sh.intel.com ([10.239.48.52]) by orviesa007.jf.intel.com with ESMTP; 28 Feb 2024 22:40:32 -0800 From: Xiaoyao Li To: Paolo Bonzini , David Hildenbrand , Igor Mammedov , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , "Michael S. Tsirkin" , Richard Henderson , Ani Sinha , Peter Xu , Cornelia Huck , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eric Blake , Markus Armbruster , Marcelo Tosatti Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org, Michael Roth , Claudio Fontana , Gerd Hoffmann , Isaku Yamahata , Chenyi Qiang , xiaoyao.li@intel.com Subject: [PATCH v5 28/65] i386/tdx: Disable pmu for TD guest Date: Thu, 29 Feb 2024 01:36:49 -0500 Message-Id: <20240229063726.610065-29-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229063726.610065-1-xiaoyao.li@intel.com> References: <20240229063726.610065-1-xiaoyao.li@intel.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Current KVM doesn't support PMU for TD guest. It returns error if TD is created with PMU bit being set in attributes. Disable PMU for TD guest on QEMU side. Signed-off-by: Xiaoyao Li --- target/i386/kvm/tdx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 262e86fd2c67..1c12cda002b8 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -496,6 +496,8 @@ int tdx_pre_create_vcpu(CPUState *cpu, Error **errp) g_autofree struct kvm_tdx_init_vm *init_vm = NULL; int r = 0; + object_property_set_bool(OBJECT(cpu), "pmu", false, &error_abort); + QEMU_LOCK_GUARD(&tdx_guest->lock); if (tdx_guest->initialized) { return r;