From nobody Mon Nov 25 07:54:57 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=1716297204; cv=pass; d=zohomail.com; s=zohoarc; b=KxQo5qcwBsHRqSWyCbh24exO5VYxYPOQnx5zhrvnt90Kuy7vhSH9kOr2eXAraY59Ya3Qq89a9uMShekyBAOh42D0BU95kx3roSqhRRzBvzoAICi+IqHR82qMVuZbvGIb0srXv85eo3QfV/+c1A5G1x+3//SzuU3oeg6POIoM4ko= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297204; 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=s/okrwVgXn8VNFlR+LfdeLdln6EjEFerCZiHAQA2Uvs=; b=PAGz+uxsK0D2NOnhqMwu9gelUiktiISqa7zzW/pOUGJvEzB2tCyL5WItBz7zxD4sJ6YDu/V2UjqE4JPtnhIXHSmvB8bTJW4szKAH9QzI4RQItxE2pCxRG+LNKO5iENS3yP293pt3yDrCUPydfDOr6iPMBBb1t/+1keyeZuW7NL0= 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 1716297204555808.3003567446058; Tue, 21 May 2024 06:13:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI9-0008NJ-2R; Tue, 21 May 2024 09:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHO-0007dw-MG for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:52 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHL-0001ZU-S3 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:45 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:40 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:38 +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.7587.035; Tue, 21 May 2024 13:11:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297103; x=1747833103; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=s/okrwVgXn8VNFlR+LfdeLdln6EjEFerCZiHAQA2Uvs=; b=rLRexdmAVTChdu2SJ0fjRKMKkDLky0rlyX0e5rBjUMAh5kHt9QmhM93w PNr0o/n3LzCtOTBEw2q3PpeVoDE7wzhdgEwkJC6WuAORpykhY75t6BsaA X4fLh0XWUi2h14KRalViTzHqGi0YybaAyUoLY4Kbr286//o+ItCwzGQc+ P1RgnAB6RfujslA/w+v8jbS+1lsknU9f8iwwzYUgwRqpzj3E0k5lzjgBp sfiXQQVBt6wf4M+1ShjEms39sgT+qSYWVyNlhRlF8v6hEPb+liAnWTbON vxoXXc+cf7x2GXYVy1l0XSTyP3Z67KspsHjTKVGPQh3GpOK0og6AxdCNu A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13007988" X-MGA-submission: =?us-ascii?q?MDHbPYWDAmPTWkT+dmbCcja8qy0ptaUnIoKtcs?= =?us-ascii?q?ztt8NyzPIpheEox1ugqQYCDV9606heUSDOHkwEEuzn7jPIo5MJrHCl01?= =?us-ascii?q?9pFBnQCTGSo6OAXtw03NdTPVMCdqdVlQjXlMGoWrWUmb5WnEaO1gzaCo?= =?us-ascii?q?2fW8azIE790K53uklah9pPXQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W0bycLx6ZlxzL9Q0Fir4ySxtCY9+NXi5WQVeD9Gno1VRVFTEhAMWBTCNJKoCrPzgNV/rqPPyQJNnVbjXpM7ZsehasAMiY01GR6XhjCud7P1o+bWjJP6Cz8jWspUz0NSlcVD9u2Ts31D9/AKZw4OHboRCkQs6CymAgHe/OZJ7SRDEcPTqtJpcz8da/vO+BKVCR5AXr0Etb8su04E3EgHhqzraau8iJ1+I34mS9tQGfm6zibHFgSyqmcvJVCrorc3L7ixwlh5T04TVIl09L+o3P1rJn4FdcvMKpLcJ66N+kAiVFv0pyI+olPl+jWi6oBEALKZ2acnLSm38BkJ/nbkzSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s/okrwVgXn8VNFlR+LfdeLdln6EjEFerCZiHAQA2Uvs=; b=b+LIZrapoEc4Snk7vAbZlvwo/IzVd5Ob1e9fr+mVQqAOHAn7x8qVPpOc3/8XL6WbkBBkuGEqV8eOF6AmI8oDEguJ34Gsh6WLFyB8HdEc4i774MDlhxil3m1+CNOT3InqSVREzZkwajY+pzYyQh1SJ9io+cQwB50RtCmMWGoofPDw2CHWWZ3cJ3lSNie0ctB/CCDUn1R+T8E//FoMuI31WB/v92uvmd+pfuJQ4jmav+4UY6bE3jSAyqxSbjFlQ4f2WTsMa25reVos4eDUNtjYOb4aI5jvCQHplgB7nxAYkffAOwLImWAsrAuQaAGDcbP/XJBk14xPJkF2anWcjyFdXQ== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 01/22] intel_iommu: fix FRCD construction macro. Thread-Topic: [PATCH ats_vtd 01/22] intel_iommu: fix FRCD construction macro. Thread-Index: AQHaq4Bpg4eL8UGtfEKvRSZXOcRINQ== Date: Tue, 21 May 2024 13:11:38 +0000 Message-ID: <20240521130946.117849-2-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: bd569a4a-2a99-4fa8-30ad-08dc79978c75 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?aXBDYW1PcXd2YjkvaDdGWGdvT1pYTFJZWDI5eUF4R2FkaENKbGRRL2F1TVFw?= =?utf-8?B?SG5ZYjlKc3VkOTUydWtZeldlRVZCUXVieDc0WXBweWZyT09RUEdNM002bHM1?= =?utf-8?B?UmU1a1RmOTViNmMxdjJBREVralptVkNXZzNVY3JEcDF5aGNHQ0xXYnRwK1hI?= =?utf-8?B?YXpiSjloS1RMMUtjZVRvRnVNaVA1Rzc3L3pIMzkyTDV1R3ZxSHVlcW5lTnhF?= =?utf-8?B?YktOb1krS3ljM3pSRzNJeUx6NkY4QTF1WFZJZys0eURDM0Z1T0dBQzhDSjdp?= =?utf-8?B?eTBoS25nclRtdGF2S3FiRDdWWFZhUTU5QzBpL1UrcitpNVBMVE91dmR2M3Nr?= =?utf-8?B?Q0RYL0ZZZzkyNG9ra1NtdzlwRTdHVVMxSnpZZkZCeDFzK0JTVzNXQzhiMnVm?= =?utf-8?B?bWEzdTNCaVJyQ2Rrc0twODQwZnE3VXZoVFRFL1dIcmxUREJYZDZhR0pkTlZu?= =?utf-8?B?a0RtVlB2OGtLMjQ2R1psRGZFd0Vsc2VxOHVNZTUxNGkyd09KQXFSMXFnYjJF?= =?utf-8?B?aStxWGNwQmQ3dlBvelAzbkNlU3hFNjBVU0swbGtjSGNQaStKa2s3aGhLRFlo?= =?utf-8?B?VXZHeGVvdUZyK3d6U1ZPeVBLTnIzekRqUU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2K3BBaHZCT25tTUNjbUdEc1l4eVZrWnVFS3ByUm8wRnpN?= =?utf-8?B?SnhldUNRanhZcUpnbXprUms0VERNbGd2SnNTTDArajRtL1ErSU84Z1F0VHNu?= =?utf-8?B?c09GcnU0cUwrRG41RDFvZjNjZkZ5eVEvRGduMW9sdlJOYWZUeGFWcXdRbnhC?= =?utf-8?B?SjcyKy9oaC91S0tmdUhBd0MxUHVMN3lhYWh3M00yZ3oydi9kWFZTdGliUlgy?= =?utf-8?B?ZmozUnNJR2xGb2doQjJwN2NIZUYzTG9scThyYjVvK1JRdE45VWQvYSs3d0JK?= =?utf-8?B?T3c5UGxpY04wc3lCMHpmdz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?MzFLZ21vVHFnVHoxNGZ6eWEyT2RHbEFLZTRRT2FoSVc4c1hzZ1NhaEdNb0tJ?= =?utf-8?B?bmFqWUttcHdHdGV3SHJNc2s2TmlScHNEVW9mTEQ2alBXOUQ2Z0hFVXFBbk5a?= =?utf-8?B?TG16STU5eElWTXZmYVZJb3FUeVp6eUIyMEpBWUkrU3BxQzVSNFZWZmVrWW1T?= =?utf-8?B?NHZPRGJMK1duZnJZT09iZS9xWDlGbU53cmZaQ2NUMmdBalp1djlCLzc2T1Rx?= =?utf-8?B?QkZ4VlBOSVhUNGZudHJoa2tHaUZTemllajdOTnFCbnFIeDhXdHpOSkdCTSsz?= =?utf-8?B?NU9BVmNwTEtRajUvSi9OLzVXNmljUmlHdG9vVjdnYnBxd3p4VENZZ0FtWmVn?= =?utf-8?B?RkQ5bkw4SFZ5L1NESjl4WTVwTEpHdS9NNzEwTjY3L3JjcEdxb0RScW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evjoT3s62PRHq0FZCo0=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: bd569a4a-2a99-4fa8-30ad-08dc79978c75 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:38.3243 (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: 1rnL44jYkT21cHuIYRpHYNVhFdiTYo0owsv9r65O++zmR8Jn1dtSAY+dkJFF4vIYdarNaOOULw1FC1kR8sAbeLGMqM2d/gO5W+gWsq5SBbQbHpJlNFO7hkarfWm3KDG7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297206622100003 The constant must be unsigned, otherwise the two's complement overrides the other fields when a PASID is present Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 7d0420e15d..1e37b98c65 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -272,7 +272,7 @@ /* For the low 64-bit of 128-bit */ #define VTD_FRCD_FI(val) ((val) & ~0xfffULL) #define VTD_FRCD_PV(val) (((val) & 0xffffULL) << 40) -#define VTD_FRCD_PP(val) (((val) & 0x1) << 31) +#define VTD_FRCD_PP(val) (((val) & 0x1ULL) << 31) #define VTD_FRCD_IR_IDX(val) (((val) & 0xffffULL) << 48) =20 /* DMA Remapping Fault Conditions */ --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297333; cv=pass; d=zohomail.com; s=zohoarc; b=Duo0ki5oomL/4bXgG+dpCA23wY1FlIidVGHRgybTBoIx/tmb8Ym0c9T6kKtQysYCnZf0DXW9ZzXZCV8jEpm/gJAP22iExNVhdpap2AQu16Bjdij9RGWbMSfOmud9ccGxQ6wLKL4PGcyT4OCGWky+mzXq3jxDLG2wvo0I/UqwSmo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297333; 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=gogYq9bIMph+X6X2cL9HJLg/M0kvP6UJCrNM9EgvxWI=; b=fXonI0FbKBpprmwK56/9kZqTAAStY5FDP4Rj7F2D32tez6r/Oy4rQD8m3ViTT5ze0LJCHjWnOwsFRwxcEuB7wtk9jhhQvs5dzOqUWF1wYJZMFCkwkqyiXS32DNmC0yJ+xDhB8nzrB+9qxSIbdIcyVVQXD+XpwN2sGSa98iaT+uY= 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 1716297333787131.9572085475753; Tue, 21 May 2024 06:15:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIA-00006T-6C; Tue, 21 May 2024 09:12:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHU-0007i5-JW for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHQ-0001aP-0l for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:52 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:40 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:39 +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.7587.035; Tue, 21 May 2024 13:11:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297108; x=1747833108; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=gogYq9bIMph+X6X2cL9HJLg/M0kvP6UJCrNM9EgvxWI=; b=PoLEN/l/fFOcxW2vpphkj2lTkUTkeU1995F0CxYWRwHBwqwl2MRO0PM4 +CnJef2npKCvHLPVehfk3e02cp7973x+XHsuYaufZ5mBowZ0HUndD9sk+ WnBNYP02QGqQsDdfBw6O9X31XdY6n0TYjDaXwvbI+Ms4Km507WkNYkJ5+ D5ZLGEQaU9G+nZUT/6m9ppCcuoRqm9gUeN7EIt2pqRPkbiGOvTVeO/PMu HW7BX3U/ZqiDDaL9AGEPaGtp6E0EYn1c+raeS8DGHypRHfpM5Ao6D5xTQ uC/YSRWvArCXXGsDFgkqr3Jtg2qP9eezhLpochcwx0t7vW0pO3RMnXBv1 g==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13007991" X-MGA-submission: =?us-ascii?q?MDF+t46JSy2INbCKVkeiLjIuxG+MdU7esKIcv9?= =?us-ascii?q?tiQfCuWskyVavi0QYZbdpdf0UA2HSnxOEPp9ZnzC8/y6HZBD6WwGD1ZZ?= =?us-ascii?q?h1xXy5vpjgQSoFZ04d1Zjz7y2h1Twf6AwaxRXLrD8wwICL3X75gMHyLj?= =?us-ascii?q?QCqpGlRUgsF0dNeJ8UjS+97g=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cBwpdSAwZ9ij62Z22z6HKg2koDYm819pFlgsTlnlT7mF4TT5JQzGzZOnNQ0+p7fRfvl4KCE1KSwKCQVTWm8v/XOrnalkeYN6yn4TYwCeHPn+H0A5z8eFaTyj1CdmqgUCTdqKeEeopO4RsAlHRiG/F70kHapTCwNSyS7H1SlToi473ZBCD37+4IzhF1b0mqMyPOwALfQo+6UxoAKCfdsJhhdobsXdmenGQs9RgdlTeuo5Ow8FwEZzJyq71LxbWC8EndbA0OxkRR7tdKDdNJvNT1mwZyLfxSz6dxBkKQTV6pa7Ao8+aZrcjl5ih0+i6YN4/QmBLRSLOmzrCTK2dIAzYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gogYq9bIMph+X6X2cL9HJLg/M0kvP6UJCrNM9EgvxWI=; b=JFLokBlGT5ATauK+ym59v5l19KM8d7JHVc+tFB46QDU9deo6tsQhiqlLKmeXqed3oEklxEdpcsxzh3/fg1vZQg662mGAdvIrGOGX56OnoLz1oHF9HuaU4x7yVlNeADuUbEmuO4MEt638+/OKig++elf9EhdZSi0OC8Z3jFpeJylmcta1j/AG6GaIpZVT89I3pRMtolnyj2q3ep/cb7rpt2RPWpQKSD8LJAbZ7MvWnQubW9ywP7YPpM5OTEstQ0RIpVIzLeIPJG1f/NyJy0TeLmmL9r5HRWFmPvm19VZhyDGEZXWnw0yQjMyDUGZhNkTyKIPsND78Gi4YbAqvUpk1gg== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 02/22] intel_iommu: make types match Thread-Topic: [PATCH ats_vtd 02/22] intel_iommu: make types match Thread-Index: AQHaq4BqDI0m4GPHTEuIK2r15OBdQA== Date: Tue, 21 May 2024 13:11:39 +0000 Message-ID: <20240521130946.117849-3-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: 8b8052db-3298-479b-c042-08dc79978cfa x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?WHJ0cnA2MTFBdVYweVEwME1zeFlha21FNjJGK1Q1QW5jQ2VZRTZ4OUtjVlNJ?= =?utf-8?B?Zkp2OHdOS1UvaUx6bjJvN1RnVnk2ckhQSmZKc2J3M2U0TkRRUFJxeFA0R0kv?= =?utf-8?B?U3pMUHA1VE9iM1RhL3VVMFdOQlk4bzlvZUZnM29ZWmZ6T1U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S0xJM0VlbnNMT2hlV3hVV3o4L1NNMVh2?= =?utf-8?B?Y0ZJTm9uakowNE45eGJiZ0cvYjkvQUV3ZEpDSmRtMmJKZEtobkRkYmdGY3U4?= =?utf-8?B?VzZHRzJtQTZna2RhQVhEdXlEQ1JqUjFhTnp2Qkx0amdYTnREcWtiNTgwUjI1?= =?utf-8?B?K0VsWUdkRExCMDhreUJQbE1TYitpRDlUS1hMTmI3UGhiTThNbEk4UVg0dXNi?= =?utf-8?B?YThQSU4vTEZpNEFVbFFyNHpXZXRLR050OUZuR0ZDZEF5VTJzQzRtMlE0cUpP?= =?utf-8?B?S2Z4Y1BRZWxLV0pFekNXanhwYlNEZ1poSFEwNDJJUVJ5Q0x3d3FuT25Ia2Yx?= =?utf-8?B?WG1MQkUwT1NwMlFjdjdDRmZwTk9TTDJPdk5oUzJ5QUF6eW5NQWpVQzkrY1V0?= =?utf-8?B?Y1BrOENWb2xpUGhOa09KdDdMKytWZkFQSTFDYW9WYm1xWDRyUDB6K283WVpx?= =?utf-8?B?M1h0Z1pnQ3pxdmN2RURJc2FzVkRlUWhxaVpGaEdFN3dxOTlmWHBHenBFZjdi?= =?utf-8?B?OHR6bnJ6U0hBUlRDQytGZmUwU0dUTXhMSnlJRGxtc1FQUzRoWHRCWXNYanh5?= =?utf-8?B?U0NzM1VSWVZVQnBES3JJUVhNQ2JTVlRkbE1VTTZjcUQwd2dTbE14SVEyYkNB?= =?utf-8?B?alBqazlpb2FlNFl5dFNlcm5rSG4xNFJJejNaai9jZGcveVVsNTBSakpWQ1Fh?= =?utf-8?B?b01wbVlCOXpXYlhyby9PUVlFQWcveEVqRDNraGxQcVUybnRXaE5IenhBeEFS?= =?utf-8?B?cFRYeHl5SHFsQWNQanJOQT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)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3RSZFg5Qnc0OGkwOGRwYVZ0NmhxOThoU2hNL21OZkJk?= =?utf-8?B?MWo1THZMcXp2NEhrLzlSZ1VRaGU4Y1pXNDEyM0hlS2ZxQnlPVitvRVJnK2Jj?= =?utf-8?B?M0xrdmpJcUpSLzBNTTk0b0hyN1FLTlpSbGhXRlVqRnBjM1hNRElIWXVpa1Js?= =?utf-8?B?a3ZLSTRaUEJFajFRTFpCTGRHUlNHcVVrNkxUUnR5UTEvanVNQVRuYk5OM3ZG?= =?utf-8?B?Z284YXpuY2ZJZXRlaUJWWlZycDdic05ydUVqdjUvYmRvajcrbWxFM25DU1F2?= =?utf-8?B?T0pNbEQ1bFpmQTZ1Y0p3YjlkUFV2cVJoUTVzeVZVUWc2eXdTcE90S1p0V3NZ?= =?utf-8?B?dGtOQUw2SFByR3hNWTdEVjJPTDNGQ2VpbGd1T1pjdVlvQW9VMlhMUU5hVXBK?= =?utf-8?B?ZDNDamtsT3hNM0tDZUxGVVR3UXVJb29OTVpqQmRuQjE5bmNyakxIODhpemNn?= =?utf-8?Q?AfwzgPQg4+Q90NRQzKnNCtI=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <05092B6E552A1844BDC6E58B62E34B5B@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: 8b8052db-3298-479b-c042-08dc79978cfa X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:39.1616 (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: Mgvs2Uwxt1tvBrVx7OF5J+pkzOcUxMpbXRyUcXlEzYLBa4BfK5CLB5jTtwVPrpTNjM1hviYwm5Zn/xs7I86Kj8Kv9V3u5BJJmQADzXQ6CETywQkVqil5+CTgbCjS+SV8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297335222100010 The 'level' field in vtd_iotlb_key is an uint8_t. We don't need to store level as an int in vtd_lookup_iotlb (avoids a 'loosing precision' warning). VTDIOTLBPageInvInfo.mask is used in binary operations with addresses. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 2 +- hw/i386/intel_iommu_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index b4bbd839d9..fc8890f4e6 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -395,7 +395,7 @@ static VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState = *s, uint16_t source_id, { struct vtd_iotlb_key key; VTDIOTLBEntry *entry; - int level; + uint8_t level; =20 for (level =3D VTD_SL_PT_LEVEL; level < VTD_SL_PML4_LEVEL; level++) { key.gfn =3D vtd_get_iotlb_gfn(addr, level); diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 1e37b98c65..c9a673585f 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -488,7 +488,7 @@ struct VTDIOTLBPageInvInfo { uint16_t domain_id; uint32_t pasid; uint64_t addr; - uint8_t mask; + uint64_t mask; }; typedef struct VTDIOTLBPageInvInfo VTDIOTLBPageInvInfo; =20 --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297365; cv=pass; d=zohomail.com; s=zohoarc; b=f3zQJdl0GVitfULcI17aaPb8kWpLADrWyAyItz6UK12no8pMwsR2RFHpMbQeDXufBPLLSMP5KWijSfpo700n9D15Hik9iWJl4uorAfCu6IXHv1nJn7r4aLpsG+90HjfXX6gmxeRuU//AYZijM8RXuNCDo4sqHl6lwOe088QajU0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297365; 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=t5mVqTcx5EuY4FPFmulO8TLnQw3iEaKvV6PBbG7z9y0=; b=O0eu70JxRmUgCP8JhJAk3bxhyNxf7Un+auFx1N8kWdk9iWX376ANSI8nkr0byrFimYuEtHtRc/5POAdM5nsVaQhCd9XhQsLQNZ8z/9erDSHhBukHkIKpGs+k7oPF//niUE9cURPyH0UaO/0AQwl2T49EtDoAsa9aID9g1gRN5do= 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 1716297365802991.312470876704; Tue, 21 May 2024 06:16:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIA-00006a-6n; Tue, 21 May 2024 09:12:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHW-0007id-4i for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHS-0001ak-H5 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:53 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:41 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:39 +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.7587.035; Tue, 21 May 2024 13:11:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297110; x=1747833110; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=t5mVqTcx5EuY4FPFmulO8TLnQw3iEaKvV6PBbG7z9y0=; b=RK17mXXRFAwQjYPEqPQJMimvAWz8a72mGI0xMbdIiCKiv0YTsaLQSll7 Yu4VIJbnACqbgQLFxqOCp74j/89BRlKfnELotfem8VOX7tx1ZFNEyiZab 5ZeL4R3+gABM4RoLqVmR6wEVBTIpnhYE/AmcVbPo0z+c1fWm37bU7IRiD wHk4MayTLT6+cMvHaMAtG1SZLL8yvxhNE0c9CZKfuOon3CaNof3VumGeK LgSJw/ruslLzw9lZ1LoUqkint9roCzHYwKRJu8dzpILATC+S+YdEBRVfj ZSf81rlGcgA6lSwlE9otsXXaHr42232FJikK/6tfvM85qofK2zXY2zKIQ g==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13007992" X-MGA-submission: =?us-ascii?q?MDG3KGaSd9eXyJfGcnepW5ktAhIYgAcijKwSUn?= =?us-ascii?q?lUy/QvENqA9BaI3XMWqvrWDeKT9pCf4dFCpurFWnCCQ2eNd/dfjicgmH?= =?us-ascii?q?rrzIo8eVZYhkS47HJI7rl7aqImgU7gkCeimFPRTgBWHlMMxVz08TuHrC?= =?us-ascii?q?eNvMpCsjpTyloS1Lixo5tzww=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjHSGFxwsj5r2jrLDiBo+VOlTrAy5XytEU3DyvgVBYHD+pFjnLGS840SW6t1kRz8RDqgrOPAWNBXFDP7oezfn5DVf3iLQAO4c/vLfcT7ZTw7aZfT2JFJF+A1C4rsgwbWXtvAIwAJHuC5fJ993gmBbpjRAR83FOXNaICtfH8yFfr4sL7ZZ8UxbQvBZ/ssl5GYe1Dzm0esMBviIvkb5qAXjvJ6+JsGpAAW/xZpzFg/gYt8ZOvKNoAv5rQ/mUoau//+jgIpdFFeAVdo2jjcp5hD6+EEHIQCuY2lXxqpft9fxAdB/vvUYO2k2x6dfannSfKfdQXcfFe2+KMsqEUIQd1zgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t5mVqTcx5EuY4FPFmulO8TLnQw3iEaKvV6PBbG7z9y0=; b=jrhQ8og6xmLsZyyjugWqGKGaSrmn7F95E4MW6+p88qNxDE3+2jPz2n8n1A3/u3hascrB74DjHHQF1/hK405ZQPfvZEM5bCq3miZmxkbgukZILCZX8adqj+o00DMGerLw4ZaZnZy+ogu6iw/y3SyijPaca6SwFVsyPWXEdGy4FpRUkuyMidq/e0XP6my80jDCe/K+6vJ/zfak5n4eS+aK5gJVU2yIudP2LcoXGavCbeJUiZdrmAaOLDSw2l5CqUjE1qAVg3oWolNPe3vwlk1szwowhrdNhX23j8s/Zabnulp6ftByBo2B7pAX7GMXbHhBJ9U9re7Szvs+Qhb0nD5IVw== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 03/22] intel_iommu: return page walk level even when the translation fails Thread-Topic: [PATCH ats_vtd 03/22] intel_iommu: return page walk level even when the translation fails Thread-Index: AQHaq4Bq+GxgjpkMDUSei0iYZLnFRQ== Date: Tue, 21 May 2024 13:11:39 +0000 Message-ID: <20240521130946.117849-4-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: bbf1ddbb-f278-45ef-550b-08dc79978d55 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?OXAybnA5N3EyQitBQStldENsMEVmYkdWY0dBZUV5RzNIVlRuMzJFbm1pZEdK?= =?utf-8?B?eGRzWXNKM2s2OERqYU9LWFZuZzFORTZYV1BkRHh0cTgxZUxJTldDb0hZRlRs?= =?utf-8?B?bFlmc01ISjJ6cFROWlQwdGUzZ1k4amJkSGdPdU5jblVVa09ZanM4VWY1SE80?= =?utf-8?B?ZHpPclQ0bFFiUXllMzdORWsvUnh4eWpId3pmbDFmWS9qSmZOR0FGUG5UeWtw?= =?utf-8?B?WmZqbWZ1NTZmdjQxa2ducXlFSXk5WnlYZlpVUC95Wm9YTHQwaDNxaHBmcHVw?= =?utf-8?B?aHd0aXVjWVBBVkhpWFBma3RGRFBmTWJnU0hieU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uNXRvMzdkRjRMeE5DSXlnTE9sVWZodHJsaDgxQll1UVJE?= =?utf-8?B?a3N4MUM4djRVRkptMFMxQWU5SWcrRjd0WU1wTlhnZE1zVUZTczNWeDB5OWRG?= =?utf-8?B?YWsrY1JteUQ1Q2g2M2V2UjNpMWdPWTVUTWNxYXM0OHFuTk5YYzdBT2FSdTVa?= =?utf-8?B?K1p4QVVmWWRZM2FiSDkvSzVkSGZvdDBnaWNubG1wRGNrN3dZUUdvRDI2cXB0?= =?utf-8?B?N1lGRHdCbmJHcFhzQ1VQRXRLYWVqaXVORVRBWmtsbTZHQXBpQ2s1K3lVT1BE?= =?utf-8?B?TDF4bHVxTUY4SVdTZ2d4MXl6RlMvdVI2V3BuQzdiOFVHclJsUFVENVRvc04x?= =?utf-8?B?eGpITVJjSmIzRGVta1ZsSFd1RzBoQy9tNHJVZ3NKYm1KV3lLMUcwZlhoWjlD?= =?utf-8?B?K0RtaWhQNVduYTB3QnRDUGVPbFY3MzdkQkNPL2RmRVhwWjk0SFkzemJpbXpk?= =?utf-8?B?bmJseHAzVmZjaDduNjVLejgwYVN6L04yK1Y0M09pcHdML2tVQnlyeUNjR2Qr?= =?utf-8?B?bkNiZVBSVUZWMzJRbTVCWmJqV1dJTnBZL2ZOOE9GamoxTWxGa2d0QXgzWnRG?= =?utf-8?B?bEQ1YWpCU1dHRVY2NnYrQT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Ymx5bFhmUnR1OXVIcWpTUEV0VzNHTkNmN21JcXdkWHVneHE2YmF6ejQxOG90?= =?utf-8?B?R3JmVmplNU0vOGJNYnRYM3doUjBDc1VrSlR5LzZMWE5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?= =?utf-8?B?bllpSjI4U2FsWXFQOEFpQjc3U3Y5VEhVOEZWc1JmNGVoVUVKRTBGY1ZkY0ps?= =?utf-8?B?T2Q3R0hNK3g0MEd6cWhzdU5pMnFITzAzTjM4bElTNm9nY1FMamx3UHZvZzBW?= =?utf-8?B?NkVYMy9pOTZlaGJqUGZHSURVV2pvRDhqTXA3TkpsWjZBdHNUdEpobVdJQWxV?= =?utf-8?B?Q3U4c1hFNVZxSCt3cUs4ZnZ4cGVHbE5WZWU0SEYvOHY3NjVjeURRaC8vODYx?= =?utf-8?B?OWVNWEFXMUU4Y2FFOFhtVzcrOHZXVTI3K3gzM1kwYk83N1lJUDM1a0cxYzJR?= =?utf-8?Q?fM/2FeRpnjrxau/05cTY5o4=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: bbf1ddbb-f278-45ef-550b-08dc79978d55 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:39.7770 (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: 2b15sFV/mJMGzVT2m3uBjbb1mSeBbcfovUg3mfbufwYjHRU1fl1HXdsGWJO6lhGF9R1FNB0YedVP5vWFS3W8i27XphuDVUYLm1jZVpdH8FIpXW0qRD29Gv2DynAnBC6u X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297367368100001 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index fc8890f4e6..a2b275016c 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2078,9 +2078,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; + *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 "," @@ -2089,10 +2089,10 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VT= DContextEntry *ce, } =20 while (true) { - offset =3D vtd_iova_fl_level_offset(iova, level); + offset =3D vtd_iova_fl_level_offset(iova, *flpte_level); flpte =3D vtd_get_flpte(addr, offset); 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 context-entry */ return -VTD_FR_CONTEXT_ENTRY_INV; } else { @@ -2117,19 +2117,18 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VT= DContextEntry *ce, return -VTD_FR_FS_BIT_UPDATE_FAILED; } =20 - if (vtd_is_last_flpte(flpte, level)) { + if (vtd_is_last_flpte(flpte, *flpte_level)) { if (is_write && (vtd_set_flag_in_pte(addr, offset, flpte, VTD_FL_PTE_D) != =3D MEMTX_= OK)) { return -VTD_FR_FS_BIT_UPDATE_FAILED; } *flptep =3D flpte; - *flpte_level =3D level; return 0; } =20 addr =3D vtd_get_flpte_addr(flpte, aw_bits); - level--; + (*flpte_level)--; } } =20 --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297333; cv=pass; d=zohomail.com; s=zohoarc; b=LRWTjf20H99vbotlrpYKQm9bYBbQFn3kyDSdIt+gVZKCBHuM1ziwuwkBEsN4rjO5HaFsM0AQhkAlo0Lr05oIA+dUUmc0k0WM8CAuTzI5jSk0eR2/qqY6fPWY3YQx7joQ5ofLwbuIE5Fw/SAzX+JG9fJ3Xxee1q014WDmgRt44RY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297333; 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=OdoSWUTa9ddjTSMitoGhaOWL+giZnUC0wKZ/HGPO8cs=; b=Vd0ZsKZdebPuYN78uIEhKzAWaFcVjST/tLJ/KDAmqJ2xkpWCkju+3RxOJweVsqCPHmHQAcukfYcaqO2vU7E9XiTnWZzZ2dH/8pSut7cB/Ut24+IMebrP0zv1V7Xuqtm/URr5y/rVUiu2JFl4jGMsSMt1Wl3nlmH5lz9rZD2o+bQ= 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 1716297333711293.9244353533859; Tue, 21 May 2024 06:15:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI6-0008Gx-TK; Tue, 21 May 2024 09:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHX-0007j3-94 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHU-0001aP-VT for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:54 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:41 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:40 +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.7587.035; Tue, 21 May 2024 13:11:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297113; x=1747833113; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=OdoSWUTa9ddjTSMitoGhaOWL+giZnUC0wKZ/HGPO8cs=; b=cOwrdBR1zaDTpwBkwMs+n3cJ2SWZWMfMNGTVvK9giYklD7p5DhV8Y9Ie 5IVUMQ1HyC23EeBJud/jEjUb9YZS/4EfLpqd8K5r4h/5FWrOvJdFja/kJ 1VZd+1uPPWaZrx1nDNaTY6l8aGuSacQu763fKZhgfUOONRcnxrSRdjQ2P SA2DYi1d3r6WYCA+HyjuFLQe14NL1oCRYh/+aZTRtWk6c5PP+PCnGCQsQ 53GsiQ+t3aTqp/CQSUMwG68PCp7bGGc9/+WhDM+gC4PfCh1QbhTefty/k VshLYDpklBbYvNW7lwMHGQT9GD7Ns8lZrInZQzXW4S/BHPcsfAtbAMhRV w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13007994" X-MGA-submission: =?us-ascii?q?MDGNhRK9jPNimaYx1YbthKwrNoZunb2sl4B97n?= =?us-ascii?q?hxMoqaHfsRyddSr4+Fm41BA11IL5wBI8vlMFfsD5TMxx4eKC3SriyKUw?= =?us-ascii?q?ZY8gbEktDucLxkwyNOszJVLy+pJNVHX1Mw0xVzSQHU7tPae1x0mtZzcT?= =?us-ascii?q?+K39mxj5iKvSzDuSz+6hrTog=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UQPDoNYaGuhSJt6S4RHLjD4qKlNsRFWB1ewsmxfChdW2rzvz98gudJQreZ4luFAr4OCq1nZ7hhofJd1BSiumUltFJOmxPYCQdLRpfEXMPsTUNtjFOv3sd1BwEl6+VXV+2Dxj5Q2I+XKylI+CKSLh5djQR3Up2FIyPVPzsbjkBYKlxXD1BK7ZYpgOU1A62vDVPvk8Dca703Io8Z5MactW4WKuoNHOBhNXQYFMgpXmxYN+ETkZ/M6531AMXoraOs7lRqZdEwtBtX47U4mfH91fwnrqLade/Mw8XhwDXny1IcujzfjR9ji1n5Hmb9rYUtqB49K00U45lv+85XJfUo27NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OdoSWUTa9ddjTSMitoGhaOWL+giZnUC0wKZ/HGPO8cs=; b=mNjAy6lPmI2owi977ljDjUTPrtQgnYBgLbZjnLamk5tmq7PJW/YdpH2mqak9z+vGnQ/uUodIRimVYgC0eC4VtKEpQCOrdRP0V2h+iF2u+BnlgT0MaKg13Oub4UZRtT91ZSmVm4WQ0h6Bd2AEq07H5Y33PxYJ4bGXvSU4Ck29MTCviASvT5jenaPlUfs4Q5tUxihzc9BuS0JZQIRNwvGuBQATvzk6wINFHLu72XqfBorWBSiIrDheil4HdqEla7F28gjFg6cwABywmlUxBv9WS8Skc4eAx5AtbRht2uD0cL3i+kBdAzU0tV01pdt1F04WAroMV3PVTzpk1x4lrmOgQg== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 04/22] intel_iommu: do not consider wait_desc as an invalid descriptor Thread-Topic: [PATCH ats_vtd 04/22] intel_iommu: do not consider wait_desc as an invalid descriptor Thread-Index: AQHaq4Brm3Er4wjTZk+767IR2JUSug== Date: Tue, 21 May 2024 13:11:40 +0000 Message-ID: <20240521130946.117849-5-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: d04919dd-939c-4392-c243-08dc79978db4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?clJyRHBCVWVVNkFGRHYwc2FsSGpBVmlreFBWUU1wbVJwa1FEK1l6K0JKaGpa?= =?utf-8?B?Z2xpWWdWV1BIRGtmbk1YSytxTFl6aE0xUlZ2R2RaZG9MTllSL3pFWmlKd2lS?= =?utf-8?B?UEQxMzFqaW9PaTdj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ejJrMFM0THpFNkkwTk9IZnp3MzJMNWx2RTBaell3OE1VMjVEdmZUZUcz?= =?utf-8?B?U2RFdlRkZDNWZTVpalV1SFZNTXlkeWU0U05XZVJLalN6blBUNEVaMXBWdVRW?= =?utf-8?B?a09aelhvWTRMMjdtTmFZamd1WHF0Y1JreWpDZWxMRG9BRTB6NWp4TzNweHpL?= =?utf-8?B?UE41bzlOM2pTeE1iaHg1aXZEbHJqWG84UkxLTHk0a0lYWFNJQVJIVnJ5Y3VH?= =?utf-8?B?Q0l4dDNzYjZxbS9wWjBXdzFXZElLUTVJdjhlTXppMmlLZ1NUb1FrWkhhRzlM?= =?utf-8?B?d1krTkxFMGpGTWZQZm1ZMmRDWVp5dUpJWE9Nc3c2Y0dUdEJERllJOUZIcSt4?= =?utf-8?B?WG1ZSE05Z3UzVi9CSGJDd3FDSnYxQmZxaVhYbFYyU29xcjl2bzBLZ2N2bG5U?= =?utf-8?B?eGJoTTRISTg1M3IzMm54RFl2SWhZd08wTWlOWXpSNEdxU3pBYndIM3RSMVZ4?= =?utf-8?B?ZWE3VWlXUU04Y2FsaGdqV3NtbkZsQmI3Q1Q5TmhHYWZ4THk4VlVVQy90bjVL?= =?utf-8?B?VVpyaUtHZThEOEFGSElJYVAvT1NaVUM1eWNiSUFmRk5MUUlUTEE5ZkJtMzUz?= =?utf-8?B?RXNsZ0RiV0YycmlkbWEyYWJZVG1PR2NBa05qNHlNcDFUOEpvVVB3a0FDam12?= =?utf-8?B?NGM3MW5MYlBSaDhCVU9Bc0ZDMm50akUwSnpyUEdhNUNOSTNoZDdlYlp1TFc3?= =?utf-8?Q?1vIxQ1Di7HOhPieBqYZ/JraB37Vfro/4GfoHqF0?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x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-8?B?VFNrUmlBQVp3d21BTGNrTWhqT2ZyRExSa0FjTGczbXJEZTIydWxpR1g2SDZt?= =?utf-8?B?RXorYlJRUXRSU2VGN3JYUXNvdVpGVlZOVkFTb3kyaks4N3NleGd1aDlCR1Ny?= =?utf-8?B?UnJYWTNRd0sydzVVTUtqdzFUdUgxbFpGSk9JTU9IWW81VmZ0cXpwOFhkNWt0?= =?utf-8?B?M2ZVSVRuUVdMMDJkY2Yya2VIUEtNVXBMTmx3a2FSQk9pMXA5QWo0aHpIaG5X?= =?utf-8?B?RExDUUhrdDlKM0U4ck4wVG4rS1FzYlREQjB5TEdXUGpTZXI0Vi9CTy9DYlZm?= =?utf-8?B?OUpJUFpVV0dWaVpRZ0tyZTBINkdhK25uYlVCbU5UaVJZQWFSMHdpMzg4UklY?= =?utf-8?B?MjNGeSt4SzdvSWFoRnlNVVBhWEhjS0JvT1lQUmdsR1NjTU1PK1RrcWdIMjRN?= =?utf-8?Q?Z1X4ujcGk5GondWzkL8Jy50=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: d04919dd-939c-4392-c243-08dc79978db4 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:40.3880 (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: rBVBqRtMurVK5BdvZ0bnReyxQdDABthkCLIvQVxub8sE9+gwp9NuDll/2brt3jMb8lL6cTD6x7S5Da52rRBe++FJSZjiXUo9l2kOJ/FS0YS1VAua8DE2Ur2C+47CMm0O X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297335222100009 Signed-off-by: Cl=C3=A9ment Mathieu--Drif Reviewed-by: Zhenzhong Duan --- hw/i386/intel_iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index a2b275016c..f71c04d370 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3476,6 +3476,11 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s= , VTDInvDesc *inv_desc) } else if (inv_desc->lo & VTD_INV_DESC_WAIT_IF) { /* Interrupt flag */ vtd_generate_completion_event(s); + } else if (inv_desc->lo & VTD_INV_DESC_WAIT_FN) { + /* + * SW =3D 0, IF =3D 0, FN =3D 1 + * Nothing to do as we process the events sequentially + */ } else { error_report_once("%s: invalid wait desc: hi=3D%"PRIx64", lo=3D%"P= RIx64 " (unknown type)", __func__, inv_desc->hi, --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297244; cv=pass; d=zohomail.com; s=zohoarc; b=fWQvbJiQRBMld4dsdqTLBgsy/kxJgp1bJat4xHSZN6gWH4OaHGtqZ7YInldIKihBOzg33hWi+TE8bpqlZdyIk3R1HroGgzE+u0unAADt4CWgu2jjonDRycfjONPYNZJrsaRT/WscT7DUDyGsKOJIVWvpXjBgWR1UvQU2+BAzKrY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297244; 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=tIM0BHg6yThMkhqORC+BUeZDUMynoBvXIlaRATWvIhM=; b=kH1uliW5PCgrgpqhgD8UrmING2Vi/zLfhQGv9JXeC/DtgMv8pc+n7Mry4ialmdK7wAmBrRR+CYMdFy1SarukO0V25CbuY1jMab/DvtHhKsabHXaqTC5xRU8YjUlOei2wldborPOK25HdHJ6CRdOIuxN95j1FdLe2g9lMVmmNzWU= 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 1716297244320489.1009080953406; Tue, 21 May 2024 06:14:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHj-0007tv-5Z; Tue, 21 May 2024 09:12:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHP-0007e3-RW for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:53 -0400 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 1s9PHN-0001Zh-0e for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:46 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:42 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:41 +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.7587.035; Tue, 21 May 2024 13:11:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297105; x=1747833105; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=tIM0BHg6yThMkhqORC+BUeZDUMynoBvXIlaRATWvIhM=; b=pBCyUZDKY+cZf0lC2wb6xMSA5lE359V9+m1OBL3beIPWmxL8A0e2jNjY Xc3SgEze72xFyyrWQowfW1s8Hbh4x2bUfEXZneBpQeDCQCTQTj5wQXhu9 RrXGY3Po+cwEdMc0zqdndpk/GaFppb31bHqfBjDdcbvwE/AVptYzf7MVa i3sgx5s+P1f8e754PxjKpV7So40zgQaGKCeBcNF1AFjl5GyDQm2a1ZM1D Y40BhT9okFcZOot4VdLSpE3DandUL4Te8KW4kIY+O1BU44z6ck2w74Uqm qslZszSl7lbfGtHDENmOFJodxkotEfV35j1287k2L8vj96LlqFZIQArk9 w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061498" X-MGA-submission: =?us-ascii?q?MDFGfMax9gt4oByEnWpuEkg42rartscyw/UmjY?= =?us-ascii?q?0gNUmz2r+/bL+YQ1/N4t2yjzgyAEG3gj8sq63hw0x2TtUk0reLJAl2Kz?= =?us-ascii?q?XVT5hKsQpyyk0FFEfibearhyRzZVZXX95PDQ7xXfTXQyMCvgUHAaYcPU?= =?us-ascii?q?e/vvTjwHwrD8FjfCDUBHhW7g=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HcRr4R8KOh7ZxfL50Re3DE3ckW78jo7yQsrtUeFc54C7BDcBpVGC/92/EHUASSuHqfowzmU3rT0+ThITVME5WkrwMVscmiEU99s9KN+01aEtIaV1OjelTlvT1oG6P/MtgD1UXguu6XYWSDTIMmssvFPREbEwnIKohYnxLCjFT7a17rzY7/NF5/wv5Zbl8cEzXoUXs/by/MRUjdu2ON9Woirm2PoCZyel0CdWCh26p0AycziYAkm1S+87JCHH/zN5KOXyDYSuLBVJBQI2FIPgSBzCEAJwR5K8+jg1t2kul+dqua9jjbGg2v0FSFIbvcYwVRB0r7vhz76vbRmzMMWM0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tIM0BHg6yThMkhqORC+BUeZDUMynoBvXIlaRATWvIhM=; b=T3Q7s2g7x4F1riGiMADAuMVuaZo1ws3h/kLcsk4ZtarjY72Ob3Tm1tGGCdQCPMZNiH4a5o+h4N7Y0WpL3ca9/Va+EC2h0ky6Lfnoo7gc07VnJvIn6RPyucBwjEiPV/SQc9Izcj3LdzXWndiPt+UAN3QAPca17vkTEqWFCGjLMMLaEgRWBafi5nMMdwmoxL/EnhLIopSmkKKHSYkepYaQ8iqDfdm/J/fp7Mn4DLqGJ7BIH5mte3+XMgr+AOXjEq93AYGkaZnHjXRHK5kpfzdT92sQwaf7x393ew8eDvIna96A5JoRjmveJmPV4NaB4KtGKVZE1ufzgNOuITa27F0naA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 05/22] memory: add permissions in IOMMUAccessFlags Thread-Topic: [PATCH ats_vtd 05/22] memory: add permissions in IOMMUAccessFlags Thread-Index: AQHaq4BrjVcZ9I524kuvkvI+pg0RuQ== Date: Tue, 21 May 2024 13:11:41 +0000 Message-ID: <20240521130946.117849-6-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: c1b4feb5-3167-4bb7-d694-08dc79978e1d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?Z0YrUkRkNlhxUm5MY2VIVWljbU5FYWgzZFlHWTArQTBKb0wvMzZ5MzhkSTBa?= =?utf-8?B?SGV6c0ZiTTBEKzJHbVVwNWpXL1BJS2EvY2JPdFJZZWVPdXlweTFsVCt6UXo4?= =?utf-8?B?aEViZGJHb3BMNjUwQVppUCthYmk2R1VYT2Ztck1GbTkydFhtaGdpNkduODQ4?= =?utf-8?B?dCtBL0Q4MzhuejIxQzFmeEJjWjY1VzdqY3dVNG1lMWduU2VCY0pkMTd6QTVr?= =?utf-8?B?UGcrM0U1enVLUXBiNTM1TVhaeXRSUVFJQUdmMGc4TUdVWmliZ1dkbEFEekdr?= =?utf-8?B?VWIzbXFmcVpxdUM0c0EwUFhMNlY1V3ExUmJqc0pETzZiVmZGRHlGT3BHdkFQ?= =?utf-8?B?QkZIc1pHVmwybTU2ZW43aUxNTmczd1ZLT3B6N05TV2tIVCtEbDYvU1dWVEFC?= =?utf-8?B?RDdYdG1KUGhVVmZyRW8rd29VeXFDUmlFZ24xamdGNVlDbDZNSnJMSnJyUVRv?= =?utf-8?B?VVp5UGlQNFI1ZmhTalduT1Y5NEtxdkVrQ2pyYjhndUt3aWg4ZGJ4M0ZXSFpI?= =?utf-8?B?dG1GbVI5NVJjQitPUjRaUkhsYUQ4QXVINXVMN01MeGQvbTA5eHpvOTdzYSt6?= =?utf-8?B?QTJkQzNQeGI0RXkrcUl4TTc0OHJLd0tOMHJse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yZDVsdzFzMTQ0R1BmYWtZaC9jYkt6Ym1hbTNS?= =?utf-8?B?T3BHSzlaNHNpdDVYc3MvTWdMWlZ1bzErWnp2TTVYenoyVU01M3VjQTZVbFpp?= =?utf-8?B?MTYwaWhVYjk3clRiWlpIdGl5aWZsUk8yM0I4ZmF4dEUrVjh0MGpJNjhnOXdF?= =?utf-8?B?Sm9TYnhJQ0NSUnVUV3laczUzaDN0ZWtsSUJZU3o0ODJ1NjloYzJZTXI4REhC?= =?utf-8?B?TXdRZjB6VFQ4dHVlUVJ5MnBaWm9SS3duQVpVSCtXWmRBVmNLcis2TktkNDl3?= =?utf-8?B?WEEzNUdPcjdFOE5peE1Bdz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?OTlBcGIwREFQbENqQWo1Yjk5YmtkS3FoZ001S28zRUdIZzRXM2NLNFkvckY4?= =?utf-8?B?MHVReU43Y0g0bDd1S2g4dU9jT0VYYmZjQ3NibFo0ejJrVWcyZXRSemx2L1hi?= =?utf-8?B?dWlmZWJjTUFrQXN4OTU1cWZnS0dhR3dHSzQ0RlpqTnFsa0VpWjhPSGFxd3J3?= =?utf-8?B?TGFQdWhYb0V2c1RPMlNyL0czQVl4bWRYNjJoVU9SYW05VERPSDdUOFkyZHJG?= =?utf-8?B?TEExT1VORk5GTHloYWFLZ1FOc21wQ1hYdmthazNTWnhRTmwzaGdFa1JtYjUz?= =?utf-8?B?R1oraXIyQnllajcxN21sNU81aCswdTdkd1R6dUZXa0czTXRxb0trdzFGTmUv?= =?utf-8?B?d2Z0RGdyb3hNeEh5VC9HcW1ucWY2WXVjelU3aXMyTFdySUU5LytsMjVjSUU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Q=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <9DED61B897366F44B800F3F344ADF684@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: c1b4feb5-3167-4bb7-d694-08dc79978e1d X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:41.0279 (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: 4k+VeVuaX/iox+dSqEsKZdW87htQWFTYPItV+5Q1pjETRgDTcYKVRul+uedavD/lB36Y0exdSmY1UkKLTErEsx2VnCienD3GdboRqDCTPKpaA/uv0mAu9hvZN8Z9qdcz X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297244764100001 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 dadb5cd65a..0067b2266a 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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=YUCA/i+UFr1QHgqv2YYl0dKUtzy9m79eL8NVKGS2//Z7VJtEpGzgOmWGCij+c6vsm6pUyinod3iCz7zai0BdLxrpW550Pn760gnjsU4I0OPnR8cLGqM8AHhOUB3Y5iMhPeavVsk5iPsSKji6nAAvMx+IWRUCzirXoBEFR75E6kg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=JJToM5aUVZELZtQhaipfZSocc6vx0ws4JjCmNvITMS4=; b=fjcgp3lkoaKurZrWB3jlXdRlWIhymovK4tGAjpkSCFe4GJSa5BLQvgo9TpGIXPZ+DY7cLDKCLuC5zN8lVTYMkQToXMqeHIXT0uDWgQTEngR2mB9B6FvPzXfzQEmNIQqPWkzxhSj3/mvHzMwGc8MBdIMAjRi2GGYlow5niKOUqdw= 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 171629717226418.564936477592596; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHl-000807-7h; Tue, 21 May 2024 09:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHU-0007i4-FC for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 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 1s9PHP-0001aH-MQ for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:51 -0400 Received: from mail-db8eur05lp2105.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.105]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:42 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:41 +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.7587.035; Tue, 21 May 2024 13:11:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297107; x=1747833107; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=JJToM5aUVZELZtQhaipfZSocc6vx0ws4JjCmNvITMS4=; b=Q4ORA9NQzvt/9qGsZ9NsecRk1oRlnQPuGSjQc/a/Pn1skVBgL26ybrtK 0KPrntxOrabZlrLTnw7k1L4OUUGZbqYciTjGSppBD3MUjvz0HTC7z6xZq WmpQI7eJPtg3ZgxuWsUjLg8Qnf8r28NIx1vUv+r1nm5H5itON/HTNHuZb DTXWzMyjrApZfRT25uk1UlfCyAao8Qd8sqCB6KyZCfvQ6g0qUL8tkheEc yuLtJd+CwM7hSn4lfGoYqsJusau8Y/1XTmaSwDHMeAstcbF5GYQ/v9C6k SVhPrZXKCZIAHKHmqlRVywD96bz8q1UK6kWE0vgV/3+s8MsJSQus8E8zn A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061499" X-MGA-submission: =?us-ascii?q?MDGGmiUBTtPJ58NJ3am1XcxCnTVKvHX9z2M7Zb?= =?us-ascii?q?68JTmXlydljWyvft7Sm5CVtmJ/EZellkdczteT8VVfZ+n5jRFC2pxw5J?= =?us-ascii?q?cfGc9+HZDZEFY0xm0pnnf3UqKQ3549K3yQ7PbrgWA1U1ifSvOvcooiQ6?= =?us-ascii?q?MHa9HwwwQlYqbYmCfci6cDiw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVqjDoiaN5fLIVimr0e/TAcbscvVjwz39szuZOhf71/yzbppimVUs6TA/FUsugN2X6i48CbCKdpwbX4WBnIGVJ7Yb7JOZlpDpoZCbNhMpe3a8DEohFfaDJQp6IHzJMXq3Zb4uqMvGuPrWpVIisIjIE/qpurYX4L27vCV6zmvENtKVURxiGeDjN+v84o9DEOOhAxm8h7bRw/8zfHn4DtZGba9Llx3owq82lTeKa9pvK1N7buU9M/9uP4sTOG3zXLHmeckdB+4R2xPbJjwU7QLoEBUoaBLwE/nzLXlepOCFcoj4lMuz2FuiwEJSwPInWnVd7aAxrIeSJKi+KfmgVQEyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JJToM5aUVZELZtQhaipfZSocc6vx0ws4JjCmNvITMS4=; b=Taq9Lwr2dFpCIF8fy9Ul+bxt/Wm6eMeqm/D++C+M8oV2rdGBd5Cl7gCLCeybGq7xpba77VplJSaGBU3N2bkOwcYnnPTQrd11sDYobyCO5lgsh5oAhCzB3xul6P8BHm1Tm6qPA4BAJ+vztt9uFaT/+/Kyr9INIVudGDfHZ65qT75gwZcPkg/I9XR9Jd0T3FrcpoU0R5Ac0iixNUGoBGsFrsuEzqZpBlVRZVhm3gtlP/y6S4UHRwhYmrn34hgcYwByIB9Py7+XSKIq/i2yjZSmlal77nTFJEC5RaLvL62H5Zp45qxRc5m0hCn5RZWNsC2DwLthOjIu5gxUj2o+yEiY/Q== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 06/22] pcie: add helper to declare PASID capability for a pcie device Thread-Topic: [PATCH ats_vtd 06/22] pcie: add helper to declare PASID capability for a pcie device Thread-Index: AQHaq4BsddIhOUtVnUa3KEFa1N4Zig== Date: Tue, 21 May 2024 13:11:41 +0000 Message-ID: <20240521130946.117849-7-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: 2cbb2d2f-5b03-4f81-814c-08dc79978e86 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?OEpRb2NoSCs0NWtEaGpKOWdjTVJLNC80TjlCdWthb0JQZ3FhalpjNVF1QTJq?= =?utf-8?B?V1NNWkY1bVR2VWt0SENPRGdEdXFjZmh0aUxPcEFWejFNb0lBb0lia2QzMWNm?= =?utf-8?B?VjRQaWxBUFZHZGhiTzh4MnNObDFYMmVibmJmWkFXc2ljTHdwODdXaG0xL2JQ?= =?utf-8?B?TnFObG14RXkzNEJ5cGVaQkdlRTdYVmwrMmozT3FvUlBUc1hPS1RoN0xSckNu?= =?utf-8?B?R0o0WXVERzNJUFVxeHpUREIvdER6RUlnUzh0WXdtVnhrSXI1MVcxOVpMeGl2?= =?utf-8?B?b00xa1F0N1o1OGdCVjhtSGlXTVJKOGtqNXl0WXhHMGhxVDNvS1gzSlRTdnNZ?= =?utf-8?B?dzlUdnhHRXQwdmZCaUhmSlBvTXZqRmpJcG01VFpxYy90Qm9OK1VLQmxmdGta?= =?utf-8?B?UGhsZlFTQ25URFpYWmVMOC8yUVdPMDhTY1NITnR3Tk9nUkQ0K3lldVd0cldq?= =?utf-8?B?MmxRSTRXNTFOelBGZ25UYkV5eWtlZVpNLzVvamV0RlQ2a1hCYTlNaHRNZHda?= =?utf-8?B?VGF5S0sxQU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XRRWENtR01hV3pwQXJ0dUs1Qk1rV25jdFYreHpsSDZpVDJOVGZubUUxNmRR?= =?utf-8?B?NmduRkVnS2dLUlBrTUVLbEQwVFRKUGUzYlZDaG5sejNVL1VDVzN2MEZKVzB4?= =?utf-8?B?bFJyMkxIaE9FSC9iRi9YcjFHZnJ3UzAvTEZsS2ZDbEVPNzgrVlB2a1g0NFVJ?= =?utf-8?B?ekZKYWRXU0h0Ym8wdkFsYTE5Um5CYm41eFovVm1tWDFjekpqbGNVbDhnTlM5?= =?utf-8?B?bTVTdkF3Ti96ZDhxeXg4MVZhRWd2Y3E2NUQvSXFDSWxGdDZWekorakRVRXAz?= =?utf-8?B?MjdaekRZbW9JSkhGLzZNUVRuR0V5UWMyU1o2VmUyUmpUZ3p2dFFGSVZDUG8z?= =?utf-8?B?UGhrWVQyQkF2Vit0WndBZz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?dnRmMWphVEoyTDMvOW5CT2ZySHVCSDZIdjA0SUpja0lTT0k0T0UwcHh5QTJp?= =?utf-8?B?NWU5MmpOSC91eVl1OFNhSEV0eTJkczhPOXNoVVErLy9oZlA1Z1VIWjJsVndz?= =?utf-8?B?ZHBRWm1qanZob3pUOWtrNmV6azlLWFp0bXk0d1I4clh6WTRJSVdDWEdvWEtN?= =?utf-8?B?azNaVzRuNXBwbE9jWXBpRXpqVDNTbXZBY1pVMkVWWlZmeERNQTE2S251MFZG?= =?utf-8?B?UTY0SG1EL25ua1ZIU3hHODBydUU3YnNPQ0xIU1hKV2dWaXl0SXhzNTlXdERJ?= =?utf-8?B?VHBUWTVWNGoyWGhTQklQMngzOUpUYnROd1RS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-8?B?QmFNc2VYR3d0eG9ib21MWk1ZU09WQW5EWUlRQWtBK0hEa1RwT0xyc2c4YnVh?= =?utf-8?Q?PnCTNZNGuYDmtGUdtaWRQtM=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: 2cbb2d2f-5b03-4f81-814c-08dc79978e86 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:41.7446 (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: ZMRGYmhClema51FExHKXmDWGnVVZdqvdFnIt8sqY8NTBuoXx+zfuzDfvQl9aY7cO/G9rGOHdr1MXBEwtBfYFN5+3QFCyDOH4BO4pQ/tiUn7XLUOUBGbtY3yxHKEkIySk X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297172750100002 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 | 3 +++ include/standard-headers/linux/pci_regs.h | 1 + 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 4b2f0805c6..d6a052b616 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1177,3 +1177,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 5eddb90976..b870958c99 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; @@ -150,4 +151,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..0a86598f80 100644 --- a/include/hw/pci/pcie_regs.h +++ b/include/hw/pci/pcie_regs.h @@ -86,6 +86,9 @@ 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 /* AER */ #define PCI_ERR_VER 2 #define PCI_ERR_SIZEOF 0x48 diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-h= eaders/linux/pci_regs.h index a39193213f..406dce8e82 100644 --- a/include/standard-headers/linux/pci_regs.h +++ b/include/standard-headers/linux/pci_regs.h @@ -935,6 +935,7 @@ #define PCI_PASID_CAP_EXEC 0x0002 /* Exec permissions Supported */ #define PCI_PASID_CAP_PRIV 0x0004 /* Privilege Mode Supported */ #define PCI_PASID_CAP_WIDTH 0x1f00 +#define PCI_PASID_CAP_WIDTH_SHIFT 8 #define PCI_PASID_CTRL 0x06 /* PASID control register */ #define PCI_PASID_CTRL_ENABLE 0x0001 /* Enable bit */ #define PCI_PASID_CTRL_EXEC 0x0002 /* Exec permissions Enable */ --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297333; cv=pass; d=zohomail.com; s=zohoarc; b=mETJLva4aATkYTJdjmcnQB2o+AOtg1YPb6qefW00Mi/yqi5Cn+LjUTcTnG0oSl6pZZfmJ+Gswa02WZWG9F+BV3xjZ+6iHe9HlvNOgoWX93Wz1hiqqbNLw/2zAzPtz3eyZzXDwJh/d90GW+o6IAKxc4oZn+AS+axpGRkJ/bQVfXg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297333; 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=uArRsAtZO0QeDOuLsYInkvN90lliPubzGjvNNTs8OpQ=; b=juOkLh2krJdcy+I6bdu1boVn7xhojr9QhxdbRn1TPxRzYqzu3wrB2JH+6+X5LdhvEOZxekfGiAX5EO832OSzXuke5tcPd7SVn6vGy41WM/4INlKzyfeDAyVLGEKscMKyUGegivdScja+b5hP2WeNiT+JdS3B7T2Md7QDtpDhlC0= 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 1716297333059853.0657497545907; Tue, 21 May 2024 06:15:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI7-0008JP-Hl; Tue, 21 May 2024 09:12:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHU-0007i6-OD for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 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 1s9PHR-0001Zh-PU for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:52 -0400 Received: from mail-db8eur05lp2104.outbound.protection.outlook.com (HELO EUR05-DB8-obe.outbound.protection.outlook.com) ([104.47.17.104]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:43 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:42 +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.7587.035; Tue, 21 May 2024 13:11:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297109; x=1747833109; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=uArRsAtZO0QeDOuLsYInkvN90lliPubzGjvNNTs8OpQ=; b=DrQU/LKv5jOenlEoyZoLQN8+ID9egfTYE2/5s8v2gJtkBcNUJ2PHPRY8 g24dMzkVbyW2gc+gZEt/UxOs1N4d+Cz7HZiNPTblBmfATAs4xbbHFFhYG OP0VLtOUUi26Z2yhJnO6iqAesFOTgRAucJPUg0XzDwzr1z6JqhnNo+rdU 1Dh2bYNxohxe+ypAK3Q76YAPyIG7hUstVW4nrmTdoIVNQlW4gGG6dfRK+ +qA5LULP7CmrSpRt45Hhx4Y/2IsMu0HuYXDZqnG4JNWdRq54N74cDeyS6 vfrgF5uaRaEy7aGJENoJ1O3VzBbo29ZyNvo+ikTfeUEZGtIlJ1jnSdIrm A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061501" X-MGA-submission: =?us-ascii?q?MDGLMDEiMuA9tmwdR9S42jc2p4jF/cXqufxVRF?= =?us-ascii?q?CeFuNXiavCb2MY1w1P6t8MQknTPA/fkuvlBS1v5JEekaczTK4JdZetYv?= =?us-ascii?q?8hwYfbb/nRJuVGdAAqbxK62Q9ld2sEgwHtIYXm3WLjvMdwBMpnFfLR8r?= =?us-ascii?q?VuXl+qPFSDrJfvDROsquyiew=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xx6D2ID6N4aHqYLUd7dYrjb17gGbR75OU93X0+eTyp3pc5yvupNPOmq7q5uSWW5TTrRtGVxtgtKaxeaaXvLE8IJiyZtPIGn8VipHg+LPqAXJZh0VZCVqiZuj5Osht+X/aVDf1zlgdeebi/NUxDvpu4xNimMr/7HBf/s1tArKgKd/hX1t061d/UgQOeUKsalWfrETrIO/REh4AyNu3jRjHRGPlSpfzUuJNo9G1T3zhyKZzlbk8Jh9l9cAPaxL7BVsBq72VbKOqferlXdlFBumaxwATlGhRA9feexrYVUvEK4PbEYLBdKJmC7f3ko1GkV7gwbmZwDuK4ee7Znh5Ii5xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uArRsAtZO0QeDOuLsYInkvN90lliPubzGjvNNTs8OpQ=; b=gze1v9EM++qwKT3/L56vz9Lim9T5igYcPn1wQvRSKre0KlW4gbC+ouyxEdCob6Y+EMfKyaIUPqKT0VBv9xKJTnd2e43ArTg61+2DO2IJHuY976MTu+LxN9HkNKKABTr/WXWM+ba93abcF8Hpn13+EloKzdcS7BVr9MXJwncZewQSLUJfYW+bQ3+JodqhQmtbKjb3pzRmn7njN0s6MYUHEZmVGhGYicWyPSC7zJqvN10QnmxJpla4RlLSxlKb9f/J96G6YMHAjBfGw/5XrU7WbGrxk363w9eZBNtmhSJg0ToHkPH73w2ok1Qe2yMwMI0ncm/i1JMUPDayFuM++pKajA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 07/22] pcie: helper functions to check if PASID and ATS are enabled Thread-Topic: [PATCH ats_vtd 07/22] pcie: helper functions to check if PASID and ATS are enabled Thread-Index: AQHaq4Bs64wl4DvR/kGSdis2w1PqIw== Date: Tue, 21 May 2024 13:11:42 +0000 Message-ID: <20240521130946.117849-8-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: f629a2fd-e705-4687-6aa0-08dc79978eef x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?TlBXN3FDRjZvL0E1bEtYRXhnNTJZUGZVVGtKWldGRzgvM1VSbU52NVp4QWVp?= =?utf-8?B?cDhJRjFHNldtNDhmVFMzclBXcVZWNC9mcmpzUDFXcUhTUFNKbG0rTklBclJz?= =?utf-8?B?SVgzYXcvWW5sZTJraWRscURaemt6WUtyZ2xOdHYxOXVzUEZDd2ZEMVVpeHVH?= =?utf-8?B?NkR1S1JsaW9vNjhpSW51bkVqMUorSHZmRSs1WndEcFJGK3hPOUt4MmJSc05O?= =?utf-8?B?T1NTTGs0Umd0cklLY3ZTbk8vSlpOOGloK015VHZCNVYzL0NrSkgwY0hwTExH?= =?utf-8?B?WTd3ZllhekoxZWFjemtHNlhUd1FhWC84cVErdjA4dlF3bHptTVdHVDJvdG1a?= =?utf-8?B?K0wydnpHZFl0U1Q3R3FQQ1lCVEtzbXVZSzFQU0NzUmhBM2swbk9Ddk1qZnpF?= =?utf-8?B?UFpMVkNqQW1sdEkxRFlzU3FTZXh6ZkFJUU15QkR1YWQyY2h2VUhabWNUQnJw?= =?utf-8?B?NHQzS3d5VlhydzNmMi9IQUczY3M0MGxyQU5OUHFBalhDM20zaFBRZlN2bDRT?= =?utf-8?B?WW5lbGdyRm01YUdQSWZYdTBLQVB5SDVFV1BqVlZzNWFxcUplQllZUUp6QkEv?= =?utf-8?B?OXJjbmFlQmdWOWM5N2w5cEZZVDRsYVp5eTJ5RTkrR2V4OFdqU2NEcGI0VE9m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JvKzI3d2tpUHVsZzZJdFFN?= =?utf-8?B?ajduUnNhaGpsTVZiMHZjaVVpSGtnYklCZ3Q5a01Zb2xRZzR3TU90UEp0RVU3?= =?utf-8?B?cjZ1TXNDVDF6RzJYQkxjdXk0TjlEK0NoTGp3N21BSEtWY0hoVnZlRXZ0dzNI?= =?utf-8?B?alBHZzZPYXhsbDV1alZBcTR0eW1mZThNc0xRQVByclF2ZzdnTlQzNitLdlQx?= =?utf-8?B?OXhjTE0vQWRIUUUzSmY4RzJyVHJMbkhCVkpWalZPZUhzZzBCUkZXaXQvVXlB?= =?utf-8?B?SThrTVlLYkdwRUUwaHJJUT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Z3BtM3E0enZEbnMyYW04cUppOHQvM1B4bGZCSUR3LzE5N3ZtcFhKUDNzNkV1?= =?utf-8?B?Ry9LZmFYRDEvaEJwQ3ExQmJEUzR6VWw1anh1UFdSUXlpd0RkNnI0aEpJZWZJ?= =?utf-8?B?NDg1Zm9jTEZ6RnZieGMxd0VEM2t6RGFubW1QT1FKbmtvM3NCNjBuTVJwbkl2?= =?utf-8?B?a2gzSUtQNDRSN21zVnZiY1lLYUZnaFJ6MmVsaDdnM3F3SFh6QzlQd3hneTVn?= =?utf-8?B?WWpZbVVLK0Yva2pYallNeWVTMnNwc3YvbVhQdUV1SWIwN1p3WnZHdVB6WXk3?= =?utf-8?B?RE1yMmlUUXdtRXhsMy95STFPRTM2ZSsycS8xd2I0TWNWMHh0SFRFSlRncEpw?= =?utf-8?B?RjA0R0ZDdGdEWXROM0FqYkM3amNCZVU3T0NPQVZaWmJNbzQ1V1J4MVVyOUFO?= =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cVBB3E=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: f629a2fd-e705-4687-6aa0-08dc79978eef X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:42.4223 (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: AOjSLVrAJEWxhhAqGwsKjlaFOuAUvlMYLyZ4ggf1eQzv/DXWuKyMJHuH8JC5Z1qqWHb45h/y3o5Jmnsl0yT1vU0ZUtWUkt9TrWTzDw6IRQoiKnXUEGUDnoUXgnPF9L+/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297333223100001 ats_enabled and pasid_enabled check whether the capabilities are 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 | 18 ++++++++++++++++++ include/hw/pci/pcie.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index d6a052b616..4efd84fed5 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1201,3 +1201,21 @@ 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; +} + +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 b870958c99..0c127b29dc 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -154,4 +154,7 @@ 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); +bool pcie_ats_enabled(const PCIDevice *dev); #endif /* QEMU_PCIE_H */ --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=lc/hF7/yL70kB6fUN9d4B8+ueot5tppQfqKNlUqGWFqNypNPt4Py3jgXzC8D6caiV1nAa2ERkEOfp/Il69egA5QIFw9cFMcGr7bqtPOOz3wdLdUaTvPzyaHmZKi+6feUC1IzeGgso+UpxgOMMTz2XOXnDn2SCw5JDc9cZfWeh/8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=FnPgbHkC17ljlEVDc30FuyLZ9hqEYmiwbjpX/Fru8IU=; b=IY0A6sBRYLmw58mitSILmxdwgTUnYF/1zz9uW2q36Okj9JqBgiGxh6iYVs/kuMAYV7YjPawo5CxAvGGWGUzvnpKnsVaG0H4I73wRF7KB4vk74qtptVUvCughL18STc9HGW88DxhK7z3pfNtfz8l3toHreV1AhePxC41zF78iOek= 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 1716297172010678.5904234925935; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHg-0007s3-Vz; Tue, 21 May 2024 09:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHR-0007fZ-Vi for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:54 -0400 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 1s9PHP-0001Zt-OH for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:49 -0400 Received: from mail-am6eur05lp2104.outbound.protection.outlook.com (HELO EUR05-AM6-obe.outbound.protection.outlook.com) ([104.47.18.104]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:44 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:43 +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.7587.035; Tue, 21 May 2024 13:11:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297107; x=1747833107; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=FnPgbHkC17ljlEVDc30FuyLZ9hqEYmiwbjpX/Fru8IU=; b=FRGxHm9Kw5wTtUaMQLEqgFz5BCkIXR/UFIV3pZ7qD/4ZP70lTkNX/HTK zHCCFt5YHGw6B1jrSP3kUvrPk+bQ/mEZDy18OZPYG+TYCalDxE6JwmVaO F+WTqrpA6CwO53pM902qcYDorlbDa3edRPYVFDDwfmbe3o3OkZSF4LtHr CM9HlbOFbMdE8ODYGfgdaeqACYAJuK8ShQA0qWXatpytGlGSTravo3Q09 L+CpJIQEZkfBbE+DznN5eBB2wc7B9+y/m/AdYUxAkvYFZOYe92YkLP7yZ 2px5ZaT+wHl2z7Q1ld48X9yA6udvLITCaIWIko3kDiRBCrfyG9jm2HE5i w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13004102" X-MGA-submission: =?us-ascii?q?MDEj2JkUrBop8uMRj8lln2EQXWm4iilFzeZHCW?= =?us-ascii?q?qi2Ec5ed9pENb8IOm190D4CPe/XIX+FzqNdi/F4r2HHbgOHUosMBO/nQ?= =?us-ascii?q?mDBwOLGz7hfS/ikR7orEuL1fN7gUT5sdN/e3BrV8Xwgc7Wwtjj8L8g9r?= =?us-ascii?q?36pOAYTx0/0qgrtmjWWylbCA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lz795raY1HEtpDEbbQi7qbiKkS4ftilrRj2TLrPXucniVPHI94vBmjxplFu5+Mjs+XZgGq5Kjjg+PpWqM4uxFIfXPMmczTGOj+2zKVlNRoQoUj54IpcPpCPrSbNC1omsdrI8Mc99nzdJ5z5Qt9D8kYfO0AsV1PkJD8UKnkHRxZVIJxqzLCe/AjgbqLrTgd+5hd8ngnjrLqxL77iJm5Oqy3tx5NoAh20tenUFTzHu34tjdMrzMmYUeMB8Q2POj3hdfrwFnDiVEzxXVQJ2ar4k5dsdCBqrUU/f4dfk2fBws7uNdZKjS8RpWrmSxWnpmI44GpK7TIeoYLdZYgh/CLdrxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FnPgbHkC17ljlEVDc30FuyLZ9hqEYmiwbjpX/Fru8IU=; b=LtkBgud/A77Enhf+OPAZM7hgCRlnKtZT5WR3l5UUdGUXIDGOVAJaVrT74xoNCQb/yvHgY4XyplAEs2J20eyKxSGD8iCTYf0Ii5jyyXK8DnZHybVmURA4FInZFS5g/cmg+qYg85Co1PXrnWjc+EZl8nONjHpgABZPVuXqzkugIFciv6gU98zO1gbaGFtKMDV40NDqzU0MxNd6z3X55G4btYfAzxLMMfIXQnrQsBnvx4MmwjV/1a9CijKznnsydX95t+drhy5xSMh7ofIVL7hjJES3q1nw9iSqn1Dzf/J5mpd0GRpnIeG8uQoicf7rPzYIGnnq6YhvE/kkofQQXNpicA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 08/22] intel_iommu: declare supported PASID size Thread-Topic: [PATCH ats_vtd 08/22] intel_iommu: declare supported PASID size Thread-Index: AQHaq4Bs2yEvb1zyt0O4idZ0yyytdg== Date: Tue, 21 May 2024 13:11:43 +0000 Message-ID: <20240521130946.117849-9-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: d7b47cd2-a6f5-469a-cd0e-08dc79978f4e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?OExvaEpzMEVZL3IwUU5JNHlTRm5vUnhSZHJySFVHSk43T3B6WkloRzcrTU12?= =?utf-8?B?UU1JbHpDaVlBR0ZuS2lBOXBEUDAwUSt0RDVZbW5FSkk4dnBtU3lUQk1DNnlk?= =?utf-8?B?SzZFb1lJR0crbWc0ak5DczNqTUNwNnFiMWJwdGFTQmpISUNqWGtncWdZQlV1?= =?utf-8?B?SFVpODRYUmxBYXErRGRFYnJSWmJuVTNrTUltYy83bUFLMGsrRTlqQnIzSGtp?= =?utf-8?B?WGs3eFpWb0luc1E1dWduUlIwQ3JnWHkrNWdBMVcxQk1oUXFONUkrY2pvWmsx?= =?utf-8?B?LzNEelIxUWZvK2lVTVlXV0ZZRGdtN2ZBTmZqVzFTdTBpWCs5NWFqVWhDTDNl?= =?utf-8?B?RC80Y21ZTTJMWXlaQ1JXSVJPSlNUc21vMmJvL2F2d01LcTJnOWVZdWpJQ1VX?= =?utf-8?B?YjVneWlrSDZJUGVhTS9STVZ4bU1GSVpUZFo2UWVCZnRTdmFGRXFNci9xUHkw?= =?utf-8?B?QW9wNVpRdUg5U1N3Y3pVc1BPSC9ZazU1Vjh3NFIyTkt1UmdXUklmT3I5S1V3?= =?utf-8?B?SElpYVk3S3RVWE8zYUpNMnRMTW53T3pHdG42SGtLdjkyNFBIUkNHQXhGKzBa?= =?utf-8?B?QytTOG5tMVlYNnRRQ2xCeFF0STNSZlI0UFFQV2ZxVHFhbGR5RGRaUnoyK040?= =?utf-8?B?SWxDajR6a29PNzdLWTdMMThIcURMcFlKU2xLTGYyUjVXZGZadi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Tb0o1MEJ2TDVGM2pIVW9ES3hj?= =?utf-8?B?NW05OWVPVUVlWC9IOTYraFZzRnF2ZmNKcjNqTG1Sb1VnakxydHA4ZWQrMVI0?= =?utf-8?B?RU55WXdkS1pELzd4SW5PVmVHMkh0OStxdzVFYzA4VkhHQW1pdWZjZ3NsaVBv?= =?utf-8?B?aExEaWhVTEdoUU53UVY4ZTl0dzhuVWd1NzdGYlJtSXJMWVpmSkFnL1VkRy9T?= =?utf-8?B?TE0xbXZmd0hEU0ZNamRldz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?M3FJNWJTbnJqQjJtMG9jVnZ0Q1IvVHlzSVRScjRBeGp3c1ptSEVLVkxaSVQv?= =?utf-8?B?c2JZb2N1c09kZXRJU1JGbUQzdE9ueXRkK0dVV3JFNTlXdFJoY3pnNytEUzhB?= =?utf-8?B?UUdicEc1d2FmZ0ZGakdlZVNNckttTXpzRTNaL2lIcWtKeFprM3JwZTNMVXQ2?= =?utf-8?B?KzkvM2hvaGdGTlZ4WHJtbWtlV2gvUWl6YWhGdnlMRjFvUkNEd0IrV3U4bE1G?= =?utf-8?B?SjdFY3VXa3REWEsvalViZ0JNRGs4QUFlZ1EvWll6Q0hSalp5dWtvUkdCZ2lI?= =?utf-8?B?ckNxbWxDQ1ZKekdmMW9JMWZCUXp6NHFVNk8rNkhjbkhuZTFrc21VZVBWbXJ1?= =?utf-8?B?SllXMlJ2SXREWEltOU55SFVRMDVqWVVvemI3eUY0RHVGSGFudlBjc0d0OWdJ?= =?utf-8?B?MTJ4eW9kTEltNW02WmY2VTlqR0ZNTjMrRXhzYWUwNDdFRFF2UXZTWjJ5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.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: d7b47cd2-a6f5-469a-cd0e-08dc79978f4e X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:43.0530 (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: XYq8OjzzHSyK12DNRmdq/b5vKWXxCJj0ECHFtMXea4YQbRfpCBVl3g1ndGlmKsw5+BLC3CltOKj0zXeVAwlgQFM7XQj8nBOSvtH4aik7q2Uqmjn1zSJRC7bFYYu9exfK X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297172785100004 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 f71c04d370..7d86a31bea 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -5838,7 +5838,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 c9a673585f..1b0d8958ad 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -194,6 +194,7 @@ #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_NEST (1ULL << 26) #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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=Ozbz2bQ6CqGkED3P/bt4louk5eHDPnga65cJKlpYEAZTbxNvPvzLiwBIP217hYqfP9EVgblcmfFMSAr6842tFhtUV1o/kpmbO9ep1TqZH541FmqznNDBJgr4dO2LoN22eQ5cK6aQFYLQ8BW9eagOvwG764uN7ZoQN4Eu1EkhTlA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=CKam7zb8e546M/TrGYyCxbXf0VqOaiRtn7XcC+gjZ+8=; b=X0jK8RUTVED1XbS0c3+WFtJm03DG8KZecrRQiKmEG/8mTP9Fq5HZs6jy/pfweBGPPwUfbxVVnjjDrXr1Bm1Bg+BLZp90UbNl3PFBL03Hcqge9NfGWmr0hUnWoYqxI7XDU8z58weRkf9WatAjQCrv2ZIac8Eceyqn4Mok6dXHOu4= 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 1716297172163880.7003260023224; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI0-0008A2-D7; Tue, 21 May 2024 09:12:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHU-0007iC-Rm for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 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 1s9PHP-0001a9-MQ for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:52 -0400 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; 21 May 2024 15:11:44 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by AM8PR07MB8148.eurprd07.prod.outlook.com (2603:10a6:20b:323::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Tue, 21 May 2024 13:11:43 +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.7587.035; Tue, 21 May 2024 13:11:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297107; x=1747833107; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=CKam7zb8e546M/TrGYyCxbXf0VqOaiRtn7XcC+gjZ+8=; b=EzrNN85aeRGupVcuLLnKfvyeaj0oQLeU70WJ5cnuUzD7chRfnwQRFrA4 ywSGWpiiIM5nvp2dKsKPR+F3hzjQFND70u1o8GxVViST4XW19ynpBCpOB Cc4jYO9/XGv9poxBZxYdDNHDiaSFO4fameqewJAWGycq0fboJboTSc2E3 aALhp3vaAkUmI4I40s6iCJ4O+9Oltu4JaGSnHj1hWjsNWEAfiJxdzvemM mNCTGat9uTTpoRcBfvujhDbqLLokX/Hnk0mq0v4wDM75RzcTw7srRyHvv BT6C/vbjk/VRFbTFGgS37HLnY82SCi4nVG9D50pOdCe/HddKpc2I9BvMd g==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13011524" X-MGA-submission: =?us-ascii?q?MDELFSXt+lGXbIMvEN48Gstb8L213TGh6Coiko?= =?us-ascii?q?J5zmPAbRet9PT+6o23E+sIy9Q1/zmYQrksGWHw8/CzOkMsSEaATDNskn?= =?us-ascii?q?m2wpE8IxsUKnAZlgHZ/JU2gzLAjT2Z/iMHNgF+Uu7xoaBZEFTmGE0BgF?= =?us-ascii?q?35XnxV6NUnwYuTkiPcaX7FDQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GDGyB2jmbBR0ouRLgSESkwTx5HXL04ZtS1xfrGLmZM4hXSLOdSSXaVnasQ+5d2hMzrzVph71eiCkZJfJwJ37Kfv4vUV9OYPeNiyvPfccoify2cjqvj4x0/Q8jgdEat48BxXN4u/63A0lSJwN7Q6QQiY8rcc9leXJCPbKqjB/7uWgI0eUaNQZtXjA0WOaima9GdSzfM4Tb1KP+FXYAffCyAtDGgerLWnwZCOa57YDdoDguPxBwHhzxbPgNi/1eCHFGrSX6Cb0ZQ9sddvStheuuglFsrXKq4NUrAaLgHdKemmiENupRItY2NzUH0idgWOvwz1V1shWw61vHbDnybJzpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CKam7zb8e546M/TrGYyCxbXf0VqOaiRtn7XcC+gjZ+8=; b=noXeSnSmDI4zd8ymeN07HdRPFqbLhdaXC6sbgB9PxHGz/89PdBr7hDQpyKWsFNUAgEbKzaHxEWS0FsFS0f1DUhuWMxN3OUGeCZfdLj//wzObikui6MdRQdcSJ6Nf3z4iD8eAI2xFfnsG29WB+epFc5GbE1nFF/7PUY4+FUTLQXlc4SueyHuCRzj4FJ66jswni8YyONiHOynChTA6ASkpcnoLnc6bJoZ0mINhMi+MWtQf28pImQ/Bj5uGalZE0EekKSCZ9He4pHBUJ8/SCfOYIsvbxcXfYlqNYwNE0DXEPO+KqqHjZDU4IMiIBKuhHiJpGKhkEWmHsQhY0Qk5/gKw+w== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 09/22] pci: cache the bus mastering status in the device Thread-Topic: [PATCH ats_vtd 09/22] pci: cache the bus mastering status in the device Thread-Index: AQHaq4BtCDCpPNoyckSYkgx7CPioGA== Date: Tue, 21 May 2024 13:11:43 +0000 Message-ID: <20240521130946.117849-10-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|AM8PR07MB8148:EE_ x-ms-office365-filtering-correlation-id: e15cc6da-fcda-428e-acfb-08dc79978fa4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?Nm1EQW1WNlZmVWRRVys1NnF2TVBON29PSnZvdlZTdFJwK0NZY0gva2xycnRR?= =?utf-8?B?emlIc2IxQk1OQn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ront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?WEJRUE5rbDV4cHE0VDhzMnpQNkx1SjF1TjRJY0hsWjlDTnVUZkhQQTVWYWVh?= =?utf-8?B?aXNDK3Qwd3RKMStkYjYvQ3QxemFKV3pvL3JwRUJ5dUlsYS84RExoVE9pbTNQ?= =?utf-8?B?U0xQQ0t5N0svdmFHZnBFbXhteWl4UnBkeDVFdTZ2cXZkLzVZMzhiN2NzUm9O?= =?utf-8?B?SHBreDgxWmtEOGtNaE50aFdCak1oc1RMV0h6NDIxdXNVQjluTWVZVDdzY0hZ?= =?utf-8?B?d05mbHN1ZWZrZ2NSNGRhK3Y2dXQxSnRkem9yV2VpQVNzdUs3QVc4MVRqN3lK?= =?utf-8?B?aGtGNHE1TkVLdXdLNURXaDFQYjR0c2RnVU8ybDN4QzVsYWM0WkRmTWdQaXlt?= =?utf-8?B?Vnk3VGl3RTFXQ0hNc29TWUFHWDJBSTRlMUFWZDV3TFN3MUNybG92bWMremw5?= =?utf-8?B?aGN6eGlGWEh0RVhoR2tJQzlaU08yMkdjOTczeTRicEdRaytNb2lJQnBCMzE2?= =?utf-8?B?KzJuMXcrVE12L1NNRTQvQTlGWXE0YWd4eE1ablFIT1VUUExKWmhUVFpLb2Vm?= =?utf-8?B?ZUVydGV2NjNBb250OFhwV292a2p6YTFYYkI5Y1AxZFNiZ3VUekpHcUNxak9r?= =?utf-8?B?RGNmWXJZNjVTQStjaXgwRFpvaE13Qjh1OEM0ZUREZitSbWFObXhlVURwRjRC?= =?utf-8?B?RUNZc3Rhamw0L2cyYW95OWlTM0NDNXNVcnE4dGw2Q3RwWEsxcGMvVDh5RnVN?=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mcEVHZWwyRml4?= =?utf-8?B?Q29mUU1FamtyWXZWbDZQRVROZno0d0lONEllbW04L3I5N3dPc0tFRW5mWTVo?= =?utf-8?B?bnVDL3pPQkpzcUx2VVpueElWL2ZLbGRTUm85Mk84NmVJbFRZRE1mU3UrWStz?= =?utf-8?B?S08zM2ZLeVhkT2pMZEF1MldTTVhPRzlKMjhDOFpsTnZGd0VJb3dnVExiSzl4?= =?utf-8?B?TVAvUDVianpxQmhsSnpxazJlMnRsMzg2VlhqV01iT01BV00rTGdVQlFvTW9N?= =?utf-8?B?bU5uc1FUN1Nxdy8rMDlaL2tjTmxYME8xbm1CeXVnSHRPM3MzdDZ3bUFjWS9E?= =?utf-8?B?OU1FSWppRmllcGdpOW5WSElBWnZ6VUluWWxvUDVmMmM0WmMxUmpOTjByTW9I?= =?utf-8?B?Mm9wMmNwZzFsMG1HUlpBQ1FDT0licFlkWDRhQjUwYzFldUtzK0M5OWhPcTBm?= =?utf-8?B?K2V3M2ZoUDZQL3Bob0RvcXh0eXZMbkJBQlNZbE5teTAzRWpxL1JEVTAza2FE?= =?utf-8?B?SllLNlhVQkdHN0oySjQ2c2hRdzZDd0k4Zmw0bXl0Y3FpakxETzRqZE9RZFE0?= =?utf-8?Q?3dMYzBerh1A44USs1G7gn6c=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <7561F19B2814E945AC1BC4EE055D1EA6@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: e15cc6da-fcda-428e-acfb-08dc79978fa4 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:43.6658 (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: pa5f9pQXLZzOmnYmtjZ1hHolt0tGDHz303oxSHNYbeQcEG+OqW+aJRsgU2cTp9Jwds008HYqbUSQxvfPUMkjov0OXX9s4pWANMtVq2qV00DFckNRlMftMAXLA0y/GIRj X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB8148 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, 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: 1716297172744100001 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pci.c | 24 ++++++++++++++---------- include/hw/pci/pci_device.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c8a8aab306..51feede3cf 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -116,6 +116,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); @@ -123,7 +129,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); } @@ -657,9 +663,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_MAS= TER); =20 g_free(config); return 0; @@ -1611,9 +1616,9 @@ 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); @@ -2888,9 +2893,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 d3dd0f64b2..7fa501569a 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -87,6 +87,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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=lqs1Mu/xuZHYlEAwzNaI3cor7PM1h5IladGw0CUn3SL27oc+Yhugf5dqWU8qRYOC9crK0D/hjmZqQ8qL3gahtT25rOepDxQkqR2Gl/AJVqhYddmR+va5tkhfuHD0vEH+GHdhGrLuiCu/JXurK8rNhGgbRucfJvJ9BiRXxGn5l6A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=3fCaFwfQGrgfgVmWEfraFRxRnf0Uq2+4zgU97Hu//68=; b=ipky2Ruc8QPAY3WPepOktu4Z6jNhiUZPR7ldpkOfnaSV/NrHiXLFm7YA+tiT81mRhzxw7fIXA2/80faLtvvsmwH5v9Hxzj3VPLBHFECA/vvxKU0cFq8j5jN0WpsWK3ORQj3JYfS5n0bAeBK5pKzEsQM/UzDxbLFGXx7dE1wGdDQ= 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 1716297172148549.0434847988249; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI6-0008Gr-Sc; Tue, 21 May 2024 09:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHW-0007ie-5u for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 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 1s9PHS-0001an-Cy for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:53 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:46 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:44 +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.7587.035; Tue, 21 May 2024 13:11:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297110; x=1747833110; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=3fCaFwfQGrgfgVmWEfraFRxRnf0Uq2+4zgU97Hu//68=; b=FxXprDypM58Fv+2fVgDwnfi4Detzeblh/2sa32IlvBVFIkuzSwCZU9Uv r1BSkcNxYHVtBIzJNGXhM5n0626m/oARDx6F/D7TlMYhDEnDsZZ5ugjIE uSVLF6kVYWb+jalO/CnKDmmzrxSf/tBkqnRTkO9VlWV0RBZ64bw/NktvL zVmIEsP3Fx/T4WVm+Df6yBrsPVN9KaqZg2ideNkCwiHMfcQYQPHXGeJn2 C+LHKRlGQFF3W0ZQNz/Y05Tx+U0IE2gsGod71lqCXv4oc86vhnp2s2AZ+ iRn7fNg3ZOlMr2rSsGk5UFFu7ihvMlBkey80SXFsYyrKJK2TSQ17S4MFK g==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061506" X-MGA-submission: =?us-ascii?q?MDGtbafTfxr6W+lytm0q9PlnLtGNa92s91gC8m?= =?us-ascii?q?D7cSpxrwq2t8cf/60yNH9sIbbcn0WC4rkjL3B+G8c0r+pJKpzi3u9YJ8?= =?us-ascii?q?f/uDd2YUDgf2ofg285NQ0C8vrJEyv3FD+vCWzfDSCHAGxjhob0xRdhkw?= =?us-ascii?q?EpqsXWY4tYXVW8hr3UllutZA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNaGI7trFtK/3iS+7Xo+1SIwAM7h11sz7cXb6D/JeJYqr8RtBh/5KBudMW3XCjPzxOFAK5iEennjAOzf7ODd2Sbmpjuy4aiwPi0AqPUaZCzQfEXkYZIPqDrjiSAm0laNG/2vXeFy2M2dO4m+34cIEccKcbx0juOqNPImc42/XAuOTyjRWk1Xc5/2iPylJAxLPQe+ymdxkKbyP3loXtlPH3zZd0OW/0ltnzCg9sQGMqCEwd5KhA08pMHwCy1+8EjkEye4wZrJKjO2FZsa0r9WCuvVfLo1JSkJrjyYgacdMj/aC7/bhqT4cBUj8f76AOwWCjBJvDJwn44RkbTFLnvpXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3fCaFwfQGrgfgVmWEfraFRxRnf0Uq2+4zgU97Hu//68=; b=inaqWLOiOYdQW3nGfvKNtJLVqxTXldDXk2D4kLHIPzzzxwDI1hekFgDLUJf1koDAER//Rs35YiW8b1ykEEfzrai8RiJutZEOE90vl3UWWFbabf7u39iDsy/VXHiUVC4mgBjjQQ+8mD2qL5yxtJ8d3UugP0O9j6z8jHfMlWQCKXNABrvnUNPy5AEzLiLB3EGy3ACOazyMHNuj17yofwzB5uATQ4Hhj0j9UArtGllaNL4o9t3ditV8Y7IBoDPFAa5kL9hZd2wHb3VkEkZiPmm3+8cqfcwbvMhBFJ+6LtJynPR1QZxCxNvU2faco47VoC+e+x+1bE7X5hsAAEJZ2hImUQ== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 10/22] pci: add IOMMU operations to get address spaces and memory regions with PASID Thread-Topic: [PATCH ats_vtd 10/22] pci: add IOMMU operations to get address spaces and memory regions with PASID Thread-Index: AQHaq4BtilJD6RPkfkmwyxJZ52pxwA== Date: Tue, 21 May 2024 13:11:44 +0000 Message-ID: <20240521130946.117849-11-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: a52fbe34-9bcd-479a-ad27-08dc79979033 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?a3RySXFiRWlNc2Y3Z3pkT29YNHgxN2MzRWxSM0hkVEx1T2hwYlVHNjZsVU5K?= =?utf-8?B?WGZaMlUxdnA1OUdBdVJZcEZUWXI4Y0VSVGFuaE1MSVRPZW05a0RmVWtBbXM5?= =?utf-8?B?bGxLZE9zbFVSN2VyWWNKWG1HcmZ5VGJCY05NRkx3NitLT0NkWVFwTDFSYWdX?= =?utf-8?B?SDBITzJIaG1wZGJ1VndlYXBzZjBkdnJOaHd3TWdIMmd1UU5IU2FsOEdRbFZ4?= =?utf-8?B?a3NLcXd6cVh2WUh3eEQyVGxRanVzRGpwU2p1TXlWS2tYUFFvOWJrZ2tyUG1K?= =?utf-8?B?d2N3N1NBUWEybUFWNVN2SE1pVjRiUkM3anY3SHZDSHRDbWhwQ0pBNTd2Mitk?= =?utf-8?B?Y0JzVndWSkkxQWNFMUJ2MVkvVGI2Y2s5NTZDOVZGY0x0ZllhOStuKzFIWXN0?= =?utf-8?B?NDU5bUVI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x0WmVkWUNp?= =?utf-8?B?TnRWMjliNGRaUFpXcVdYVUIzMjE0N2k2ZWovajl5NnRwdHRzVy9XeVc2b21k?= =?utf-8?B?bmFVcUUrakd0aGNVbDR5aVh1cnJGVStqaDBmSjM4V0VtVk43b3pkRVBZMmFD?= =?utf-8?B?L1hxbGhZV293bWlYSm5FVlp4YTRkc2tra1dhNzg3UmhLdDdTOXRXYXVMcmI4?= =?utf-8?B?S2txd3dvU0FJN3VRMlpFdUpobzJHSEI0SzQycjdIZ3BPNUs4K2VxYlpSSG1O?= =?utf-8?B?WitwSFVITFBkLzVFY0twVzJ3WWtUbGhINHIyVjY1Uk0xUCtLejNDajNMemtQ?= =?utf-8?B?ZzFKTW96Q2Q4NFBHQ2wwMGpvN29md1Q0MWJvbTRwY3lrcXNnai9obTJzcFlk?= =?utf-8?B?VXpUakprRVJEY1VjMmtJN2QvOXgyZ1ZWK3lRanNsYlBQQXJNT2NrK1IrbmRq?= =?utf-8?B?TDdrNGMyOFFuM3dQTjZTSmlsT20ydjlSdFYzdlE5eDM0QVpPdC9OUjNabWhw?= =?utf-8?B?ZkVCUVBaV1ZGWWdoSXgzQT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?ZFVzV3UzeVJPZG9MVW1FMjByZmVMNmF2UE9KejhQUjFsMExncjJycDNlMFR0?= =?utf-8?B?cEplN2c2Vm5laU9GbGFKRWtiU3ZBMk9wai9teWVaVmROdzVSMndXY0NJWjBy?= =?utf-8?B?SVg2bklXajBtemFudHczVDVpOVFVTU5acjVZQThVWGNWTHNmUGZVb254cXZW?= =?utf-8?B?azlIZUVoVGFJb0hpZmRGUGk1YV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reFRQ?= =?utf-8?B?SGE5eXhuSmZmZDl1Z3Q5bkU4TnJaZFpBTVNrdm56eDZiQUhNTkx6R0QrbVcz?= =?utf-8?B?ZHdtMkNKaWZRSTQxMnIvZ2F2UUtncmpOTXhhNDliTTdKaktLRUQyNDFSOTBR?= =?utf-8?B?RUsxS010MVdpMGhrK1QybE8rSWJuSE9NcG5aREt3bTAzK1liYU44VWJmbmRx?= =?utf-8?Q?hYdHdsh2DC4sSCkkLhaF8cg=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <1D8919986CC53C4D9298509CB75EEAF4@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: a52fbe34-9bcd-479a-ad27-08dc79979033 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:44.5708 (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: N+cdNNKT3sf224fwfkKY6m/E6dbSCotR/F/KwvQ1EWeRAm+NrOEF7VjQ2E+MxPaoWqlUumzdKEvJddg2QVcHS/YKMmkZchX+i+ktfvAKdi364Yps4SSOoZu5pYMnsrfk X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297172752100003 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/pci/pci.c | 19 +++++++++++++++++++ include/hw/pci/pci.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 51feede3cf..3fe47d4002 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2747,6 +2747,25 @@ AddressSpace *pci_device_iommu_address_space(PCIDevi= ce *dev) return &address_space_memory; } =20 +AddressSpace *pci_device_iommu_address_space_pasid(PCIDevice *dev, + uint32_t pasid) +{ + PCIBus *bus; + PCIBus *iommu_bus; + int devfn; + + if (!dev->is_master || !pcie_pasid_enabled(dev) || pasid =3D=3D PCI_NO= _PASID) { + return NULL; + } + + pci_device_get_iommu_bus_devfn(dev, &bus, &iommu_bus, &devfn); + if (iommu_bus && iommu_bus->iommu_ops->get_address_space_pasid) { + return iommu_bus->iommu_ops->get_address_space_pasid(bus, + iommu_bus->iommu_opaque, devfn, pasid); + } + return NULL; +} + 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 c84cc9b99a..6c60f7a7c5 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -385,6 +385,38 @@ typedef struct PCIIOMMUOps { * @devfn: device and function number */ AddressSpace * (*get_address_space)(PCIBus *bus, void *opaque, int dev= fn); + /** + * @get_address_space_pasid: same as get_address_space but returns an + * address space with the requested PASID + * + * This callback is required for PASID-based operations + * + * @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 + */ + AddressSpace * (*get_address_space_pasid)(PCIBus *bus, void *opaque, + int devfn, uint32_t pasid); + /** + * @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 * @@ -420,6 +452,8 @@ typedef struct PCIIOMMUOps { } PCIIOMMUOps; =20 AddressSpace *pci_device_iommu_address_space(PCIDevice *dev); +AddressSpace *pci_device_iommu_address_space_pasid(PCIDevice *dev, + uint32_t pasid); bool pci_device_set_iommu_device(PCIDevice *dev, HostIOMMUDevice *hiod, Error **errp); void pci_device_unset_iommu_device(PCIDevice *dev); --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297196; cv=pass; d=zohomail.com; s=zohoarc; b=V68TbwIuTgo74oTQs8mQRc3Hhi6CFgzf3xzu23prFfmSPKRx63uPR6FqlHzsybxu5aXLf6OPa6t23PrszdpHNGaz17AXU0dFhX4gP9YoZuje8U6YUmVQtNVsURRuFhiRaz0LyHXOFHaUhFxyKm8lXuyNupsKMPd4buGQPLCGn50= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297196; 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=1KP+zeK26x+doh2isKWRxN6rm1DzgfpKS4lDIjc+Dro=; b=g8cv4eVYcgzZNbIgQYkXTvnq62gPK8JuzWsAuBNsrimYLQFGlTG22Mv21UT37MzqNCfx/fgm2Q2eTJhQizW8QdZ3WtNdjEQ4iyv1eskR5wMkIrgmuLdaBi4ZVaBvEtU2dDSwxVMv2RzdEuatpqSrFu+vRBpaor9y4ey5Id1yB24= 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 1716297196942858.3593943076831; Tue, 21 May 2024 06:13:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHk-0007zk-T3; Tue, 21 May 2024 09:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHW-0007ih-IL for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 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 1s9PHU-0001aH-S2 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:54 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:46 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:45 +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.7587.035; Tue, 21 May 2024 13:11:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297112; x=1747833112; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=1KP+zeK26x+doh2isKWRxN6rm1DzgfpKS4lDIjc+Dro=; b=Z4NvI3mVhBJq3qkXFTxC7fetvtZpzI642v4bMNLE2dcoFJUle7OziMjS FeasUswgYoDDOTuFoXrH3mPZvPVQ00ky50mIPoDUTpq5W+vvIlcwq3ZG3 thdrOHHCa2g3pmZfAqNJLAuf8uQ8AoHEwvdICFcMaUc4XrG0HjWPQkMht /TRZN1Ri1s0mUyeiScHWAmmBGhmQU0nUWKYYNc3H0E+BEaUx4wT+WAeDj DeJV7xEy/pOJCGHdTLIfk9eh0NEvQvLjq4ZJUxjec/ZHeEd2/ivM15vzp flqx7aLuJDPRMpE9LiSi2HVYb+idG+MIFVfq3iAGUV5uL5Lkhcc2A1U1S Q==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061507" X-MGA-submission: =?us-ascii?q?MDFTAb4y57vFCnQNzlJRHyL6rfgX+uPtyWF8N7?= =?us-ascii?q?RiIni/BgHazqgYbT/oAQutPB16I48K74vb1HdMwHppw8WQcBhPMCvC01?= =?us-ascii?q?p5YZC/jkcQsXYrkH1il2OSDttU/1VKPkKR83ibnRgFmzMS7wTCptEAgz?= =?us-ascii?q?eCLsRx0yuq+jB28YuFTEh+EQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N1VxaiidyN8T8IKzWgu4ODk9t+C4A4gl0HsIYnGAVxO/kWwje3IdtlBwDImSfa83M8TkcxgVYkHWYMYW3OG0Y9IRdemh1y4FQSsMlKFVIRk1+JMiKUs3m7JGGHPWKQ5yycSlHgdLFyYMGDJ7bhqTji437CPxrXkr1QD08+RML/bMEevVZp9p4+yjkjIXSxTITF3Ie06xs3JTJom4ppmP509J7o1CQUai3PGo5aHUZyccFSCP9dZ0KjVOrz+JyBqlw7bpX1F7RxHN+YSX5MQl7fZWD4+nbABEMJFeYmpQ+WSn80CwmXdyq+KVd3lABE0Bpx8aOmi98KoUJtdssNXi/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1KP+zeK26x+doh2isKWRxN6rm1DzgfpKS4lDIjc+Dro=; b=KfX3RcJvuULU3OdCKCy0NN/Fh/kjtgKFxNMgX/unJ3mIc3qCpxXhHIaCfqbFpwmJ1uNZM+fZBsJAEfAUDWE7Mf4pw8VwoCNah9iCwYHKoJxfFMTwX4YdEyOxgZxLkO1nxap5m+5zzK7FlAw4iccAb9Q9CrNWyXt0zlI+ggnMDHioZCxNi2749NjoVWajqM+x8P4dSCTu/QOZ1eWuNuwswkkt+ykRGHkjv2xhPkpZiHeD5KjJn8YHPlGydNtbY4FXrK//VgODZ9WRFOtilC5BoIgxCYfHuH9jTao6PhZowve3zo6y4J7JjLGYpA8LXDFoODrnP31luLBaRWdeFI+Udw== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 11/22] memory: store user data pointer in the IOMMU notifiers Thread-Topic: [PATCH ats_vtd 11/22] memory: store user data pointer in the IOMMU notifiers Thread-Index: AQHaq4Bux/vp8d1aW0iFdkcO/MvXEw== Date: Tue, 21 May 2024 13:11:45 +0000 Message-ID: <20240521130946.117849-12-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 72894d0a-45cc-408b-2250-08dc799790a6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?QUIxVnBSTG93NlF3L0lieEFOSWhwSUdVU0RDWUJ5UW02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1RRbnBzMjN0WVlPcEs4UT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?WGl1NE5ObjVUajlKaFluZGpNTFp5Q0p2MHBGUm91UmhXTklsODhWRXVJeisz?= =?utf-8?B?eE12SnBPZGdycS8yVWRnSU9Ubm9PUy9VbWVLT2ZSSG9GdE0rNVhkU3dYZ0p2?= =?utf-8?B?V2lsMWRZMW54dTVSMHMwOXhpMWlnMHFFMmxuLzdjUHdTOFVMUFJ5bFcyZXhi?= =?utf-8?B?VmJMTytRaUh2Wkd2VmhXNmdVRUhKMGVlTjlBMW8vOTgyZjhtTnNqVlhhaCtT?= =?utf-8?B?OXBoZzdmdnZqTUtDTHFIZ1lFd3NXS0FyNEFMSHVWWTBGZFRPRHU4RWNBMXRI?= =?utf-8?B?VTVHQzhPTUJXZ2JPbTJkUG93K1hZenQwaWVRT1VmVHRWK1o1MUwvYmd6SHhQ?= =?utf-8?B?UVk1U1RZaDl4U2ZCQzdCc3o0MnJUcDJBemNPRkVVTVdENklhVittQXE0UE9m?= =?utf-8?B?bkxVL1ZTVHRSSGZkY3hwSC90NHNHYUJueXg0Y2dueGllL2lXNjBYa29jYzBW?= =?utf-8?B?MWJBTEFtYkw0Q21YSVNVamFlRFpzUUpLMTBYM1dQY1NmWlFVSmxobFpFMjNQ?= =?utf-8?B?ZGNJeTlqaHFGMFhmRVRBbUU2UmJteEZLaDN6cW1qdm51bzdVZnRhamZwdkd4?= =?utf-8?B?YUhrcmQ0dTlTWElDTmU1Zm9udGxYeWRiaTZEdTB1N09nTk5GUVlVYUFidGdY?= =?utf-8?B?T0VSRUtTNHFnOHRLVHlOSEp1VjZGN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VBdDByQUxadm5aQ3pRZldqc2pmMWh0NXp4dHBvZWtZQVI3dVdVRWczOURI?= =?utf-8?B?SVVsVkgrK2g0aFJHd2FZNlJuOFZTRGsxRm4wMnljVDVkbGF4TElqb241U1h4?= =?utf-8?B?SWo3UDhwYUw3L01BMG5VSTA1UHEvUFZLblVVSndya1BpNkZacHV6Qnp6V2xK?= =?utf-8?B?SUY3bUhJUTZuazBZRVhyem50M21yRDl6Zi9Takc2d1I1b2dYMWRhbGtoUDdM?= =?utf-8?B?SXQ2ZlkvZGhuUFkvL0hrOVpDbURtSDZUWGFuamZCRW5RTjNBcXpVOE1CbG9H?= =?utf-8?B?dUczdUZBaGhwa2VpMlBxby9RSkxiMFY2dGxOWU5ha3RmOHU0VWhuVU5tUVdw?= =?utf-8?B?c0ZCRnRhNFo5YlVXT1BzWXk2VENjbW1uQXJBUGtKS2JOazRlc3ZENnVqbjJL?= =?utf-8?B?SW9LeVdkS1dWdXh4Z0Z2U1BLdHdrRnpDUFBRY24vUDRDRUNXK3p5UHhuTjl4?= =?utf-8?B?SjhZekwzQytybjR6cUFIMUkxVmFEbk9SamVWMHRaYmxZdzVYcmFleUh5aXJq?= =?utf-8?B?TDBYUUNxZTQreEZkSDJkekU5MkhlU1VGUFRyZWZFZ1JnK2FtZ3k5aUJ2djVT?= =?utf-8?Q?laeWOgb5OiahAdHfumDP58k=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <3B1EBFE97BC06346BB98F0D3C817899A@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: 72894d0a-45cc-408b-2250-08dc799790a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:45.3337 (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: 5ZcviH9BLRnx5Ab/EUAoa/7DAONcmM5sPTd43vSlPugnyCSSoYj30qaim1Sq9dq9yHoo6ZRtTi8sDzLLg/awIBIEciZ1j9HbATt9q2+VM/giG9UaSmRd7IfCmnOMB/9A X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297198532100015 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 0067b2266a..359bca2ae2 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -203,6 +203,7 @@ struct IOMMUNotifier { hwaddr start; hwaddr end; int iommu_idx; + void* opaque; QLIST_ENTRY(IOMMUNotifier) node; }; typedef struct IOMMUNotifier IOMMUNotifier; --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297309; cv=pass; d=zohomail.com; s=zohoarc; b=jCe2gWNpnUUc2uZ1CRV8DNrWUslGDXnqmXRYPMq0qiNn67iIS5KlOy/9uarv1iTau8ynyuQu6Ql7PkSRgjQcgtDVl47CiYvUdPc16usYLHWe8BBz1yLW129DS5PAussSdEL1feilvdda8EuV3/z7+YBoghmuIDFsNd4bu2Wyx9s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297309; 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=8GU03lMLg26o1svETtJlIBqEUa69Gidx+p5JjCEJw4o=; b=aDxrVIKpenqYtEmFoDAQ3Sj+ZTSsimkih+1gH5ART5gjEXVM5PRCCGJcDSXE2z1HiitqEpLyZCL/AaGjvxjo/cy6Bz1YcwNehdDz+1sX6i1WxorLn4Gm+OPwakyhyOKGawDJoCxtKOJWQEVaw5kJOID+tn3daAcnzWce6h8cE+E= 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 1716297309489806.7739984813168; Tue, 21 May 2024 06:15:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHo-00081T-3N; Tue, 21 May 2024 09:12:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHX-0007j4-Il for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHV-0001ZU-9j for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:55 -0400 Received: from mail-dbaeur03lp2168.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.168]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:47 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:46 +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.7587.035; Tue, 21 May 2024 13:11:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297113; x=1747833113; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=8GU03lMLg26o1svETtJlIBqEUa69Gidx+p5JjCEJw4o=; b=pNYY1y+svE8M0v3ADhYd3OoSBY9IaXGN1ZNgVkpr11v/Nk2Z8ACgo1+6 uxjjOWmWh5YI2DevxVbcq28UfAu9g8wUUabakvhiktg/qWaHzdqFOtXqW 2jmaI1P26x0xt17MxSL5KML3Mwo3WnAH95si7H0ENs9BaH9ZQeA9m22HK E7RYXLhIlDBhyham9BEwkcOLd2TOpmV6KxaxS7SrQNH6DJueBbh1d1clS Cb2Ent2Zl2FZTbwWCQfWG8Oqv26OyfW3Sg2TEVxHmpNk1w9dtBRJQw7JN +FVH1E8+xskNPx4NMjdKxpVjyzeoydHzFkfAgNdEMGVbR3lT8jNZYMSZK g==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13008001" X-MGA-submission: =?us-ascii?q?MDG9qdn3Uyn/Y7UYQZwolynDeoy6s57ew4fIME?= =?us-ascii?q?rye0JCeA64twQk2W96vDNTdcaBh5X5e/C521o3x6/8j1UlEoeZ4tNz4q?= =?us-ascii?q?yqbebNeBsADuFBkgkQ3+xVsaApJjpNnfOYV1+dJYlrSl1FCY85yd3aNo?= =?us-ascii?q?kIwxQk2JSMVnpyzFUZKgYjyg=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XONUUh3ILGm9RX0Fq6QAv2u4BKP5VIbl/zqY82nijyZJyjVq9kMLgANPuaEgqn+a5aC3n3IYuKaCxx9ylTpaqxZNBFistEF8chFhCEY91S8npzGha72c0q4JqYXu/NKKKqa4rzgC+NA9Ov+ME+caQyQYy8viOfHI53iYHeYkfcEPbXGl8vqapjc/vhjfxqG5cMdHoyXjKJgRmppiyUnDccSsWASYahSRLdFQUt2skyi7JEm9pgHmyEN9izSIPr/21FQSy/ohUDOfZispv03Cvj/jtsTHqTcSnLIiuRDhJ1j2KuFKediZcoM3pFFjhWRhE+xS5sCbimTbvbWghN1jkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8GU03lMLg26o1svETtJlIBqEUa69Gidx+p5JjCEJw4o=; b=f6js85/VWNiG164qr4NV0QxstjR5ftbav/Yxztd7l+BqSwGCLcaGfRUe+WuU0hdBik9gfH/NJQ9NDB2es5GY47grUnDKT/uS3+U2h3FinoQIXBSNttnr17mafZre6V7vc6H4P4aLQ4sWwSxThwJ2M5V+8EdRK8fvqYqCGUsUiCRTQ0liMATZBh+K3ktd2zGL0BKzSBqWurKYncztwmgCfUnP7F0bEBFIE9ZqZ+ojjePHRUWP8owBbC4y7UeRLNchRGHWMjS2YXM5O85Xw5VQzRBSHZUyBjTuVswPOAK8TKLKg0MgvAwEbRiUaffwDs5yE0mxmcH/3JPsxEFCcv2S2Q== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 12/22] pci: add a pci-level initialization function for iommu notifiers Thread-Topic: [PATCH ats_vtd 12/22] pci: add a pci-level initialization function for iommu notifiers Thread-Index: AQHaq4BuIH0I4A4DJUyHT8GkQmNaSw== Date: Tue, 21 May 2024 13:11:46 +0000 Message-ID: <20240521130946.117849-13-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 74c113ac-ce04-4578-13e8-08dc79979122 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?YTRsZTJlWEMrUER0NUowQzQ5SSsySXM5MUdhNXlJU3M5Zm9SS3FjdktJdjFI?= =?utf-8?B?RlVoRFd1MkFLOWVuTjFNcHpVWlZ6d2lTVVA3Y2FrRml3VWIwaUNaNTNlOVNa?= =?utf-8?B?dmIvVGpIdTdsaEREeXRiUTF2aXB5UTdEMTA3NVJocEF0TDRDVGFURFh1Y1dv?= =?utf-8?B?ZzdmVjd5dXV2WkQwcmQyWGNTV084Tm5yQjVVbVMvNVlGdHR3N2oveUlGZHR4?= =?utf-8?B?OTk3UFpncGtRcGNtMlhKNEVLRFZWY3JpSGswR2Q1KzBwSjJEcktiWGJ3VkJk?= =?utf-8?B?VVlaU2puQ0dEQnNjRnc5WTdJMk9CSUdsTVBVaVlWd2pPMUZZL3Faa0dId1Zm?= =?utf-8?B?U3Vmd21jc2Q2dnZjL0FpNGZIWThVdzVzK2Fqam1rSVp3MzBBY0F1blZQWVN5?= =?utf-8?B?MDkrZVFKSU1tQmlUbTM1NGRkNUhsbjVsdm5VbVpVOXkyRTFlaTRzT2ZCQklE?= =?utf-8?B?NWM4YUxtTXdwNERBTGN6TUN5c0VCdXBLMld6OXRLMm00YkxQZG1lYVhud2RM?= =?utf-8?B?KzEzaDNaYWNRcXdUY0NhVWEvMGp1UDdERThrcVBwSmg5SlRrbWh6S0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EtYQ3BxcFpzUXJZVXlzeHNKL2NvRHJEaE5NMlZD?= =?utf-8?B?cldteVByOXZncHdITzlqRldvWFpQdEo4ZHNiYVAvRzNWMVlqR1VsZTI3cTZR?= =?utf-8?B?K21xYzZ3OFNEbzA5aFJvb3JrQnlrTkFlU2c3YzRDYVFIck9RdjZaRjNLNGxT?= =?utf-8?B?aHF4VDV3cHdQNktPR0RkNWVZVGs4bUY1YnR5Nkx3VEx4ZW1XMGpNZ1dkcGtp?= =?utf-8?B?WE1PRnl2b2VYVklkTUVZUHpCQUo1SlpqRGUyenQxTGQzek9Yc2loUmJwQzFs?= =?utf-8?B?cTh0RUM4VzBydHFIenNINEdpTTdydmpsS2lGTWxMNWtZV2NhMTZweHFGeVhj?= =?utf-8?B?TGZKVTdVbnZ5cCtkVCsrZz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?OWdRMmx6TENVb056TVFySGVFYldPZkI2b2hvL2RkcTl6YXFiOWh1aWlRaW9t?= =?utf-8?B?KzJSWjBhSktPZTNoMThBTlRTcFNWU0tUaitvN2JWaGlTWlNEeTl3YTBkY0xo?= =?utf-8?B?VHg3dUQrQnd1cSthbkNSN2VNTE4rb3JEakdUVWJ1MEVSdDIxNWNyV09IbFc5?= =?utf-8?B?UkJKV1d1V1N5YXpHTHlwVjRBdkhyR3R0bStxekVDV0NSMjN4S01tai9GMnZ5?= =?utf-8?B?TGEyYVYzcFROZnhmdkUzRkVVVHJJdVN0NFJNNW9YRXAraE9vUHFScTd4azVp?= =?utf-8?B?NjlDb1VFY2V6SjQ5UW9CVGFFVENUNVJtMDVoK1FGeHhLTFNiSkZVTS9Nc0o2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Mmd6YXd3aWIvSWZSaU9y?= =?utf-8?Q?DWlnJG5NAd5z0lGv5aalqXE=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <81569FAB2078DC4D84B676C8B7C99CFA@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: 74c113ac-ce04-4578-13e8-08dc79979122 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:46.1263 (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: 5wVz3ykZjwVZRfeQli12TkNPKeKzWlyc2pN8GWYnaARcYjCJy8xJQcXqNtvmPKH2aEm9MDWB22+2duFHXNJz/FiVdkGVRlHf587rbNj//AikAkTwuHuzmWYkW09phvDq X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297311192100001 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 3fe47d4002..0e14ef4ab2 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2747,6 +2747,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; +} + AddressSpace *pci_device_iommu_address_space_pasid(PCIDevice *dev, uint32_t pasid) { diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 6c60f7a7c5..2147981423 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -458,6 +458,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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297288; cv=pass; d=zohomail.com; s=zohoarc; b=FfrtjTZw6xyeLPZv2qArxfVBwLEKg2g4fyBE3+dNrbQvrYPbs5/Fx2nL3XaTs7noPkkjQWjnbp1qHVuQg3GAFlwlnzAV7mzetS+fegZg0iHWhPRS7cJCilhWveBoEwvFEqctaOpsx9qR5+qURxy/cgPThE7hJNfq9Pl6B6HD+rY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297288; 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=zje3qgi6Yo6QpMtuPRNjzGkwSFQAkaBm8X4sadei1l4=; b=J3jMPyyo5RYLDSjYPkzXk0/UWVI7b2e05qXOs4b2Ej46lLfi73iUckZmiitxB0KfRP8PkEEEJ4djQ4heOrMgHjtynextTjT4w6gyZA/dCPqzxW8ghH+/4RHZLLH1UXYtf0iB97C1OQL6mIJscV/3WKVqZ2+Ico+GjYi8rbTAYrY= 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 1716297288659995.7504906457975; Tue, 21 May 2024 06:14:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHy-00088u-BA; Tue, 21 May 2024 09:12:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0007kU-GT for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:58 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHW-0001ak-Kb for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:48 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:47 +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.7587.035; Tue, 21 May 2024 13:11:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297114; x=1747833114; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=zje3qgi6Yo6QpMtuPRNjzGkwSFQAkaBm8X4sadei1l4=; b=wiH1yt/bcydUvs+3iuGVwdHGJht3bmR6BNYZXn5QqctJEwwNCCd09RSG 4rweeq5+peKpVzKFQ0EUiX6VDzmw97bpHa8ZfO/525QirK2NS4PkqCCYr gCCYW2H5pe7/eE/5JfP+6K0AOvUeOZ+m12wejC/w+BHlK0h3aYHETagNS 4QnQn6aZizsyC0gbP1TKLkcCmgb1PW/8cJroETrPI/WmGfJJvOp6SnjVH p0CTB1636q+VsXrBhfpi15oTU1BudRAa9cCGn+mAmUdpD4fOHp0KRWeh5 OvO6iHImmFwg87GUyV1maL1hUchTgbwZGdCVuv7oMU4eoVl85ipPFhrNA Q==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13008002" X-MGA-submission: =?us-ascii?q?MDFN3VJJOqos4i/DrDa0vLOV3S/kmO2g+FDchi?= =?us-ascii?q?lXi3GiuMsCSxJgGnTLb9ywL77YqkfUt1lPipkm08DFbuAgWpgqBUccWO?= =?us-ascii?q?OJrRpONozWf5la8VNtHkzH+KR31FDXQK65ZWPeR8s2oG8cWTjmZ/iL5I?= =?us-ascii?q?gUKGJHwkwMMk2KqmyWxfac8Q=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WIRB6lewgG2xjCPnfv/ZsxZpu3+rkahZV5MSvIF5w2W9CLs1myzd9XKqhS9xFyT4+aUyT5hiIw5WguQnvoDWv+pOUq83HM40WyWhStG7m7nGgChhYZ24GPj8fcfF9G66Rph4utYeYIEU8Qpop+imDzejdY8y/0wCizRtnUaKTDSXyOpknOGQZ1CH7BljUeVuMvfCqrneZ41vz4DP5iHNcMFE1Al83oN+gaWMGNq8YV2Il3bThDiU3Tl6QZ51oc4TXm3xczOj80C8VowDjJPVM47Vi2hD0e+OUxxk2Hmf4DfGROrBwo9TQNsjrh9n6xKN/pXaB07x1jewLSUtJlUtug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zje3qgi6Yo6QpMtuPRNjzGkwSFQAkaBm8X4sadei1l4=; b=fF6zhbFaWy8z4mOXJsOGkKkuPZr+e6rasUtTa2YsrwUKUA3hRYvbXeXSlwRuD6NZdEQwWSYX4L+iP3xNUOBMqT17QA0DYPTd1rnaRhS17vhuNbHMcYIWx27VGDNzbiMG0avYdULnZqYv0iisLToEVTUcSL5sh2RpWs7TRKxWCetFpPiKBTtYQBLXeI6WRXCccczvlzA/GwNTovCdt4Qv0MMS7tZuk8Tw1RIDLxysbtTBn1Pf+oTaTAUkksU/4yhWQ0Rkx3wJ53bGay4GO6/qI1M85KhuHHMjPqeyvNR2JWi1i/hgLGSlFxkLjXka5/UrP1jMkNfTTh0HpUCIrwgwvg== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 13/22] intel_iommu: implement the get_address_space_pasid iommu operation Thread-Topic: [PATCH ats_vtd 13/22] intel_iommu: implement the get_address_space_pasid iommu operation Thread-Index: AQHaq4BvlzjFaZHZg0mSYIg84+qjww== Date: Tue, 21 May 2024 13:11:46 +0000 Message-ID: <20240521130946.117849-14-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: f6245577-7219-43db-1069-08dc7997919e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?RlU3Wm1vZnV6YlNoVEVJS281ZWN2Zy9lRVMzYUpwdXQzTnJQTGRGOGZTS2tP?= =?utf-8?B?eVJ1dVR1azFoWFlXMHZzczNKNmt2am9aLzQ0ZUl3TkYxOWJ0YjJDaHdwUVlr?= =?utf-8?B?MUtoZU1FYnlSMklJM25tK3ErUGxZWmdLcmc2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FS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?cEErZFdzZ1V0QkN4b1NKUzhUVHI4ZkVtbGZRYndBcVZGL0dNRTlvZi9OKzVU?= =?utf-8?B?dU5lWmFmbXh3a3EzS1dIZ1RadnZKUDFLbGtvR1ZCTW8xakh5aUhNSTBvSWhS?= =?utf-8?B?Wkc1cGZkTzBhNjhicEtxL0RDMXcvSUoxeUF3YUVLKzlGUzQ5VncycEgrNXFE?= =?utf-8?B?cG91VEl5eFVzWjRFRGZIdE13MEZZQzBPd3I4N2ZzMmx3UzNDV3RyWVZoemor?= =?utf-8?B?bkJLbUd1c0dNWmVSR3gycVFjR0dCTFlYOCtPRGN4bVowajlUSlVZQk5LcTdI?= =?utf-8?B?NVQ5Y1BieXg1UnZpZVoxODc0d3lJVVN6cHk2TGk5ZXVoTFppWndIZlJpZUE0?= =?utf-8?B?L1lCNS8vUGVxSDVtOVByR1JjZWxJV0J5S0swTmcrWlViVjF1ZXFyTFhyaHZz?= =?utf-8?B?WFhldi9PcGRuZTBPRytidGFKRCtUUXNadE9VNHQvWTJ1aHlSM3JXWm02RjBL?= =?utf-8?B?Yk5QVk1kb3ppNkZpQjFhTklmYVlCWDRkaGQ2azFaY2c3SkMzODd5VUh2Tkw1?= =?utf-8?B?QnJERStYTHZDQmp1RElQOGNvb2JxTWc2U0ZsdVo2WkNEMUtnUFB5WGI1d1Zz?= =?utf-8?B?Z05IK1hIVXJGZFBuNkRJbkdGdTJiNjd3bzdZeVluZDFQSHJYTWttTFJXMmZx?= =?utf-8?B?bUZaK1hqZG1GOGpwSGZiVFo2NkRPSmVjVjcrUURuOHpDTlU3L0p6MHVwdU02?= =?utf-8?B?Tm9peUFsQUJmMUVRKzFpNlRRSUwvTGpvaEFRc3RJODY4UVV6eTB6eE9TcXhZ?= =?utf-8?B?cTJRdEN4NUVIU2pCT0dzW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utf-8?B?aEVQSGpBSEZNMlRLaE9EbDd5TGY2YnY1cXpNTW43RlR0V0RVRUpTaDJ2MjdD?= =?utf-8?B?b3JlZWkvVmtJTFE5eVdMK3k1Y1l0YnBBQTZJbGphRnlNNUR3OStLSGNQaWd2?= =?utf-8?B?eWpDdXNxcUpIY043SUhxMWdVY0ZVZkF5NFhIM2lvUzc0Yi9VS2ZHb0tpSXFU?= =?utf-8?B?SVRzcU5xN0grWFVGYlRMN0x3R3d0WUpsckRFTnd0aE5xNEZwVWNaMTRGNC9v?= =?utf-8?B?VlBNQ2JFeno0aHkvVWpUVGFkNm8zZlc4RHVoVjNnVkRsQmFQM092N3M3RFBy?= =?utf-8?B?cnhDbWpJMURONUVWRXdMT0oyZHd4cTZPZXZWa1JwMTV4Y0Q4ZUI5dVErYUVl?= =?utf-8?B?cmcyNFlDVFM4TFhYOGZkK3dHZXNDakxubkdFc2w5Q3FFQ2pobHN6VDJYU2Ja?= =?utf-8?B?SnZQQWE2dlphTlRVQzNJc3BDV0hVU21PRjNZRFhDdHN1SkpPZVUrSGdQVVo1?= =?utf-8?Q?uK6xxqOdPy5O4UqMF8xjYvI=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: f6245577-7219-43db-1069-08dc7997919e X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:46.9229 (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: RQC8hmJ9uahFtBG116D3VJaTh5Oihlrrspz1KryuPKSdz5pIWTtiUeK7JNuedfGM0Xu11ysYnFoqy8efFZ1qYYyvFmPJgm/ROQENnthyIJyErlwakQioQTdpY5wO/lC2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297289007100001 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 13 ++++++++++--- include/hw/i386/intel_iommu.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 7d86a31bea..e83985f2f7 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -5414,7 +5414,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 @@ -5958,19 +5958,26 @@ static void vtd_reset(DeviceState *dev) vtd_refresh_pasid_bind(s); } =20 -static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int dev= fn) +static AddressSpace *vtd_host_dma_iommu_pasid(PCIBus *bus, void *opaque, + int devfn, uint32_t pasid) { IntelIOMMUState *s =3D opaque; VTDAddressSpace *vtd_as; =20 assert(0 <=3D devfn && devfn < PCI_DEVFN_MAX); =20 - vtd_as =3D vtd_find_add_as(s, bus, devfn, PCI_NO_PASID); + vtd_as =3D vtd_find_add_as(s, bus, devfn, pasid); return &vtd_as->as; } =20 +static AddressSpace *vtd_host_dma_iommu(PCIBus *bus, void *opaque, int dev= fn) +{ + return vtd_host_dma_iommu_pasid(bus, opaque, devfn, PCI_NO_PASID); +} + static PCIIOMMUOps vtd_iommu_ops =3D { .get_address_space =3D vtd_host_dma_iommu, + .get_address_space_pasid =3D vtd_host_dma_iommu_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 0d5b933159..bac40e4d40 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -325,6 +325,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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297393; cv=pass; d=zohomail.com; s=zohoarc; b=BJ5s/vUUk2+Kf4Gjwqv3niBgSWTNKhXYnibh8THBYzGfnIpO+Vh7egVf7pS3PfHGdc71DyQ2L1c2qhZj7XQEFw/LANUuRU07hOMD9LKUVfQ0NYczSarsblDX9pKK5DCBeF/AYQw8DfHc+/WGKC0P5lU7vK2KNEIX+lv0eqOf/IU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297393; 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=DCiJkhq21aLilYfmazBpuY1RUfcOG8K07TIGqnYLIIA=; b=lZNWmBDDJPpfP5PhnEu0nVsiPWGRBpW7Wp1Bj/to3p3w42d8Mx0mD/mOef1FcS9sejSj/QYhuA0LdhZTAEVWmQ8DqSMIUj6VQMedAYODyDXzCXKwlo/STHmRfkE8c2iXUcdrssIOGRCxkNsbuj2C+sdwA4R1U8fDTv3j0pRoK/o= 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 1716297393625176.74172219728496; Tue, 21 May 2024 06:16:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PI7-0008MC-TY; Tue, 21 May 2024 09:12:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHk-00080I-Rh for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:09 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHX-0001aP-Jn for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:08 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:49 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:48 +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.7587.035; Tue, 21 May 2024 13:11:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297115; x=1747833115; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=DCiJkhq21aLilYfmazBpuY1RUfcOG8K07TIGqnYLIIA=; b=xO/veNJoRZ7S6utpdlVBTLEGHsnWnPAZiiJeVv40Xghcb95Cq/wf3m0P AUT4o8zfv7jemswo8pMhGbTSRvGJyKDLDm8WURxoFbW1BR55qcx7RHnQw nc+7UFBe3QzEihKxc5mRtPn08ivj04fNbr4LEaWoR1ZnTa38TqgJSxlo/ I/1qt13yZHR5ZWB80VjcFvmvM7LAnUYWZBZgoDhpsyo1tLrCG5xhC2Eqj tTAJUOku4FZG9L4L4ioRPd/KW/bC0iMF5JjvUPArBn1kie5MWPPWaAHav 7rz/4ZMNsZ8Eeo/+RESJqZGcWpRCyOuVGYRiSgrd9tApt3UTaT5L0hNdG A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13008007" X-MGA-submission: =?us-ascii?q?MDHmFhhalvjWrzQ0fRygSkGcqSE7GLc4sCcutQ?= =?us-ascii?q?k7xsrOgK8IdFXakGlcISYnQoECxYBVQ+UAbsWCKiy4I9G9BddpY+Jtay?= =?us-ascii?q?A0odMub8+ii9bIIp3wSJb+0mBUHT808JcQEypRk8YQtExHPyMwqVWTEI?= =?us-ascii?q?MQTkHo531AGoHheBWssESfmQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kSurGjSpYJECA4rF5phkaFv9S5/FehR9YSEOqmG5dvKKHbD9BAS/mABy+m6fcEOm1BPA4tndT/dvdjQQtwd3Da2L48oWAoJORhzA9i3NTIZBxR2yHOWQiVE/IGPbgTy3Bl5spj//EoxwS8zFGN3mve6DVuf16TBIJbngxVkd2xPuyWSmCJqlr8mMziuDiVx6IF9cyYnoLWahQpep20ymEk0ze05pQHwuOXR58DILg/ZfXRLpao+QQtU0l6VemYpqaAGwX9mut4brCuebMGvSH/Pq0IZEU+Drto6f3OhwiVySW7uSk3DcyzwmAyhgeDIlSnCQVe95gz4ip5VQtfUaUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DCiJkhq21aLilYfmazBpuY1RUfcOG8K07TIGqnYLIIA=; b=Zi8MhFCYW6HjQO4INFy51gKSThX8dMshjGCDe10c1qD8awmJ6phoHvOi1BnCuhhQ6ySPSO9i8aMs+fNff4pQvarjiSFzb5jQUKkkDD7zz9v1eR9DOhQcIG9unbijMgck/HoOd4vKESn6biAQcXgfuaFezVJTmFCwqb83n3vAqwKS2zfK/xNU5tsX6RKvPlyHJMbF5OeutvKflFIn03gpOgoCHtiPyeMmTy1DDtsQrlTDJgvBJNtV4h9lWErh63TaWS4zAg2EfzYPBD588RY+SRQDMVTjVzM8BA5JqMVNhAcpK3TxEn9ZkM3abTu3wt8C6d9bdeMnWJbQPEjBMmPsvg== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Topic: [PATCH ats_vtd 14/22] intel_iommu: implement the get_memory_region_pasid iommu operation Thread-Index: AQHaq4BvLD9RdICWlkC5j/mZ2ctG3w== Date: Tue, 21 May 2024 13:11:48 +0000 Message-ID: <20240521130946.117849-15-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: b29a5b42-be93-4a89-b206-08dc79979241 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microso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0cDlkTFVOc3NhTkx3M0VuVGk2?= =?utf-8?B?K3k3Q2NhZHpoTmdNU2c0dz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?LzJpR3p6bXZ6QzJydmg0NjZJOStySklFSm9GMnRRZDlMcVJkU1hWV1I4MWQr?= =?utf-8?B?N1ZQTmhMRHNwN1BKZGlQYnZCWEVuTTVuWnkwaUlNQzdVMlIzam1jTjRXSk15?= =?utf-8?B?TlVSSlp3c2dWK0x4a0ZGQnQwYWp2aUNCalpTWXk2R2FJVUJXc0RuT0grK3Jy?= =?utf-8?B?VFpKZEZrd1NCS01RNXNLVU5PT1ovMzhJT3NGQXRoYzEwWEV1ck1FREFjM1Er?= =?utf-8?B?VFF2eDR2dS9TYk5NVkpFZ1psenZ4YmhCa3l5dVFyazcvMVkrMWdhV0JDenFL?= =?utf-8?B?bXAvR1locUk4UVRyMlc0UVNadHltU3BZdjZNeFJaWHRIUHM2Y3ZKNVlXTTNH?= =?utf-8?B?c2R4YkJuNlplSFFIYmFUMGJMMWJPQjlHTlpGeldid2RLNDlkVlNRTUptbXJP?= =?utf-8?B?NmdLZWJwMkJOdjlxb2tjL0JJVVNwYll1L3RnQ3RtTDFIdGE5dFZaSFkvUHpV?= =?utf-8?B?SnhYOWNPT2JEeER4QW82bk1GUVJ4RzJXVkJsbEV6SlRieGJTNTlSSExmTTZK?= =?utf-8?B?QkNieDZKMkQzdDNvVUVZWjdvWkR4M0JxQWNiM1V0NlZxN1BuRzRoNkpLNStt?= =?utf-8?B?NVpkRzBDd2J3SUZ5YzJXRzhJYTBuWURNbUZYRE1kaDlkN1dNSnlUZU12THdB?= =?utf-8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0aUdTV3kwVzhL?= =?utf-8?B?dlNZVTY4Ukh5b3kxZHpwTHVaeCtMOEUrWHhZdXNXQUVxUXZDRThDalJsSFRt?= =?utf-8?B?N2ljV0tyOU0wMEhlbE5vUDJnN3d6Tk1JbUJRSCtyWmdIT2JSRjdmYzRwRUhS?= =?utf-8?B?YWFTTEROOHloOGhSaWdZK3JJTm9ValV6clFpblYrOGVtT0FlSzVRRGh6czhO?= =?utf-8?B?UnhySDBGR01NSFBLazBVL1JCUWhMYzRnYmRsRkZQQVVMYnZxM1VQQ2ZMMmNX?= =?utf-8?B?ZXh5NzkwaDlhWHpoUWJXeFF5bldKNjcxS2VyODlRY3FPTmhRWEN5V1I0azg1?= =?utf-8?B?M01sTFF5YTV2dzRnaFJYVUZjVzRBYm85ZVhSZ3FSMkxpZzdZemkxZEM0bit0?= =?utf-8?B?VVNUQWJhamw5OEJDK2pyNUtuNERxK251S2ZHRW1XTXlHZCttTFp6ZGQ1YlV2?= =?utf-8?B?ZVJLMXZIMTBOb3FUS2xmaGtZSkpVSWtiQkZMaUlveFNMQXBadTNGODdUTTI1?= =?utf-8?B?S0pkYzNlZmpDalFPUm1XTHpBUFdvYVpMMHJDRU9QN296OThVTEpFSG9XTkZ5?= =?utf-8?B?cjU5OWxtS1Q1dUFHVlBFblFCbXllWXBNMmhQSngwSmN6NEZ5WmlCejZlMTJH?= =?utf-8?Q?wfY/2Wvqm7R3CD4cws6ttIQ=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <6DFD8BD61FA9454FA18183404D15A7F7@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: b29a5b42-be93-4a89-b206-08dc79979241 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:48.0177 (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: zdTMM+A4ni+KszHu0fn/fP/DiRR2EJ9Avw+YVmdIZfn6n82KWjyfrk2hwc496CoFaucBcJSCFsIJhXE3ZGLqYaloTlgevq7JRl+OOnChKB2AEI7aYMZKq4VzsVTg+xpS X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297395488100003 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index e83985f2f7..a42938aacd 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -5975,9 +5975,24 @@ static AddressSpace *vtd_host_dma_iommu(PCIBus *bus,= void *opaque, int devfn) return vtd_host_dma_iommu_pasid(bus, opaque, devfn, PCI_NO_PASID); } =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_address_space_pasid =3D vtd_host_dma_iommu_pasid, + .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, }; --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=Kcq0gr1uVyMuvLDwK9zuZOYnjry7ALW2eIThyxDlp9ydFhqbMFdTBDSLksCTpxpJmHr1Am/H7G5U9nmPn2mXEmMPo++SfzZj9mOG5gH+TOf5BsXqi4Ea6B0FLrkkmMw5UKU8bOfIqIqaBpMpVGHSutCMQKSDiiryTHbRxIDcwf4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=l9bNcp34tf8qesLcsVgJklrBtutAApnNrmDyzOeqyZY=; b=GTUmwrvSvB646eoQBOPfwDYU6ubTvN9IciakEafHXCFOsUN2r26j6pWndVoXm0c4cN2IHIXAjYbcZmcryqV1Lx3B2GE/96UsoZb2YYVEOnw3Eh5/aXiWpH0Z4Rcl8xKq/1RIVPpc5zLamdDKRAAVkZnPIn8EsAbAHYPF8N351Os= 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 1716297172759513.9923121358885; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIB-0000Dn-77; Tue, 21 May 2024 09:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHX-0007it-4P for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 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 1s9PHV-0001Zh-5D for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:54 -0400 Received: from mail-dbaeur03lp2168.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.168]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:49 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11:48 +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.7587.035; Tue, 21 May 2024 13:11:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297113; x=1747833113; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=l9bNcp34tf8qesLcsVgJklrBtutAApnNrmDyzOeqyZY=; b=EUKVoQUzNQA4x6xcY9Wh/WidqfQ9cO69YQ41EzgtEKWwtJaux5u6/VTo bAGH+/CbJZ3QLHUliW5QWBToWzAAHZ/mPTpJR9H2u8vhzvJ32uQxIjp6e dWtwsyPbq/+01/Jp1bLXoaAbtm4ROHlK93ct3kPbIRhfIla1Bti9lraX/ pK051gNSYXmbA4Fa6FT0EUSlFlFHVzUgyZrJu2pXYZCsUWOaSfz7ewKgM 6sIZOF+OFPYO7iA4iT5O8K41+riennEdw8qYItF1lenLM5z2TO9cyvo1n ltGjnLQQRvR/gFyrxph9BbDbNEv0fgsip2H2aO8GXgYum7PHNJDkvYKkV A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061509" X-MGA-submission: =?us-ascii?q?MDGeQrvyXfxkoQAnmOavVki1omy8P4Vl5LuINw?= =?us-ascii?q?ww29b7lYci8Q5FI5c0OttXmyDIaCBkv9cXkOaUtQFRs+HLpQ1udkhNMK?= =?us-ascii?q?lSwke1zlAqGWDEJXEJMN/nbzgNb6i5ayjCTW8g5anPPJ3XzjUUsGqOxs?= =?us-ascii?q?ADE+8zWELpOjnMo5woW4mVYQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FDHyqTfPNULPPy8jS2GVsibyubxSVtWgtMqbhmC+1SDZZECQSN+Epb0vecMvhE65smEq/9KN/hmCi53HtiWTBK7QuQMvIgtCGceH3NA449QMgA27n3Adw5S8fKDzFYl/U2bFC+lG7Xf4Q9U5NXetr8wF5ZqUaj35gccvCfQsHAPxR/OEaqPg722EuY697Gnlhp6R5/LcGA0nPbCHOMpH2dxVvK8AIs7rSc15NBDQWMYEN8Cm4WH+glApbzvEGcndP9m6RHfxUIGB1q5A17K1tWL3zQ4Ni2IZqnuBycirAX6TgHBKXCol7bsYHUwFsVrrCB847044BR3OXIEhkNvsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l9bNcp34tf8qesLcsVgJklrBtutAApnNrmDyzOeqyZY=; b=NVKT+ym8oIro7p4ZJ+Xp283UDcZDOyUl/boqrhb8i8UqC6y8ifyGgnvr19koG0Cy16HojO0h/oEyNYr05HMcF8M/pwj4ICm9Wu49OSNbbCTntxQiOCn3rXhiXyr5sT1GNsi9F+kSGOb0JWVTYV2aeZOBwrJ8+KfAdGkZZHGQHFYdmkp5eeAqdpIFtk/2J2HQRVOw4xkeXXd5kVkLVULXpuI06IR+zT3pkxwmlhLHKisu9hcjQgzHgOX5F6rQJbs4NYMl5XrMkeiJSQvbqaFtw1JHf8FFjYplxGSJyshRDnfglzz8F0GFsXd6kmFS2cEIhGkhBl3Cp+KDOmsB7Dhp4A== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 15/22] memory: Allow to store the PASID in IOMMUTLBEntry Thread-Topic: [PATCH ats_vtd 15/22] memory: Allow to store the PASID in IOMMUTLBEntry Thread-Index: AQHaq4BwMKxyUNJbN02mJJyi62Xrcg== Date: Tue, 21 May 2024 13:11:48 +0000 Message-ID: <20240521130946.117849-16-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 39a9c922-5dc4-490c-79c9-08dc799792ab x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?Sk1OV2VpMGJjN2YyQWwvd28xOW5KY3FsREJZc1hNN0ZIQkJOOU9Za0FzSWZn?= =?utf-8?B?djJsRGw0N3FmTmd6a2RUSGFrcjZ6T1FWVGtpUDhEM1pKdkx6YzlmZkpRa1ha?= =?utf-8?B?RDYwTW9xc2kycVVRdng5WWsyNHhEUkl2ditYMUdwMEhldHVpclBXUnVhOE5m?= =?utf-8?B?YjhNSHJ4WHdwQThjMUI5bnN2ekVZU0Z2YmVkS1V0Q09QajdCU1JNVk43d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F3L0lZak5nTTIyaTBtTVIy?= =?utf-8?B?TFp1ZFZGT2E3ZXExdXpvOHJOMmhsSTBoWFNMdUlGZi9kNzFFYllVbUErL0xI?= =?utf-8?B?Sk1TZW5NYzVwK2hIelVSNDFITjlKYzF5WE1ReHVycFAxM0w4Q2NyNFgzYk9O?= =?utf-8?B?SG5KV0V5bDl5dHRnVE9udlpWVlZQV1ZJbENZMElSS1E2Nnl4dEZYMTM1M0VF?= =?utf-8?B?dG5Lbm03T3F6Y21CczdFb1N5RGZrU2tFb1ZHSkcvbFhONzdJeWZvS1pFUkNN?= =?utf-8?B?andsTTJubjFHNzk0MUQxTlBlQmtXTXBUbUZWejdUMEl5MElYMU5nNGwxa1dI?= =?utf-8?B?SDNIeU9MNDZ3WkJVcXRwM281WC9FVlJVSjNwdFRrdi9FVGhYSkYzQk1JUEJZ?= =?utf-8?B?UlF5SXFnMGoxUnIrRXNMZWJIWXNnUG9uaGhxMmVUcTBUQ01PZGhKL3VkKzNV?= =?utf-8?B?SlFaWk45L2UwMHFQeWdwTEN6eElyRFQyaE91enNnNTRvUFZGUDI0ci9kYWth?= =?utf-8?B?VTNuSW9NdCtMK0xlWWltUWFzSjZRK2ZndEt4Szk1WDEvcERFeW9hRE9KM3ZP?= =?utf-8?B?Z0ZJSExtQWYzS1o3dXVCNXhBRnlJT0p0NnZHRmwyL0tRWnBJQWpKYmJpYnF6?= =?utf-8?B?R2VVWmtZTms4T0NvR01qejQyM2dtbVlMRXYwWStOZllQczhvVTFwbEk1RXpI?= =?utf-8?B?SWJvcFpKeSsremZjMmVsdz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?SFg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1ZY3luT20vWTk1dUZwaEdWNGN1Yyt0ckVJeU1K?= =?utf-8?B?NmxwQzYwRFg5aE9yVk1QZHdZaWZiV1dmZUxCbUo2REl5d3dBNzlyNEFrTTZX?= =?utf-8?B?cWVrRDhDNVpRa2xMNkJabkFScmhuSFBvRzNBVlBoZjBhN1lRMG9pSThGWmw4?= =?utf-8?B?RkdtZXFqaDQvaitkdlR4aDd6dnRDdGhETjdvMndTdllNZ2xJYWRTMVdZK0Rq?= =?utf-8?B?N082azlUYW5zVmZDQklYMGVMU2s0RXMwSzNrbzRGM0hJeVBkN0lFZW4xd1Rl?= =?utf-8?B?Y3F6RCtJV1R4RzVaUGZzUzJBY3VSL2JDOWorNXY3TEFSS2dVNGJOeEs3KzVF?= =?utf-8?B?TVFLbXBYSFFHV212TUhKbTkyeGhwbU9zbG96YkI2UHFsR3kyL2hLR1F3UWJJ?= =?utf-8?Q?IgIF4SiiQ5w7G9rRugsccvY=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <4C99E2DA041A9A47ABCBBCDAF3FE3086@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: 39a9c922-5dc4-490c-79c9-08dc799792ab X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:48.7370 (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: 5svMXyfaNE7HXrffuymmBBxkwrw4mqQIvp1Ikxf5uZKPbwR2rexHMFjy+XWgwYNLPJ1Hur1ten5mjr1wOi2elNoSwoU1owG9TeYavOc0K7sBot3GSDyBrOAQr1cR5My1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297174460100027 This will be useful for devices that support ATS 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 359bca2ae2..56ef48780f 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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297331; cv=pass; d=zohomail.com; s=zohoarc; b=ScSOpZTbopnkW6JCj8M53E3aHH4Bvo9DXoamYKWvL09gAwqts2cV6k8Rene4982lOjcLzBU6d63RDU12wrRnYRR4nz46jJZv2BnrX49pWP6qQHk7gEs+P7qbHyCSI1g73O4nnYkEDHT90JmTw+WL+N9diSsi4m79bGLg8EdG3dA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297331; 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=F9597oN4TImrsU5O420IR4+7xZpXTaUNA2KVmchYngs=; b=W9er1cycn45pbjtFd2YVjFw/TsSbOBwsLFNme5xZUA17MUQM+a0QxQMYYO3p3hEf3FafAH4bLghYO3vtSUddKB3a0gIu2e2RkCbMBFPm6Ccyy0PkXZDt9V+35VhwQvco48mZ0E8D6t5dHuPGo/aN8x6BkBTynsyH98GBpzwVrqU= 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 1716297331786465.5995684216873; Tue, 21 May 2024 06:15:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIE-0000Tq-7k; Tue, 21 May 2024 09:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0007kT-GX for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:58 -0400 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 1s9PHW-0001an-HI for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from mail-dbaeur03lp2168.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.168]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:50 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297114; x=1747833114; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=F9597oN4TImrsU5O420IR4+7xZpXTaUNA2KVmchYngs=; b=GUr+7l3HIkFKwoAa1OjYF8Ezs14F6OVIOpkeLEJvdQD9qJyXMHFGI9kb ucewf97aJ8IMGYj2kgrcTSiP9HeItOk/cY+9oSoHzwfo6ra05zvzSQTpI Z2z03HvaXcaA8f8O6n8xaPr4FFoP3IaCrzT1uxpbvhe2SvDE8TTFRlNF+ QJOwt+dWdSr7PqFwEPK35ZrYc2slCiPMXINEdVRUSuOCgGIJ86a2Apayk JOMeM280ySLYAmxLelI2NUBcIUmPN+HtQuS6sQbPftzVl45h0L2o1OU4Y MIJxmh1FdMokwQI69E1yay+Cnsf6MGDm/Vc6rIEM6OJT3ruEKY06DFHA5 w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061511" X-MGA-submission: =?us-ascii?q?MDHgTBEcqe9PCFFeD7O+RCuGI/MhRbsSodYDDE?= =?us-ascii?q?Pfm+Xbt8xtA6pspqnXJt1s2j7dSb8bBS42m6BkAwGrDZhGDczf3KRdzw?= =?us-ascii?q?z3qRTZUGljqD/ERg5ygW/REjZ2HV71eTOGgTa/UqzeWg24FvkGYVy6oj?= =?us-ascii?q?N+sGsYnzlVTVXj/MeZctvpQg=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iBY4kLXqi2x1kwk0PWr7Zdga7gGtTXx+6ve8+Z60JVf+7hE/uYjsOo7O5mCXeugjBiHwZIHrddOr8/B6R1772GsCVjUaAgFCReXWxgtrb4N0gC9hpMw3qIqZemY5yENaIOFPNWgtk0OftvqKxE0e5F4O0+0zj7IekxEZFtDzzYhf9RFEgVOzBeVn350BUzoC9zJoBrQJs6YQT5Fh0rcZIDBITmTGfn4+0Bl6cD0Ddbs4dSrTKDGMC/s91B0Rb0gHcmd9SZIuAxsZp5YJdtIdPzdFXa4ldMu9ezrNUSWQI+zT/mDCXrUPqztQ+GuzpnC6ryHALpYp+VB+8omVlSFM6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F9597oN4TImrsU5O420IR4+7xZpXTaUNA2KVmchYngs=; b=ZIHIlT/UTmq72PnO2P15Iof4OtcKdZ/KCFCaCPu5ue9CD1+1jYL3zdKKESwfEGt4o4vbIGCgnbrsrYy2J1/OE70iG6J5+ZB1IZg2rgkbDMbWICCveoj9sKNQlU4LE7u45mwi7eb6BbVm3frpru7zTmt9xAFoUq+I9xYjeZpyJoD2qonbPA99/hhz/L6+P4KjpxKIgdDA60O6UNX3kKqLULoR+3CAW/bPaKl3Xd1ZOr/r5tkOASFmwJ4d7BLIr54FfnRSOqkmnpUBxALsLAL2hrFn/fFO1h5YRtDr8GEq6Cyze1+kSA94klRhdb8/e6uGuNYR4K97DO24gzVa6njXUw== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 16/22] intel_iommu: fill the PASID field when creating an instance of IOMMUTLBEntry Thread-Topic: [PATCH ats_vtd 16/22] intel_iommu: fill the PASID field when creating an instance of IOMMUTLBEntry Thread-Index: AQHaq4BwdWnqJ2m6gkm86Rsix4ClAA== Date: Tue, 21 May 2024 13:11:49 +0000 Message-ID: <20240521130946.117849-17-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 90b40d72-9a25-4326-7053-08dc79979314 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?WU5qVTJ1aEpmT1czemRDZ3d0VHllVk9McjJTSTYwTm4xN2pNU0VOL3FYQTAx?= =?utf-8?B?OC9rMkpVY214VkdiYWxCQ2NXZVk3SnR5Kzh0R0E0dTZPOWc5MnNsS2c4dUsy?= =?utf-8?B?dWE1a1BvMytRZlJka1dsMFNva3ZJQWIyZWMrM2RFRnBESUZibnpIbGN1NFZa?= =?utf-8?B?aHVmTFNqOU9QMzdjVFREWU82UzYvbXA4L2ROOTRPZEhlcnVYR1NjVDB1Vnoy?= =?utf-8?B?cjFuenFXWlcrUHdGMjNsdGZwbjNjcm5VcXZoYzAxTWMxVUZGL1NtaG1MWWtj?= =?utf-8?B?TDZ5VEliVENNY2grbGhNN3k0dXVERlgrRzQvMG9INWdUVkI5Rm1oL3JTZ25M?= =?utf-8?B?V1plMFFEdk43VVREOCtDSkcwRFVISm9rK1ZyTExNOWRCN3AvdjZLSTliVExy?= =?utf-8?B?MUIxL3UrTE5wT0QzTnBkb1BlMWVudUFVVm9VWVJRdmZqdnhWUktrMUtjNzZ6?= =?utf-8?B?UGR2ZGdxTjJRVFFEdDF0TU9IQ25PZGhEUE5HcjEwbTRiMjJUUStIRzU1NkF4?= =?utf-8?B?a2dicnQ2cy9HeTBjUFp1UkNjU2hlNEVxYVVGRXc1bHQva250WG1YZzZ2R29E?= =?utf-8?B?QXJTTHo5TkE3K2ZBbThmbW15TUhHWHE1U0pkVHdDV0h0RVV4SnBFK3EwL2F6?= =?utf-8?B?T2ZCYytMRU5CYTl6QkFmS04rVHNmZ3FFanB2U3c2Rm1uOTh4YkxuT3kxWDZn?= =?utf-8?B?T3Z0SExxNzI5eTNEMWdLYjBrTHlhQUhYWTVRVmdYSkJFZ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XMFpWSlIyL1JWWGFSeHg1NHRlcW5H?= =?utf-8?B?aHVxZGxqWnJraHQyd0V6RmlNZTNBOTJacVlFeFhFSXpaNGZpaHZXS2FVTkVs?= =?utf-8?B?Vk1DNDFLZGRVWlAwUFFZYW8yNnJVY21TUXBoWmdIT0NhWWpMUGU5SDhXcGQz?= =?utf-8?B?OWZORjdkZEs0TjNubWZhZz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?TlhqZHVjSk9sNElsMkJ1UVZQSEs1SUZmS2t2U0YvdmNKNEV0VFhjMGRmUXFq?= =?utf-8?B?WGNzcnhoQUJ0TlpYeHFUSHVTVkRYRUhMcmxMeVdzR0hLRXlsQzhrd1R2Z0p0?= =?utf-8?B?bmE1d0NWVXczYmVKWGdJaGg1akc1dDBFbzlyd1lYSTVobXQ0dmRWeU1CWkdH?= =?utf-8?B?Q3NqL2dyOTRudDQxSlAxS3c0MWV3bHVQYTB0bUhCZWFyenVSaE1IUWo5VGNm?= =?utf-8?B?c1NNQm5NZ2FqSXNlNG1ueHJla3B6bVVtSnlEZjFBcUh0bExzVGFPbTNhYXFZ?= =?utf-8?B?aTlwclU2NzIxSkVyQkx5L29WR3k3ZzdhdlRQNkxOdjdZNVRhT2c4K1VFOThG?= =?utf-8?B?aWVpajQyVTdQekZ1dTNhMzhXR0xOK2g2K0FaSitBenlvTXRFM1B6M0Vrd20w?= =?utf-8?B?VzVlb2hFLzVYNitkaWs4N3VIdEVQRWtoRGJ5ZnFKS3d4WERleUtqRUduR2NY?= =?utf-8?B?NGxYY0UwWFZKQm45c0k5bENoeklMUnNHU25RN1RNRXpiZDdJR29yK2hIcFR0?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DelJZS0JwZGxSYTJDVFk5RFVXdldrQXJyU1k2?= =?utf-8?B?Y016R08xTUFEMUZuRW9DRXlzdjg2VHpiWTdsUWU5TnNBRkRWa2NVMi9zNGN3?= =?utf-8?B?RUpURjRoTm5HaUJtd0lJZVlVWDRVbVJOYVRLMURzUzF2cWZCeXBGWHZoWDh1?= =?utf-8?B?WUpTUWhvQ01wd3dNbGFMQlQ2NG9kd1EwcmUwcHhEWGZTd2Z5WUZzNzVmWi9P?= =?utf-8?B?cmhHSFcyN1RvTlBSRjduekxBWmlrUjNHSVY4RDJmZjg4TVRnYXZ1SHpxQlFG?= =?utf-8?B?anAwaWFsWlhvMWVRZ3E5STM3d29UMVZNVHhRMEFlTURxTzVLanVrS1RmYjF6?= =?utf-8?B?cWZpaHpBNWtpR2NyUjVRQVdxcDBmRy9wanNoZTJOMVZHWHlEcVRIS1RNazJH?= =?utf-8?B?WTI3WkVTQ3J4akg2ZU5IRGJGYnRFb3Q1MTBsT3BvZjVjWU1ZMG1PTkdPRUIw?= =?utf-8?B?ZFI4OEZqOWVPczMrcEZjYkVUN3FLZWI2TWJ2QlE1dUkyaHBhK0hWMGthNk90?= =?utf-8?B?QU9PM3h5Z1hGT29uZnFWam4zc1FkQlArZ1VUYWljOHpTdTJVL3lHWkV3RjBG?= =?utf-8?B?ZDBNenYvWlJNK2x2ZEpsUy96RVVHZ1RzQnpUMXcxVCtxTzlDSEs0YzloWm43?= =?utf-8?B?cUVkUFY3RTRtRWNHeVZMOXFKb2ZaZFkwTFExN3ZBbC8xMlB0RXVoOUhRcEph?= =?utf-8?B?TEp3a1NaeVJ1WmUrT291L0VwQ3ZnMkRmYWZ6dHl5eS9SY0xaNkxVUjNhUFJz?= =?utf-8?Q?2Sz5vfPyFDOnlDUgzrrLiYI=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <12D940B8BED9454AA5FAC6F3C26FA2BE@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: 90b40d72-9a25-4326-7053-08dc79979314 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:49.4174 (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: ny3WKEyqcowag4vLq5X2BSYhBS39ZI65jiPi0CCFlb5ZwLRWuxZ//l9RctFjIZNh91cMIRL2ycoanOzrsWGnE5kcIoAKmP0XY4PyRlGni9EENI4tyzD2Dr2qpmXc0Vet X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297333233100002 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 a42938aacd..f08c3e8f00 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2187,6 +2187,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 form IOTLB, we don't need RID2PASID logic */ @@ -2304,6 +2307,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: @@ -2312,6 +2316,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 @@ -3673,6 +3678,7 @@ static void vtd_piotlb_page_invalidate(IntelIOMMUStat= e *s, uint16_t domain_id, event.entry.target_as =3D &address_space_memory; event.entry.iova =3D addr; event.entry.perm =3D IOMMU_NONE; + event.entry.pasid =3D pasid; event.entry.addr_mask =3D size - 1; event.entry.translated_addr =3D 0; memory_region_notify_iommu(&vtd_as->iommu, 0, event); @@ -4320,6 +4326,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 @@ -4896,6 +4903,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 @@ -4908,6 +4916,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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297227; cv=pass; d=zohomail.com; s=zohoarc; b=KWt1PkqququaGap9fqFPLh8+ud1HZGl0u23Fu//9rXbIIQXlawPAp8nP4v8tWz6oY7LOuCYRiypeQoICqHdiREQqTI3nhaJKSYEwipePHT1x2Xb4xVvYBv1YU95bNErE4qAOrfvpteF1Xa1kc/MbiRHCOP0zfhdAU9hCSO7osvI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297227; 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=rG+Bw3MmmndtbJbVWq6083592qHj2h+NjpwqB0a2mhM=; b=ALFxTEq+9Uwr2BpoVN5GI6thgZFY0g120kaNSycGU2jA7Qe8pAxECJJkKDH7Mz1agoIkwNHWXeZLBHiK8j11M3dp40J4NqFP5A1dpKMEwuKjIbfz76Id9DP9iXdWGbRhAfiBxCH6/rcUzLSZRLV2gg3+fqAo/eL6+MTVoyI1tKs= 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 1716297226593711.0754756207036; Tue, 21 May 2024 06:13:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHj-0007wm-Ls; Tue, 21 May 2024 09:12:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHd-0007mh-3a for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:02 -0400 Received: from smarthost3.eviden.com ([80.78.11.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0001ZU-1F for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:00 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost3.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:51 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297117; x=1747833117; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=rG+Bw3MmmndtbJbVWq6083592qHj2h+NjpwqB0a2mhM=; b=GYnSZSWur6WHft/WuKn8U5jNAjo/54NBmSelwQidvq/DwKdh/l/IMNj6 4Tod3iTQ8bNOgn8Vz3Bf8mFL0+c+ePFKGzgf9kRPrhex4OucIc6aEqjOz 161X3xOu0B4QCv45+E2KQo9ClacEdH5UFTHbGwddkO0ovT/RYqLs+tW0g t99TBtebPCMpX3/nK/oShFcgmWZOLZAR3gx9mGGf2rJOLUkLErLcYehJi 9+JKYwFUqJ3U1vZFuwr2Oiwasr3n/kRsVtUU/Gelg68ni5NcXzUuG5ZES HnZr2GglXUI6Zh5q4U2/SbaD1+C8c12dC/nw8QIQUKegdGl0yobt+KNhH A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13008012" X-MGA-submission: =?us-ascii?q?MDG48rgx94wLZo/3EO67I5dIktNJtDeikG8/t7?= =?us-ascii?q?MYO9KNuD3beOhD3Y+L9dEmZ2kaeBkKVsBAiwRKxWB53w7SJJAqx4hMCb?= =?us-ascii?q?vuI0vtq/8ttuLlhL01PF/2B5W7MzkNRwdOGaIjPUlz0eeMdrIq62t1Co?= =?us-ascii?q?oIwVYEgSwhGsYZ4K/9R4pCVA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oBaTJS7cxUZsWe2m/MiymtJhz6azvBZucI2LaVABQePzJklbGPHAT7wb4+QSl25hkeb5dPvXkoqPC2d1fRGqH7V1q/zMfL3G9bNt7UnojfI7AVkRVBWSuiBxmL5/HZ2/xRRMIreuQWLPWKxnUz8NUNGAXwBTxiXu1Wm3kxBbbx5rHH7xTDDoeBhRw4di/gDUjhHfsZk1fWOhPhcr5QY0M6/OSPqqbsXic5rI5koNVjVImA0Cm0f88+q7MVccVDHA7bK6p3LzIcmxUEzgNyAwAbetSM/igmZtxOj0ROaggNBmmyvbOd80JWF1N+IT56M2hiDkOd55H7Xp16F9+jPX3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rG+Bw3MmmndtbJbVWq6083592qHj2h+NjpwqB0a2mhM=; b=Q9deFib3E+KnbcAVdPfWnKIfBKrueTAyTgMnGtgjWvw3RP00eRmhwLAiaADmfE0yLtBMjlphHWo6rok3K4ZJEz+2+6ZmRzIVD6UxZ8fycZeqUhAmhRQh0iEY+5Z/ZI6S0V5+CZz5Vfmbgvg0cFrNHO1xUdVs+z9aSW5MrwgxNQSAgdA5X1Mw5nigfsNXqIlzQvAiwE4vYzrnjmWyyO3zFk2fQpXmIOrzXvZmJzXy9RdfpV+uSV8jTXXSTqHtukNBM8RHdLPq4evC9jQ4YMyFgV5cRdw0397nB93tmJmJodrSqai1D3NJKFCJdXh4iENecV6M1kAR1hNx4mhmYxiqPA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 17/22] atc: generic ATC that can be used by PCIe devices that support SVM Thread-Topic: [PATCH ats_vtd 17/22] atc: generic ATC that can be used by PCIe devices that support SVM Thread-Index: AQHaq4BxILxnhaztEUGv0ZSpe4izZQ== Date: Tue, 21 May 2024 13:11:50 +0000 Message-ID: <20240521130946.117849-18-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: e4b58842-519f-45ba-e76b-08dc79979399 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?TDBJcUhuM2ZycGtxRkxSeGt1YmNwRkpoQWF6Z3NWc0hlam15NEc2SmIwUVNP?= =?utf-8?B?S0FjdFhDM0gwSStBVVpSbElZekF0ZUhaM1JYaEVYYUVRQUNlYzM0L1UwaHQ4?= =?utf-8?B?NzRWRytyUitCdW9CRGZiSHIxdDQrajFDeUN2RzAwTmU0UGpkMGFNbll6VmJH?= =?utf-8?B?VHRCZnkyNXlRWGFzd01qcVY4bk02VXZPSnF2Uy9oY2dMM2lOZXVJaE8xVjgw?= =?utf-8?B?R3FpWFZIbENWTzFzMlhUYnNpR2hlV0JtSUR4VzVpZXBUSzRmM0JXOWFLUmtT?= =?utf-8?B?TmlFWmsrNmVFQTdQNGY2SUNTdXFxTC9VSUR4bU9aTmRkQm15Ny9UTXdsSzFt?= =?utf-8?B?RDZteE11eEo3RGVpUy9valdHT0dJMSt6WHVBaGRJRGtpRndCcCtxSE5uRThJ?= =?utf-8?B?WkNNeld6ZTdsQXhIaHc5WGw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bXhmb0taWkV5eXh6TXV6bzByUTZSU0owNkZTM0VFc1dGZFpFKzU1VzBYanJl?= =?utf-8?B?Ykp0eWRHZkhMdnlCMTJyMVRHVlI2MXVuajBJZ0hKVW40YlpMT1FKajFSdkR3?= =?utf-8?B?SDI0QW9IdUIrWFZHVjJwVjFUbzcxT3BGWHJjRE5SbmNvWk1DZU5XQVpNcU8y?= =?utf-8?B?NFdtZ252dGQrKzR4bnZBU0g2MXREWkV2ckJhRlAwZ1ZSK2RjRDAvRTNKR09x?= =?utf-8?B?dHNqZlRFdWdHSlFmKzQzQmhETXFVbWV6ZzVka2hCS2dZRnpnZG0zZDdIQzh4?= =?utf-8?B?YWFOV2NaUFRaR3JMV1JzSm5sM2tJRHlrV25TYU0ydXBpcjZEdXFCWDk4TzNw?= =?utf-8?B?NnlzQ2Zwc2lxdGpaMlB0K0V4QjVFR3ZwWm9GbGpEUGlJRlhsNzRqSGJnPT0=?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?QkFDVXkwK1pKUUR0MXd4anpBcTVwZE5BeFAxajNCbkJWOVZiNTB4R0plcHor?= =?utf-8?B?UzFySUtYTC9LY2dwTHNCbERQeTlHYTlVenBTWVlGZEVuTkNhYzQzb2lyc28y?= =?utf-8?B?WHlGNTFCUGxjS2gzeXB2VXNFZkhqQkJDNlJySEdSTFFNTmFkSDJsbzJVRGFq?= =?utf-8?B?RGZ1UzkxYVFUU1dmZ1I1UC9aeUxTM1dLR3pIUWdDR1N2YjdENFRqeU55RzJk?= =?utf-8?B?VTVxZkNsaFlxVUF4UVhPSFdlVkpLYS9pSnpUSXlnY2dNdkpTOG9JZ3BOc25r?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plcW1BU3loOC80WmwzMGduRUJMeHA3djQw?= =?utf-8?B?aFJkNW50cWhkL1diSHNXWWlhb001N2czVzFiV3BPWGxTa29oSy8wSFYzSWwv?= =?utf-8?Q?d6YD79L9kVL95g38n4X55uc=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <4E4E46386A911F43BE9B36D2683FD9E3@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: e4b58842-519f-45ba-e76b-08dc79979399 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:50.2827 (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: vAb5aDYq1VbZxOft3Z1+hzcowAIl3dzK79EfJkJGrNbuzhtOWwOaTXce5JkuLn7BQ8dPh1QBYBCjR7L6K2MZBV3cM0XX33Jw7qosvHGy/m2sq7d6HmEMHmvT9E6Lbkdm X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297228867100005 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 2ad57b10ba..e6ca37a4b1 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', 'uri.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('block-helpers.c')) --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=bNou81+lC3rRH6oAXEYM/zGYvh7dD9Wl7mtwpksbWHZKHmnmGOpxtkVqon6vxdeyq/MvrzIV7r8V4+GyTebAckIJoS3kgp9M0Pnw4frFLgLyTuUTZ0uOICrrx1cIW8ULHijPD0MF/Vaazc5f3uTTUk4AuY2pKZm3+QgWwzxSvqo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=VbrUOIfc8U2UXrs6qL7PQ/+HQEYub06zah43XKt6V9I=; b=DufucIqItlVdlquocxO1DunUe3CzyDajBDd8V5Py42umvUBNtQnyfiKE+Zu8bSdDGj0EAcgGXhJLyQgzF8fd6lx5CgBKxIVQjoN5Wph2XLEDexa0lPUVe+47B1Ee5P55CDsWS/s4Owq3tmpsthcIA1pR1umFV2+FOEPGLwaaBRY= 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 1716297171984553.662456846707; Tue, 21 May 2024 06:12:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHq-00083L-5H; Tue, 21 May 2024 09:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0007kV-H3 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:58 -0400 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 1s9PHV-0001Zt-PI for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:52 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297114; x=1747833114; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=VbrUOIfc8U2UXrs6qL7PQ/+HQEYub06zah43XKt6V9I=; b=rRkpe5Wk2iUPB4fu9PeYtRR7N7/1BrWpWcKPRpCmLzLY7AUmw2DxTxZd 2wTYn1p08oDqoGuEyESbasDhpj4VM7PuBbf8s+pnc261Ggh80O204qSpx z/ISdzZp9p0T9MSqG6mlGIIZ9wsPGICzN2LFH5stUZt2qGvYMgM1NvPjQ eszkkLUuRgx7zfrP7vhO+inUJjz4Whrqqyqa1qe9RRr0ipZKE4SZjxP+d tQkJZ9otdZvs7/RcK32bZPokRoKCLKwuLX/LKMFoN9hJweGGpbvj6A8GT iF1/6/6SoWg6Rre6vZAZt5Urgr1TczqM+KcoHbAPL0haUzeTj3Mt9SdsX Q==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13004109" X-MGA-submission: =?us-ascii?q?MDFxsB7xin/uDNOsIDkr3O5BEHMrcXBudKGn8V?= =?us-ascii?q?csQNaXUcgBcrtbNb7arztuMVCcQh5CeeHUc6DFcjdQB1ZrrjwnnWsu9z?= =?us-ascii?q?4Jgyn4CWL4THOMPHSN311R57tWbajHV2+sv9K3rNZokqpY7Hk0YOxzOP?= =?us-ascii?q?gabKt1cSct1Vat90C6bhdtWQ=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XWqMOzS9Ci0oBW8cecDfgp32CUjNt8LZrYvr6f5YoIJ8cmLKovp2XdktLzYjbOVexU8DJ/3wONKXVZGKU/cloOX+qaY9nTQ+HiuIeQb4E7PAxkpQ4k+jW0+iz+JB7SwjSE3iQLh5Ussups9c79A5pOqB/M60AB4w8uZQEEynLK+UB5qH9OXEdqwWmTHxkBONdsdT15rE/T1tFSSW5yuwGlMbeupwU3EJAZR/Rwtq8GkJV2BXIWNcQ/qlBfOQR+lCedlmAaacEynlxsnWeesu1QzpCLcBXNJC/Bqpta0e1Z23VDtb/SbwWoTbbBmY9Bzm3Tf5z6yxQg/5ABdx0VCuMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VbrUOIfc8U2UXrs6qL7PQ/+HQEYub06zah43XKt6V9I=; b=eyb5mSV/TOC+DGXEyrFxNu3+ZCxnsfOXK1SBKxQkP8Xhza6qO2FUWZgEXHvEYFrgrYly1Htv0AIUUk1Sa4Ow9JRYE1Jh706IqDuuUZo/qKZIZNBnoibFqxB99ZYjmy1bm+ZAyMDFAuqMX9t58J9aP3OPfyHhslGUtM/NuZ7UZ12HSRk4eLiwCaVACk3OrW9YMjuUA5gCoQGiIHq8XkaJtLWSFrCQEoGeGrGGZhBW0FPVxmJvnxKGvt0Gde1qbn5kd2UQlpQ0p5sMZSmUFfyFmYTEyJUdwQAAeoLsqRQtz6xYE90SwRmae0vsyqlAY9RVOX4MTU+F68pRULlcU7cidA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 18/22] atc: add unit tests Thread-Topic: [PATCH ats_vtd 18/22] atc: add unit tests Thread-Index: AQHaq4BxokQ3ac59N0iT4f1OV0wt4w== Date: Tue, 21 May 2024 13:11:51 +0000 Message-ID: <20240521130946.117849-19-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 76efda2a-dbfe-4acc-6faa-08dc7997941f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?NHRJQXozQVVBanNDbFJEQ0pRNldLd28yUVhjV0xhd1IyamxFYWlQTWVEaE9q?= =?utf-8?B?OGNEME5CdTNSbDRFZlI1anpWaFhiQUQ0eUdEQzRURXUxaVpjcU1oZ1VtV0pB?= =?utf-8?B?dGdBRGkvY2wxb2hPWkFneDJDUW5lQkw0dk51Y3NSMUxKa2EyU3dBblVFVklD?= =?utf-8?B?RjBlMjUrQkNQbkF4YTIwUndaMWNxU1pSWUt0TEI1M1hYdFRUcGd6TExTRXBY?= =?utf-8?B?d0VHVHdLRnBqM0I0WWd6Yyt0V3IzbFdqYy9sZHBmSnVwblp6ZnE4dFRlQ3ox?= =?utf-8?B?akl0NFZucHYzcktLVTgzNGVnbEJEUFpMQWtyZnN0dEJhMWhhMkhxbkN3VFBH?= =?utf-8?B?c2wvcHZBSjZEcWVxWlFtd1dURmd3NTZkRFRQcUR2Ky8xYm1sTEhVRmlFYWdi?= =?utf-8?B?bDhsaUpOcmRUR1gzekJZckNUeUYzamo3RXZoVm9SemxlOStYaWt0Q0Y3QnRa?= =?utf-8?B?dHV0d1hYbWJBMzR1OXpjQVdZMkFWRGl3L1lCTmJmUE1XditwdzRwYUVLMm5p?= =?utf-8?B?NDQxaTNDanJVLzdEemNKcDhYelM1alg4bEpUSWxkS0QydXpuSlA0YWM1VDlX?= =?utf-8?B?SmJLZXEwbktnQ0RlcGdBTVdBakQwQnZqZE9qbGZUWlUrT3hYbTZIQmtoZUxr?= =?utf-8?B?QUp6eU9OSE8wQjF2U3NQOUd5NTQrbVhyN0hycmttaUI2MDYydSthZUU0R2VC?= =?utf-8?B?K2xobENYb2dveHZTdGpmWkFWR2lYTUR5d055b3p0S0xLMG5qY2IzR3BTYmU3?= =?utf-8?B?WmxBT29xM2hiUHhsdGRQUzI0S3VPQlp6VHhhV21MUUh0aGtFaWp6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VNlV0JGR21GbVR3PT0=?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?YXJzQnEzQUo0NzFFUmpxeUtNNVA0WkhLaXByRmgydWxKLyt5eDhkVFU3QXFl?= =?utf-8?B?eWZSTk82TFFRVmhBa3RrdmVtL3BycTRRMnJQYzltVmY4M2xERUhaWE1xY0xJ?= =?utf-8?B?UU9FUmlWbkxqazZvR3Mxd1d6S2x3bXA1NUpueXN6ZlF0Ung1OFJZSkNqVjdu?= =?utf-8?B?RUliNmNVOCt4YmJnMUhReHZvMWpxNXd3ZVo4TUJoQXBYaWdyb0tWVHlYeGVI?= =?utf-8?B?QlMwY2orRGpHZWdKck02NEZ2c3M5R2VQOC9La25XQUgwSWNtZktZUmFsSWRt?= =?utf-8?B?b29WTU5IcThDaG1qTXMrckZaMFprdWdOdkcwOVdTcTBEVGhCeXNGcmwzTVZx?= =?utf-8?B?WTlUanZoNjNEM3JTWXlNZUdkNnVFTmE1M1dHVXVvNTRnNUJKcWxxOU03YU1M?= =?utf-8?B?U3B0UEo1ekxEVmJyMmhkcS85WkFyeXl2enlZOFpHMTVURXdaNzhzSm94WGQw?= =?utf-8?B?a0phdGo3aG4remc0V3B0V2htbjN6b0dOcGh2NG5jcDdWd3RRelBPTldOdmpK?= =?utf-8?B?M0Y4dFR0UjBpc3NZTmNPSUZ3UmVtRFhLcmJhajhXY0pYTmtwY2dBemwycEJB?= =?utf-8?B?MDF6TE8vdmErVHBhZ3lRN3V3cVFvYXB5RzAvb2JoZ25IMjVNWGNWZ1VMVE4y?= =?utf-8?B?c2JwN2U1c3ZFQ0pZUUZiVW5Bbkhja09OMmNtQUhVdGNF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U1JUGtRQWdoZEdodVJDVEI4VGVzWGkrQ2ZhOHdI?= =?utf-8?B?d0dralREdkpWV2VsQnRYbExNTjBERVdSdTZmWlZlVHNTQUl6d1YzZ1lncXZp?= =?utf-8?B?SzRZUmRsakkyTDBJK0trZzhrRkFSNHlYVVB3b2lubE1jWWY1bFVFRi9pVDhj?= =?utf-8?B?QklYR0ZQU2tLSkpZZEYwTmdIdy9UNDUram94c3RWNy82UTJoOUhyUUNHYzBa?= =?utf-8?B?dm1mTTZ3VXMvK1ZoMTJWazFDN1dUcGEra2hJL0hjZTE5VmJNbjVhSDcyNmI2?= =?utf-8?B?WFB0aktMK05hd1BUZTAyeEQ5V2pCcGFBTk9DeklvOUx4WE5UYU83bnNSVktX?= =?utf-8?B?WnNHNytQV25xUUNjeEJicTJBUE93dWdrb1E0aUdydFp1WjNNZ2xsYzVkZ1pE?= =?utf-8?B?TnE4SVE5RlRuT1loR2FQVEltcFVveGxJZjd2MDJYN0ppZFNaMEpmN0puS0pa?= =?utf-8?B?RFh4WlJ1V0JQSVQ3QjNUNHJoZHJCUXkzb0dqb3pUN1R6Mjg2dXpaZzJucmd1?= =?utf-8?B?K0RVVUZ0NzdoS0UyYkZDTFY3Uko3bTFaWGR6QVcrZG10VUMvaU9iYWNrYTNJ?= =?utf-8?Q?thrbi8F8K5V318a5SaTeRuo=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: 76efda2a-dbfe-4acc-6faa-08dc7997941f X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:51.1322 (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: OEjyhf9cf6v6cVmB/H8dCH0h9LVrTxJm4a2nvOOP0y5bX84h0shyvD7EcFtj88ItnUs0msS9NJ6HOBZ/NAHWIAd8QBr5tSh77Ko3lmWE+47hOaix29VyA+vkxoNDj9my X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297172854100009 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 26c109c968..d6c6c574de 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -47,6 +47,7 @@ tests =3D { 'test-logging': [], 'test-qapi-util': [], 'test-interval-tree': [], + '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..89378f7f63 --- /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) { + if (atc->levels !=3D levels || atc->level_offset !=3D level_offset= ) { + g_assert(false); /* ATC created but invalid configuration : fa= il */ + } + 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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297194; cv=pass; d=zohomail.com; s=zohoarc; b=JiHv+BwMkHqDakXkUOBXX1IDJSrRp9VUDvrUEncXtY+V6BAVeyVIt9BnNRFhlHvQRdWW7XrPxUJe2eENzpdR/8v9dVDpQxfOYPGMZP/oDkhmdCWL/HuIUkCqUQWKxiOn5u0pGSXnZvhSYZqZLAUDz3WZ6TkP/mbRmpujat5BQoU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297194; 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=0dE/fO+DHZfygGNvv8Lx3q8Dt93nwgJmL7gxtEqEPQA=; b=h0ypLXlNHkneul0/SvwZiSII9QDCMQWbrOvIcGS8X0KuV8SBAaPBMhbJWTDbQMCxCjEOEw9+SyKy4kriJtfvKymE39SmzmJN3JOB9qSai+RcfWWGIyKFRA7OJE7GezNYDTRWqlNkn1BgO3HLKP/7AaRW0q6Wlb1Cj8ac+oXaV8g= 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 171629719472572.49056192506953; Tue, 21 May 2024 06:13:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PHq-00083X-4o; Tue, 21 May 2024 09:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0007kW-IM for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:58 -0400 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 1s9PHW-0001by-NO for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:56 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost1.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:53 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297114; x=1747833114; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=0dE/fO+DHZfygGNvv8Lx3q8Dt93nwgJmL7gxtEqEPQA=; b=c/j4I7bhSuKLF1i38R74cJRFh3GpVRhdvwCnCK9o+WWv/0O9vhuzHY9y yoRVP/cFcfFGam4Ri5vklY5sOtJ/JV5CaYDOvx/ebx1JGUneP2tNXwnhh 6rRO/ZGE+01xApFSB2d6P33/eAoahgI/jFasPfHS9WiEY60QcRKuu5vM+ P7GWeuuoSGYmSVan6HO/HIMp2iJEZtY4cFXmXeqvMZLUvMx0Uy4w4mJWb M0xU3Hsn/HJx67ExTS5ztbBUCrkjVXgRpcxkLhJD2ohldcNIkmr+wAGwJ Gr2KrL3F5lLPmWND7sV6GlCny/UxA1ek+DIZLF6Gv1n5FIXBk47NzylRl A==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13004111" X-MGA-submission: =?us-ascii?q?MDGq8+OYkkOKG5+DJmqOPG8PEpenaY6pYbuyD+?= =?us-ascii?q?Ap6RQ2Hbe+2Q1ANRCkLmb2Iu7V73i0SCtWFjYKT0JIwcP5cCo3kPzB6U?= =?us-ascii?q?7aQV5tGS/a9qkjjEAlp8sBVvEtHGzSC0a4AMxSsAV/I/FPVuVi98/V/S?= =?us-ascii?q?OvtFqCzvjPi34uxL1cu0HK2g=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=So5HxPW4MaavwqEFJLCKCVhkGx790Wydd2gPOBXv2iRlLwy/Uwn1+dtavxtJyfivf2SvGdUvXQcbYcxdjho+tmOVP+yZc9gtg8IX2MICIKawH3TrrNzGsbGDgWOi0EL8QSNOAbQMCvVEioRLdwuVsmalVMzhyTBIyNSJUKhLQ5Pqj/9qyNUkr4HMGj0LDFGIEDNqqzV0PHrKG1YltAkkMnvgSGrToZUEkAr4vDZ8+NWdZWfMaevLYT7AM4yin5vU/gi0xhFYVp7ZKIe/L7xSWbk7eunl9UtfGzjJCnuUhrw5/gc93kTLjqQXhwrLx3vwmPsY0xn+4U29FF/JKKFpWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0dE/fO+DHZfygGNvv8Lx3q8Dt93nwgJmL7gxtEqEPQA=; b=XafJC83IpvbcXr/Bhq3DO2/9fu5mIwktaT/cWExmqfFhDHqhYC3daaxXKqwh2qaHi0AlSMZKlM0NL8Tg6nDLowPkftm2tOqUsIoEYl0Q2zAb6mEqa5qR5Dg6v0cfF79zuI4Yd7LTlXszdSaJ9Bg5BPw08x/ktufRLRhH6rQMNEURdkvpNffs+Ts5NkYs0kbrs3JSxv9+jZ1K5HXx74ePNdsm3EeYD+Tgq0/nJRzmzXVZMlMeur2hqACEmfqo6xksgaDP6d3FSv2GfMJDNU+Gf66N7Ya2WMadTFkSzA+60zRx3xtguMl5hxR3zH0fdFDigXz5OItgcVWWFsNkHbgWIQ== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 19/22] memory: add an API for ATS support Thread-Topic: [PATCH ats_vtd 19/22] memory: add an API for ATS support Thread-Index: AQHaq4By7GJRtLEAU06I3NQX0IDNRg== Date: Tue, 21 May 2024 13:11:51 +0000 Message-ID: <20240521130946.117849-20-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 123c417a-4e6a-48a1-e56b-08dc79979491 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?dVFLZVdrc0hwMWFTWHlFcXNEY1pNSmpmNEU3d2FZMXZ6WForend2NzNKWTRw?= =?utf-8?B?TWFMdlpHNXVjME40VUViZ0NpczZ1RHF0aVloVjJHQ3U3WlY5UUZFeENPVytp?= =?utf-8?B?cUZJNndYSlc5TEN5ak9aMXI5SWVWSy82NTlQdkl6cCtLQk52Y1RuQnRVZS9a?= =?utf-8?B?bVl6OTh2U240c29PU0xwY1NwcklXNjhwWXBwY1BpalFRVlBPZkNESStoVzJs?= =?utf-8?B?dmZ5NndjZHZMRnl2eHN4OThqckJQYTF3YlM2WlMrTk1oampnVnRuRTNJN0hW?= =?utf-8?B?SlVwTFlGY0dFZmRqWEwxWmFTTEk2aFFRekdRMmVmZ2RCUEZkS2w2Z0dOdmJF?= =?utf-8?B?ZUxSTkFHM2NPTVhOeWc2ZGRUZUI5dDgxcCtYd3FhL280UWcvMnFaUWFka09i?= =?utf-8?B?MWowTU5oT2lsOFo4QzVveDQyQU0zRU50M2R1K0RzcFB5UDhaZ1NiU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m9oSmgvdmdsd1JLb2Y5MUI4bTE1?= =?utf-8?B?UlMvaG1VVkdpV0RKNmZ2emtCaThab0FZdDk1c1lsanBDZW1UUlo2Um1ITjJK?= =?utf-8?B?VGdZaEpzdWNZN05ycC9jbG1TOHZFOHhGSllBWnFIcGtCdmRrdVZNN25mcDJw?= =?utf-8?B?bzIrajhRQ1VVQ0pYNWJMQnNmNkE0S0xUSGtlak1tdmc3a2NGcDloZ3pBSUhQ?= =?utf-8?B?UFo2OE0yNGVqMThSRTF0MUlIYUZOa0N6cS9lU2RqZVNLL2k1alBxOXh5WnJ3?= =?utf-8?B?d0ZsemJHSkxrSXpHQjFzdFBKTDhmdkQyeGU5TTU1TFN6OEdVZDdqdWdpWWpF?= =?utf-8?B?SnFZSVByMVR0ZmE3djdMbVF5UHpaVDd0dzVRSUhJUFZRcGovcWxrbGdycXpK?= =?utf-8?B?bkV2THJjMGJ0L3lpODM2aFhRUERBenJYU3R0dEFIdG1TdUlNWVlZRE9RV3py?= =?utf-8?B?emhLM1dENVlzVWNVa3Zhdz09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?WkY1c2tzaUFTeEo0Z0FMWVBSVjRSNEV2MkNKYkJZUEFJazV3Rk5vcXRzdHBD?= =?utf-8?B?MmtDcDhORlBZaXB5RU42QnpVbmhPVTVGaG5hcU9NQ3FqQlA3aDBFZGdNVm1S?= =?utf-8?B?V2oyUmd2ZkFhZUNrVGM4UEx6RHRHbkxHc0dPeG1pTmZUZWFuV0NBaVovMTZi?= =?utf-8?B?SFVkcThZaUo1SHFjQlA2SXU5KzloNEFoRkFXRWlocVF5cHUvU1BOWEhHRnN2?=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0h5RlNpdlhnb0E5NlZT?= =?utf-8?B?NUJjWFRzcDRqTm0xR1lCRkZYMU53Und0TndQZTBwd294bnZTVzlzQ3ZhNktp?= =?utf-8?B?U1N0aXpvVmRONWhpT01qQ1JoSHRjM0NUczlVd2JsS2hWVzdISlNXMEVaeGk0?= =?utf-8?Q?YKp4FwnS9w3rZ5NYFGFkpKY=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: 123c417a-4e6a-48a1-e56b-08dc79979491 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:51.9146 (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: IWoqWKhHDysmLTuizscQic5ySeyh82m5AzW6LBZl9bfGPcTsNGbEvDV8sR9kCL9fFts91szZzUex0abkVrxcOY8rp9Lvm4pJRgLBBaTQ28CDOgetutiAdY93lvot/0dn X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297196598100009 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. 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 56ef48780f..0ced7c33b1 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). @@ -571,6 +575,20 @@ struct IOMMUMemoryRegionClass { int (*iommu_set_iova_ranges)(IOMMUMemoryRegion *iommu, GList *iova_ranges, Error **errp); + + /** + * @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; @@ -1888,6 +1906,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 49f1cb2c38..d9d66ae2e1 100644 --- a/system/memory.c +++ b/system/memory.c @@ -2005,6 +2005,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, IOMMUTLBEvent *event) { --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297194; cv=pass; d=zohomail.com; s=zohoarc; b=fyDN6XhFtaLpgf1iImXcR1LU4yG0SERmIks0mTROK98FNXmRZ2Z5PSup8zOVdHFZm0YSAab59uMEmcoQM8cnmYzsLjr8d5CvwDM+rl0UAnfPxNOYrqiny4oqP7ZpvW0nBzk5u+iIh40Ra8l1VdvmhsbN417505iugAJf2HGgWA8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297194; 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=lokuilwH5N8vJsvnP4ToLvsgvaPjW/Dc0GK83AImbMY=; b=cGMgIMpqJjth2OPuOVJRx4iumraWO5TtrkCjR7R5Xe5ygwEDUVTDKCOsLfGhOWUZ+gGAU+qADaQFFE/W8wV80HsGVxwmQQtivKXjSCdwgtxUTgxaY74/tQoqbAHmsL+hJlYK8VWJ4020R1ksVeopuFTzOpFjQgtQ7M6D2+Yf2iQ= 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 1716297194970225.82161545117674; Tue, 21 May 2024 06:13:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIB-0000E5-Cg; Tue, 21 May 2024 09:12:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHZ-0007kZ-Q6 for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:59 -0400 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 1s9PHW-0001aH-Tm for qemu-devel@nongnu.org; Tue, 21 May 2024 09:11:57 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost4.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:54 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297115; x=1747833115; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=lokuilwH5N8vJsvnP4ToLvsgvaPjW/Dc0GK83AImbMY=; b=wsLVx3XrXhLo2oqHonW9iidFHrYBTcFbnbSngd7hjmqVt/xNVZc2ejO4 bodveJuqsW35tkGDeDvdS62+vYlAcHP+g8nXmFPz8XS+34dqZW43rUTnN HAM7wwlOHQXocz+n3IDgdyYY5TU1oDIhKf7G8cotR86eQnvRuT9oZ3OiD JLg4m+M52EL0vXCDLydziRCGhnKIwhdBwZdakmRlyliUP9z/JD8CVNbXJ M4kikbt5BBlszrZKGc2cP2Anj5ZCA6KvNXxpVJpCxg+3BxcOxCiAKRELl c1P50M01D4l1b7taz4BHgDDLT3xl7XtQDLZyTP5B2LkNHVKg0LQJE8cy6 w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13061517" X-MGA-submission: =?us-ascii?q?MDGLs7tvvTd7BKGXP6TYAai9RNVbUU9xeHDbT1?= =?us-ascii?q?reEOCzq9fGgNqyZOK7BA3NTrYZZ0wKAhPg4SIJWAtiql9QcVEqxa6cxj?= =?us-ascii?q?0a0zsVx2fDfUpmN2uZYM6wfSEK7jSMJ0HxVagJaLNBVGYBLwsyjcmRGS?= =?us-ascii?q?1dFKbFgncBRLMjEUmvS8e1Tw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DS4PnH0y94wIWUHIDxW3Xn0vsL7WdDCQDh4TCgJqtvK5E5FbpzzUu4e40172t+aY6m8hfEE/MtjJbhb+ju7xygrzajX5zxERs3Ve0ha82njzqV4GWUtxDtjnb63BsJM3JMZmYIGJY/y9c0AzawTBE4vjs64oPcXXiMt3Hl1YiZbi7kBCPa83wz9DUjvmBNuthLRHCnf09P7LnwnP71cn7FQLkxUdSHfXUjfNZbsoRh1Q6sPTXeU1202cEqhq0oXyIJd0BFt1E39ysr2SYszfjaFMnv/oBoeJMAIPC4SUepL94OssaJSEndaI6qu5lgiowEKdf8dJA5shS87jWVlxEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lokuilwH5N8vJsvnP4ToLvsgvaPjW/Dc0GK83AImbMY=; b=aOB/hhAMRAvgsfuFF/d+1bgMJ1MJH1AreRF5/m6ihEzr42HwaFpuB16FUqNbEj2o+rBitIDxU27QSOCJPqhlHXBikQdhz9+Lp/Mn0L2l9HFT5uKA1r0ENkqScPyutLDDMi8TxzKIbpoYKYBiuSWQ9VSVnlqswCgwSj2x3pvLdYkkbE4iVcyuI7GXUfy4IDIqYgTMk3NqgVLDJeZtgajoEWrfrf1EEV5jPtsb9QQ1UFw+ZzNeMswrDBY+foHm+91Qs2eMDmaJoz+/4bF2yUVI+LooJfkDpUGD4Tf4dUk+D6YLDF5Iu0pNDbpEGVTSwfb2Dev0u3z0wvQNHWYrWsvxcA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 20/22] pci: add a pci-level API for ATS Thread-Topic: [PATCH ats_vtd 20/22] pci: add a pci-level API for ATS Thread-Index: AQHaq4ByZz976K1p+kGzAFoHDNZtkQ== Date: Tue, 21 May 2024 13:11:52 +0000 Message-ID: <20240521130946.117849-21-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 6ad381df-f401-4ee7-6619-08dc79979517 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?cFJSOTczNUNFTzZWQWZPOVdGR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HJmb1M5c1Iz?= =?utf-8?B?OXc1TzZIUWZZSXhPVUJtUT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?YmZaRlRzR0tmbnpjelpSM083eEdSdTk4VzZMWjNudkFGVEliM0NwdDZoZzM4?= =?utf-8?B?T2NONUpkTHJSaGQ2UXVjNDdmR2E5dURGQ1VjcHVpT3lpWklkOUdPYlhVY1hW?= =?utf-8?B?TjZTVWYxK09oY21UcGYwWCtqdC9IaUx3NVB5SjJnaG1PTGo4S09jN005U1JF?= =?utf-8?B?WklyT2dBdnFJY2FWb3AxWFYxZkRwN2xIVERab3ZUa0hyRCtNazVyNUpiWXFH?= =?utf-8?B?cmpkOUpzZ1JTQndFZFZjbGFaNXVCSlVoY1VCc3ZFY1lEbmxLcndRSEpwdVor?= =?utf-8?B?Y05YZ3BHTHJrYkVlUFVPSm16QUZQVnhIRWdMSWo1SFBnZElKamc0VlFhbGJI?= =?utf-8?B?K2NhU0ZKRzFyd0VQSGp4K3ozVlM5dVYwdWdIWjZKeVFZbEpSWGRnWXdOUWF6?= =?utf-8?B?QlNvVmE2emVMeC9oVm5tTllINWNPSFkwM1IwSTFPZzVhZGtQaTVQSkxPY3NH?= =?utf-8?B?Yzk4VFBxZ0t3UTZ0NzFhMENNUG1kbFpTelJRanhqeEVFM2lLUHBRelJYWFFq?= =?utf-8?B?cjhuMm4vUW9vMlpiVzIwb2NoQUVsOEJueGhTRnlmV2dWQ2R5QkhnTEVPclZ4?= =?utf-8?B?RlRpUjNpSnNnR2NZU2t4N2VRUkNmWDdBeUk3R0lpS29EMWtGM1dxTHBrSDFH?= =?utf-8?B?MFpPckY2aGVS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?B?eS9GaFFadWI4V2dXYXhnQVYvZWhnbFpRemRWb1preEt6cG9jZDIvZ3I5UjdO?= =?utf-8?B?cnBJVTdqcXpnM3JJQzJsUFR5MmRZemtZamdvVFR6cTdLcU1LY2N5aTFSd2pU?= =?utf-8?B?TmhsUVNaNWFid2RrMVpJWGZ6ZitPVEpQcDJGQ3FQODBhWXJDQzlYNWZrMFk3?= =?utf-8?B?ZnRmV0RyakFWbE5XMUppZWFVb0lpcGExTEdQL3E3SjR6cGR0a2FkTTVXZlk0?= =?utf-8?B?Ym5RRm9ma1FRU0c3anZsQms5cXJTS1V4dDV1YklFdXZFd1dzMmRKTUFzVHRs?= =?utf-8?B?VmxMRFNLWkNIQW5QOGRYZzVuSDNmVXB2YU5URHpGaUNJbHFSUWk3RXhHSXJY?= =?utf-8?B?ajdtaHo0VkZuRERMQ0x4eXlFT0trdnAvdXVDVXo5NWNXMTN3aERSVVIzbFZ2?= =?utf-8?B?b1ZYYWZ2R3hYa3dhZWdmTkVEZ0pUZ3hVcmZNZjl4dFVxSkszRWs1WmUySEpX?= =?utf-8?B?a3B0WW9pYWU0TEt1TWR5Z2x1M3d5ZXFhNEJtQW5RbWdkZ3k4U3JjRklVNW5S?= =?utf-8?B?U3JCRk5yWkZvSDJNQzA2ZjgxRDZqNXE1UjgwSExEZDg4SEdTSWwwUUV2c3Nm?= =?utf-8?Q?FDxvXApESLoTZNaQTqMFlTM=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <8D2A294620C75A45B134EF95D29AABD2@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: 6ad381df-f401-4ee7-6619-08dc79979517 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:52.7918 (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: LOiCMTB7iiKb8kolVJhmaSOMTPYMqNI6SVlSuTNtjWFSvd23x/OnpMXzZXr9XB9E/ecg1dl3PqwOUscRTo0UbAM/AT6I8Y6JKlSUIJnm7B4ds7vOTOYJaNl0JonKVTyh X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297196611100010 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 | 44 +++++++++++++++++++++++++++++++++++++ include/hw/pci/pci.h | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 0e14ef4ab2..10b0708130 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2833,6 +2833,50 @@ 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, hw= addr addr, + size_t length, bool no_write, + IOMMUTLBEntry *result, + size_t result_length, + uint32_t *err_count) +{ + assert(result_length); + IOMMUMemoryRegion *iommu_mr =3D pci_device_iommu_memory_region_pasid(d= ev, + pa= sid); + 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 2147981423..8adba6af97 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -473,6 +473,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, hw= addr addr, + size_t length, bool no_write, + IOMMUTLBEntry *result, + 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.44.0 From nobody Mon Nov 25 07:54:57 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=1716297172; cv=pass; d=zohomail.com; s=zohoarc; b=M3PTs9wH6tj+xy6FGTSzibNk4Zl1wh/nrh3FlCRAX20babb8PHu5ldhvGqs9PDoNlBeRImT+so/93u+I4iiwQ8dyH+EEXREVw2u49afA+3+iYZ0zBgPlaRYsp2uYHg3MqOu4wqKxf9YayY0dWQKCkYI1rg5Re/idN82Ul3fuRto= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297172; 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=OYW6nDkzOmyJAYhlc9/fa1EDVXZlqVKe7EKbL9TNrZk=; b=IfnmTbGOYiTL5YuzD2ykkWZE0LqOL7njzqklJuZbX6EiviseufkjzjjSF1VK+zs3lPijYRnO32qg58mTEmoHlpHUXcYoY7MSh9BYdjLbvQWJaVqeLgnH6AGhS+wJcf3lVcjYUj+sQoHKn5RVssZ1LetHyPfwgqb7gaOzDrfheU4= 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 1716297172716475.72098555129014; Tue, 21 May 2024 06:12:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIH-0000ip-Rp; Tue, 21 May 2024 09:12:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHk-00080J-RX for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:09 -0400 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 1s9PHX-0001a9-Kt for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:08 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:54 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297115; x=1747833115; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=OYW6nDkzOmyJAYhlc9/fa1EDVXZlqVKe7EKbL9TNrZk=; b=DmXLKpuYbMHb5wNrlo7W+hIlfo6d4b4wEdDQMOHy1eqaaFaJ2QKCdvTJ b8UbawVlJsLAFQAbsbKqncQsGInfklkvsGrmUSRj05nK4AW04p7TLFfX5 vQki8ZZKmdDBmUQewBN+8pz/oySYb+RbXPR8v35hRA+KyqSGdreUbY4dC AEx0OsA3yxBjR7MZH5CwxrHMxw88maIOHI0OCbvrYITO5FNLLkV4huEeR fKEc9X0JO9HY8vQxLJPCT9aPx5u+Z2z9eDRlVvoxQJTX3jjQyCFr3ASWC Oq5f+09yF7TTfhh0+fOhDEVcy+A2ao/3BeDqZ3iE4EWKvtiA5RNSP1nRg w==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13011538" X-MGA-submission: =?us-ascii?q?MDFXN0FrgkUGvL6RFU9+0ZjBjEznCVzp8ehWHn?= =?us-ascii?q?5K4xQlObfTmn5H4npf1weu0fAp2s2+yZ+R7PVbG2aeYCRVsmUZV7Rrk/?= =?us-ascii?q?Z0AzBRwctD+VdwGq+yVixnLy5OxSPYB4nKpyXwUojyQSNFRAujevSzGm?= =?us-ascii?q?GPfsppAn1uQW2fzLEFQ3haUA=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRwQuYaF/hXovTJ5LZ9Nkv9wWtjdndcBcNrbHEKapDH/LMczQOlOx2QQTrBCyLUpT9iuh5Soz0086/hjYbzl0eL08/zmErVIJyD7KxDtKk5NKoC16Yzwvn9lfjfBJ/0D8Q1ZL9Uxx+gZkuuvolCrE9MksclnMr49WntGCF6PsQUdBiTYyYEFUxRyRHcYmceFonUWYv8uVwtIXEyAtW2tZ+zdOrAkQ4TUrTeq/zlmmuLltG2j8r6Bnb3TVDTfQv0ZZkMdUK9DJajAVzBfDllJpXb+stCX/GVbYqzPTcx1h3EMVW+1wB78FR7T1PB1rP245GcF0NZpUUXR9+G1O6wu9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OYW6nDkzOmyJAYhlc9/fa1EDVXZlqVKe7EKbL9TNrZk=; b=gSVQhUKHsBPtQ/PPVXD1Cfraaq37QY19QWYykYuHzqvU/g25xQM6rT2cgq1ddoI4kaO3W9juillbjtKS/IqJzwDBW4Hb7fsZyF44nhNJ0gebelYX8Bex7hI2UrRKgi5BWl9TKXKdatR99rcsfr0BDhptHBpJkvoSE/Zo0aWpOxbwNVEX2ypxNNR/USteiQm2s56q804HmC1EMPTaiMo9dxMKf48UzvPYy10KdIEedwGl3ulXCepOyWocXVi+4rwCrl+qmE/yGnPKtRlLqSkftcVcm0SS9jiNxlvubB8vnrN7vJxs0kiWLE7lhe1GazAXfOx6XlXh3erI/4+DazI6ag== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 21/22] intel_iommu: set the address mask even when a translation fails Thread-Topic: [PATCH ats_vtd 21/22] intel_iommu: set the address mask even when a translation fails Thread-Index: AQHaq4Bz7Ru33W1vwk2nGsDl0E/tfg== Date: Tue, 21 May 2024 13:11:53 +0000 Message-ID: <20240521130946.117849-22-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: 86b9ede9-775f-49bc-6050-08dc79979593 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?bitxaytCYXpWNlVza0ZieVU2OW1OSGVYT3BwWHBkQzd0YWVaWWFBblpsbVB1?= =?utf-8?B?WUxYL0F6TEtyUCs0djc0T2FKUXFTZGZsS2cxNmFEV0I3QTFmWFNNekFORXJJ?= =?utf-8?B?U3NmQXdhWFM1SXR6SmlFNmlxc0cwcStZWlZ6aGdadlByZ2doLzJJay96cCtR?= =?utf-8?B?Y1pWSlp6VVo4MEpiRGluTG1pcFhhNEhJem5QWGtmOWNvY0UramsxbHppNVd2?= =?utf-8?B?d09FaTJOY201SFF2Y2wyRHl4eC85RzdCTnczUWtkektKY2VZQjl5SFgyUkJQ?= =?utf-8?B?dHE5TkEzNWtIbXVoS3pGb2dLVFVTUXhINmQ0TXJzaGtoYTVkKzR5TjhVdXgv?= =?utf-8?B?djZTSVNURlVQQXBoT3F1SDNSc09qd3dTbXNRSTl4YUxFZ2VWY0tSNU04cnlR?= =?utf-8?B?d1l3WVArUHprTVlicXVFR0ZUNEdMOFpNVnRrdVVQRUYrSHdqSDlPQS93b2Ny?= =?utf-8?B?NjM0cnBCTlFvYlV2cjh4T0I3SVdyV2NIeW95ZTB3N2U4MUdHK3lCRU5iU2lU?= =?utf-8?B?YVcwUWFuYWRCRk00eVlkcTF6WENlcDJhTlNMeUQyUEc4VG51ZFB6QkJWN0ZD?= =?utf-8?B?RGFYM3pldGFVbXlaSXJVUG1wenl0U2VEM1pwaUYrSGFzK2dSUVpUeHZtaGM2?= =?utf-8?B?NjBGSEFuUnV6RTdwamw5YmQzY3BuSjYrQ1pEaWlwVEZuUXUyYW9lb05sWDJo?= =?utf-8?B?a2E1TkFqZUhha0kyOXFqNUdETmRvaWY0WUorNU5KNzBXUFFuNGNoUittWk9r?= =?utf-8?B?eGN5NWNTU09sYTkxNzBkQnZjUXFrMm1GbzAwVU93QVJYdlcvV1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FJL0ZQeEN0aU5sdmJvSGZ2MFFxOGY4b1dEK3dx?= =?utf-8?B?NCtrbWZ0Z1B0T3lSM0VmeGdrb09JWU5Oc3pzaTV5blVYdDFkSmY2djEybm1D?= =?utf-8?B?WU5MaEpOQlVWRjBpbHlnUT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?MXlYUXc3ZHZYeXRyaUo1SXl4dGMvMjZmbU1YdTFwN09nQUwwQ3ZnMkZaaWlz?= =?utf-8?B?SktHUVhCVzM4ZFlxOFMvaFRxR2U1Qm16elRHeG41MkMyTFlGRGFqNkNpaTRv?= =?utf-8?B?SXFjZ0ZOb0lDanpWbkJPQ2tMaXFXNU5laW9kb0x3bWM2VUNyd3lqM3N6c3hp?= =?utf-8?B?dEE1Z01Bc1ViOEFBenR3NGxUSC93UlprTDFRZjJjQktOQ2xaZjFDb3lKbUQ2?= =?utf-8?B?N3dIRE1MaTVMQWZpZUVOK093dzFta3pNVEozUTVOZlI1d2xlOVdVV1N6aW1M?= =?utf-8?B?elFOK09LSzkxVFBaS1VzV09CL2NNTjFuU0EzOVcya1IzWDVxWVlsSXhSMW0x?= =?utf-8?B?c2s4dGVhd0ZQTGZqM1BwZXc0K3QwMC80MlBPVWlqTVl0UDRJUEJXVWtnN0Rv?= =?utf-8?B?MkZnT3RYZTRwSTgrck9NNkNjQit1ck13QmRrbmZuV0JLaUN0bzdBVGRDRGFF?= =?utf-8?B?WUNXVDZtZnpUZGFTbDVjSUNIYm5KQjY2ekpFVlZJYkdoQVlWYWpjTFVCWjVt?= =?utf-8?B?SGMwa21SVy9Ga2U0ZCs1OUtrelZpMFYxaEJhVG1FT1Mx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dEYrY0FHd0hkV01EUlphMDBUMG9Md0s2OXVOSDBkRTRu?= =?utf-8?B?cThiZFREY3l3OWJxTXErZ3Z6dnlFVlBQNitjVjBNTTZCRm8wZ1RrYzZVakxz?= =?utf-8?B?S1c0ekl1N3c0V3p3Rjc4SmN5VUMwbVhPYklOS041NWZSMDdVU3RKcXlqcmFj?= =?utf-8?B?UXNwZXczcW5QR0JXS0U2dHRESFJzdERXU3Joc3VBMWhtS2RwTTZlUHZJRVZ1?= =?utf-8?B?YTV4SlUyTVcvYnh1NnJoR1hYZFRoNVRQYldERFNHTlRSWkhINGlhWFUxWFd0?= =?utf-8?B?NlFUS1ZJclJtRHRQc0hoQ1EwNTMyR1dCOGNXUnJuUUhuODFJd2VHMTBKQ1NU?= =?utf-8?B?YmpYcmdBZHViR3l3NGNtUDU1dVhnYWpiMlFLRk9lbmlOU2NRRkRNMERZTmpr?= =?utf-8?B?TGlLejJzaFpIUEJnZnFzRnR3dHRyTS85TXBGcVo0RitOYm9OeStjUDkwdUti?= =?utf-8?B?VVl0cHRjVGM4L0RqRVBGZ25sSnppYU9CMFA3WHFRZ3FtbjNhRUZ0OG1JdERY?= =?utf-8?B?b20wZktTZTNKZFQrcFNXaVFJWjVtQTd6RS9xc1VydE9kaU5uQjRxK21SM09k?= =?utf-8?B?d3A0aGNPdSswTjJTSzJ5VDJFQjlOY3hFZUZLNmgySFdtcFRIZ3Z0OWMvWTBr?= =?utf-8?B?d21vUjBHbHc2bVNaME9WeWFZQXBLc3dURmF0QVZHRFJuVzF3SE1xekRTYUFF?= =?utf-8?Q?pScfYiDlIqntluKwjT7lPd8=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <7A0A7C391FD5994FACA7E7235A4942D0@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: 86b9ede9-775f-49bc-6050-08dc79979593 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:53.6044 (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: vqI2dHeXg0p5H8vyyXC9OnxCiCe53T8uy4ROpK9Svni4IOi+IL70VlhMWTxpvN5S4Gl+rYo3b3/H32TDp7IxUEnQ684wivDR8asXYLoJ/MyD6LGveF0L6CSWWYMJPod9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297174469100029 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index f08c3e8f00..496bed9447 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2169,7 +2169,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; @@ -2314,7 +2315,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_slpt_level_page_mask(level)) : (~VTD_PAGE_MAS= K_4K); entry->perm =3D IOMMU_NONE; entry->pasid =3D PCI_NO_PASID; return false; --=20 2.44.0 From nobody Mon Nov 25 07:54:57 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=1716297225; cv=pass; d=zohomail.com; s=zohoarc; b=JBpCXWtWzUTEw+eN3BFAYHefQfEkBFVE5BM1qq5DNl1d2A5KsRVSTaJIPgMsbk5MqQ3FT/BZA6dRZe/v/khgVRF+f9A952nCvkIQQe5K6pDfxda2sUF2kmlbz1pnGeAquDQFdbfS5micpf/ARVDtDo+Oo3aSh6qIh4f/7mHJNYI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716297225; 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=gOL1Z/9VTnohgeJlr7Aoab7lzDrd5FOG5MHKFkUZjKc=; b=cS7javZ7XvNbFAc0XC7XwfiefG/49XzP0RUkBgIflgtn+X6fKSCjqQcquV0cTUyM7OH5gZyyC0KckwX08C5C8GmWUasB3WF5z9iTCKMtCNc0/tiIlUb+XE8huothn29u3R3mEzVyrIj/I3mhOZXeHts6WPZPxtEI4vpzCeK2Jms= 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 1716297225802438.5759839371394; Tue, 21 May 2024 06:13:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9PIC-0000MF-UQ; Tue, 21 May 2024 09:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9PHd-0007mg-2c for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:02 -0400 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 1s9PHa-0001co-6l for qemu-devel@nongnu.org; Tue, 21 May 2024 09:12:00 -0400 Received: from mail-dbaeur03lp2169.outbound.protection.outlook.com (HELO EUR03-DBA-obe.outbound.protection.outlook.com) ([104.47.51.169]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2024 15:11:56 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by DB8PR07MB6249.eurprd07.prod.outlook.com (2603:10a6:10:140::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.27; Tue, 21 May 2024 13:11: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.7587.035; Tue, 21 May 2024 13:11:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1716297118; x=1747833118; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=gOL1Z/9VTnohgeJlr7Aoab7lzDrd5FOG5MHKFkUZjKc=; b=pnx5gT3TGQ5rNEtDhJxQ3MveUljbp2owHSV17EuPNIoFZHCFieJ2/g9G QB2qgKV2pAeb8AsmRZY+PnsuZys1gXoik+bB+kw4Oc49yEgdhyRAO40OF kb0Q1uiRtiqg4b6jEexy8yKWjcHdKvFnUGSaWxe+EAKq0gq40UFgpr+vq z3vU1HnYugWsYNZVEfIoRHQVr75StqBZtyy8s8oGL6OTBbiQfyX0YrUCs aScS1qUyR0moSNX6zqAVtylxJgrOU6l7IkoUKHSsVnsj8seMhFjogx++5 tuPxRBQfHN1Gep5yJnZ9xKoFr8L/Iqmsdxlp4NJt9quOrHFOy/m4bF4fO Q==; X-IronPort-AV: E=Sophos;i="6.08,177,1712613600"; d="scan'208";a="13011546" X-MGA-submission: =?us-ascii?q?MDEsXXfpqCkV6Bs636Xm3BSa0iLQrFgKudtVVn?= =?us-ascii?q?UfKmt3yrCKOSuXqOL4fa4YSeILtk1b7H4Te6GDRHr9MxNTVFEkkjSJmc?= =?us-ascii?q?d4opj+R0FbzcikEeMXeE157qJe5H2KWk+pz+isu02a0OEMIFKsRYjsWq?= =?us-ascii?q?+CF67joztEkYYMtaH1pq1Znw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QO0bfDfYq/kNQWZwbLqOdDWEyAls5gC+6c0fRJUOMo6aP6EgjCWABEebBWQ30UVTWEfhqIZS9MzaoT9RnDaUF3MbonH1iVDqjDuSC6Xyavn/i5rzWdKsutkSEnOZ0wHbZahtTiD2BUuo38jc4QxETaIMou5Ap3utbo8V288yhqPdggqaBa6+ZMu+PLTlpbA8LCZxXiHPTxVSkhLXWhxHJ7O79ouk4RPvmM2OT9x6up6VuU1aUzWbRwzJqq8KkATyXngfVFwS6DTfCexzn869wwumKt4wPknjyDbNsO5cxYR0s2BwbX1d9FFHqvu8+KU9XXbz/Ru79r1dZwVBplu5ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gOL1Z/9VTnohgeJlr7Aoab7lzDrd5FOG5MHKFkUZjKc=; b=lhufddWhhXhq/6q8OIDbXtH8NvLt2Y8un8fRmiYtLXMkfg6xpaeijGt3A0iQwyHvcMNjWGRgNqkPrKWDpjVSYEBCFNOzNhFE77SVSgLHISHjGkkS7N60UXroaYUUcPiPlOl9vPN72OIjV8AsrMHw8dQMVc9OhDTOV+ZhNeTtWbQAeQZbDXCYEvpSVN77k2tgRgxNRw9Xj5/kyld0yeGU3WdrAsCGKMZo3IYHcF86sojX4zuynvmOt8nFFxlCGOoPxPzeBcszfEGk6cyXS2O589YL5v9QP9ZGOuajXknHi0/KOzAPOK+Y7y0Z97g4BZNE2A3Ezs8QRc9FmYqeao+dKA== 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 From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd 22/22] intel_iommu: add support for ATS Thread-Topic: [PATCH ats_vtd 22/22] intel_iommu: add support for ATS Thread-Index: AQHaq4Bzxu50+1LF9ECmS9tKvgO8/A== Date: Tue, 21 May 2024 13:11:54 +0000 Message-ID: <20240521130946.117849-23-clement.mathieu--drif@eviden.com> References: <20240521130946.117849-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240521130946.117849-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_|DB8PR07MB6249:EE_ x-ms-office365-filtering-correlation-id: fa369c92-c842-41dd-5263-08dc7997960f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|1800799015|376005|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?WTUxREQySTFWdlpoZjNJN2kxSUhoNEVlM3E5bTFvQ3JkOFBnTm1LRTVwRWZC?= =?utf-8?B?VnRxaStLZk8vVnJHTWZhbzJkNzI3bzVaN0l6VHdVOFh1V29IZWdme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; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?bVNmcHdQUmVjRGMxSTZXNzZ5QW1mdDZZcGU0bVF1aDIrd3dSdFg2emx1KzV0?= =?utf-8?B?d1l6UWtpVDVkbkVadzRtcGl5U1pRMlZtU2N4RTZyb29GWXpDRTM1TTBKd0Vr?= =?utf-8?B?UFl5c1JaeTI5MkErK1cvZnlXdENjTlNiWGpLaFJNQnNrdDRCakYzY1F4OXJT?= =?utf-8?B?aHJMVk84SWZHNkc4SHg4czA5akQvM2xMTzF2WW1sQlNtNXg4SlhPV2Jpc21j?= =?utf-8?B?MjR6RWptcVlDKzZNQWtIMGtoSlBDdHFxdmQ4dXozSm5VWUhGR1pXV2tKaC80?= =?utf-8?B?a0w2djRJYkkwZURVR0JUYzhweE9TZDVFNkFiTFo1VnduVlFwcGhpbHFXdGJR?= =?utf-8?B?Y1NuUE1WUzdXZ3FTWWdERWlBY2ZJTUxUblJQYjdJUGpmZTQzMHdvMXY2bDRw?= =?utf-8?B?ZDRyZ3JjVWQxZDc4eEl2TlREbjltUlErZnZ6d3p3ZjJFWmk4QktYbXNyYVBH?= =?utf-8?B?Y3RBLzduY0V0N3lYc0llcFEvb3c1QlFRRHBoTkNZS3BCRVNHZ1EzbXBmWm01?= =?utf-8?B?dGFQY3BSeU9LVC8zMitpbjl1b3AzV2VYZjJuS01GTmdLUTdsNVRxa1RyZVJF?= =?utf-8?B?RndKV0YranhDQ1VueHBybzMzUmlCck1IZ2RXbVVQaDV4ZE4yWFZCamFjclJS?= =?utf-8?B?bktDUWIvZFJGU2YwNEJLTEM0YlBaeS9PL2hkSW9zUXdibFQ0VHkzSW5sRE1q?= =?utf-8?B?Vlo1RXYxZ28reFdid1phSWYxYWdoaFZzN1Y0azhIcDRHYkdVd2V5N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o0bFpwNnJuNU9jZkxFZXlSRk9HYzRXek4z?= =?utf-8?B?VGZoOFl2YUxuSUp6bW5tT2tBVmhBNExwTkRFYXJiWmlvM0lpZjdnWGEycUFy?= =?utf-8?B?RUIwNEZocklkaFlYY25ZYUU0Y01vNmtvMnkwVnMxeDRuK1doRytlYzFPaDB6?= =?utf-8?B?eTFQLzdJL0hIQnpRTEFrMndvazBMVXVVT1RiMm0yRUQ5Y25rSmJOcU5mL0pJ?= =?utf-8?B?L1lxWkEvb1FFNjhsZkZoeWVVY24zeXlxL1dURDMrYTZoYWZoMEdyZVd6aGpJ?= =?utf-8?B?aU40ZHZIUmswL3JKTzRmYkZVUjJuVWpJUzNoV2h1RHE1U3hxVnZJbWV1T1oy?= =?utf-8?B?aGErTnZJVTZWNzhSSjBHeWF5Z28zdVUrdEY2cE92d1M0c0gwMjBmVDVLSEZ2?= =?utf-8?B?eklPYmRwMFJjanE5VTkzQytFK21TL1Z6TThkT1E2T05Lb0Y4L2NnUkwwTU5J?= =?utf-8?B?VXFPRmNVcTZ0OUI0RHpSU2thSlF4UkJ5aGtQMDRlRURXUS84RTFXa2duaUJP?= =?utf-8?Q?tyYlwJuweBbA1jrCmtp8s2Y=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: fa369c92-c842-41dd-5263-08dc7997960f X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2024 13:11:54.4017 (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: 92L/N0jEPxcPOEqzBWr9FusqqwsU2CuQPYdzjpwb6IRnJ6+XcXtoz2UxJe0u6EZg1U66nJldLqHXUjkanUxLbok/uwby85mMmJ9CGKoK1FwMzONAJwSiSjW0R/TH6zTa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR07MB6249 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, 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: 1716297226677100001 Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- hw/i386/intel_iommu.c | 75 ++++++++++++++++++++++++++++++++-- hw/i386/intel_iommu_internal.h | 1 + 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 496bed9447..2e78ebe6d2 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -5381,12 +5381,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); } } @@ -6004,6 +6002,75 @@ 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 */ + if (no_write) { + /* The device should not use this entry for a write access= */ + entry.perm &=3D ~IOMMU_WO; + } + /* + * 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_address_space_pasid =3D vtd_host_dma_iommu_pasid, @@ -6210,6 +6277,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 1b0d8958ad..461158f588 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -194,6 +194,7 @@ #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_NEST (1ULL << 26) #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.44.0