mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
Revert "FROMLIST: iommu/iova: Support limiting IOVA alignment"
This reverts commit ee98c0848c as it was
not accepted upstream and it causes merge issues with 5.11-rc1.
If this change is still needed, please work with upstream to get it
accepted and then submit the backported patch here.
Bug: 148141615
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I108ba1f929c620898a3b30dc6238a44d93d3ba7d
This commit is contained in:
@@ -11,36 +11,6 @@ config IOASID
|
|||||||
config IOMMU_API
|
config IOMMU_API
|
||||||
bool
|
bool
|
||||||
|
|
||||||
if IOMMU_IOVA
|
|
||||||
|
|
||||||
config IOMMU_LIMIT_IOVA_ALIGNMENT
|
|
||||||
bool "Limit IOVA alignment"
|
|
||||||
help
|
|
||||||
When the IOVA framework applies IOVA alignment it aligns all
|
|
||||||
IOVAs to the smallest PAGE_SIZE order which is greater than or
|
|
||||||
equal to the requested IOVA size. This works fine for sizes up
|
|
||||||
to several MiB, but for larger sizes it results in address
|
|
||||||
space wastage and fragmentation. For example drivers with a 4
|
|
||||||
GiB IOVA space might run out of IOVA space when allocating
|
|
||||||
buffers great than 64 MiB.
|
|
||||||
|
|
||||||
Enable this option to impose a limit on the alignment of IOVAs.
|
|
||||||
|
|
||||||
If unsure, say N.
|
|
||||||
|
|
||||||
config IOMMU_IOVA_ALIGNMENT
|
|
||||||
int "Maximum PAGE_SIZE order of alignment for IOVAs"
|
|
||||||
depends on IOMMU_LIMIT_IOVA_ALIGNMENT
|
|
||||||
range 4 9
|
|
||||||
default 9
|
|
||||||
help
|
|
||||||
With this parameter you can specify the maximum PAGE_SIZE order for
|
|
||||||
IOVAs. Larger IOVAs will be aligned only to this specified order.
|
|
||||||
The order is expressed a power of two multiplied by the PAGE_SIZE.
|
|
||||||
|
|
||||||
If unsure, leave the default value "9".
|
|
||||||
endif
|
|
||||||
|
|
||||||
menuconfig IOMMU_SUPPORT
|
menuconfig IOMMU_SUPPORT
|
||||||
bool "IOMMU Hardware Support"
|
bool "IOMMU Hardware Support"
|
||||||
depends on MMU
|
depends on MMU
|
||||||
|
|||||||
@@ -178,24 +178,6 @@ iova_insert_rbtree(struct rb_root *root, struct iova *iova,
|
|||||||
rb_insert_color(&iova->node, root);
|
rb_insert_color(&iova->node, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_IOMMU_LIMIT_IOVA_ALIGNMENT
|
|
||||||
static unsigned long limit_align_shift(struct iova_domain *iovad,
|
|
||||||
unsigned long shift)
|
|
||||||
{
|
|
||||||
unsigned long max_align_shift;
|
|
||||||
|
|
||||||
max_align_shift = CONFIG_IOMMU_IOVA_ALIGNMENT + PAGE_SHIFT
|
|
||||||
- iova_shift(iovad);
|
|
||||||
return min_t(unsigned long, max_align_shift, shift);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static unsigned long limit_align_shift(struct iova_domain *iovad,
|
|
||||||
unsigned long shift)
|
|
||||||
{
|
|
||||||
return shift;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
|
static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
|
||||||
unsigned long size, unsigned long limit_pfn,
|
unsigned long size, unsigned long limit_pfn,
|
||||||
struct iova *new, bool size_aligned)
|
struct iova *new, bool size_aligned)
|
||||||
@@ -207,7 +189,7 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
|
|||||||
unsigned long align_mask = ~0UL;
|
unsigned long align_mask = ~0UL;
|
||||||
|
|
||||||
if (size_aligned)
|
if (size_aligned)
|
||||||
align_mask <<= limit_align_shift(iovad, fls_long(size - 1));
|
align_mask <<= fls_long(size - 1);
|
||||||
|
|
||||||
/* Walk the tree backwards */
|
/* Walk the tree backwards */
|
||||||
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
|
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
|
||||||
@@ -260,7 +242,7 @@ static int __alloc_and_insert_iova_best_fit(struct iova_domain *iovad,
|
|||||||
unsigned long gap, candidate_gap = ~0UL;
|
unsigned long gap, candidate_gap = ~0UL;
|
||||||
|
|
||||||
if (size_aligned)
|
if (size_aligned)
|
||||||
align_mask <<= limit_align_shift(iovad, fls_long(size - 1));
|
align_mask <<= limit_align(iovad, fls_long(size - 1));
|
||||||
|
|
||||||
/* Walk the tree backwards */
|
/* Walk the tree backwards */
|
||||||
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
|
spin_lock_irqsave(&iovad->iova_rbtree_lock, flags);
|
||||||
|
|||||||
Reference in New Issue
Block a user