From nobody Mon Nov 25 09:30:24 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?WkNNeld6ZTdsQXhIaHc5WGwrbXArMUFBT056bWQ0OTRGZkZhTlJ4L1JUbFho?= =?utf-8?B?LzRCbnZSL21aSm5JK3ZCcmdhRm9FUVdRRzNBOXpRdmlmMkpOeElLN2N1Ty9K?= =?utf-8?B?WUVXWVJxNlMzM1ZFZGhiV3RrT3UybGhEaVdvdnlkbU1IUExUWkhnYjJrcGlw?= =?utf-8?B?RG5BZDNEY2M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= =?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?= =?utf-8?B?SEpDcFZzM3JVRElmcHlUSmIraHd1T2dNMy80MnlQNmNwQSs1TCtPQ3RMbXJW?= =?utf-8?B?Q1FHeUVDU2lXRVVMR3VpazdkcUJhZGdaVXhjUG5CZVpSeDE5b2xxUjlLbTF0?= =?utf-8?B?R21CSU5PNzYyZXpSL3FwMUpwbmRpSWphdkFaR3ZLQlRXblZlWU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TnlsMWZ2OS9HcDllMW5L?= =?utf-8?B?QmM1YVRzMXZYTnlPOTROdzZpVTViTHFnc1V4MmUvWjQvMnFuYTBMNEdmN2I4?= =?utf-8?B?eTMycUdxYTg4ZW9IMW0vcGFzY1BYNjdDVGRzVVZrYkRYa2xTZjJtWGZBWS8y?= =?utf-8?B?UnNSLzA5SCtOdnNqTy9BSXZwQ3BTN2s2RXM3eEV3R2Z6aGY4ZkxkZ0wxbHV2?= =?utf-8?B?K1pqZUZyOS9NQ3hsSjZZZ1MxRnhnaFI4bDF0WkZHWkFiT0dwNUpiaVo2OWI0?= =?utf-8?B?ZXN2VnIzNllsQXlQYmVZRWlmNkdXVVp3eUxkOGpCMW9WcVVGeEFNZGljU0Fp?= =?utf-8?B?dkw1Y2thZVhTdHVJMjdkdzkyekF4WjY3Qmx2aGVvUWcwNlNFOXpMbXkwdXpQ?= =?utf-8?B?SVZQZElTMVIwYTZkR3VXeU1Ka28wUTNqNW1PdW9XYXZaTnBsdzdySlVwQml1?= =?utf-8?B?R2l2T1NCcU1VQkZwNXpIS0c0S0Q0SThQMDkwazVkMmNEd25VL0tidzlLNE4v?= =?utf-8?B?bTBIUm5IWms5UU4yd0tZM2lzL2dud0lXK29aMm5SUkRpaDhLL2wzdkJRblh6?= =?utf-8?B?cERQaG1LTlgzR09IaitUVVFyb2JmS0tBcTZpVi91bTB2NXNCR0dGbG5rMk1U?= =?utf-8?B?ZlNPdzN6OFUvK25ybTBsT01GTXJka1o2dnhxNzVUUHRjcnhZM0oxRjltUFo1?= =?utf-8?B?MzBNVGtiN0s2cmNoOVg0ckZDL2plcW1BU3loOC80WmwzMGduRUJMeHA3djQw?= =?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