From nobody Thu Dec 26 12:50:33 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 1505132237638293.51326935048576; Mon, 11 Sep 2017 05:17:17 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F303121CEB0F2; Mon, 11 Sep 2017 05:14:16 -0700 (PDT) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0073.outbound.protection.outlook.com [104.47.38.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D8C8C20958BEA for ; Mon, 11 Sep 2017 05:14:15 -0700 (PDT) Received: from ubuntu-010236106000.amd.com (165.204.78.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Mon, 11 Sep 2017 12:17:09 +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=gxRU5ilyH3afpym9iFEOlCHuxLNmQZ3iHspEUwKc7DY=; b=byTaDmC8ByDL2u8dB6h6skaSnjdFKAtDHQ+bklNPSYukBWApXzatJtnyKl5/DPcjarXhToFEb4YR6ETqv6UsKvYphlgleAq7dhj+MTQu7z1jPFUTvrHQ1WX1KmqC8e5nyw8RgfWrAJgA1NOsvENtZVm/8HUAZJuq3rSYjgpvxwY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Mon, 11 Sep 2017 07:16:51 -0500 Message-Id: <20170911121657.34992-3-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170911121657.34992-1-brijesh.singh@amd.com> References: <20170911121657.34992-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: DM3PR12CA0047.namprd12.prod.outlook.com (10.161.151.15) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b31f1b7-b0da-4388-93d5-08d4f90f0690 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:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:D3S8BcG/e4POuxhaiM7FzCJOfWrPhheNOYc3SHQ5OI2IyqjX5G2T8F+VyjORZqdJcWlx/knrAR4dOAY46oK9exTX3MTAMQJhUM+ZsFpCO6gtzP73pOluJDleuC0rTqPG2eZCIMj7e+X2zJB433uIroXwioRA8EXa0VQQJNE5lfA+eChwZgITD0fokeTHOUFg8sQtXg1YG9vkQWJAkeywAIY9puy8WVanTqfOBy86258CNNhKrgWgxUEpmRxis1NC; 25:ZkbxygpfE72HTL1Udv0ECE6E8z+9cYQ0AQWZjZ3ekkzC0x7CqoEP7cXrYPbJMuhV7+Z3jGC5s2soLfb6XG/ldTTc2Lf2+r2yKDZTKZc++CYOrgVTLef8vJ9WpV6bJJ/87nCaaCbIUxY083ste9vXHzx4AddhroczozR1Umr63UfGCc9/4JEwx5tQddU+ppAUw2Wq+m0ePrPgNVQm51U9rhIyfgVyjqoue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M2weN5kcKa55vCAJozziHL/JrvEZ0L1FdToACnJ1KQ4UdSdsiT1NqI1ERTt4I1kYmu7z3dtzu1eiCfetVMx2E807At1nBB55BC+FM1b1MC8dVtxNogN67zTY0DVjC4J4SdqmvZxOJbJQcVniFdO3cQM1nI+7PtDwFwycK5oeo5naZqSgMz/T1tnGV2/AfihIwIsUvJd+9kLzHTlRuum7l9sJ9VjOkp0DQ= X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699)(17755550239193); 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)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123560025)(20161123564025)(20161123558100)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 04270EF89C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(51234002)(189002)(199003)(110136004)(106356001)(7736002)(105586002)(101416001)(4326008)(53416004)(1076002)(2361001)(2906002)(305945005)(2351001)(5660300001)(189998001)(25786009)(33646002)(50986999)(76176999)(3846002)(6116002)(68736007)(8676002)(478600001)(81156014)(81166006)(42186005)(50466002)(54906002)(6666003)(50226002)(97736004)(48376002)(36756003)(6916009)(2950100002)(8936002)(66066001)(47776003)(86362001)(5003940100001)(6486002)(575784001)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:ubuntu-010236106000.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; SN1PR12MB0158; 23:GJoGkYMSYUrE3JAxtRU1BQLJ/HuIanQf1Sxsz/csQ?= =?us-ascii?Q?l1q8OM0ajU23UXtC/bRjc692NELiw45pA70s1U+p8hrSjWF9uBkjfFT7ec7c?= =?us-ascii?Q?EfVW2sawITVacpUbyUbMGYaj+js9xD1cp2XaBjZzRfmiYrXKbAgR7vR/Fw5d?= =?us-ascii?Q?OeOURTnvOuVA6iCFgKrKJ3t8w1k4Z0kEYTR9LZWXiUrNqF+4SptRn+i6Ojvq?= =?us-ascii?Q?apwEmDWeM2ihfYmBM1C2p/gG/0LGECkL9zZuCvLSY1hD4cZ4D+h6qQ2OZg6A?= =?us-ascii?Q?e11VG7F1FoaqcgwhBFMR13i5Ktz1txH9bAOWsImLEsa7qp75Z9BC8cPHF32r?= =?us-ascii?Q?jDGEkL2QiMbK2GQFNUjAmh6f4TzMd7ILkDN4gnaPeDID+kFNjysy/DKki+wg?= =?us-ascii?Q?HqZQXTyckHSF9dUQeMM96SuQCHkz/qWf3IHj6EjQrG1BPvjjRY0uSQDilRYX?= =?us-ascii?Q?EiwmYE8Vphb8KYcgSUJFDp3/i+JGegbrOZgUuo+/vzExrdSurxmCbstD0DCw?= =?us-ascii?Q?TFSsGQx7UidwFx2isTYeUqYoPLTdRz6ok/qud+CP7/6iKccOawcEbRyXXaex?= =?us-ascii?Q?PgMve6n9dQUjSiCTCHmVXhFAxwqZVBU+OjTb4W6c6OfRsqAA5bDbv4AIsykf?= =?us-ascii?Q?+ahzyPP5oqRw3cGG9+gOvPEpEM03p5i2Fz/+f7WyhDGrQ3pJhGDOy7A53BiF?= =?us-ascii?Q?mvFQM51GsR5wJzNrBcuAtmTup8o8tfV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rttfxPu/75UrN+z/wFtNcLhUS8ggVckgYa6DJLE5FfNpwAaK5nl3lvg1QwSzB0EqemmVZojMQExl68T8MJqvvOtfnHX6HJ3v0=; 7:uXmhe3GmI1ckRPfKBisPYE3RTPFDRmAZIP0+s1z+PLrYJYm1DqL7x49Q2VVc3eeAr1SSd6twTEs37jTyDn9k/SxvYWoaJ4jLeDQL/w5xwittyHXL02ufeghUxj0kbF6yTN0yTG3LmFNt5JU90o/UTbhP6FoxyJt8ca6RSzaUIvx2sFj2AaZMEzHZnE9qo/gCJj940YLkBrSVcpTO0vb3EhByUYmHflR0OCsa/rYK9S8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:MD/tFYATvKaZiBvgxgeB4UNk+fAX/k9lPBEOVkVIosacBZqHHZz/3eAZxyh6ofC140VJQ3qTrJma13xHTdeOhgFbxTOiik/GJ6n8JCMpuEDV097lG92f69YwSQSaHXHojSNs+YQcPynCgDuF8wbwvxFjCn9zId5dRCN3ujAE2hpyL2kUeBkfo+ZlRg4Ypdvng9QbaVIAqPHDDKuU0B3F5JrIZ476xzrnS2iQFBOj2iT+Z+4juEuk1fHvMIO6SLUa X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 12:17:09.2296 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Subject: [edk2] [PATCH v2 2/8] OvmfPkg/VirtioNetDxe: map VRINGs using VirtioRingMap() 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" When device is behind the IOMMU then driver need to pass the device address when programing the bus master. The patch uses VirtioRingMap() to map the VRING system physical address[es] to device address[es]. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 7 ++- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 50 +++++++++++++++----- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 10 ++-- OvmfPkg/VirtioNetDxe/SnpShutdown.c | 4 +- OvmfPkg/VirtioNetDxe/TechNotes.txt | 1 + 5 files changed, 55 insertions(+), 17 deletions(-) diff --git a/OvmfPkg/VirtioNetDxe/VirtioNet.h b/OvmfPkg/VirtioNetDxe/Virtio= Net.h index 87a0f06e01a4..6762fc9d1d6e 100644 --- a/OvmfPkg/VirtioNetDxe/VirtioNet.h +++ b/OvmfPkg/VirtioNetDxe/VirtioNet.h @@ -82,10 +82,14 @@ typedef struct { EFI_HANDLE MacHandle; // VirtioNetDriverBinding= Start =20 VRING RxRing; // VirtioNetInitRing + VOID *RxRingMap; // VirtioRingMap and + // VirtioNetInitRing UINT8 *RxBuf; // VirtioNetInitRx UINT16 RxLastUsed; // VirtioNetInitRx =20 VRING TxRing; // VirtioNetInitRing + VOID *TxRingMap; // VirtioRingMap and + // VirtioNetInitRing UINT16 TxMaxPending; // VirtioNetInitTx UINT16 TxCurPending; // VirtioNetInitTx UINT16 *TxFreeStack; // VirtioNetInitTx @@ -267,7 +271,8 @@ VOID EFIAPI VirtioNetUninitRing ( IN OUT VNET_DEV *Dev, - IN OUT VRING *Ring + IN OUT VRING *Ring, + IN VOID *RingMap ); =20 // diff --git a/OvmfPkg/VirtioNetDxe/SnpInitialize.c b/OvmfPkg/VirtioNetDxe/Sn= pInitialize.c index 637c978709fd..8eabdbff6f5e 100644 --- a/OvmfPkg/VirtioNetDxe/SnpInitialize.c +++ b/OvmfPkg/VirtioNetDxe/SnpInitialize.c @@ -35,11 +35,13 @@ the network device. @param[out] Ring The virtio-ring inside the VNET_DEV structure, corresponding to Selector. + @param[out] Mapping A resulting token to pass to VirtioNetUninitRin= g() =20 @retval EFI_UNSUPPORTED The queue size reported by the virtio-net devic= e is too small. @return Status codes from VIRTIO_CFG_WRITE(), - VIRTIO_CFG_READ() and VirtioRingInit(). + VIRTIO_CFG_READ(), VirtioRingInit() and + VirtioRingMap(). @retval EFI_SUCCESS Ring initialized. */ =20 @@ -49,11 +51,14 @@ EFIAPI VirtioNetInitRing ( IN OUT VNET_DEV *Dev, IN UINT16 Selector, - OUT VRING *Ring + OUT VRING *Ring, + OUT VOID **Mapping ) { EFI_STATUS Status; UINT16 QueueSize; + UINT64 RingBaseShift; + VOID *MapInfo; =20 // // step 4b -- allocate selected queue @@ -80,29 +85,42 @@ VirtioNetInitRing ( } =20 // + // If anything fails from here on, we must release the ring resources. + // + Status =3D VirtioRingMap (Dev->VirtIo, Ring, &RingBaseShift, &MapInfo); + if (EFI_ERROR (Status)) { + goto ReleaseQueue; + } + + // // Additional steps for MMIO: align the queue appropriately, and set the - // size. If anything fails from here on, we must release the ring resour= ces. + // size. If anything fails from here on, we must unmap the ring resource= s. // Status =3D Dev->VirtIo->SetQueueNum (Dev->VirtIo, QueueSize); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 Status =3D Dev->VirtIo->SetQueueAlign (Dev->VirtIo, EFI_PAGE_SIZE); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 // // step 4c -- report GPFN (guest-physical frame number) of queue // - Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring, 0); + Status =3D Dev->VirtIo->SetQueueAddress (Dev->VirtIo, Ring, RingBaseShif= t); if (EFI_ERROR (Status)) { - goto ReleaseQueue; + goto UnmapQueue; } =20 + *Mapping =3D MapInfo; + return EFI_SUCCESS; =20 +UnmapQueue: + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, MapInfo); + ReleaseQueue: VirtioRingUninit (Dev->VirtIo, Ring); =20 @@ -456,12 +474,22 @@ VirtioNetInitialize ( // // step 4b, 4c -- allocate and report virtqueues // - Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_RX, &Dev->RxRing); + Status =3D VirtioNetInitRing ( + Dev, + VIRTIO_NET_Q_RX, + &Dev->RxRing, + &Dev->RxRingMap + ); if (EFI_ERROR (Status)) { goto DeviceFailed; } =20 - Status =3D VirtioNetInitRing (Dev, VIRTIO_NET_Q_TX, &Dev->TxRing); + Status =3D VirtioNetInitRing ( + Dev, + VIRTIO_NET_Q_TX, + &Dev->TxRing, + &Dev->TxRingMap + ); if (EFI_ERROR (Status)) { goto ReleaseRxRing; } @@ -510,10 +538,10 @@ AbortDevice: Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); =20 ReleaseTxRing: - VirtioNetUninitRing (Dev, &Dev->TxRing); + VirtioNetUninitRing (Dev, &Dev->TxRing, Dev->TxRingMap); =20 ReleaseRxRing: - VirtioNetUninitRing (Dev, &Dev->RxRing); + VirtioNetUninitRing (Dev, &Dev->RxRing, Dev->RxRingMap); =20 DeviceFailed: // diff --git a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c b/OvmfPkg/VirtioNetDxe= /SnpSharedHelpers.c index 5b75eabc7a6b..57c7395848bd 100644 --- a/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c +++ b/OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c @@ -55,15 +55,19 @@ VirtioNetShutdownTx ( /** Release TX and RX VRING resources. =20 - @param[in,out] Dev The VNET_DEV driver instance which was using the ri= ng. - @param[in,out] Ring The virtio ring to clean up. + @param[in,out] Dev The VNET_DEV driver instance which was using + the ring. + @param[in,out] Ring The virtio ring to clean up. + @param[in] RingMap A token return from the VirtioRingMap() */ VOID EFIAPI VirtioNetUninitRing ( IN OUT VNET_DEV *Dev, - IN OUT VRING *Ring + IN OUT VRING *Ring, + IN VOID *RingMap ) { + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, RingMap); VirtioRingUninit (Dev->VirtIo, Ring); } diff --git a/OvmfPkg/VirtioNetDxe/SnpShutdown.c b/OvmfPkg/VirtioNetDxe/SnpS= hutdown.c index 432e0691d457..d8c11f20de61 100644 --- a/OvmfPkg/VirtioNetDxe/SnpShutdown.c +++ b/OvmfPkg/VirtioNetDxe/SnpShutdown.c @@ -67,8 +67,8 @@ VirtioNetShutdown ( Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); VirtioNetShutdownRx (Dev); VirtioNetShutdownTx (Dev); - VirtioNetUninitRing (Dev, &Dev->TxRing); - VirtioNetUninitRing (Dev, &Dev->RxRing); + VirtioNetUninitRing (Dev, &Dev->TxRing, Dev->TxRingMap); + VirtioNetUninitRing (Dev, &Dev->RxRing, Dev->RxRingMap); =20 Dev->Snm.State =3D EfiSimpleNetworkStarted; Status =3D EFI_SUCCESS; diff --git a/OvmfPkg/VirtioNetDxe/TechNotes.txt b/OvmfPkg/VirtioNetDxe/Tech= Notes.txt index 86b91f561495..0891e8210489 100644 --- a/OvmfPkg/VirtioNetDxe/TechNotes.txt +++ b/OvmfPkg/VirtioNetDxe/TechNotes.txt @@ -72,6 +72,7 @@ faithfully indented) that implement the transition. VirtioRingInit | | VirtioNetShutdownTx [SnpSharedHelper= s.c] VirtioNetInitTx | | VirtioNetUninitRing [SnpSharedHelper= s.c] VirtioNetInitRx | | {Tx, Rx} + | | VirtIo->UnmapSharedBuffer | | VirtioRingUninit v | +-----------------------------+ --=20 2.9.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel