[PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions
Olav Haugan
ohaugan at codeaurora.org
Tue Aug 12 09:53:44 PDT 2014
On 8/11/2014 6:35 PM, Konrad Rzeszutek Wilk wrote:
> On Mon, Aug 11, 2014 at 03:45:50PM -0700, Olav Haugan wrote:
> .. snip..
>> + for_each_sg(sg, s, nents, i) {
>> + phys_addr_t phys = page_to_phys(sg_page(s));
>> + size_t page_len = s->offset + s->length;
>> +
>> + ret = iommu_map(domain, iova + offset, phys, page_len,
>> + prot);
>> + if (ret) {
>> + /* undo mappings already done */
>> + iommu_unmap(domain, iova, offset);
>
> Don't we want then to unmap all of the scatter list instead of just
> the last one?
>
It reverts all the mapping that was already done up until the error
occurred. "offset" contains the amount we have mapped so far.
Thanks,
Olav
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the linux-arm-kernel
mailing list