From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 C4EF281E0A for ; Mon, 14 Nov 2016 07:13:51 -0800 (PST) Received: by mail-wm0-x229.google.com with SMTP id f82so104091831wmf.1 for ; Mon, 14 Nov 2016 07:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HO/74MLzAlAe3wU3XNhDu52wqNwYV+TzzJM5wTQ2buY=; b=eanSaPLhu/u5xLZYjbkxZOCK0RpObRQ0niTcjYf1e0NFlagiprffLm3U2NZ/e53x3k 7xdQE9qzkt4IbrpoWINinaAgm3MCEt1iMIpl9HtoYZgXhVOCX+aV4ycZb9skx1fYV16q 8ICSi77KGuTOHKmfEX75OFz87jRuNnuTKyhDE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HO/74MLzAlAe3wU3XNhDu52wqNwYV+TzzJM5wTQ2buY=; b=SEUR2FvWe88z1boUPthJJGWpd4lrLNwA00OrNShXwbXFqKMEa+qykKoBWtBex+TCdz lxzIEv58dohaBmWzBHWXEnpPT7a4abcpG578Vxkkm/FpXVWzlLBWVBPVjJzHITa3YFhn mCzzCpxX6goWl5EQ2PO0K2bDiBox5rQ2zGeHIaDCJcbeYBdhDcbpiqghgL69gK6UfATu h9WlKTbH8dP4oDRbIg/oWsvv3Mxa6d1ylTnddlKSG6gkeWIIRDJ0OOkxlWnoINkVh+Gc n19Ftb0fX0Fnqx73DubTosBYvlpKF+0mvy2hI3m4+ubbg8RtEhPurgiE0riD991DqQRB jR1w== X-Gm-Message-State: ABUngvcGQXD8Npe+VEJQ0vQzGOGEL5EO3LNroBkZPXQtPnaYH/wMGcWJWQQYvsOEPQ7IFLDj X-Received: by 10.194.62.178 with SMTP id z18mr22982107wjr.20.1479136434848; Mon, 14 Nov 2016 07:13:54 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id s204sm30023171wmd.1.2016.11.14.07.13.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Nov 2016 07:13:54 -0800 (PST) Date: Mon, 14 Nov 2016 15:13:52 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org Message-ID: <20161114151352.GQ27644@bivouac.eciton.net> References: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> <1478955748-14819-3-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1478955748-14819-3-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH v2 2/4] ArmPkg/ArmDmaLib: fix incorrect device address of double buffer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2016 15:13:52 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 12, 2016 at 02:02:26PM +0100, Ard Biesheuvel wrote: > If double buffering is not required in DmaMap(), the returned device > address is passed through ConvertToPhysicalAddress () to convert the > host address (which in case of DebugUncachedMemoryAllocationLib is not > 1:1 mapped) to a physical address, which is what a device would expect > to be able to perform DMA. > > By the same reasoning, a double buffer allocated using DmaAllocateBuffer () > should be converted in the same way, considering that the buffer is allocated > using UncachedAllocatePages (), to which the above equally applies. > > So add the missing ConvertToPhysicalAddress () invocation. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm > --- > ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > index 03fd9f3278e6..c2a44398d25a 100644 > --- a/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > +++ b/ArmPkg/Library/ArmDmaLib/ArmDmaLib.c > @@ -127,7 +127,7 @@ DmaMap ( > CopyMem (Buffer, HostAddress, *NumberOfBytes); > } > > - *DeviceAddress = (PHYSICAL_ADDRESS)(UINTN)Buffer; > + *DeviceAddress = ConvertToPhysicalAddress ((UINTN)Buffer); > } else { > Map->DoubleBuffer = FALSE; > } > -- > 2.7.4 >