From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 24453A034F; Sun, 6 Jun 2021 03:10:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C62D40147; Sun, 6 Jun 2021 03:10:58 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2061.outbound.protection.outlook.com [40.107.21.61]) by mails.dpdk.org (Postfix) with ESMTP id 33AA24003F for ; Sun, 6 Jun 2021 03:10:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P3m4J4dIHZ0OCmnucWczsaXY1aoW3a/8n646ULSZJtk=; b=QVt7ZzFg3hjeT/uGSSp/z9KrDyihF25SDSZJPm+8jIqU0OuzLy83hD7hWrAG09DbMkVvJ8qGaZqMp/HIK0wTfAKIsTeiR0UIFUU9EmkInIWnivkkRRPVupFFU/d+9aF3dWJJnRmDXc8u8m9gnTOYdq89qJyg/zZ7cB+OW9jUw9Y= Received: from PR1PR01CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:102::41) by AM6PR08MB3446.eurprd08.prod.outlook.com (2603:10a6:20b:45::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Sun, 6 Jun 2021 01:10:48 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:102:0:cafe::de) by PR1PR01CA0028.outlook.office365.com (2603:10a6:102::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.22 via Frontend Transport; Sun, 6 Jun 2021 01:10:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.21 via Frontend Transport; Sun, 6 Jun 2021 01:10:48 +0000 Received: ("Tessian outbound 5e4f56e125a9:v93"); Sun, 06 Jun 2021 01:10:47 +0000 X-CR-MTA-TID: 64aa7808 Received: from 18420cf3a63e.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2C395402-AEFF-404D-AB63-E7C9AB5505F9.1; Sun, 06 Jun 2021 01:10:36 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 18420cf3a63e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sun, 06 Jun 2021 01:10:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UupTEWZItw8m8K1gBkeHhNIQR0vvZjC+Ivfk46IkEOL6D4PIWKOYGSeJ1VfSxq/Viy+lNH5Rw6165KMbMvKAPYk2MtFGreOZvhqCiVljo4EghDk5pHu0v9q8bF5Yfehd//XrWjQ2P9/WEgAXacg2OHmZvHTAlJv0VPC6xeZkyqafR1+2xvmr5ByR4PPjCVwEHg1u6KUrSEcz+a5VQA2ZlgKTHJFEq1R6vBruOX4U92aJhjgnupAzvm4AJThONqbzl/+903Y9pe5SJWBifOc6iMp6BGxU61tH2H9n120qXvehsdBSN/gJ/Ea+08EQU5dLp0Y+cQ3Q/xgUz7Qp+hnjug== 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-SenderADCheck; bh=P3m4J4dIHZ0OCmnucWczsaXY1aoW3a/8n646ULSZJtk=; b=TYaSYIXHK/yWqbXN9epWvoxaEzTwT8DrnVWPX/NbUmMxDGmff2WqKGTDXpH2ep4a8n/0diuP6x5z7AGqgDTWdVfom5aMBokxmXDPTcRVBHR234HJmlevStuTs7jO+x9bfUQAtfSDBFB7cV0m7PlUac+v8MjpJucnHoTtBxGY0l/GPi5V7/y8a8sAcOgigG3qVzeAgTF4aSKhOxxLE23uPmPCOWBrZPMKFDyFJeenHrpZt937Mm70OENKhoWE+P1BLDedIw0e/cNRus3bq/gA+HRIUCrDX685tTCOy8ZfHM89gZ7Ij3gbbFYHwDJ5Q5Lbn7gH68lLstmJ0jSMWcqoFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P3m4J4dIHZ0OCmnucWczsaXY1aoW3a/8n646ULSZJtk=; b=QVt7ZzFg3hjeT/uGSSp/z9KrDyihF25SDSZJPm+8jIqU0OuzLy83hD7hWrAG09DbMkVvJ8qGaZqMp/HIK0wTfAKIsTeiR0UIFUU9EmkInIWnivkkRRPVupFFU/d+9aF3dWJJnRmDXc8u8m9gnTOYdq89qJyg/zZ7cB+OW9jUw9Y= Received: from AM8PR08MB5810.eurprd08.prod.outlook.com (2603:10a6:20b:1d2::20) by AM0PR08MB5250.eurprd08.prod.outlook.com (2603:10a6:208:160::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.24; Sun, 6 Jun 2021 01:10:34 +0000 Received: from AM8PR08MB5810.eurprd08.prod.outlook.com ([fe80::3060:6b1a:395e:e840]) by AM8PR08MB5810.eurprd08.prod.outlook.com ([fe80::3060:6b1a:395e:e840%8]) with mapi id 15.20.4195.027; Sun, 6 Jun 2021 01:10:34 +0000 From: Honnappa Nagarahalli To: "thomas@monjalon.net" , "dev@dpdk.org" CC: Elena Agostini , nd , Honnappa Nagarahalli , nd Thread-Topic: [dpdk-dev] [PATCH] gpudev: introduce memory API Thread-Index: AQHXWnC8/An/ShP5f06FnKT8kU9aZg== Date: Sun, 6 Jun 2021 01:10:32 +0000 Message-ID: References: <20210602203531.2288645-1-thomas@monjalon.net> In-Reply-To: <20210602203531.2288645-1-thomas@monjalon.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: AC0A28236E81C5459E360E3722055DB5.0 x-checkrecipientchecked: true Authentication-Results-Original: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.113.13.105] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: c9b173a2-1fd6-4c4b-9601-08d92887eb3e x-ms-traffictypediagnostic: AM0PR08MB5250:|AM6PR08MB3446: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 2h86zwh11xRDiRXRvimPwNodIchQlu9XmOh9IQXWtMIcHvdCsQqEEVWjRRiT/I0crt5Ph1V3Yce8XVaw9kAtfpXMiHyI5vL+l6F3myjWcwQ22juvNu13IqEZka41DijKci9HNEeZ3mwjglRqooZLA+PmAiypnCcneSH0sa9qnOfxap0MuJ31pHjCImMWOfNv5ycHyKp64TfaEiDhD0JHuVNsrons0yuMqkUWhZlBq6mkAD8hZvWv7z0wipQFSLeEY9vTWnPERV02SBN4wBWoYDafCWUlBsw2X4xOflid9sE1yjF7OXOGZgmB6YRytLHGfdTWL8lM8mEoLqr47wk+gzv0fzHod1USmxFHhEBZQF5lyLwQGKdCEnkBxQBPFx9QAUYsOewYz4znotRM8gvYaBxEuv/M5ygzR9Xb+q5RYh8VUO1wm139cu5znyM1QrAgJVyvzAS9ZxRri+8qS7BuzdP4naahk9lhLhe1/gbyuNTqke3bIwQxHrPkwo4Kn9vxvcymHIr5YAaLe/IpzjFv6kZgGed5kDtIzLXK19uhtdBc/Ww9uDCv9BgGAXGfhk0pwVFLOMTXRoUTf55EfthkzZIarFry1gteIrRX7pPTzMA= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR08MB5810.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(366004)(396003)(346002)(39850400004)(8676002)(71200400001)(8936002)(30864003)(4326008)(76116006)(110136005)(54906003)(9686003)(316002)(55016002)(2906002)(6506007)(86362001)(186003)(26005)(5660300002)(52536014)(83380400001)(38100700002)(122000001)(7696005)(64756008)(66556008)(66476007)(66946007)(33656002)(478600001)(66446008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?V5nKo6/4A1YyfNP0KOb3YkE8oYC9mjXKzxASArlw1sCrDzbfGTQPNQFtlAi1?= =?us-ascii?Q?NFN0JPFu7pviXqJX3Af7hNnXhXA5tg85KhttcLvJ3esH7RbdlKQMg1/8xakR?= =?us-ascii?Q?kcYHYUNMDOMEHbEJ3S1NR9zENX8YCyIYNOGKL0k1U+iznmSs3GN7f6ncrcqI?= =?us-ascii?Q?x1BXd0lCYfbCgoTQ6p6++MASVNxzP1nbiPI38tCttRa4dZTUIaPb5UgdXGi3?= =?us-ascii?Q?LYZ+cRO/01sZaKujQsSZ64oCSwcVQVY+wuSxqVexsuxWz9LG2L4hB7WZhGPo?= =?us-ascii?Q?9uu0FkThbpSkhCAO0Lu/sY5U2B9flj6AmhFY7o++qYd75Hb6LLj4Us1zyWsJ?= =?us-ascii?Q?tGjilJKL8PsoBBwSzhEJMYoUtwSKA2rabfj5xqNsNzMrHc746lnqjzG0q4lP?= =?us-ascii?Q?7jjl+11uZ0ktvDGXHhg3RyySW9S5GirSptcDO0on/MHkhcJl007GHPG7n3wj?= =?us-ascii?Q?WQK24bTTNE0ttVAIVuiJkjy1DRSz493dFiHSRi5hNP7s2ISX2qx9urAYpYap?= =?us-ascii?Q?fLNmcs17uqYoSTV2+AvwDptfaDTACc5ssQ3V3pL6MvP7GeJI21GVDpzzxXZb?= =?us-ascii?Q?DReSSA6FnKMhurwRqJETGvsVDTxkXjy9MVsEYTdhgzW5OyJg9aYc/ZgmtRNz?= =?us-ascii?Q?MSVxMS/YtGEuadTuqdogAL8zSL7KcWk/YTCxlnw8QkvaEd2p3H4oSUzzDX7d?= =?us-ascii?Q?ZE7PlujxNcam9cszPVd1bWwrtXy88OjRsPCmZD/IBPg6dRPvIc1KACWjCojP?= =?us-ascii?Q?//N8FfAfr/wHIuKyeysF6tjTwzKA4OZ2uF7Vak0BM+/wciwbFC9FiXUSjPhC?= =?us-ascii?Q?pbcPMik6RWW0sBI9C5bdl3CpgECgGcE0Oh+qTGi/rrzA6uHqNgnC90wwC+pm?= =?us-ascii?Q?JCHd0hUtG6y763Fs7HSqhlE2D2Cz0ffUYFPtKjltM702IH5m5nkjILJleCAt?= =?us-ascii?Q?yIe8Y9f/8OLz0xqLKXiJ/S/LADHHuoOfBvU2fYIyDbhPuakDz2rdubKTk6nc?= =?us-ascii?Q?RipS7rlk/LEJDoHazH780a34jkLlCA3j5f6un5CJT2Fh8Ur15e/TZ22qVXY2?= =?us-ascii?Q?e0OZSnHZTQZaAaWv6cW9Pw2sB1EGXhCco15+EMKmNGZiB0/WrxOXfXeI/Zif?= =?us-ascii?Q?dEDzaQ3M1wZVHJYdCrYZzz3UWnn8iYy2tkjpOE9WksqwZbIjhA1l8Mm4FHKE?= =?us-ascii?Q?3nbQhs6GsCicjRnIFKkn5rzGeRdqc7ocQIREkmNxIz/+7TDDrmbR5NKD77sT?= =?us-ascii?Q?njcLiURBwIqYQ4Gk8vgoxvnLQYKk8oCCbikod5fpUDhn1Cf42dbXjyyyUrB6?= =?us-ascii?Q?HlmUoNQ6eNrCs7yknmy7T/DP?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5250 Original-Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none; monjalon.net; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b7deb24e-29a9-4f5b-d8b0-08d92887e2e2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sGs5ijBmhh9D6g2YjdwpbpB2crcVjiMGpm+Xqg/mqTgtlcSbqbt/UfQ12NZ6vdLzj1PL1j7NrQjb+64bX+FMjwyBtA2cB0+gf3xnKo3ssV+Cer7MWDHehuW24TECiIdju4h9q+HbTXPaWolfdrCCr32H4WfN2d/nEcAkXtXbAyVe4RtNzU138f3TsT/jPviSQqDwVYaJ/wv1oT1lR0kT+SVj1FBWH/Ytg3DcObJEA2r3Xl+IQg0/O2aU6CVKmxb7owjfqCTo0Tf1R8w+p2beHkgS8f1YIc3usqOkO0eqj+oa3JjCWHXvmczUmQp4s3PyrmzzZSPjFjdR4h7yCvtkve3hP6DfvEzmN5cqJ4mH+Q369twVQBIYAvdgVZI2CEBG1kXeuNEgu9PaG5J1+SNLrkbZNcmAlZbtgmzOrHq9p4A0yuwl44stS1TtswuMTLcuV5xkhLAn21dDW2KDD/gyxSYGaxbzdxA1wwcn3lLi69L1fhX+QjZgdITsVsAqfp+erYv8yLIwXERLtN/1vNkH9vnGem3zjWuHz0Xr9xFS6dFhtG40+lpjlgaO7y5EVrjbcBgZ57g7FmEmIWrEkxj4wRYfIxk/9uH+kyRUtrmia5eCYpRf+bi2egLgUcVOwvpLQ0kwYuv3BPZarEmvo8u9bQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39850400004)(396003)(346002)(376002)(136003)(46966006)(36840700001)(33656002)(478600001)(7696005)(2906002)(6506007)(336012)(55016002)(9686003)(54906003)(316002)(30864003)(186003)(356005)(82310400003)(70206006)(4326008)(52536014)(86362001)(81166007)(70586007)(82740400003)(36860700001)(5660300002)(47076005)(110136005)(8676002)(8936002)(83380400001)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2021 01:10:48.0370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9b173a2-1fd6-4c4b-9601-08d92887eb3e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3446 Subject: Re: [dpdk-dev] [PATCH] gpudev: introduce memory API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > From: Elena Agostini >=20 > The new library gpudev is for dealing with GPU from a DPDK application in= a > vendor-agnostic way. It would be good to explain how the application using GPU+DPDK would look l= ike. Which parts of the workload need DPDK's support? Any requirements on co-existence of GPU with other accelerators? >=20 > As a first step, the features are focused on memory management. > A function allows to allocate memory inside the GPU, while another one > allows to use main (CPU) memory from the GPU. Is this memory for packet buffers or something else? >=20 > The infrastructure is prepared to welcome drivers in drivers/gpu/ as the > upcoming NVIDIA one, implementing the gpudev API. > Other additions planned for next revisions: > - C implementation file > - guide documentation > - unit tests > - integration in testpmd to enable Rx/Tx to/from GPU memory. >=20 > The next step should focus on GPU processing task control. >=20 > Signed-off-by: Elena Agostini > Signed-off-by: Thomas Monjalon > --- > .gitignore | 1 + > MAINTAINERS | 6 + > doc/api/doxy-api-index.md | 1 + > doc/api/doxy-api.conf.in | 1 + > doc/guides/conf.py | 8 ++ > doc/guides/gpus/features/default.ini | 13 ++ > doc/guides/gpus/index.rst | 11 ++ > doc/guides/gpus/overview.rst | 7 + > doc/guides/index.rst | 1 + > doc/guides/prog_guide/gpu.rst | 5 + > doc/guides/prog_guide/index.rst | 1 + > drivers/gpu/meson.build | 4 + > drivers/meson.build | 1 + > lib/gpudev/gpu_driver.h | 44 +++++++ > lib/gpudev/meson.build | 9 ++ > lib/gpudev/rte_gpudev.h | 183 +++++++++++++++++++++++++++ > lib/gpudev/version.map | 11 ++ > lib/meson.build | 1 + > 18 files changed, 308 insertions(+) > create mode 100644 doc/guides/gpus/features/default.ini > create mode 100644 doc/guides/gpus/index.rst create mode 100644 > doc/guides/gpus/overview.rst create mode 100644 > doc/guides/prog_guide/gpu.rst create mode 100644 > drivers/gpu/meson.build create mode 100644 lib/gpudev/gpu_driver.h > create mode 100644 lib/gpudev/meson.build create mode 100644 > lib/gpudev/rte_gpudev.h create mode 100644 lib/gpudev/version.map >=20 > diff --git a/.gitignore b/.gitignore > index b19c0717e6..49494e0c6c 100644 > --- a/.gitignore > +++ b/.gitignore > @@ -14,6 +14,7 @@ doc/guides/compressdevs/overview_feature_table.txt > doc/guides/regexdevs/overview_feature_table.txt > doc/guides/vdpadevs/overview_feature_table.txt > doc/guides/bbdevs/overview_feature_table.txt > +doc/guides/gpus/overview_feature_table.txt >=20 > # ignore generated ctags/cscope files > cscope.out.po > diff --git a/MAINTAINERS b/MAINTAINERS > index 5877a16971..c4755dfe9a 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -452,6 +452,12 @@ F: app/test-regex/ > F: doc/guides/prog_guide/regexdev.rst > F: doc/guides/regexdevs/features/default.ini >=20 > +GPU API - EXPERIMENTAL > +M: Elena Agostini > +F: lib/gpudev/ > +F: doc/guides/prog_guide/gpu.rst > +F: doc/guides/gpus/features/default.ini > + > Eventdev API > M: Jerin Jacob > T: git://dpdk.org/next/dpdk-next-eventdev > diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index > 1992107a03..bd10342ca2 100644 > --- a/doc/api/doxy-api-index.md > +++ b/doc/api/doxy-api-index.md > @@ -21,6 +21,7 @@ The public API headers are grouped by topics: > [compressdev] (@ref rte_compressdev.h), > [compress] (@ref rte_comp.h), > [regexdev] (@ref rte_regexdev.h), > + [gpudev] (@ref rte_gpudev.h), > [eventdev] (@ref rte_eventdev.h), > [event_eth_rx_adapter] (@ref rte_event_eth_rx_adapter.h), > [event_eth_tx_adapter] (@ref rte_event_eth_tx_adapter.h), > diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index > 325a0195c6..831b9a6b33 100644 > --- a/doc/api/doxy-api.conf.in > +++ b/doc/api/doxy-api.conf.in > @@ -40,6 +40,7 @@ INPUT =3D @TOPDIR@/doc/api/doxy-api- > index.md \ > @TOPDIR@/lib/eventdev \ > @TOPDIR@/lib/fib \ > @TOPDIR@/lib/flow_classify \ > + @TOPDIR@/lib/gpudev \ > @TOPDIR@/lib/graph \ > @TOPDIR@/lib/gro \ > @TOPDIR@/lib/gso \ diff --git a/doc/guides/con= f.py > b/doc/guides/conf.py index 67d2dd62c7..7930da9ceb 100644 > --- a/doc/guides/conf.py > +++ b/doc/guides/conf.py > @@ -152,6 +152,9 @@ def generate_overview_table(output_filename, > table_id, section, table_name, titl > name =3D ini_filename[:-4] > name =3D name.replace('_vf', 'vf') > pmd_names.append(name) > + if not pmd_names: > + # Add an empty column if table is empty (required by RST syntax) > + pmd_names.append(' ') >=20 > # Pad the table header names. > max_header_len =3D len(max(pmd_names, key=3Dlen)) @@ -388,6 +391,11 > @@ def setup(app): > 'Features', > 'Features availability in bbdev drivers', > 'Feature') > + table_file =3D dirname(__file__) + '/gpus/overview_feature_table.txt= ' > + generate_overview_table(table_file, 1, > + 'Features', > + 'Features availability in GPU drivers', > + 'Feature') >=20 > if LooseVersion(sphinx_version) < LooseVersion('1.3.1'): > print('Upgrade sphinx to version >=3D 1.3.1 for ' > diff --git a/doc/guides/gpus/features/default.ini > b/doc/guides/gpus/features/default.ini > new file mode 100644 > index 0000000000..c363447b0d > --- /dev/null > +++ b/doc/guides/gpus/features/default.ini > @@ -0,0 +1,13 @@ > +; > +; Features of a GPU driver. > +; > +; This file defines the features that are valid for inclusion in ; the > +other driver files and also the order that they appear in ; the > +features table in the documentation. The feature description ; string > +should not exceed feature_str_len defined in conf.py. > +; > +[Features] > +Get device info =3D > +Share CPU memory with GPU =3D > +Allocate GPU memory =3D > +Free memory =3D > diff --git a/doc/guides/gpus/index.rst b/doc/guides/gpus/index.rst new fi= le > mode 100644 index 0000000000..f9c62aeb36 > --- /dev/null > +++ b/doc/guides/gpus/index.rst > @@ -0,0 +1,11 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright 2021 NVIDIA Corporation & Affiliates > + > +GPU Drivers > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +.. toctree:: > + :maxdepth: 2 > + :numbered: > + > + overview > diff --git a/doc/guides/gpus/overview.rst b/doc/guides/gpus/overview.rst > new file mode 100644 index 0000000000..e7f985e98b > --- /dev/null > +++ b/doc/guides/gpus/overview.rst > @@ -0,0 +1,7 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright 2021 NVIDIA Corporation & Affiliates > + > +Overview of GPU Drivers > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +.. include:: overview_feature_table.txt > diff --git a/doc/guides/index.rst b/doc/guides/index.rst index > 857f0363d3..ee4d79a4eb 100644 > --- a/doc/guides/index.rst > +++ b/doc/guides/index.rst > @@ -21,6 +21,7 @@ DPDK documentation > compressdevs/index > vdpadevs/index > regexdevs/index > + gpus/index > eventdevs/index > rawdevs/index > mempool/index > diff --git a/doc/guides/prog_guide/gpu.rst b/doc/guides/prog_guide/gpu.rs= t > new file mode 100644 index 0000000000..54f9fa8300 > --- /dev/null > +++ b/doc/guides/prog_guide/gpu.rst > @@ -0,0 +1,5 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright 2021 NVIDIA Corporation & Affiliates > + > +GPU Library > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > diff --git a/doc/guides/prog_guide/index.rst > b/doc/guides/prog_guide/index.rst index 2dce507f46..dfddf90b51 100644 > --- a/doc/guides/prog_guide/index.rst > +++ b/doc/guides/prog_guide/index.rst > @@ -27,6 +27,7 @@ Programmer's Guide > cryptodev_lib > compressdev > regexdev > + gpu > rte_security > rawdev > link_bonding_poll_mode_drv_lib > diff --git a/drivers/gpu/meson.build b/drivers/gpu/meson.build new file m= ode > 100644 index 0000000000..5189950616 > --- /dev/null > +++ b/drivers/gpu/meson.build > @@ -0,0 +1,4 @@ > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2021 NVIDIA > +Corporation & Affiliates > + > +drivers =3D [] > diff --git a/drivers/meson.build b/drivers/meson.build index > bc6f4f567f..f607040d79 100644 > --- a/drivers/meson.build > +++ b/drivers/meson.build > @@ -18,6 +18,7 @@ subdirs =3D [ > 'vdpa', # depends on common, bus and mempool. > 'event', # depends on common, bus, mempool and net. > 'baseband', # depends on common and bus. > + 'gpu', # depends on common and bus. > ] >=20 > if meson.is_cross_build() > diff --git a/lib/gpudev/gpu_driver.h b/lib/gpudev/gpu_driver.h new file m= ode > 100644 index 0000000000..5ff609e49d > --- /dev/null > +++ b/lib/gpudev/gpu_driver.h > @@ -0,0 +1,44 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 NVIDIA Corporation & Affiliates */ > + > +#ifndef GPU_DRIVER_H > +#define GPU_DRIVER_H > + > +#include > + > +#include > + > +#include "rte_gpudev.h" > + > +struct rte_gpu_dev; > + > +typedef int (*gpu_malloc_t)(struct rte_gpu_dev *dev, size_t size, void > +**ptr); typedef int (*gpu_free_t)(struct rte_gpu_dev *dev, void *ptr); > + > +struct rte_gpu_dev { > + /* Backing device. */ > + struct rte_device *device; > + /* GPU info structure. */ > + struct rte_gpu_info info; > + /* Counter of processes using the device. */ > + uint16_t process_cnt; > + /* If device is currently used or not. */ > + enum rte_gpu_state state; > + /* FUNCTION: Allocate memory on the GPU. */ > + gpu_malloc_t gpu_malloc; > + /* FUNCTION: Allocate memory on the CPU visible from the GPU. */ > + gpu_malloc_t gpu_malloc_visible; > + /* FUNCTION: Free allocated memory on the GPU. */ > + gpu_free_t gpu_free; > + /* Device interrupt handle. */ > + struct rte_intr_handle *intr_handle; > + /* Driver-specific private data. */ > + void *dev_private; > +} __rte_cache_aligned; > + > +struct rte_gpu_dev *rte_gpu_dev_allocate(const char *name); struct > +rte_gpu_dev *rte_gpu_dev_get_by_name(const char *name); int > +rte_gpu_dev_release(struct rte_gpu_dev *gpudev); > + > +#endif /* GPU_DRIVER_H */ > diff --git a/lib/gpudev/meson.build b/lib/gpudev/meson.build new file mod= e > 100644 index 0000000000..f05459e18d > --- /dev/null > +++ b/lib/gpudev/meson.build > @@ -0,0 +1,9 @@ > +# SPDX-License-Identifier: BSD-3-Clause # Copyright 2021 NVIDIA > +Corporation & Affiliates > + > +headers =3D files( > + 'rte_gpudev.h', > +) > + > +sources =3D files( > +) > diff --git a/lib/gpudev/rte_gpudev.h b/lib/gpudev/rte_gpudev.h new file m= ode > 100644 index 0000000000..b12f35c17e > --- /dev/null > +++ b/lib/gpudev/rte_gpudev.h > @@ -0,0 +1,183 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2021 NVIDIA Corporation & Affiliates */ > + > +#ifndef RTE_GPUDEV_H > +#define RTE_GPUDEV_H > + > +#include > +#include > + > +#include > + > +/** > + * @file > + * Generic library to interact with a GPU. > + * > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + */ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/** Maximum number of GPU engines. */ > +#define RTE_GPU_MAX_DEVS UINT16_C(32) > +/** Maximum length of device name. */ > +#define RTE_GPU_NAME_MAX_LEN 128 > + > +/** Flags indicate current state of GPU device. */ enum rte_gpu_state { > + RTE_GPU_STATE_UNUSED, /**< not initialized */ > + RTE_GPU_STATE_INITIALIZED, /**< initialized */ > +}; > + > +/** Store a list of info for a given GPU. */ struct rte_gpu_info { > + /** GPU device ID. */ > + uint16_t gpu_id; > + /** Unique identifier name. */ > + char name[RTE_GPU_NAME_MAX_LEN]; > + /** Total memory available on device. */ > + size_t total_memory; > + /** Total processors available on device. */ > + int processor_count; > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Returns the number of GPUs detected and associated to DPDK. > + * > + * @return > + * The number of available GPUs. > + */ > +__rte_experimental > +uint16_t rte_gpu_dev_count_avail(void); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Check if the device is valid and initialized in DPDK. > + * > + * @param gpu_id > + * The input GPU ID. > + * > + * @return > + * - True if gpu_id is a valid and initialized GPU. > + * - False otherwise. > + */ > +__rte_experimental > +bool rte_gpu_dev_is_valid(uint16_t gpu_id); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Get the GPU ID of the next valid GPU initialized in DPDK. > + * > + * @param gpu_id > + * The initial GPU ID to start the research. > + * > + * @return > + * Next GPU ID corresponding to a valid and initialized GPU device. > + */ > +__rte_experimental > +uint16_t rte_gpu_dev_find_next(uint16_t gpu_id); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Macro to iterate over all valid GPUs. > + * > + * @param gpu_id > + * The ID of the next possible valid GPU. > + * @return > + * Next valid GPU ID, RTE_GPU_MAX_DEVS if there is none. > + */ > +#define RTE_GPU_FOREACH_DEV(gpu_id) \ > + for (gpu_id =3D rte_gpu_find_next(0); \ > + gpu_id < RTE_GPU_MAX_DEVS; \ > + gpu_id =3D rte_gpu_find_next(gpu_id + 1)) > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Return GPU specific info. > + * > + * @param gpu_id > + * GPU ID to get info. > + * @param info > + * Memory structure to fill with the info. > + * > + * @return > + * 0 on success, -1 otherwise. > + */ > +__rte_experimental > +int rte_gpu_dev_info_get(uint16_t gpu_id, struct rte_gpu_info **info); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Allocate a chunk of memory on the GPU. > + * > + * @param gpu_id > + * GPU ID to allocate memory. > + * @param size > + * Number of bytes to allocate. > + * @param ptr > + * Pointer to store the address of the allocated memory. > + * > + * @return > + * 0 on success, -1 otherwise. > + */ > +__rte_experimental > +int rte_gpu_malloc(uint16_t gpu_id, size_t size, void **ptr); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Allocate a chunk of memory on the CPU that is visible from the GPU. > + * > + * @param gpu_id > + * Reference GPU ID. > + * @param size > + * Number of bytes to allocate. > + * @param ptr > + * Pointer to store the address of the allocated memory. > + * > + * @return > + * 0 on success, -1 otherwise. > + */ > +__rte_experimental > +int rte_gpu_malloc_visible(uint16_t gpu_id, size_t size, void **ptr); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Deallocate a chunk of memory allocated with rte_gpu_malloc*. > + * > + * @param gpu_id > + * Reference GPU ID. > + * @param ptr > + * Pointer to the memory area to be deallocated. > + * > + * @return > + * 0 on success, -1 otherwise. > + */ > +__rte_experimental > +int rte_gpu_free(uint16_t gpu_id, void *ptr); > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* RTE_GPUDEV_H */ > diff --git a/lib/gpudev/version.map b/lib/gpudev/version.map new file mod= e > 100644 index 0000000000..9e0f218e8b > --- /dev/null > +++ b/lib/gpudev/version.map > @@ -0,0 +1,11 @@ > +EXPERIMENTAL { > + global: > + > + rte_gpu_dev_count_avail; > + rte_gpu_dev_find_next; > + rte_gpu_dev_info_get; > + rte_gpu_dev_is_valid; > + rte_gpu_free; > + rte_gpu_malloc; > + rte_gpu_malloc_visible; > +}; > diff --git a/lib/meson.build b/lib/meson.build index 4a64756a68..ffefc64c= 69 > 100644 > --- a/lib/meson.build > +++ b/lib/meson.build > @@ -33,6 +33,7 @@ libraries =3D [ > 'distributor', > 'efd', > 'eventdev', > + 'gpudev', > 'gro', > 'gso', > 'ip_frag', > -- > 2.31.1