Skip to contentSkip to conversation

question on c/s 15181

DISCUSSION Jan Beulich 2 participants 2 messages Jul 5, 2007 – Jul 6, 2007

lore
Share & tools
lore
#0 lore raw

Herbert, are the changes below to use in_swiotlb_aperture() strictly necessary? They get us further away from native code, so I wonder if, for the purpose of being as close as possible to native, these could be reverted (in a larger patch that would get us closer to native in many other respects).

Jan

********************************************************

@@ -605,10 +610,12 @@ swiotlb_unmap_sg(struct device *hwdev, s
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++)
- if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
+ if (in_swiotlb_aperture(sg->dma_address))
unmap_single(hwdev,
(void *)bus_to_virt(sg->dma_address), sg->dma_length, dir);
+ else
+ gnttab_dma_unmap_page(sg->dma_address);
}

/*
@@ -627,7 +634,7 @@ swiotlb_sync_sg_for_cpu(struct device *h
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++)
- if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
+ if (in_swiotlb_aperture(sg->dma_address))
sync_single(hwdev,
(void *)bus_to_virt(sg->dma_address), sg->dma_length, dir);
@@ -642,7 +649,7 @@ swiotlb_sync_sg_for_device(struct device
BUG_ON(dir == DMA_NONE);

for (i = 0; i < nelems; i++, sg++)
- if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
+ if (in_swiotlb_aperture(sg->dma_address))
sync_single(hwdev,
(void *)bus_to_virt(sg->dma_address), sg->dma_length, dir);

#1 lore raw
Quoted 4 lines · Jan Beulich

Herbert, are the changes below to use in_swiotlb_aperture() strictly necessary? They get us further away from native code, so I wonder if, for the purpose of being as close as possible to native, these could be reverted (in a larger patch that would get us closer to native in many other respects).

For the sg case technically we can go back to the original code since the underlying grant pages should not get copied once it has been mapped.

In fact, if we had the strcut page pointer for the unmap_single case this could be greatly simplified.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt