mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-01 10:13:58 +08:00
drm/ttm: drop bus.size from bus placement.
This is always calculated the same, and only used in a couple of places. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200811074658.58309-2-airlied@gmail.com
This commit is contained in:
parent
098754fe3c
commit
ebb21aa188
@ -751,6 +751,7 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
|
|||||||
{
|
{
|
||||||
struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
|
struct amdgpu_device *adev = amdgpu_ttm_adev(bdev);
|
||||||
struct drm_mm_node *mm_node = mem->mm_node;
|
struct drm_mm_node *mm_node = mem->mm_node;
|
||||||
|
size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
|
||||||
|
|
||||||
switch (mem->mem_type) {
|
switch (mem->mem_type) {
|
||||||
case TTM_PL_SYSTEM:
|
case TTM_PL_SYSTEM:
|
||||||
@ -761,7 +762,7 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
|
|||||||
case TTM_PL_VRAM:
|
case TTM_PL_VRAM:
|
||||||
mem->bus.offset = mem->start << PAGE_SHIFT;
|
mem->bus.offset = mem->start << PAGE_SHIFT;
|
||||||
/* check if it's visible */
|
/* check if it's visible */
|
||||||
if ((mem->bus.offset + mem->bus.size) > adev->gmc.visible_vram_size)
|
if ((mem->bus.offset + bus_size) > adev->gmc.visible_vram_size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* Only physically contiguous buffers apply. In a contiguous
|
/* Only physically contiguous buffers apply. In a contiguous
|
||||||
* buffer, size of the first mm_node would match the number of
|
* buffer, size of the first mm_node would match the number of
|
||||||
|
@ -362,6 +362,7 @@ memcpy:
|
|||||||
static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *mem)
|
static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resource *mem)
|
||||||
{
|
{
|
||||||
struct radeon_device *rdev = radeon_get_rdev(bdev);
|
struct radeon_device *rdev = radeon_get_rdev(bdev);
|
||||||
|
size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
|
||||||
|
|
||||||
switch (mem->mem_type) {
|
switch (mem->mem_type) {
|
||||||
case TTM_PL_SYSTEM:
|
case TTM_PL_SYSTEM:
|
||||||
@ -380,7 +381,7 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
|
|||||||
case TTM_PL_VRAM:
|
case TTM_PL_VRAM:
|
||||||
mem->bus.offset = mem->start << PAGE_SHIFT;
|
mem->bus.offset = mem->start << PAGE_SHIFT;
|
||||||
/* check if it's visible */
|
/* check if it's visible */
|
||||||
if ((mem->bus.offset + mem->bus.size) > rdev->mc.visible_vram_size)
|
if ((mem->bus.offset + bus_size) > rdev->mc.visible_vram_size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
mem->bus.base = rdev->mc.aper_base;
|
mem->bus.base = rdev->mc.aper_base;
|
||||||
mem->bus.is_iomem = true;
|
mem->bus.is_iomem = true;
|
||||||
@ -392,11 +393,11 @@ static int radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_reso
|
|||||||
if (mem->placement & TTM_PL_FLAG_WC)
|
if (mem->placement & TTM_PL_FLAG_WC)
|
||||||
mem->bus.addr =
|
mem->bus.addr =
|
||||||
ioremap_wc(mem->bus.base + mem->bus.offset,
|
ioremap_wc(mem->bus.base + mem->bus.offset,
|
||||||
mem->bus.size);
|
bus_size);
|
||||||
else
|
else
|
||||||
mem->bus.addr =
|
mem->bus.addr =
|
||||||
ioremap(mem->bus.base + mem->bus.offset,
|
ioremap(mem->bus.base + mem->bus.offset,
|
||||||
mem->bus.size);
|
bus_size);
|
||||||
if (!mem->bus.addr)
|
if (!mem->bus.addr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -140,7 +140,6 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
|
|||||||
|
|
||||||
mem->bus.addr = NULL;
|
mem->bus.addr = NULL;
|
||||||
mem->bus.offset = 0;
|
mem->bus.offset = 0;
|
||||||
mem->bus.size = mem->num_pages << PAGE_SHIFT;
|
|
||||||
mem->bus.base = 0;
|
mem->bus.base = 0;
|
||||||
mem->bus.is_iomem = false;
|
mem->bus.is_iomem = false;
|
||||||
retry:
|
retry:
|
||||||
@ -214,12 +213,14 @@ static int ttm_resource_ioremap(struct ttm_bo_device *bdev,
|
|||||||
if (mem->bus.addr) {
|
if (mem->bus.addr) {
|
||||||
addr = mem->bus.addr;
|
addr = mem->bus.addr;
|
||||||
} else {
|
} else {
|
||||||
|
size_t bus_size = (size_t)mem->num_pages << PAGE_SHIFT;
|
||||||
|
|
||||||
if (mem->placement & TTM_PL_FLAG_WC)
|
if (mem->placement & TTM_PL_FLAG_WC)
|
||||||
addr = ioremap_wc(mem->bus.base + mem->bus.offset,
|
addr = ioremap_wc(mem->bus.base + mem->bus.offset,
|
||||||
mem->bus.size);
|
bus_size);
|
||||||
else
|
else
|
||||||
addr = ioremap(mem->bus.base + mem->bus.offset,
|
addr = ioremap(mem->bus.base + mem->bus.offset,
|
||||||
mem->bus.size);
|
bus_size);
|
||||||
if (!addr) {
|
if (!addr) {
|
||||||
(void) ttm_mem_io_lock(man, false);
|
(void) ttm_mem_io_lock(man, false);
|
||||||
ttm_mem_io_free(bdev, mem);
|
ttm_mem_io_free(bdev, mem);
|
||||||
|
@ -162,7 +162,6 @@ struct ttm_resource_manager {
|
|||||||
* @addr: mapped virtual address
|
* @addr: mapped virtual address
|
||||||
* @base: bus base address
|
* @base: bus base address
|
||||||
* @is_iomem: is this io memory ?
|
* @is_iomem: is this io memory ?
|
||||||
* @size: size in byte
|
|
||||||
* @offset: offset from the base address
|
* @offset: offset from the base address
|
||||||
* @io_reserved_vm: The VM system has a refcount in @io_reserved_count
|
* @io_reserved_vm: The VM system has a refcount in @io_reserved_count
|
||||||
* @io_reserved_count: Refcounting the numbers of callers to ttm_mem_io_reserve
|
* @io_reserved_count: Refcounting the numbers of callers to ttm_mem_io_reserve
|
||||||
@ -172,7 +171,6 @@ struct ttm_resource_manager {
|
|||||||
struct ttm_bus_placement {
|
struct ttm_bus_placement {
|
||||||
void *addr;
|
void *addr;
|
||||||
phys_addr_t base;
|
phys_addr_t base;
|
||||||
unsigned long size;
|
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
bool is_iomem;
|
bool is_iomem;
|
||||||
bool io_reserved_vm;
|
bool io_reserved_vm;
|
||||||
|
Loading…
Reference in New Issue
Block a user