From patchwork Thu May 30 12:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: CLEMENT MATHIEU--DRIF X-Patchwork-Id: 13680336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4A67C25B74 for ; Thu, 30 May 2024 12:26:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCeqM-00073O-HE; Thu, 30 May 2024 08:25:18 -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 1sCeqK-00071g-V0 for qemu-devel@nongnu.org; Thu, 30 May 2024 08:25:16 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sCeqF-0006CX-Mo for qemu-devel@nongnu.org; Thu, 30 May 2024 08:25:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1717071911; x=1748607911; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=/9deiCr5zfRae8uKC+gcrmZtUgeFngGPj+Ci4oAplW0=; b=uHZEXPA3fTawgpFko+hD1nVh93fG/aYysdCgtBUor97IUHHliwBt28bx PHjuobzM9Jji6eLHnk/QS0adlplgG/vw7d0+YD/zT+4qhkqPNnY10oDAy XExPQItjloOLJY9IlpC0OwTm6W1rPCcZvQu7OjGFtYg4wDgSKPCMDqItk duG3YUzcUCLtNz/5mEFcCE0Q5xc6hwrDQmqppxhVMYVz1wHA9t1I0zU8T T4DQY7pWCNdKZBCEe5UZTE3ILRvLoPap3rQ1JIs1kWwVaL4+33KrgzvQJ Dcazw391w9U9bNf3YxDzuzRAaoff2psKeON7pyEk7v4KHfzTbOmodX5OY A==; X-IronPort-AV: E=Sophos;i="6.08,201,1712613600"; d="scan'208";a="13581117" X-MGA-submission: MDFPc2Uw4XwEguz5Cogvjh6ocKJxlqnIxpyBmpBHb5w2ZCEwHYNlCyVyKsp/WInwN4PXG6Xy38PcGaxmEjmo9Gy4JBE+gnPBGVhjXkNEk9H6bf7fRoaqE+FoHN7jfOYvB/YqyvX5vW1TRHObsH80qEVYapT2nZX1GhV8q2ySuSEQlg== Received: from mail-he1eur01lp2051.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) ([104.47.0.51]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2024 14:25:06 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xjqqkyfpv2P987VXZxxalWOJJbElnjkfhhHFySOkCgTXaQUghIhy0nFhaysm4LJO+JdhEB5hbLhe4p/5ze3b20QQSUt0lU78BkgFoYpopBkAD/jweA2fTj/xzwdBLkVVi2/pP73dyFQXHw+PFQUH7r5S5BQ9tU97XUcEq3fkcTkWdvBnGUCSdzeFpvGQ2Azt2TviRd/cuq1lkMY16yr1hwrfjUE4zbMN2eooV50FQ/Jw7+oNbvkI6KlGbYTQSonOZCTTwC4Rf/xm8NaGWzIWKHJ07tGdlIuIjXt/NPJ3AvI/7U6D7fERMi37f2Q1E8EsNQfR+4LuugzKjl52uwm8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/9deiCr5zfRae8uKC+gcrmZtUgeFngGPj+Ci4oAplW0=; b=CERh5oqm+o1+YnVKEOz9UQCqe+OzRwfAM0Zdbq0I55f3LJNNbKC0K/kzV9KvDaxr6i5LshrzTaM65SxI/uBPw4xRENqjv9RJBu7mk3cvxWMEzkESEJNZcY8p0QJDTTaXA+TS5H9nW+BrezSbySr7De2Aj+i1M7QG0a4iyW/rvSBdsyLaUHUDHy/FcZdWgtqjW1RpMT9oA+OVbk+kkYZlQRRD/cawxBbZs0f/jvuabDDRQWBZN4JxI4JRMlgL6kKPc8c8W5dvcTcWcMfHDt5Z/8xlYKMWEAxVy+ej+a+fyhx6S0YJkjpolMAmNk3j06/ti+BsQ3pcOAopeHXFgKZoCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eviden.com; dmarc=pass action=none header.from=eviden.com; dkim=pass header.d=eviden.com; arc=none Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB8069.eurprd07.prod.outlook.com (2603:10a6:20b:358::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Thu, 30 May 2024 12:25:04 +0000 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d]) by AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d%5]) with mapi id 15.20.7633.018; Thu, 30 May 2024 12:25:03 +0000 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 6/8] intel_iommu: declare PRI constants and structures Thread-Topic: [PATCH v1 6/8] intel_iommu: declare PRI constants and structures Thread-Index: AQHasoxm243WHLgbkk2BAL0jzD3XeA== Date: Thu, 30 May 2024 12:25:03 +0000 Message-ID: <20240530122439.42888-7-clement.mathieu--drif@eviden.com> References: <20240530122439.42888-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240530122439.42888-1-clement.mathieu--drif@eviden.com> Accept-Language: en-GB, fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=eviden.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM8PR07MB7602:EE_|AS8PR07MB8069:EE_ x-ms-office365-filtering-correlation-id: 461e6470-3af9-4a5c-4178-08dc80a3889b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: =?utf-8?q?Bkomr+JfSaGR1AZEI+khG/XBocoEBix?= =?utf-8?q?tSITc6iEFJRSB6cCm0sPX81d3RZFEnQMP6pK+oao6VlocjCCmvRAHAP5/PFdqSVuz?= =?utf-8?q?xwt8Y63SuCZGj5Q/G1cSLyF9ZT7LBTkcEEXNWNDxPiHXtRotBzAI+PFRQyxOkZoOw?= =?utf-8?q?b9n9iDC9KZl1Y7C8cUGJtT/AQHRForUfCsTeOi4KS9JHOH2n1GlnNV9NXeoTwWOMy?= =?utf-8?q?1WcUaWeD1LfnhZLDuQzeAhKn907rPUkfgQ9vHSGLjmtE8W/WuDfTV/OFCEkhko17M?= =?utf-8?q?sFJ4RS3NTSeOMZDahVD8EJqUU06WuuUVHqQgczAgVsugu49hhGxf+phR47tmvt53U?= =?utf-8?q?7RAMMyd+X7sZE+buWNVdpr4ILwH16OJNRMIRJ8gLB2bpQXx0PqMpy1NgverWKBM+I?= =?utf-8?q?AADyCD0cVczRH3sTnOMc3iIUtQY4QivJMA2c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bA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?mMy/TrF+gCFlF7YXu0Shewt0JtXp?= =?utf-8?q?bbXIHkmbAMaoWFMiHR768wayQXYQaq9y3XpKzw+rjcCBbRRoANDecAWFhEjoP/jC4?= =?utf-8?q?HrKhdg0DPtQuQMdpAaEy2pqt2XNCRp/3twsRDZlLFOeOPKFfaj4oNizfrCnoxkLQp?= =?utf-8?q?S4iYt2PYtYLgHFuVfsPrv6aQ9L/XC+pCvzsUwSCQjYEQBLFDgh9C+h59xCbPQr/q7?= =?utf-8?q?AbCTaADDeDCYDwFVnfj0n5STaKcAXVXp2ekN09yJTu/cvRcoPFOxX6fBGZiAxQJku?= =?utf-8?q?cp4CD9bdclnVnPItG7DVrna34ItH3J2wyilP+aRBw9uRls+m2cBBvYXmwv3r4oBuf?= =?utf-8?q?hYADMUwgSF7/R/6U6ePnC+8KNPwtA0yFx3XfkkB/bC7kJBpJQIcrKUDBfJYg7WnZX?= =?utf-8?q?77rt4bIQMrYHVDdFjgwYGCPXApf7DEKYolDb/SVAqQFL7VTeuOQQWYzqPLjy3uLtF?= =?utf-8?q?PQ8g3jgVL33GIzSg9XEynj1dmCXgvIMusxwy7c6wH4lOFbmK+KHiaJ2y5NP9/VZ7m?= =?utf-8?q?TielHEes8h31pIDQkOaGX3Fb8Hpag3EBlAuYw93tbKVDZ5OQlxOIEc+7PTGKTdKS2?= =?utf-8?q?+ileWd7BGw9tBDNuW2vrOzq66CUoopU9Ag0EQLTO5cj4qH+Ba+AuKNyxh/76xb5B0?= =?utf-8?q?Q6b5CXIDgX21AyrKQjydEOmIOEp/GrKT0gfrVl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ymm2LJcPhtdbHNs=3D?= Content-ID: <49D715EDC1D20447B486473CB1621A62@eurprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: eviden.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB7602.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 461e6470-3af9-4a5c-4178-08dc80a3889b X-MS-Exchange-CrossTenant-originalarrivaltime: 30 May 2024 12:25:03.9573 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7d1c7785-2d8a-437d-b842-1ed5d8fbe00a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rbE4hOAaWS5jtO/lDj3wHq4f314Crrq5vKEFlzEXWFkZSRRZkqrS/5HLwrU7TIeMzU7kt6Prde9+GfbwEPvr6x9DXbBVN21c7Dv58r9UJcVzpMXu6d1TkRafmeWqhyEv X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB8069 Received-SPF: pass client-ip=80.78.11.84; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost3.eviden.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Clément Mathieu--Drif --- hw/i386/intel_iommu_internal.h | 52 +++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 461158f588..9e01251335 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -191,6 +191,7 @@ #define VTD_ECAP_EIM (1ULL << 4) #define VTD_ECAP_PT (1ULL << 6) #define VTD_ECAP_SC (1ULL << 7) +#define VTD_ECAP_PRS (1ULL << 29) #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_NEST (1ULL << 26) #define VTD_ECAP_SRS (1ULL << 31) @@ -373,6 +374,18 @@ union VTDInvDesc { }; typedef union VTDInvDesc VTDInvDesc; +/* Page Request Descriptor */ +union VTDPRDesc { + struct { + uint64_t lo; + uint64_t hi; + }; + struct { + uint64_t val[4]; + }; +}; +typedef union VTDPRDesc VTDPRDesc; + /* Masks for struct VTDInvDesc */ #define VTD_INV_DESC_TYPE 0xf #define VTD_INV_DESC_CC 0x1 /* Context-cache Invalidate Desc */ @@ -384,6 +397,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_PIOTLB 0x6 /* PASID-IOTLB Invalidate Desc */ #define VTD_INV_DESC_PC 0x7 /* PASID-cache Invalidate Desc */ #define VTD_INV_DESC_DEV_PIOTLB 0x8 /* PASID-based-DIOTLB inv_desc*/ +#define VTD_INV_DESC_PGRESP 0x9 /* Page Group Response Desc */ #define VTD_INV_DESC_NONE 0 /* Not an Invalidate Descriptor */ /* Masks for Invalidation Wait Descriptor*/ @@ -425,7 +439,16 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_DEVICE_IOTLB_SIZE(val) ((val) & 0x1) #define VTD_INV_DESC_DEVICE_IOTLB_SID(val) (((val) >> 32) & 0xFFFFULL) #define VTD_INV_DESC_DEVICE_IOTLB_RSVD_HI 0xffeULL -#define VTD_INV_DESC_DEVICE_IOTLB_RSVD_LO 0xffff0000ffe0fff8 +#define VTD_INV_DESC_DEVICE_IOTLB_RSVD_LO 0xffff0000ffe0fff8ULL + +/* Mask for Page Group Response Descriptor */ +#define VTD_INV_DESC_PGRESP_RSVD_HI 0xfffffffffffff003ULL +#define VTD_INV_DESC_PGRESP_RSVD_LO 0xfff0000000000fe0ULL +#define VTD_INV_DESC_PGRESP_PP(val) ((val >> 4) & 0x1ULL) +#define VTD_INV_DESC_PGRESP_RC(val) ((val >> 12) & 0xfULL) +#define VTD_INV_DESC_PGRESP_RID(val) ((val >> 16) & 0xffffULL) +#define VTD_INV_DESC_PGRESP_PASID(val) ((val >> 32) & 0xfffffULL) +#define VTD_INV_DESC_PGRESP_PRGI(val) ((val >> 3) & 0x1ffULL) /* Mask for PASID Device IOTLB Invalidate Descriptor */ #define VTD_INV_DESC_PASID_DEVICE_IOTLB_ADDR(val) ((val) & \ @@ -545,6 +568,7 @@ typedef struct VTDRootEntry VTDRootEntry; #define VTD_SM_CONTEXT_ENTRY_RID2PASID_MASK 0xfffff #define VTD_SM_CONTEXT_ENTRY_RSVD_VAL0(aw) (0x1e0ULL | ~VTD_HAW_MASK(aw)) #define VTD_SM_CONTEXT_ENTRY_RSVD_VAL1 0xffffffffffe00000ULL +#define VTD_SM_CONTEXT_ENTRY_PRE 0x10ULL typedef struct VTDPASIDCacheEntry { struct VTDPASIDEntry pasid_entry; @@ -700,4 +724,30 @@ typedef struct VTDHostIOMMUDevice { uint32_t errata; QLIST_ENTRY(VTDHostIOMMUDevice) next; } VTDHostIOMMUDevice; + +/* Page Request Descriptor */ +/* For the low 64-bit of 128-bit */ +#define VTD_PRD_TYPE (1ULL) +#define VTD_PRD_PP(val) ((val & 1ULL) << 8) +#define VTD_PRD_RID(val) ((val & 0xffffULL) << 16) +#define VTD_PRD_PASID(val) ((val & 0xfffffULL) << 32) +#define VTD_PRD_EXR(val) ((val & 1ULL) << 52) +#define VTD_PRD_PMR(val) ((val & 1ULL) << 53) +/* For the high 64-bit of 128-bit */ +#define VTD_PRD_RDR(val) (val & 1ULL) +#define VTD_PRD_WRR(val) ((val & 1ULL) << 1) +#define VTD_PRD_LPIG(val) ((val & 1ULL) << 2) +#define VTD_PRD_PRGI(val) ((val & 0x1ffULL) << 3) +#define VTD_PRD_ADDR(val) (val & 0xfffffffffffff000ULL) + +/* Page Request Queue constants */ +#define VTD_PQA_ENTRY_SIZE 32 /* Size of an entry in bytes */ +/* Page Request Queue masks */ +#define VTD_PQA_ADDR 0xfffffffffffff000ULL /* PR queue address */ +#define VTD_PQA_SIZE 0x7ULL /* PR queue size */ +#define VTD_PR_STATUS_PPR 1UL /* Pending page request */ +#define VTD_PR_STATUS_PRO 2UL /* Page request overflow */ +#define VTD_PR_PECTL_IP 0X40000000UL /* PR control interrup pending */ +#define VTD_PR_PECTL_IM 0X80000000UL /* PR control interrup mask */ + #endif