From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0087.outbound.protection.outlook.com [104.47.36.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4D32921E49BCA for ; Mon, 21 Aug 2017 18:40:32 -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=oozM0TlpphAePyW5GweEPHTKFis5PrHnT/SmkaG34eA=; b=nzQj4VEbw8CzrlU1gvjimySVo28TTeyo00f6p3p0ycu4K//KjZn1Nb4s71PDiNWbd6LNZFtJMkwjGN72VydeL6UYn+CPxx+C/9G6GcISKoYR2Aca4ccGi8L2Lp7VazdDuqXGG5PVWnPED2o/ivrJHjV3b6U+dhqP8kAuvMrrd7E= Received: from wsp093862wss.amd.com (165.204.77.1) by SN1PR12MB0160.namprd12.prod.outlook.com (10.162.3.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18; Tue, 22 Aug 2017 01:42:59 +0000 Cc: brijesh.singh@amd.com, Jordan Justen , Tom Lendacky , Ard Biesheuvel To: Laszlo Ersek , edk2-devel@lists.01.org References: <1502710605-8058-1-git-send-email-brijesh.singh@amd.com> <1502710605-8058-18-git-send-email-brijesh.singh@amd.com> <8392c590-62db-fea9-5cca-aa0e76183c20@redhat.com> From: Brijesh Singh Message-ID: Date: Mon, 21 Aug 2017 20:42:55 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <8392c590-62db-fea9-5cca-aa0e76183c20@redhat.com> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR1101CA0008.namprd11.prod.outlook.com (10.174.246.18) To SN1PR12MB0160.namprd12.prod.outlook.com (10.162.3.147) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21e2d8b7-c872-42df-d174-08d4e8ff1f51 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)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR12MB0160; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0160; 3:cCucUWLSdrF9zh+AMDnY3Nzqf3B9wAvpTQJ1RDdU0XyWfmpEdUbFv6yiXZIisCZh/aNbXcvqJ6CYhvMtZxhIbZEBc0KikSiInoKkivmewKheA0E/BliVAdS9S7QX8nYbp1WPdjdW+ezglqJNFjC5KfdNyarpybdoalhP9vuOjoMIjTQ6IpyfSBzMFq/n2kUNIv/f71snpSO/Uh8IxcIks9cV/LDJ2lOWQzDscEvoCSYvsl1tpwWE187Gz0Hk5z+V; 25:LbfK3NXDzlVvwkCs1Abvc45oc1ygzYnFjx1KsnORiI32mckEPKN9sVs0J6g+dgg+UqQXE5BEIrp9TxcWU8SbUstWQqyduvuqvmx1JWqvrvVLpKaPq/tlmlOWZKpQ5ldaErWUcS/4yf6uV6yP8e0fr3QCSREOQ8vWDBfF58ryHr1l0G46fn8V0GjxgKMhJ92bFpud/7CzKfjy2qiS+c3M47NgBr/E25Do4YX/sSpgiag/61mkfaYf2tyWrQChKS7cgNsQ++lYPambAL9oypJztckqk7My3iSyGRJi3GfXKqJQGYJ70Fk467khQUqb5vTmrFnHCwuJJ9a0YisPmchCeA==; 31:xpqaOGextNXf8NeWGtnhVYzs0GyLN6OIdxEejs7W8MJTsafw4xYq7MZrj0UqrR4MAXJZ/rZx+Jv1o3oRtMW9WvqNDiHAX0TUaP3X4IFkgdx70o/m0xPJ2TisxjgrFfmU1xSCnWjI8GLEbtVVYJypYneJAymfeDZGU2JbTfPuAYXadwxQeywskUhzxvFkOLeiYw8I2KKwAxYgTRs/HyJfI2SiQw++8wpUGGa98s15zec= X-MS-TrafficTypeDiagnostic: SN1PR12MB0160: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0160; 20:zPqVfgyhaGansqcGEEb5MyikAErcft1aB/9v38BuBxgmGe8Ty6yLMOH53AbrhNW8hc8WRepeP0ZgLxjLiVuYJ9SA+r6smZ84eN9iIgioVU9AWcl08hQhl+lcxIgVSditqH9S8zDGQNEeUQY26HoIrgRJfWNPPxkSgYKDxkU+kxsCFjtBBNCB1DrjW75Mz8dCvGRLQ/Z2n01vgoalgGLwZKkrlQVRnGsW0n1BEw3t7sY244Fg7m4YEoYs3PM45Mb/sowlXAtnMzAC76hG7KrDDeRVWNvh0kX3mBDgW00/sT+fSVDYukGrU1SfNMEVVEAYYt1kG/Lqa5euWMJtO+T8gDmASTHcv/L+Cip1l+98pz69jw3FxhzZ6XGO0/HQhtUNXtld/x8Wkaz1BQPYKTvUu2XyZzveJaMZVa/QqUZrDYKRH8RhCPzmB4Gt2vp19WN1qj5KLut3EE6L3bs1a0xaB2yLW2l3/fDqy5562uplq69sGrkWLCviQw5/f0NMVhBX; 4:iDF6lhfAqrLtQ91Tkgwb3iCA7rZEMfMHV08uLf4ABfAMN28FgjYR1Zmn4LWzX/wIPG1IpMfqNvkrYgbbWK6dGZW7Dwn/EkparhQ/uslV7p93PIojKILZqCP2cPVUmRfzWpdEIExviUhd5Z6wvE8ALvIj+htOmKEenMc5B5QwMOrsuBvvj875iLYASqL6Pcco52sbeY7Hp0lZDFAvr9ArDtgktwB7h4vzLNCrqxXrBk40TuY2eqSyfSyatlXmgzdL8njuVLA8GAGFClMorAUNffyazuyAoR3fXVDg+WFLbeU= X-Exchange-Antispam-Report-Test: UriScan:(166708455590820); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123555025)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0160; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0160; X-Forefront-PRVS: 04073E895A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39860400002)(24454002)(377454003)(199003)(189002)(23676002)(64126003)(54356999)(33646002)(65806001)(42186005)(47776003)(53416004)(4001350100001)(76176999)(66066001)(65956001)(110136004)(6246003)(25786009)(7736002)(31686004)(68736007)(81156014)(81166006)(6486002)(53936002)(8676002)(36756003)(50986999)(50466002)(105586002)(478600001)(305945005)(86362001)(7350300001)(5660300001)(966005)(230700001)(54906002)(83506001)(106356001)(3846002)(6116002)(4326008)(6306002)(189998001)(97736004)(2950100002)(31696002)(101416001)(229853002)(6666003)(2906002)(53546010)(65826007); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0160; H:wsp093862wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTYwOzIzOko2dXNzVGd1WUFhQVR0VkxsUnF4alVMSTVn?= =?utf-8?B?WnpsVS9iLzhod2NhNVE3TkdUZ1lqYklJelJhNGJ2U0x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VVSGJ6ZDEwRWxIN2dmRDJ2QnNDb05POGRIL2RnSnVmSGRCN0Jr?= =?utf-8?B?YUxhbWVxQ3FnPT0=?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0160; 6:DyYQTtglP/hS0OZWAJmqsVLqgfcb9Sj91KeFb60P1IQXwtCD4hxd/LjD5j88DSitEmlvCzJgLIIWOmTuYn3X7GruHFmVoo7CeX18TWh4OqZ0eNHFLapOup/dRfspe/yS16RfDN5+DQVn/EOkWTuwGwTMUj7azVmZspPx8jH+RI3Xzqb+PCoG0JBPDcxyYIoWqCMuD7xqxmv9kkBk86OXU2Szp2vmkLpRJ6w4VusLYqx42VMrVYCMM8CJnmT0ms0/u9oV1WhUy1rwt6mtaCaGMP9NYnnhVHngfF3SR15OiiIhSI2NxTOnwj+E82+dXFnrUeZz5/WL+rgKlA/ZqFKRDA==; 5:tcWogM0aEv5xzuFjeDrNeUDKOd4kYGvpRUXOl+3U7FteRo6J+hx87w5cshGus2jAqNklG/yMkS5z8ba5BbSgQPZ2VPAEuIeqW1RBEgPAPIErJqbye7hmS1bvWG+tzGBx4P/U65CNrFxr0euD3g8CiQ==; 24:D9aacD2URfDQ7q/uYbQp/YfUtrTNq1ZGB938jotQUUGCiZ4QN/PEnwGl0DakxCwdRR2XSzqPNmcbPRvhLpo+XDNmKqktrmAKTjEzVjkx7+w=; 7:+426V52IrP0qoqb67syoFazTVQ/jboZc+Wri464NW0gE+zu/rJsb4VfQmqu7q+gCzaKFuiS/Uchvw8bw+Fno6xc8kbVHVSss6B9Qi46qr05hHZo1rpYNKJbI2SZIiiLR8hNe67t1YGoVFJvshi3goQdt+AelTepzuQDee/Ooc2u3D3s8PiTAFoZ2crede32ezMWWzq9D3KbmxVOqvSsosmS+LeKrRmX4U/Zftv09LyQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0160; 20:9cvFUHLzLJf0BGSILlktLvO/MUTfEhtIIURZKCH8AWvTibcYIEOE37OANyOCJuOCt1UcdGSEfd7HDWS2STgZAf7pQDDD0Yo6Y3QfYG61lRP+hBREP7hEll+fhsXcc3D6xSQEGRdZvzbB4qGU882QsvedWdach5H5wW3Ul44PK/3GvYdxkOuFjd6Y2UTglTgl768p3QYPMqKc9JPPCYkW2miNADkX3jp8eD6aqKbNS4cN2VTUQ3L5guspoTR6V8zF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2017 01:42:59.8655 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0160 Subject: Re: [PATCH v2 17/23] OvmfPkg/VirtioBlkDxe: map host address to device address 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: Tue, 22 Aug 2017 01:40:32 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US On 8/21/17 10:24 AM, Laszlo Ersek wrote: [Snip]... > (25) I think you intended to add the empty line above the "ReleaseQueue" > label, not below it. > >> VirtioRingUninit (Dev->VirtIo, &Dev->Ring); >> >> Failed: > (26) You forgot to call UnmapSharedBuffer() in the VirtioBlkUninit() > function. Each ring must be unmapped in three places: > > - in the device init function, if there is an error and we're past > mapping the ring, > - in the device uninit function, > - in the ExitBootServices notify function. I will go through each of your comments and try to address them in v3 but I would like to understand this code flow a bit more. When we invoke PciIo->UnmapBuffer(...,Map) [1], it searches for Mapping in its internal list and if found then unmaps the buffer. So idea is each Map() should have exactly one Unmap(). So the question: is it possible that we may get called from both ExitBootService notify and device uninit functions ? If so, then we will have issue because now we will end up calling Unmap() twice (once from ExitBootServices then device uninit). In my debug statement I saw the call to ExitBootServices but was never able to trigger code path where the device uninit is called. I am wondering if you know any method to trigger the device uninit code flow so that I can verify both the path. [1] https://github.com/tianocore/edk2/blob/master/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c#L316 >> @@ -885,6 +974,12 @@ VirtioBlkExitBoot ( >> // >> Dev = Context; >> Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0); >> + >> + // >> + // Unmap the ring buffer so that hypervisor can not get a readable data >> + // after device is reset. >> + // >> + Dev->VirtIo->UnmapSharedBuffer (Dev->VirtIo, Dev->RingMapping); >> } >> >> /** >> > I think I'm skipping the rest of the series for now (except the last > patch, I have comments for that). > > Please rework the rest of the transport-independent virtio drivers (scsi > and net) based on my comments for this (blk) and the previous (rng) patch. > > Thanks! > Laszlo