From nobody Thu Dec 26 13:22:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 150542418807195.14698743106828; Thu, 14 Sep 2017 14:23:08 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6C48421E7493C; Thu, 14 Sep 2017 14:20:04 -0700 (PDT) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0054.outbound.protection.outlook.com [104.47.38.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6B6F521DFC89E for ; Thu, 14 Sep 2017 14:20:00 -0700 (PDT) Received: from ubuntu-010236106000.amd.com (165.204.78.1) by DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Thu, 14 Sep 2017 21:22:58 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=YdO4qOI85txjxBPgLKIsvMOVkR/pLg52TlLUFGIHTTA=; b=aUGW5NK4r635D7ZOCsaZ3ZhOx2wTgADZuQMS2JlrfG/JjnJoxt1AMRghymSe4l8Z5MVxYK/8e0G63NKJBQJkFUQ4zkuO9xX9Og0vXUSXPfm2YMyE5jtuS2olJsfpxM3IeltE9SgYdzZGt2/R92xgM8PWI9ChDogQWMhBjhj/o+U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Thu, 14 Sep 2017 16:22:43 -0500 Message-Id: <20170914212247.124937-5-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170914212247.124937-1-brijesh.singh@amd.com> References: <20170914212247.124937-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM5PR20CA0014.namprd20.prod.outlook.com (2603:10b6:3:93::24) To DM2PR12MB0155.namprd12.prod.outlook.com (2a01:111:e400:50ce::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34540af0-90c7-4790-74d9-08d4fbb6c5b5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM2PR12MB0155; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 3:nlUbzEpI/pUlfFMB+1J3QpM8Whmf6a8QISEjNFu/Ohnhjemt5U0C7lNxTFkWajbnVwT5+FYBAiQQXEabZR2sYfnht7U/qJ0U3ga4Pl/N2NgkxjmVnYLY36Wlz+RYKftBgzHMufCmN3eEsDNHr94aRYbFLbgzqNYz4jKmQqxnmv3gyyAr0grhmRJ5Y3jsOBs5PuBT6LcNK5ywB/2xueAKMM0a6/iX42kjlgm37/vhS0Uq5lt9sSpRkQfOlQ5Vg7iM; 25:u/Rs+ou8EfmNH1mrIc6tiGgDoqThfaBNDr82wwRM5pa7mkg4mK00lD60+cNe0GJV7v+hH6YBps27Epy0qORPT9hQqHDTkPEJiUDPQwdfDBQssvbwRdX6uEhxulLjywedUCuLtLEDHSCW3JKu7KOxVNU8HkzJyhvk9di5roQAZ22K+91/oFq3yP/tmIe8Kv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ZpWRDaz9gtdbQAD0QCiOaVC+NX8fBPFdi+TxrcI18J1RKn5D6zwZ85vA22IdZnYuzOlk70WbjIIwjY6yU28DaOGGfZXwpTIUBD6nkPYj60EIgjcGQ47IVGqtg5dZ3CoXW1mTcB8+KJmCpe/9vi/rfKEdnNMh4GBHaZ6U39X7uFi4OC+7UaJJ9r/QP0UwOUcliByaV+77FP4XUCY8XCEmsCnGj3D6ZG4GYhkH4eMxGqUe+qaNamcxhv44g== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0155; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0155; X-Forefront-PRVS: 0430FA5CB7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(51234002)(199003)(189002)(53936002)(4326008)(110136004)(50466002)(47776003)(50226002)(81156014)(81166006)(68736007)(54906002)(8676002)(2361001)(66066001)(2950100002)(6916009)(33646002)(2351001)(36756003)(106356001)(105586002)(53416004)(101416001)(48376002)(8936002)(25786009)(6486002)(97736004)(305945005)(7736002)(5660300001)(16526017)(16586007)(2906002)(5003940100001)(1076002)(6116002)(3846002)(316002)(50986999)(6666003)(76176999)(86362001)(478600001)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0155; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0155; 23:RzTg1rR5lyp2kDdDF5zTbJ6+FDldwnmenM9ZTpyzO?= =?us-ascii?Q?jmlZJN+c/mST91lxOSKc+see67Q3CDCnhqI42tvGdd17gOsgPBTZHh3X7zwA?= =?us-ascii?Q?AqXSweWlLXeHZ6d26uVRXi2VCZUXtHXV6aZtzYQdMwEw0x9gep6XTusNRsom?= =?us-ascii?Q?SRK61obtjoQMbmiun0DiGoVw5v2763PZ6W5CZ4eQgK9ysEMcseDafyjXz3vL?= =?us-ascii?Q?/uOAmrR8X0WLWmu9WedMyT9xw6OdaxqkRCz/YoGlaC/a9evDySolPiWEMmsn?= =?us-ascii?Q?ic78MM6BUiZuoVjLv2gnHve0U40J+0XzABILYKg6TCj7vvR5+SFKid48FmjC?= =?us-ascii?Q?Hg96zbwmRju0+R+XLLNLIa/pkUytLTNkxJh0bbfMdRF422gBY9VBiYbvpwg/?= =?us-ascii?Q?UUSfqzcNsQu4LwZHYrLICMyQZ6bWGDsbs7bnaU6pg94cnHUHpVKunaI8cY+q?= =?us-ascii?Q?Vk/XKRIECszRqudXogAIx26Fk5XODGbYTWAKHJmnJQ4UhnK83NSsNdYRJ6/c?= =?us-ascii?Q?48yAxOeDUO4PGw48r8WWKiBGLdoutzGn6m7yQYFpLeMG7GHOdYumOv5/S926?= =?us-ascii?Q?RsnzvT0Lq4w14qDwcTiwe9X8ZenERmVvJf2wowUIKyXOywyc6jsGgAyoKMnZ?= =?us-ascii?Q?ldeLifJRmPksR5lff+hdmw8IIHf5qItxK/QPOr5f7KjPumBDLDpSfuZ3Cr36?= =?us-ascii?Q?GQN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nPa5OYFbarjx9X8vBeFnvUOK4edmwugRVaUZxu56T/3YR2QFCDDuHlgv1qXLJmAKWu0arAn2/UTfLBmz3a+pEjUeAaJa9LO2yukKYsjO+gE=; 24:VZSwW27HTi/nljUPz72dEMG2LdoXIC2xohQ8gZvd34l4HHe3iycuXZ2Iq0VmNldxMskr0HiQN7bKfnXpBBFAMxojOTt/MQp49OM4t/ywkc8=; 7:A6j8bR+TPaJW1gEdh+4HRSHRb3OVIHr5MKoTtAitSXJAjDF+QR7ydlNtFHnMXs2pNgqnc4MgRma6AwyeBKpj0bXuMfJFQCVMfecCBtb9VaNpsRtT4duCMIBpc8gwhztr8hiqhfqVGbfTZuvPFfD7J6wFoz+bbrwisFR9R3pisJrWlEfw0kCAotPMAbA/q8TA+YAsP1u45FjTIkE+pHeRB7QBz8vC7qu8YpAYAGiaNwU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:5uG7Nw9nvGo6eMet0UyzXxh9LcdLLBBy7DEgLehXXjFF9pSCC0cu8cgLbJWE6oGfmOzQlCpNuOXJVKyXHTkidzq3i68WZCaUpSMT0op0ZTDU1mmo1AP2c3/TiGY5dK78zBumNIj7h7CLOqdIB0mc+MWbzrU07Ry3S0ayaYNcZ+hUsOh4+CfDho/v6MZDgieHXatu5fHG+8hYUYMPlC7HjSNybyeYVf0NpqnpDy+mSPzkdhVQM8VdMmVtvR0atb2z X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 21:22:58.3518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0155 Subject: [edk2] [PATCH v4 4/8] OvmfPkg/VirtioNetDxe: dynamically alloc transmit header X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Brijesh Singh , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Each network packet is submitted for transmission by pushing the head descriptor of a two-part descriptor chain to the Available Ring of the TX queue. VirtioNetInitTx() sets up the the descriptor chains for all queueable packets in advance, and points all the head descriptors to the same shared, never modified, VIRTIO_1_0_NET_REQ header object (or its initial VIRTIO_NET_REQ sub-object, dependent on virtio version). VirtioNetInitTx() currently uses the header object's system physical address for populating the head descriptors. When device is behind the IOMMU, VirtioNet driver is required to provide the device address of VIRTIO_1_0_NET_REQ header. In this patch we dynamically allocate the header using AllocateSharedPages() and map with BusMasterCommonBuffer so that header can be accessed by both processor and the device. We map the header object for CommonBuffer operation because, in order to stick with the current code order, we populate the head descriptors with the header's device address first, and fill in the header itself second. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 3 +- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 64 +++++++++++++++++--- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 7 +++ 3 files changed, 65 insertions(+), 9 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index 995593f4b236..027f75993e8e 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -97,7 +97,8 @@ typedef struct { UINT16 TxMaxPending; // VirtioNetInitTx UINT16 TxCurPending; // VirtioNetInitTx UINT16 *TxFreeStack; // VirtioNetInitTx - VIRTIO_1_0_NET_REQ TxSharedReq; // VirtioNetInitTx + VIRTIO_1_0_NET_REQ *TxSharedReq; // VirtioNetInitTx + VOID *TxSharedReqMap; // VirtioNetInitTx UINT16 TxLastUsed; // VirtioNetInitTx } VNET_DEV; =20 diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index b739875d4c01..9621f936d2cb 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -18,6 +18,7 @@ **/ =20 #include +#include #include #include =20 @@ -147,6 +148,9 @@ ReleaseQueue: =20 @retval EFI_OUT_OF_RESOURCES Failed to allocate the stack to track the = heads of free descriptor chains. + @return Status codes from VIRTIO_DEVICE_PROTOCOL. + AllocateSharedPages() or + VirtioMapAllBytesInSharedBuffer() @retval EFI_SUCCESS TX setup successful. */ =20 @@ -157,8 +161,11 @@ VirtioNetInitTx ( IN OUT VNET_DEV *Dev ) { - UINTN TxSharedReqSize; - UINTN PktIdx; + UINTN TxSharedReqSize; + UINTN PktIdx; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS DeviceAddress; + VOID *TxSharedReqBuffer; =20 Dev->TxMaxPending =3D (UINT16) MIN (Dev->TxRing.QueueSize / 2, VNET_MAX_PENDING); @@ -170,12 +177,42 @@ VirtioNetInitTx ( } =20 // + // Allocate TxSharedReq header and map with BusMasterCommonBuffer so tha= t it + // can be accessed equally by both processor and device. + // + Status =3D Dev->VirtIo->AllocateSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *Dev->TxSharedReq), + &TxSharedReqBuffer + ); + if (EFI_ERROR (Status)) { + goto FreeTxFreeStack; + } + + ZeroMem (TxSharedReqBuffer, sizeof *Dev->TxSharedReq); + + Status =3D VirtioMapAllBytesInSharedBuffer ( + Dev->VirtIo, + VirtioOperationBusMasterCommonBuffer, + TxSharedReqBuffer, + sizeof *(Dev->TxSharedReq), + &DeviceAddress, + &Dev->TxSharedReqMap + ); + if (EFI_ERROR (Status)) { + goto FreeTxSharedReqBuffer; + } + + Dev->TxSharedReq =3D TxSharedReqBuffer; + + + // // In VirtIo 1.0, the NumBuffers field is mandatory. In 0.9.5, it depend= s on // VIRTIO_NET_F_MRG_RXBUF, which we never negotiate. // TxSharedReqSize =3D (Dev->VirtIo->Revision < VIRTIO_SPEC_REVISION (1, 0,= 0)) ? - sizeof Dev->TxSharedReq.V0_9_5 : - sizeof Dev->TxSharedReq; + sizeof (Dev->TxSharedReq->V0_9_5) : + sizeof *Dev->TxSharedReq; =20 for (PktIdx =3D 0; PktIdx < Dev->TxMaxPending; ++PktIdx) { UINT16 DescIdx; @@ -187,7 +224,7 @@ VirtioNetInitTx ( // For each possibly pending packet, lay out the descriptor for the co= mmon // (unmodified by the host) virtio-net request header. // - Dev->TxRing.Desc[DescIdx].Addr =3D (UINTN) &Dev->TxSharedReq; + Dev->TxRing.Desc[DescIdx].Addr =3D DeviceAddress; Dev->TxRing.Desc[DescIdx].Len =3D (UINT32) TxSharedReqSize; Dev->TxRing.Desc[DescIdx].Flags =3D VRING_DESC_F_NEXT; Dev->TxRing.Desc[DescIdx].Next =3D (UINT16) (DescIdx + 1); @@ -202,13 +239,13 @@ VirtioNetInitTx ( // // virtio-0.9.5, Appendix C, Packet Transmission // - Dev->TxSharedReq.V0_9_5.Flags =3D 0; - Dev->TxSharedReq.V0_9_5.GsoType =3D VIRTIO_NET_HDR_GSO_NONE; + Dev->TxSharedReq->V0_9_5.Flags =3D 0; + Dev->TxSharedReq->V0_9_5.GsoType =3D VIRTIO_NET_HDR_GSO_NONE; =20 // // For VirtIo 1.0 only -- the field exists, but it is unused // - Dev->TxSharedReq.NumBuffers =3D 0; + Dev->TxSharedReq->NumBuffers =3D 0; =20 // // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device @@ -223,6 +260,17 @@ VirtioNetInitTx ( *Dev->TxRing.Avail.Flags =3D (UINT16) VRING_AVAIL_F_NO_INTERRUPT; =20 return EFI_SUCCESS; + +FreeTxSharedReqBuffer: + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *(Dev->TxSharedReq)), + TxSharedReqBuffer + ); +FreeTxFreeStack: + FreePool (Dev->TxFreeStack); + + return Status; } =20 =20 diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe= /SnpSharedHelpers.c index ee4f9ed36ecd..2fce8142d554 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -54,6 +54,13 @@ VirtioNetShutdownTx ( IN OUT VNET_DEV *Dev ) { + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->TxSharedReqMap); + Dev->VirtIo->FreeSharedPages ( + Dev->VirtIo, + EFI_SIZE_TO_PAGES (sizeof *(Dev->TxSharedReq)), + Dev->TxSharedReq + ); + FreePool (Dev->TxFreeStack); } =20 --=20 2.9.5 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel