mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
BACKPORT: swiotlb: remove swiotlb_nr_tbl
All callers just use it to check if swiotlb is active at all, for which
they can just use is_swiotlb_active. In the longer run drivers need
to stop using is_swiotlb_active as well, but let's do the simple step
first.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry picked from commit 2cbc2776ef)
[willdeacon@: Fixed up additional users in DRM drivers]
Signed-off-by: Will Deacon <willdeacon@google.com>
Bug: 190591509
Change-Id: I3bd4c17695f0224ae68509d0e51cb5bdc455277a
This commit is contained in:
committed by
Will Deacon
parent
2f2f753c19
commit
e64f1c94eb
@@ -1357,7 +1357,7 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (adev->need_swiotlb && swiotlb_nr_tbl()) {
|
||||
if (adev->need_swiotlb && is_swiotlb_active()) {
|
||||
return ttm_dma_populate(>t->ttm, adev->dev, ctx);
|
||||
}
|
||||
#endif
|
||||
@@ -1401,7 +1401,7 @@ static void amdgpu_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *
|
||||
adev = amdgpu_ttm_adev(bdev);
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (adev->need_swiotlb && swiotlb_nr_tbl()) {
|
||||
if (adev->need_swiotlb && is_swiotlb_active()) {
|
||||
ttm_dma_unpopulate(>t->ttm, adev->dev);
|
||||
return;
|
||||
}
|
||||
@@ -2589,7 +2589,7 @@ int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
|
||||
count = ARRAY_SIZE(amdgpu_ttm_debugfs_list);
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (!(adev->need_swiotlb && swiotlb_nr_tbl()))
|
||||
if (!(adev->need_swiotlb && is_swiotlb_active()))
|
||||
--count;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
|
||||
|
||||
max_order = MAX_ORDER;
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (swiotlb_nr_tbl()) {
|
||||
if (is_swiotlb_active()) {
|
||||
unsigned int max_segment;
|
||||
|
||||
max_segment = swiotlb_max_segment();
|
||||
|
||||
@@ -1328,7 +1328,7 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
|
||||
if (swiotlb_nr_tbl()) {
|
||||
if (is_swiotlb_active()) {
|
||||
return ttm_dma_populate((void *)ttm, dev, ctx);
|
||||
}
|
||||
#endif
|
||||
@@ -1358,7 +1358,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_bo_device *bdev,
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
|
||||
if (swiotlb_nr_tbl()) {
|
||||
if (is_swiotlb_active()) {
|
||||
ttm_dma_unpopulate((void *)ttm, dev);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
|
||||
if (rdev->need_swiotlb && is_swiotlb_active()) {
|
||||
return ttm_dma_populate(>t->ttm, rdev->dev, ctx);
|
||||
}
|
||||
#endif
|
||||
@@ -689,7 +689,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
|
||||
if (rdev->need_swiotlb && is_swiotlb_active()) {
|
||||
ttm_dma_unpopulate(>t->ttm, rdev->dev);
|
||||
return;
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
|
||||
count = ARRAY_SIZE(radeon_ttm_debugfs_list);
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
if (!(rdev->need_swiotlb && swiotlb_nr_tbl()))
|
||||
if (!(rdev->need_swiotlb && is_swiotlb_active()))
|
||||
--count;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
|
||||
|
||||
spin_unlock(&pcifront_dev_lock);
|
||||
|
||||
if (!err && !swiotlb_nr_tbl()) {
|
||||
if (!err && !is_swiotlb_active()) {
|
||||
err = pci_xen_swiotlb_init_late();
|
||||
if (err)
|
||||
dev_err(&pdev->xdev->dev, "Could not setup SWIOTLB!\n");
|
||||
|
||||
@@ -37,7 +37,6 @@ enum swiotlb_force {
|
||||
|
||||
extern void swiotlb_init(int verbose);
|
||||
int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
|
||||
extern unsigned long swiotlb_nr_tbl(void);
|
||||
unsigned long swiotlb_size_or_default(void);
|
||||
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
|
||||
extern int swiotlb_late_init_with_default_size(size_t default_size);
|
||||
|
||||
@@ -94,12 +94,6 @@ setup_io_tlb_npages(char *str)
|
||||
}
|
||||
early_param("swiotlb", setup_io_tlb_npages);
|
||||
|
||||
unsigned long swiotlb_nr_tbl(void)
|
||||
{
|
||||
return io_tlb_default_mem ? io_tlb_default_mem->nslabs : 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(swiotlb_nr_tbl);
|
||||
|
||||
unsigned int swiotlb_max_segment(void)
|
||||
{
|
||||
return io_tlb_default_mem ? max_segment : 0;
|
||||
@@ -653,6 +647,7 @@ bool is_swiotlb_active(void)
|
||||
{
|
||||
return io_tlb_default_mem != NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(is_swiotlb_active);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user