Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403681
| From | Robin Murphy <robin.murphy@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCHv6 2/8] dma-debug: add support for resource mappings |
| Date | 2016-05-19 13:50 +0200 |
| Message-ID | <rAuCL-7Be-53@gated-at.bofh.it> (permalink) |
| References | <rwWxz-11Z-3@gated-at.bofh.it> <rwWxA-11Z-15@gated-at.bofh.it> <rzODw-5QT-29@gated-at.bofh.it> <rAujo-7ti-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 19/05/16 12:21, Niklas Söderlund wrote:
> Hi Konrad,
>
> Thanks for your feedback.
>
> On 2016-05-17 10:50:02 -0400, Konrad Rzeszutek Wilk wrote:
>>> +void debug_dma_map_resource(struct device *dev, phys_addr_t addr, size_t size,
>>> + int direction, dma_addr_t dma_addr)
>>> +{
>>> + struct dma_debug_entry *entry;
>>> +
>>> + if (unlikely(dma_debug_disabled()))
>>> + return;
>>> +
>>> + entry = dma_entry_alloc();
>>> + if (!entry)
>>> + return;
>>> +
>>> + entry->type = dma_debug_resource;
>>> + entry->dev = dev;
>>> + entry->pfn = __phys_to_pfn(addr);
>>> + entry->offset = addr - PHYS_PFN(entry->pfn);
>>
>> Is that right?
>
> You are correct that should be:
>
> entry->offset = addr - PFN_PHYS(entry->pfn);
>
> Or even better:
>
> entry->offset = addr - __pfn_to_phys(entry->pfn);
Better still, simply offset_in_page(addr) (as per dma_map_single()).
Robin.
> I will address this and resend late next week, still hoping for some
> more feedback.
>
>>
>> __phys_to_pfn(addr) is PHYS_PFN(addr), so what you get here is
>>
>> addr - PHYS_PFN(PHYS_PFN(addr)) ?
>>
>>
>>> + entry->size = size;
>>> + entry->dev_addr = dma_addr;
>>> + entry->direction = direction;
>>> + entry->map_err_type = MAP_ERR_NOT_CHECKED;
>>> +
>>> + add_dma_entry(entry);
>>> +}
>>> +EXPORT_SYMBOL(debug_dma_map_resource);
>>> +
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCHv6 2/8] dma-debug: add support for resource mappings Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2016-05-17 17:00 +0200
Re: [PATCHv6 2/8] dma-debug: add support for resource mappings "Niklas Söderlund" <niklas.soderlund@ragnatech.se> - 2016-05-19 13:30 +0200
Re: [PATCHv6 2/8] dma-debug: add support for resource mappings Robin Murphy <robin.murphy@arm.com> - 2016-05-19 13:50 +0200
csiph-web