From nobody Sun Nov 24 00:54:09 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=1727682856; cv=none; d=zohomail.com; s=zohoarc; b=Wt01mOyrILHoqxLKq8VXa1xyy3HspCdM99gD4cFwptMxxfkH6hyfPLfkDkgy5Z2/R4TxWruki71MDgN9pHzKEX92uZgdCXOo+hUT77Zcuqvoe/3h/vnSqonD77LgEcc8hMysxIdvq2/bHXGCJcaNl1Mrok2vk4EsRiO7Bt5rxpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727682856; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fc2xcDKKuaJDGH4lcAR3bQI+WivIlCbUXS/W4ZkqUTw=; b=hGtT3hTMtCJwcdzSnt5BkzRcZV3SP7ZLtU9Ka/W0q3P/NAW7pOzSXMb6TEORT0iCIWIQoWLtweghtmU7ltEpn2UqpNeSDIFFtni9WBwwMgXaQHYdVUfIKpTgMFFfDNS5OFG6qX4+2MwVeZyTV4yh/TWtajEsoOYVmuKWze+9318= 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 1727682856301869.1783735710285; Mon, 30 Sep 2024 00:54:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1svAwf-0002xU-V4; Mon, 30 Sep 2024 03:35:51 -0400 Received: from eggs.gnu.org ([209.51.188.92]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svAwb-0002wX-1P for qemu-devel@nongnu.org; Mon, 30 Sep 2024 03:35:45 -0400 Received: from mgamail.intel.com ([192.198.163.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svAvm-0008Fa-Mc for qemu-devel@nongnu.org; Mon, 30 Sep 2024 03:35:29 -0400 Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2024 23:55:56 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2024 23:55:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727681695; x=1759217695; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aCcMSeMNMPx+pb7Uzwd65SQYAQiwolqLIZNDri1C3Pk=; b=AJRI4rXZTmoNakSCs0ycwzkngurGBj5D+1rmXlo82xcYEsNkeFY40She YLjbCx0RkqdN4gITF/j9/Er9fOQFbBkObHw12s/pBiS1fCrCHF25OHHyY VXNjcWizll2A7PDarbcKi2jvKN7nlnTqGAvp/CGtGIa2bv4OHonLw9A5C 2CBBWgyZdumz8Wa2c7uLjWTiL3qrrB8f0wtOM4iQR4U+mgQWzOOF/208F TewFE+2DkLqn0bG459bmuJ5im2CQpwM3T3/3ixQ68UbX87XNL1HtGp63c dmiLcdHU1rcO9zfUY4F6iaSknwpUSYHh+aYyfYu2so9mdMb4qoRGL0nFA Q==; X-CSE-ConnectionGUID: loydjF65TYiVLQ6pM9jVkQ== X-CSE-MsgGUID: dUz6DgGHQO2qH3bgTvEfaQ== X-IronPort-AV: E=McAfee;i="6700,10204,11210"; a="38107853" X-IronPort-AV: E=Sophos;i="6.11,165,1725346800"; d="scan'208";a="38107853" X-CSE-ConnectionGUID: Is8QYQNFQ0yD83G6fU2aoA== X-CSE-MsgGUID: wm6sEFRXQxuxHEk858HQ0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,165,1725346800"; d="scan'208";a="103984693" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: chao.p.peng@intel.com, Zhenzhong Duan , Yi Liu , "Michael S. Tsirkin" , Jason Wang , =?UTF-8?q?Cl=C3=A9ment=20Mathieu--Drif?= , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH] intel_iommu: Remove Transient Mapping (TM) field from second-level page-tables Date: Mon, 30 Sep 2024 14:52:44 +0800 Message-Id: <20240930065245.2993767-1-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 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=192.198.163.10; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=no 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: 1727682856844116600 Content-Type: text/plain; charset="utf-8" VT-d spec removed Transient Mapping (TM) field from second-level page-tables and treat the field as Reserved(0) since revision 3.2. Update code to match spec. This doesn't impact function of vIOMMU as there was no logic to emulate Transient Mapping. Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan --- hw/i386/intel_iommu_internal.h | 13 +++---------- hw/i386/intel_iommu.c | 11 +++-------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 13d5d129ae..c818c819fe 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -412,9 +412,7 @@ typedef union VTDInvDesc VTDInvDesc; /* Rsvd field masks for spte */ #define VTD_SPTE_SNP 0x800ULL =20 -#define VTD_SPTE_PAGE_L1_RSVD_MASK(aw, dt_supported) \ - dt_supported ? \ - (0x800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM | VTD_SL_TM)) : \ +#define VTD_SPTE_PAGE_L1_RSVD_MASK(aw) \ (0x800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) #define VTD_SPTE_PAGE_L2_RSVD_MASK(aw) \ (0x800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) @@ -423,13 +421,9 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_SPTE_PAGE_L4_RSVD_MASK(aw) \ (0x880ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) =20 -#define VTD_SPTE_LPAGE_L2_RSVD_MASK(aw, dt_supported) \ - dt_supported ? \ - (0x1ff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM | VTD_SL_TM)) := \ +#define VTD_SPTE_LPAGE_L2_RSVD_MASK(aw) \ (0x1ff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) -#define VTD_SPTE_LPAGE_L3_RSVD_MASK(aw, dt_supported) \ - dt_supported ? \ - (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM | VTD_SL_TM))= : \ +#define VTD_SPTE_LPAGE_L3_RSVD_MASK(aw) \ (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) =20 /* Information about page-selective IOTLB invalidate */ @@ -536,6 +530,5 @@ typedef struct VTDRootEntry VTDRootEntry; #define VTD_SL_W (1ULL << 1) #define VTD_SL_PT_BASE_ADDR_MASK(aw) (~(VTD_PAGE_SIZE - 1) & VTD_HAW_MASK(= aw)) #define VTD_SL_IGN_COM 0xbff0000000000000ULL -#define VTD_SL_TM (1ULL << 62) =20 #endif diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 08fe218935..eb5aa2b2d5 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4111,8 +4111,6 @@ static void vtd_cap_init(IntelIOMMUState *s) */ static void vtd_init(IntelIOMMUState *s) { - X86IOMMUState *x86_iommu =3D X86_IOMMU_DEVICE(s); - memset(s->csr, 0, DMAR_REG_SIZE); memset(s->wmask, 0, DMAR_REG_SIZE); memset(s->w1cmask, 0, DMAR_REG_SIZE); @@ -4137,16 +4135,13 @@ static void vtd_init(IntelIOMMUState *s) * Rsvd field masks for spte */ vtd_spte_rsvd[0] =3D ~0ULL; - vtd_spte_rsvd[1] =3D VTD_SPTE_PAGE_L1_RSVD_MASK(s->aw_bits, - x86_iommu->dt_supported); + vtd_spte_rsvd[1] =3D VTD_SPTE_PAGE_L1_RSVD_MASK(s->aw_bits); vtd_spte_rsvd[2] =3D VTD_SPTE_PAGE_L2_RSVD_MASK(s->aw_bits); vtd_spte_rsvd[3] =3D VTD_SPTE_PAGE_L3_RSVD_MASK(s->aw_bits); vtd_spte_rsvd[4] =3D VTD_SPTE_PAGE_L4_RSVD_MASK(s->aw_bits); =20 - vtd_spte_rsvd_large[2] =3D VTD_SPTE_LPAGE_L2_RSVD_MASK(s->aw_bits, - x86_iommu->dt_supporte= d); - vtd_spte_rsvd_large[3] =3D VTD_SPTE_LPAGE_L3_RSVD_MASK(s->aw_bits, - x86_iommu->dt_supporte= d); + vtd_spte_rsvd_large[2] =3D VTD_SPTE_LPAGE_L2_RSVD_MASK(s->aw_bits); + vtd_spte_rsvd_large[3] =3D VTD_SPTE_LPAGE_L3_RSVD_MASK(s->aw_bits); =20 if (s->scalable_mode || s->snoop_control) { vtd_spte_rsvd[1] &=3D ~VTD_SPTE_SNP; --=20 2.34.1