From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0065.outbound.protection.outlook.com [104.47.40.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 437D120945C12 for ; Fri, 8 Sep 2017 08:47:45 -0700 (PDT) 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=YawzCDzU78DB369zv/ZqMx6/bVaJvVokxa0pun3znIA=; b=SpxAv52Eondi4MD2iaj4AHJrThP6P7AFedyjZxLU8eF53u7kWyNCBP27ll5FgPYbyGA/HWq8j+oUohiiq1RhhZgN0Zobt0BtOMrmWfJibanlRHOqq4TTja3k89Kf0Qi8/ZLk4uae1Xg/AuGHZQaOU9iVOthC80zs/BS7xn/9M0U= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from [10.236.136.62] (165.204.77.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; Fri, 8 Sep 2017 15:50:34 +0000 Cc: brijesh.singh@amd.com, Ard Biesheuvel , Eric Dong , Jiewen Yao , Jordan Justen , Star Zeng To: Laszlo Ersek , edk2-devel-01 References: <20170907224116.895-1-lersek@redhat.com> From: Brijesh Singh Message-ID: Date: Fri, 8 Sep 2017 10:50:30 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170907224116.895-1-lersek@redhat.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CO2PR07CA0070.namprd07.prod.outlook.com (10.174.192.38) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0b68420-0cf8-4ec6-d2c5-08d4f6d15841 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:ybkhNXrX8YEtDHbqZtXCnhNWpBxC3W+7fWQnXx6OusJDmOVR10c3l3sqYzW3ETMd8Gg8sZYyaRNX2O0mAbTvaDj+uzyuYQAnHcN+FLHEdwdsYpjs6UovKKTGEFSTYk9ty1zC5DGuVG1oXjXggTfeI3nHrIQ5uvMmI0Zq5vFhQCLDa3OuN104so07KRZbPVG9LKrNPUKiw98TvlLHbkUKwmb8x+QCInDX38c5Xd0Uf4y5srto0br8mAYmlHfjl/RK; 25:e6APCO0HKT7Z38gctmGaT9XoT4KZDaXN+0QQSWWuHw4fZZ0T4wAEZCBaPWNtmfp3objMuY42x9HUW+IS/VkSPAtQR9t0PzHdtQrC5fO2Sdnp2IBPKmIbm0P7iZzLTE7SVgWqOyc+WhQV66jNv57IyjxffdAlJFThUNcgtAoWhXg4dXZxunbD3KMo0hkX+Ad0yg0Y3FcS3AkwCBeFRgPbZCTtKwEMOBkUeBJmnl7Z+c4GPl71vwQc2a2gmmy+7WBbCXFKf6yssDcHr/cTCrHLomWLhsX2UK08K54Xe92KNyf487Yz6JK1a4iqQwK4S6784lZXBwr+cH+u/7rSB0M/OA==; 31:D173aOTIyjAU0Ggn1Yi/G4YfpMiwMYJiMWIfgjKkX/g2/iZeybXsd3oKrXL/K+56B96eSsR7/CFsOItQspvkbjbUMLtouNxzCeAbVju5xJ4WCs+oyu7jdCIX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9ZQXRKdv8Des5n2vEX2Cv9K7cw== X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(767451399110)(162533806227266)(228905959029699); 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)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(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: 04244E0DC5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6049001)(39860400002)(377454003)(189002)(199003)(24454002)(47776003)(86362001)(8936002)(8676002)(31696002)(966005)(6666003)(83506001)(65956001)(6246003)(65806001)(68736007)(66066001)(7736002)(36756003)(305945005)(53546010)(25786009)(50466002)(81166006)(81156014)(4001350100001)(478600001)(97736004)(101416001)(106356001)(230700001)(3846002)(54906002)(50986999)(2950100002)(33646002)(23676002)(6486002)(6306002)(90366009)(64126003)(6116002)(54356999)(5660300001)(65826007)(31686004)(189998001)(53936002)(229853002)(105586002)(42186005)(4326008)(2906002)(77096006)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:[10.236.136.62]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTU4OzIzOnc4MVlpbjR4ajk3SGxzOUV5SlplekdOYk9t?= =?utf-8?B?Z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ncaDZp/QHRZiSGU+vNzakPetyVzDChaU6UW1b4S0Tjq0gJUcP03x7qhFqZi7wa8+p4zKIqnko0I4MIHu1dIj0tzRzXoK9Oyeo6ip7TqxR6sB9CJBEd+R2BtyKuOwfnbbI58kryQOJR7vF+eRfKl8UDflpdnV8CBelrt+Srwvtbfp9NmqboJkqus5vYW1DM0n4NhUmXpaswosAVM7QPvGd3mDcWz5yyygS4M X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2017 15:50:34.5076 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 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:47:45 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Patch 4 - 10 Reviewed-by: Brijesh Singh Tested-by: Brijesh Singh Thank you Laszlo! I will work to finish virtio-net next week. -Brijesh 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(-) >