From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (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 D2B3921E95E03 for ; Wed, 30 Aug 2017 04:45:05 -0700 (PDT) Received: by mail-wm0-x22b.google.com with SMTP id t201so8831971wmt.1 for ; Wed, 30 Aug 2017 04:47:47 -0700 (PDT) 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=OgD6IGtPhAWLTkMXh3ZsRPETw/hSJ9K9PYFf6G3iO5g=; b=FYmjhkpuiljYppIe+EXpM8rdZlTSJPiUOmx9BJjoxGqLc2F/MYZzdFRJdvzx26BhVT MxzF1rkG3dkLFaXDU3Q9o+RUU/r3FTvqAzJxu0ShMyQXLkc7h71vFADyDptE0BFxdGZ8 g8Pp5GucNBBqyiDqrCXARyoLtIqy+9hhMeDgE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OgD6IGtPhAWLTkMXh3ZsRPETw/hSJ9K9PYFf6G3iO5g=; b=lc1RpTw8j5//u14uVdlBmM6d0YrwnGYc4qkr6KPUvapM0jMExokcyF1ikt+FUjA5W3 Gn1q2E1RF1z8uJ4mkzq76cJQjRlkPdGJVjfMyvkIy4295M+b0zZeBVKR7Cu4gUd4Pg+a jQomz00VwsZwbM15jjkbJIW6sPOyD96miFGs6nk+aCugoiNpFQldo6YHAHoGnepGCfTv hAQI0n0nNEl5A/VZZBmR4/RLbCLKL6+mOA3RvFiQQnFzB6LqoW90ilbXO5XjB1sYCE3Q YhoaqEzrwI0K4vRZdYxgQ5naP5mS7bpiE3IYLPpkcAWfldbNBZ+bkIfIq3qKSvAW8kL+ CJ2A== X-Gm-Message-State: AHYfb5gWs5c5buceiUTTt/pqx1Y+65l7jJhYakmSOTuj0OHBKdMk7x96 bpsrvjmUvxUGCB9r X-Received: by 10.28.213.143 with SMTP id m137mr1300078wmg.87.1504093665254; Wed, 30 Aug 2017 04:47:45 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id c56sm8554668wrc.1.2017.08.30.04.47.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 04:47:44 -0700 (PDT) Date: Wed, 30 Aug 2017 12:47:42 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" Message-ID: <20170830114742.3emvzywrpkddl443@bivouac.eciton.net> References: <20170830082108.7470-1-ard.biesheuvel@linaro.org> <20170830082108.7470-3-ard.biesheuvel@linaro.org> <20170830105140.5gglqu3ftedfbu2y@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH 2/6] EmbeddedPkg/CoherentDmaLib: add support for non-1:1 DMA translation 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: Wed, 30 Aug 2017 11:45:06 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Aug 30, 2017 at 11:54:05AM +0100, Ard Biesheuvel wrote: > On 30 August 2017 at 11:51, Leif Lindholm wrote: > > On Wed, Aug 30, 2017 at 09:21:04AM +0100, Ard Biesheuvel wrote: > >> Bring CoherentDmaLib in line with ArmDmaLib, and add support for > >> defining a static offset between the host's and the bus master's > >> view of memory. > >> > >> Contributed-under: TianoCore Contribution Agreement 1.1 > >> Signed-off-by: Ard Biesheuvel > >> --- > >> EmbeddedPkg/EmbeddedPkg.dec | 7 +++++++ > >> EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.c | 10 +++++++++- > >> EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf | 3 +++ > >> 3 files changed, 19 insertions(+), 1 deletion(-) > >> > >> diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec > >> index 8ad2a84c045c..ccdf38e36a8c 100644 > >> --- a/EmbeddedPkg/EmbeddedPkg.dec > >> +++ b/EmbeddedPkg/EmbeddedPkg.dec > >> @@ -208,3 +208,10 @@ [PcdsFixedAtBuild.X64] > >> > >> [PcdsFixedAtBuild.common, PcdsDynamic.common] > >> gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L""|VOID*|0x00000055 > >> + > >> + # > >> + # Value to add to a host address to obtain a device address, using > >> + # unsigned 64-bit integer arithmetic. This means we can rely on > >> + # truncation on overflow to specify negative offsets. > > > > Is that promotion-safe on 32-bit archs? > > Yes. EFI_PHYSICAL_ADDRESS is always 64-bits, and so is this PCD, so > whether it is a 32-bit platform or not should not make any difference. Right. Well, EFI_PHYSICAL_ADDRESS is. PHYSICAL_ADDRESS appears to also be (they are not derived from each other). + return (PHYSICAL_ADDRESS)(UINTN)Address + PcdGet64 (PcdDmaDeviceOffset); (I think I misparsed the above as return (PHYSICAL_ADDRESS)((UINTN)Address + PcdGet64 (PcdDmaDeviceOffset)); ) Reviewed-by: Leif Lindholm / Leif