From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5421420945C1E for ; Fri, 8 Sep 2017 08:57:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A8D7C057FA6; Fri, 8 Sep 2017 16:00:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0A8D7C057FA6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-10.rdu2.redhat.com [10.10.120.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03BDE60605; Fri, 8 Sep 2017 16:00:07 +0000 (UTC) To: Brijesh Singh , edk2-devel-01 Cc: Ard Biesheuvel , Eric Dong , Jiewen Yao , Jordan Justen , Star Zeng References: <20170907224116.895-1-lersek@redhat.com> From: Laszlo Ersek Message-ID: Date: Fri, 8 Sep 2017 18:00:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 08 Sep 2017 16:00:10 +0000 (UTC) Subject: Re: [PATCH 00/10] MdeModulePkg, OvmfPkg: unmap DMA buffers at ExitBootServices 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: , X-List-Received-Date: Fri, 08 Sep 2017 15:57:18 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 09/08/17 17:50, Brijesh Singh wrote: > Patch 4 - 10 > > Reviewed-by: Brijesh Singh > Tested-by: Brijesh Singh > > Thank you Laszlo! I will work to finish virtio-net next week. Awesome! Thanks! Laszlo > On 09/07/2017 05:41 PM, Laszlo Ersek wrote: >> Repo:   https://github.com/lersek/edk2.git >> Branch: iommu_exit_boot >> >> This series is the result of the discussion under >> >>    [edk2] [PATCH 0/4] MdeModulePkg: some PCI HC drivers: unmap common >>                       buffers at ExitBootServices() >>    https://lists.01.org/pipermail/edk2-devel/2017-September/014099.html >> >> At ExitBootServices(), PCI and VirtIo drivers should only care about >> aborting pending DMA on the devices. Cleaning up PciIo mappings (which >> ultimately boil down to IOMMU mappings) for those aborted DMA operations >> should be the job of the IOMMU driver. >> >> Patches 01 through 03 clean up the AtaAtapiPassThru driver in >> MdeModulePkg a little bit, because at present, (a) it unmaps the buffers >> and disables BMDMA in the wrong order in its DriverBindingStop() >> function, (b) it doesn't abort pending DMA at ExitBootServices(). >> >> This subset can be treated separately from the rest of the series, but I >> thought they belonged loosely together (given that AtaAtapiPassThru is >> used on QEMU's Q35 machine type). >> >> Patches 04 through 07 remove VIRTIO_DEVICE_PROTOCOL.UnmapSharedBuffer() >> calls from the VirtIo drivers' ExitBootServices() handlers. >> >> (The conversion of VirtioNetDxe to device addresses is still in progress >> -- Brijesh, when you submit v2 of that, under this approach, there is no >> need to change VirtioNetExitBoot() relative to current upstream, and you >> can use VirtioOperationBusMasterRead to map outgoing packets.) >> >> Patches 08 through 10 make OvmfPkg/IoMmuDxe track all mappings, and >> unmap all mappings (Read, Write, CommonBuffer) that are in effect when >> ExitBootServices() is called. It is ensured that PCI and VirtIo drivers >> abort pending DMA first, and IoMmuDxe clean up the mappings last. >> >> Cc: Ard Biesheuvel >> Cc: Brijesh Singh >> Cc: Eric Dong >> Cc: Jiewen Yao >> Cc: Jordan Justen >> Cc: Star Zeng >> >> Thanks >> Laszlo >> >> Laszlo Ersek (10): >>    MdeModulePkg/AtaAtapiPassThru: cache EnabledPciAttributes >>    MdeModulePkg/AtaAtapiPassThru: unmap DMA buffers after disabling BM >>      DMA >>    MdeModulePkg/AtaAtapiPassThru: disable the device at >>      ExitBootServices() >>    OvmfPkg/VirtioBlkDxe: don't unmap VRING at ExitBootServices() >>    OvmfPkg/VirtioGpuDxe: don't unmap VRING & BackingStore at >>      ExitBootServices >>    OvmfPkg/VirtioRngDxe: don't unmap VRING at ExitBootServices() >>    OvmfPkg/VirtioScsiDxe: don't unmap VRING at ExitBootServices() >>    OvmfPkg/IoMmuDxe: track all mappings >>    OvmfPkg/IoMmuDxe: generalize IoMmuUnmap() to IoMmuUnmapWorker() >>    OvmfPkg/IoMmuDxe: unmap all IOMMU mappings at ExitBootServices() >> >>   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 103 +++++--- >>   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h |   7 + >>   OvmfPkg/IoMmuDxe/AmdSevIoMmu.c                           | 246 >> +++++++++++++++++--- >>   OvmfPkg/VirtioBlkDxe/VirtioBlk.c                         |   7 +- >>   OvmfPkg/VirtioGpuDxe/Commands.c                          |  23 +- >>   OvmfPkg/VirtioRngDxe/VirtioRng.c                         |   7 +- >>   OvmfPkg/VirtioScsiDxe/VirtioScsi.c                       |   7 +- >>   7 files changed, 299 insertions(+), 101 deletions(-) >>