From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866333; cv=pass; d=zohomail.com; s=zohoarc; b=fJd2ZIWGndyQA7iIFkPXyiva7DyTcpCoYYW+5b6llfRutihyNgnnZ5f5S03EzSx5qA49hcTd6JDxSuyLgEMEx0/UlYv1wodUycnHCZhpJY4MYQFeCmNMQ62nbOizz1ZA5c+kWfGdPqIGkqvWhXc6FHsGYLzZJowoM/WSYq969ig= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866333; h=Content-ID: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=j7ZhHAc3M7mChDH3124zBWgd3jo5et1QNZwivcfTjKs=; b=GyQ0dc7kqQv5x1LIxhH9wf2hqYXB2xOdfZvbANkRYW46iPeyJvFSxTwni8tN0mzjMPgB5iUWpCxDHZvF9rGwtcbprHAuAQCk6ZNEJVfVW9HTghpjsRtk9bmWwOOEQsVR9PFmDsMLxEds2YDO+QQfClzsHl9gDU2EvRw3pBNBwe4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866333003101.48459749188498; Thu, 28 Nov 2024 23:45:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvff-000802-IH; Fri, 29 Nov 2024 02:44:11 -0500 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 1tGvfU-0007y7-6C for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfR-0002e4-St for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:59 -0500 Received: from mail-am6eur05lp2105.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.105]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:51 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:49 +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.8207.014; Fri, 29 Nov 2024 07:43:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866238; x=1764402238; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=j7ZhHAc3M7mChDH3124zBWgd3jo5et1QNZwivcfTjKs=; b=mXMbeHenmze8uT3vbIUzR5vKe42a/5ZX5+Yks73kc0tMxN8t1UloStYn rtzeqHT71ZTHVQr6UmCoFjsyTWSYgKC87WmSxSImFe5jQs55yhWqDfhso Mo4Z5vW6cWb0+X9l7KAsaSpo82EChNyWnf38rc4SyasR9qtQM/Y5lNXWw Eg1ty1GYlEoSZHddMgStrL3ZDTodB+bFVNLRr8I8VcgmvIHZa86mJnPY4 bMN5k8KQFh0XriXnc0ZTi6qx9Fvzf8MElD6+MW0WH6Wvt3eFjbTLc/kKt Mn/Goef5lHxGIYnbgc+aG3cVLOrEwFonHSwBiUiRZG1L2DzGGqBuelv/J Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664396" X-MGA-submission: =?us-ascii?q?MDHfmMeb/1qzVUA+P//DOF0EIzToYCvs9+YJJq?= =?us-ascii?q?67RVZvclHk6lBbayvLv37sgQQd1u4tlMLa4sIxO2NCRNZR5O6Nb/jNpe?= =?us-ascii?q?S1z+R7+xzfXkZpdf9eCS9BtZ0TAWlmP4eAlokWp6lKYzD8z/s4zzbfVx?= =?us-ascii?q?5zdtyhVkHivnyHGsf9lCMX6g=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x+VPZnsfwBsDjmDYsLhX2eh6bd4Tst0YMrueFwaqtHjktDyT5pc7dcf7tF+iAAoo4+Oqn50AvCnOO7WiVYwV5bDZ0t+MhyByLo4noqMRmrNVfyHYMxSOjp8c7vCBjC0ygUxJ5sJ67imHplfTvlTeoP0kwX4v+Ij+XUIGoDgEkuTSZs69AKzn8R34qFqdxi/Y09MUxBXXX0prubpqiIloxw5G/E5BLEhUP9quFIP9ZKMV9cgNoj0V2vMuEWbbMBnJr5qPlWQkkr77o5yyvXtGKoEiLzF9W6m8D9vsftVBa5B9fGdPQ/tBqRKIwizTuvwqLaKIdx/rmI7YCz0En2D38w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=j7ZhHAc3M7mChDH3124zBWgd3jo5et1QNZwivcfTjKs=; b=KulmbskJyRGtyWNckqlTRvLgjhTUo1ofN9ejLK9NGe0xZniE5oeEQ7v19tGlihvg257xLfkVprBawZUs6pbIb0kAiiBxxX+73vLsCx66D5r7LidIBBg9QpnhbG7G0kuMIo6VA8hmk7ubOjgqgCyS9LxIVAjc9EwBVW2AGCAVFDHQ87sTx6NkzKkn8tcKzgzd/GKSe0QkgG1fCMZL9OTA0/RzYtEFNMuA+Axfpc/0jymsvOxF/uCe8j+Ig3LF5te8DeB3OBNvYD2paHUUfJ+XCUJwFiH5HcFi/7mVKISHncsQoJ2wD5DKXRBU099AqxCgZpoq5V0qaMePZ7ci41WIxg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j7ZhHAc3M7mChDH3124zBWgd3jo5et1QNZwivcfTjKs=; b=LfLtD0K4gFBQIFAqdBT4HnOaYf69/GcgPOd3EV1RqpIPxWtdGhuTIVIcDKHS+8YHmnQTWMa0ds/U05EK2xIByniG0uR0uYB9C8kYmCRj1RCOaA4rPSDpMg426cBEFJShJfzfgqgf86O+dVaqMn1RXyf9VqplQmsFh9aA7xAckQL42nk2xac+HZxtVVH1ykjH7/sftUFI3+ogCjJrhq1kQ7yBRm9cLv5SUKWjYEfsSOuAYSky5nxD7Q2E+UCEBJGfWlz2t7vD5sGHPb6Hjrf1icbScMEoTDw5hhsqPcAbR8gOyVIJaRn2sz+qwNcOIUCyOvX7YxdwRgbHziqW3ESg6w== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 01/19] memory: Add permissions in IOMMUAccessFlags Thread-Topic: [PATCH v1 01/19] memory: Add permissions in IOMMUAccessFlags Thread-Index: AQHbQjJt58lDGQrBW0y9U9llBbaxQA== Date: Fri, 29 Nov 2024 07:43:49 +0000 Message-ID: <20241129074332.87535-2-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: ae535b29-b2d1-4b48-29ca-08dd10499063 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?OTZ6WkthYTgweTI5T1hILzd4VncvWVJQWmlFazNkVTYrQnh4amxvVDRkaXZh?= =?utf-8?B?R0JpQzdVcFMzTVZSbDB1R0hCcXA1TzNuK0FTS0JSeHAxSkYrTitGUUZiUmNS?= =?utf-8?B?TUJUUVk2M2pLRkdhcWkxK3BNU1ZxYnVGWGVveEczb3hTeGlmSGMr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LI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?UlBUcVFLOStpTEluMU5RUFhPV1V6ZTJkK2c3Q0NveHVwOHhBb05OWjdNYmlv?= =?utf-8?B?WVo2enR1cnJsanNPNjl6cWpMUXM4WGpjTzJvM2loQlJvWnRmM2Y5RFQzUVB1?= =?utf-8?B?dGRMNk1MZ055QkltKzljUmdMUW4vaG0wV0tjcXpIMVFyTUhQK1BZcldlVlYx?= =?utf-8?B?aU9WUGlSN2ZRb2d6YThLY2FHNTB0a3E5UXgzYWV4RVhvVDdWeis4SFp1cFVE?= =?utf-8?B?Y05GSDY5NWZiOU9QbmU4L28xWE1FVXlEdVVJT1NaSWxnd2VrcXcwQjc3M2V2?= =?utf-8?B?N2dRWDlYbGw0R3ZGZGkxYVFkYytpaytmTjNITGFZVFUrallkcExNVEVxaFdu?= =?utf-8?B?RTdlTUtYR2ZNbWJSRU10K3lhS3FQU0RBbExLUTRmaS9IVTJMK3lxa1F0NHh1?= =?utf-8?B?RjlVdUlSL003SkRZdmVobUFtemJBN0d0cU1jWXQrNWtwZlNna0ZDUUJnOE1i?= =?utf-8?B?Z0Y2UFR3LytQc2E3RnJXMG1QTm80eHBlWTMyV1ZEUnV6UlQxRUhUdktnODZS?= =?utf-8?B?c0I3aVh1Y1dycVRraEtsNUxFZk16T3VYU0NLbmwwN0oxYXdOYWY5OGx3ZmZn?= =?utf-8?B?QzMrNHM2dEtiNllZYm1OOW5pRkZmTE1JR01WanNnSENrUHJ5aXBSVXJkV3Fo?= =?utf-8?B?YlNoTC9kdmJaNTVQRmNjbVdsODNRYmtDV0VzK25mdHNSWksyTjVmNUFmRGNv?= =?utf-8?B?blQ5VlZneVF3ZXFVNjU4am5lNDk4WDZteENMTllOQjc1K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3aTJIVDhBOFlDa05RN2s0MThXY3pVRnFtRExCcHFz?= =?utf-8?B?QVBEOVc3Y3FyUlRobFdjYzZzNzg0Q0lMQkg2ZWQ2cHFPaVJuZm9lRDJhZStR?= =?utf-8?B?MmhJUjVQVFVXUFNqemZ0V09Jdkl6bGhXWkpvQUlsclZzc1hPNzE0SzdsZUNx?= =?utf-8?B?Vk9BV3Z0QndyQ0ZyZEJidlNJdUFSRFlDWXc3dEoyRXplaFNONnlTL3ljZ1BM?= =?utf-8?B?bFZJcDd3VmF2VzVJM3RDUTZWemR1Q0JDTXkyVTB2dmRsM1FIcitBWmpvbkZG?= =?utf-8?B?UTJ5djMxckRRZHZMQXBLV0dBVWlsUWd6ZkNMeGtjOFJ3Y1cySjUxeW41Nmxa?= =?utf-8?B?bmovZFMrYURjQ0Z3Z0lsaXBvbDJSNVo5UVFYTmc2dDRycEhRZnMxUGlpcEdi?= =?utf-8?B?RDdpZ2VVQVlqZVZremNUVnhZQTQxMlJDRXZRbTg1bnRDQVZVbUVUZTc5MFE4?= =?utf-8?B?RlVSZkhXN1lBSVhua0FLSjliZzdLbkxHQ3d0bFlrVm9odnI5UkZuTUZDUDdh?= =?utf-8?Q?4k9hAYTeniXw7VLUVTz/JyA=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: ae535b29-b2d1-4b48-29ca-08dd10499063 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:49.7194 (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: N3xJXIPf8Vum8nyOxaX9+rs4CohzDFOradIvmQwckAQikSJea7o+G1WHDOVSdEn81SCwFbz5hrQX39PN4loO1xc87bF8oQRbmDtXXeZYzwMtrUm2VfSWu4xaGwaVnsg7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866333931019100 From: Cl=C3=A9ment Mathieu--Drif This will be necessary for devices implementing ATS. We also define a new macro IOMMU_ACCESS_FLAG_FULL in addition to IOMMU_ACCESS_FLAG to support more access flags. IOMMU_ACCESS_FLAG is kept for convenience and backward compatibility. Here are the flags added (defined by the PCIe 5 specification) : - Execute Requested - Privileged Mode Requested - Global - Untranslated Only IOMMU_ACCESS_FLAG sets the additional flags to 0 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- include/exec/memory.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 9458e2801d..15fff69432 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -110,15 +110,34 @@ struct MemoryRegionSection { =20 typedef struct IOMMUTLBEntry IOMMUTLBEntry; =20 -/* See address_space_translate: bit 0 is read, bit 1 is write. */ +/* + * See address_space_translate: + * - bit 0 : read + * - bit 1 : write + * - bit 2 : exec + * - bit 3 : priv + * - bit 4 : global + * - bit 5 : untranslated only + */ typedef enum { IOMMU_NONE =3D 0, IOMMU_RO =3D 1, IOMMU_WO =3D 2, IOMMU_RW =3D 3, + IOMMU_EXEC =3D 4, + IOMMU_PRIV =3D 8, + IOMMU_GLOBAL =3D 16, + IOMMU_UNTRANSLATED_ONLY =3D 32, } IOMMUAccessFlags; =20 -#define IOMMU_ACCESS_FLAG(r, w) (((r) ? IOMMU_RO : 0) | ((w) ? IOMMU_WO : = 0)) +#define IOMMU_ACCESS_FLAG(r, w) (((r) ? IOMMU_RO : 0) | \ + ((w) ? IOMMU_WO : 0)) +#define IOMMU_ACCESS_FLAG_FULL(r, w, x, p, g, uo) \ + (IOMMU_ACCESS_FLAG(r, w) | \ + ((x) ? IOMMU_EXEC : 0) | \ + ((p) ? IOMMU_PRIV : 0) | \ + ((g) ? IOMMU_GLOBAL : 0) | \ + ((uo) ? IOMMU_UNTRANSLATED_ONLY : 0)) =20 struct IOMMUTLBEntry { AddressSpace *target_as; --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866513; cv=pass; d=zohomail.com; s=zohoarc; b=dfDHEVvoTGaF4bUrEvqCFA7kM+nng3/wpyg3VEechll1vkkcWIj3qy/RWNMOIMDRj6RGvcqsY5xAuAVKymIdp5P7nV0Lh7FBpI6/KT6+uf3EZgUpz71ZkCL+2bvP1F7yvnfFudRUK66yb7pKpUZtruQYytHYtBYgM6SKL0uSeig= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866513; h=Content-ID: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=QWd2tkeHQbBwbBNdDBZH/aGLavqAFkrtdTaIu/gE1UU=; b=TTuGzesrlRcuV+938lCvrW97r7SMbXq9GAMmgYyoKU5lOep9uUJC25mR3GaYVphASKgGIiHEZYUxXJwenodGG5pbrumkE1CmeO1Bhe+5alB0cVcySQ475O9vJvuEaTjz+WOVniYIeb+LTfrNjTxhceBzHaYgHoiFJ3spcTZYd90= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866513312162.5593974437221; Thu, 28 Nov 2024 23:48:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfT-0007xv-9z; Fri, 29 Nov 2024 02:43:59 -0500 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 1tGvfR-0007wx-I9 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:57 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfO-0002eL-JA for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:56 -0500 Received: from mail-am6eur05lp2105.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.105]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:51 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:50 +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.8207.014; Fri, 29 Nov 2024 07:43:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866234; x=1764402234; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=QWd2tkeHQbBwbBNdDBZH/aGLavqAFkrtdTaIu/gE1UU=; b=UCAqjRcpkrj24LZ2UPK1XySl1aKa6ZgZeuHgBxfolBBI14XIarKIJMeN mt4S0I2o9r+bWj3Lo1H/G7lujoszpvHppyyWB1/kpdx7eDftFGDgGaPtU jJcV+KijzWFB8swV5TA1YU30IF+7OdHu5V/Z/pIKVfh5XoGa5jrD/AKnR zh9qUb5mrYcadBmiUSqSQq/HYD8wUBQPKyL+RJbHeRohI8iS1b97Y5tvC eUPbbZZp9OKA1oeVpjP4H7jvV/atKDBVIJTQhfgCwy0jSVcMnNQI0hez9 8ZdEBrPjdKZIGSofUkBkYT2DziMBGSqDY9rfT9RaVA/0pSWHT4tWRVgSn Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670793" X-MGA-submission: =?us-ascii?q?MDHrc9yHZwufgdxk5QNh0KWEmN8lJhM0ovdCA2?= =?us-ascii?q?j/+g2WGFdsIypo51rtvf+xoDXAI7uWKeJOpuhFHzl3CDwvGh/t12Ieg/?= =?us-ascii?q?Q+qQUg97XnZqZ9W4qbvO1jzup59VurkcXqUPQ/UkdH/o3qvIzi/QxpZ7?= =?us-ascii?q?WjHwqjnmOyonIRPGURUkj1cw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sFJ93EnwlS6GFrynhraqbxx/WbCL4yTODxzg2AKiuJOdQC4c9JnNwcwSQRSVYP/0MMeUxgXXO1n751CQe7lCtK1ZZmm7XBwMd6I1mf34u8vcv+pmGMkbXJTqR9b25xKENjbQwK09bd2N5AUXAm9Q6fEWrsRO+C7hhIfSMssiM3q33tsaab1Jbtq8TPfkFyVc3nHyCvNrikXd45+pTPdSafoOsGtpynzyMmpcuV0nEEwO1HTXSuyVGetJUjHhr3Xl1bknBzQZDcZA0gdmj++Oeecd6j+z9kAupZhRGC/GpLMiR71ADS3RdJHuFGvEGqZvSlZ9MmJEk8w/Xz1sC3flpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=QWd2tkeHQbBwbBNdDBZH/aGLavqAFkrtdTaIu/gE1UU=; b=PwBrqrncBjHZn7rCgg4dFW6TgW0ySowcW6MWBw9JnPxe2mVh6hxwHpkaW7NWHVldS6B9urSnyaMVzcKJd7O69HHaN0bnKR+v4wTfHQ9KCa3cklTsCdeEefXDK0bDIrf3/Icl8QqMM2OW3DU+QcN4P1q/5fMwSBmXbEzJU1cpm2RwQeOFkHJXmBFvERm0MzlhdAVlnl5J7CW3/bZZ5YNhDOHeJeVCl4wmbKRcB98lkaG2DEaQLPAjuTg4POL0snUcVt+CacPv7GBMePtMlfX8sC5aSDFaJ8EpEBJH56PDffpOJQ1B8BPks9F9u5n4vbBPpp+JH+evk6ySyGBCQrBAOg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QWd2tkeHQbBwbBNdDBZH/aGLavqAFkrtdTaIu/gE1UU=; b=FquTm4/vuVY0T5oJSItpe7fZnpVoYhbstkqnuEXmgUplEVC+JP6WsmQ2vB8crpvbaKpC1SuO0ADoyAoJvvzZ6+HiupcOFpV7PhERHRjG1sP6OSPzWcLmQm1wM5e2kD1rci3lsus42YilwTQsrSZaFr/B/rM0NOTzUYTU6yEj1Zwuw07HAYsBzV6yLVIf6yg77tUzZKHXbmf6kiZN2cxkiHJoZj+zby67aPLefVy5KVR4PsYbnG8wDkLGt1CRMvkkyoyxaoG4X2d0O7pfGFrVyqZiecQpuheLbqPiK9yfL+UNQG2ev8aw/SHDeBQr9Ot/AiZBKkzwEC/TEsjsACGZWw== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 02/19] intel_iommu: Declare supported PASID size Thread-Topic: [PATCH v1 02/19] intel_iommu: Declare supported PASID size Thread-Index: AQHbQjJuc09ui8+1N0yV5gvXicUETw== Date: Fri, 29 Nov 2024 07:43:50 +0000 Message-ID: <20241129074332.87535-3-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: 482a81b7-2561-457d-c727-08dd104990d5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?a0JPc3NCYzRUblUwbXo0SXR6Yzh6OHdLcCtxNjNTOFR6dlRZSHVXYWU5a2pQ?= =?utf-8?B?amRZbFVRU1dmSU5FdUtvUkVEVVVoQm9mTVdKMWppY2JnMVBoNkR5WSs5NmJE?= =?utf-8?B?NVBMTEQvTDZaTFhRV3lVWFFSSmViN2F1QTFBMTBUYVFQaVJGWTdwVUxscGF2?= =?utf-8?B?NEJWTVVEeVAycmxmWjE4UGh3Q2tWS0JYMVRJbXFJSEY2Wk14NXVOVDN3Qjdm?= =?utf-8?B?YTBmTmtnVFlWQTA2MTZDS1JwM3d4VStQanNUQlhBUXdkckdTa1NWeUJUekVi?= =?utf-8?B?NlcxNVhSRjZKeWUvSDJXeWtpWjZsNmgyZUlIdDZUYWVNblhIekFFbUxJOUZv?= =?utf-8?B?ek5HQkNjc0lsWm9oMjYydDN0QUZFQWFEW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doTzYyRGRGd2FPMEpOOTFOTnl3bGYrYTFSejh4cFk1RitxVHdI?= =?utf-8?B?elRkbnd4ODV4MXFseVVpaHp0bUJib2hRYW41QUZIOXhRZUNGWU52Tml0d042?= =?utf-8?B?eEhJTzJ1aENSekp6eEpMTHI3OC81SGRqREpWWmlXbW9nUGVJUGc3b1BEcmY5?= =?utf-8?B?NVNxUmVoNkFmb0tIYUg2TUhCeVFqa3IrcEh3cVlmdEV5Y2NYVkNjNEZYQ3h5?= =?utf-8?B?ZjFaT0RUWVd2enpLS0pEdE9tSEhXS0ZOczU2bkdSV0JIaXNVeE4vU0tDTDlr?= =?utf-8?B?Tk1ZQ25PTXhsRVIxcjlPcDhpOEtVSys4QnZrOForNTVPYjhCWktmcDkrVjFx?= =?utf-8?B?ZlNuMXVzZUxOQUMrV1V3emlFbThrZEVTdHVuYmRGVENOMjV0TUxiZTFnMkFD?= =?utf-8?B?cCs0ZTVRa1hadjZsbzQya29aYjRBVkg0bVVJck1Eb1FsUTFMMlg5WGJPcUQv?= =?utf-8?B?R2hVb1lCa2ppVmUyZ3U4WGpyZitpSzVVYk1WY3V3UFpHekZYQUZoYW12MXFI?= =?utf-8?B?eEdPY1NWTXdkVHhGV092eGlLWmJTaW1FRXZ3Rk5CaG5jZHE5ZU1ZQTcyUlAx?= =?utf-8?B?MUNNZVNSNzhhdmhoWkNvd05CWjVFK0FoeHNQekZCaFhDdXc9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?WUNjRzUrbWpoUDFCOEhjOXRoczh0aGNiMnkvVzlzOFQrNXVlUFMyRkUyejB2?= =?utf-8?B?bFd6emp2ald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kxV3JubTdvdzcz?= =?utf-8?B?WDFEdGxRWnhFRHVBOFlWT3hJUjRxeitWeWtTTVR5QUZZbUQrdkk3NWR1MXZD?= =?utf-8?B?N3VzVWdiTDBmOWRmSnR2WnkyMFdrVStsQVU4NkpuRVdFb3dXbjhWQjgrY2U4?= =?utf-8?B?SDlMbUxaQUsveU85OXBMUjB6eVBVcGNiN1lpQk1KSmpkclVhNUVYTmlTSjZu?= =?utf-8?B?QUZuS2dGNkE4d1NzZERGN0xORUJ0NzB5TUtzakg3ZTJZVS9XVWJTTGYxZW0r?= =?utf-8?B?cTRsdzZIOTFmV3BVRXVNdDhyazE1YmtWbXJoUmhIc1pKclpxS0dNYTZsMDBZ?= =?utf-8?Q?ZF2hjCqsKAc4V7L0jjn330o=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: 482a81b7-2561-457d-c727-08dd104990d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:50.5046 (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: 4y1PUksNre6bx7Hvr4cRz07PVCzurKh9efFNKHBvmx+oGekAG3c7bNgeqX7XNq213VlYRpfCrTIl5idkmaicRlSRlEJ43skqoypJXFjwH2tn9WN2kxX//y2L0j03QppA X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866514530019100 From: Cl=C3=A9ment Mathieu--Drif PSS field of the ecap register stores the supported PASID size minus 1. Thus, this commit adds support for 20bits PASIDs. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 2 +- hw/i386/intel_iommu_internal.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 043426032c..aad132e367 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4575,7 +4575,7 @@ static void vtd_cap_init(IntelIOMMUState *s) } =20 if (s->pasid) { - s->ecap |=3D VTD_ECAP_PASID; + s->ecap |=3D VTD_ECAP_PASID | VTD_ECAP_PSS; } } =20 diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index e8b211e8b0..238f1f443f 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -192,6 +192,7 @@ #define VTD_ECAP_SC (1ULL << 7) #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_SRS (1ULL << 31) +#define VTD_ECAP_PSS (19ULL << 35) #define VTD_ECAP_PASID (1ULL << 40) #define VTD_ECAP_SMTS (1ULL << 43) #define VTD_ECAP_SLTS (1ULL << 46) --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866378; cv=pass; d=zohomail.com; s=zohoarc; b=CQ/3C56lQ8gqjZLJBjKUBxuwh3VosnC6Ni8gWUIS/1iOh4dsQN+feBUpBDI7A80NXJczV9lmlkcHkBiVc7xzqtqb9+/muMZCxS6He42M5Kauuh4aP/tkY1LW36CO+NFKBucgMaUrDaxrpayaeFFzrD4ZBzAeGO8wOtDYEpbPvqU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866378; h=Content-ID: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=n8O98KShNuvgHQbN+mh2dS/8MP0Nk7wBFRcwtlVqYDg=; b=ByYfNmDPnuLeSuol8h4X7LI6R2+aJiNUvFdsK1XdErCRQ1i2+ScrZ/1U8/9RIGfRsp+QqKlGXJhIRUEjf79EVz2zBdAiXD1R7fWTXPtPx2O7L77oRhxCR86SlcR0kkaA34juetcJKUvYxdQg3C7t0AhPyP2P6gcS/7GMV71G+rY= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866378318206.14896931710405; Thu, 28 Nov 2024 23:46:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvff-0007zB-Ci; Fri, 29 Nov 2024 02:44:11 -0500 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 1tGvfS-0007xC-8y for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:58 -0500 Received: from smarthost4.eviden.com ([80.78.11.85]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfP-0002fk-GM for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:58 -0500 Received: from mail-am6eur05lp2109.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.109]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:52 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:51 +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.8207.014; Fri, 29 Nov 2024 07:43:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866235; x=1764402235; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=n8O98KShNuvgHQbN+mh2dS/8MP0Nk7wBFRcwtlVqYDg=; b=OcD8DvMoiwsczfgJ4TtCeF8d0c30s2Fvw9A9RKoRbG2L4B4KMoMsFReW DfQDiqQho2YeLZCksqjkPjtE6li3IpqYKfhLeYVjsz04UHDWVbUPzFqwz tbXJUkRP2vgd5Qv4CxoR254WehImpb8P4EIo+hhya0Jk+mze0mzKJvrkt B3ofqy0+Hwxi8WTMOToYqYNEe8t1tLW7Vid6vi91QxGogqNYHbsdsJivV hEC+IfD+Wq2PtCg3dxKpSJ9t9h9AYrxpwgtTlTsfAQcNOkQCUSYKtLbMM 1WgxbNV2ArogcLul7aKyY5PXcLHLmFcMtzXReuOktUflLDZZ1rBnp5vjM Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="26377115" X-MGA-submission: =?us-ascii?q?MDHlI7iHgExURIGa95c/M8LuI2hgkaWQG7n5dN?= =?us-ascii?q?MPtOuMxpsNkxXTeTAgqdVP0v5cx9KnFkl/cwg4JXqQ+A1LqXV3xh2omy?= =?us-ascii?q?kEMAFLvPJ+OT+GBDrNYxn6GGJlXhgKoKadTHFZtqA2LrwKdD+wrYuN9i?= =?us-ascii?q?jsO/CGFcCyjkbYT79yLiEOKw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VGUeaSzPDZ1gWrLYtEsgYL9aBcgoBHyVKt+rLly6RCx/e+yS9fZt6pFy+fhOhRSJ9gBStTd3wSpfKQxnVdoOcOq6K+ZibJsBGMJ8CfLL59BIqTeA1fcteGkwlGU8aeJX2T90iLXZ+7BBwwa2JUqqbnS4bBp4cTeC3wBLn7cLQdVQDQ4oaIJ2ob/NNr2RoZOkozCWUBF9KlQX9BfI0SEiMpvcAlFIMjkdmhSMrdM6BKh1ODuJUxai7YSTzF3ugOX0hWopyAKsjx+cppYFcaqy8vmkVF8zDfGBQm2H1wbR1ZDvDA1gvVXuyO6mrGb1eG3E2sEaeOe2sJgLo+m9+vU45A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=n8O98KShNuvgHQbN+mh2dS/8MP0Nk7wBFRcwtlVqYDg=; b=RyniU3hIQo/FGQlJ+RCXdkikEJuheheB0PqhLK+n59YHlr2MM7J47Bl02MUlVcTzwFczEsFCcG5qWoLWRbtRaM3mr0vMssYEIrEtmkrpwMjHma/66h1RdsPOKTCjyCdm44WWiu0hcYg8nwGOoPDL9Pe2Wd1mibIuf3LOlHMr+P6f3jfhnaGX3JCIxjXDNsGq5BMcbzO35qI0/evdf1FYzA4RSesprL2Lr7hSgwR1YNq2PJ2ESYKMrpRnTnSYvmoISxvYQlsSQri7CtxF7BonE4AT953lMja7Yvpf99yfzcUDq/5zkx66CdB4+6R9mqoRSNGaX4qwr8ckkUXK9dDZqA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n8O98KShNuvgHQbN+mh2dS/8MP0Nk7wBFRcwtlVqYDg=; b=q+jBtZ/UqNNAAc2iJhlN+ot6Kb93bK7COt/vWIO8T7syz4+tdj+cymO5A/C4o7a2FvbOoVOuFOhuSTfVmBMCJAZ94i8ysbjixUiN54zytmHoMlhRLo6+uHNGE2SrFpXJElB0UmBTir1ZSAO2GF3Q46Ab0wXQP1WoAvtfeiTzEmO5Mb/2tgcV+1pTwyZYdLUOBRTnWLjOhv5JLnVU/D2V0znma0R2qVpnzJj+KaXYgtzFxgnrjYUNoqRdCF78GAlp6P0DIKElq/KyDYexsyLoRsACh50KmfcMvNPI3rPjLn9Fc7IjR6YwhROHM1y7yy9nVOiHX0wtzF8JRUVBENif8A== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 03/19] memory: Allow to store the PASID in IOMMUTLBEntry Thread-Topic: [PATCH v1 03/19] memory: Allow to store the PASID in IOMMUTLBEntry Thread-Index: AQHbQjJuVhzKX0BtCk+R1aLGA9xAJA== Date: Fri, 29 Nov 2024 07:43:51 +0000 Message-ID: <20241129074332.87535-4-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: ebf6b0d0-9d22-4d73-b24a-08dd10499151 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =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41cDkxRDF1VHM4R3FF?= =?utf-8?B?SVZKcjZNSzlnWFpCUHVuT3BJZHUzYUIrS2J6Z2VEV0M2dEhRZFdmRGtGajRk?= =?utf-8?B?OGNWM0RHU1pTL2J5YXhNTkNEK0tSWHlrS3ZjM0tnTFBRY1E9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?cEI0cW51OWxIRENGdU0wMUhPSFAyRm1wTHY5OEc5N25NbFd3N0xpNDVMOVdD?= =?utf-8?B?ckY3Z1UzMENxVmZiSWZjRXJqZ3J4alhhQndvejA3NER5dFBtaWo1OHRBd0pz?= =?utf-8?B?WWVOK2ZPNDFaWE5UK1NScEJNangzRTZpVUdjZzE4b3dybURJY0x6QlRVQ3Ni?= =?utf-8?B?UjlENGRiWVltb21MTm1ILzdtS3VZQUh5N1duU2lNS2VuWkpBK29JNGgxQnJv?= =?utf-8?B?MkVXSkhxT0pjUmZpR3RyZVgyd1UzZlZwYVRDbkJocDI0R2gyV0Z5dGFQSi9m?= =?utf-8?B?UTZzZ2phQjFGeGgwRHFTRlVuR0dlT3NHVUxscE9taFBCZGlVME9WaUFxbkl4?= =?utf-8?B?emM1OHVrMVZ0QWw1KzVlVzE4Qm9rSGN5ZlJRSlh0RU1ETlVpQTB2My9uWEkw?= =?utf-8?B?bi9CUCtHbURKTGVwWndGZlk5K1Zadkt6QnR3SVhyRFI0T0oyZzRwYVU3c245?= =?utf-8?B?UTVCQ2luYmpobGhzcmJHa0N0K0dDUnNzelZCTHVIN1pWcVRkaGF1eFRrRUl5?= =?utf-8?B?NmxuUFJadzE0RnFQN3pOdmZ4UElCMFBnVHBHTUlKS1g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Bnb1pnZjVqc21VdDRMZ21COVhQTnZM?= =?utf-8?B?aUxTU01JK2Y2YkE4TGFZRXBHUE9VQWN3bEsxWVA0VkdNWC9QdEhpamI4aUxs?= =?utf-8?B?Ykk0anZJa1BaNno3SWo4Y1A4R3Ixc3B2aytMSm1QU2dza0h4QzErRU1haUh6?= =?utf-8?B?cU82UVh1ZHVYcDZhRDdBUkh0RFNoMlFRWW1VVm9pMVRSUkV0Z2RadHRTSXFK?= =?utf-8?B?aDJ0bDdYb3pHN21oS055VGxIMXc3cFVoMldGRnA2bTJRblhFMXJnSVk1NVhq?= =?utf-8?B?OGptdVNHb2ZTN3ZoVHJyU0V6MEtaMHA5THdxR1hqYS9IdVJaL2pHMEh4NXI3?= =?utf-8?B?OG43V1pUbDRyUDVBdFluZkozNlh5T2NuQ2dqR0FlY1UvVGREMjduME5rM0lk?= =?utf-8?B?anpnQkxEQ05XaEtTREFsTUZnVlB5aWptbnpoQXRORDJmTkoxMVVXRzJvbVU3?= =?utf-8?B?VllHK0szaVFRY0ROVUJrWUUzcm1peFlKaFpORDh3aVFHOUdKVlR0cU9nUVJo?= =?utf-8?B?bkRrRmpQMjA2MGcrVUxYZ29za09HemFTR1MvUEovMTAyMHJxbHBMT21CUVhN?= =?utf-8?B?RVh1VlUwKzFtMmQ2dFNZOW9ETGJlbnZwUlU1VmM0MDF0ckVnSXJzTjIxNk5G?= =?utf-8?B?c1EzVW5Tb2p4OXlCSVZPUEdWMldZOS9POGkySy9qMFE4M1E0T1BIVHJ1QUE2?= =?utf-8?Q?RzsqucckQr1wzBuhtOu6mOw=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <70E67DE5C74D2747A5ACD2686E753665@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: ebf6b0d0-9d22-4d73-b24a-08dd10499151 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:51.2633 (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: UOleF5CtLnYf28y4ddTRoJ7uObK/d7t6d266DW5Mm446PdnvCb6GeyJy1TiAZpJYN92vz+S8Mp2HBexsRc4ThLs8cySuHKI4zpOm9gSJ/JdYHbVIKyCIR6TNVzLnQ8qY X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.85; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost4.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866380150019100 From: Cl=C3=A9ment Mathieu--Drif This will be useful for devices that support ATS and need to store entries in an ATC (device IOTLB). Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- include/exec/memory.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 15fff69432..756dd2ea7f 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -145,6 +145,7 @@ struct IOMMUTLBEntry { hwaddr translated_addr; hwaddr addr_mask; /* 0xfff =3D 4k translation */ IOMMUAccessFlags perm; + uint32_t pasid; }; =20 /* --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866507; cv=pass; d=zohomail.com; s=zohoarc; b=KRbyMzK1NMeMvUtIebV+bjV7BslUP5iYEs54qn/oXSIz14jaP/2sFhiLdhFxToSKsh669ucj5DXWogE13HV8eObrrgN+vQ2Ql9CxmyXV3cp6UoY+cvUpqthhxDNW3DbG/0BMOMh6zF3gRvpz4Ab4buRMqSc9Ww1aNwR+qpP1hRo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866507; h=Content-ID: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=rX+tJ+oComjbrky4DpyY1uHu/VCIFl2io6UCQg7jFHo=; b=V8VhhWbFH0zvWOY3wDL+bgMbzNajn5Su62G3FAjLLZ7W80m9Wr+gVciwWAvYz6zGKgzmouK73TA7uu5bhw9xuJ129rJYdI4SsNa5tar198JdzYcKZCCx/C5Q0CqUDnGyTU20EVf5Ruan38ddDxaP50C15bWPE507EQctAY7U2ks= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866507209880.3103436156612; Thu, 28 Nov 2024 23:48:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfi-00081I-EX; Fri, 29 Nov 2024 02:44:14 -0500 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 1tGvfU-0007yG-Fc for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from smarthost4.eviden.com ([80.78.11.85]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfS-0002fk-JB for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from mail-am6eur05lp2107.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.107]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:53 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:52 +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.8207.014; Fri, 29 Nov 2024 07:43:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866238; x=1764402238; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=rX+tJ+oComjbrky4DpyY1uHu/VCIFl2io6UCQg7jFHo=; b=O+vS8tGXThVPbi9+zg0thDpwzdF7jVZak0DYp3VbwsSk1oPW9AMnf3JS HZqyjb5x+s3fdjzgHPQXZ9F0OcXd6CT9GH9805vSwmUZ7dykbMrmA/gnB Bo+dfTfrBfX6mvEYwSzquC/gsuR4VseZ8kcDFmvKQ6Ib6s1Ql4IhetK12 LiGnF4i0OQnzR0YEmS11kGJ8Xfh168N7+uHFn5H+QfvgCivc49MZ0NPXf wvKk7JyCftnRV3mNsA3cfOOYHVJRGV8viyfZPqeKdWE8EGKGjrnAtX/2w g4sByiHdMVHWVJoJT8zvpZD7tKvHK5PQYWDkEmYHvFhNM7GBIOKF1nif6 w==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="26377116" X-MGA-submission: =?us-ascii?q?MDEdpAa2xxhhsoRkzAoa+W6H844oFiyu0JgeIu?= =?us-ascii?q?Umo161lkVPG8TP/DD82CariAphnXFokZhXMRaUgZoYtwH1IUREXbBi+S?= =?us-ascii?q?RXAlBepRSLaunSdlI8aoSalBaSO8DnV+CWnhHyqdqlhE63n467lOWjW9?= =?us-ascii?q?0Rn5X1KCZtSYOLMDup8FgChQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jelfD5q2cHxiM4rBs9BFbahB9LbMyoO43TBPtcvMKVxd930rzrdgel15M2+TCMeZVZk8FoRVu7mIN3XbVs80YTYhZPu2vdTCq4YCSCNp/+IclUSGbBPAay1cwq5pW97b7Y+BpeuS2LduqMtW3fXjeAUmx1ezHJJ8E8mleFCIt61AmO8zx+rLGtFh4ZJjl3Q/XJauIS/8DybKsLL6FavQ8BnKcY8zQ9vGBtt9WrzaCfktzomthckmU/AY4NQutspRFVYVQxE/c6727Wzb1CrL+M4mStzo6zJs2ySSqM4VmvTmksOteKqwHmIQHi3v/KvIqqiWQJluz4iQ4w627oLeNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=rX+tJ+oComjbrky4DpyY1uHu/VCIFl2io6UCQg7jFHo=; b=Go/sOazKfF10geAhdduZMuYChCPHj0NJPCgKJQBs/StEXiiKUNjddVA7ml5cirQTBihwv3HxS/lB3L9ipXCKkYKZHZ7cGgW9HCagC1yk5dHX2XEdpzT7oOaNjhTY+7QGK2/61ScK3m1aTzyWm3dtRbDN9OHWPah+SgVnDbcnWEWtk1JS5fJc3HmlFM0Cyi6OLsJVOO4ApNsLmjVZHnutsDGkVh21WIAxZYwxcSCflKGyHbXcDiQNUnSIAxofn/6xdCYhdRzHLkEXQNTr+qscwRJAiTGi/Oh5L9Cv6pnw4k+QlBHJ66Ws5wYG7cZ7DRzGBWFOLVPAtWuk2fMyxvOFNA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rX+tJ+oComjbrky4DpyY1uHu/VCIFl2io6UCQg7jFHo=; b=s0XLlyFo6Uw7DeVyRQZRSGgzC81Y7SE70MEXwE96cVgr6jCByvgO2JStKB5YuUyXTAN0mpCFz3MVCVB1ZsSSd5skDVLFI3UAObJTw1dzyaFnN7dqMY9OFY3ngSPUAljIOa4CM3bHcPV7wSzLe5/MIXNCy81ykOlS/EqJtIiiymiDOUjqRN0URuhaAE6e75cTvlfLx0qBC3OoKpe685b64POraozsfGIr6RAs+VGdq9DNJisp/44HVVsaZZqF4kJgG59pW5ipWhEy0/z3Gl3aPo1c6y+riFOB1z8yTx6wB/OcuITHrfQXzkbS4ED1laEd8O8LV1AdliyFV6Mr62rZ2w== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 04/19] intel_iommu: Fill the PASID field when creating an IOMMUTLBEntry Thread-Topic: [PATCH v1 04/19] intel_iommu: Fill the PASID field when creating an IOMMUTLBEntry Thread-Index: AQHbQjJvXDmiXC52f0OTAvckNfcVmQ== Date: Fri, 29 Nov 2024 07:43:51 +0000 Message-ID: <20241129074332.87535-5-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: 4d8e5bf3-ef73-4967-7369-08dd104991b3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?ZE9wT0F3MzRuMjZzeDlQZmdvU0hSWTdzZm0zYWFWSUNtZ0JoTWdiOVplNGt2?= =?utf-8?B?Nzc1ekx2dThOK2F5SEU3VlVNYU5raHVzb2VKMFZhYytzTVBLaEVlcWNHTjEy?= =?utf-8?B?TzM1bHlDWk5NczZkdHB0dkxtWFY1UnJIajRVeEVCcWhpVnpURzlSMGhOaDJi?= =?utf-8?B?THF0dXU0M2ZJK1dhUEhLNFhpNkhVOXBZUms2cndDKzNmajRmOXFqN1Bic0hi?= =?utf-8?B?K0dpbjY5M0pIL3AvUCtWelJpYk5PR0NDREl2RmxZaFRIZ3ZRQWwxRStKOVVQ?= =?utf-8?B?QWZ0b1RxUHQ5UzNtTzdhM2dLU2kxRHZJclNTRFptbkRHMmVOb0NrMjcvVzQv?= =?utf-8?B?RlF0ZVVGc25JNjk0NkZ3WGN1c3JhZFdPN2IxdUpNNGZ5TzBBM21Eb1lUelVu?= =?utf-8?B?VG5PTkFMRVpGY3RrakE1eTB0N21NTDRCaCtFQ1BmS3Fab1pNK3p0dWU4dXNs?= =?utf-8?B?TkJvbmpPcGsrajBTVmJacWxsRVhkdzlBcHdNOWhJdGRuS0pIWk9SUU5ZTWZm?= =?utf-8?B?aFREWDE0L2RibEY5OUIxckEwRTh4UElkWE5rS2d2bkVIZWZVRVREZ1BpZlhJ?= =?utf-8?B?Z2dJcFRrTDJsRnlpOXdsTEhYSG9KbmVHRGJvMC80bDQ4QWJCMFRXRXlSUUh6?= =?utf-8?B?SHQwYkxiMHJzNXpZRG1GM2FWSjNnSWNLeEhOc0pzRitYem8yZ1NlanNUV1FI?= =?utf-8?B?b3hXVzZQUU82ektQZ0RvMTR6Y0N4TmlwVGUrRkcraUFuZTZlaDc1SmxoZ0xG?= =?utf-8?B?OU90OGR2NG8yQWw1VjFpTUM3U1R2MkhHaEd2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VnbERGT3J0SVRWRzJlVDVGWlZPdllzZHVCTDQ3cEdiVXc1?= =?utf-8?B?UnVFOUZCS05sRjlxTVJtSGpyTWkxY3FpVzZnend0UTN0bWx5UUNUVU5kaXRp?= =?utf-8?B?RmxUelBVeUU4cHBBRUZVdXFLS0dMWWhGQTg1TFpFSHZYTGlmdmR2VzkwUGxF?= =?utf-8?B?cTlhRU9lSW42ellYTzFab1dMQmlQc1NtQUVZbW1udVN6cVE9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?dEVITzc3RlY3TEV0TDNIbEt4cnNIblpEV3g1YmcvYkZaQVFINEFKR3NldE1N?= =?utf-8?B?N1MxeUs1RTlBV01HM3djZ3lhYlg4ZGJIK2VqcnNuZTZZSTd4ckJjUytqSk1L?= =?utf-8?B?cHpjbVMyV1QremVMbzMvMXlQN2gyWVpmMVM1QXdxR3hFellqUjg3bXJDSlJs?= =?utf-8?B?QkJsTG9GOW5XOG9ITWZ5V1ltMkRQWVlFWkUreVlJZGpvL1VvU2NyanByVk5Z?= =?utf-8?B?VlZEakluQjE0RUVZZWI2VHV0VmNpTEJDM2RrYlE2R3ZmY09XbE9NTmE5SDdi?= =?utf-8?B?WlZRMVlhdkM5MXdERlB0OHpKbFpnUDd2d2JhWnQ2NHVPWTkwUGxNcStEaWdZ?= =?utf-8?B?ZFY5UVNmNHBOem43dXlsbm00ZGQycDFCeGhsTVNOdGFCZEpndUVZUXdSOXQy?= =?utf-8?B?dTR0Tk41Rnc2cUs1ZWE2Si80amd3Vm0vMkdKc0VFc1NGVnNnNWUyN0ZzeG9a?= =?utf-8?B?R3VYUkkzSXJVY0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mJW?= =?utf-8?B?YWppcEE3dXdlc2R0ZWdPM1ZxVm1zTFNDR1QzTG11ZzRRdXBUWHlTT1QwRGtl?= =?utf-8?B?bUYzZTdrNFNFbWtYdDJCRnBMRmloN3BNZWhpMXhvay9PWnFiOFRlN3VKQ0Za?= =?utf-8?B?WGQ3SlE3OUlsVDA3bFBsbGRmY3Q5dHREc2Z6OGJybm5PeFBhbWFQUkdLRktC?= =?utf-8?B?STlBbDd3eUxwL2h0RUNQN002VU85cENoRlpGRVhCdEoyVTArSDZhVGZSZ1ls?= =?utf-8?B?cEl0VG1NQjFUWGdpTjQ4MmR4c2M5RFVRNUhxSGJ1blNobjRmVG9tclN3Y2Vr?= =?utf-8?B?WjB6RzJDQkF0Y3BORHB1ZDNjNjVaTjd6TWtxdWFXSjQxakZmQ25HSm1KRFRN?= =?utf-8?B?UVBndmMvNkhYREdDUkw0cDdGYnlVR3Jqcm1jSG92NUdlaUszUjJpOG5oalh6?= =?utf-8?B?cmFJTnFBUm5qU0NXekxobEdtR1NaWWFaa1FUY2tpSkF3MVRlaWtjZkxVQVZx?= =?utf-8?B?UHF1bzczeS9PdUNXeTR6VDVNOE9NUHkyL1hLYzZMZ3ZOM1UrZ3F6a2s1NnQv?= =?utf-8?B?UHFrbzdMRUNMTjhNWVBqV1NRS3VCZFkwY09xaWlCbkYvL0FuMWhDcFMxUXdv?= =?utf-8?B?a0xVM0E1SURBTUNOb2pxdWY2NmhQajJHdlhGR2Y1L2tpOC9hQXB1Nmx6eUVC?= =?utf-8?B?N0oyQVRRc2l1N3lUa2s0SEs0dXQya29md08wVG0zaXEvTGJZMTRwZ21QVUtB?= =?utf-8?B?UmtadUlpU0cvUkxnL3hYeFU5OThQQXBwWlNvSWdnL2xLa0ZGVGFKV2xFYzBI?= =?utf-8?Q?2CpKYooS0ki8k1VcMxedXf8=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <34EB571D86DA77448E459DE72B3909D7@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 4d8e5bf3-ef73-4967-7369-08dd104991b3 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:51.9380 (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: KvR+mpm145Ws1xMdjazB/e0wEFtZxj9x070V/6jbP54T/3wASZ8hi/r8qkcpZ5MjMX6wZoxdNBQPW76I1F68YdOj0dMDWfOTjwyRitEOkSZYHFaBLKhFPfO9EoDQ4x1w X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.85; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost4.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866508705019100 From: Cl=C3=A9ment Mathieu--Drif PASID value must be used by devices as a key (or part of a key) when populating their ATC with the IOTLB entries returned by the IOMMU. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index aad132e367..a92ef9fe74 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2119,6 +2119,9 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *v= td_as, PCIBus *bus, =20 vtd_iommu_lock(s); =20 + /* fill the pasid before getting rid2pasid */ + entry->pasid =3D pasid; + cc_entry =3D &vtd_as->context_cache_entry; =20 /* Try to fetch pte from IOTLB, we don't need RID2PASID logic */ @@ -2260,6 +2263,7 @@ out: entry->translated_addr =3D vtd_get_pte_addr(pte, s->aw_bits) & page_ma= sk; entry->addr_mask =3D ~page_mask; entry->perm =3D access_flags; + /* pasid already set */ return true; =20 error: @@ -2268,6 +2272,7 @@ error: entry->translated_addr =3D 0; entry->addr_mask =3D 0; entry->perm =3D IOMMU_NONE; + entry->pasid =3D PCI_NO_PASID; return false; } =20 @@ -2511,6 +2516,7 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOM= MUState *s, .translated_addr =3D 0, .addr_mask =3D size - 1, .perm =3D IOMMU_NONE, + .pasid =3D pasid, }, }; memory_region_notify_iommu(&vtd_as->iommu, 0, event); @@ -3098,6 +3104,7 @@ static void do_invalidate_device_tlb(VTDAddressSpace = *vtd_dev_as, event.entry.iova =3D addr; event.entry.perm =3D IOMMU_NONE; event.entry.translated_addr =3D 0; + event.entry.pasid =3D vtd_dev_as->pasid; memory_region_notify_iommu(&vtd_dev_as->iommu, 0, event); } =20 @@ -3680,6 +3687,7 @@ static IOMMUTLBEntry vtd_iommu_translate(IOMMUMemoryR= egion *iommu, hwaddr addr, IOMMUTLBEntry iotlb =3D { /* We'll fill in the rest later. */ .target_as =3D &address_space_memory, + .pasid =3D vtd_as->pasid, }; bool success; =20 @@ -3692,6 +3700,7 @@ static IOMMUTLBEntry vtd_iommu_translate(IOMMUMemoryR= egion *iommu, hwaddr addr, iotlb.translated_addr =3D addr & VTD_PAGE_MASK_4K; iotlb.addr_mask =3D ~VTD_PAGE_MASK_4K; iotlb.perm =3D IOMMU_RW; + iotlb.pasid =3D PCI_NO_PASID; success =3D true; } =20 --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866274; cv=pass; d=zohomail.com; s=zohoarc; b=FULfk0/Rd9+VaWO9BzzGHiNtFnlbZrstGTs6Mrz6V9LtokfftzQ8pIXjaOE2jLzKxTev1GQuR+mG4oYhtNKK8xIX7icczn1sG/JvoS+1Lzzhu8fGUkgT6bD+Z0RV+kNgql6KkWtSzIHHDWzPXWxODUwIbW24AV/7uTDLXXU+6hY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866274; h=Content-ID: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=aM8mqPyN5ZNPJ+XgspxAHIbZoobBBfEugTRjl/ShzBE=; b=ha3SgHV9El/jzc+TdhH6txLOAfbmBqeL5XvXBiHZNy7BbLCuF6Fm8D8/ITdz3c1cpLgpW7H868V40nkHiy0YXXyk0PMEPoHs7L7S2DDE4SGLZnPv9Z7ktyfaY6bG0Qqk4vSufvhdl8h1C6aWQjmb/s+tbHU/VkBDLm2oE8eH18o= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866274094139.26172243349106; Thu, 28 Nov 2024 23:44:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfU-0007y5-5l; Fri, 29 Nov 2024 02:44:00 -0500 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 1tGvfT-0007xw-9G for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:59 -0500 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 1tGvfR-0002iu-Cy for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:59 -0500 Received: from mail-am6eur05lp2107.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.107]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:54 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:52 +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.8207.014; Fri, 29 Nov 2024 07:43:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866237; x=1764402237; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=aM8mqPyN5ZNPJ+XgspxAHIbZoobBBfEugTRjl/ShzBE=; b=xZ4eha9qgMrlwmEQaoHV7vuHtNBfN8zvAS1CA0NOfSRcG3yhJZRePU0d 7yGtOYIdGAAqpYwb8OcYMw/6/Q8ihHL1Wv9QojH6/LDbQmVWfZe4FuU5X HJMTLgjSDUImNAht6FMemABnQqKO0IWhnzrDAmYfsL/hwQUTCNSmeir6A uRvRQz7AAcGZMcRdVJ+1n+eo9+aTpEWJuWdF6KutPqJLL5WI14D5A9QlQ FMACAZAv+d3pRKb2wx9sXt6xoHj3kvca+3VzFQ8sFXEI5EG5vC1gkpRcT gnSJ/0+Ez2wuEC70Spb2sGop3yQU7z878XoRbPAwFeeK956J3MYG0ZLxX Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25663421" X-MGA-submission: =?us-ascii?q?MDGWdL3aigG+Z8ODGlCVozlFb9cZvifuLNw9if?= =?us-ascii?q?vzDvsDkaNXRt1qyHvJWr9CXsp+tlZoy7aJmSIFd4UiTveWA3drBxgZ3+?= =?us-ascii?q?XbsgEg60O9SL5CJUXYv7DpRx9EVZ+ujK3g43HOH6aVtNTU4AhcZrqgiq?= =?us-ascii?q?UXsIlfbjPz2DWC+IsCeReIJA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lxPxFmquwuGE1ExCGKJphSK0zu0oNz9MMeUKvch2psv6kYAzQQMsA3AUjnXiUnYCCvYTL0yI8I9wLzob0tGiZ6llFthr8dnMeumxm+fQUc1pWmP1MFoR6sonPrju4UbabRjALLl9PVqHyuWXsenDJ0EuulhNaclWpl38tP0PQCMH9z6NbLCrwkpAR2y0HupH44SzkawyzgKrdXELSjmy3/cNqdXTpGGTNV1oERq6u7vmGRmW3tWs0lhXXGtyxv//qXtTlpjn65tbxnbLjZEIzINhyo4sYzedkwbAbns2cmA9N6sJ1ffaVuCF7TzZzpKxUl7TYJ+9ih8tGQdSjm9enQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=aM8mqPyN5ZNPJ+XgspxAHIbZoobBBfEugTRjl/ShzBE=; b=fJ/vqOkCS9Uz2AOMGgl8dURzBEdIN95Hjjxuu9gNHdnXQZAsPDdrlUtsRQLe8D+Jo+hfiECZQfbURc1GqqTUkcL9O7s4e/cJ+ZOofjFh7CQDj+IljqsppsIcGrmaToQeKYTqFLJGdtdcfIo74diqDvXagzVBYDCccqNuP2b1hXEseBYsfgzapwRHRQCF5ywJEHRJs9PLQeue+3tSfBr0Gjd7za8W8n8vNItOSFwH+XSPbRLYocOwCp1vUc8jXQJ6nOhm0Zblw1Dc5hl7McYOpuMW/aX+xJPg81QCQ3BXtX0BkJR86BFVswwJeB5285RmTxR6Mg+HTuYuoqNmTfsYsg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aM8mqPyN5ZNPJ+XgspxAHIbZoobBBfEugTRjl/ShzBE=; b=MEMqfMEfqyLnfqg5Xasa4wTS/ssgcI3m/QZqX/pVoykM9DOj2mpp2hyQ7Jz0yLneJVY0pJscA6b7d6kfix0Dbr9uV9hqBl6qmWKxe5zp+sZggDSyPARrm2x6knuvXBEl+JWpFDo8Tj8pJ9tolFRHQymqxOLWp69kGqzaTUFXCaWe+R3H7/Mezt2Ftl5iH+rTgO/Fhhn5Najgv3Je2/rhIueT7hYYtCFttrOGqclcYS2y+h3wS0hLlL+4Zeknokmz3xOKZzI7PhgqMoNZ6FBTZUKew6yaWzqEdacQjOrXiUTG/Qt5pXTPSrE2nut7w/u2pdwkCVzJn0Cs/GolLvxDcQ== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 05/19] pcie: Add helper to declare PASID capability for a pcie device Thread-Topic: [PATCH v1 05/19] pcie: Add helper to declare PASID capability for a pcie device Thread-Index: AQHbQjJv/djmAPSDTkCKwQvJ1qVl7w== Date: Fri, 29 Nov 2024 07:43:52 +0000 Message-ID: <20241129074332.87535-6-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: afc98462-0cce-497a-d08a-08dd10499225 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?aENGclBkWUU2TUlyVUQ0T3FhQlpDUmxUaVVIYUVlbDZVYUtuWmNETmVxQ2hq?= =?utf-8?B?cDN6cks3M2M3OER0bS9XRU1sMXBSWFZpeWQxMnpwaGx6SCtmSlorcndpL2RP?= =?utf-8?B?clJtemlnQUdTdlZiOHFxeUxxTUN1eERhKzhBUGVGMGlXVndlMmlPMlVESVlK?= =?utf-8?B?MFJOVjkzeW9jRW9vdjJXZTdkZ1plK2o1alJhMzRyWW02aHJ1ZkVndzg4SS82?= =?utf-8?B?cDdEUUNWVEw1QnZkWGxncXVnN2d0MXNweHlMcTZ6SnRXOWNvRGpjWW5zTFo4?= =?utf-8?B?Zy9sNkFUUU03UVZ4ZzRXNDhXSVVvVnBqQTdJZzY2K202b0VPcTA0MnlraGF6?= =?utf-8?B?VVVpY1dqZUF3Q3NwVzBteDlBQUVmYk5QR3poWEEvcHVIOVRBRzR2SUJlOCsz?= =?utf-8?B?WkduNitoNUI2NWg0RnpTWXVSKytSYXRMbkhVYktTVTlEZWhoVlc0K3J1Vkli?= =?utf-8?B?Mk1QMHlJbXVadWNKMjB0WERGelVTaHNuZEVhSmQvM2JmYUF6MUd1THhtT1BD?= =?utf-8?B?WUEzeWYxVWpQNEpDOUFyR281ckRzc3lpTEEva01HUUVsVUwzOFhjNFBnRlRm?= =?utf-8?B?cDdwQVZ4enRXNmNzZS9XV01lOVdnREpTTUQ5cVd2SHVpVmtNQXpENU95YjJS?= =?utf-8?B?N1h0UExEYnBjVm1IODU2WEJBRWRZY1V5ZmhTMjJDektCdS8yMWQzZHBMZzdM?= =?utf-8?B?ZGpmWmlWc2lYdTFDVGRMdEM0YWszOXY4N0lXY2llZGlTM0xIaVVPTE9lY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YjMrMVE1bnd5eWlRWjBR?= =?utf-8?B?em1wUXNaTFBZQWR3dTNVSlFTVXlkSmJFREJHU0lsVG0zOW1WME1PUTVZdFha?= =?utf-8?B?M0FyYlJ4SDUrUjUrUlI2ZXdGRVVZaUszcThoa0V3dHl2L0RUYVR1TjZBdXU0?= =?utf-8?B?YWhjbnB0RnBybW4yZ0JjcjRrZzM0TnFBc3A5TDIxR05vekF3YjdGRlo0TG9z?= =?utf-8?B?cDNtdFV1MjA4SVR3NGRKSzJMbjIrNU9lR2poNWYxMGV1VXc9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?eDVVL2s5TUZ1SVRsOWhjVkF6Y01mUlAvRlhCclg1V0NPd29sdnhSZDZoWEpW?= =?utf-8?B?OCtVRDB4RmhiRUVQRjBZa3JiYjQrNGpEbGEzUG5ETHA2TVBiL0dHZzlOS3lP?= =?utf-8?B?dTdTQk01Q3drc29UcFZKcDkyUDlGaUNTRG1ocHY1RGhHMHBUaXoyaVhISW13?= =?utf-8?B?dlh4WVcvd2FBdnpwZ0xONEp0SzF0aG9RQmpmbVhrbVgrTGJoQmowVjNLVlVn?= =?utf-8?B?cmhuZlljUi9NTk9BWVRUQzJ0K3lSb2Q3c2VhTHRESXdyenlMOEgweEZuYnV3?= =?utf-8?B?d0hVUlNsdnMybktwK0tCMWVKcy9KS01TTFdWS0NOa1ZjQXlqc1h6Y2hiRWxK?= =?utf-8?B?SWtzWG90bkpURi9RYXN5NDVRUFNkVThQdnY0YzM4K1pzUjZvK2MweDlTQ1Bu?= =?utf-8?B?VkJoZVhGN05kZ0VDRGRsQmJubEk1U044UXFkWXFK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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: afc98462-0cce-497a-d08a-08dd10499225 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:52.6593 (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: rBWRT4Mwp6AXIYvOPrOoXoNYtvpVGyFFjNmM2kVK/urec8gQKwOEhnrK/urW2Xq3n+N7tzgDL+daHzThhSlTHAT7NSdw0rCMe4UeDX1GnsZ8MDKqSreH9n511g5HKCIL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866276343019100 From: Cl=C3=A9ment Mathieu--Drif Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pcie.c | 24 ++++++++++++++++++++++++ include/hw/pci/pcie.h | 6 +++++- include/hw/pci/pcie_regs.h | 5 +++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 0b455c8654..5b896496ae 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1210,3 +1210,27 @@ void pcie_acs_reset(PCIDevice *dev) pci_set_word(dev->config + dev->exp.acs_cap + PCI_ACS_CTRL, 0); } } + +/* PASID */ +void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width, + bool exec_perm, bool priv_mod) +{ + assert(pasid_width <=3D PCI_EXT_CAP_PASID_MAX_WIDTH); + static const uint16_t control_reg_rw_mask =3D 0x07; + uint16_t capability_reg =3D pasid_width; + + pcie_add_capability(dev, PCI_EXT_CAP_ID_PASID, PCI_PASID_VER, offset, + PCI_EXT_CAP_PASID_SIZEOF); + + capability_reg <<=3D PCI_PASID_CAP_WIDTH_SHIFT; + capability_reg |=3D exec_perm ? PCI_PASID_CAP_EXEC : 0; + capability_reg |=3D priv_mod ? PCI_PASID_CAP_PRIV : 0; + pci_set_word(dev->config + offset + PCI_PASID_CAP, capability_reg); + + /* Everything is disabled by default */ + pci_set_word(dev->config + offset + PCI_PASID_CTRL, 0); + + pci_set_word(dev->wmask + offset + PCI_PASID_CTRL, control_reg_rw_mask= ); + + dev->exp.pasid_cap =3D offset; +} diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index b8d59732bc..aa040c3e97 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -72,8 +72,9 @@ struct PCIExpressDevice { uint16_t aer_cap; PCIEAERLog aer_log; =20 - /* Offset of ATS capability in config space */ + /* Offset of ATS and PASID capabilities in config space */ uint16_t ats_cap; + uint16_t pasid_cap; =20 /* ACS */ uint16_t acs_cap; @@ -152,4 +153,7 @@ void pcie_cap_slot_unplug_cb(HotplugHandler *hotplug_de= v, DeviceState *dev, Error **errp); void pcie_cap_slot_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); + +void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width, + bool exec_perm, bool priv_mod); #endif /* QEMU_PCIE_H */ diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h index 9d3b6868dc..4d9cf4a29c 100644 --- a/include/hw/pci/pcie_regs.h +++ b/include/hw/pci/pcie_regs.h @@ -86,6 +86,11 @@ typedef enum PCIExpLinkWidth { #define PCI_ARI_VER 1 #define PCI_ARI_SIZEOF 8 =20 +/* PASID */ +#define PCI_PASID_VER 1 +#define PCI_EXT_CAP_PASID_MAX_WIDTH 20 +#define PCI_PASID_CAP_WIDTH_SHIFT 8 + /* AER */ #define PCI_ERR_VER 2 #define PCI_ERR_SIZEOF 0x48 --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866414; cv=pass; d=zohomail.com; s=zohoarc; b=aw5YscouNaysalo4w4IgAAT9jAla0Q67fcPB9xbcBBtXlFS7IRjbG3xNzzJIZ0BzTztnTm/W8pOS0Ay82oaGGo1U2CBD/He++A4imTRDQqyQ09YM4ferJ+EIDWz0tqPSc7JZYDi7KdcESWlLjwnGiq06iGs+oeD5qu+8fjtHdC8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866414; h=Content-ID: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=dSbec9u073dxNs0vgQ5NpjaCt5YwLh5q+Zos3VDB6P0=; b=kUc0v8S6EYu1+atu4K90UUo41Di4uY3CqlqdC3J55EzuMp5qV73al1wPz6sROGDVMkxNrHTz4Rzq1IzLGJqz96pcteJrCS9r3OcwR/6ttw7MC4yQ3cgO1rBBPzJUq+s0h78s7RSyVoYUr+0NmNY4VanIXsEVadmlcChXWOwsEjw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866414019848.4438699941688; Thu, 28 Nov 2024 23:46:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfk-000827-0K; Fri, 29 Nov 2024 02:44:16 -0500 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 1tGvfb-0007z9-FS for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 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 1tGvfT-0002iu-JD for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from mail-am6eur05lp2107.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.107]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:54 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:53 +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.8207.014; Fri, 29 Nov 2024 07:43:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866239; x=1764402239; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=dSbec9u073dxNs0vgQ5NpjaCt5YwLh5q+Zos3VDB6P0=; b=MqBf2sbe5a50fkmMwswahGEaO8nGKhYqnuEwGnESK2b9e008b8mLCXos PSuuPTlJ3hkJf4kOuR/+PVi+2OPhbOcRnBdjcW14fc9+a2D1RSXuG04Uv vSPThX2Til5Ppf3KzMJIRABkXP3vFc4FOuIVBNCSLKDVDSWPvUI7IXlpV k+BwXDqC4KG3F3scLMfnN/WnZiY94bAykXpHo23BgHWO70REKcTewVXCa NgvQGax7XfdfPUTLhRsqcasS5Wk+EkPCsYD5GVegsnyJhWBX5qxrcenRC nMNGKJrgZ/wuh1Vckv53HVcqad3fmN7P2oZocHJC2UTljSavQrBsiZVHG g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25663422" X-MGA-submission: =?us-ascii?q?MDHdK7Kwv4sPI/A4mSEm5AOL3xkbWZby6lGG21?= =?us-ascii?q?BA0zYRys2IS5w7jmaFe1UP8LzbhDdTHPTaBr/Jh4ErKOnnczdO3B0tnB?= =?us-ascii?q?nYbZJ0mAH8/91067LeCsLr+FnABOVzCqEoN4EvYnpo6ckp9wU18z4UyN?= =?us-ascii?q?uk5WskkHlfx7nYhqCDFlH8Xg=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wi/K6EKjfOPp+1LZwpKzLbo23IS74cb1Q3QYpjNsmrPMlJQU7HYp72TIMMYG87TmpKvOU16+sqEOUj5VnVe8DOyzoXLoPsCzmFGGwvAlc+nYtdflE/PpJAxj3OoQqwn+e1nPOXRgkHwcM0s4hXmfmk06VU1OheJmCW2gJeJBlWYJ30oSO4a03wXM4nbCgO6IezXzNvNeQQSLmG5Nwb2W3pFpOamtcfRKHXE82ZG+C6uKnnF3k9EmpAX7cJD+WU3NMhdiy0xcSrEXfgC3X5w+83VeWq7stn1bsNZ4YXRtcknecd/dmBWTUbXVpK+yMkR1XXJZUwyx7PAYtqCHCRqzCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=dSbec9u073dxNs0vgQ5NpjaCt5YwLh5q+Zos3VDB6P0=; b=y1o5PlrvByXi9PxtMGVGF9xfXkzIz7kzo1xmIl5cLbP1qo0yV9B1zw7KAxMGqGnpB0qc7A80zpghMcNSdXtar2Z3B4qzN2aeVyrrkMeBnlRns+mYkk6rj9rsN9LmF9tPC6j4ZPGK69IAtSSa9nt8dApjH5WuJiev6VaAHPbcFgasYv1B9YeWpHb1qvto2LD1JLBjmfyJAMpHEM6futpA0eaee6doyAwhWCStFApsAkCsuUXkbVgZf0vc+PBy58zPCH63GzQPcaelo6QlKXJVisd38wcaz5VNPRYr8qzfmGsC7sWQYLB+8+xnI8spGKkgdgfGvVQx/QAkoLxnl54kVg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dSbec9u073dxNs0vgQ5NpjaCt5YwLh5q+Zos3VDB6P0=; b=PDagTgmSS7us4b1h1/PBZ55h4i9/O+xNyCOs/Dk7fNSMaXRveXXdcmwsCiX+poE9uge+SHAVqdfPOSZxsk+GD9BOCjOg1SxWipiNnfVGQmlCrQ0z4jnCK5lGFU7q93C4Qtv2Bg1Z43mmTUZPuhQgVtWj3cbi52E5XR0UtZ/OWm/Ji7XHjZi8wVF7RpHVqKboz/V94YkSobchttpSPQGWHcEZ5349bdAeiEGosnQB+ow5Uu2PjvxVj8yR01PIIODkMHq23vVDLoW4LGBBgU4mW6jZbHRi6RL/yBSB7bcncWmmz09PadN4t9EEh0Fx9Vg15jDf1Wk4G6B88I5BUeUAUQ== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 06/19] pcie: Helper functions to check if PASID is enabled Thread-Topic: [PATCH v1 06/19] pcie: Helper functions to check if PASID is enabled Thread-Index: AQHbQjJwXoyduQYO3UOuG9p1h7xK9g== Date: Fri, 29 Nov 2024 07:43:53 +0000 Message-ID: <20241129074332.87535-7-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: 34b96ed7-9690-4bfc-84aa-08dd10499293 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?S3Q2TUkxQ292TUxVLy9GTzA3aHBSR3FKeXlZRFpxa0tjb3ErTldQYlJGKytR?= =?utf-8?B?OVk3TEtQdi9IS1ZDckhBYWx5VEdicnE3b1F2aXJkb0RxbTJTYU8zNkp5RW1R?= =?utf-8?B?RU5Sb2R4WjdKYyswc0hXNFluRVJiUEZUdTBUSlRUOU9zMlNqSDJZMHpmMTNQ?= =?utf-8?B?dmNkQTJkaGg5aTVjMFVmVXE1TDZmdFl3dnlPdnNNQ1o2VjNnaTVhYndsWEha?= =?utf-8?B?d1UzV1BKV3FSSDM0SHFSaTQyZXlWR1UxWVNuVVRNNDhpdzBwSDJsdE1oRU9O?= =?utf-8?B?K0ErbVQzUVVqaG9OL2dKYU1PNUMzR1c0cENHQThxbjNrYUhtbzdlS3N4aWRC?= =?utf-8?B?VllDblBiQjg2K2ZVeXllN2NoWmVlTkpFU3ltbUtvUkxFMmJucHVmUjBXa2h4?= =?utf-8?B?RDJ1YnBpanVJQmVxUVRJRHlxUnFqTWZSS05LSFdlT2Vud21qbnFNbHYvbzJY?= =?utf-8?B?ZWo5NGVYZVZGd2xjVDBuVWZZcytWbTdEMTV5WnM2QkhIQk1MYXdRalA4MjZz?= =?utf-8?B?WkswMVpQMm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f-8?B?T3ZYU2pVMHlscWZKaDZ2V0pBTmJyYzJ5MllsWFZjVSt3UjdVVEtqTzVmVHVV?= =?utf-8?B?TXhrbTkyalNUU0ZCRDF4ZVR6ZzhkVEE3cGppZFZHTWxLUk81TXZ0Z0NFZHVo?= =?utf-8?B?ZFNtSTAyMXhsaXZpWHFvWlB5MjFyVGlKc29xRzFTNVZGWW5CWEQ2Q244UWJU?= =?utf-8?B?OVFUT1hpRHgvTkZsNlZNaUxjaEpZZm5GNXkyaEZCZzV1dlU1M3REVnBZNVRR?= =?utf-8?B?MGY2dFVhR3dXcEF4Z05NT2c3cFVldFZMcGJ4bG5lRjJqZVBWVVhoTVRKNktD?= =?utf-8?B?TVJvbTNDNU16eDUwQ2RzMEFQRlJWSHpkWVBHajk4YzErMVh1STYxVzNmMmVY?= =?utf-8?B?emJobEJhT0I1MmtnWXZrQ0RSQ2JVeWx2ckpiR3FGTzFDdkJUWmhML0xBZWg4?= =?utf-8?B?bFdxK1ZTb2RNdU0vM01STGw4bEs4dVFuL09kS3dqVHNOd1E9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?ZlVRemQ2cWJSU3c1bCtxRGlRSDdKbnNsTmZ0WlFYZ29oNG9xTWRpSGZRN3oz?= =?utf-8?B?Nkh6WkFLUS9MVmZFSG42bG1mSDR2bWphY3JPUVFWK1BhQWtOL0RGckRCd0ND?= =?utf-8?B?SCtPNVlqV3JlbmFRMWFlVW4yTE54dHowdnBScWtTZUNHQ21EMzh5ZkZxTllT?= =?utf-8?B?L3N2K2txZEJpbTNHbUR6OHBIbTBuKzFGUSs1MUd4aURkREo0U21XaXpV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TNNQ2FTNmRPSnZLZmMrU0FjMjF0UHpiV1A4WW5v?= =?utf-8?B?cDd3aUJNTzJBcGNZRlRJTXZYZkxvcS9KRE5kazF0MXNFdXpCWWhWRnpiWkJk?= =?utf-8?B?Ykh1QzNPaUVWRnRmNndOeVBQR2F2bUhHcGk1dHBtQnk4TkgrYWtJTmJwSVFC?= =?utf-8?Q?8JQ8vit89tE9ZXG05i+ArAc=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: 34b96ed7-9690-4bfc-84aa-08dd10499293 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:53.3763 (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: 821KS86VsF6wrb+D+z6VIN79YkA33cBwZ9aDZnkD3ytqjiOq/G0sl4KQcJXMyV5h531n8JaodAxWqwsQUI6Pe6NeJtIAA6ZIgx8tMBPG3RBL9UEqV+1saYg2PeW5NWQ0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866416191019100 From: Cl=C3=A9ment Mathieu--Drif pasid_enabled checks whether the capability is present or not. If so, we read the configuration space to get the status of the feature (enabled or not). Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pcie.c | 9 +++++++++ include/hw/pci/pcie.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 5b896496ae..b6e84acc93 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1234,3 +1234,12 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset= , uint8_t pasid_width, =20 dev->exp.pasid_cap =3D offset; } + +bool pcie_pasid_enabled(const PCIDevice *dev) +{ + if (!pci_is_express(dev) || !dev->exp.pasid_cap) { + return false; + } + return (pci_get_word(dev->config + dev->exp.pasid_cap + PCI_PASID_CTRL= ) & + PCI_PASID_CTRL_ENABLE) !=3D 0; +} diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index aa040c3e97..63604ccc6e 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -156,4 +156,6 @@ void pcie_cap_slot_unplug_request_cb(HotplugHandler *ho= tplug_dev, =20 void pcie_pasid_init(PCIDevice *dev, uint16_t offset, uint8_t pasid_width, bool exec_perm, bool priv_mod); + +bool pcie_pasid_enabled(const PCIDevice *dev); #endif /* QEMU_PCIE_H */ --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866419; cv=pass; d=zohomail.com; s=zohoarc; b=X/2tdjJAdAULADsncvchybMoMiotDO2g0dV3T4TjWaN/aYa9A9jyi1ZV8/tRiKNfWVv/YiknU27+41qNxSr1k7GnU+8UwC8VKdEPBKBHeKnBdzHX9E806w6CzTYdkLUPR/cQ3uqrTqOC2xtMF7oukOenZH7lYUeZz42Gs6qvjDo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866419; h=Content-ID: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=ytktZtEYU0dSCIMqO67HHQkh/DLqPU7KZ/tIFWoIeww=; b=eOM5P4iDYjrAy21O3dglYswtiPF8Mkp4bIUL3TTaQWLvAFTKmag5nt4Vjbz5/zbWLM+U/a1/Q9S5QemTqKShXb4Qho7+Gsu0HxldZi8HaA8Pgmlemnqod9LLXp9kYNb8Xy6v+7ngQqDB5+TV3C0bcFdxayj7rYqde4TZPi6gHNc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866419012313.13347841940765; Thu, 28 Nov 2024 23:46:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfh-00080s-Me; Fri, 29 Nov 2024 02:44:13 -0500 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 1tGvfU-0007y8-6W for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfS-0002l6-FD for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:43:59 -0500 Received: from mail-am6eur05lp2109.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.109]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:57 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:54 +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.8207.014; Fri, 29 Nov 2024 07:43:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866239; x=1764402239; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=ytktZtEYU0dSCIMqO67HHQkh/DLqPU7KZ/tIFWoIeww=; b=nLO7oFl1vVw/df1gXC30zEz+WpNpsTM0Fxzn4pMLcgjUGbjUBVhcbCwY r7wfARh/vpQo105yjpKXgDuEg3vwFr/eKGgUA9A93EIbDYp8rxHGOT7/t 8LPTlHG+QaQCYarhi51vK4qB9P1OY5Y6fOmavvhiJdKMFGzgCj7R6qUV0 2BueMoIk13IdJRzMjtOr1AQIuGDlvwJY/rff4HqlcoHnjkDfwA7KOJb9B 88g1fmkPilv7Cv9afC9Uic5Kam/eDRg/G5nRgyWrp6BYvWdKxKj7+Dtl3 7ZAbTVHaO52FFBxBnv7CeTRF+W0r6dhHF5FT3lSrSjY/zj1dVPacbtVoQ Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664403" X-MGA-submission: =?us-ascii?q?MDEZNtdPT7zhjxTYdsJrzrE+B6bVspPyFTlwnX?= =?us-ascii?q?iC3c0sDTOXXYyoguh6IRmIQlbOY9N2ou1BBqPSfMgmMD8SJV7ecvGH11?= =?us-ascii?q?DB3plEM01gkIeaQD+ZKoKEFLl1X445PcoEdK9GhsPdMQCxe9X/CrBGQr?= =?us-ascii?q?E8BTRBY5y1A4qhVmg8023mOQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M9CEcEtqqX9zHpWO6AKvaEpGFpbnghc7YUuMt+sZOkBDyUlb3cf+YVqkvxY4+iRiU1HjW9AbvwBR+tuP8XXSmTQ5PvUgTNYjMKYBMs/6Ty9fDTEJlZpAYyblHRyeDLnMuV4KQ6gSK5sRsMQ0/SFgfX4lpYU5MpbY7TR8LeBrMWtEFQK4IEMYqHqrB7AmbrP8L4/WNuROteNK7SycLmRf69ZAPtJHl4RDWM5jLC/rwhqoqfYqyrDKjRZ6KiDXNZFXJ1lSEV4YDTR9zD3PtnCMrEtV1Y7KrpV6ujMXAmN9k3QlNgyxlQ1jZPPgfJOLKdc+bj7PQJeVlEcBvMW45GbUWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ytktZtEYU0dSCIMqO67HHQkh/DLqPU7KZ/tIFWoIeww=; b=dxyUqNORLKCKo2zLcesLl33bujECXchdUOryzmB4Zm1xhlK/KgKp727tfi3kHUM9AzAGoAK4Lajk3DLruS1ygLDujjGM1kSST7daVyMDCCLvGpOMwUjfq87XClEAuoFGIDy0uQcZUQSjvkyic3k0kpCb9BypnytrSgbvg2nHLGFP5gV9oyH5+eRjeQnMvqgkMr+3pYFaOOMvIHjhj1RMrkCIYT6ghOY7/amUz2PXt0L8psXXDsRLvsEzzVS2SFC71OZ3TnVXcGy497kRlpdpH9ayRaOeDOvlyOnfPCVMN5MsU2U1+h9SH0yI/nIVYpGp+DHTYsAR9df3VBSUR5pMKw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ytktZtEYU0dSCIMqO67HHQkh/DLqPU7KZ/tIFWoIeww=; b=iCo7xBMu0XGJ7O0uqilEkecBAg72+PyLYxFkQtxnCgYLckLaqTp361wDSYzH4fLvznT5x8UJFSEUTavmMQROoSNjQfgoJc2LmtE8tcRpYFjZ+d5iHURuV8m5BRXzmVw/fREhc/WzAIjYeKHbjs8AwYPPM1BDEOgc29VoBY5dbk2G1zKS8R4G9r0FpqrfmNm0tqS6DxF8hJkR5136auXSPDWHZkZ0+BKnmNqIwVO0Jl2B2JDoeiQDWsUOIqbjdn34GtArxByKQv2465g1HNkkUBXYvvr1Bv7AcUQn+DKQ1wei1T2HvFVONUWtAVaJoPYEqDAdrnNQEa5kk7vXNroohQ== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 07/19] pcie: Helper function to check if ATS is enabled Thread-Topic: [PATCH v1 07/19] pcie: Helper function to check if ATS is enabled Thread-Index: AQHbQjJw7Xoxk7N7VUCV2WyGQB2/QQ== Date: Fri, 29 Nov 2024 07:43:54 +0000 Message-ID: <20241129074332.87535-8-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: ea94c5a2-8bb6-4cb9-c5f9-08dd104992fe x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?cldoRG42SFR0R2lzVU96NVFTSmMyL1NaclpYSkVONXMyMGczWXVadkRVMGth?= =?utf-8?B?SU1uSU1Ed2RWdWxtTGhudzh1VXcyMDBPRlNIQTZJNnB2U1V1c1B6dXo1SEI4?= =?utf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1R3Q4Tmc9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?THpodnh0bVVwakZzU1RTcU1YR3YxSVVnNHJpS1MycDZkbktmTDZvUHBJMXJq?= =?utf-8?B?elFHcmhCcnplamJ3QjNLcFlxWjlZeGxqZnBoTzRqcVlKTCsxaWd5MTllMlZJ?= =?utf-8?B?QlZkTVVEcXBpcTVLYnc0ZGJ5VkdRV2Jza0pYVnlXOTlNY0lYcEZFRWJMTXpY?= =?utf-8?B?c2NHVGVSU3FXUWJiVVRjaU1zeUp5VFoxNmRhbXhVT2trRXJMM3NiWmdJbUJP?= =?utf-8?B?bFpzMjVJdnFmM0lCU21YeVlhUHpobTh5ckdRRURCQTF5U0ozemw3QWxIUmJD?= =?utf-8?B?M2E4RkpuOFlmay9teWdBcEJXNmNsOTVMRE9Ham1ONmJ3SDRGWWZmelFQQjV2?= =?utf-8?B?S01WSnVKcVJiWW55elRtZERnN2hoM3NpcFVtTytreUt0SmpCeEJNU0w4cHNx?= =?utf-8?B?T2lhclN4TVJ5Rmg2bkpLbnJJZFdENHNsUjRhVmlsNFo0Qktjenh3YmRlREVa?= =?utf-8?B?bzljNXROK2UxeTgvMDIrZEt3eEc1ZEtZd2hKTVVudDlwVy9WT2ZRM0ZyZkdV?= =?utf-8?B?V2xOakxtbXJyeU9Bei92UDlCb1ZmNE4ydUswUE8wUXY2SlZXWnNvM3NkZWJU?= =?utf-8?B?enBsYlAxZk43cVAwWlB6SjRKM2ZkUFYzVFdadEpNN0FEdStXUTRLSnBMWit1?= =?utf-8?B?SkdsbEhtNVBoRVVsbS8xbjJsblpweTlFRXUrMVkzdUc3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NUHlPVUNRdFY1Z2ZoNFB3dFZDdWFnV2VkeWJ3?= =?utf-8?B?cm1hYjc3UThjRkdLSVlycm1scC9yczUzeVNlN0ozVmxDNnNpd3pCa3ZxektW?= =?utf-8?B?bCs3aFRyWFU3dUVOSDROeDNyT2dYUU54dmtYS1JiRkxxNUZhVDFkOEFhYnNj?= =?utf-8?B?bHRJM1ROZGtPSmZ5VW13OGRuWkZCN3V1NkRzWnFURU44TGRCMm5pTXJhV3ZO?= =?utf-8?B?Z2VGaVMxT2RpMEE3TGtZWGJtYzV0Wm9zT3UzQmRVNGl1amd4Z0daT2hnL1Vi?= =?utf-8?B?bnFhTHBpWTViaXhsTk4vaDVEeE9GR1h0dVdhRzJJSFc3RTVOYlNING5FRHBC?= =?utf-8?B?d3JOd05kL2dYUStzRldYNWR3Unh6bU5vQXo4bmZSRmppU0ZrL3dXaE9tQUtP?= =?utf-8?B?eDBpUjVxaHZObjdNMDlOVlVFMnVtTklmTEJnR3VQb3hWdHBPVHFMWEFyRnNk?= =?utf-8?B?SFRzalBSYjNDbHdpWnpGd1hUbXFxc1ZRZTdFek13aU45akViVVJRRng0U3VD?= =?utf-8?B?NmprSFFTRU9BRE5NbHNWQ1RtME5icU5GZ2xKOGNlelJ1bW1xbkVmYVJpclBB?= =?utf-8?Q?wVE3RxZ/KmKYK1LWu+8Bdx0=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: ea94c5a2-8bb6-4cb9-c5f9-08dd104992fe X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:54.1081 (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: BXszZwXww1PrisbXNPACx0KC9qFL13JYzX3fDsgMb2sS7n9M5hMuZ3bNi7MJCLaMCJjBYI3lF/bsily79k8wx4+Af90LzyMx0NHgkXpqYto/DMu9j1nmWW1ZEF4EVLvl X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866420357019100 From: Cl=C3=A9ment Mathieu--Drif ats_enabled checks whether the capability is present or not. If so, we read the configuration space to get the status of the feature (enabled or not). Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pcie.c | 9 +++++++++ include/hw/pci/pcie.h | 1 + 2 files changed, 10 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index b6e84acc93..72bdf07834 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1243,3 +1243,12 @@ bool pcie_pasid_enabled(const PCIDevice *dev) return (pci_get_word(dev->config + dev->exp.pasid_cap + PCI_PASID_CTRL= ) & PCI_PASID_CTRL_ENABLE) !=3D 0; } + +bool pcie_ats_enabled(const PCIDevice *dev) +{ + if (!pci_is_express(dev) || !dev->exp.ats_cap) { + return false; + } + return (pci_get_word(dev->config + dev->exp.ats_cap + PCI_ATS_CTRL) & + PCI_ATS_CTRL_ENABLE) !=3D 0; +} diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index 63604ccc6e..7e7b8baa6e 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -158,4 +158,5 @@ void pcie_pasid_init(PCIDevice *dev, uint16_t offset, u= int8_t pasid_width, bool exec_perm, bool priv_mod); =20 bool pcie_pasid_enabled(const PCIDevice *dev); +bool pcie_ats_enabled(const PCIDevice *dev); #endif /* QEMU_PCIE_H */ --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866518; cv=pass; d=zohomail.com; s=zohoarc; b=I1TrL4irjL92L1CNRVTRlfgv3hzprDALDTrrdJ2pZ16uNuTVApy2j9WkDAKYI7WmHwIdbjWMXby3TAeTZpSrSo/YKeGI/nsj9jZe0ABV4mMH5zD3bjYb1ppPbxY4FCv2iU9tBiMZDwKDeA493XGdgQ8/yGEzcVLWX024t1D2axg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866518; h=Content-ID: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=SgZ/NdieoWyyUYJq31zTUmPy3l7qes7ujZUCB5UJYUw=; b=YQTaV1GLkig9EzMuTPGwYmwSBZm10B8AGgJR9Rzy+AZOaZRWvv1dDQG8N3Is2kWKhqqmc8Zxc21w4NYHjRo2pHoFEEwWwn5jGnG63p9/T/sqiFJD6Q8r/yh7/GrvTfs5sDZUARpeEmc2pqYe53a7VIDVeny1OIjtoNDJGnShJJM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866518595140.35083104926582; Thu, 28 Nov 2024 23:48:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfl-00083N-BO; Fri, 29 Nov 2024 02:44:17 -0500 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 1tGvfb-0007zA-G3 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfU-0002e4-9i for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:01 -0500 Received: from mail-am6eur05lp2109.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.109]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:57 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:56 +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.8207.014; Fri, 29 Nov 2024 07:43:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866240; x=1764402240; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=SgZ/NdieoWyyUYJq31zTUmPy3l7qes7ujZUCB5UJYUw=; b=GGCQRfYD0NQLrQYMv87e3lfAgJRiwCpipyOZa7XfpGoCfYgk37r6VMiS oB7fD0/OGPG9O7IibWXVpsWW+5rt5CGKnY8sEOSu0+fz98keZm36qyqIq 6aHCQkOHJ5VMnNqd6QcmQhYKWdvSn+qkBVd8+iDxkKYBJUIRPyWfEH7KS pvzzCZmf7EXqsovii/Hvu6BwSvyA5ylihh5mw3dV7o0mNLmJ3vhmw3Xh6 POCqI0TK5r7E9iKdjaXg+z1hOT1xUxd70YUEzItEIHfmc9DdVA6TnGcL8 GILShHxl3MEJa6esNr1ACe6o3TLAMztQwwyfrsnZYnywoDRwE+nSftzub g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664404" X-MGA-submission: =?us-ascii?q?MDFIMZM8J5+PI8S/UsUuFt+ekDXmTEttc6dhj1?= =?us-ascii?q?SNFbhvBlzVIMe27S9Nu4cvZbml3hSPCYsVx8xxk8AtMYHdj3zoVUeFNk?= =?us-ascii?q?iDH9t+ymmhxWIF/BhqdnXaOQPLwUwimfU3G5jYrBDaHT0smczfawrjJ2?= =?us-ascii?q?+4nborwyIHgetaQvmZBqRmtg=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=otDriJfUgLl+whCAijuGnbDawrrmQ18YKQA+L5fK2YVtWjqFNsaaKf/bYU6mZMR2mJG8uyI0+8UFyyp34FsGZdqOvOJ1eTp20Iyt96RUvLMl9RT0RKdtqxdfeJLx2giFOoNpqxqWgpDgvCDnhRbFmgdj/Q137YEK1+YIJaO5QqZkuNSdARWPIlfNjbIRMqTzaPXYTtohGqCkw9DsfCJgUejZEzTxml5qgOWNg3RIMz+vmEA1mDnQlDXHT6RWFVpOYUBs6Nvt7QrwbmfcuM8F1pjvQgWDygDINwx2p3NXQ2moq6XFHOAIGav8+Wnq6cEyIYfzqMmAvFX5BKb5E98T5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=SgZ/NdieoWyyUYJq31zTUmPy3l7qes7ujZUCB5UJYUw=; b=bYW4myQNDhHGjMG4nss1+P4mvlxxN31ys0riWilGtksER4Xii6gb9HHjUOnK/+ln7E3FHkAAoXgK5K/dnl49AkXS6crPimId7RPwDu7CJFhtOZT2OtauByg7g2tk2r5JyXc9LM3divMxIidLLW0hEzBCO2Ijr1J2XI++iJUDT6WHjwLYAOLdAi9vbXBK3NlcFnqhZLU7NfLoac2dPeldQU7kI7hsW1SrFfPzq8szbxwcwS4GYtGD9h6faC3tj4ZhC7zVHXPCcBnI5O6Q+GFnmXKwgxGBVSpbfODiq4SIzZT6XqWbAnAJRB7000so0WN1V80n1szO3Tetf1RoTP6Sdg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SgZ/NdieoWyyUYJq31zTUmPy3l7qes7ujZUCB5UJYUw=; b=WQlNKHgyxmIN6TxyYsCCr7dNIqHgylBrFGLdSebouAH7nQDlx2G+lYRkO4UtyHQV0T1KUklc+G9ZrzM5m2Ru+MiD4JYTPBTIB0U5ebSGrC04CluUSgSpa3qT2tONvm5GxaejCrhIpj20c+XXKS8ARQLvxwcyVYE1v0VNebgOzVdLCCVynKgdjZKiUeHNcwUQlIWPj9C60g7ceTi45EXFZizNLeltyUAYWNm9IRDBb1+wx91xvFaQWRbcFCx0T0SfBM4At99honZ0ZK55cQJhRVfGc4h54hZoONExCiLYsWJYYW6Wc6O2lN47jN3rV/9aWiaGEdlQVLm4E5p37ybZ4A== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 08/19] pci: Cache the bus mastering status in the device Thread-Topic: [PATCH v1 08/19] pci: Cache the bus mastering status in the device Thread-Index: AQHbQjJwwtKQ1xqBiESCRkJz4hVdrg== Date: Fri, 29 Nov 2024 07:43:54 +0000 Message-ID: <20241129074332.87535-9-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: cd734155-2d13-4014-8e76-08dd10499427 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?RmJDcGwxWDFQNmVFV1MvU2ZiamhuNlplVUZQZG1QeXBhY3RWaXA1bmw2c2JB?= =?utf-8?B?dzJJQUVzbkd6MS9WT2liWWt5azRvalVsdUtkTzBGTko0VTQ0eXI4YVREb05Y?= =?utf-8?B?NjU4ZGRjVE96T3I0czg4cEd2S0daU1dzMGppeVZzOTl5Nm9iNEROd002ME1J?= =?utf-8?B?SzN5bnBSOTFHdjFLek41b1QxbW1RdEtLZjVDQzVvSlBXUUd0bXRPT1pTd3Y3?= =?utf-8?B?SWEvR0MvU2hVb2ZydUlPdnljN3lmTHVLeE1jdjc3R3dXdDlmN1pvN1RpN1N3?= =?utf-8?B?OC9sd2Q1MUlKZmF5R0prdThJcFd5bTcvK2pNY01wQTF3eGtlRHB2RkhHU2wx?= =?utf-8?B?U1YzbXZ6d1A3K0xOVFZUWjdSY1JsN2pvQjMvNUFwMFVNSjJ5N1Z4L3ZSSnI1?= =?utf-8?B?K21GVG5IV2hZK1JDUjZPVlZ5WXFGdlNZd0JwTVRVWlVRTXByb0lvRElObnor?= =?utf-8?B?aG1LTXBvTWhxUmkrL3ZVSWFKcFVnWDZpRnBPeDRhVVR5T3dURzM5QXlPK2hn?= =?utf-8?B?Zk1XL1VjbVptcHBEQ21GLzM3WUxuTUx6Nlh1bkVVUXRwaktVSTdTQUNKTHFS?= =?utf-8?B?N20rejVM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3VJ?= =?utf-8?B?ODRTTlNYamljcHNsK0hxOWIzaGlrVEVseDZvcmx3R21DSzBHQUp0N204MHhz?= =?utf-8?B?UFBEUE94Z2dKZEI3cWJJNlBDUHdTbFhDMm1LV1hDc1RIUVI1eGd0THN5ak0x?= =?utf-8?B?YSt0MC9sRTYvdTh2cEJsV3JoZTE4bjh0dmpWdnBycXlnVnQ1ZkVKRy9rZmJv?= =?utf-8?B?ZVJKbUh1OWM3UFlMT2g0SFlQOWF1K0pkSlNEdDJMUlRkc2YvS05YOTFKNzNW?= =?utf-8?B?WXBjM2ZBTGtDUU5ibDl6SThEMWxVamlNNnpJMXovQWdMbXNVZ3RURVdSYW40?= =?utf-8?B?NWNEZHFKVklINWUwcWtPRFZBakZ5Mm82OEVwbWJjSVBFYVAvcmJHQXcxVzMx?= =?utf-8?B?YllhRlV3dWloMU1HQjg5VU9YdnF2Q1dDVHVJczdMOGwvc3c9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?MWhxRVc2eEQ3SkJYTFpJbHY0THNaSXY1K2JQVHdzUnVYMWdyWFkxelRtK2Mx?= =?utf-8?B?ZUNOZEU1dHI3ZEY0SFhTQ2NRWkJGclJxK0w3NnQ0T2t4c0N3YU5DSmI5UDhp?= =?utf-8?B?QkYwaDRsaXFkM2JZSVdVNWd0bU9LUXdpMFpGTWx6VGNHb2xVZHlXQjgwdXlH?= =?utf-8?B?eDRYQ291ZFl2ZzB6ZmtCaDc1OVpmNnB5YXRiQy9FaFdSOGNSR2JRdXlqSGwz?= =?utf-8?B?VGFncWJaYUpHSEtvL2Z4ZUh3UC9VdHFiVUppalB2RFRub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HJOV05OaE9zSTdYZ0lRc3NadTRNVC9q?= =?utf-8?B?NDJUK0piSGY5UW9zZlVlc3lwSWtTTWNuK2JLOFdMQllxL2dYOGgwWklUeVhW?= =?utf-8?Q?LaOgC/VQrcKCLPlg3wjwHhk=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: cd734155-2d13-4014-8e76-08dd10499427 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:54.8071 (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: Q+dUZ+XaSu9H2rCgHharpwAmSYdU+Mjr0dk/LzopfzfG8ebUaSbagrDe+5Phw1asvGowcgxgafLFzDivAmN7JqFmTDD3G268hXtQWdH+LpqfL8BgHgiHP6NmtpmsxEm2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866520590019100 From: Cl=C3=A9ment Mathieu--Drif The cached is_master value is necessary to know if a device is allowed to issue ATS requests or not. This behavior is implemented in an upcoming patch. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pci.c | 25 +++++++++++++++---------- include/hw/pci/pci_device.h | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 1416ae202c..bd36c5227b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -134,6 +134,12 @@ static GSequence *pci_acpi_index_list(void) return used_acpi_index_list; } =20 +static void pci_set_master(PCIDevice *d, bool enable) +{ + memory_region_set_enabled(&d->bus_master_enable_region, enable); + d->is_master =3D enable; /* cache the status */ +} + static void pci_init_bus_master(PCIDevice *pci_dev) { AddressSpace *dma_as =3D pci_device_iommu_address_space(pci_dev); @@ -141,7 +147,7 @@ static void pci_init_bus_master(PCIDevice *pci_dev) memory_region_init_alias(&pci_dev->bus_master_enable_region, OBJECT(pci_dev), "bus master", dma_as->root, 0, memory_region_size(dma_as->r= oot)); - memory_region_set_enabled(&pci_dev->bus_master_enable_region, false); + pci_set_master(pci_dev, false); memory_region_add_subregion(&pci_dev->bus_master_container_region, 0, &pci_dev->bus_master_enable_region); } @@ -675,9 +681,8 @@ static int get_pci_config_device(QEMUFile *f, void *pv,= size_t size, pci_bridge_update_mappings(PCI_BRIDGE(s)); } =20 - memory_region_set_enabled(&s->bus_master_enable_region, - pci_get_word(s->config + PCI_COMMAND) - & PCI_COMMAND_MASTER); + pci_set_master(s, pci_get_word(s->config + PCI_COMMAND) + & PCI_COMMAND_MASTER); =20 g_free(config); return 0; @@ -1632,9 +1637,10 @@ void pci_default_write_config(PCIDevice *d, uint32_t= addr, uint32_t val_in, int =20 if (ranges_overlap(addr, l, PCI_COMMAND, 2)) { pci_update_irq_disabled(d, was_irq_disabled); - memory_region_set_enabled(&d->bus_master_enable_region, - (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); + pci_set_master(d, + (pci_get_word(d->config + PCI_COMMAND) & + PCI_COMMAND_MASTER) && + d->has_power); } =20 msi_write_config(d, addr, val_in, l); @@ -2917,9 +2923,8 @@ void pci_set_power(PCIDevice *d, bool state) =20 d->has_power =3D state; pci_update_mappings(d); - memory_region_set_enabled(&d->bus_master_enable_region, - (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); + pci_set_master(d, (pci_get_word(d->config + PCI_COMMAND) + & PCI_COMMAND_MASTER) && d->has_power); if (!d->has_power) { pci_device_reset(d); } diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index 8eaf0d58bb..de53a44ae9 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -88,6 +88,7 @@ struct PCIDevice { char name[64]; PCIIORegion io_regions[PCI_NUM_REGIONS]; AddressSpace bus_master_as; + bool is_master; MemoryRegion bus_master_container_region; MemoryRegion bus_master_enable_region; =20 --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866434; cv=pass; d=zohomail.com; s=zohoarc; b=etMXPIdpazTLYoxUFRRZH68gYURPXYpx/TBNR9OkpVYi9y2hBjQ3ZXGfmbTX+czOGAigIuJRfLaxhfL+c9JukBEbQC1m2dWMgsKbWX/17DQR6K5Dx0psu4MAln38VpdHVLQrjL1DNDZo6DoEet/Eiwfv/5Db1W9QizDL8wU8O8U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866434; h=Content-ID: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=JYTIqof7QhuFRW4wADhZR8s7wPY2u4yiamG1OLfdCiQ=; b=ccxtYrjN8fWPMGHLVCmdAKadjTB/NFFvdeUHN3ZsSHa9ajPKidkhYzXbWlqR6FiLxdpDCBiKHkxS4HuCggG+rb55U1x/VhjdcMfBvkNaitzpK0iiJMhOwwYGr1iqMdaKENA6ShmCScwSDicvKGDFlYVJk70CHmuW+wViUtJ9fJ0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866434404345.89425180741375; Thu, 28 Nov 2024 23:47:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfj-00081i-Cc; Fri, 29 Nov 2024 02:44:15 -0500 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 1tGvfb-0007z7-F9 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfU-0002l6-C2 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:01 -0500 Received: from mail-am6eur05lp2109.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.109]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:58 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:56 +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.8207.014; Fri, 29 Nov 2024 07:43:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866240; x=1764402240; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=JYTIqof7QhuFRW4wADhZR8s7wPY2u4yiamG1OLfdCiQ=; b=IFrUYJx8YDNqFtGSAwbOr6c30DgVqJ4c1aqnIuFfxar7gFZSY/x7Q5sr /qOWOv0tNIxK30FpBAi2JcllUrz5ZsM+52w0nFwZTQ3FpYuWajV1rbVc6 np2XmQ/l1CMg6qZJfMExcLLphe65LqqSn1MRfI51bQmWWw8bP6HdBsV3r BAWtZFivQOiEh1uSPN4qjTIeQLlVVcPMhkGN//RB73wvxBaIuTw1sTGz0 W/Kfxm068U0Z1I+bJFKu23itRrKRx2eI8nGHnkt7DPYPB6MQ6pd4x+bn6 g1K7wSP83eo94r9TCY4WPpYHgr5NiI8fhWTlt+Gu81NSdpjhn6TWSlyIF A==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664405" X-MGA-submission: =?us-ascii?q?MDHYsGRhdcfUuLh3lc4jqcYd0pwONASn3+DS+Z?= =?us-ascii?q?JCBBXl5aUnpNfMcRnmMeXM5RBnrxo8t+rmXLWUQy2+em8CZ5ptQ7ya05?= =?us-ascii?q?2eFCQAxtGHpOx2dtmn0+GzZoJUnZXnWJlo2IEoVdc7cX0Ir2gor602fM?= =?us-ascii?q?MtKDtO7sf77hpVjOOEpfNv4Q=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xxBKPxVbuBgtbSRQTMiErk6c/NRJfG6qjR533Lc8eFKmE1dKpixWIgveQgsvDPar6hhvOxjl05aTUPinXoF90Zl1HoOH+F3LZhpptkdh+/0Wl47wESI+0pM2k5g69bJcn9XkXAqcqgh8Vuzfgm8Hxck+42FGLDVNILeh8YIAg/6v5+wMKqe0V6ANCn994XeRfSmYZVGjH731qpBA959r7BNdDVO/kLFA487yw+Od7mVJuA6fAMnqtbw5SWjSqGFzB9N8cL3YmrX9tMvjssWGxxLJ52+xgb6JL8Sx4tF48gPaVSrgngf0Hp7ttFIc58i60yLuuKkTD3P8s4AotFXScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JYTIqof7QhuFRW4wADhZR8s7wPY2u4yiamG1OLfdCiQ=; b=LxR/Ym1wRisIc17KZjjUlOh5nT2zwZq2DPlSSWFrBCFrtPAdvPBxuYVgU+qs6y9ZhI/ffUA8KrEn63dmcI4pcgYqlITBhjrAQeaNyszP5nxVLeacQ2ZKrw2qtRvAiIyEiNetFLXgx9uZHvf2/g1gtqtV9mbqFpZcUeOug42Zlml610emiPkkq6LKzCskoWZdWYxD7kOwOQr2iIU1oV424i8p7pNQIUuojn1StQ9v0YC4Sjts2LgJMkjPg8NmR7EgPtW7GTpCeO5J8pLD846QAluB0/QLAJtqlkX9zJB8YHCYcHQDMz6Ibx07Ud/tWqLa+L7uwyq+YxqA/QSxkqTfhQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JYTIqof7QhuFRW4wADhZR8s7wPY2u4yiamG1OLfdCiQ=; b=oc9C2uzQ8x9mD3UOcFC4sTIyPKKTbk77Q5UhnV5s64m3CFu+9ayT2mP/IAres54B5GcNvgP/Y/Mo7d0Qq8akB1r0hgx8pbtNOLfALD6vTI5dgn7NUFS0+w98VbYqYz7XTow1rKfLSyIIcVzvhXClwr0Hm1KBayRJIyfb3awpytipi3icpBXSTlSP/sUAkVrap1s3f+PxQckOZ0ux85lZ2HRKUm6kRWrGXf7ZUfV5avn+ltdSUvDDAdd5EydVDka+0F/Ioli4LyIClX8dDxevvoeIoJJStNIfciqchdeCxq0pa5i/eFGuRKdzHIsCoW9w+hFP6NZqIS2pQZOJsFA0Tw== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 09/19] pci: Add IOMMU operations to get memory regions with PASID Thread-Topic: [PATCH v1 09/19] pci: Add IOMMU operations to get memory regions with PASID Thread-Index: AQHbQjJxlly1mLkXtUGLosCh8+EKPA== Date: Fri, 29 Nov 2024 07:43:55 +0000 Message-ID: <20241129074332.87535-10-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: b506727f-506c-4449-0fb9-08dd10499445 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?R0xacnRmRElvZkwwNXNPaDlhRTkvRFFleTNGc3VmcVR4dG81RjNzT0dLeW5x?= =?utf-8?B?ZVZ6d0gwMVg3UC9oTmhJN09TWXppMVBIYzF3NVBRL1Z0bUowRFJwMWZVNW9a?= =?utf-8?B?UVcyOGhxMzZ0OG1obG1iZjlzVHM4ZlkvbThRazBnb1RNa3NEWVIvc0JzMmNR?= =?utf-8?B?TDVlVWJpb1ovUkkyZCthTGx4SXVGeE91SVpsNjRsMXAzdnh3TVhaMmRuN1FC?= =?utf-8?B?aE01VGVob3J1R2k2dVluSWhOUUdnNm8rZnhjaW9RU2hNZVB0cW9Nb282aTgv?= =?utf-8?B?Y2x2dDdrc2JPZW02OXV5R1pNdlJvRFl5Zi83NTg0MWNITC9ZNDVqblI2VkI3?= =?utf-8?B?eXRwY3lWdGg5dl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Rkc2Y25NVFpzaEdXY0FEVytuM29FR25OSEpZU1MyUGN3WVNrMFkwWGRDWFRR?= =?utf-8?B?dWZqUE5OREt1RDI4aHY2dmlaSEcwbWJ6dlkwdzEvQjhOVjE4L2xXcDI0eTFz?= =?utf-8?B?TTF1UXoyenRoKzFqRzZSODNSUHIydWpqZ2drdVhuQlJQbHFqZXVHUWphUHRo?= =?utf-8?B?aWprU003bGd4T0RPZnRKVCs3ZElGRmY4S0JoeVFmMEVFQytOK3JYSkZyMnEy?= =?utf-8?B?L1hQbW9DcFFMZ1VBOFJhUFp1djN0aG1lVk0yRnladEFaMjE0cW9oeTBHSFMz?= =?utf-8?B?NEJGQTJvanczdjJhMUU2d1VrN1cvNXhvMkhhY09leHNGeFRQSEJzdkpkYlpy?= =?utf-8?B?ZTkzN29wUUl5YSs2a0VxRVNMYmxpaEpQSXpNWUJDa1dOelc1SVRNVUdpMTdM?= =?utf-8?B?YVI0SkRURzNEY3IxKy9XUy9TdElNRnpXRWNoaGNzQ0o1YzUxNkc0ZWdsZTlX?= =?utf-8?B?a1RsM1l5eG82OEdNaXMvdFV2bVE0OXR1RTJZV1dabUtucndoeG1aN3R3UUh3?= =?utf-8?B?d0NCWTNrV0RJanhEN3huaWVXbHlXWkFOaCs3WDZseG8zdGpLbC9VaFZqODVM?= =?utf-8?B?enpib0NaZEJ6a0drRk4reC8vWXNDL01OL003aFFCVEtwd1E9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Z3M0WmIxQkpicU43OGhpcXRZSk4yZFdrUGt3dUNhQWJxdU1JMzEvWEpqQSt5?= =?utf-8?B?bldhd040Z2JTM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SVZPR1h0cXY5aXBZ?= =?utf-8?B?M2wxajJaeDF4NHZUbnBZMENqZlpFeVZ5endiV3d4ZDhNVXZJbkc2c0Uwdmpt?= =?utf-8?B?NGk1R1MySnBQNDl5QTYrZG1zQ3pGaU1tYUdYQi9hMllyaXZuZnpUMTVOWnVX?= =?utf-8?B?YnoydStQNFhvNnhZV3QrSTJBQzk4cnJRSWRycW8wQ3BRVWRibWFCR1dFdnMy?= =?utf-8?B?VDJXTnJCbjg1aWh5dE92Y3cyS0ZDR205aFlUM3dsRWFuOU9SSFF3TDdZOXlt?= =?utf-8?B?Qkw2R0Q2clQxMjR3QWszcTFvK0ZGMWNZTEtWYXF6R1NCWURaVERQekdhV0Ew?= =?utf-8?Q?raRBN292Nsk2fK7dD1voo7I=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <765DE4BFCF17E0459D9165253C140C9F@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: b506727f-506c-4449-0fb9-08dd10499445 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:55.6714 (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: Hu7EfzEH1Klw3ISuQZifV964yZ6q0p4H9KiqW4fyzaE+cApXtwI/NODeKQrUxkzdkiuo5zqbEH9N9CU99eXPZYWzlHooomi85tWbKkTT5SF1mjpfOeR3np/Yh814V++R X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866436273019100 From: Cl=C3=A9ment Mathieu--Drif The region returned by this operation will be used as the input region for ATS. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- include/hw/pci/pci.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 135695c551..c34ec5ea81 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -388,6 +388,22 @@ typedef struct PCIIOMMUOps { * @devfn: device and function number */ AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int dev= fn); + /** + * @get_memory_region_pasid: get the iommu memory region for a given + * device and pasid + * + * @bus: the #PCIBus being accessed. + * + * @opaque: the data passed to pci_setup_iommu(). + * + * @devfn: device and function number + * + * @pasid: the pasid associated with the requested memory region + */ + IOMMUMemoryRegion * (*get_memory_region_pasid)(PCIBus *bus, + void *opaque, + int devfn, + uint32_t pasid); /** * @set_iommu_device: attach a HostIOMMUDevice to a vIOMMU * --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866307; cv=pass; d=zohomail.com; s=zohoarc; b=cmsFNWHFoxBq9QKiG2Hx9VIISrkFzZHrnJ8+4j4c4Sm5JcBp8qDDvmiLHB22Ro6RWCEyPYqVD8MEnJAn+GiX0W+FRv0746uzDX9kiqM8+qFgtqhv7ZJPc5HuWbScc2MYoxzwiSj/r+e1g4h0036TFCl6Mf6ixf1FhBxbJo03KAc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866307; h=Content-ID: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=YBhE5BBedzp0ZGBHlCFslUbzcaTj+tWkn8qeTXWletU=; b=mzoROjqEEfB7m8biWsso2ON2kzJX0Qj2whH8rNiy9vmkgi8BNcHupRacQ7COwFzlPlTFppeqw4VczGfD6y0iLX+xf3OCjFP0pUQuVZ6XpxRBESUXkAS9cXhm4/9x66xSjnzGa7xUiGPBFz73fqEpbLGmVdt0Wm5U5g29RfFBmzg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866307330431.5696470490849; Thu, 28 Nov 2024 23:45:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfo-00085M-QK; Fri, 29 Nov 2024 02:44:20 -0500 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 1tGvfc-0007zE-9t for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost1.eviden.com ([80.78.11.82]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfX-0002mK-Hn for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:08 -0500 Received: from mail-am6eur05lp2109.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.109]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:58 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:56 +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.8207.014; Fri, 29 Nov 2024 07:43:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866244; x=1764402244; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=YBhE5BBedzp0ZGBHlCFslUbzcaTj+tWkn8qeTXWletU=; b=UI+wnTHf95zBFzL9yNBfBDGCIwnOJDA/ZvcEIJiXTnNGvjKGR1t9MHNL EAuvbaI0h/MnCXbLzAsgUuy5MDSOFd+EqFG2rAechfMqSiT1r6Z3UdPKF iGtWkYgnQCCe801SR3K0PP9kL2bJpTPsqisTwTeh+5idRV4fODMBAyvLK jLOZ4nxM1i5Vdjy6rPgYhV8Y9XfTSFFlLHygw8jLrMsQKv7mhVcsXy+ON JE/V7I0MFdlQyUNOLR4qvJDYTdSzGsHIbLsNhvBtC8p6/IxMlZPWKGe8v sbmNJ1iYA8P5rR1ZcH1cLoEaqI+1l7a+AlOTR49pv3dAK072a1NhX0QAk w==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25664406" X-MGA-submission: =?us-ascii?q?MDGtBwjA5Nw44xfKT5Lzr3q5Gjp0txOBOCy2Vw?= =?us-ascii?q?JVfBu0PmHA51M3AhPwk6TLf1pXG3OaQen/fdTz+h2GKc+BEJO+rivQ9q?= =?us-ascii?q?ldY8ic6i2xq7wMvWGf8dp1McLg/AqJf3prsSzVv78F3vmuYvjuTwx43y?= =?us-ascii?q?gdvoCgwx2rQOBViEBABw/kIA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Dp8wDQWjJWNVAjcF2hxnVf5aU0EVNpJ24xhZdLM44b9sc23zeoU+ElWIxauo5GmBt+dJU8fmMtLLSeAE3BEmwI5YOka0ZFueJXr4akmMzi2AWYPN3C8v4AyeozHYQOEx4iq247aaV8QSmSM+a+Y+1SMRgNHH5TzFkjGSH4SH1pAU40IhTfkXYEgJRO2rkdO0cnvV3p/AuJt7PS0nAdX9ylww+daN06Ofdfe3DE/z7GGA1MyACKCaPuA9OPQ9kEgBRbnGuvmkR2dVkU4OgSxWnzuUyLfpKPABmGPFIQKHfzML+f0i9PJP5j5lvZvvcprN2p3anzMATOfcebjeEI2DjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=YBhE5BBedzp0ZGBHlCFslUbzcaTj+tWkn8qeTXWletU=; b=st+zP0ger25GRaE2ie2CtQIjQffkAZoo9zQTdIuJtuE6qT4urcMwETa/oANnGccJB0YyBi4W5cUNsbJodxYdD5pfe3L6TW/uhlfP+DldVw4QWbiwmn9gQdQyqlVhZEX9JuYIG24KCCD+jKtaZ+DD/Si6NO6hUbTokVzqiAG0Lm0fclNb+bAxHzzH+qqpGZ6f8805arVXRHG/2GZlg+p2eHKZHv49bEzM89wAo2BFpbJC5PxUFSc2FKFbC/nDefcPqI2GKOWcZ0hvRq8LnDwtQHXoMP7QqaIEMGVHFtIQaTBF1LWNm8I67Hz3pCO4/qinsM5GevpHwLQHvJ7OxkgapQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YBhE5BBedzp0ZGBHlCFslUbzcaTj+tWkn8qeTXWletU=; b=MGIF/FuoKTf/BR11JXoQ7gNkqaActgrp2+nuAQ5Un1ZcgYbVgfxdF7wCALfBNv0yo//bQAQtCtbxeYWQS8/oOi0YZezODUwNDRhi1NpfYgAGE800Tga513ATYq1wRw6UPUsRE7Rdu8R2Xth76u9fircGr1SKywDzTe1P8kKjOzeIGDdVF4zzHkBSPXMH5tgdXWU4HIPwQrWCgCt9vulwhE4H+HIOvxCaGzgdam37GKoT8tTuoaSJE43QmBTdZ6PLSN6t2HBiPamHyYHFvaqlSJBw5OD8br1Uzp1z2VFBa8wWEtwWQTnLcT3H2j46s17jNgFTov64hvv/cFfcUWwuXg== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 10/19] intel_iommu: Implement the get_memory_region_pasid iommu operation Thread-Topic: [PATCH v1 10/19] intel_iommu: Implement the get_memory_region_pasid iommu operation Thread-Index: AQHbQjJx30tXT3ATwUiFDB81CRnjhg== Date: Fri, 29 Nov 2024 07:43:56 +0000 Message-ID: <20241129074332.87535-11-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: 37c0f1c5-f8d3-4a30-8e3a-08dd1049946b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?cWd5eVZjWXZTaFNmck85VEg4akJuVll3WWloQy9QMkZ5RVN2b3gybEhXdnhN?= =?utf-8?B?YVhqOHNzMjQyYVFXVHY0bTlUY3crYS9mb1pobWJETE50emxLcHV5V05XYTZH?= =?ut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ZWticUx3RG44eDVFUmZKWEE9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?bkxjOTV0SjYvQW5pVGI1S3pLR2FrZHdWSURUbVVMUWk3OU43NTYxQk9FWXVU?= =?utf-8?B?WkhBTUpuR0pYK3dnT3lZU2RsYkZKSkNnVkthQnllc1hGbC8wWUJJM3kxak5o?= =?utf-8?B?UmtTRzRNaVk3MWF2RFlnRTZRME5oVXlCcnBHTk5pajNiZmdIeUVUYlduS01Z?= =?utf-8?B?S1d3RHI5NnA0YlhjVzhFSVJZY1dmQWJIbDZzelBiaWZyQisxMXVydHpYZDQ3?= =?utf-8?B?YzZmYTVHdFRmRXpXTDJwa0tOWWhCZTROaWt1c1BvSjV5WkJGYXVrWldVcG1D?= =?utf-8?B?Ump5TzVqSDRwOGVKZnZSUkJoZ2lJcVZ6UHF4UmZ0M3ZsZk9OanRacitxWUd3?= =?utf-8?B?b05HL0dzRWFweXpDRUpDYnpRUGhCbUxxNzFLYTA5RVA0R3dheFByd0hLUFdx?= =?utf-8?B?QUMzQ3lFS3I2Z3YvS0RvbDdYNHRqT1RPVHZqTmVUZlYwRERuN09LQzFGdTRw?= =?utf-8?B?WEdodlliZFJNSzZFdFpzUUFMUDB5VTNwU0V6Qm11My9ZaTd0K3ZBUDNQcjVD?= =?utf-8?B?YWtXb2NHUVJNM3crdldwZEtnaEdzdWJPMXpFZEZrWHJWem1wcXlaRTdsZnd0?= =?utf-8?B?aTF1bmU2L0tiVFIxbkVZREtZaVlQTjZnekVsdW53dWJ6Z3BDampiRmluUkZF?= =?utf-8?B?NGpML04rUHN1WmJTd3A1SFducXFISVc0Q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lGZ3JHNWM1T3hzb2J3bUs4Wk1heXo3MzNJakUvZzJLVE5mcFhYM3hS?= =?utf-8?B?UFJtRWR3alZTeUdtQWRlOHhjYjhza0t2YkJXVm82MzFUc0FnTU52NVZud1I0?= =?utf-8?B?aVYraEg0TXN1cVA2ZTdGaElIRExEUldEL014ck1Ja3ZuVHJEak51eTg5TFVn?= =?utf-8?B?Ry9kYk81c3IxQXhEUURXSXFSRzlPMDA2a1MxaitxVnZKVjdCOHQzSnl5UThm?= =?utf-8?B?Uit6NFEzV0ZEYUVrYWFrK0NwRHNuV3ZIK05zWnk1eUtCUHA1R0xJNlJqeVBn?= =?utf-8?B?NDAxclYvSTU3T2pqUmcvWkJ2eDlJeldqQ3pRSk8wYkVyMXZHaW5uZVl6dVRt?= =?utf-8?B?czRzRlNyUFZSMWRkZ1R0SVduR21vdzByTTR3VTdEWU9qMk5PNGYyV1d2MXdG?= =?utf-8?B?b25uOUNkTUVFY3ZydGRYdHhyMHFaYjlHVmJFMHA0b2NZYW9LNnNnRkduOFdh?= =?utf-8?B?ZUhIRzZobmZLUnNDeUJHdUtaK3RSanYxOTFyOXlNQzdNRyt5ZSs0aFdpcW1a?= =?utf-8?B?TExoMmZmeGFSYk9hWDdBT3BZV2UxaEtIR0d5MkU0eW5hNFdRZlNZZ1BNRTVI?= =?utf-8?Q?AqDvzLyXrGZ9Udm226dlbyQ=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <66038F5E1B650D4D8F6EEFAFC7DDBCC0@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 37c0f1c5-f8d3-4a30-8e3a-08dd1049946b X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:56.5081 (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: U73fHSWNQyej6D9CPYyZoKVeMHJLk15JJIVvpNttsHYo7VKVVJ9+72mu+KErnozkbRi3l5Jt6rnr1xtXQI3sfpJKcIB2cN2KPKYejpoPHqMGCw3otE1epbE7Yx+VGe6p X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.82; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost1.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866309706019100 From: Cl=C3=A9ment Mathieu--Drif Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 17 ++++++++++++++++- include/hw/i386/intel_iommu.h | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index a92ef9fe74..7e8676efb0 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4209,7 +4209,7 @@ static const MemoryRegionOps vtd_mem_ir_fault_ops =3D= { }; =20 VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, - int devfn, unsigned int pasid) + int devfn, uint32_t pasid) { /* * We can't simply use sid here since the bus number might not be @@ -4726,8 +4726,23 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus,= void *opaque, int devfn) return &vtd_as->as; } =20 +static IOMMUMemoryRegion *vtd_get_memory_region_pasid(PCIBus *bus, + void *opaque, + int devfn, + uint32_t pasid) +{ + IntelIOMMUState *s =3D opaque; + VTDAddressSpace *vtd_as; + + assert(0 <=3D devfn && devfn < PCI_DEVFN_MAX); + + vtd_as =3D vtd_find_add_as(s, bus, devfn, pasid); + return &vtd_as->iommu; +} + static PCIIOMMUOps vtd_iommu_ops =3D { .get_address_space =3D vtd_host_dma_iommu, + .get_memory_region_pasid =3D vtd_get_memory_region_pasid, .set_iommu_device =3D vtd_dev_set_iommu_device, .unset_iommu_device =3D vtd_dev_unset_iommu_device, }; diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 1a4a53053f..21f7f8a07b 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -324,6 +324,6 @@ struct IntelIOMMUState { * create a new one if none exists */ VTDAddressSpace *vtd_find_add_as(IntelIOMMUState *s, PCIBus *bus, - int devfn, unsigned int pasid); + int devfn, uint32_t pasid); =20 #endif --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866450; cv=pass; d=zohomail.com; s=zohoarc; b=cRA/UWUpWOeju/MzSEcsPjDO8VJiSpPCZ/566U1hVlVlI41M9dxH3RnWSubWIc2xhS5R+36AmIuQdBt7uWnfSAgYmb63vA9rmfN1RKKh1vuSl7liLLh2tTeDjdqMyVthi/UY5wDSXEaOj/OtBaLLbt45n/DfRDPmqohinphhsr8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866450; h=Content-ID: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=m6yDis67dF1alZmmiGn0X8kfeXfpoNZ8C44721iYd5Y=; b=SyNLX5j/TneXg4BfPjyh9/QQdUVSYUBuCYKTac6GLph/eUUFnfMjt6uFXFIkYBY+dTaAzkWJW4aGSPCULP7FE3fXYiMQ8bxccMOGfWZVjRHChNs4hfpVgUY4svqoo31oVHEl4AKmWj97VG9/XQGacpYz3KPiWmJhnKDQLNgsXbI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866450979315.02125484972896; Thu, 28 Nov 2024 23:47:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfi-00081T-Ro; Fri, 29 Nov 2024 02:44:14 -0500 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 1tGvfb-0007z6-F3 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfT-0002eL-7w for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:00 -0500 Received: from mail-am6eur05lp2104.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.104]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:43:58 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AS8PR07MB7847.eurprd07.prod.outlook.com (2603:10a6:20b:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:57 +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.8207.014; Fri, 29 Nov 2024 07:43:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866239; x=1764402239; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=m6yDis67dF1alZmmiGn0X8kfeXfpoNZ8C44721iYd5Y=; b=OhI/vO86mw1MfJnjsbCWXmc2C+GnhPxXNDfWZ8Jo03/0bnvq/dZPJz4+ TJSd4kHQ0s9R1+CQLLECU5bOJ2VL3jvGukVka8hGsW0XOcvWTrg9+GXoy nutQIdRX3fqlQXymCuCSQDA5q1wnftO3Msmb9NnUCN1TULYUZVRkdaGEK O99r7TSoTbS7JNioMpZJuYKEXBXbliza/Q6ZvSLLoofQyanztW0cT1sNS 9SfmWLfidEQv9hbHcD9A3YGwpwewdE5pirxDufT0VzOAK75iIJJxTFV5M WsQawUf7diKj3JgnbLsaLjrjiNrKnSCRe2Kvh503aAhLLkuu/WcNK+y+H g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670801" X-MGA-submission: =?us-ascii?q?MDGd+gu3E8dwwfAWmaJ4UUlpW8tOeM0lwfXLuX?= =?us-ascii?q?2SmGIK/IkiY+UceDBeBF/G9ZBCG+DUTcJxppFSkov3Uxtvw0N2oVCJkt?= =?us-ascii?q?Ny91fErWmi3kk00cTaUe7hp3gKZtwXz1T3eBHBR9Oeps/CF9u6sQj0CE?= =?us-ascii?q?8TEoYswuP/43hh/ejSuSxWng=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XCVf87RXf2d1j8fo0xUvnn3+LzesxLGDnOth0RQ54ciQwEEFGUUZJfUmK8vXRoycOWBh1C7sA2v9DyK2v2ptlm647ox9tpA/9zpsqIlFYrBAG75IZtd8vqZJ+rs+pv+knMQe/WHQ3jdsS7RN62h1iCCyV4GrdT0KWN1lZ0xMFeWM8g5U2GNFfo7decl5pZDhu5FJj8rmJlRJZEOIPG/m/tSHnZCTiyVe7x3KZWXFXAVfbQTCuIlk3IdzrzST8DQTECcOGcaKpMR/LquhTr0/Zxaa1J02Bv5lIrIvpPrs53VAZ0H3dcLWC0WWSWv/XMIi7XEyE9jXCZVqtzEiAU7qxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=m6yDis67dF1alZmmiGn0X8kfeXfpoNZ8C44721iYd5Y=; b=TWkzbS9CQbArM+8huw4ARd8k08f1LxmrQ6k6rTrQ4tOw3qycMfBt9OpneL/lllNa6HJGrePZ+jhbzMtYfo/l4zLp3oC9UH+N4yeZbWKbFkdLMUtib5NokFIXIeL6lK4KXiYxVxp47DVMaWkGH70fD3YILQ8ZTFw5bDTKx9NnHehga7+kDYDYMf6OdDvsD7B4AGBATFxFZD1bf5HLXJ40V09qPSiPGLSQTCaIrCw+j7FnE39PPba/J26C2hqPr47kCF/xIEUepdL2VSblz26s8y+NWGnNxSZSEpMnpIEJ+tAyB/hpeLks4T1ccrsZKwIw6lKUWy3hdvnDkC6KhGNM5g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m6yDis67dF1alZmmiGn0X8kfeXfpoNZ8C44721iYd5Y=; b=bcpU7CCnPl1La1UkErRlyuqbRV5TnUzt62eGJb+ekEePWqUYs0uLFC20vDH92W44nQQILz72Zd198VMuQuIWdHcZvpvBaT8cH3nxpvG9lnL8rkovsSWjgwr2Xkrbzyh3SVTU7KopBfjNCL3z6wA87HZBYE/EC1bvOeS/Lryj9Dvyt+FDDhEhoRmxEYZ+G3+9I9jcjiinpbqLekrGuESHjZvLGZIIhAme/3Z3sHDjLYztQ3knPArN2CJQ6L7cC5pjO6xQg9Y0OkFMcehKe/dP2NjJMaVPPcH9CXUWhTAoIOGpHeBh5hcRUSXOWtwhAiC6hAbTUAcWOMmzGE4Dgz92iw== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 11/19] memory: Store user data pointer in the IOMMU notifiers Thread-Topic: [PATCH v1 11/19] memory: Store user data pointer in the IOMMU notifiers Thread-Index: AQHbQjJyHnrIgNnsXECB7r/kjdHmtg== Date: Fri, 29 Nov 2024 07:43:57 +0000 Message-ID: <20241129074332.87535-12-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|AS8PR07MB7847:EE_ x-ms-office365-filtering-correlation-id: 803f1af2-d758-4f6b-5c63-08dd104994e0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|7416014|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?MDZZbVpCcE5Ia29HdHdXR3oxb3dESGcraEFUOFhYRTBtNENEaTA1Z1hiZzRv?= =?utf-8?B?SWROdDZGQUxDRzQ1UEpiV3FxWVBBaTZkZXo5WEV5aFlycUZENnhKQ0VNcTli?= =?utf-8?B?Q2lZR0pxNE5DS3VVemtqWFRXTlZqamRaenl2OXluOGJJMG0zanZQUTFvdlFU?= =?utf-8?B?Q3RWRHlDbmZjYWptS3lhb2JBQ3RYeExPbW9EM1U0REpZUG9kMFFyeWRFQjRX?= =?utf-8?B?WC9uTVVHT05lWnlZdWZHcVhDNEpqU3VoR1IzQmJnbER6Y0RTWUhUS2FhRE9W?= =?utf-8?B?ZVRmc09FRFI0L0NNOH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enh3VDBqS2F4dFZMSkhCVjFNWmxHdmpUclF6UVdWeGJxdnJjMUJu?= =?utf-8?B?WS9vdlVwamNWanlEa25SekNrL2VMZUdmMmdlNVRZcG1WdjRXWjNVNWFGU3JB?= =?utf-8?B?ck5IcGtnU2lOWGhNbnkrVDlYUVVTd245RGU4NklROUJScnRweldUa1dJc1Rt?= =?utf-8?B?U3pnZERXbjNPOC93Zm9ycHNwRVhtYjFOWXg4ckRFNlpkdTdmUGp6OGtmT2Yz?= =?utf-8?B?Yk9OeDd2RDlIQ0Fmbk82MEh3Qk9qdU1zRWVXdTVtck45ZVVrMEhWY1MrQkh1?= =?utf-8?B?L2x5bHY4ZkJWYWpHUGhmZ2FmeGMwYi9EOC82MGpsS0oyZEhwT1gwMm5vV2M3?= =?utf-8?B?ZzhNQXZ0eHV0TU0wdGRSZ0dQa2NQYzJlRTVmcXpPZ0srWmIxUktCcUNmY0t3?= =?utf-8?B?TTZlank5NWdGU080SE5idllvRlZwaVdiY3VNSERvb2wwVFdndGZ5UGxlblVB?= =?utf-8?B?eStUM29pdmNLN0pCSkxqK3RURENnbkU4TXE5b1kzb3Z5dzBYVExGaHMranhO?= =?utf-8?B?Q0MrWUlxeTNKS25nYm5EcU4ra2VLTmJjRjVCM3Zud2FGOXE3bG1oaEl4Q00w?= =?utf-8?B?TjBWVklibnUzZFJNRkt2SDNobGJ0bnRUREM0ZTdGQm1UdDFnek9CbzFUSCtB?= =?utf-8?B?NmxlS0RXNUNhbG9TcnlmSHNHVUM1WXVzT0VUQ293ZUwzUHc9PQ==?= 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:(13230040)(366016)(7416014)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?RmsxdGc5MWV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MzlmVUM1dWJlczk4Y1k0U0l4?= =?utf-8?B?MklPbXpGUEtxWHpyUmRzNWFVcHdPYTNKeW1xZis1U3NnNld6KzdaTk1qV25L?= =?utf-8?B?MCtBZG5KdUdINEpCRVM4NkYwNXJEaWNsK0pDM1dtaG5TNldGRExqQVEwZ3RE?= =?utf-8?B?dkI3SDd3QjljN1VRWlRKUFlEVTNaQXZtcUZoeTA1a0lWQ0pGOGhOaitoOFNO?= =?utf-8?B?MW9iZDNDVGdVbjM3SWU4WjRkMGJXQzFrZG5iejJhcGJKMmVuSlFFZEZmbC9C?= =?utf-8?B?em9MTG9TNkRtYlJwRnYxUDc4M2hlbHd5aEZ2c1gzSFNLMHZ1Yi9VellicHNE?= =?utf-8?B?a1R6VUZPUTRtL09lY25hS014WXU0WUdZWTRUYjZxbUNMS2RJOFBQaVEyWDNo?= =?utf-8?Q?nGDWpKHLcExznHiFelh+a1o=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <200A7DC6C30DFB4CBC2D1A7ACB295E26@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 803f1af2-d758-4f6b-5c63-08dd104994e0 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:57.2456 (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: 2fK+jsmiZDyMhqO3x0Ouy1LU1Xq7nw82hw3jUhAAf2BNLg1D6lmwSfU27MdEkXUn6eVN1YEU+84waTrjjDX+9mxTb0o6YU/o8pTfNxQQJ8VmmNhhNYZrnIGoltm+WnNM X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR07MB7847 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866452303019100 From: Cl=C3=A9ment Mathieu--Drif This will help developers of svm devices to track a state Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- include/exec/memory.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 756dd2ea7f..c0d064dbd8 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -204,6 +204,7 @@ struct IOMMUNotifier { hwaddr start; hwaddr end; int iommu_idx; + void *opaque; QLIST_ENTRY(IOMMUNotifier) node; }; typedef struct IOMMUNotifier IOMMUNotifier; --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866345; cv=pass; d=zohomail.com; s=zohoarc; b=BO41wQZpXJ+4Q2QG7JYlcyt0RZo7m9r+clnI66BU8TWwAmmEoKhRHwrxAhQTSO9WmKRPgkr6yUbTdjNsDbeCPtiUu5BhzuceSKGhi4pGqYxG4cwwCTinula2sAArqEniQfH/Qz7hCucjEddB0cNR4nSJxX8Drlj7iqFY25utdNI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866345; h=Content-ID: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=NaZCpvqgA/bH2itIriVIa+Uv+Dy5+DrbRgkIjSU9Tfk=; b=Ymu1d7d3pHN9UKSXdv3UE/t8k04Zyd/Fy5HihaPHVQg1Fd2qm4uLVaO/+3PDkTOKKO1PJbSL+4YSbQWaxR6w9VvtICstcfPiW+i0imLX3Ff8ePkNZzbKx4oZ3gtjoxFyRJj28eH/8hCWgWIOljcS4PfRcYkQ0eaYZhdhIkj9cIc= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866345157143.7684307423283; Thu, 28 Nov 2024 23:45:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfo-00085S-Vz; Fri, 29 Nov 2024 02:44:21 -0500 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 1tGvfc-0007zG-NZ for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfY-0002nD-Br for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:08 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:00 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:58 +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.8207.014; Fri, 29 Nov 2024 07:43:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866244; x=1764402244; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=NaZCpvqgA/bH2itIriVIa+Uv+Dy5+DrbRgkIjSU9Tfk=; b=iRX/iBPoIH3zLYdr6D5dNJtcXash2W/2KhNyPsv0kF4pi+JjH0xn/8mr muUTapVN1rAMcEY7qUJaFz7Ps55KJeMokO2UHf2S7KDjyXHtYht8PoKuv NGUviQOb/ROn7iKbm638KxfTsGVZkL4x5ohQTONhS7SedcsJDtZolNuDC YK5eLtsOxLeVDn91s5M9j42V0lnEFpH44gJ3+qcuri37MT9N26ebcl/Qe Lpi2VdumMpe2J7PlJAEkfbGz8V0ZljfW+v8pzL8T8MTn5qSjQv9TJSvyr c32rq/BIsrOXzIO8gHIivSAJlLFgY58maGu5nJrDY8fzi5QGxOMo0l7Ys A==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670810" X-MGA-submission: =?us-ascii?q?MDHhzpIxOaufYw7nCy3yoe3Y/z2Qcku/f4IKrv?= =?us-ascii?q?rXByE50bD13DljUALXbNy01fK77V9YNjRSFz0gUUKG0UiRXWFpw49v7d?= =?us-ascii?q?EA+ULluG5lwwKGN/psNEJp1NBoRS7yDczdm49HkjTmW8VPGLOF+qqMEu?= =?us-ascii?q?RN9fKQGLhCAwOtDYtbjRcDOQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HFuHAD7DFS5Con8bsYsUKwNhbHjUSPZqmbW/zg3WbnZOffn0EiY7h0e3IjJA/dLD1x+bSFXhOumRC1V7X93eVU+x3XD1AYT5InBACkCdkU8Pfu8TBjyApwzOq8H+djvgTNz40mCXglpGWAg89b6Jmfh5//B+ULN+NlaxPQwGv91bJJSOYbCYe6znW6ym5NekcynG08CcD9IggNySsxZwfBXcLhasa4gIyzFdVJv41O5KdNi+nAyqYoIN4jFXqU/g1OWmA9kFldB765Lndu5rz7D+fe7iZ5KIhkPtBoFemkLYdfvgz7eqqOTjShfNf7eWXy6sz9Qup+2lx4ZMvT2q3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=NaZCpvqgA/bH2itIriVIa+Uv+Dy5+DrbRgkIjSU9Tfk=; b=n/Nbnj2rW1ewPGN+jxJXR/cEjPn6KnCdhxLcN9Gl1we5JqtlIpUCoTxnUuSoU8sTe+h6EaLmlgmLYnV/nnCNquInqWrg8HmQy7m5pRBF9NIysASxXRoQZKRTLK7RNwRWa2bDeMEMQ0dNY97oeFRg0OYMruLUxbJ5u7ojkNhV7uXAIf/6ir8J3bx4Z1tWdBfqXTc6F1dyI4hE7QTc9GilkLqDI9MdJOZPPNVUMYArhL6MFQRlobOUjC7rPb/7cyYk5UK8qCGfwyf12NEVGfXTubWGb/gwfWiTKsJqXTkjepjz25M86Gkgzj/HUadTPTXSAA2bfG7WR8H/xgoNWbuBeg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NaZCpvqgA/bH2itIriVIa+Uv+Dy5+DrbRgkIjSU9Tfk=; b=atDvQhT3HJsJxocG9SOWw1otbflWngM639j6JNpJMCaTQNVmlDXAMD1KNFrxGJTKsHy0xyu+/x6+/0QhgFvKQqnmAKvqyHdtfc427aHljbhOW4AjiY22LejuL07jgkGaIykVA459KS42GW8qJ7f2sWiUfxy3Jq2O09J1mFPjMrptCELW5ImtdFsj0IFa11rTlvhX8CC5xVuBejwl2ijF1jHuo40fDXtOqgzdagggYrc1F5oBJJ8fS39AYZX0lY0wv94zqoaSU7qz8zKnlx+bO6xc3CPb1r/MZIJ5FR2JfI+CIwUjDWs0EGtojn9q6Rxi3lL4ZhMURwZmuOAvTJNO3Q== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 12/19] pci: Add a pci-level initialization function for iommu notifiers Thread-Topic: [PATCH v1 12/19] pci: Add a pci-level initialization function for iommu notifiers Thread-Index: AQHbQjJycOMVY49bv0uPDEfnaCo52w== Date: Fri, 29 Nov 2024 07:43:58 +0000 Message-ID: <20241129074332.87535-13-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 13ae6722-06db-41dd-5d11-08dd1049955c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?R2dmek9yVUt1T3ZtZ0V1WkxxcHM5MEx2OVFLTFlGc3pMVEs0T2p4cDl5VDVI?= =?utf-8?B?bWlrbWtDcTNVczV3MGhpSjJ6WWM5RTFXcTBON08rSzRkbWJGUGtQY3N0ZXJr?= =?utf-8?B?S2VKR3VCQ2phYmtaMktrR3pPZHdscWRhREhtOWh3dkJURVNKOWNBVUJMQlg1?= =?utf-8?B?WTNoSTU5cWEwZDR0c0l3TERpMjl0YkJmSDZTNUVVbUdSSXg4d2JQMDRqQnFh?= =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; SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Y1VRWE13dEZCZzNiNTB3WEFLTUYzYlBBVDBCdDlxZjZCK0RING1FeGpPRmNv?= =?utf-8?B?ZmdJUG1EZGlRTWlvUXlMeGVjeU9ieFFkeUlla3I4N3VJNDdpT0JiS0VBbXRQ?= =?utf-8?B?bWFzazVtakhEZmNDOUVPWnNBQlJtV0dENTBEcVdwUnhoL3FCVzNXeGFWS3pO?= =?utf-8?B?U2svRCs5bVpEcHNZTy92VjV2NlpxQm96NW5UVSs1c1VJSUpEd2N4dHpKTVZZ?= =?utf-8?B?d3RGLzNpTE5TM2hlK09SYVdZcUxHczZSMDRGd3BkUEtrcTg3ckxYNHpTclMr?= =?utf-8?B?SG5MalpBTmVISWcyK04xOFZ1SDlYV253U0ptcE04Nk5XcGRyU01Gc1VCT0tn?= =?utf-8?B?S3JNREFZRmVtZFFGeWdRNUlyWTBFUEFEanpPeGNUUW5YSHB0eTB6T2tINlJW?= =?utf-8?B?emx4WnJHRFk5UXNib01MWTMvVEprZnAyUkVibU1EM2JySy9td3BOUjcwalpp?= =?utf-8?B?dXJobFU3SHlISVEzZXJQTHltbGtoL3A5eThTaW9TRk15VXRVa0FFTVVuK0xU?= =?utf-8?B?UCtZV0cxcCtSQldZeWFDQzhEZUNSb05WbS9FU01rK1l3NTNpclJob2toMXNs?= =?utf-8?B?SVRENUNCVHNyVTBuWXp5cG4rY0NtSXpZZXgzUjUyKzFmdGpFM24wY1pxZldv?= =?utf-8?B?cVVvMGZGRXVhOXRkZUhkTjUzRlFSQ2c5Q2tQUmlWRGtMZU9MSVY3OXk1OEJH?= =?utf-8?B?VVlvT0xQOFEyNS9ZajFrYTQzME5lUzY3M3pmU0VKTVlLN2VTQmc2cUJsdUM0?= =?utf-8?B?cTQ2alYrN29IYWh0VDFidFQ1bTh3V3RYb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VxWEdJeDZIUTZPUTNQVG5xTnhzb1JXeFArc0xkdUpn?= =?utf-8?B?Q2hQMmNuVzdLaTlmSHYxelF2aHVtWGlvNXFWaVhsTmw0b1YyV0lVeW5oeVpO?= =?utf-8?B?dThlWmhlYjdqSEZXcXdEbFVtUlUrcVQyZm5NU3dpdk9BNndEU0lZR29UR1dk?= =?utf-8?B?Q3JjNHRrQk1OUm9SZzVxSXp2WU1kSDhpOTVyM2RnOXQ2c2gwaTdydWtRZUk5?= =?utf-8?B?alRlVmpiLy9wY0dSNWQ3R0xUM1J5MXp4aVJBZFdmT015Zm15Y2xBcFdmNWNZ?= =?utf-8?B?bzRPcUJ6UGtOZXJ4cnBTcXVIRnNyRE5PbGpBUldSUzZGV2xScmZmdTBBMk1l?= =?utf-8?B?bS9Lcm01U0ZBdUxWMzZ2WExCa3ZNNnphUWhwUTBpZU1uU0lReVZ2R04vbjc1?= =?utf-8?B?MDNxNWdXb3FEZzArWEJkeSt5VWlSb1Q5K0xtR0FwVFJnWUJwU2h1clNuRzRm?= =?utf-8?Q?6Szsz5f8LV4WAn7eEsZ/lmc=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <750E06CB7C5B7F43A4EDD02A20EA90F3@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 13ae6722-06db-41dd-5d11-08dd1049955c X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:58.0740 (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: c5h0Om059H5steIy5pfb7YaE7h7CetVgN2gfALDheRYylhQFdk2P4iisAQ/bC2u9p0XJzyJh5YdLmDznXkMk5WN8E2EUZcr5Stv82wY+RwtHakH5CYzMJQRDVlyumRPG X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866345911019100 From: Cl=C3=A9ment Mathieu--Drif We add a convenient way to initialize an device-iotlb notifier. This is meant to be used by ATS-capable devices. pci_device_iommu_memory_region_pasid is introduces in this commit and will be used in several other SVM-related functions exposed in the PCI API. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 15 +++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index bd36c5227b..435fcb6c78 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2773,6 +2773,46 @@ AddressSpace *pci_device_iommu_address_space(PCIDevi= ce *dev) return &address_space_memory; } =20 +static IOMMUMemoryRegion *pci_device_iommu_memory_region_pasid(PCIDevice *= dev, + uint32_t pa= sid) +{ + PCIBus *bus; + PCIBus *iommu_bus; + int devfn; + + /* + * This function is for internal use in the module, + * we can call it with PCI_NO_PASID + */ + if (!dev->is_master || + ((pasid !=3D PCI_NO_PASID) && !pcie_pasid_enabled(dev))) { + return NULL; + } + + pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); + if (iommu_bus && iommu_bus->iommu_ops->get_memory_region_pasid) { + return iommu_bus->iommu_ops->get_memory_region_pasid(bus, + iommu_bus->iommu_opaque, devfn, pasid); + } + return NULL; +} + +bool pci_iommu_init_iotlb_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n, IOMMUNotify fn, + void *opaque) +{ + IOMMUMemoryRegion *iommu_mr =3D pci_device_iommu_memory_region_pasid(d= ev, + pa= sid); + if (!iommu_mr) { + return false; + } + iommu_notifier_init(n, fn, IOMMU_NOTIFIER_DEVIOTLB_EVENTS, 0, HWADDR_M= AX, + memory_region_iommu_attrs_to_index(iommu_mr, + MEMTXATTRS_UNSPECIF= IED)); + n->opaque =3D opaque; + return true; +} + bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod, Error **errp) { diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index c34ec5ea81..b21448bc2a 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -443,6 +443,21 @@ bool pci_device_set_iommu_device(PCIDevice *dev, HostI= OMMUDevice *hiod, Error **errp); void pci_device_unset_iommu_device(PCIDevice *dev); =20 +/** + * pci_iommu_init_iotlb_notifier: initialize an IOMMU notifier + * + * This function is used by devices before registering an IOTLB notifier + * + * @dev: the device + * @pasid: the pasid of the address space to watch + * @n: the notifier to initialize + * @fn: the callback to be installed + * @opaque: user pointer that can be used to store a state + */ +bool pci_iommu_init_iotlb_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n, IOMMUNotify fn, + void *opaque); + /** * pci_setup_iommu: Initialize specific IOMMU handlers for a PCIBus * --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866482; cv=pass; d=zohomail.com; s=zohoarc; b=KOrMVlfth1AdgvPhv12WV15wbIUsPkW5k9xjus3GU5WRNBQHvj8IOfS2HcJO6wuKr0MDuyBWHUtbjCRQi7rOmJ0Kjy2w7cdJ3oUfEmVY78um2tARoH+xTXFOtDSLPMJZwo4BcizNxcIsn8pCfdqItiI9z6JeHuhmVcoqmVr+Ubg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866482; h=Content-ID: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=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=YrLH7R32AgLQIf9jBUdZMjdhJav1U1YHdsZ8SkWpkbmlN0C0g6lwXGx7JHbo/jAcjMEZF6K8fa03zHXtQ5YRE0ifVe3zBPwg6Eulmc1UfK2MBMNGkNvX+eoDzM5KBi0Xz9Nt8bK/Tt/68dCaTgO+XuXONZtAb4+e8AqlywDXxEU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866482356290.1338338437314; Thu, 28 Nov 2024 23:48:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfm-00083j-4l; Fri, 29 Nov 2024 02:44:18 -0500 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 1tGvfe-0007zT-7x for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfb-0002nM-0H for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:01 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:59 +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.8207.014; Fri, 29 Nov 2024 07:43:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866247; x=1764402247; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=JCigumQ7ryzPAgOhNtxGccSP0NG4R5pI9u49yyB5l9VlsXClZf1Wkk3X 34mXIkqvOyWyr1if9Ngr3mJHc/vwitmcNMo/YabpufKSgmFV2gjTHUrbx Gbntag19siczOOsHwdWIzQwIbWTQjRe3Nj2fH8aGC7E81jjB618EaMvoT ITZRr0Fx4YPMN8jVpWzMGOpPvrUQj8Dm+t5W3nTPr4VnvtkCjlRRzj/Vz FYPkoX6NvepJsm2v5Z25sjc+NDASLGHcsDASt6j4o4zBSaUbC+6hPIdCJ P/qb9XY7+v8YwvLz7AfdSFr+CYVPJYmjzi52a/n5zRKWbIYpp9f/2JxyL g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670811" X-MGA-submission: =?us-ascii?q?MDGo7LgHrwqw3jDPn6WpDqwxKaBmucBmi77fnm?= =?us-ascii?q?NbIxiLI5obCk6RsYBsPbqLlxt29aAeM33YFAlR6DqVFKuqzkOFJIdFsu?= =?us-ascii?q?KpOUbby8dIED2cBTghyAeM6RsgpP5ppek+N4wjcqwzf4eRdi1EZfXQpG?= =?us-ascii?q?HWOgUuJRLbQ1aok60N38cmAw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r4OAEbsHTQBwcuctCtA0HEY4P015KpHbwQYQMtMUU3a34g7TzcDaKLXHDU2oGBU9zffuWsx5ngRNRDWCJ2CV587k+ICZv2JWV4nTTvEmKvTakOKWTZG6V1N6pQ/wHB9oEz04z4OkWYGFYY+sU9j9TrWVCQkRnCctQCkqzpi1pw0NmzEOijZ1V4G6s59z1Yj6ZscNt8ZC5pGpaKp1SwpLNhiS7P05ILaweq6R8LghC+8Zgxzr5ttd/kuXYmyWhywFAiMU3M8baxjnBAeW85Lm1jdrC9/bOsz60/i+AKJp5hdyePnAutyd4eBVytKvWEdIQ49FbdGNY9YzhxJbhdxpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=Wr+mKCsyhxUld+HBC6PCs84M9M9XxI68qWrM6oNzjxZ4BXaisSUL1efn612vxpPFyLat6wZSqYFfeodODXA54EftWNwZkmbzZFiE8rVXWvowuOMiylXTUrTHwVJAR60NeNSaK0GvdxTPgkhTd6tCnB5WphT7M5INP6lXgYA6HaqRMIujJNJRuHx9D/JkH4dGTTAOcQugVyE/xMBDGZfz/EDMvub2TDVbuyVpBVrLISZQywCTJhVGiOj+usg4qU9z0kAKnOnZ06iK6cLrY1ECVcxSKarIW6iJe47UsNjyU5ZNeivMK5pT9mNYGKpEEyu+8tE92iCT11D1ZIcvviN6SQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=IXZMD6gZ+vjtaS5HVrXC6rP9eesmWBjyCq241zSs85GPkh/4NHnVSx/3EuvzJgcMUkH45o1v48IUl+cAj2VLLI5nMQaGbPOlA9/wNaM5YRKaQzQz0n9lZybgbjUjufxAIohJSayvW/Q+CVt4cGl4nOZ1kbBOCudyHlKaOwr0oRDnn9EhlFR0lRWs6ttIG6fkb4b+/ojQyzcBWrHOvfsdAK4YbcgmH4a0y8N98G2zaF7BWFGOIbASjjPFSJLpZDltaWwOJOEwcSVzogy7OdalqROrGGp+tagREFvzWYmmi3qAAXb8RUqA+uqYtFsDS9zQxZdXEi78HdWZw/kvSk4SIg== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM Thread-Topic: [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM Thread-Index: AQHbQjJzOocc57+pXUCiOlRFpHu04w== Date: Fri, 29 Nov 2024 07:43:58 +0000 Message-ID: <20241129074332.87535-14-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 7a8d3666-3ab7-4b63-ddeb-08dd104995e1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?WmEvWkhGTVBIL3J2MVlzVWF0UFhkNFlQNlVrUkdIYmZZRllJUnNYL2RONkp3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NnOFF3SW1McUJyY2taMFB2RXdkYmJvTHNNWm01QlhNWldt?= =?utf-8?B?SGpkZm02aUx5d2EveEsra3ZFSEtEMmdDL1pKbjVUTDROSkE9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Y3lJY2dtbUc0V1NPRGV5NVA3dlRaMzZiMFJ1enNIT3U5UDVzWFRuYTczeG04?= =?utf-8?B?L2IvMXd1TTlpd3RRcnduOUYzTDZuUlVWRTFuRnM4ODF5SlRkNmZ5QTljS2dW?= =?utf-8?B?eDBBV0lyMFNvVkwzWFQwWjYwRkR5VmFWTEl3UU9hL1V3ckh4QTV1WDByODZF?= =?utf-8?B?VHVxQmcxY2xxZW5IWUFpUFhtQzJQVFA3Zi8zckpmKzhQTlMyRi9UZnh0NUc4?= =?utf-8?B?NmxYbG0vNTFNTFVsSWRxYTlualJWZnJjM0NyRHBNY0NReWRrYWdPbTBsRU1a?= =?utf-8?B?QURpNFlmRVJhb3RtQ3J3bXRxSVVUVEE1OEI5UGFpL3VYZzYrTDcxSDVUMGtS?= =?utf-8?B?R00rUnhDK1Y0SUgvODBmbitWbHR3bTZnTDZZNmY5T0Mzd1hUTzJUR2kvRGFo?= =?utf-8?B?QlhGRVFtSEV1V0FzYnU5ZEpKYUVhQ0VQVXYxZ3NzTWVubi9peGNSRFhZTWlp?= =?utf-8?B?TG54SUJYRzAzVHA0MDlNVkluK2VUMEtlc1N0Rk56elhGaVU5TWg1eW9Ud3VR?= =?utf-8?B?MmlHMW4zalVuaWFVY3R4eUtrZUVSaWtsWXU3SWZJSDBvN3ZZeHYxQnNLWG01?= =?utf-8?B?Umdta3o0Uml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= =?utf-8?B?dEFPQnBvaEtUeU14RmZ3UHBiZEV3UldVbGJPVnh0aVJGNTRBSFhXbGwvRlMv?= =?utf-8?B?aTJyb1RiTm9Ja2FWMmNaMFhGRFZCeU1BTmNjY01QYWdsUlh0WFMxMkM1OUJm?= =?utf-8?B?QWxGR1pZcXpPWnptWGVOYlBZa0lGMWtaZk9DTFMwcjg2TktqaUR5ZDBLUnRt?= =?utf-8?B?aEdFQnh4aXJzOVFxY3BzUWY1bDJNclJnLytaUEhxcERLVWF3K1RzcldHcXNv?= =?utf-8?B?MUZFRGhwdEFxbjN5bGZtYkhoa1RvUm1pZ0JVWG93YzZCajMveDY5aDNkaVhs?= =?utf-8?B?L05OUDNsTUFVdE1ULzdwUFN3M1dwVU1TSmxYNXd3b2xjb0NGcTF5KzlnWTk5?= =?utf-8?B?QnJ1NlZQWlhtcG9ZYllFVFRSU2ludC9zYlUyWktWa1Zjbm1UWktDQVdhS0pP?= =?utf-8?B?QU0zQjZpUzV2czlvdjRlK05lTTBMbEZSMk94SWNPdXUvWDJ4MUVKTkxGT242?= =?utf-8?B?V25EdHdWdWpycm53UHIzVmhxdmcvRjhlVk90WDV0QWVKcTRudHY1U1kyL1VW?= =?utf-8?B?QlNMOU1qNXUvZFZVUTh6bUdXcDQrNzFUOTRzaEJ6NGVWV2NFQXh3elZKRHow?= =?utf-8?B?VGp5ZGYzWHJCZTJIQ2pGN1hvSlNkZG9JNTNTZlMrMGd5ZUF6L3A4QlhsWmdu?= =?utf-8?Q?YpMSRK/XYZSTkCgEag1R1rk=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: 7a8d3666-3ab7-4b63-ddeb-08dd104995e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:58.9325 (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: DPPJyJUi2EnELMUvViUz5yJV+o0PSt93rPi/qUoIwbACMEELdNj3Ba7UgPibb/ZTzb5hZ4TkLF6VtCruIL7egWWgQxpTCq5i1FzH/K+EOTkbjkvviYDjl7a43UdDr09y X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866484576019100 From: Cl=C3=A9ment Mathieu--Drif As the SVM-capable devices will need to cache translations, we provide an first implementation. This cache uses a two-level design based on hash tables. The first level is indexed by a PASID and the second by a virtual addresse. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- util/atc.c | 211 +++++++++++++++++++++++++++++++++++++++++++++++ util/atc.h | 117 ++++++++++++++++++++++++++ util/meson.build | 1 + 3 files changed, 329 insertions(+) create mode 100644 util/atc.c create mode 100644 util/atc.h diff --git a/util/atc.c b/util/atc.c new file mode 100644 index 0000000000..584ce045db --- /dev/null +++ b/util/atc.c @@ -0,0 +1,211 @@ +/* + * QEMU emulation of an ATC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "util/atc.h" + + +#define PAGE_TABLE_ENTRY_SIZE 8 + +/* a pasid is hashed using the identity function */ +static guint atc_pasid_key_hash(gconstpointer v) +{ + return (guint)(uintptr_t)v; /* pasid */ +} + +/* pasid equality */ +static gboolean atc_pasid_key_equal(gconstpointer v1, gconstpointer v2) +{ + return v1 =3D=3D v2; +} + +/* Hash function for IOTLB entries */ +static guint atc_addr_key_hash(gconstpointer v) +{ + hwaddr addr =3D (hwaddr)v; + return (guint)((addr >> 32) ^ (addr & 0xffffffffU)); +} + +/* Equality test for IOTLB entries */ +static gboolean atc_addr_key_equal(gconstpointer v1, gconstpointer v2) +{ + return (hwaddr)v1 =3D=3D (hwaddr)v2; +} + +static void atc_address_space_free(void *as) +{ + g_hash_table_unref(as); +} + +/* return log2(val), or UINT8_MAX if val is not a power of 2 */ +static uint8_t ilog2(uint64_t val) +{ + uint8_t result =3D 0; + while (val !=3D 1) { + if (val & 1) { + return UINT8_MAX; + } + + val >>=3D 1; + result +=3D 1; + } + return result; +} + +ATC *atc_new(uint64_t page_size, uint8_t address_width) +{ + ATC *atc; + uint8_t log_page_size =3D ilog2(page_size); + /* number of bits each used to store all the intermediate indexes */ + uint64_t addr_lookup_indexes_size; + + if (log_page_size =3D=3D UINT8_MAX) { + return NULL; + } + /* + * We only support page table entries of 8 (PAGE_TABLE_ENTRY_SIZE) byt= es + * log2(page_size / 8) =3D log2(page_size) - 3 + * is the level offset + */ + if (log_page_size <=3D 3) { + return NULL; + } + + atc =3D g_new0(ATC, 1); + atc->address_spaces =3D g_hash_table_new_full(atc_pasid_key_hash, + atc_pasid_key_equal, + NULL, atc_address_space_fr= ee); + atc->level_offset =3D log_page_size - 3; + /* at this point, we know that page_size is a power of 2 */ + atc->min_addr_mask =3D page_size - 1; + addr_lookup_indexes_size =3D address_width - log_page_size; + if ((addr_lookup_indexes_size % atc->level_offset) !=3D 0) { + goto error; + } + atc->levels =3D addr_lookup_indexes_size / atc->level_offset; + atc->page_size =3D page_size; + return atc; + +error: + g_free(atc); + return NULL; +} + +static inline GHashTable *atc_get_address_space_cache(ATC *atc, uint32_t p= asid) +{ + return g_hash_table_lookup(atc->address_spaces, + (gconstpointer)(uintptr_t)pasid); +} + +void atc_create_address_space_cache(ATC *atc, uint32_t pasid) +{ + GHashTable *as_cache; + + as_cache =3D atc_get_address_space_cache(atc, pasid); + if (!as_cache) { + as_cache =3D g_hash_table_new_full(atc_addr_key_hash, + atc_addr_key_equal, + NULL, g_free); + g_hash_table_replace(atc->address_spaces, + (gpointer)(uintptr_t)pasid, as_cache); + } +} + +void atc_delete_address_space_cache(ATC *atc, uint32_t pasid) +{ + g_hash_table_remove(atc->address_spaces, (gpointer)(uintptr_t)pasid); +} + +int atc_update(ATC *atc, IOMMUTLBEntry *entry) +{ + IOMMUTLBEntry *value; + GHashTable *as_cache =3D atc_get_address_space_cache(atc, entry->pasid= ); + if (!as_cache) { + return -ENODEV; + } + value =3D g_memdup2(entry, sizeof(*value)); + g_hash_table_replace(as_cache, (gpointer)(entry->iova), value); + return 0; +} + +IOMMUTLBEntry *atc_lookup(ATC *atc, uint32_t pasid, hwaddr addr) +{ + IOMMUTLBEntry *entry; + hwaddr mask =3D atc->min_addr_mask; + hwaddr key =3D addr & (~mask); + GHashTable *as_cache =3D atc_get_address_space_cache(atc, pasid); + + if (!as_cache) { + return NULL; + } + + /* + * Iterate over the possible page sizes and try to find a hit + */ + for (uint8_t level =3D 0; level < atc->levels; ++level) { + entry =3D g_hash_table_lookup(as_cache, (gconstpointer)key); + if (entry && (mask =3D=3D entry->addr_mask)) { + return entry; + } + mask =3D (mask << atc->level_offset) | ((1 << atc->level_offset) -= 1); + key =3D addr & (~mask); + } + + return NULL; +} + +static gboolean atc_invalidate_entry_predicate(gpointer key, gpointer valu= e, + gpointer user_data) +{ + IOMMUTLBEntry *entry =3D (IOMMUTLBEntry *)value; + IOMMUTLBEntry *target =3D (IOMMUTLBEntry *)user_data; + hwaddr target_mask =3D ~target->addr_mask; + hwaddr entry_mask =3D ~entry->addr_mask; + return ((target->iova & target_mask) =3D=3D (entry->iova & target_mask= )) || + ((target->iova & entry_mask) =3D=3D (entry->iova & entry_mask)); +} + +void atc_invalidate(ATC *atc, IOMMUTLBEntry *entry) +{ + GHashTable *as_cache =3D atc_get_address_space_cache(atc, entry->pasid= ); + if (!as_cache) { + return; + } + g_hash_table_foreach_remove(as_cache, + atc_invalidate_entry_predicate, + entry); +} + +void atc_destroy(ATC *atc) +{ + g_hash_table_unref(atc->address_spaces); +} + +size_t atc_get_max_number_of_pages(ATC *atc, hwaddr addr, size_t length) +{ + hwaddr page_mask =3D ~(atc->min_addr_mask); + size_t result =3D (length / atc->page_size); + if ((((addr & page_mask) + length - 1) & page_mask) !=3D + ((addr + length - 1) & page_mask)) { + result +=3D 1; + } + return result + (length % atc->page_size !=3D 0 ? 1 : 0); +} + +void atc_reset(ATC *atc) +{ + g_hash_table_remove_all(atc->address_spaces); +} diff --git a/util/atc.h b/util/atc.h new file mode 100644 index 0000000000..8be95f5cca --- /dev/null +++ b/util/atc.h @@ -0,0 +1,117 @@ +/* + * QEMU emulation of an ATC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef UTIL_ATC_H +#define UTIL_ATC_H + +#include "qemu/osdep.h" +#include "exec/memory.h" + +typedef struct ATC { + GHashTable *address_spaces; /* Key : pasid, value : GHashTable */ + hwaddr min_addr_mask; + uint64_t page_size; + uint8_t levels; + uint8_t level_offset; +} ATC; + +/* + * atc_new: Create an ATC. + * + * Return an ATC or NULL if the creation failed + * + * @page_size: #PCIDevice doing the memory access + * @address_width: width of the virtual addresses used by the IOMMU (in bi= ts) + */ +ATC *atc_new(uint64_t page_size, uint8_t address_width); + +/* + * atc_update: Insert or update an entry in the cache + * + * Return 0 if the operation succeeds, a negative error code otherwise + * + * The insertion will fail if the address space associated with this pasid + * has not been created with atc_create_address_space_cache + * + * @atc: the ATC to update + * @entry: the tlb entry to insert into the cache + */ +int atc_update(ATC *atc, IOMMUTLBEntry *entry); + +/* + * atc_create_address_space_cache: delare a new address space + * identified by a PASID + * + * @atc: the ATC to update + * @pasid: the pasid of the address space to be created + */ +void atc_create_address_space_cache(ATC *atc, uint32_t pasid); + +/* + * atc_delete_address_space_cache: delete an address space + * identified by a PASID + * + * @atc: the ATC to update + * @pasid: the pasid of the address space to be deleted + */ +void atc_delete_address_space_cache(ATC *atc, uint32_t pasid); + +/* + * atc_lookup: query the cache in a given address space + * + * @atc: the ATC to query + * @pasid: the pasid of the address space to query + * @addr: the virtual address to translate + */ +IOMMUTLBEntry *atc_lookup(ATC *atc, uint32_t pasid, hwaddr addr); + +/* + * atc_invalidate: invalidate an entry in the cache + * + * @atc: the ATC to update + * @entry: the entry to invalidate + */ +void atc_invalidate(ATC *atc, IOMMUTLBEntry *entry); + +/* + * atc_destroy: delete an ATC + * + * @atc: the cache to be deleted + */ +void atc_destroy(ATC *atc); + +/* + * atc_get_max_number_of_pages: get the number of pages a memory operation + * will access if all the pages concerned have the minimum size. + * + * This function can be used to determine the size of the result array to = be + * allocated when issuing an ATS request. + * + * @atc: the cache + * @addr: start address + * @length: number of bytes accessed from addr + */ +size_t atc_get_max_number_of_pages(ATC *atc, hwaddr addr, size_t length); + +/* + * atc_reset: invalidates all the entries stored in the ATC + * + * @atc: the cache + */ +void atc_reset(ATC *atc); + +#endif diff --git a/util/meson.build b/util/meson.build index 5d8bef9891..f2dec01300 100644 --- a/util/meson.build +++ b/util/meson.build @@ -93,6 +93,7 @@ if have_block util_ss.add(files('hbitmap.c')) util_ss.add(files('hexdump.c')) util_ss.add(files('iova-tree.c')) + util_ss.add(files('atc.c')) util_ss.add(files('iov.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('block-helpers.c')) --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866508; cv=pass; d=zohomail.com; s=zohoarc; b=PaTVLzLUr7erSnXkRd7XPDf0MXU4fOqtG0CeskR+A5wkbR5O1NWX2W6gskX8SEYN0Wl4MVB5taVTjF2QI4vXJCuV3ugqkAnXjMfZ4qGassAy8Z9nOM+8b5ru12+TbHU8ryRamIlwS11aZ91KwRBJgmdttAg9cSwDC3vlmj9G6T4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866508; h=Content-ID: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=TOg2qey615bPbMGOVOFb9kk/xetbfF2n4Ge4E8toy68=; b=fIBNQC89QdsfX1MQBzhY5sIRIYYaKe1nRDr35b4LHzXVmjoFtYkE4eyFM8AE+66WCTv3nZQR6enDPt4EjTzo4ZV25ENKI+FSTUGTAo5ITNWezUResu06vDWn1TDVIAGHsXLDGuVW4WbKNhLX4PvVqN4KKW8T9ScIWNde/XuA978= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866508215942.9865188169895; Thu, 28 Nov 2024 23:48:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfj-00081b-14; Fri, 29 Nov 2024 02:44:15 -0500 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 1tGvfe-0007zV-LY for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfb-0002eL-FL for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:10 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:02 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:59 +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.8207.014; Fri, 29 Nov 2024 07:43:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866247; x=1764402247; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=TOg2qey615bPbMGOVOFb9kk/xetbfF2n4Ge4E8toy68=; b=YQvDYPh7jeHxfLjCu2DxAdaseTbmvUcbL3RRvRurqnfyKsdiUHCFNga+ E+GpogPkd5NF2l4zlAThMmyVysPpg3TivwCufk5Mi3kGTP6hN8wwgWJQl sucajeaHSG5g+dV7t7aHOxFvwA/Sil06Bq3p+C7MxEe4F7073OdM1EYXQ 6HKTJrUEPsamPZ6Dp/vTTOvxMcoMYPFvEDRAxfxhmIdA791ll076TbuXy s4nQyIv/Xsl3JGOxDMkPZzuZJJ3N7x9/BjX0FL6LexwmtLh9szOtvJ0MR /f95oQf3AoHXi7LLx191LO/xAuyonmZ4DjI1E2pBBW5XnhhHgBMqHlBkT Q==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670812" X-MGA-submission: =?us-ascii?q?MDExnROP9tTJ5rFq9kr1F9FRbDUDQMrfIC4AyC?= =?us-ascii?q?PRs22iF6mo3P1LPYFAx8SjW99yhTlTi8FXyRROxh6Kg+Q1OJzit+F89j?= =?us-ascii?q?AmnFF3xpw7mrVqaiE0KU8ofWii/jh9YcQQ6CEEqpUIyXsW2mWDIJETrz?= =?us-ascii?q?nGIcz675xd047Ij20GSwalwg=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YHz2Y1SwVgrJCpG9FF5n/3llGItcB7n0rcxSDiynq/4A36AxVqfnRe6I5pU6CNw9CJTBAuPP0FtDwT5oF/MRuahcKrtWQfssK2MUSmqA63io9wlw/SxvKzn6VRRw3L6GdSeWUkcq4UmnGeCkp+IMhdTA7ZenOPkTMF+E+ly8Q2FFq4UZvcoSwm+zq0g6DyCpKDPnkkLS65Wvm27SysRjtqCZ2bADx2I9JSz+Gtou1PJs6oAAhUtNU4IC98Oh8I8hFuWIL0wYz/mHanz6c0xFcNW+jI1+MmRWM5ZLHh5irZgFnRtKhdlHWQW0iSE5DAWnn0a6YLOtvBlagat6f2/cRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=TOg2qey615bPbMGOVOFb9kk/xetbfF2n4Ge4E8toy68=; b=WdJeMWTAWRR9+ZT7fGBtFuwfoTX8vzXryK83AXyEVnlLNfEyArCywt7Qp4bINGQwVx4XUH9IKqFojrvgPc90ffHtCy+E32KyCvXj1WSAmeK5Mz6XINGXGRqnzkPt7MvPfwLKP7KZHop13FxuLvV8yicb43fzZaxgTY+HyygZX2oNKe9gIFot/ZaKmWYveC5nMwUFvisIJAfXCBdtETETd/zkuzNxdBjlyJLEJyzpUkv7xgihlQxR2gjVaTsIEYi1cd0a7TgQIRgKQsgtxxL0ga6L4rJyK4KJmLvOB5iLR8SWQiS9RT2ORwnVsM9x81Issj9o1g/1JHlwX345kzzEOw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TOg2qey615bPbMGOVOFb9kk/xetbfF2n4Ge4E8toy68=; b=DjHWpGbJoWiZICqz0YwLFAcyt+K6SADibwvx4L/7eDMEhTw/vqUPNoUGVjlSCMZt8GcgPDp7mdexAWOdTHWdrUtUCi3M10MMGkyZJnQQfqypySvyZoe57C8g8KonEwo64bZZXHi4LJhShX4s6AUlG3TnHv6jAflF9aA7MXtwLY+8eMX9EM0Xjq0pdXC2V4l2TXIqird2bg/D/VQlJi33uyOqZGU5l1p5DyNZ37sj7t61wCquUewc5VOuy13Il0EZpains9HEi3Vl15B1CqC9KXcHqX0i6WKFflVdSlaZsIKCtHIUOSU2i7sSy8jGsUFkLDOMNvsjlIV89yfjPXxZjg== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 14/19] atc: Add unit tests Thread-Topic: [PATCH v1 14/19] atc: Add unit tests Thread-Index: AQHbQjJzD3BJ3Z07D0etiK0rxw+UBg== Date: Fri, 29 Nov 2024 07:43:59 +0000 Message-ID: <20241129074332.87535-15-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: dab2f38a-f42c-4880-59a1-08dd10499654 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?ZVovNWhXdXBkeXRlZEdXa3FER2VmRVJmQW5SdWJYTUlEdU51RS9UbW9rUElR?= =?utf-8?B?Uk5BZS9aT1V0NWNTU3c2T0dVQ2poRFhUbW9MYk5FN3dRcXk0R0NFTFp2eWNS?= =?utf-8?B?dGJFWTdmSUV1bTN5L3FtNlROWDVmcFN3NDFJM0JkaTc1NktrS2tJRlVvM0t6?= =?utf-8?B?REo2SmRIZmRYSWxONGVkejMzb25PQVlkK0JJckdkcXVoNDRhVHUxcnBRS3ZT?= =?utf-8?B?dGRpUTlZS2ZVM2s4MWxiSnBUL0NOeitGaHFPaU9SSEw2Rnpmd0hBLzkzRjZO?= =?utf-8?B?OGd5c2VPT3VuKzJCbk50UUdvWWloNThNMXZKSCt4aDlYeEVLZFlLM0pISG1H?= =?utf-8?B?OEpmYzBOTkZBT21Iclg2WlRzU3AvaUJ0SFcwR2hlY3lsVVl3dlFEZE43Yk1B?= =?utf-8?B?OXovMmtBVTF0U1JMSDVhNW9xWWpkdEpxUUo3T1BEYXEwSm9FK0hvYW5LTC90?= =?utf-8?B?ZTg4Zis3ODgzNmxVK0NBVmtacy9DZ0o5T2RBWmNQenEyWGNhVk00QXF6U2NR?= =?utf-8?B?MjRuOUI3R2ZRS3Noa2Q5bEZnb2NKWC80L2NEeTBHZUc1SVpJTkhMSUhidVZz?= =?utf-8?B?VWpTNTBOZUN4RW90S2YyVDFWZ3hjekltd0d2R3g3VCtGRE9tY0dNTUNpOGNU?= =?utf-8?B?SitseX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?utf-8?B?K2gyOTY4WGlvWUQzQ2R5NlR5MG84YmlsdHh4c09kNGo4cGU4d1JIZDBxMm04?= =?utf-8?B?TjdobWlCTmlXNkNCMUNHNnYyYXk0cnVLNmtWV2E5UDFEOTFteGNKL0Eya2JN?= =?utf-8?B?U3gwcnFDWmdZdUZQUGtSV2dlOG5QRUhQOHhMc1ZETExXSWZrb0NpYk5PMGxn?= =?utf-8?B?VXdwZzZpcXVObjM3dWNEaWgyMld1OXl2eFdWa202QThaTE1IbjU5cGdHOVpF?= =?utf-8?B?MXRQR3prc1pDMW0yRUhZVnV2bm81UTJjQjVrdEFBTXAzUjlSQjUrMUp5K09q?= =?utf-8?B?eVJjRkhRM1BtNEgxb1hVNWVHL0dIZUdJQXdCZkpKdlRsM2c9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?YTRsTWdJZDlWUlFtaUVWQW0vM1BwY2gxQzEyT08xZjZtNzA1VlNtdllXU09J?= =?utf-8?B?UStPSkdUNmwyY2kwVEluQVBUNEM3R0lvRm4zckdFVVhVWmVFcHpuaklRSWlO?= =?utf-8?B?WmtRUG80b1lQdDNWbWxVc3RiTDlhWXNYNkNKOVJ4OHlVRzFEZUJuYm8wMjJi?= =?utf-8?B?L1BhNmtmRTBwejRGZ2JwcVNaYVNRcTQ4VUFNMU55NzlINHRRNGc2WFlCb2d6?= =?utf-8?B?RmQ0cHhmYi9VZUpieCtZZTJrZEViNFFCUllzVFdnQmJ0ZUlJQTVOTDZsVDEw?= =?utf-8?B?RWxycUt6MjAvN3hnMUVtYWExT0ZKT3djMlVNbG9UQmtEN1AxK0tHeXdoSngv?= =?utf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akRCblB2RmFldTB0UHk5YlhFU3lab3o5WlFGZFl6bFFi?= =?utf-8?Q?MHjT3tZwT1BXXDZysMmV2bA=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: dab2f38a-f42c-4880-59a1-08dd10499654 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:59.6909 (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: wEM83rl7+hmsDyvMaYmqKdNZPf7CFNLJpd/BY5PM9HxQOaLWUrGOoE1/L+uybhFXmRxACSC7L0phJ7hEszYBJD3v4uXFgZ5/eEaxR4aR+GBOneAiZwPmdjj4KxyviQRW X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866508907019100 From: Cl=C3=A9ment Mathieu--Drif Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- tests/unit/meson.build | 1 + tests/unit/test-atc.c | 527 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 528 insertions(+) create mode 100644 tests/unit/test-atc.c diff --git a/tests/unit/meson.build b/tests/unit/meson.build index d5248ae51d..810197d5e1 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -48,6 +48,7 @@ tests =3D { 'test-qapi-util': [], 'test-interval-tree': [], 'test-fifo': [], + 'test-atc': [], } =20 if have_system or have_tools diff --git a/tests/unit/test-atc.c b/tests/unit/test-atc.c new file mode 100644 index 0000000000..0d1c1b7ca7 --- /dev/null +++ b/tests/unit/test-atc.c @@ -0,0 +1,527 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "util/atc.h" + +static inline bool tlb_entry_equal(IOMMUTLBEntry *e1, IOMMUTLBEntry *e2) +{ + if (!e1 || !e2) { + return !e1 && !e2; + } + return e1->iova =3D=3D e2->iova && + e1->addr_mask =3D=3D e2->addr_mask && + e1->pasid =3D=3D e2->pasid && + e1->perm =3D=3D e2->perm && + e1->target_as =3D=3D e2->target_as && + e1->translated_addr =3D=3D e2->translated_addr; +} + +static void assert_lookup_equals(ATC *atc, IOMMUTLBEntry *target, + uint32_t pasid, hwaddr iova) +{ + IOMMUTLBEntry *result; + result =3D atc_lookup(atc, pasid, iova); + g_assert(tlb_entry_equal(result, target)); +} + +static void check_creation(uint64_t page_size, uint8_t address_width, + uint8_t levels, uint8_t level_offset, + bool should_work) { + ATC *atc =3D atc_new(page_size, address_width); + if (atc) { + g_assert(atc->levels =3D=3D levels); + g_assert(atc->level_offset =3D=3D level_offset); + + atc_destroy(atc); + g_assert(should_work); + } else { + g_assert(!should_work); + } +} + +static void test_creation_parameters(void) +{ + check_creation(8, 39, 3, 9, false); + check_creation(4095, 39, 3, 9, false); + check_creation(4097, 39, 3, 9, false); + check_creation(8192, 48, 0, 0, false); + + check_creation(4096, 38, 0, 0, false); + check_creation(4096, 39, 3, 9, true); + check_creation(4096, 40, 0, 0, false); + check_creation(4096, 47, 0, 0, false); + check_creation(4096, 48, 4, 9, true); + check_creation(4096, 49, 0, 0, false); + check_creation(4096, 56, 0, 0, false); + check_creation(4096, 57, 5, 9, true); + check_creation(4096, 58, 0, 0, false); + + check_creation(16384, 35, 0, 0, false); + check_creation(16384, 36, 2, 11, true); + check_creation(16384, 37, 0, 0, false); + check_creation(16384, 46, 0, 0, false); + check_creation(16384, 47, 3, 11, true); + check_creation(16384, 48, 0, 0, false); + check_creation(16384, 57, 0, 0, false); + check_creation(16384, 58, 4, 11, true); + check_creation(16384, 59, 0, 0, false); +} + +static void test_single_entry(void) +{ + IOMMUTLBEntry entry =3D { + .iova =3D 0x123456789000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 5, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xdeadbeefULL, + }; + + ATC *atc =3D atc_new(4096, 48); + g_assert(atc); + + assert_lookup_equals(atc, NULL, entry.pasid, + entry.iova + (entry.addr_mask / 2)); + + atc_create_address_space_cache(atc, entry.pasid); + g_assert(atc_update(atc, &entry) =3D=3D 0); + + assert_lookup_equals(atc, NULL, entry.pasid + 1, + entry.iova + (entry.addr_mask / 2)); + assert_lookup_equals(atc, &entry, entry.pasid, + entry.iova + (entry.addr_mask / 2)); + + atc_destroy(atc); +} + +static void test_single_entry_2(void) +{ + static uint64_t page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0xabcdef200000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eedULL, + }; + + ATC *atc =3D atc_new(page_size , 48); + atc_create_address_space_cache(atc, e1.pasid); + atc_update(atc, &e1); + + assert_lookup_equals(atc, NULL, e1.pasid, 0xabcdef201000ULL); + + atc_destroy(atc); +} + +static void test_page_boundaries(void) +{ + static const uint32_t pasid =3D 5; + static const hwaddr page_size =3D 4096; + + /* 2 consecutive entries */ + IOMMUTLBEntry e1 =3D { + .iova =3D 0x123456789000ULL, + .addr_mask =3D page_size - 1, + .pasid =3D pasid, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xdeadbeefULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D e1.iova + page_size, + .addr_mask =3D page_size - 1, + .pasid =3D pasid, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x900df00dULL, + }; + + ATC *atc =3D atc_new(page_size, 48); + + atc_create_address_space_cache(atc, e1.pasid); + /* creating the address space twice should not be a problem */ + atc_create_address_space_cache(atc, e1.pasid); + + atc_update(atc, &e1); + atc_update(atc, &e2); + + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova - 1); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova + e1.addr_mask); + g_assert((e1.iova + e1.addr_mask + 1) =3D=3D e2.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova + e2.addr_mask); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova + e2.addr_mask + 1); + + assert_lookup_equals(atc, NULL, e1.pasid + 10, e1.iova); + assert_lookup_equals(atc, NULL, e2.pasid + 10, e2.iova); + atc_destroy(atc); +} + +static void test_huge_page(void) +{ + static const uint32_t pasid =3D 5; + static const hwaddr page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0x123456600000ULL, + .addr_mask =3D 0x1fffffULL, + .pasid =3D pasid, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xdeadbeefULL, + }; + hwaddr addr; + + ATC *atc =3D atc_new(page_size, 48); + + atc_create_address_space_cache(atc, e1.pasid); + atc_update(atc, &e1); + + for (addr =3D e1.iova; addr <=3D e1.iova + e1.addr_mask; addr +=3D pag= e_size) { + assert_lookup_equals(atc, &e1, e1.pasid, addr); + } + /* addr is now out of the huge page */ + assert_lookup_equals(atc, NULL, e1.pasid, addr); + atc_destroy(atc); +} + +static void test_pasid(void) +{ + hwaddr addr =3D 0xaaaaaaaaa000ULL; + IOMMUTLBEntry e1 =3D { + .iova =3D addr, + .addr_mask =3D 0xfffULL, + .pasid =3D 8, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xdeadbeefULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D addr, + .addr_mask =3D 0xfffULL, + .pasid =3D 2, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xb001ULL, + }; + uint16_t i; + + ATC *atc =3D atc_new(4096, 48); + + atc_create_address_space_cache(atc, e1.pasid); + atc_create_address_space_cache(atc, e2.pasid); + atc_update(atc, &e1); + atc_update(atc, &e2); + + for (i =3D 0; i <=3D MAX(e1.pasid, e2.pasid) + 1; ++i) { + if (i =3D=3D e1.pasid || i =3D=3D e2.pasid) { + continue; + } + assert_lookup_equals(atc, NULL, i, addr); + } + assert_lookup_equals(atc, &e1, e1.pasid, addr); + assert_lookup_equals(atc, &e1, e1.pasid, addr); + atc_destroy(atc); +} + +static void test_large_address(void) +{ + IOMMUTLBEntry e1 =3D { + .iova =3D 0xaaaaaaaaa000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 8, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D 0x1f00baaaaabf000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D e1.pasid, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xdeadbeefULL, + }; + + ATC *atc =3D atc_new(4096, 57); + + atc_create_address_space_cache(atc, e1.pasid); + atc_update(atc, &e1); + atc_update(atc, &e2); + + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + atc_destroy(atc); +} + +static void test_bigger_page(void) +{ + IOMMUTLBEntry e1 =3D { + .iova =3D 0xaabbccdde000ULL, + .addr_mask =3D 0x1fffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + hwaddr i; + + ATC *atc =3D atc_new(8192, 43); + + atc_create_address_space_cache(atc, e1.pasid); + atc_update(atc, &e1); + + i =3D e1.iova & (~e1.addr_mask); + assert_lookup_equals(atc, NULL, e1.pasid, i - 1); + while (i <=3D e1.iova + e1.addr_mask) { + assert_lookup_equals(atc, &e1, e1.pasid, i); + ++i; + } + assert_lookup_equals(atc, NULL, e1.pasid, i); + atc_destroy(atc); +} + +static void test_unknown_pasid(void) +{ + IOMMUTLBEntry e1 =3D { + .iova =3D 0xaabbccfff000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + + ATC *atc =3D atc_new(4096, 48); + g_assert(atc_update(atc, &e1) !=3D 0); + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova); + atc_destroy(atc); +} + +static void test_invalidation(void) +{ + static uint64_t page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0xaabbccddf000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D 0xffe00000ULL, + .addr_mask =3D 0x1fffffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xb000001ULL, + }; + IOMMUTLBEntry e3; + + ATC *atc =3D atc_new(page_size , 48); + atc_create_address_space_cache(atc, e1.pasid); + + atc_update(atc, &e1); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + atc_invalidate(atc, &e1); + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova); + + atc_update(atc, &e1); + atc_update(atc, &e2); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + atc_invalidate(atc, &e2); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova); + + /* invalidate a huge page by invalidating a small region */ + for (hwaddr addr =3D e2.iova; addr <=3D (e2.iova + e2.addr_mask); + addr +=3D page_size) { + atc_update(atc, &e2); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + e3 =3D (IOMMUTLBEntry){ + .iova =3D addr, + .addr_mask =3D page_size - 1, + .pasid =3D e2.pasid, + .perm =3D IOMMU_RW, + .translated_addr =3D 0, + }; + atc_invalidate(atc, &e3); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova); + } + atc_destroy(atc); +} + +static void test_delete_address_space_cache(void) +{ + static uint64_t page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0xaabbccddf000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D e1.iova, + .addr_mask =3D 0xfffULL, + .pasid =3D 2, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eeeeeedULL, + }; + + ATC *atc =3D atc_new(page_size , 48); + atc_create_address_space_cache(atc, e1.pasid); + + atc_update(atc, &e1); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + atc_invalidate(atc, &e2); /* unkown pasid : is a nop*/ + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + + atc_create_address_space_cache(atc, e2.pasid); + atc_update(atc, &e2); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + atc_invalidate(atc, &e1); + /* e1 has been removed but e2 is still there */ + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + + atc_update(atc, &e1); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + + atc_delete_address_space_cache(atc, e2.pasid); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova); + atc_destroy(atc); +} + +static void test_invalidate_entire_address_space(void) +{ + static uint64_t page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0x1000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eedULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D 0xfffffffff000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xbeefULL, + }; + IOMMUTLBEntry e3 =3D { + .iova =3D 0, + .addr_mask =3D 0xffffffffffffffffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0, + }; + + ATC *atc =3D atc_new(page_size , 48); + atc_create_address_space_cache(atc, e1.pasid); + + atc_update(atc, &e1); + atc_update(atc, &e2); + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + atc_invalidate(atc, &e3); + /* e1 has been removed but e2 is still there */ + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova); + + atc_destroy(atc); +} + +static void test_reset(void) +{ + static uint64_t page_size =3D 4096; + IOMMUTLBEntry e1 =3D { + .iova =3D 0x1000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 1, + .perm =3D IOMMU_RW, + .translated_addr =3D 0x5eedULL, + }; + IOMMUTLBEntry e2 =3D { + .iova =3D 0xfffffffff000ULL, + .addr_mask =3D 0xfffULL, + .pasid =3D 2, + .perm =3D IOMMU_RW, + .translated_addr =3D 0xbeefULL, + }; + + ATC *atc =3D atc_new(page_size , 48); + atc_create_address_space_cache(atc, e1.pasid); + atc_create_address_space_cache(atc, e2.pasid); + atc_update(atc, &e1); + atc_update(atc, &e2); + + assert_lookup_equals(atc, &e1, e1.pasid, e1.iova); + assert_lookup_equals(atc, &e2, e2.pasid, e2.iova); + + atc_reset(atc); + + assert_lookup_equals(atc, NULL, e1.pasid, e1.iova); + assert_lookup_equals(atc, NULL, e2.pasid, e2.iova); + atc_destroy(atc); +} + +static void test_get_max_number_of_pages(void) +{ + static uint64_t page_size =3D 4096; + hwaddr base =3D 0xc0fee000; /* aligned */ + ATC *atc =3D atc_new(page_size , 48); + g_assert(atc_get_max_number_of_pages(atc, base, page_size / 2) =3D=3D = 1); + g_assert(atc_get_max_number_of_pages(atc, base, page_size) =3D=3D 1); + g_assert(atc_get_max_number_of_pages(atc, base, page_size + 1) =3D=3D = 2); + + g_assert(atc_get_max_number_of_pages(atc, base + 10, 1) =3D=3D 1); + g_assert(atc_get_max_number_of_pages(atc, base + 10, page_size - 10) = =3D=3D 1); + g_assert(atc_get_max_number_of_pages(atc, base + 10, + page_size - 10 + 1) =3D=3D 2); + g_assert(atc_get_max_number_of_pages(atc, base + 10, + page_size - 10 + 2) =3D=3D 2); + + g_assert(atc_get_max_number_of_pages(atc, base + page_size - 1, 1) =3D= =3D 1); + g_assert(atc_get_max_number_of_pages(atc, base + page_size - 1, 2) =3D= =3D 2); + g_assert(atc_get_max_number_of_pages(atc, base + page_size - 1, 3) =3D= =3D 2); + + g_assert(atc_get_max_number_of_pages(atc, base + 10, page_size * 20) = =3D=3D 21); + g_assert(atc_get_max_number_of_pages(atc, base + 10, + (page_size * 20) + (page_size - 1= 0)) + =3D=3D 21); + g_assert(atc_get_max_number_of_pages(atc, base + 10, + (page_size * 20) + + (page_size - 10 + 1)) =3D=3D 22); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + g_test_add_func("/atc/test_creation_parameters", test_creation_paramet= ers); + g_test_add_func("/atc/test_single_entry", test_single_entry); + g_test_add_func("/atc/test_single_entry_2", test_single_entry_2); + g_test_add_func("/atc/test_page_boundaries", test_page_boundaries); + g_test_add_func("/atc/test_huge_page", test_huge_page); + g_test_add_func("/atc/test_pasid", test_pasid); + g_test_add_func("/atc/test_large_address", test_large_address); + g_test_add_func("/atc/test_bigger_page", test_bigger_page); + g_test_add_func("/atc/test_unknown_pasid", test_unknown_pasid); + g_test_add_func("/atc/test_invalidation", test_invalidation); + g_test_add_func("/atc/test_delete_address_space_cache", + test_delete_address_space_cache); + g_test_add_func("/atc/test_invalidate_entire_address_space", + test_invalidate_entire_address_space); + g_test_add_func("/atc/test_reset", test_reset); + g_test_add_func("/atc/test_get_max_number_of_pages", + test_get_max_number_of_pages); + return g_test_run(); +} --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866312; cv=pass; d=zohomail.com; s=zohoarc; b=gYvEyluPNN/TYRRGMVgAt/KsQPrCG4gZ6UMH+L+X6Oj3LOofrrKH3KbVGXguD4S3PbDK0Cw675cfE154toXsjZ/h6S92QsXOqfs+k3MVX+F1cGb8tpKULFor3/Z8wowDnNMvdxiss2vpHYfHaU+DPdGS6fN5/j9AUA3pfp7A0Ik= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866312; h=Content-ID: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=E6spcd+vgURo5mrvsgn1W+za75oPRJn3obf1Yvr5WBA=; b=iCkrcD5WFnOMA7bnj90jzFRnHR4PAG4ASlYjqdAQjNnq9Bp5JF6uU5+cFzyhajQwC9Ev03d9ODTcBtj5VNQDM3RgLxMWVzcfqQYl6KSYkbCfmynWTLPogSOV1c6fl9eKhkLGYdq00LZp5Pm9MXKzM7OluWM9fvFT/AI44HsTTLs= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866312063393.53025060688674; Thu, 28 Nov 2024 23:45:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfh-00080y-Tk; Fri, 29 Nov 2024 02:44:13 -0500 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 1tGvfe-0007zW-Mh for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfd-0002nD-0n for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:10 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:03 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:44:00 +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.8207.014; Fri, 29 Nov 2024 07:44:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866249; x=1764402249; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=E6spcd+vgURo5mrvsgn1W+za75oPRJn3obf1Yvr5WBA=; b=thavWXlzJuTQ/WMynyMUpuC3sh/sqStWRjDcfdUotjPdkCZ3xzk8Hpko PkWOsHdiW7roW54c43jeNjzn26ySUDwH9PhSo5eUEg/EXW/ca0NY6thz7 yk3f5DjLex47SgGc8ciSlwn2hWOD4jqb4wWL3etdKqV5R5nSJ0GLpE29A i5J5XhNrl8zc+hXVtnhMIKuZiLVV3PFD7mdZ36L7keiq3xkIsBoJ/C6cb SsmYUd6eIZNOEsmcGARcwUuamQ+OVtoW3asax6Lmni+S12WaiJ6Vne6O+ 1R/X6J9E+AUgIy8kr656SRb/ZgpLRzIo4aMr6R6iLWl6Iq2+fSPJ4Jor5 g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670815" X-MGA-submission: =?us-ascii?q?MDGfQXAr6yW+NrNSpnBFW0COyFjWbOwHAxxUiI?= =?us-ascii?q?I5auO3aaaXIIx9v8gZpde3M3rHc8g5EtbHswtM3kDZJ8/v8qxjW4CDW+?= =?us-ascii?q?hV3lCa7hnmy3AV/a11jirMDLQjaHRYDUnAc7eKxxxdCi2n5gkhmpyMz9?= =?us-ascii?q?pGYZbdYYbK68EpUV30yu163Q=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Meji/nqoMiq6j8/s1TA2dtibPXoi8gY2Su6WbFX/uzoWd8TSEwAVKGMk2WhArMJkk1UckO1MUqTgSikR/TlLPbahOdvNCGCeLNdFbI9F7FuN94rCJx6LN8HAlenrzE7XOK0hjHPFZwdVoGGbsAP9FzKOzIFGFzRcJCpx6VcUAzj8FsMsFHYQQ2PsInZOraV43bu4hgCol7Kn8PHa2DLir1VDl0aoIml2geHP4DFA0SSH+7hfo10Tjf8KpO6eTGD4hX2GOWvHYAKLa2uZBFoLkfdjvNnoA1UX8RzE4GSCQeSQHA5Gu6dhCJ+7dDu86sCSJLyy3GytknMWbnlKhTbbXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=E6spcd+vgURo5mrvsgn1W+za75oPRJn3obf1Yvr5WBA=; b=sdWHKJutLyUlJse/Iao6fBGRZpzV0bMuTTWHVa1nNYy3hM08GaN16kdqaQhRcaD1TV9FkaNEWs+ayIdudBsgthH7v8NdD5Z/39HZicato64n8UvA+g0rjNmYEYl4fQq7oN2VZ6TukGWmFAUvhp4Z0AQlH9GcrhoeJyMkYasR7cJGB5miPxFY8afHcqGff7mXcgxCkRhK5B5yv0ZJTPEx3ZusDFDiGLA3hVJ/pCTvnswrQsVNuoqu+P0JPs8wMNIUdwTl6uGHp6kNj5n/xcYurY+08qEdPtJCN19W6hG3JPgdnePfjRxqaGDc50keZ0QiN6nTxXm9JW8MSVhHfoxp8g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E6spcd+vgURo5mrvsgn1W+za75oPRJn3obf1Yvr5WBA=; b=XPYqO/n1M0PD7T12y6NomIw4gtNCZXpFqkD8x1UTZ3MGJmOG356hdBQU8PZDORELB8cZr0K4XEJt+dDk0il7UgOjDFbpHSvH3X+Ht6TotRzXA0J2Dox+GQuT+iizKFUGeAP8/pL8d/Q87xPnwKcuNFvdl8SecOaiZr3uLohm9dA+OwpojW7yseVM/P1/ZpmPqY5thBUiRk9svHCU09q1DtsjLKHxUchzXss1oPfmQXC1rxOI3D/63mnE5KsWigI9NsgWI2SzTmLV0NW5K6t0jkEIDDclVEsbKvbEDeWnIpjRHperfs/DborvRsnrYo0B9f5JNRNjBO7DfQ4aHWn6dA== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 15/19] memory: Add an API for ATS support Thread-Topic: [PATCH v1 15/19] memory: Add an API for ATS support Thread-Index: AQHbQjJ0k0DlGQgy0Eihqb6cUgrbzw== Date: Fri, 29 Nov 2024 07:44:00 +0000 Message-ID: <20241129074332.87535-16-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: f20bae39-f0af-4179-1a2a-08dd104996d5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?alJJWWdZV3FSMXFqa3Z0d3cyUXN6bnFBcTdUNTdKMFg4Qk0zUXI2WHQ2V1o3?= =?utf-8?B?VVZHYTNYbzBKaDc4TnVHY01uZTk3M2Q4YTNEcXVjd2xObngxNTFmVEU0U0Qz?= =?utf-8?B?ZHRtbmpZSEx5NThHbk9XYm4xTEhlejZkRWxOUDBRcEFETWRXazVnYzBTUjc1?= =?utf-8?B?ei9BZldiNml0OVdOVnJ4QzhxV25nVnMwenlWQ0lsY2h0K3ZCZEQrWmdtNk41?= =?utf-8?B?ZWwySzlTbUJ5Syt6a1gwSU1NUlVtalFUUGg3UG9OS3JzRnNqdzdtT0ZETHc2?= =?utf-8?B?U0VtbzE0eHdyZnZlUENhM0NKcHB4aS95SWFzV1RsemtlYTVTc2diZnQwR0lh?= =?utf-8?B?UmFBaHlOWWlEYjN6ZSsxc3lqcmlNMzBwMituQWs1WGlUZHJITElyczhxWndF?= =?utf-8?B?Y3l6QjJNb2s1OWZDWlpXN0pKY2JIK2l4bnJHVGRkdGJDU3NHell1bU9Cajg0?= =?utf-8?B?SVhNdVNKdnhid2ZMYXBIVnhjQ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Cakgxd3hJVlhoT3A0QWNPTklUTk16VVQxS3lGeXk4bXRNMXNoclJF?= =?utf-8?B?dXFOZzJLdUEra2loUDYwblkxcUh1dituUVYvWThUWEtxMW8xR3grNENPQndw?= =?utf-8?B?Qlg4QVVWOGVvejlpZm5lRkd2QWdQWHdxWEhCUkhRVUhLMmxlOEdQQ3p1S2M5?= =?utf-8?B?VllMejJpRHo4QjlvbldLUXNsVHB1VmtwbGFLNjlJNThQcmpHQi95bW9mdVBo?= =?utf-8?B?Wi9HQnpkdU9SN2tuS0w0K3p4OXEvZHc3S3BOU1JPTnNTTHpCSWhjRlpGQ1F2?= =?utf-8?B?TUFGanpnYUZObXBVU1lxaVVuaXl3UFRrUjBYMzN2WkxMdUwwVkEzZnZFRUNL?= =?utf-8?B?TXczb0ZNai9qNlFYRXpSVXBNa0dGNkZPM1lpYXBtMS9FUHhLcWxtVTFMKy9O?= =?utf-8?B?MUtnOEdyeTdCR2dnaW8zYURQaFJsWkZVMXVyQjFPVVZCVFNOaXhUejRoZlQw?= =?utf-8?B?bXNoZmE0TXhsRVNxeXFmb0JDZTZCM3ZOWFBBbmR3QkFianc9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?TVNqLy9tdGZ1eUdCY1Q4cG5WVWd1TEdKekd6UkdZSFA0NjBJcTF0K3A0QVJK?= =?utf-8?B?cHMwYVE1bG9tYlJmYk5rNUw5Nm1JSzlxVmtGd1FjQnZMU1l0VHladW5CU3ln?= =?utf-8?B?Y2VaNnRxRGo0TTRHbjlQWlg2VWxNWUxTdXA1Z2didnpka3hnMEVkVWNVY0li?= =?utf-8?B?M0dPTnpDS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cWFTZWVGOHJ4ZUFuNUNZbUlWOERhc0VH?= =?utf-8?B?dEpsdlR3ajFJbjVscUxsUlIyRVVOTm40VjRzM3VyUU1IQmVqMlIwcE4zSysy?= =?utf-8?B?MW1PTHBLdy85RU1rejZUbG81aUJJVUJJUkNuTy84bS9WSExqNnI0WUF2cjIx?= =?utf-8?B?bURwaTFJSTV4TWhtc3ZsZnlNY25lMU1mTisrVHZtUG14SDNKanhlY0tINHpy?= =?utf-8?Q?r3y1riLUEWqweeIQ8a+yyIA=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <778FE744520ED44CA741A72C8B1A86E6@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: f20bae39-f0af-4179-1a2a-08dd104996d5 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:44:00.5066 (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: qkVIpoKT0EY4qhPbT2F/6hlTN4jEToZYdbL8BiJL8/MlzXa/2rf0JksC9Z63bSOPi6psiHOIJ6NxJJaVQW9iVjmhGBDQ8w9lLSaI7rOEDly75GreMRo8wDisqxhW7PlO X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866313765019100 From: Cl=C3=A9ment Mathieu--Drif IOMMU have to implement iommu_ats_request_translation to support ATS. Devices can use IOMMU_TLB_ENTRY_TRANSLATION_ERROR to check the tlb entries returned by a translation request. We decided not to use the existing translation operation for 2 reasons. First, ATS is designed to translate ranges and not isolated addresses. Second, we need ATS-specific parameters. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- include/exec/memory.h | 26 ++++++++++++++++++++++++++ system/memory.c | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index c0d064dbd8..14166e2874 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -148,6 +148,10 @@ struct IOMMUTLBEntry { uint32_t pasid; }; =20 +/* Check if an IOMMU TLB entry indicates a translation error */ +#define IOMMU_TLB_ENTRY_TRANSLATION_ERROR(entry) ((((entry)->perm) & IOMMU= _RW) \ + =3D=3D IOMMU_NONE) + /* * Bitmap for different IOMMUNotifier capabilities. Each notifier can * register with one or multiple IOMMU Notifier capability bit(s). @@ -525,6 +529,20 @@ struct IOMMUMemoryRegionClass { * @iommu: the IOMMUMemoryRegion */ int (*num_indexes)(IOMMUMemoryRegion *iommu); + + /** + * @iommu_ats_request_translation: + * This method must be implemented if the IOMMU has ATS enabled + * + * @see pci_ats_request_translation_pasid + */ + ssize_t (*iommu_ats_request_translation)(IOMMUMemoryRegion *iommu, + bool priv_req, bool exec_req, + hwaddr addr, size_t length, + bool no_write, + IOMMUTLBEntry *result, + size_t result_length, + uint32_t *err_count); }; =20 typedef struct RamDiscardListener RamDiscardListener; @@ -1883,6 +1901,14 @@ void memory_region_iommu_replay(IOMMUMemoryRegion *i= ommu_mr, IOMMUNotifier *n); void memory_region_unregister_iommu_notifier(MemoryRegion *mr, IOMMUNotifier *n); =20 +ssize_t memory_region_iommu_ats_request_translation(IOMMUMemoryRegion *iom= mu_mr, + bool priv_req, bool exec_r= eq, + hwaddr addr, size_t length, + bool no_write, + IOMMUTLBEntry *result, + size_t result_length, + uint32_t *err_count); + /** * memory_region_iommu_get_attr: return an IOMMU attr if get_attr() is * defined on the IOMMU. diff --git a/system/memory.c b/system/memory.c index 85f6834cb3..7f6f3798e6 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2011,6 +2011,26 @@ void memory_region_unregister_iommu_notifier(MemoryR= egion *mr, memory_region_update_iommu_notify_flags(iommu_mr, NULL); } =20 +ssize_t memory_region_iommu_ats_request_translation(IOMMUMemoryRegion *iom= mu_mr, + bool priv_req, + bool exec_req, + hwaddr addr, size_t le= ngth, + bool no_write, + IOMMUTLBEntry *result, + size_t result_length, + uint32_t *err_count) +{ + IOMMUMemoryRegionClass *imrc =3D memory_region_get_iommu_class_nocheck= (iommu_mr); + + if (!imrc->iommu_ats_request_translation) { + return -ENODEV; + } + + return imrc->iommu_ats_request_translation(iommu_mr, priv_req, exec_re= q, + addr, length, no_write, res= ult, + result_length, err_count); +} + void memory_region_notify_iommu_one(IOMMUNotifier *notifier, const IOMMUTLBEvent *event) { --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866375; cv=pass; d=zohomail.com; s=zohoarc; b=PR0uvEhWpChrO7uBJKAMhXrq26ISa8H70gE3Z/u0CbQIX+eWDNWWIBCL0aXHUbktha/eWa0wEyiGRfD9SCAR1Ldr3e6K4EkDx6ItffW56KBo5er3taHHc+Nkgxfma7U1uajefMX+5ZS7A9oC9DUIec+U4l1rJMiJg5+MybDPDfo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866375; h=Content-ID: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=vYT7O3CmbHBot/TrWbgm+CGz6yYH2nqqj0xRWpdTDT0=; b=NBJD4MCpqtiEt30MTFnBPdL8W2D/uK2URH1MFQnold8kkA+rn7pmNebAl+yM7QsND3L8jLLwilGZoDGGKyrLp3GqDno1LuCAKkiR1lcoaeObB/Pt/eqc3QAA9h8ZhJL+PXBag8gAJM4odhPi/dL3US3FBfRUxMRe/Y6bHdagnX8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866375109609.1837164290505; Thu, 28 Nov 2024 23:46:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfj-00081m-Gb; Fri, 29 Nov 2024 02:44:15 -0500 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 1tGvfg-00080X-Ac for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:13 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfe-0002nM-Jw for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:12 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:04 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:44:01 +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.8207.014; Fri, 29 Nov 2024 07:44:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866250; x=1764402250; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=vYT7O3CmbHBot/TrWbgm+CGz6yYH2nqqj0xRWpdTDT0=; b=xJbU31GgV03COYoYanORSYPh8xOVZXFvCKse670MbwA1T3auf6ea3uR/ b/DcsDYFQ997B/qMzU0Kee3OpN/s6xzhXTXVxZSlC+w3QlIT+PYIo28zG 22itXrJdMjDOqp9BN7gP0oSOj6z3bBlwu0kCxn2HqoMtBhQwGOKxyO+pq 19Lbzfwt/CjcaomAEV1cvmNXp6Y6olNIFnOxg6QHGATXm++/75Ukdn31Z npaT1LbAkVQwFNHkGaJFGI4gSCyZ3i4CbRm2fLJQM0JgaoS++hFHFL59P fm/9oD5dNVctGB9lQrsKDbKGrDhx92vncOIzgz87t+xDBF5qGHC9CCzn5 g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670816" X-MGA-submission: =?us-ascii?q?MDGDX/2qiBNAz8q3yiCuhFN6bRlJlS7XeZ2irm?= =?us-ascii?q?1R0QKfiyvycmwWdxaQuwSQFjuYxPzVabHSgQ5fOpSnvBVytxTB7RXEfx?= =?us-ascii?q?WFqkmZ8LmIMP1TX5GO1G1O6fYyoSDvl5M1RZoQ+YhKIl9Gag1eH8rQTn?= =?us-ascii?q?eja1oPiUwKsnD1RjerehBTew=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MWOhvSugvkNgGBn9utqFZ4H+bsHoyiBW85jFA/sShUMFIFBFpDn1+R+bmITsFWPKZDpkoXufclPmDjRrcF9chW91g70mRi4oQvHAywTx37JWoKvxwzzGx+wcCN4M6CEN7hZl63KkgQkaH4wTbdOeGZvbdCSKTCgHw/w2X8jfW3YVemDn8PmLtvBZ6twoRakg29fTI6ucLV3purD7WTVvem3txHkudyfdHTr4E9KJUIvXpL8tWrr9WoX3XdYbncfb/ym5l5YBgmdcLU9nyvNK1M/6+z/wTYWZDyMvDlBhJlaoj8Wqfi9M1udIxKlAGQJJ3QP/dxTFT4qf0aPJXHWyOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=vYT7O3CmbHBot/TrWbgm+CGz6yYH2nqqj0xRWpdTDT0=; b=LKwSBt/9/ZqB1oIpxHc+7OG21eUC+FOBmyJ3+kqL85k7CEZNfSMUiXgank3940vwfWeL4aPGR1IOE1As1hbLgHupLSg2l48WukNcwN51PFgOmIX4hGRfgEWvw+ULm65ZnJWe9ol7qwt9H48izg41Qi0Ph4O1pFDatU2/ICyvVWWmQQ3i6W5YXGNui9Ecz3uRZb9hDtVnV1+3RsQtgxxCv4h0qDx+hF422DsYXwwNze9GQ80e/NTOhe9u3kGt/kSoRxw99KaroSY57Eptc5liNbY3OXj0IWB5/fP2hzeU+oNnXPgvN+9ZLB/stt5uvZ0X/v/IEYfRWkJ2ebCrkXYPLg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vYT7O3CmbHBot/TrWbgm+CGz6yYH2nqqj0xRWpdTDT0=; b=ZN95RiaF9h8jwHjlHQdQvBDWV6lByFg0fS9LCg4XU/NT+zyvPxNeEQs49h0u+LxL5U2Wg3dzBvQ8VoKcSyXDpl8Hxw6dtx3hLG5s6uk0Wmua/kRRwwq+MJm406XSLSshbKxB3zlDfeSTvoMlb1+drpv15qvyaUltW+CISFt/iRNJp3sb6jekglsQNXC00jD3crzBSnmM2UiplU9LF7lfVbfJPHQluy+tE5MalPZeal9J65z4/4dHpwrFiIflNH0xnMoAxlV2E6o+1Q3YtNzAoeghBeVmJsduGHxUUA/e+JOeA3dsDrlIN5VnkXc+S33y5rSh1mBn3JRvYPcc2zz59Q== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 16/19] pci: Add a pci-level API for ATS Thread-Topic: [PATCH v1 16/19] pci: Add a pci-level API for ATS Thread-Index: AQHbQjJ0APXgNcpLuE6g4EiGuYqvbg== Date: Fri, 29 Nov 2024 07:44:01 +0000 Message-ID: <20241129074332.87535-17-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 341eb73c-8094-41a2-0617-08dd10499751 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|4022899009|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?akthZW9TcElQNXlqTDljc1gyYTdIRDQySjhWalRXcTB6eE1nVUg3UUpTZzdS?= =?utf-8?B?MjVhZ3RwTG40R09DLzNiakMrZHl4dmltZkZ0TkFxNDllY2JFUHByaFhUZnRo?= =?utf-8?B?MGlFdXFOckN5eVhPRmRIekxyTG5tblBpU1ozdDhqZkhSNWorSmErcUU4Mmx2?= =?utf-8?B?MEgvZlpEMmlDUWVKMEJZWHdzckMva0ZBUEhJWmE1UkQ0Yi9QQVhKS25FVCtX?= =?utf-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(4022899009)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?SEYwR2xsYjJXUFZmd0MxOERGSVcrcWZOM3dzK3Z2bUVjRXVXM3R0by93aFFY?= =?utf-8?B?UGUyenNqeUd6YkU5OHZIRSsyVktlbC92ZXAwT2cvQlJJckFUT09xQitXUUJ0?= =?utf-8?B?c0I3cjQrd2ZoQnk2clhvcXVsbi9PMEJQc2xycjJYVzg0Nmt1bFpzU0RQOHhN?= =?utf-8?B?VzFhVmVHa2pxL3VLaVp0b3ZHZHdaaFFzOWpxb3hhdEVDY2Z5WndwYkt4eCs2?= =?utf-8?B?YjNPWU5tWGIwWXEvaVEwZWNzR2dUWUxmdzJkUHpwUm9OK2gzc0hwbXBNMGdV?= =?utf-8?B?YXFuMkZYQmdxMGdLeFN4TlF1MnVSNlhHL1p2REhOK1F1bmwwYjBBYzAzekpB?= =?utf-8?B?eTU4Qnh4aW1DUEltNDkxc2NmemhaN2R6M083L2V0Z05BNHZjS0xFeHdJeDVj?= =?utf-8?B?MjFCbGJNbWV2eWJSWXdyVnRUaDVWZFE2NGxud3NYbVQvMzRrU014NDNOTW1h?= =?utf-8?B?MEhnUUxMbFFNdlk1czdaV1o1M0Vjc0VHb1YrekF3b2pEWGNpeHpseUdlRElk?= =?utf-8?B?U1hyTElmL0Vtc0dKSk9pSE15V0NUZUtreGV0eDdaMjM4UEFJUUNiTUNJekxT?= =?utf-8?B?Q0hsRzlsdWkvSXZUV1pNdTAxSEQ2bmlNai9xRFhiU1RIbmFyRDU1cHJqYllW?= =?utf-8?B?NzdwUklVb0gxVWdMb2pKVVlhTzgxdlFhVVo0NUdKbHpEbzdpbDcyTnBDQTg1?= =?utf-8?B?ZHNxSDBKanF0aWlhaGNpamM4eFJrWmdqOU1RWmlySlNYaTV0cHg5OXo2a0l2?= =?utf-8?B?YmpFYnZmcVRYeHR2NEdPd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Yzc1BrT3AwZXlvUEdEODM5ZkJQRy92TnRKR2J6YjdnMUk3NzNENy9rV1Bz?= =?utf-8?B?NTNldHhrR1NOUEpDWk9Nemt2QkJIV0FPRnp4OG5nV0JiaWh2OVFxU2FYUHZI?= =?utf-8?B?RCt4QTd3eHdKV28rbW14R3NGZFBCZks3Uy9WTFg1K0RvTWJUeTVrVk5MUW5h?= =?utf-8?B?eCtCNlBxSkZNcnMveCtVU3FFUnVleVZ6c1Jub2VwRC9SbnJIaCtPTzJmNkZZ?= =?utf-8?B?SEh3ZjBPTFVRUTZKUGpsVmVRakkzV1ROVmlMU2htMG5qUTIwVk1UMEFvcGRk?= =?utf-8?B?Ri8raUI2UE90SXlRSi9BeUViUjc1MnloVkVDdk9qMU1vRm5jRlZUdldLQ1pK?= =?utf-8?B?K3kyQlM0QU1uL0o4QjhGK1VtbVdRY05sS2c0bmxsNERhUkxNZzFENk5jQTVT?= =?utf-8?B?QVZtR1JHSXgzcUw1REhVdTgreFo3R2lyc3drYmtZdlk2dmd0alFtcmpQRjM3?= =?utf-8?Q?VCXtjzHjbWEUxrbPPZyrKFw=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <632A854F651E234F8932097EAEA280BD@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 341eb73c-8094-41a2-0617-08dd10499751 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:44:01.3279 (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: /kz1UkzW2ysIpqRbr1DGctv/C39obcgdUasmVqkuewAa2uwtfXuP4iwHBKS4Ztlohv9RdrqIKwWB5VX+ynqjt4oiYmdeYf9JIelhxLxQBv/ir+OWMzC+zjhlmw8eZVsC X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866376111019100 From: Cl=C3=A9ment Mathieu--Drif Devices implementing ATS can send translation requests using pci_ats_request_translation_pasid. The invalidation events are sent back to the device using the iommu notifier managed with pci_register_iommu_tlb_event_notifier and pci_unregister_iommu_tlb_event_notifier Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pci.c | 46 +++++++++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 435fcb6c78..7245089011 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2844,6 +2844,52 @@ void pci_device_unset_iommu_device(PCIDevice *dev) } } =20 +ssize_t pci_ats_request_translation_pasid(PCIDevice *dev, uint32_t pasid, + bool priv_req, bool exec_req, + hwaddr addr, size_t length, + bool no_write, IOMMUTLBEntry *re= sult, + size_t result_length, + uint32_t *err_count) +{ + IOMMUMemoryRegion *iommu_mr =3D pci_device_iommu_memory_region_pasid(d= ev, + pa= sid); + + assert(result_length); + + if (!iommu_mr || !pcie_ats_enabled(dev)) { + return -EPERM; + } + return memory_region_iommu_ats_request_translation(iommu_mr, priv_req, + exec_req, addr, len= gth, + no_write, result, + result_length, + err_count); +} + +int pci_register_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n) +{ + IOMMUMemoryRegion *iommu_mr =3D pci_device_iommu_memory_region_pasid(d= ev, + pa= sid); + if (!iommu_mr) { + return -EPERM; + } + return memory_region_register_iommu_notifier(MEMORY_REGION(iommu_mr), = n, + &error_fatal); +} + +int pci_unregister_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n) +{ + IOMMUMemoryRegion *iommu_mr =3D pci_device_iommu_memory_region_pasid(d= ev, + pa= sid); + if (!iommu_mr) { + return -EPERM; + } + memory_region_unregister_iommu_notifier(MEMORY_REGION(iommu_mr), n); + return 0; +} + void pci_setup_iommu(PCIBus *bus, const PCIIOMMUOps *ops, void *opaque) { /* diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index b21448bc2a..f142e17a2e 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -458,6 +458,58 @@ bool pci_iommu_init_iotlb_notifier(PCIDevice *dev, uin= t32_t pasid, IOMMUNotifier *n, IOMMUNotify fn, void *opaque); =20 +/** + * pci_ats_request_translation_pasid: perform an ATS request + * + * Return the number of translations stored in @result in case of success, + * a negative error code otherwise. + * -ENOMEM is returned when the result buffer is not large enough to store + * all the translations + * + * @dev: the ATS-capable PCI device + * @pasid: the pasid of the address space in which the translation will be= made + * @priv_req: privileged mode bit (PASID TLP) + * @exec_req: execute request bit (PASID TLP) + * @addr: start address of the memory range to be translated + * @length: length of the memory range in bytes + * @no_write: request a read-only access translation (if supported by the = IOMMU) + * @result: buffer in which the TLB entries will be stored + * @result_length: result buffer length + * @err_count: number of untranslated subregions + */ +ssize_t pci_ats_request_translation_pasid(PCIDevice *dev, uint32_t pasid, + bool priv_req, bool exec_req, + hwaddr addr, size_t length, + bool no_write, IOMMUTLBEntry *re= sult, + size_t result_length, + uint32_t *err_count); + +/** + * pci_register_iommu_tlb_event_notifier: register a notifier for changes = to + * IOMMU translation entries in a specific address space. + * + * Returns 0 on success, or a negative errno otherwise. + * + * @dev: the device that wants to get notified + * @pasid: the pasid of the address space to track + * @n: the notifier to register + */ +int pci_register_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n); + +/** + * pci_unregister_iommu_tlb_event_notifier: unregister a notifier that has= been + * registerd with pci_register_iommu_tlb_event_notifier + * + * Returns 0 on success, or a negative errno otherwise. + * + * @dev: the device that wants to unsubscribe + * @pasid: the pasid of the address space to be untracked + * @n: the notifier to unregister + */ +int pci_unregister_iommu_tlb_event_notifier(PCIDevice *dev, uint32_t pasid, + IOMMUNotifier *n); + /** * pci_setup_iommu: Initialize specific IOMMU handlers for a PCIBus * --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866285; cv=pass; d=zohomail.com; s=zohoarc; b=dz+OM2nuorN2/N15zdp6Ue0iFAyD4nXQ40KOhHASAJg1tdbMQCSvdrmxa8U0NPASRKjS4I2MO1XAZEtJ+WOF9+3eRk2xltpx2EazSYBTP6vXPbSo9QUBp43ozEm/uSZMP8IYMD78wmCijFU6fUJrwMSOE56EwdNlzOPzHRh5I18= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866285; h=Content-ID: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=VTiec8G5rIHL0vyL3mg9SgoFhCVnChkHAUp8DJ/M3N8=; b=E0fTNw5DrO430UExulJ/tJFUiSz+iFO5JEsoBXH564aplaHWKl6T81buKmERMAkOa+1TM5AHOp/4o9iG6KtxuJvsqtGeQlusC8n/8JlXssXxBx5pvc6rS+1QXrmr/bd8fbjEy3xL8kaC8mbOPGqe6Z4Ak9BoqrTEqyXUodjyMmM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866285770563.2716190847095; Thu, 28 Nov 2024 23:44:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfq-00085y-5B; Fri, 29 Nov 2024 02:44:22 -0500 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 1tGvfg-00080Z-LG for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:13 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfe-0002eL-W1 for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:12 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:05 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:44:02 +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.8207.014; Fri, 29 Nov 2024 07:44:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866251; x=1764402251; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=VTiec8G5rIHL0vyL3mg9SgoFhCVnChkHAUp8DJ/M3N8=; b=rdOAq1EJTn1QAbAfmRWlDvBOLNqPXl1iIOSWIh5EL6KHQpK1Z1UiYvey mWMmqSQktvnG3EMYpo69AHHa4sALDKzY5xlphxnaaj73XHfmqqMJZY5H9 c5Nc9O8PH7LFSFyRLdxF1DLfoavotE7YWI4ADMacahr0QUoaZy2ERJSXi 2oVs8OpOmii/57h5IStca2mpz/DrjRWCizIIXccUFrai69Ij495VA0clL S5un0hrqa8yzJfX3WxP6dqHfjjDgNjNXdOZeo0+tBapLfQomH6yM1bBs1 U7qNdpimRSVPXIXbOtBC5HpnxR21PLBqjLshUUamVlUaNoBKGXL8UQgrM A==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670818" X-MGA-submission: =?us-ascii?q?MDF9rLqqPdRhk/SkqYl4+2pU+GWhU4rzd8mgme?= =?us-ascii?q?q9V/uhoN1hac8REYx4Dk4otXbs63DnL1ZvK8/5oeOdgqRp8KbeQuSPvU?= =?us-ascii?q?EOqWSNqjdg5HJT5jj+ANVs97aoJA22YCaiyzuGcDk2zOBCSVbt3FsQ+c?= =?us-ascii?q?SwNjoHoWqlfwGHCQ/xdGvOiA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PhQH/BfjHmQISVcVvQ2C1s3xMaXLEBM+4iTpeLuc7mmHjEuuhvA7zQ6/MKLljZxnYxcWosxU73J/TL2Uf5embeYDZrh6JY4yFse9zBYYRqA/BsmOoFaB8haAfi5LKCo3sVWlc1CeENQnEJRnAIeDWXe+Ux6BETaAAJBcgaJt4ZBN81VPSY+lTmuIFmu5m3cnjJyFgg6ll2G7XmVBg0oi9SDZIGjqWmJVmNnkYzZGuerK5LGFVKzVBpIX76b3G5xWIdSh9ZMMs2N0LjgczvNONoggDywA7ldxu22Ryx/xYOhNN6gtK10vaQr7+7cSgQXYjIHpqj8aaAdboWLws34cqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=VTiec8G5rIHL0vyL3mg9SgoFhCVnChkHAUp8DJ/M3N8=; b=L3TFMwUxYPShuIzB2OLXwI9stNxoGik0UgS5FE5jc4NSEv8cclyjvKd+gr0o2U+4cjuuRIfN06aygSzxqEPo/OwkTM61hCuWJJFb50YnG2phS3GuKdfVOdzmDPRODV/fLY1bRY9FokTgyMX9cgu+d4Z+eArijafd79yAKJodL6eWgmGtpeQNGrFF6MKmg2HmG6CsSQ6rGHQRwbYqv2a1cKgwOvg5FIp+tSXj4gwFLWPHSTd73kcoGZYpveY4yHp2mW8WkhmufZmAttlZo9+fIhvyF1tJC9hW2Lbslg98hh3wftUKI71xpnDab+GfvMsFP2cCdi98X1EHtr1DEyirMw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VTiec8G5rIHL0vyL3mg9SgoFhCVnChkHAUp8DJ/M3N8=; b=YHaWhfKPDZ5zS7mY5eqkguQh/ptjqJs178S7W8AKJjxDbijueK8MU0UM1yHCafeEAB7m4vN8nREVNZQQIQPpH/dkkukPLNFNJ3q3ae/8NQuw6/yVrnYHCcve5ONnnR5zY3PB8bIb5ES4jRZdY3AbQi2VzpwyWG/roxFHkpkPjQ8/VK0+ALKhX7FAVb047y+lDr7vIs4ihSAJ20eY4Uuhc0mFQITU/Gxt3W5zfMOpkVNXKuY8wBSbR/qKxUKveQj+RxuUO7N11K3CgiiGFn4qhjxYJ4bR0bSfboY5O+oNwN/Oa9QtUEuTvkXXl4vTUdYnsfZDASyo+zGsS7B5un17Jg== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 17/19] intel_iommu: Set address mask when a translation fails and adjust W permission Thread-Topic: [PATCH v1 17/19] intel_iommu: Set address mask when a translation fails and adjust W permission Thread-Index: AQHbQjJ1rB7nLH1SCUaPPBOjd8HJ8w== Date: Fri, 29 Nov 2024 07:44:02 +0000 Message-ID: <20241129074332.87535-18-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 6d5246a3-0740-4f2a-0687-08dd104997cd x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?MWU4Z21EcWpCZUY1dU5EVU1pekFTd29iQ0MwUENiZTVIYlZNS3g1R1Z4Mk05?= =?utf-8?B?UWhhWEJhZUdiWTNDcmlHZ1VrWU14cFc2NDJlR3hvQUsyT2s5SXpEd2xPRlNr?= =?utf-8?B?QXFaZGhTZFZsQmdOUnVyUDRaTnYzNlJMZzcrOFhQK0c4SWdEaG5CN0R4a2RY?= =?utf-8?B?Zi9iL1pESmNuSnZjNjhEUUJMVmo4SWlpbFNrbnIyQVJUbFpJMDlvU0RHSHVZ?= =?utf-8?B?Q1lsMG0zRTRwbGRXWmhNVGNzeWhuSFdmVkN0SGZCa0N5ZExhV2lTZXB1c21C?= =?utf-8?B?RzAzZ3JiZm53UlpPYlRCNFE0M2hnbWU5dytpZFpYWVJpZ3psaEFtNGh1ZFFJ?= =?utf-8?B?eGh2NWsybUVKRURqd2tncmVOa2ZIMGNjQ09WNnEwQjNjVTJNZ2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mUycjRBYW50ZHZBRTFCcG10YWlqS2ttZTRUOUlOVVVY?= =?utf-8?B?TnJtQUljZC9iMXFZMm1lZ0pnL3V1OXZEOTZ3NG1LQVFDS1FqL3VQK0tUZWVS?= =?utf-8?B?QXJvbGZwT2gyQUtjWHBLY0R6cnB1Z1RyemFBblVmREplOUVqaVc4Z0RtSFZu?= =?utf-8?B?Y0w3ZzZZSEZ0NzBvYVZwZm1EajJ3Y1BCMFpTazFGRHBJV2I1OGdWTUhZWW81?= =?utf-8?B?YW5aaDRIK201dVdYQXhETm5HbmdnUmI4eUYwaFdtbmdYTmRwcWU1ajFjNktj?= =?utf-8?B?ZEJhS0gyVWt5SlBMdmU1cm5zekVrWDZaQmFlYkQzZ2lnQW5NSnptck43cUo4?= =?utf-8?B?VXI4b21wOU1rZW8vS3Q4MFo3cUdNYW1qKzVWTTU3NVUyaFUzMTlISXRxeDFM?= =?utf-8?B?MWV5bWhSdDdsL0YwOW12YW5JeEtQaEdjdDVRMlNHYU5jSnhWcFVsbVJ5Tmtu?= =?utf-8?B?Si93cUhGMlh2b3pnUCtCRzFjMUNWSklVWGJMU3Zob0VIcUxJS1ZZZFV1bjBI?= =?utf-8?B?ellVRzQ2Vjk1aERlSUJobHF6N1g5TU1SZ0ZZYVNHc09qaEY5VWhoZGJDRVVT?= =?utf-8?B?MlRJZFFKNkY3SGh6ZjJjekR4bHJ2cEptQzRYTzJCdFBqZWc9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?RC9Pc21hTmRKVlhBRXo4UmJXM2NQb2RoUGhYMkJYbzVyT2VSOFNUdjNlYTA4?= =?utf-8?B?M3Yy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aEFWaXBhQUVlZzVnMnpWTGp0?= =?utf-8?B?V0hFbThJa0pmZU96NVlQSWFkRnIwc1RxTjBWbHdiN0NXNmZUQW4zdmVmaTZ2?= =?utf-8?B?MUYrYmd4TUZFSWd3WnZ6TnVEM0ZnZXBNRVF5YnlTVENKU0xsKzF1dE1tM2JB?= =?utf-8?B?N1RMOEZyN3pYUU5paVlyRHl1SDdaUkowNDJlNGJjNkZtTmVialY3Z2tTd3Zh?= =?utf-8?B?OWFVTEF0dkNSQ0FFS2pWNXU2RlVDNTJOWEMrWmFFR1ZqQXZWSVVnWUd1R1F5?= =?utf-8?B?OVcrQkhCdjZxQmN2RUhCMDJEdTBFTXhoN01WcG52dHIrRGdxWHFBUDdnT0pG?= =?utf-8?Q?pxujQY/2UdJ46DUS/RJBkrw=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <746DE87AFBF2F346A4B53915677E15F5@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: 6d5246a3-0740-4f2a-0687-08dd104997cd X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:44:02.1539 (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: Otnc7ndX4mrDB+SfB3Egxjdv6qBO4BWWIlFNvDAEZhsCqcA0AzpgtmVa96JTZjr13vHXGRYm6B7+Tyw60dAkedqRLM2cF7u+rA5I1Ow50814ML3EDYvhjHHCwbXQsVqi X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866288067019100 From: Cl=C3=A9ment Mathieu--Drif Implements the behavior defined in section 10.2.3.5 of PCIe spec rev 5. This is needed by devices that support ATS. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 7e8676efb0..0637437552 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2100,7 +2100,8 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *v= td_as, PCIBus *bus, uint8_t bus_num =3D pci_bus_num(bus); VTDContextCacheEntry *cc_entry; uint64_t pte, page_mask; - uint32_t level, pasid =3D vtd_as->pasid; + uint32_t level =3D UINT32_MAX; + uint32_t pasid =3D vtd_as->pasid; uint16_t source_id =3D PCI_BUILD_BDF(bus_num, devfn); int ret_fr; bool is_fpd_set =3D false; @@ -2262,7 +2263,7 @@ out: entry->iova =3D addr & page_mask; entry->translated_addr =3D vtd_get_pte_addr(pte, s->aw_bits) & page_ma= sk; entry->addr_mask =3D ~page_mask; - entry->perm =3D access_flags; + entry->perm =3D (is_write ? access_flags : (access_flags & (~IOMMU_WO)= )); /* pasid already set */ return true; =20 @@ -2270,7 +2271,12 @@ error: vtd_iommu_unlock(s); entry->iova =3D 0; entry->translated_addr =3D 0; - entry->addr_mask =3D 0; + /* + * Set the mask for ATS (the range must be present even when the + * translation fails : PCIe rev 5 10.2.3.5) + */ + entry->addr_mask =3D (level !=3D UINT32_MAX) ? + (~vtd_pt_level_page_mask(level)) : (~VTD_PAGE_MASK_= 4K); entry->perm =3D IOMMU_NONE; entry->pasid =3D PCI_NO_PASID; return false; --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866507; cv=pass; d=zohomail.com; s=zohoarc; b=VvDcxCcnTcMUBDhuznWblC/d8kaYLYGIEuf7DZG39gnKuyHoNXXHNVfgnMR2MHnxSC5firkFpNH2V2d9eEoWWz/QvFoKTPlQ55CNrS9x0wP1Ti6IMHS5SDZrozLIaQ7bh/zL2bhw7hQ8xfEBsBBc4GZMg/dlTxOeEp9gaeePwk0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866507; h=Content-ID: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=s5ra5nffzHwWucxF5rmuojk/qIU0y66Gpw4WdaZBVd0=; b=VZy7g6dtRCx97W4iZHU8Q8kcJrzxf8rLmB8mFuhiBP5r6wHDhelIRa9jd1j9I+DnPtCsDDhpTqu0VGaAhf8gHXxY4cJdvJx+iASv5Woy2do6PU6TBRz65R1TxaujcaypCqqmA3wKq5AlGs0+1bUoRE0/uNe6KSPZ4vhvU+YQoh8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866507946747.4597337247968; Thu, 28 Nov 2024 23:48:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfl-00083J-6e; Fri, 29 Nov 2024 02:44:17 -0500 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 1tGvfh-00080x-PU for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:13 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvff-0002nD-0p for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:13 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:06 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:44: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.8207.014; Fri, 29 Nov 2024 07:44:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866251; x=1764402251; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=s5ra5nffzHwWucxF5rmuojk/qIU0y66Gpw4WdaZBVd0=; b=X/Uh2yzSLFN3G4pG4cWPzOl6nDUeTnd2gFq7R7lANGwS6AzfCQhZ5N0o LOozQf5DTq2mBRmxbX8v4Ed9z/9S8RZmzDLgdZZPm3bzS56A6loNeVX6e vVjh8lukKU5Vas69Pj2IYCqUnNz3PlLOu15Ye3D2Kv4JDaKzPyXD5+1fq fQ5lDqwR7/z7FF3jK0NyaPkhbmx28ZEHsNAla03+Zuu6yNlmxIhaO6MVY g/vbcnQqoTlpKlVgakQx8r0W7eoJ0O5CyZ9TVcrCHuq2CCV8QUnBL+VNA 0H3bdkNnFtx9OL1C9aBCm5X3dclXDD13nzEguK+hra0Sm+HkxJp2a39O0 w==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670819" X-MGA-submission: =?us-ascii?q?MDFBYtm2nTryqGVqbqEqJ+4E61ZhYjamntoaGs?= =?us-ascii?q?4GtZndf1fO+3g1tWDPSFycxJfeLKhYoMFOIiptmek6CMKlquTGhMV54g?= =?us-ascii?q?PKdaA8mKysGxcwz00bUt/3LK25fPI3vcY774INHmFBpLKD3F/oYJuzl/?= =?us-ascii?q?iww3YsB4QqJjpNFqGgxkcq1A=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hidjWI2pFU2D8aENcoH/HfQ8RX0gNhBjj/QPigMBOKzMl8/FbRYxPBZq7PT+mehEe0jIqE5xY08g79+4WJHVYw47ODd68lteBAgXkUMeZj/AdZl0siB71Wv5rWjZl78BR5SXbPEmrT6nhQJVC88xqJzDeWHmux00xHDzuSTA1aH7N8PcVnm1DgtpHTDfct8OgC4p+ib8YlO/dPYhQV3fCeB0aNU6ec8iuKd5DnHWv8XvLHrTWr2ALM9ymRwsELN+mgAiw0xIfEMWkroOo5FzhoOWZ3+gJ9d1YTl4oa/9mcg4JyyCeK/4ErLVmIJxBlJzAncVO0QjDMPS2p0TC8oNHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=s5ra5nffzHwWucxF5rmuojk/qIU0y66Gpw4WdaZBVd0=; b=eszkPwTs3OUJ2av9kYv090608XM/Dw86AzrVu71aZbZBJoLfBtcBZtczwNq5mqnIz1KoYqdqedjrJV6aDahTPmFmOc2ecG3/babKFckOw28kbYSouPLPl5RFDjwajK522HQyk4MqGRc/XX3vR++962XvVJ8csQkyHfSUBmML1+H+gnLrR2IxQVoKnLkV4IqXWUl6YMs3i3Oi6RigUNTCFQsf+1SIEF4Sg8G8eNXDt+rEdUx5XmMCAfeJTy+/pcU0+OvipihTl1xSH/7r3rm+YokbADde04eVuqCXXwJdyxDz0E9xeYZrQUZvklA15TwVs5J4voJOXAFZ09P74/1yvA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s5ra5nffzHwWucxF5rmuojk/qIU0y66Gpw4WdaZBVd0=; b=I5QiU/wGBIn3gIXhHjEYMgn3HSSikylXgceWqe0QbMP75ot949FVWMyMLmXH0WyJcBUnRqMO+kavRWddV3HR3E9iPU5+Ibpx/VeGkbtMEq4P7RRx9VHR5g4ildhoQtpETRbbfIqVySJl2AtW7qk9i5uEGx334ZREnalkWkR9BWmHTQwNrjvrE/hKOjJokUCktmuv56n/mOpsHA9pfzUjNPjxqj6OojbbAXI/Ou6pA66axl84fhgHjLHttYLhqK0EgtdD8dKQL/J+Jga1EtQ2MyYmUxyveiIsWe+0j+RIoL57K1Mc+VbFMxWREk8YNF103pWxPb1v8+je4KgG7jR6Ng== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 18/19] intel_iommu: Return page walk level even when the translation fails Thread-Topic: [PATCH v1 18/19] intel_iommu: Return page walk level even when the translation fails Thread-Index: AQHbQjJ2eyRaO/QBnEG/q4DtvF0FWQ== Date: Fri, 29 Nov 2024 07:44:04 +0000 Message-ID: <20241129074332.87535-19-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: d5e78ae4-1e45-484e-3194-08dd104998ee x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?a0dlTFVzRGVHeWJqcWdmc2xzdm9yVm1WVW8rU3d5V0Y1eWF4V25LZWZHYmJY?= =?utf-8?B?VXByUXhsUDVTd2pBeEN1N0ZhOWVQTm9TMGU1akFMMzIxM0VrS0xLNUxoMTAz?= =?utf-8?B?U0x0NEJ2dTlCTldWV2paZkl5N1lpbjhSQTF2ODdYc3h0TWtoYUU2a1pYcXY4?= =?utf-8?B?VjNJR3NCYktzMGQrQnkvVC9iU1VzRUZaMFpPbERlQ25tRjN0emQwSTBOeURh?= =?utf-8?B?eGdIZkxFL1BDbmU5bmxHclJQZFRPNU5NNGsrMzdTUTVUNFdQT25sQVMvdkhq?= =?utf-8?B?cnA3ZVpPZCtFZ3llWFZNQTJ3WDlKbFNkK25ZbHJyd2R3Q1B5LzFFUzAxYXVN?= =?utf-8?B?QnRwUnRsT2ZTMG9OV3J3V3RzcWFld3dERktadG53VzI4dWx1b0RrUDdJTVBz?= =?utf-8?B?bUllQ2xzaFdpRFcyRkFkTHFCdmYwNWgwUmNoTE9DVmpjUUJoWm13N1owSlht?= =?utf-8?B?eGQ5RXMvQnhiT1VZZDVUK0hXMzBHNDdJZ1JJNkdjQ2ZwdEU0ZE16eERQbUdv?= =?utf-8?B?bW9UVE1tbWRiN2xQb212RHNiTXpZclNaOEZ3dmQzWHlhU3d6TXFqZjIzNVRu?= =?utf-8?B?Mys0dWZMU0JWYlM3RGs5djR2ajdVSmhqRzdyTU1pUUZSbmt6VlorV1NRRThM?= =?utf-8?B?TUVHZXErOWhkekdpeG9pa2VU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k9ZOTJPYnpqZlBiVm5FUDN4ZTV2b3A2Tzk0MlFwVkFZM21H?= =?utf-8?B?NytrbHlCVmFWVklZVDhBQjJCYXlVRHM3aDY5Q2JjZ0l6MWpWWVEyV3FQMlhU?= =?utf-8?B?K1RhRWhTNTB3L2pyVmhBTCtoNW5YN0xSb2dHdnNNdnBLV1RyQ1l5cFBLS0V0?= =?utf-8?B?ZXFiamwzdTI1T2VEODBnZHh0aXhncHFBQjFKeHR4eXBtZjJqVDk5UytoT01v?= =?utf-8?B?Wkw0Qi8zZnFmbTV3Rmh0bkhIWVlhZDQ0OWFoVFg4dUdpbkYvV0J5WEtVOGYr?= =?utf-8?B?QkVVY1BTUVdqazNQQzFWVHliOStwOWYyckdvb0hxQTNJZHc9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?a1FoQ3REMk1MUXRvNzYrZWorQWkrNERFcmJqOXdwcWh2V2dkYzB3UmwrZ2hZ?= =?utf-8?B?Mkw4ZGRmdXR3N21leDhHTFZjWVVKZ3ZFUUdsZ1htR09WVWd3RGRoUG5tTGo3?= =?utf-8?B?Q2tTR2o2bDFwWDg5NUJ1WmNoN3JXM0gwcWR5c2h0eHp2UVVIeWQyQW8rMFZu?= =?utf-8?B?VDUwTGFpVStWVG1jbkJGT0JCTnpBRkxxck82YVM5SE16dHpPdW1RT3dGbXNn?= =?utf-8?B?dTg2bTVvVlg5YS9taFhNTEdjR1VYWlkxajJBUklraUtpTUpyVDh0cmlucjRR?= =?utf-8?B?dkNFaEEyVm9XZWN5MlptTEdxUGJyQzVEM0pNT05WQkk1L01VbVV4N3JKNndh?= =?utf-8?B?OE0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L0I4RjNScVd5WXJOeXVzVk9tNGh0?= =?utf-8?Q?qpaEsoL8p0f7z19Q0I5BzCY=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <9237B26B234F9A468753FFD2D0F00C43@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable 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: d5e78ae4-1e45-484e-3194-08dd104998ee X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:44:04.0518 (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: y1khjslCVar7Y3q2qTY+Y89L+XeMPUoNPgRh2JdXzH3MRK7wn4BBHAhAXZ1PDal2T+MkomVYHB+g3P2iya/4LxFwe8QUnG7KI7lFS0LZRCQS3a6plBAdFh67XjmOnfiB X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866508707019100 From: Cl=C3=A9ment Mathieu--Drif We use this information in vtd_do_iommu_translate to populate the IOMMUTLBEntry and indicate the correct page mask. This prevents ATS devices from sending many useless translation requests when a megapage or gigapage iova is not mapped to a physical address. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0637437552..a3e972af75 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1995,9 +1995,9 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VTDC= ontextEntry *ce, uint32_t pasid) { dma_addr_t addr =3D vtd_get_iova_pgtbl_base(s, ce, pasid); - uint32_t level =3D vtd_get_iova_level(s, ce, pasid); uint32_t offset; uint64_t flpte, flag_ad =3D VTD_FL_A; + *flpte_level =3D vtd_get_iova_level(s, ce, pasid); =20 if (!vtd_iova_fl_check_canonical(s, iova, ce, pasid)) { error_report_once("%s: detected non canonical IOVA (iova=3D0x%" PR= Ix64 "," @@ -2006,11 +2006,11 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VT= DContextEntry *ce, } =20 while (true) { - offset =3D vtd_iova_level_offset(iova, level); + offset =3D vtd_iova_level_offset(iova, *flpte_level); flpte =3D vtd_get_pte(addr, offset); =20 if (flpte =3D=3D (uint64_t)-1) { - if (level =3D=3D vtd_get_iova_level(s, ce, pasid)) { + if (*flpte_level =3D=3D vtd_get_iova_level(s, ce, pasid)) { /* Invalid programming of pasid-entry */ return -VTD_FR_PASID_ENTRY_FSPTPTR_INV; } else { @@ -2036,15 +2036,15 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VT= DContextEntry *ce, if (is_write && !(flpte & VTD_FL_RW)) { return -VTD_FR_SM_WRITE; } - if (vtd_flpte_nonzero_rsvd(flpte, level)) { + if (vtd_flpte_nonzero_rsvd(flpte, *flpte_level)) { error_report_once("%s: detected flpte reserved non-zero " "iova=3D0x%" PRIx64 ", level=3D0x%" PRIx32 "flpte=3D0x%" PRIx64 ", pasid=3D0x%" PRIX32 = ")", - __func__, iova, level, flpte, pasid); + __func__, iova, *flpte_level, flpte, pasid); return -VTD_FR_FS_PAGING_ENTRY_RSVD; } =20 - if (vtd_is_last_pte(flpte, level) && is_write) { + if (vtd_is_last_pte(flpte, *flpte_level) && is_write) { flag_ad |=3D VTD_FL_D; } =20 @@ -2052,14 +2052,13 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VT= DContextEntry *ce, return -VTD_FR_FS_BIT_UPDATE_FAILED; } =20 - if (vtd_is_last_pte(flpte, level)) { + if (vtd_is_last_pte(flpte, *flpte_level)) { *flptep =3D flpte; - *flpte_level =3D level; return 0; } =20 addr =3D vtd_get_pte_addr(flpte, aw_bits); - level--; + (*flpte_level)--; } } =20 --=20 2.47.0 From nobody Thu Dec 26 18:06:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866517; cv=pass; d=zohomail.com; s=zohoarc; b=a+Q1UChNEQke4rAGEoJXg1Z3j1VB9RvUvFAbQ6Ly/waxJf2cc+qKkUcXAuN1J9Zqf41nmvAbwJqGd6ItqpEoBJxPpgscXcYrHTuEtPIA1mIGzSP1beyGtQHSDWj/W1fEp3CjkouINrO+qs2tiVCuRETAfUPNOStK5T4B8VNoBk8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866517; h=Content-ID: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=r1cIMR2bydzS/r8/JNnPbdEFMy5ycwRYByzUFRA40/o=; b=A+CvdBagL3LgsX5IvbXngcOAz5ESKJQ9iEHJTkp4bMZA6OZiJTP5CjN+RZGB7+pixrnQVU3Yyu/rOEkszkdkz54ZPp9wlQt2XexzM47M9sEsaEgx1IRBaXGAImj+dwXIZPNfxs8XeY1gfKyWCwf15z879cP1rVhfbvXV6VPxPIk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.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; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866517733593.1288584725896; Thu, 28 Nov 2024 23:48:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfp-00085Z-Mp; Fri, 29 Nov 2024 02:44:21 -0500 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 1tGvfi-00081U-Ji for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:14 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfg-0002nM-MR for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:14 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:07 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:44:05 +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.8207.014; Fri, 29 Nov 2024 07:44:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866253; x=1764402253; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=r1cIMR2bydzS/r8/JNnPbdEFMy5ycwRYByzUFRA40/o=; b=Upp4fDke0KFj5Ng8a7k5ScWFxhCLYAtWa7Lq23wAgx5wg8+NUz0IoWH7 ZGzl80VaLlFxq3pLvvE9rdYPEo+JC1cCEgVMvhTXgniiD2vnO/jfuAF7U E5vKXVLMrDQXRXXCiURwqLuG7ap9N1fUn9Fsn84AoFZ97FGeO95b/gDYA 4Rt0t9Z2Ph1SAjI9RpmTwbjNdJ4qj1Ek7g0NdLBj0gTWQ8zOkXP69Nmd8 ZBtC8vg7auPDekfZ2m1yH0Di8SEn3mGsM+3jptxY53vbdKR8Oq6i2mjxL dhCwf080olNQniIqncnFZb2OkjA/Kn43+8BcCKJ29asUixwJlrTPU/aHw w==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670820" X-MGA-submission: =?us-ascii?q?MDHwBCCxTrnBU+wELJSvXKCeujxKx9y/MTdV3v?= =?us-ascii?q?hMu9wh91zH4uF18ynTEZjP/wZIhsAgtt+1xjZX3sBiF44zZUOgd930Ld?= =?us-ascii?q?oGgKFh8PGgihE9p7I89pIMma3VGZ3+vpNm2dxCV4Kx/RXzE16yCyJ8cN?= =?us-ascii?q?oEXwbOa57IiW8U40Jvdt8nrQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Im0+fdXMmMYpvO48Xpzdus41smX8ohQ0num5t2H/2bTRwkfKwy8DbuNxROriHEnTLtz+567O2i0ItMEL31EiFpvb3cTzDqJ2RZE2mGxLTDLUsUjS8TAMzESlEtSo7T6rgi5cBi5RzWddZ8fxIvlVXlhToyXleiOWcdPckGxHm0tv+pTpzIUtJRW2ud441hGi66sbiQHG2SeZvQqWClw+Tkeg+yp/ZT+cfh77JZMgYzWwQ+Yfr75KIldOnmPnevCM9XNKcbTXYiuseVospj1A+Mem7M/ssO4dXeBi8HPyxAp2tN0P6/jPRR9Pz6nyRDXPqb4xaPhmIpivjvkS6E53qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=r1cIMR2bydzS/r8/JNnPbdEFMy5ycwRYByzUFRA40/o=; b=Xce/7jtyut1Enl37oStbC8WjWdpepdvfvgaRah7/6lJhx6a3x3oTyXOO4XlfdirmjhGQPzidYUuUmj9evePQ7r0r3rIexyQMUr9xXhVHkLh4O4WSzRr+e3rrqjFSQATLR4uXiiVmjpeFQnNJDxWwTy4O7E7TTcLB/eFpnZEpROzAQ9zsr1CpDF8/QI7BWdO/3sB45oKvDGAX6sXYjftVlCzw6FniRXkgQuRk9B/Wj6LOvEa0kIkwZT0wEYpm1ZZKRVUwYDHqGdqFzztJFksep14pxvFK+3k/cUTVcXQwhQ0FxOBn5pbcQQLuzL91ZGDnPfSmxGkzQV5nU4l4nAjNwA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r1cIMR2bydzS/r8/JNnPbdEFMy5ycwRYByzUFRA40/o=; b=JM3+6h5n/3JVfta6gShLiNyPv8ZUOOCcZFaIfZ9PYlEkNNSLno5Su3dCF2wiNdbub+1lsxMBmULm/OMEYY09L8v34Q1zbmWyPZnI/ER1JsZ/6UH4hxPB53Pa6Q687iUnZ3U9boGmRSNCnLNllMSMPDpSNcNRA0Q8zsBPu6pPfPzo6AQjMEFz5zMaqViLQLcFGw59Q2m4z01MwZIBgBzuG6IH0m2ofull19ILQ30HMlv3rLy05dCXy7wx8poFCsZzmu1PRmSqycjtg0FQ+cGnxi78CS3gMOrcidzLMm8WiaF91Mes59J+RqZXZ1Z5gOMI2HENA05D6g93qjdk1bGnPw== 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" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 19/19] intel_iommu: Add support for ATS Thread-Topic: [PATCH v1 19/19] intel_iommu: Add support for ATS Thread-Index: AQHbQjJ3Jcu7IEEYSky5Kq9PmWavTQ== Date: Fri, 29 Nov 2024 07:44:05 +0000 Message-ID: <20241129074332.87535-20-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-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_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 6f7abee3-0bb4-4a99-a328-08dd1049998f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?cXdmZzMyaFJyYUZDZHFEa01haGdkK0JiTDYvQ1I0RTd1bUxKdk9meGdwNG9M?= =?utf-8?B?MC9oNzdMSy9QS0hQaW9qdVZheFJid3JndnNlcTVDV01tZXE1clB5aStDMDFz?= =?utf-8?B?NlBuMVpnMGlFSGRJOHNUR3c0YUs5TDRjdmQzdUx0bzl3YzRPYW5DdllFdU1j?= =?utf-8?B?NlpHZFNuNWdIbkVFSnZDZ0tZYzIrNGUzeWVqK2duTVpYdi9IQVZ5dGx5bGRW?= =?utf-8?B?S1YzNUZoNERnS3R1ZFcvVHdBcE1Yb1NKMmkvZ0lSMUxuTlNoU3J4VXhQZlhZ?= =?utf-8?B?TXpMeENDZnRKeXpsRHJnNEpaT3VGbjFuOUFsbUJ2ODZ0YmxvbnZoVzJ6eGVN?= =?utf-8?B?YkdmQkpQdkwyNzJVS2hVYm9tM0ZhY0o3UTV5WXNOVEt4bFBnVW5MY2tDMXFH?= =?utf-8?B?Ty8wSmo5WFVnSnJFTWo5ckgvRWJmZWdwTzJjN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jZtYVBlS0JnTjRLMVBqTEdaQUhwMHhLZVhSeE1KWm43?= =?utf-8?B?Zjd3eTJWclVGeU4wWGp4aVdka1I5QnF6a3VZT1JlTHllcXVkanhnTVlydzFG?= =?utf-8?B?dUI0eTlxVitWd1lBRUh3S2dwaWROQ0hVbHRmTjBOcWlyUzZaVTN4Z3c2a0Fo?= =?utf-8?B?bDcycDJmQjRIOVNDYkd0bEZ6RDZkdGp1a0xmUlYwdjZhVEN5dmxha0pJbWJw?= =?utf-8?B?NEUvNnpqb3pVWG52Tm9FZ2E4dEROUlRyK1lRVmVhQ1JRUGZFdnVOaG5iRHJN?= =?utf-8?B?TDA0VS8yZzUzdXY4UDAzM3YzRUhpRnlwWE1yelVsYXhoakhvSTM1MlVRMDBU?= =?utf-8?B?aFBZanBodW9hdktDWktkd3NRSEh6WE1oYWN1T29EcGx5WVAzdDErUU55aW5D?= =?utf-8?B?cDI2bDJ5RG9tTjJ0WUlIYmdxazFseFNaT1d4anAvY1hRVzA1Y2EwYkFDS09L?= =?utf-8?B?aElCOFFDTnEzRWxIbEsvU2xQTDBPSXRsejNwYTBmM2RTdGJhZUlCQ3lWWGwy?= =?utf-8?B?NU1tczFBcnBuTi9pNlU3NGc4TkNGNXJPUi91Wkw1NnB1Y2c9PQ==?= 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?U3dRc3l2QnJFRVFSMVRuSWY5WVh5QnoyYzRCdVpZMWNLRGpETmdhdUhMajNu?= =?utf-8?B?Smg4QjVYUGswZm42bGFQV25RczI0elZmd1hORDJwMVZhQVA0YjhQQ0d0Qkly?= =?utf-8?B?WWQvbnB6TnFjQ0dtR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KzcvZ2RnOUV1TmV3TG40bHJz?= =?utf-8?B?dTJ5azZqRnNzNERCNGxJdjd4UG5EdmdDdEpMeUZ6RThUYkFER1FLbjlrRG1r?= =?utf-8?B?Zi85eFg2L1hNQXNVRDQzTEpHZWJ6dXFuOE43bnBESHlUSHJpQzFjQTdrTjBK?= =?utf-8?B?eFhzbFpsS1BWVUZYWERYbVp4TFRpTzJkM3V0TGlkUzNSN250U0R2KzNZeHN0?= =?utf-8?B?c21LRFZxOXV2aW1oK013QkU5UzhNWUNFZDB0YUpzSmcyODdlNFR6UHNad01O?= =?utf-8?Q?vjntRqwLEPIvx2JAigHqjMM=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable 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: 6f7abee3-0bb4-4a99-a328-08dd1049998f X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:44:05.1044 (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: TP/tzPD3nPveRRb0kJEavlOQ1vMnSMn/2VQB52H7/c3dXdsd68wtTHfn37cbcQM/XolfXsBUNuXP/StKA2sSuWTmpH6NB+MoQ6ukwgsV2WeiU1lg7spB4R7HA84pJH38 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 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=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @eviden.com) X-ZM-MESSAGEID: 1732866518644019100 From: Cl=C3=A9ment Mathieu--Drif Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 71 ++++++++++++++++++++++++++++++++-- hw/i386/intel_iommu_internal.h | 1 + 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index a3e972af75..899c8506de 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -4166,12 +4166,10 @@ static void vtd_report_ir_illegal_access(VTDAddress= Space *vtd_as, bool is_fpd_set =3D false; VTDContextEntry ce; =20 - assert(vtd_as->pasid !=3D PCI_NO_PASID); - /* Try out best to fetch FPD, we can't do anything more */ if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) =3D=3D 0) { is_fpd_set =3D ce.lo & VTD_CONTEXT_ENTRY_FPD; - if (!is_fpd_set && s->root_scalable) { + if (!is_fpd_set && s->root_scalable && vtd_as->pasid !=3D PCI_NO_P= ASID) { vtd_ce_get_pasid_fpd(s, &ce, &is_fpd_set, vtd_as->pasid); } } @@ -4745,6 +4743,71 @@ static IOMMUMemoryRegion *vtd_get_memory_region_pasi= d(PCIBus *bus, return &vtd_as->iommu; } =20 +static IOMMUTLBEntry vtd_iommu_ats_do_translate(IOMMUMemoryRegion *iommu, + hwaddr addr, + IOMMUAccessFlags flags, + int iommu_idx) +{ + IOMMUTLBEntry entry; + VTDAddressSpace *vtd_as =3D container_of(iommu, VTDAddressSpace, iommu= ); + + if (vtd_is_interrupt_addr(addr)) { + vtd_report_ir_illegal_access(vtd_as, addr, flags & IOMMU_WO); + entry.iova =3D 0; + entry.translated_addr =3D 0; + entry.addr_mask =3D ~VTD_PAGE_MASK_4K; + entry.perm =3D IOMMU_NONE; + entry.pasid =3D PCI_NO_PASID; + } else { + entry =3D vtd_iommu_translate(iommu, addr, flags, iommu_idx); + } + return entry; +} + +static ssize_t vtd_iommu_ats_request_translation(IOMMUMemoryRegion *iommu, + bool priv_req, bool exec_= req, + hwaddr addr, size_t lengt= h, + bool no_write, + IOMMUTLBEntry *result, + size_t result_length, + uint32_t *err_count) +{ + IOMMUAccessFlags flags =3D IOMMU_ACCESS_FLAG_FULL(true, !no_write, exe= c_req, + priv_req, false, false= ); + ssize_t res_index =3D 0; + hwaddr target_address =3D addr + length; + IOMMUTLBEntry entry; + + *err_count =3D 0; + + while ((addr < target_address) && (res_index < result_length)) { + entry =3D vtd_iommu_ats_do_translate(iommu, addr, flags, 0); + if (!IOMMU_TLB_ENTRY_TRANSLATION_ERROR(&entry)) { /* Translation d= one */ + /* + * 4.1.2 : Global Mapping (G) : Remapping hardware provides a = value + * of 0 in this field + */ + entry.perm &=3D ~IOMMU_GLOBAL; + } else { + *err_count +=3D 1; + } + result[res_index] =3D entry; + res_index +=3D 1; + addr =3D (addr & (~entry.addr_mask)) + (entry.addr_mask + 1); + } + + /* Buffer too small */ + if (addr < target_address) { + return -ENOMEM; + } + return res_index; +} + +static uint64_t vtd_get_min_page_size(IOMMUMemoryRegion *iommu) +{ + return VTD_PAGE_SIZE; +} + static PCIIOMMUOps vtd_iommu_ops =3D { .get_address_space =3D vtd_host_dma_iommu, .get_memory_region_pasid =3D vtd_get_memory_region_pasid, @@ -4922,6 +4985,8 @@ static void vtd_iommu_memory_region_class_init(Object= Class *klass, imrc->translate =3D vtd_iommu_translate; imrc->notify_flag_changed =3D vtd_iommu_notify_flag_changed; imrc->replay =3D vtd_iommu_replay; + imrc->iommu_ats_request_translation =3D vtd_iommu_ats_request_translat= ion; + imrc->get_min_page_size =3D vtd_get_min_page_size; } =20 static const TypeInfo vtd_iommu_memory_region_info =3D { diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 238f1f443f..7e2071cd4d 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -192,6 +192,7 @@ #define VTD_ECAP_SC (1ULL << 7) #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_SRS (1ULL << 31) +#define VTD_ECAP_NWFS (1ULL << 33) #define VTD_ECAP_PSS (19ULL << 35) #define VTD_ECAP_PASID (1ULL << 40) #define VTD_ECAP_SMTS (1ULL << 43) --=20 2.47.0