From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v7 2/4] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Date: Sat, 17 May 2014 19:12:04 +0100 Message-ID: <5377A674.8090806@linaro.org> References: <1400163385-19863-1-git-send-email-julien.grall@linaro.org> <1400163385-19863-3-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wlj5d-0003ZS-60 for xen-devel@lists.xenproject.org; Sat, 17 May 2014 18:12:09 +0000 Received: by mail-we0-f180.google.com with SMTP id t61so3841647wes.39 for ; Sat, 17 May 2014 11:12:07 -0700 (PDT) In-Reply-To: <1400163385-19863-3-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On 15/05/14 15:16, Julien Grall wrote: > Grant mapping can be used for DMA request. The dev_bus_addr returned by the > hypercall is the MFN (not the IPA). Currently Linux is using this address (via > swiotlb) to program the DMA. > When the device is protected by IOMMU the request will fail. We have to > add 1:1 mapping in the domain p2m to allow DMA request working. > > This is valid because DOM0 has its memory mapped 1:1 and therefore we know > that RAM and devices cannot clash. I though a bit more about this patch. It doesn't handle the case where 2 grant use the same MFN, which is valid. In this case, we should remove the 1:1 mapping only when the last grant is removed. I'm not sure how to handle this case. Regards, -- Julien Grall