From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1993C20958BD8 for ; Fri, 8 Sep 2017 01:50:15 -0700 (PDT) Received: by mail-io0-x22d.google.com with SMTP id j141so4337828ioj.4 for ; Fri, 08 Sep 2017 01:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xulZh9ZuXibb52Ac+J0GsNE53/ji8PGsVAsQWnHmCzk=; b=KMkrjOKhl9Xoo9M4Oazhu469bISNZaZquwhFtN/4gIJgpT4kYiWVTlTQNiUyXGq7LP e9wsXiCyXKOxefeAiohCtrWRoZadifhog/AE3/V9xL4MdwRDfRFa8NJah2fz7zSl+2Gr AsHl8UIOhggv9scmJBXjYM6f2GKHuNatZZMbQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xulZh9ZuXibb52Ac+J0GsNE53/ji8PGsVAsQWnHmCzk=; b=QcCEyXkmYp1ngWSwHlV7fj8zEDITCoUeF8LO5Ctdpr0fjgndvT28I1UbOT//s7hjUS ErAvAh9e/R9Tj4uwe1OfaZIRHe7Dmva7QJPJXKpfdaLliEMMbAnb0fsp/CoCQ5o8k65S 1RecRj27QrSfqiCUSFthBxX5gSOd7SWwvJTQ+xqU9NNLdpiqUmucAZV05MtVhmUUjlI6 Tu7DfejRowr57G2dBk9mwMm26HEeBU+YD4FVMxwtl+dgB3afodn5SDu/2xb3iIFhJH1J MARJ9z6nUSujGoW9pCgAggJB6A2H96KNpmj6nj7XXq+kwgSEQxLuf6dcCi77SacxU3VR crpg== X-Gm-Message-State: AHPjjUhh82dhmzH/BkulQLJMvxCu4R/owNiOc8FFryuRJWgdK9SqBCtS LObibxFgJK1gwsTBDXEyYkLVakxmeE8L X-Google-Smtp-Source: AOwi7QCEfTD4IOPdxBHmaWBtsx9BjUrhcBUY8gNxo3kkY5zUvOQuaP4BNBPUkVKco7ejDfpmIMDeQ/AAh0VfYYWdyKY= X-Received: by 10.107.142.200 with SMTP id q191mr2186824iod.149.1504860786594; Fri, 08 Sep 2017 01:53:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.162.1 with HTTP; Fri, 8 Sep 2017 01:53:06 -0700 (PDT) In-Reply-To: <20170907224116.895-1-lersek@redhat.com> References: <20170907224116.895-1-lersek@redhat.com> From: Ard Biesheuvel Date: Fri, 8 Sep 2017 09:53:06 +0100 Message-ID: To: Laszlo Ersek , Leif Lindholm , "afish@apple.com" , "Kinney, Michael D" Cc: edk2-devel-01 , Brijesh Singh , Eric Dong , Jiewen Yao , Jordan Justen , Star Zeng 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 08:50:15 -0000 Content-Type: text/plain; charset="UTF-8" (cc'ing the trinity) On 7 September 2017 at 23:41, 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. > The patches look fine to me Reviewed-by: Ard Biesheuvel Given that we are now depending on events signalled in an event handler to be queued after all currently pending events, I think we need to explicitly agree that this behavior that needs to be preserved, and documented somewhere, given that the UEFI spec does not offer this guarantee.