From nobody Fri Dec 27 08:14:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@eviden.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass(p=reject dis=none) header.from=eviden.com ARC-Seal: i=2; a=rsa-sha256; t=1732866482; cv=pass; d=zohomail.com; s=zohoarc; b=KOrMVlfth1AdgvPhv12WV15wbIUsPkW5k9xjus3GU5WRNBQHvj8IOfS2HcJO6wuKr0MDuyBWHUtbjCRQi7rOmJ0Kjy2w7cdJ3oUfEmVY78um2tARoH+xTXFOtDSLPMJZwo4BcizNxcIsn8pCfdqItiI9z6JeHuhmVcoqmVr+Ubg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732866482; h=Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=YrLH7R32AgLQIf9jBUdZMjdhJav1U1YHdsZ8SkWpkbmlN0C0g6lwXGx7JHbo/jAcjMEZF6K8fa03zHXtQ5YRE0ifVe3zBPwg6Eulmc1UfK2MBMNGkNvX+eoDzM5KBi0Xz9Nt8bK/Tt/68dCaTgO+XuXONZtAb4+e8AqlywDXxEU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=@eviden.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=eviden.com); dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1732866482356290.1338338437314; Thu, 28 Nov 2024 23:48:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGvfm-00083j-4l; Fri, 29 Nov 2024 02:44:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfe-0007zT-7x for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:11 -0500 Received: from smarthost2.eviden.com ([80.78.11.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGvfb-0002nM-0H for qemu-devel@nongnu.org; Fri, 29 Nov 2024 02:44:09 -0500 Received: from mail-norwayeastazlp17013077.outbound.protection.outlook.com (HELO OSPPR02CU001.outbound.protection.outlook.com) ([40.93.81.77]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2024 08:44:01 +0100 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6414.eurprd07.prod.outlook.com (2603:10a6:800:139::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Fri, 29 Nov 2024 07:43:59 +0000 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d]) by AM8PR07MB7602.eurprd07.prod.outlook.com ([fe80::fbd7:ca71:b636:6f9d%5]) with mapi id 15.20.8207.014; Fri, 29 Nov 2024 07:43:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1732866247; x=1764402247; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=JCigumQ7ryzPAgOhNtxGccSP0NG4R5pI9u49yyB5l9VlsXClZf1Wkk3X 34mXIkqvOyWyr1if9Ngr3mJHc/vwitmcNMo/YabpufKSgmFV2gjTHUrbx Gbntag19siczOOsHwdWIzQwIbWTQjRe3Nj2fH8aGC7E81jjB618EaMvoT ITZRr0Fx4YPMN8jVpWzMGOpPvrUQj8Dm+t5W3nTPr4VnvtkCjlRRzj/Vz FYPkoX6NvepJsm2v5Z25sjc+NDASLGHcsDASt6j4o4zBSaUbC+6hPIdCJ P/qb9XY7+v8YwvLz7AfdSFr+CYVPJYmjzi52a/n5zRKWbIYpp9f/2JxyL g==; X-IronPort-AV: E=Sophos;i="6.12,194,1728943200"; d="scan'208";a="25670811" X-MGA-submission: =?us-ascii?q?MDGo7LgHrwqw3jDPn6WpDqwxKaBmucBmi77fnm?= =?us-ascii?q?NbIxiLI5obCk6RsYBsPbqLlxt29aAeM33YFAlR6DqVFKuqzkOFJIdFsu?= =?us-ascii?q?KpOUbby8dIED2cBTghyAeM6RsgpP5ppek+N4wjcqwzf4eRdi1EZfXQpG?= =?us-ascii?q?HWOgUuJRLbQ1aok60N38cmAw=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r4OAEbsHTQBwcuctCtA0HEY4P015KpHbwQYQMtMUU3a34g7TzcDaKLXHDU2oGBU9zffuWsx5ngRNRDWCJ2CV587k+ICZv2JWV4nTTvEmKvTakOKWTZG6V1N6pQ/wHB9oEz04z4OkWYGFYY+sU9j9TrWVCQkRnCctQCkqzpi1pw0NmzEOijZ1V4G6s59z1Yj6ZscNt8ZC5pGpaKp1SwpLNhiS7P05ILaweq6R8LghC+8Zgxzr5ttd/kuXYmyWhywFAiMU3M8baxjnBAeW85Lm1jdrC9/bOsz60/i+AKJp5hdyePnAutyd4eBVytKvWEdIQ49FbdGNY9YzhxJbhdxpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=Wr+mKCsyhxUld+HBC6PCs84M9M9XxI68qWrM6oNzjxZ4BXaisSUL1efn612vxpPFyLat6wZSqYFfeodODXA54EftWNwZkmbzZFiE8rVXWvowuOMiylXTUrTHwVJAR60NeNSaK0GvdxTPgkhTd6tCnB5WphT7M5INP6lXgYA6HaqRMIujJNJRuHx9D/JkH4dGTTAOcQugVyE/xMBDGZfz/EDMvub2TDVbuyVpBVrLISZQywCTJhVGiOj+usg4qU9z0kAKnOnZ06iK6cLrY1ECVcxSKarIW6iJe47UsNjyU5ZNeivMK5pT9mNYGKpEEyu+8tE92iCT11D1ZIcvviN6SQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eviden.com; dmarc=pass action=none header.from=eviden.com; dkim=pass header.d=eviden.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Eviden.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lKFYdcossLRHzL2m6cO8jzSLlEUPo1FKRfk/C2cEJBY=; b=IXZMD6gZ+vjtaS5HVrXC6rP9eesmWBjyCq241zSs85GPkh/4NHnVSx/3EuvzJgcMUkH45o1v48IUl+cAj2VLLI5nMQaGbPOlA9/wNaM5YRKaQzQz0n9lZybgbjUjufxAIohJSayvW/Q+CVt4cGl4nOZ1kbBOCudyHlKaOwr0oRDnn9EhlFR0lRWs6ttIG6fkb4b+/ojQyzcBWrHOvfsdAK4YbcgmH4a0y8N98G2zaF7BWFGOIbASjjPFSJLpZDltaWwOJOEwcSVzogy7OdalqROrGGp+tagREFvzWYmmi3qAAXb8RUqA+uqYtFsDS9zQxZdXEi78HdWZw/kvSk4SIg== From: CLEMENT MATHIEU--DRIF To: "qemu-devel@nongnu.org" CC: "jasowang@redhat.com" , "zhenzhong.duan@intel.com" , "kevin.tian@intel.com" , "yi.l.liu@intel.com" , "joao.m.martins@oracle.com" , "peterx@redhat.com" , "mst@redhat.com" , "tjeznach@rivosinc.com" , "minwoo.im@samsung.com" , CLEMENT MATHIEU--DRIF Subject: [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM Thread-Topic: [PATCH v1 13/19] atc: Generic ATC that can be used by PCIe devices that support SVM Thread-Index: AQHbQjJzOocc57+pXUCiOlRFpHu04w== Date: Fri, 29 Nov 2024 07:43:58 +0000 Message-ID: <20241129074332.87535-14-clement.mathieu--drif@eviden.com> References: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20241129074332.87535-1-clement.mathieu--drif@eviden.com> Accept-Language: en-GB, fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=eviden.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AM8PR07MB7602:EE_|VI1PR07MB6414:EE_ x-ms-office365-filtering-correlation-id: 7a8d3666-3ab7-4b63-ddeb-08dd104995e1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?WmEvWkhGTVBIL3J2MVlzVWF0UFhkNFlQNlVrUkdIYmZZRllJUnNYL2RONkp3?= =?utf-8?B?M3ErZXVtaFRhck1QNkQ0SGRQR084Q2dLazEzYkVlc2h2YXFFR0YxQytnVGly?= =?utf-8?B?U01KL293OXVmbmwvc2lpeFF0Um1lekFlcXNmVzBjNTJ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IP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Y3lJY2dtbUc0V1NPRGV5NVA3dlRaMzZiMFJ1enNIT3U5UDVzWFRuYTczeG04?= =?utf-8?B?L2IvMXd1TTlpd3RRcnduOUYzTDZuUlVWRTFuRnM4ODF5SlRkNmZ5QTljS2dW?= =?utf-8?B?eDBBV0lyMFNvVkwzWFQwWjYwRkR5VmFWTEl3UU9hL1V3ckh4QTV1WDByODZF?= =?utf-8?B?VHVxQmcxY2xxZW5IWUFpUFhtQzJQVFA3Zi8zckpmKzhQTlMyRi9UZnh0NUc4?= =?utf-8?B?NmxYbG0vNTFNTFVsSWRxYTlualJWZnJjM0NyRHBNY0NReWRrYWdPbTBsRU1a?= =?utf-8?B?QURpNFlmRVJhb3RtQ3J3bXRxSVVUVEE1OEI5UGFpL3VYZzYrTDcxSDVUMGtS?= =?utf-8?B?R00rUnhDK1Y0SUgvODBmbitWbHR3bTZnTDZZNmY5T0Mzd1hUTzJUR2kvRGFo?= =?utf-8?B?QlhGRVFtSEV1V0FzYnU5ZEpKYUVhQ0VQVXYxZ3NzTWVubi9peGNSRFhZTWlp?= =?utf-8?B?TG54SUJYRzAzVHA0MDlNVkluK2VUMEtlc1N0Rk56elhGaVU5TWg1eW9Ud3VR?= =?utf-8?B?MmlHMW4zalVuaWFVY3R4eUtrZUVSaWtsWXU3SWZJSDBvN3ZZeHYxQnNLWG01?= =?utf-8?B?Umdta3o0UmlQbGxjb2ROczdTaW9OK1RIOVZOVXllc0pkQ3NuOWVwVnQreSt0?= =?utf-8?B?OHA1NlhwaENraGFRSVBSV0xFbTJ0QWUyVHBpL3UwY2ZSbkNKUjhpcGpLYjJ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Y01QYWdsUlh0WFMxMkM1OUJm?= =?utf-8?B?QWxGR1pZcXpPWnptWGVOYlBZa0lGMWtaZk9DTFMwcjg2TktqaUR5ZDBLUnRt?= =?utf-8?B?aEdFQnh4aXJzOVFxY3BzUWY1bDJNclJnLytaUEhxcERLVWF3K1RzcldHcXNv?= =?utf-8?B?MUZFRGhwdEFxbjN5bGZtYkhoa1RvUm1pZ0JVWG93YzZCajMveDY5aDNkaVhs?= =?utf-8?B?L05OUDNsTUFVdE1ULzdwUFN3M1dwVU1TSmxYNXd3b2xjb0NGcTF5KzlnWTk5?= =?utf-8?B?QnJ1NlZQWlhtcG9ZYllFVFRSU2ludC9zYlUyWktWa1Zjbm1UWktDQVdhS0pP?= =?utf-8?B?QU0zQjZpUzV2czlvdjRlK05lTTBMbEZSMk94SWNPdXUvWDJ4MUVKTkxGT242?= =?utf-8?B?V25EdHdWdWpycm53UHIzVmhxdmcvRjhlVk90WDV0QWVKcTRudHY1U1kyL1VW?= =?utf-8?B?QlNMOU1qNXUvZFZVUTh6bUdXcDQrNzFUOTRzaEJ6NGVWV2NFQXh3elZKRHow?= =?utf-8?B?VGp5ZGYzWHJCZTJIQ2pGN1hvSlNkZG9JNTNTZlMrMGd5ZUF6L3A4QlhsWmdu?= =?utf-8?Q?YpMSRK/XYZSTkCgEag1R1rk=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: eviden.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB7602.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a8d3666-3ab7-4b63-ddeb-08dd104995e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Nov 2024 07:43:58.9325 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 7d1c7785-2d8a-437d-b842-1ed5d8fbe00a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DPPJyJUi2EnELMUvViUz5yJV+o0PSt93rPi/qUoIwbACMEELdNj3Ba7UgPibb/ZTzb5hZ4TkLF6VtCruIL7egWWgQxpTCq5i1FzH/K+EOTkbjkvviYDjl7a43UdDr09y X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6414 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=80.78.11.83; envelope-from=clement.mathieu--drif@eviden.com; helo=smarthost2.eviden.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @eviden.com) X-ZM-MESSAGEID: 1732866484576019100 From: Cl=C3=A9ment Mathieu--Drif As the SVM-capable devices will need to cache translations, we provide an first implementation. This cache uses a two-level design based on hash tables. The first level is indexed by a PASID and the second by a virtual addresse. Signed-off-by: Cl=C3=A9ment Mathieu--Drif --- util/atc.c | 211 +++++++++++++++++++++++++++++++++++++++++++++++ util/atc.h | 117 ++++++++++++++++++++++++++ util/meson.build | 1 + 3 files changed, 329 insertions(+) create mode 100644 util/atc.c create mode 100644 util/atc.h diff --git a/util/atc.c b/util/atc.c new file mode 100644 index 0000000000..584ce045db --- /dev/null +++ b/util/atc.c @@ -0,0 +1,211 @@ +/* + * QEMU emulation of an ATC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "util/atc.h" + + +#define PAGE_TABLE_ENTRY_SIZE 8 + +/* a pasid is hashed using the identity function */ +static guint atc_pasid_key_hash(gconstpointer v) +{ + return (guint)(uintptr_t)v; /* pasid */ +} + +/* pasid equality */ +static gboolean atc_pasid_key_equal(gconstpointer v1, gconstpointer v2) +{ + return v1 =3D=3D v2; +} + +/* Hash function for IOTLB entries */ +static guint atc_addr_key_hash(gconstpointer v) +{ + hwaddr addr =3D (hwaddr)v; + return (guint)((addr >> 32) ^ (addr & 0xffffffffU)); +} + +/* Equality test for IOTLB entries */ +static gboolean atc_addr_key_equal(gconstpointer v1, gconstpointer v2) +{ + return (hwaddr)v1 =3D=3D (hwaddr)v2; +} + +static void atc_address_space_free(void *as) +{ + g_hash_table_unref(as); +} + +/* return log2(val), or UINT8_MAX if val is not a power of 2 */ +static uint8_t ilog2(uint64_t val) +{ + uint8_t result =3D 0; + while (val !=3D 1) { + if (val & 1) { + return UINT8_MAX; + } + + val >>=3D 1; + result +=3D 1; + } + return result; +} + +ATC *atc_new(uint64_t page_size, uint8_t address_width) +{ + ATC *atc; + uint8_t log_page_size =3D ilog2(page_size); + /* number of bits each used to store all the intermediate indexes */ + uint64_t addr_lookup_indexes_size; + + if (log_page_size =3D=3D UINT8_MAX) { + return NULL; + } + /* + * We only support page table entries of 8 (PAGE_TABLE_ENTRY_SIZE) byt= es + * log2(page_size / 8) =3D log2(page_size) - 3 + * is the level offset + */ + if (log_page_size <=3D 3) { + return NULL; + } + + atc =3D g_new0(ATC, 1); + atc->address_spaces =3D g_hash_table_new_full(atc_pasid_key_hash, + atc_pasid_key_equal, + NULL, atc_address_space_fr= ee); + atc->level_offset =3D log_page_size - 3; + /* at this point, we know that page_size is a power of 2 */ + atc->min_addr_mask =3D page_size - 1; + addr_lookup_indexes_size =3D address_width - log_page_size; + if ((addr_lookup_indexes_size % atc->level_offset) !=3D 0) { + goto error; + } + atc->levels =3D addr_lookup_indexes_size / atc->level_offset; + atc->page_size =3D page_size; + return atc; + +error: + g_free(atc); + return NULL; +} + +static inline GHashTable *atc_get_address_space_cache(ATC *atc, uint32_t p= asid) +{ + return g_hash_table_lookup(atc->address_spaces, + (gconstpointer)(uintptr_t)pasid); +} + +void atc_create_address_space_cache(ATC *atc, uint32_t pasid) +{ + GHashTable *as_cache; + + as_cache =3D atc_get_address_space_cache(atc, pasid); + if (!as_cache) { + as_cache =3D g_hash_table_new_full(atc_addr_key_hash, + atc_addr_key_equal, + NULL, g_free); + g_hash_table_replace(atc->address_spaces, + (gpointer)(uintptr_t)pasid, as_cache); + } +} + +void atc_delete_address_space_cache(ATC *atc, uint32_t pasid) +{ + g_hash_table_remove(atc->address_spaces, (gpointer)(uintptr_t)pasid); +} + +int atc_update(ATC *atc, IOMMUTLBEntry *entry) +{ + IOMMUTLBEntry *value; + GHashTable *as_cache =3D atc_get_address_space_cache(atc, entry->pasid= ); + if (!as_cache) { + return -ENODEV; + } + value =3D g_memdup2(entry, sizeof(*value)); + g_hash_table_replace(as_cache, (gpointer)(entry->iova), value); + return 0; +} + +IOMMUTLBEntry *atc_lookup(ATC *atc, uint32_t pasid, hwaddr addr) +{ + IOMMUTLBEntry *entry; + hwaddr mask =3D atc->min_addr_mask; + hwaddr key =3D addr & (~mask); + GHashTable *as_cache =3D atc_get_address_space_cache(atc, pasid); + + if (!as_cache) { + return NULL; + } + + /* + * Iterate over the possible page sizes and try to find a hit + */ + for (uint8_t level =3D 0; level < atc->levels; ++level) { + entry =3D g_hash_table_lookup(as_cache, (gconstpointer)key); + if (entry && (mask =3D=3D entry->addr_mask)) { + return entry; + } + mask =3D (mask << atc->level_offset) | ((1 << atc->level_offset) -= 1); + key =3D addr & (~mask); + } + + return NULL; +} + +static gboolean atc_invalidate_entry_predicate(gpointer key, gpointer valu= e, + gpointer user_data) +{ + IOMMUTLBEntry *entry =3D (IOMMUTLBEntry *)value; + IOMMUTLBEntry *target =3D (IOMMUTLBEntry *)user_data; + hwaddr target_mask =3D ~target->addr_mask; + hwaddr entry_mask =3D ~entry->addr_mask; + return ((target->iova & target_mask) =3D=3D (entry->iova & target_mask= )) || + ((target->iova & entry_mask) =3D=3D (entry->iova & entry_mask)); +} + +void atc_invalidate(ATC *atc, IOMMUTLBEntry *entry) +{ + GHashTable *as_cache =3D atc_get_address_space_cache(atc, entry->pasid= ); + if (!as_cache) { + return; + } + g_hash_table_foreach_remove(as_cache, + atc_invalidate_entry_predicate, + entry); +} + +void atc_destroy(ATC *atc) +{ + g_hash_table_unref(atc->address_spaces); +} + +size_t atc_get_max_number_of_pages(ATC *atc, hwaddr addr, size_t length) +{ + hwaddr page_mask =3D ~(atc->min_addr_mask); + size_t result =3D (length / atc->page_size); + if ((((addr & page_mask) + length - 1) & page_mask) !=3D + ((addr + length - 1) & page_mask)) { + result +=3D 1; + } + return result + (length % atc->page_size !=3D 0 ? 1 : 0); +} + +void atc_reset(ATC *atc) +{ + g_hash_table_remove_all(atc->address_spaces); +} diff --git a/util/atc.h b/util/atc.h new file mode 100644 index 0000000000..8be95f5cca --- /dev/null +++ b/util/atc.h @@ -0,0 +1,117 @@ +/* + * QEMU emulation of an ATC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef UTIL_ATC_H +#define UTIL_ATC_H + +#include "qemu/osdep.h" +#include "exec/memory.h" + +typedef struct ATC { + GHashTable *address_spaces; /* Key : pasid, value : GHashTable */ + hwaddr min_addr_mask; + uint64_t page_size; + uint8_t levels; + uint8_t level_offset; +} ATC; + +/* + * atc_new: Create an ATC. + * + * Return an ATC or NULL if the creation failed + * + * @page_size: #PCIDevice doing the memory access + * @address_width: width of the virtual addresses used by the IOMMU (in bi= ts) + */ +ATC *atc_new(uint64_t page_size, uint8_t address_width); + +/* + * atc_update: Insert or update an entry in the cache + * + * Return 0 if the operation succeeds, a negative error code otherwise + * + * The insertion will fail if the address space associated with this pasid + * has not been created with atc_create_address_space_cache + * + * @atc: the ATC to update + * @entry: the tlb entry to insert into the cache + */ +int atc_update(ATC *atc, IOMMUTLBEntry *entry); + +/* + * atc_create_address_space_cache: delare a new address space + * identified by a PASID + * + * @atc: the ATC to update + * @pasid: the pasid of the address space to be created + */ +void atc_create_address_space_cache(ATC *atc, uint32_t pasid); + +/* + * atc_delete_address_space_cache: delete an address space + * identified by a PASID + * + * @atc: the ATC to update + * @pasid: the pasid of the address space to be deleted + */ +void atc_delete_address_space_cache(ATC *atc, uint32_t pasid); + +/* + * atc_lookup: query the cache in a given address space + * + * @atc: the ATC to query + * @pasid: the pasid of the address space to query + * @addr: the virtual address to translate + */ +IOMMUTLBEntry *atc_lookup(ATC *atc, uint32_t pasid, hwaddr addr); + +/* + * atc_invalidate: invalidate an entry in the cache + * + * @atc: the ATC to update + * @entry: the entry to invalidate + */ +void atc_invalidate(ATC *atc, IOMMUTLBEntry *entry); + +/* + * atc_destroy: delete an ATC + * + * @atc: the cache to be deleted + */ +void atc_destroy(ATC *atc); + +/* + * atc_get_max_number_of_pages: get the number of pages a memory operation + * will access if all the pages concerned have the minimum size. + * + * This function can be used to determine the size of the result array to = be + * allocated when issuing an ATS request. + * + * @atc: the cache + * @addr: start address + * @length: number of bytes accessed from addr + */ +size_t atc_get_max_number_of_pages(ATC *atc, hwaddr addr, size_t length); + +/* + * atc_reset: invalidates all the entries stored in the ATC + * + * @atc: the cache + */ +void atc_reset(ATC *atc); + +#endif diff --git a/util/meson.build b/util/meson.build index 5d8bef9891..f2dec01300 100644 --- a/util/meson.build +++ b/util/meson.build @@ -93,6 +93,7 @@ if have_block util_ss.add(files('hbitmap.c')) util_ss.add(files('hexdump.c')) util_ss.add(files('iova-tree.c')) + util_ss.add(files('atc.c')) util_ss.add(files('iov.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('block-helpers.c')) --=20 2.47.0