From nobody Mon Nov 25 07:21:42 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=1717394501; cv=pass; d=zohomail.com; s=zohoarc; b=S5N+IA3Rznpa4PMOfTql7nMtjCY43D6ejqTO88WTx8AzTNFHf2jYfOEPeYEjgwV7JttxfoJ/DhCYE+PnqEQD0eIVL1BX0itsZNGjXOAO67SFC+jwZcpdGmjS+O9mp72PU1OA0nDfIWMaYui1ZPiWfZjc6VAibLb9qkyBQefBX5w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717394501; 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=89kz2uZWAOgE5eTvYbbmfDZ+DOtI2Rb/PyJY5T5dams=; b=Y+aPLgQJFGyJIj7y0Xh3A2fggTM7SoMISs2xttk/AMfd+2+dPg8L+cpEaGTiO/y1v5+9+0LDEggyu8SzAYrSZuw/tGXGPnkhOz6jwFl+iBVg97DeUUN05BEJoLwco10OEk4xHxnwFk27+ZzRg389x6QQV3aYFxWDxoFCQ7/lGOc= 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 17173945018849.456391907258421; Sun, 2 Jun 2024 23:01:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sE0js-0006ri-KG; Mon, 03 Jun 2024 02:00:13 -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 1sE0jl-0006nM-Nf for qemu-devel@nongnu.org; Mon, 03 Jun 2024 02:00:05 -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 1sE0jf-000731-69 for qemu-devel@nongnu.org; Mon, 03 Jun 2024 02:00:01 -0400 Received: from mail-he1eur01lp2051.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) ([104.47.0.51]) by smarthost2.eviden.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2024 07:59:55 +0200 Received: from AM8PR07MB7602.eurprd07.prod.outlook.com (2603:10a6:20b:24b::7) by VI1PR07MB6238.eurprd07.prod.outlook.com (2603:10a6:800:136::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Mon, 3 Jun 2024 05:59: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.7633.021; Mon, 3 Jun 2024 05:59:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eviden.com; i=@eviden.com; q=dns/txt; s=mail; t=1717394399; x=1748930399; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=89kz2uZWAOgE5eTvYbbmfDZ+DOtI2Rb/PyJY5T5dams=; b=eE6NLiXShQbYKTcjWrepu0P+HSLv58AjZo9igwC/ONh8HlmF2Uhazx0J pB/9Mn9HRfC1zMckoO4VAOR/KVsPNwgctRLUjfDHb/zAegjCArq5WlIXq 2TV82A9cIMfZnUY4fXgrmdunOW2Wz3DGombqyK79OXWmx6qu/nu6+BeGV ohRjZ5CB8gNPtvW+ugIt+Ws44QTD0uA1EMWsfCAotwB5uvzz4jXSUptd8 z8mZ5Xx8pEe4RPOmFU/kKkmQH6CUVYsKompl/qho8M0E9JcRWjiqXdbiU bxX3CulNEZqv1qnH2myJDyC7PMoUSsPEU4n9EKkoO7L5C4c0KejhTqn8Q g==; X-IronPort-AV: E=Sophos;i="6.08,210,1712613600"; d="scan'208";a="13763251" X-MGA-submission: =?us-ascii?q?MDEhRueoPZ2SneOXDWaF/qVCmIZ0XWUWVw1hUB?= =?us-ascii?q?5jdhvWYDvS0uPLOPBUo4PH2MRNk5hX4umsRpb++0oVsS1qxFGCuPHke7?= =?us-ascii?q?BzkraSCcvPV04U28mH+Pok2QZKLnuxAP9jissimZ2f1T9fecroIBsKkT?= =?us-ascii?q?pcYW86i9AslOVvbVjkrYxXig=3D=3D?= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j443M289D2aWD46oV8TJcANoImizt/UgWRlOpdOfGqApYYi3UYiPvBn5Z7R34/Y1JJooQTyOVVfkb7QH16wc4NPx2XrDacT+Ju0QB9a+Veje/GfiJdFGPh3+XysbcfiYEx+pZG9KGMLCIGhCd2PuR+NUx1+6WcMF6lQ0wl0bFE1dh1PRYoz17wE5GxA62zP4goE4RC+RvQhomoFnSbaFSpMA+ndXcnF9NzT1P4LNHcYSOZaNssTg3cjrFgvPxdZkRnCisMpOEcgfrlbRpj2eZ79BohI24W2j1lfX/jGcAtD/KEb4o2b7n4H3xJ5egiQ/P4twchaPWrooJ33vRWbpdA== 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=89kz2uZWAOgE5eTvYbbmfDZ+DOtI2Rb/PyJY5T5dams=; b=LNzkzm3oLnQSrNPGIRKwnf905za1e/RKw3TW6RMWusRq4weL4UkYHuzwbF66FPCh5DfyBkA7K+fLVfw8CL1e0/BzVWjDc9XFr9PoRBfe3HncAgcIaKod9uXr+HvvtDQt+2FIiavlm1DLYfBbOeETuHxMnxItQi19cQUrqlHOLZ16GcQVnvlfaaE/Gd3aLu5T60sfDMjVhNzgHNfj3cm2ayqcjAgSn5D+iaqX8XhLv44CQML6dcKkNz8kSmdI/uxs1Hhz4gUS/D19XO6KmRuJazgs5K2Osey6gk/pxekd0KkawSE/YJl0K1sbc24lDu5/6ZWbro+/xjpRWrdVJe0DYg== 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=89kz2uZWAOgE5eTvYbbmfDZ+DOtI2Rb/PyJY5T5dams=; b=q+6A0GylRHReocXIdZuG+m6pX7uk75h6aJnRK3rtnHNvlVwRvwkkY8VuZeWbL/i3+HPnWHdQqLZUFAOknnjzCffXdbilfosOZU2VDPwYKWAnIIzjsHpI+tDDVCZVECFRVNbWOj/HXbppyAtHRuX2m24zOkZI6R7GZcIyTkcP5+BUc2b4ZshJttrXKcPbvAhj63g/tk9b9tkn+Ilqk3OEhZhHj+vDRLkCdcyTQiQJKWwWT+1vluEOJMU6Sq+KBW6Na8M1KnQXePMVNL6xPkOS/QvAJ2/5yM1btOU+WZXzVqmce9WvlcmbxeXu5uwND0vBQCp5QwTRd5X6kDW05UG6Xg== 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" , CLEMENT MATHIEU--DRIF Subject: [PATCH ats_vtd v5 17/22] atc: generic ATC that can be used by PCIe devices that support SVM Thread-Topic: [PATCH ats_vtd v5 17/22] atc: generic ATC that can be used by PCIe devices that support SVM Thread-Index: AQHatXs/4cl8uzc3D06D64WXq8wIGg== Date: Mon, 3 Jun 2024 05:59:51 +0000 Message-ID: <20240603055917.18735-18-clement.mathieu--drif@eviden.com> References: <20240603055917.18735-1-clement.mathieu--drif@eviden.com> In-Reply-To: <20240603055917.18735-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_|VI1PR07MB6238:EE_ x-ms-office365-filtering-correlation-id: fbb2d89d-1f7b-4ec4-9b67-08dc83926250 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: =?utf-8?B?clZxSFJYTktlWnk2dnpjSEkzYXoySC9hNG5hUzFxT21TOTk2d3h0YkpibWhr?= =?utf-8?B?R1JZR1dzNlY3cktaU3RKdE0wUUpvc2tWc3FYR28zdm01SlZxUzJFYVppdGRP?= =?utf-8?B?NmY5c1dGdDVqWWU1Rk90ZFFPN2k5am9lU2RFdVVCd0l2SzEvaVh0STVKUlVz?= =?utf-8?B?b3VVZl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?utf-8?B?TWZ5ZDlnSFVFdFk0eHlkYWtJbThsYWloRldVVVV4aXp1UWkwMFd1NFduTXNK?= =?utf-8?B?c294SUQwQkNpS051VlhBSUEwWVR1QVgvV1pSVTh1MEF1U3hQTWdDME1ZVGZV?= =?utf-8?B?Uko2eGM2R3MwaldDN09DWkwwTzZQQ1Q0YWw1aGRSN2FFUGNiV2g3WEV6eXd4?= =?utf-8?B?c3BrQmtVQnNsdVdpUENIQ3l6dmFCVmIvUk8ySGRZLzFwd3MzRjBOT1NvTlVG?= =?utf-8?B?SEQzUDkySWVndzBLdkVoU3JTUzJzRW5YMXI1QzI2OEN6akZkd240d2NWbzN2?= =?utf-8?B?VnpycThhclRsNFJHak5rQkJtOXkxamRyMUlHeHpud0lFLzZQWGdjZFVxdUlB?= =?utf-8?B?aEVYQXVuc0dxd0xia05MMXdhNWNDWlpua1F3OXFpUUhBbGpyeDVwai94Nzc2?= =?utf-8?B?dzdpNVdpck5PdWNnU1pucXkvN2d6cEZ2WUJGQ1lFYTZraTV6WE9rQi9oNkgw?= =?utf-8?B?TjlqZm9pdDBkaEl4akFFeG5BTTNzR2ZTWmg5a3IzLzJVYWtPR01DUStDanM0?= =?utf-8?B?c3dtZjBpbmQxb3M2bEV1NDZTUDUyT05WcTkwb1lmUTRZcjRFMmJsTUY5Mmlq?= =?utf-8?B?MStncm51eSs1ZFhVcGQvS3NDNSttY0ZmdlM5LzJWRU9CQ0x6eDZzZ2oxUGRR?= =?utf-8?B?aXArMHpmLzBpNDFMSG9PTU1TdW5PUDJRblg5VElZVHFyNmFEdTJaM3NWRVhi?= =?utf-8?B?SEtQSHphYXprTFJTdWZOUT09?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR07MB7602.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chun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8?B?NEZQU2p6Tmdnclk5SG9JeXQxdm5HZnhQeFVHTE1BdzZnSVZEQW1lblJlSWlu?= =?utf-8?B?dHJiTUI3NHdoZmZtd29qWWVoejRRZk5ML3JWdTI4N296dFFzWFN4a1VkMlZo?= =?utf-8?B?b3Bpby9kWDlhN0UySGJDN0w5bkh5U0M5dEdZVC9XTmIwc3kzdE8xdEl4ekFy?= =?utf-8?B?bFgzc29XZGZLNTJHU1Z3MVRoQ1lhaDFHaVJEVjVmbGM1WDNtRVF6anJBK0I0?= =?utf-8?B?Z0xNTWdac29QeWxBK1F1L2c4bWc3T1Z6UlBYMWZZU2FJR09yc3hrSGFSNThU?= =?utf-8?B?RUM3aUdzVURUM2ZVRFRwQXlscU9zUmF3clhYaDJaNnpwNHNrN2xDd1Avc1Jw?= =?utf-8?B?cDdteG1PWGt6Vm44MGRIK1puL2NXNXhsSm5iZVRwL2k5N0NKYzg0WEkyM09S?= =?utf-8?Q?W9/UEy4ero30/B9qgy6M/jM=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <5374C1BC3E978640B7878E39204C3407@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: fbb2d89d-1f7b-4ec4-9b67-08dc83926250 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2024 05:59:51.7273 (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: HFbuudPL7muZupEHCkkhNpiOAjAdELDiiiHsgKJla74lTSmTDq9daS3qwD0SNepGGz2m48bIVpYaxyrGEsOACCTgWFs9n/QxnJjqQSQeJPzMbPCHvcGgSkxicu8NlWAC X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR07MB6238 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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @eviden.com) X-ZM-MESSAGEID: 1717394506996100003 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 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.45.1