From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 99B41A0598; Fri, 10 Apr 2020 21:39:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D3D0F1D57C; Fri, 10 Apr 2020 21:39:17 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0E3591D571 for ; Fri, 10 Apr 2020 21:39:15 +0200 (CEST) IronPort-SDR: AzzYoCukqKB/jz6xT09I29ppaI7OW7kULGgPeVD131kHWe9derO/3nu097jOVd2GjIgcNix1VX Mp7gIPv+BjHQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 12:39:14 -0700 IronPort-SDR: +xqHcGCj19ZiaiRHlm8jrcJxBIEOyLHS76Ep2TXTq16886YgzRbTXhi6JZ7i93wzH3/7iuG4K4 1yup68DfFeQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,367,1580803200"; d="scan'208";a="287281857" Received: from rmenon-mobl.amr.corp.intel.com (HELO [10.212.42.118]) ([10.212.42.118]) by fmsmga002.fm.intel.com with ESMTP; 10 Apr 2020 12:39:13 -0700 To: Dmitry Kozlyuk Cc: dev@dpdk.org, "Dmitry Malloy (MESHCHANINOV)" , Narcisa Ana Maria Vasile References: <20200330041026.784624-1-dmitry.kozliuk@gmail.com> <20200330041026.784624-2-dmitry.kozliuk@gmail.com> <20200410055010.6d2b5592@Sovereign> From: Ranjit Menon Message-ID: <87ea4ee6-c85b-6a58-1218-611540aef913@intel.com> Date: Fri, 10 Apr 2020 12:39:13 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200410055010.6d2b5592@Sovereign> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/1] virt2phys: virtual to physical address translator for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 4/9/2020 7:50 PM, Dmitry Kozlyuk wrote: >>> + >>> +_Use_decl_annotations_ >>> +VOID >>> +virt2phys_device_EvtIoInCallerContext( >>> + IN WDFDEVICE device, IN WDFREQUEST request) >>> +{ >>> + WDF_REQUEST_PARAMETERS params; >>> + ULONG code; >>> + PVOID *virt; >> >> Should this be PVOID virt; (instead of PVOID *virt)? >> If so, changes will be required to parameters passed in to >> WdfRequestRetrieveInputBuffer() call. > > This should be PVOID *virt (pointer to an untyped pointer). User-mode passes > a virtual address as a PVOID value, WdfRequestRetrieveInputBuffer() fills > virt with the address of that parameter, so that *virt is the virtual address > user-mode wants to translate into a physical one. > Makes sense. Thanks for the explanation, Dmitry. >> >>> + PHYSICAL_ADDRESS *phys; >>> + size_t size; >>> + NTSTATUS status; >>> + > [snip] >>> + >>> + status = WdfRequestRetrieveOutputBuffer( >>> + request, sizeof(*phys), &phys, &size); >> >> Better to put a (PVOID *)typecast for &phys here: >> status = WdfRequestRetrieveOutputBuffer( >> request, sizeof(*phys), (PVOID *)&phys, &size); > > What do you mean? Without a typecast the built-in static analyzer emits a > warning (and all warnings are treated as errors for a driver): > > virt2phys.c(108,46): error C2220: the following warning is treated as an error > virt2phys.c(108,46): warning C4047: 'function': 'PVOID *' differs in levels of indirection from 'PVOID **' > virt2phys.c(108,46): warning C4022: 'WdfRequestRetrieveInputBuffer': pointer mismatch for actual parameter 3 > >>> + if (!NT_SUCCESS(status)) { >>> + KdPrint(("WdfRequestRetrieveOutputBuffer() failed, " >>> + "status=%08x\n", status)); >>> + WdfRequestComplete(request, status); >>> + return; >>> + } >>> + >>> + *phys = MmGetPhysicalAddress(*virt); >>> + >>> + WdfRequestCompleteWithInformation( >>> + request, STATUS_SUCCESS, sizeof(*phys)); >>> +} >> >> >> >> Co-installers are no longer required (and discouraged) as per Microsoft. >> So you can remove the lines indicated below from the .inf file. > > Thanks, will remove in v2. They were generated by WDK solution template. > I see the above changes in v2. Thanks! ranjit m.