Remove shadow bo related code as vm code is creating shadow bo using proper API. Without shadow bo code, amdgpu_bo_create() is basically a wrapper around amdgpu_bo_do_create(). So rename amdgpu_bo_do_create() to amdgpu_bo_create().
Unified · Split
| @@ -515,7 +515,18 @@ bool amdgpu_bo_support_uswc(u64 bo_flags) · 514 unmodified lines | ||
| 515 | 515 | #endif |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | −static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |
| 518 | +/** | |
| 519 | + * amdgpu_bo_create - create an &amdgpu_bo buffer object | |
| 520 | + * @adev: amdgpu device object | |
| 521 | + * @bp: parameters to be used for the buffer object | |
| 522 | + * @bo_ptr: pointer to the buffer object pointer | |
| 523 | + * | |
| 524 | + * Creates an &amdgpu_bo buffer object. | |
| 525 | + * | |
| 526 | + * Returns: | |
| 527 | + * 0 for success or a negative error code on failure. | |
| 528 | + */ | |
| 529 | +int amdgpu_bo_create(struct amdgpu_device *adev, | |
| 519 | 530 | struct amdgpu_bo_param *bp, |
| 520 | 531 | struct amdgpu_bo **bo_ptr) |
| 521 | 532 | { |
| @@ -644,7 +655,7 @@ int amdgpu_bo_create_shadow(struct amdgpu_device *adev, · 122 unmodified lines | ||
| 644 | 655 | bp.resv = bo->tbo.base.resv; |
| 645 | 656 | bp.bo_ptr_size = sizeof(struct amdgpu_bo); |
| 646 | 657 | |
| 647 | − r = amdgpu_bo_do_create(adev, &bp, &bo->shadow); | |
| 658 | + r = amdgpu_bo_create(adev, &bp, &bo->shadow); | |
| 648 | 659 | if (!r) { |
| 649 | 660 | bo->shadow->parent = amdgpu_bo_ref(bo); |
| 650 | 661 | mutex_lock(&adev->shadow_list_lock); |
| @@ -655,50 +666,6 @@ int amdgpu_bo_create_shadow(struct amdgpu_device *adev, · 4 unmodified lines | ||
| 655 | 666 | return r; |
| 656 | 667 | } |
| 657 | 668 | |
| 658 | −/** | |
| 659 | − * amdgpu_bo_create - create an &amdgpu_bo buffer object | |
| 660 | − * @adev: amdgpu device object | |
| 661 | − * @bp: parameters to be used for the buffer object | |
| 662 | − * @bo_ptr: pointer to the buffer object pointer | |
| 663 | − * | |
| 664 | − * Creates an &amdgpu_bo buffer object; and if requested, also creates a | |
| 665 | − * shadow object. | |
| 666 | − * Shadow object is used to backup the original buffer object, and is always | |
| 667 | − * in GTT. | |
| 668 | − * | |
| 669 | − * Returns: | |
| 670 | − * 0 for success or a negative error code on failure. | |
| 671 | − */ | |
| 672 | −int amdgpu_bo_create(struct amdgpu_device *adev, | |
| 673 | − struct amdgpu_bo_param *bp, | |
| 674 | − struct amdgpu_bo **bo_ptr) | |
| 675 | −{ | |
| 676 | − u64 flags = bp->flags; | |
| 677 | − int r; | |
| 678 | − | |
| 679 | − bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW; | |
| 680 | − | |
| 681 | − r = amdgpu_bo_do_create(adev, bp, bo_ptr); | |
| 682 | − if (r) | |
| 683 | − return r; | |
| 684 | − | |
| 685 | − if ((flags & AMDGPU_GEM_CREATE_SHADOW) && !(adev->flags & AMD_IS_APU)) { | |
| 686 | − if (!bp->resv) | |
| 687 | − WARN_ON(dma_resv_lock((*bo_ptr)->tbo.base.resv, | |
| 688 | − NULL)); | |
| 689 | − | |
| 690 | − r = amdgpu_bo_create_shadow(adev, bp->size, *bo_ptr); | |
| 691 | − | |
| 692 | − if (!bp->resv) | |
| 693 | − dma_resv_unlock((*bo_ptr)->tbo.base.resv); | |
| 694 | − | |
| 695 | − if (r) | |
| 696 | − amdgpu_bo_unref(bo_ptr); | |
| 697 | − } | |
| 698 | − | |
| 699 | − return r; | |
| 700 | −} | |
| 701 | − | |
| 702 | 669 | /** |
| 703 | 670 | * amdgpu_bo_create_user - create an &amdgpu_bo_user buffer object |
| 704 | 671 | * @adev: amdgpu device object |
| @@ -720,7 +687,7 @@ int amdgpu_bo_create_user(struct amdgpu_device *adev, · 15 unmodified lines | ||
| 720 | 687 | |
| 721 | 688 | bp->flags = bp->flags & ~AMDGPU_GEM_CREATE_SHADOW; |
| 722 | 689 | bp->bo_ptr_size = sizeof(struct amdgpu_bo_user); |
| 723 | − r = amdgpu_bo_do_create(adev, bp, &bo_ptr); | |
| 690 | + r = amdgpu_bo_create(adev, bp, &bo_ptr); | |
| 724 | 691 | if (r) |
| 725 | 692 | return r; |
| 726 | 693 | |