From patchwork Sat Nov 12 13:02:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 81916 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp228919qge; Sat, 12 Nov 2016 05:02:37 -0800 (PST) X-Received: by 10.98.222.194 with SMTP id h185mr16941568pfg.130.1478955757511; Sat, 12 Nov 2016 05:02:37 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id k62si15121231pgk.90.2016.11.12.05.02.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Nov 2016 05:02:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EDA9E81F17; Sat, 12 Nov 2016 05:02:32 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::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 A56DB81F11 for ; Sat, 12 Nov 2016 05:02:30 -0800 (PST) Received: by mail-wm0-x22d.google.com with SMTP id a197so23477195wmd.0 for ; Sat, 12 Nov 2016 05:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hona29oIgn/7zUx/tyFgQT41IHc1rCL3kJN7sDo1ZPc=; b=CKgaS+ZBPQBni57eZe6RGdApISJ9eKWzavbEYZKhFG0tnKoRBJs4bk5p58kebd3HkR yv0uHkB/UNKAxKWb+aTJ5s4U6mzn6zGj2v25mygpJe16nfm2lOX62FWgDoQ3w2MwMI9x GhDNftJCcj6ZESpJtj2+fWYgsBjg55SyKJc6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hona29oIgn/7zUx/tyFgQT41IHc1rCL3kJN7sDo1ZPc=; b=i/FnrK8eT5dZnrFDU0nOx+Ycifpck+9ErrriRaXjwssaTF1VgIonuMTHL5XvLm45OM 9acslttZBSeuSfwQqXgMcc6BqRk4jAQWF9sI2ygs72kTwg/dC6rfXSxE7PKL+2JUPTRH KOf0ZviISFyM+AGEB5XMnErhWz2JGJv4St2P1FHVsnMbyA2sJBcKbYTqNhkJjXXcm+Ex QsmBQnhKGEaj87fM7u5TKNtRp7FSyllAp98S5jlzgKr+IWSzUXrq2H9nSqS7RVBbrLpb 8fHgDpDbnqzWnL3kyTES3AjfNEVbGBCApTgK0r6GUFRULcZ/g52dmzkS5iKtmALEWlNO laXQ== X-Gm-Message-State: ABUngvfUULnQekOQ7jFdNBUD2kKX/3VeBXJlhe2aNB0d/It+9cd6DnoPipqiFf5XZUGWNNAS X-Received: by 10.195.18.201 with SMTP id go9mr12874750wjd.200.1478955753107; Sat, 12 Nov 2016 05:02:33 -0800 (PST) Received: from ards-macbook-pro.access.network ([193.57.185.11]) by smtp.gmail.com with ESMTPSA id e188sm6084212wma.21.2016.11.12.05.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 12 Nov 2016 05:02:32 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Sat, 12 Nov 2016 14:02:26 +0100 Message-Id: <1478955748-14819-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> References: <1478955748-14819-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [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: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPkg/Library/ArmDmaLib/ArmDmaLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm 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; }