From nobody Thu Dec 26 14:24:40 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 1505387327629656.1048231372223; Thu, 14 Sep 2017 04:08:47 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A5B5C21E3EA77; Thu, 14 Sep 2017 04:05:42 -0700 (PDT) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0070.outbound.protection.outlook.com [104.47.41.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E5D420945C16 for ; Thu, 14 Sep 2017 04:05:39 -0700 (PDT) Received: from ubuntu-010236106000.amd.com (165.204.78.1) by DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) 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 11:08:36 +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=Jimm7+PxEqjmN3bbzmeNes/tt4gmp0eVPUb2Bxy6vP0=; b=r05ICwOURJdRbni8SejRCnU7qU9BAeuFNI9GTS4f35FMrVZiAwbHqOF45oTz0zIk8vFsX8GTonEN7BOgaxtqBpQThI/G1fXe7KeGjYu/rC3KSFQD/USvsunJpLTF63iPMZRKigrvDjCrWePXS+gX7CKvgdhaQI7sEXqUrZtL4GU= 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 06:08:16 -0500 Message-Id: <20170914110822.112540-3-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170914110822.112540-1-brijesh.singh@amd.com> References: <20170914110822.112540-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR08CA0083.namprd08.prod.outlook.com (2603:10b6:404:b6::21) To DM2PR12MB0156.namprd12.prod.outlook.com (2a01:111:e400:50ce::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf165e08-077b-48a1-4168-08d4fb60f278 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:DM2PR12MB0156; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 3:OXGjTiq+N7KnF02dUkNmhJ5JQk6D+OYttZ510IJ92GxM55CVMaB20rshheK4sfPaIi0MALG15I3gbecwMGhUiF93sQVwBxudbHJ3pZ5pO7reDI61FSYhZJ8gnNecXXNsjpRK4wirJ3wOA8acEKXfH4qCFJZ0H7MYypbd91UdnfbhDdtuAcPjuiZEM38pmYFJ4yUnsebOd+MLPWu5nj5QV6AuhjRC3ST1Piu6U4tHZGm0dkFVcyvcte5KZa2h8oQr; 25:+VnKMe/7n7lEcdQxyQqnpSj/djK/HkU4sIKYJxoxHW+PQwFT65PmJjgjjY6xXEuPpJ139ZHspFcXBeJYTA5wCHgvpcMMaeeb8aOKONAQUAtFR1t1sHGaL9bLM0nvOnyYrivPntHGvvEk5SxOFHXhA4w/pAgUMY+rEGaVrfKfpfzpGdn3P3vsNGgPINp08k4HEeX9DXdsLs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FTBt4YZgXFp2CdUg6WynhUwzC1fbE7hXrHolzsprZIt44WAEpQI3KnqI3yiCyE8falAPQG6YSqL+2bujHjfKF9BAs4tnzY1gVqLpIoyY8mjA1fEEFBEB7UMM69yDhAtRygFRWNjWyU9z6IHIqYXZ2pckMJe3mXXNnKsPXjXmqNEhFkpgdpr1dNiP+kdnJKr7A0gXssCEWvHX004v0Gt1GuH5pe1LO6nJXKaj4AWZEqV6wLkJcMwmmA/8VUV5xsbEWrECll5kWiIlLE= 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)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0156; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0156; X-Forefront-PRVS: 0430FA5CB7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(189002)(199003)(51234002)(189998001)(50986999)(76176999)(105586002)(106356001)(33646002)(2361001)(2351001)(5660300001)(6666003)(6916009)(2950100002)(6116002)(25786009)(36756003)(1076002)(101416001)(68736007)(3846002)(53416004)(16586007)(6486002)(478600001)(97736004)(50226002)(110136004)(81156014)(47776003)(48376002)(16526017)(81166006)(54906002)(8676002)(8936002)(7736002)(316002)(305945005)(2906002)(4326008)(53936002)(86362001)(5003940100001)(50466002)(66066001)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0156; 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; DM2PR12MB0156; 23:DlPhVYUk71Cu+wmLb2HoozENvVZMnFMK0aYDcl2hS?= =?us-ascii?Q?QfKYNPHm7wCexLP/C1I4Zb37ahZKamBjN+DN3SKtEFRJHSkI2U4K8usAlP66?= =?us-ascii?Q?7zPc91gGWS0qwMCG7Q68eSbtOWH8mku5f5nf4ObHA/4k4OZ+FwEapXM3oKWD?= =?us-ascii?Q?bR5mbEnCy8FegQ9UUerlHJwI2h5/jjhRXptLg2vqJp8v/z6qyYnnM9uCp0X3?= =?us-ascii?Q?KB3WnjBdF7cQA06aiRRsfCJv0/dl7GorRF8TcEQq6K56A308JzxbGvxi9vUA?= =?us-ascii?Q?gJv2ojtHp2aYbqZuXoHW+0JeIQrgZDFaFMuVTkGb2AKwSkq6udi6b2WWUI7b?= =?us-ascii?Q?XX25sxm9iQSJF9E9expWKcxco8EeJh4qraiAEu8PGCapjiaVIN0zABmCUIn2?= =?us-ascii?Q?T67fCwfsm/JONuQODGYULdSbRP7nBaqHQdnL3uCX6cWwxt0zbAwACKJvbKia?= =?us-ascii?Q?gaA0lCWuBkzkHZ6pQszo7avM9WK/n68SIB8KOHKfWqqPnfSq7o6SU3hg8UbU?= =?us-ascii?Q?pk6tscO7kH37elPuNYxDd3sUkdz55Y7BU3ShzYXXhYtEZcZsDgiGMPUjYjah?= =?us-ascii?Q?CkS3agY0bFp/gGDPyx1qZKIzdwuJgvXlgIvbW8lsC2P2CBnZYZxnPrxAJ3/Y?= =?us-ascii?Q?YBYVeamTTwLPhDUk6fIlVPBBG7lf2diAE6F2iA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4TmImvPk1FU3o0oqeFgHH0tA==; 5:XoRyx6PQqZsILsrzUYXpQSgCYbpMVUQdmi8+4DRwCwqX+cYR8BHTVBDNpCpyKOwfIog42D7kygQg7V8tJAHHoH9eHa52nKNoPiKhnqjLkptxHhaBqRNo20jl+gqdZTj+WBdPBhx8ZgJzk8C2I5YJzQ==; 24:VdkQD5e8P4uEvDP9rg7dcM5ZmnrErGDlL5QbvoamMCiaGibSOi9R6duT3CT/Zp9OHiSq0hS5oaB4bBJcHkU+XWeozEB2M5rxei8gsziPs6Q=; 7:wmM4bnciHi2s2ki47YsnMGpl+eq/z9iBH9LBI0YCpXL1VvxtbS8sdF5efxawJE7AR2+cjNTIpxlDsbQIJbQ4E50+ulNvmR9lEMf1PkuODphWjmpyrqifhfjeaYYUTo+tZJG8nRvwSq6fJJmoHsJo+dwJQtFZZYAYQJyuK2ut9thb8enno6AUFY5jCN4Lr6BNX8P+Avvg8+AfztukiCrTtn+ecbGqjmMJBG8VyT13qjA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0156; 20:5lWNQTB4cR7h4zRISfVGGW6R8F30pAlMsV2IcTd+yITTadaxk65bXkDzT5sJOzHr4bHK3jCG9U53DuTnlZ76q6xZMd6jBSpR6ER0A89vW1We4gl7pdLXPqMPdHtQk5RLd/NTXcNC4JEa85ksIO31Lkr6jgZCXuL4dckCFAYkHmzPuaa/5WCLSTIEhO+hM9YymaNIkoVbrJ35FX8xBoECAGZ04zJI38qsAw5y+R7PRkorhGiet0eCrmBweDPK4Sg6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 11:08:36.3232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0156 Subject: [edk2] [PATCH v3 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 Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioNetDxe/VirtioNet.h | 7 ++- OvmfPkg/VirtioNetDxe/SnpInitialize.c | 50 +++++++++++++++----- OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c | 10 ++-- OvmfPkg/VirtioNetDxe/SnpShutdown.c | 4 +- OvmfPkg/VirtioNetDxe/TechNotes.txt | 5 +- 5 files changed, 57 insertions(+), 19 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..37250b14a98c 100644 --- a/OvmfPkg/VirtioNetDxe/TechNotes.txt +++ b/OvmfPkg/VirtioNetDxe/TechNotes.txt @@ -70,8 +70,9 @@ faithfully indented) that implement the transition. VirtioNetInitialize | | VirtioNetShutdown VirtioNetInitRing {Rx, Tx} | | VirtioNetShutdownRx [SnpSharedHelper= s.c] VirtioRingInit | | VirtioNetShutdownTx [SnpSharedHelper= s.c] - VirtioNetInitTx | | VirtioNetUninitRing [SnpSharedHelper= s.c] - VirtioNetInitRx | | {Tx, Rx} + VirtioRingMap | | VirtioNetUninitRing [SnpSharedHelper= s.c] + VirtioNetInitTx | | {Tx, Rx} + VirtioNetInitRx | | VirtIo->UnmapSharedBuffer | | VirtioRingUninit v | +-----------------------------+ --=20 2.9.5 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel