mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-06 06:37:59 +00:00
AMD IOMMU: use iommu_device_max_index
AMD IOMMU can use iommu_device_max_index() instead of the homegrown function. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
24268245d8
commit
40becd8d5a
1 changed files with 3 additions and 7 deletions
|
@ -470,10 +470,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
|
||||||
* efficient allocator.
|
* efficient allocator.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static unsigned long dma_mask_to_pages(unsigned long mask)
|
|
||||||
{
|
|
||||||
return PAGE_ALIGN(mask) >> PAGE_SHIFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The address allocator core function.
|
* The address allocator core function.
|
||||||
|
@ -486,14 +482,14 @@ static unsigned long dma_ops_alloc_addresses(struct device *dev,
|
||||||
unsigned long align_mask,
|
unsigned long align_mask,
|
||||||
u64 dma_mask)
|
u64 dma_mask)
|
||||||
{
|
{
|
||||||
unsigned long limit = dma_mask_to_pages(dma_mask);
|
unsigned long limit;
|
||||||
unsigned long address;
|
unsigned long address;
|
||||||
unsigned long size = dom->aperture_size >> PAGE_SHIFT;
|
|
||||||
unsigned long boundary_size;
|
unsigned long boundary_size;
|
||||||
|
|
||||||
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
|
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
|
||||||
PAGE_SIZE) >> PAGE_SHIFT;
|
PAGE_SIZE) >> PAGE_SHIFT;
|
||||||
limit = limit < size ? limit : size;
|
limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0,
|
||||||
|
dma_mask >> PAGE_SHIFT);
|
||||||
|
|
||||||
if (dom->next_bit >= limit) {
|
if (dom->next_bit >= limit) {
|
||||||
dom->next_bit = 0;
|
dom->next_bit = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue