From nobody Sat May 18 23:23:44 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=1653917385; cv=none; d=zohomail.com; s=zohoarc; b=lwxubjUUq91MmSTEoFWLjXpFVDDyJ5ZQiqWy/jdTLOo5GY8uS7XyU6isgpXgB1xVxBVj6Qqw8adOyWR6zDvXUOec1p/OCbVdNlNaNSCCzAPQWzhBg1SMKcwaRYF+U48Ohn5ZUlpOweFbeH78tXsZQsOiMo+7ao1uJX465LTRYf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653917385; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=O4Nk2NLctS1QOq4KB8lPxfMDqGrrLgBPBhlTj+79YkA=; b=S7e5u98Zur0ICkeNpD4m9I4gjkLJUHY5aYZrq0dMmihx5F7zgD2gPhJZvNleXBEFxNhHAaMsxQzfsgIfJu0y3lDz8CVSZHtVbEVu7psFS9u4dtJfBkdWV/MEtIBjS9JYJQLhwft0nnx67Xm3optVeEu6c7xmxR2jocjMcQdNaGM= 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 1653917385636388.7366265104514; Mon, 30 May 2022 06:29:45 -0700 (PDT) Received: from localhost ([::1]:58400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nvfSq-0004oO-HT for importer@patchew.org; Mon, 30 May 2022 09:29:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvfIH-0001FS-UQ for qemu-devel@nongnu.org; Mon, 30 May 2022 09:18:50 -0400 Received: from mga06b.intel.com ([134.134.136.31]:40559 helo=mga06.intel.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nvfIF-00020B-6F for qemu-devel@nongnu.org; Mon, 30 May 2022 09:18:49 -0400 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 06:18:42 -0700 Received: from icx.bj.intel.com ([10.240.192.117]) by orsmga008.jf.intel.com with ESMTP; 30 May 2022 06:18:41 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653916727; x=1685452727; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4bUzFfuW7PI/iZG3TricEnJCJWSwKo7DQcGwE0jHqr0=; b=hYruMOy50Lo2qcAMhmSO6ij48OH75VIFmfZOkKxuuFMxv+F8hwSHbTlS kSJ4gCeJcgOgYKyZhzMQ1PaJF2KKDwkZyJ5d3jxI/kOv3tkdAOSmczn6K mLXKP/QS79ZGTwJrKl5HM1wS2vgH59OIoljuHwl/7ky/v5FmpfOtDfM7Y Yet81r5zvs2BOy7tFV3qYCl4LsVFFbTj88GEZrv/XWnwSfO/bfbYw2t2U 6ol7YcOap/1zQW5mjYFHkbamhS5j9A/0M3ZP6xg2+w0xLfN1FpEy4TWDz YlXbCiQ4uiEd33F4SXnEiNZMUcgLPjA7yD+Km93bZCDBDX5XoT8eRj+hQ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10362"; a="335647723" X-IronPort-AV: E=Sophos;i="5.91,263,1647327600"; d="scan'208";a="335647723" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,263,1647327600"; d="scan'208";a="605187101" From: Yang Zhong To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, yang.zhong@intel.com Subject: [PATCH] target/i386: Fix wrong count setting Date: Mon, 30 May 2022 09:18:34 -0400 Message-Id: <20220530131834.1222801-1-yang.zhong@intel.com> X-Mailer: git-send-email 2.30.2 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=134.134.136.31; envelope-from=yang.zhong@intel.com; helo=mga06.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, 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, T_SCC_BODY_TEXT_LINE=-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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1653917387830100001 Content-Type: text/plain; charset="utf-8" The previous patch used wrong count setting with index value, which got wro= ng value from CPUID(EAX=3D12,ECX=3D0):EAX. So the SGX1 instruction can't be ex= posed to VM and the SGX decice can't work in VM. Fixes: d19d6ffa0710 ("target/i386: introduce helper to access supported CPU= ID") Signed-off-by: Yang Zhong --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index bb6a5dd498..9fdfec9d8b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5559,7 +5559,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, = uint32_t count, * supports. Features can be further restricted by userspace, but= not * made more permissive. */ - x86_cpu_get_supported_cpuid(0x12, index, eax, ebx, ecx, edx); + x86_cpu_get_supported_cpuid(0x12, count, eax, ebx, ecx, edx); =20 if (count =3D=3D 0) { *eax &=3D env->features[FEAT_SGX_12_0_EAX]; --=20 2.30.2