From nobody Thu Dec 26 13:58:22 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 150542418540962.82646184565067; Thu, 14 Sep 2017 14:23:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2471C21E74910; Thu, 14 Sep 2017 14:20:03 -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 1B6E320945C0B 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:56 +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=HjgMiD/Lj0K9XJ8xH2QsEmRQ0l/tNDQgAWUfPsjgxFA=; b=M7rhJQzqjujFtPtt0ZS2ARV/kDjGO3wJHrgrPjIq93TLOar8DnDOVUaHchUzmeiB1Z6frRnwamOvIhRUJo4UFadE0Vv4wlUrfDc0KUvy3X1KErRQ7k72jS3qqkbVfLvtckEX2rp37+LH/1YMXQ3E73/9JleSIbHBPaTk0w0pK1s= 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:41 -0500 Message-Id: <20170914212247.124937-3-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: 158b658e-d7d8-46d9-e249-08d4fbb6c4de 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:yiLahKGEBp8jqK7wgiGNet3KVk4r1BMIIYYSuHebkTWaJi/EFxvzOHxcDaYmmjxWUVdrDzW+8gwf0CqqzQsASPcpTs1TdKb9b4hZ1B0Poeuh+k05kofgmMUH0rIT2Mnu33fLvFkmLXj9RwOQLfbXM9b32AINjNAiMz40HxPbJVceU919AwjAEpoblKam2elUFWzHpqOdEE5Hcc+vquVG6rNk135bb8SjV6v7xA8x8ySn/mIdL5KKaVYYwgyMukQ6; 25:NUmipIqUpd1v1KPQriC9NWGM/haotpHCD/WaFAMpBwGGW5Xtq2ee6GE4gUo95e1g2DvcEevskKh4ju8+eAIEqz4P/p+da9234nc4ikBm0t8He3M7L5MHrFmHysKIxrNtzL+zU7gzVVjYoEGPrD6YZQb/LGpitnYHeGmsYKwxifid4bLsMGty20FB+7kXOrL5rubqlj2NdKc8L2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b5+RZrg0qsJW/6DmvHGoi+jI9DlLXvUXnFbPPyU7i7ADijNhY9JDdC62U+1UrCS01b05TsBLkVb5MSS8mRMi6ol0XUS+XmVEDtkhJybhrdZXRPeWoMrqARq+afjsRwWOendVTdV82WRPxS8Zi3cCp1Rt00QXFIMV2Ozu2+gH+c9e6OljLbfz802r+8KAw0bBqyVhhOT65ceUu4u50thG8tPNhP43IyUe0nIQqeVm9I0mu4MfdXqgg5qXNDFIqOs5CND5A= 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)(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)(575784001)(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:ii3CLeBS8TAtLJKkVkXbVprhZPq5uhge/Fb0qRizS?= =?us-ascii?Q?/DVsW8LPcQTG0uPpRc1tOm36nGOpVUBpS+YvwiU5GvnXc1CWbiCQb44hti3S?= =?us-ascii?Q?3o4XKvxR+hv1Oue2POqB3FiHLL/OmFiTWfDTjGVFEPunLHZf157ns831tItL?= =?us-ascii?Q?BzGoGt6QHaTsdbsUtDXwoh7ugJ0yuoWnwrIJ0pTDNSp6ZeWRLf0/L8YPvPd1?= =?us-ascii?Q?Ov/uJbfgTeGGCM+SWACYAGnSpHZD15D8jAkzFDH6uVeF1ra9J+DC2QbMXv0N?= =?us-ascii?Q?rh1ef/ER4Jr6rFYJVNRFZeNVmswSj54YVqJb+iWsFOJElH17MJlqCxhMc0kv?= =?us-ascii?Q?KW41SokQCbOPKIQ8nZi5bl+rUtVh3i0Hqpk6IRtyDz59L83pdM0QpCUyT7LM?= =?us-ascii?Q?aKGt1grwFPKEeAI46xhxHjt9isr//thTc4Uaznb7jdtRgd9C9pMk8OBwX6Ag?= =?us-ascii?Q?7UMzJ+KV3aNw0VjBOT+v0Wb+i06nURi9H4gqXpS3PIyPrKB03US297DWdPE9?= =?us-ascii?Q?QESzh7V+MBwroLzoY6ctrNQcVXVXwiD5n793JdveH5pn3sXTULmgJXJeZYj8?= =?us-ascii?Q?7td9DQFR8Q7tr6xEa38cEvq91DvTMMcgV6E6uRc85K1ma5TEwaCUeFGVsAn6?= =?us-ascii?Q?BSjUjSdvnRELGWtFxIZNMZ3Sw7P6xX9vlgkIVVpA4niE+0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W7hEdkJR7nA==; 5:LqUWietGkNrAk3IpT3Yo3dcIcJIlQux0kAcIGdg9mKy+phcxUT/Mr5sbeUaQaL6KGFVhXI8VSHIcBKMd13oGVq3L46DwnIJHgyDbr/tvhddVoaolYizZFFDksH78SJ9Bz6LCAchRjmlrS+EAZjXrJozTnYntasexSjFcyeCQq4E=; 24:+8evl35Xh9tt29756PqShFJGLHgqWXXuT4bskJn7d7QQA6FiYimfH2EzXOFFjY77LFEY9CqeOMTbrnnrxvaQVwEejRewgA2/TqAbhXOSCzM=; 7:voi4Wpt2Yh4gwSVuWHQyD22SLuWoAvwji+5W0dIoez9c1J2nmN4QH+4bmxklZ3ZmjeRCCJmO7PG4TytoRNqhJMQChW58BAl0tPNP/0SimTkXwvcmZJor6TXczCprb79nOfiLGmD8CuhdfTxK5x4PcLQiUCKG0nrdDu5ysIIqydY49HPeEGJcB/zcRXpM1/w6AIOCqp661L830Y08lIfpZoblttjCMMvcTre6u5thqF4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0155; 20:T/4JWVnUvRACy+bzTixUKR41XdPpqKWVeuIUumRBNxyfuBwcf6ojOfTBh7nTvbI6FqqKXW71uL/gW24QrBujBqsTFKDXZ6XQWSd2/UOJW2q8FdRQzifxtB8dAhLjQQ6PfT47nJgnbxp6sSq38i7GfOMncM57byTEuoQdbo4K+D7S3+cNpC6HWA/N8OXelYdh67rL7Tan+Wv8J3O+tUdQn3qP6Q2B2tvpW9dD7z8vRzmr44r1jgh/yzSMDvK+yQqq X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2017 21:22:56.9612 (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 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