Re: [PATCH 3/3] drm/amdgpu: use amdxcp platform device as spatial partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Series is:
Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>

On Tue, May 23, 2023 at 9:29 AM James Zhu <James.Zhu@xxxxxxx> wrote:
>
> Use amdxcp platform device as spatial partition device.
>
> Signed-off-by: James Zhu <James.Zhu@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  2 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 12 ++++++------
>  2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 3d91e123f9bd..852c98dd40ea 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -51,6 +51,7 @@
>  #include "amdgpu_ras.h"
>  #include "amdgpu_xgmi.h"
>  #include "amdgpu_reset.h"
> +#include "../amdxcp/amdgpu_xcp_drv.h"
>
>  /*
>   * KMS wrapper.
> @@ -2944,6 +2945,7 @@ static void __exit amdgpu_exit(void)
>         amdgpu_sync_fini();
>         amdgpu_fence_slab_fini();
>         mmu_notifier_synchronize();
> +       amdgpu_xcp_drv_release();
>  }
>
>  module_init(amdgpu_init);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> index 6ab5713ff741..9e3a7efaf584 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
> @@ -25,6 +25,7 @@
>  #include "amdgpu_drv.h"
>
>  #include <drm/drm_drv.h>
> +#include "../amdxcp/amdgpu_xcp_drv.h"
>
>  static int __amdgpu_xcp_run(struct amdgpu_xcp_mgr *xcp_mgr,
>                             struct amdgpu_xcp_ip *xcp_ip, int xcp_state)
> @@ -228,21 +229,20 @@ static int amdgpu_xcp_dev_alloc(struct amdgpu_device *adev)
>         struct drm_device *p_ddev;
>         struct pci_dev *pdev;
>         struct drm_device *ddev;
> -       int i;
> +       int i, ret;
>
>         pdev = adev->pdev;
>         ddev = adev_to_drm(adev);
>
>         for (i = 0; i < MAX_XCP; i++) {
> -               p_ddev = drm_dev_alloc(&amdgpu_partition_driver,
> -                       &pci_upstream_bridge(pdev)->dev);
> -               if (IS_ERR(p_ddev))
> -                       return PTR_ERR(p_ddev);
> +               ret = amdgpu_xcp_drm_dev_alloc(&p_ddev);
> +               if (ret)
> +                       return ret;
>
>                 /* Redirect all IOCTLs to the primary device */
>                 adev->xcp_mgr->xcp[i].rdev = p_ddev->render->dev;
>                 adev->xcp_mgr->xcp[i].pdev = p_ddev->primary->dev;
> -               adev->xcp_mgr->xcp[i].driver = p_ddev->driver;
> +               adev->xcp_mgr->xcp[i].driver = (struct drm_driver *)p_ddev->driver;
>                 adev->xcp_mgr->xcp[i].vma_offset_manager = p_ddev->vma_offset_manager;
>                 p_ddev->render->dev = ddev;
>                 p_ddev->primary->dev = ddev;
> --
> 2.34.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux