From nobody Tue Nov 12 22:46:35 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=1726032500; cv=none; d=zohomail.com; s=zohoarc; b=gD1ci4L3Pb2M/pznsfzKvw3O/K29NRDxivoauLA5QV2L1aGXfJ4oYNHItVKyL797NpXLOpKQZ7JTCzaUKBfh1sslgBkrYJbtyhUSYwFaSI71H3qbk32oEnzu120uibu9Ez9Dhq0uDVn+uvBbXmT+9tCDhvltQW+Is4t42R8URv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726032500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4P/UEmKZh+PR8keUFYxpiYlQ1MdR853x+Nv/HqiMZ5E=; b=fdKHIsi75sowvdm+EuSzcPeKmgQjewlL2FCeWdP0e1eYlclE/Mwgy+l/k5mYBRSpEaVPgVVgivDO4TKA4Qgy42ZDdmQ2PrmGhvi/7UVEMzjjNvC5FFXA2W/t04LfIIEc/fQFioyLUAivrPqRa+E9YMPjq/sl9cez37jejfVt/o0= 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 172603250028240.81153584685558; Tue, 10 Sep 2024 22:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soFsh-0004v9-6z; Wed, 11 Sep 2024 01:27:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soFsd-0004fz-4K for qemu-devel@nongnu.org; Wed, 11 Sep 2024 01:27:03 -0400 Received: from mgamail.intel.com ([192.198.163.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soFsa-0004Mp-Ja for qemu-devel@nongnu.org; Wed, 11 Sep 2024 01:27:01 -0400 Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2024 22:26:59 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2024 22:26:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726032421; x=1757568421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UGoxBVA6kzO1gidRWg1XuJWhl0S6Jg6nM4URHbYa68g=; b=c1/CkIqDznyAXcJEBF1kPVW4YcDd86iyBx8QMOtowhCNTVTmT4PWTB9z HGL7OKGvJyUhH+EPrEPrwnwWOj3jRiEHoiTVMIxl3c96zzj3dAUh+kZW+ Nx+y+p+EQEChtL599+bYAStLtguF4M4cnQTBLj33G7JlABVuWwUdGw5ch ZyCJ+ekPGfc+55aCf/qYDZl1D2KsSSeTAbudisjcZAcjznjQ+YE7eT3PA 9FtUcgWTj7Ilw9OYYsqDR/+vJjBl2sa9T/qm2HQPHzvAvgR/+JccyxX9d RVwJHn73Wc4dgFd1CZ1P1AsBy08YVxSdlZwyEBuWKdGcYxGYKOBuMMvxV Q==; X-CSE-ConnectionGUID: LKQP1zxTQ1ymm08qkZxIZQ== X-CSE-MsgGUID: O7d2ASSXRAKTM71TuMa44Q== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35403616" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35403616" X-CSE-ConnectionGUID: bqxPxb0hSMC3tIHAqN7BIg== X-CSE-MsgGUID: VmVfFZ2uTr2HtHM86d4U3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67536528" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, eric.auger@redhat.com, mst@redhat.com, peterx@redhat.com, jasowang@redhat.com, jgg@nvidia.com, nicolinc@nvidia.com, joao.m.martins@oracle.com, clement.mathieu--drif@eviden.com, kevin.tian@intel.com, yi.l.liu@intel.com, chao.p.peng@intel.com, Zhenzhong Duan , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PATCH v3 14/17] intel_iommu: Set default aw_bits to 48 in scalable modern mode Date: Wed, 11 Sep 2024 13:22:52 +0800 Message-Id: <20240911052255.1294071-15-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240911052255.1294071-1-zhenzhong.duan@intel.com> References: <20240911052255.1294071-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.11; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.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.145, 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 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1726032500810116600 According to VTD spec, stage-1 page table could support 4-level and 5-level paging. However, 5-level paging translation emulation is unsupported yet. That means the only supported value for aw_bits is 48. So default aw_bits to 48 in scalable modern mode. In other cases, it is still default to 39 for compatibility. Add a check to ensure user specified value is 48 in modern mode for now. Signed-off-by: Zhenzhong Duan Reviewed-by: Cl=C3=A9ment Mathieu--Drif --- include/hw/i386/intel_iommu.h | 2 +- hw/i386/intel_iommu.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index b843d069cc..48134bda11 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -45,7 +45,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(IntelIOMMUState, INTEL_IOMMU_D= EVICE) #define DMAR_REG_SIZE 0x230 #define VTD_HOST_AW_39BIT 39 #define VTD_HOST_AW_48BIT 48 -#define VTD_HOST_ADDRESS_WIDTH VTD_HOST_AW_39BIT +#define VTD_HOST_AW_AUTO 0xff #define VTD_HAW_MASK(aw) ((1ULL << (aw)) - 1) =20 #define DMAR_REPORT_F_INTR (1) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index c25211ddaf..949f120456 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3771,7 +3771,7 @@ static Property vtd_properties[] =3D { ON_OFF_AUTO_AUTO), DEFINE_PROP_BOOL("x-buggy-eim", IntelIOMMUState, buggy_eim, false), DEFINE_PROP_UINT8("aw-bits", IntelIOMMUState, aw_bits, - VTD_HOST_ADDRESS_WIDTH), + VTD_HOST_AW_AUTO), DEFINE_PROP_BOOL("caching-mode", IntelIOMMUState, caching_mode, FALSE), DEFINE_PROP_BOOL("x-scalable-mode", IntelIOMMUState, scalable_mode, FA= LSE), DEFINE_PROP_BOOL("snoop-control", IntelIOMMUState, snoop_control, fals= e), @@ -4686,6 +4686,14 @@ static bool vtd_decide_config(IntelIOMMUState *s, Er= ror **errp) } } =20 + if (s->aw_bits =3D=3D VTD_HOST_AW_AUTO) { + if (s->scalable_modern) { + s->aw_bits =3D VTD_HOST_AW_48BIT; + } else { + s->aw_bits =3D VTD_HOST_AW_39BIT; + } + } + if ((s->aw_bits !=3D VTD_HOST_AW_39BIT) && (s->aw_bits !=3D VTD_HOST_AW_48BIT) && !s->scalable_modern) { --=20 2.34.1