lkml.org 
[lkml]   [2019]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 00/10] iommu/vt-d: Bounce buffer for untrusted devices
From
Date
Hi,

On 3/27/19 2:48 PM, Christoph Hellwig wrote:
> On Wed, Mar 27, 2019 at 02:34:56PM +0800, Lu Baolu wrote:
>> - During the v1 review cycle, we discussed the possibility
>> of reusing swiotlb code to avoid code dumplication, but
>> we found the swiotlb implementations are not ready for the
>> use of bounce page pool.
>> https://lkml.org/lkml/2019/3/19/259
>
> So make it ready. You too can contribute to common code. Robin
> also explicitly asked to make the bounce policy iommu-subsystem wide.
>

Sure. I am glad to make the code common. I will try to make it with a
new version.

For the swiotlb APIs, I am thinking about keeping current APIs untouched
and adding below new ones for bounce page.

/**
* swiotlb_bounce_page_map - create a bounce page mapping
* @dev: the device
* @phys: the physical address of the buffer requiring bounce
* @size: the size of the buffer
* @align: IOMMU page align
* @dir: DMA direction
* @attrs: DMA attributions
*
* This creates a swiotlb bounce page mapping for the buffer at @phys,
* and in case of DMAing to the device copy the data into it as well.
* Return the tlb addr on success, otherwise DMA_MAPPING_ERROR.
*/
dma_addr_t
swiotlb_bounce_page_map(struct device *dev, phys_addr_t phys,
size_t size, unsigned long align,
enum dma_data_direction dir, unsigned long attrs)
{
return 0;
}

/**
* swiotlb_bounce_page_unmap - destroy a bounce page mapping
* @dev: the device
* @tlb_addr: the tlb address of the buffer requiring bounce
* @size: the size of the buffer
* @align: IOMMU page align
* @dir: DMA direction
* @attrs: DMA attributions
*
* This destroys a swiotlb bounce page mapping for the buffer at @tlb_addr,
* and in case of DMAing from the device copy the data from it as well.
*/
void
swiotlb_bounce_page_unmap(struct device *dev, phys_addr_t tlb_addr,
size_t size, unsigned long align,
enum dma_data_direction dir, unsigned long attrs)
{
}

/**
* swiotlb_bounce_page_sync - sync bounce page mapping
* @dev: the device
* @tlb_addr: the tlb address of the buffer requiring bounce
* @size: the size of the buffer
* @align: IOMMU page align
* @dir: DMA direction
* @attrs: DMA attributions
*
* This syncs a swiotlb bounce page mapping for the buffer at @tlb_addr.
*/
void
swiotlb_bounce_page_sync(struct device *dev, phys_addr_t tlb_addr,
size_t size, unsigned long align,
enum dma_data_direction dir, unsigned long attrs)
{
}

Any comments?

Best regards,
Lu Baolu

\
 
 \ /
  Last update: 2019-03-28 07:39    [W:0.073 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site