public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: shaoyunl <Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH 04/13] drm/amdgpu/gmc9: Adjust xgmi offset
Date: Thu, 6 Sep 2018 09:39:06 +0200	[thread overview]
Message-ID: <feee76c4-8e7a-1350-0220-520dd7a00a91@gmail.com> (raw)
In-Reply-To: <1536161364-4280-1-git-send-email-Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org>

Am 05.09.2018 um 17:29 schrieb shaoyunl:
> From: Alex Deucher <alexander.deucher@amd.com>
>
> On hives with xgmi enabled, the fb_location aperture is a size
> which defines the total framebuffer size of all nodes in the
> hive.  Each GPU in the hive has the same view via the fb_location
> aperture.  GPU0 starts at offset (0 * segment size),
> GPU1 starts at offset (1 * segment size), etc.
>
> For access to local vram on each GPU, we need to take this offset into
> account. This including on setting up GPUVM page table  and  GART table
>
> Acked-by: Huang Rui <ray.huang@amd.com>
> Acked-by: Slava Abramov <slava.abramov@amd.com>
> Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c  | 4 ++++
>   drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c | 3 +++
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 6 ++++++
>   3 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 6acdeeb..a95b615 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -158,6 +158,10 @@ void amdgpu_gmc_gart_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc)
>   	if ((size_bf >= mc->gart_size && size_bf < size_af) ||
>   	    (size_af < mc->gart_size))
>   		mc->gart_start = 0;
> +	else if (mc->xgmi.num_physical_nodes)
> +		mc->gart_start = mc->vram_start +
> +			(mc->xgmi.num_physical_nodes - mc->xgmi.physical_node_id)
> +			* mc->xgmi.node_segment_size;

That looks incomplete to me. The calculation above as well as the AGP 
code needs adjustment as well.

Probably best if some fb_start/fb_end fields to struct amdgpu_gmc and 
calculate that only once in amdgpu_gmc_vram_location.

Christian.

>   	else
>   		mc->gart_start = mc->mc_mask - mc->gart_size + 1;
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c
> index d4170cb..5e9ab8e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_1.c
> @@ -44,6 +44,9 @@ int gfxhub_v1_1_get_xgmi_info(struct amdgpu_device *adev)
>   			REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_LFB_REGION);
>   		if (adev->gmc.xgmi.physical_node_id > 3)
>   			return -EINVAL;
> +		adev->gmc.xgmi.node_segment_size = REG_GET_FIELD(
> +			RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_SIZE),
> +			MC_VM_XGMI_LFB_SIZE, PF_LFB_SIZE) << 24;
>   	}
>   
>   	return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 3529c55..0da89ba 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -770,12 +770,18 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
>   	u64 base = 0;
>   	if (!amdgpu_sriov_vf(adev))
>   		base = mmhub_v1_0_get_fb_location(adev);
> +	/* add the xgmi offset of the physical node */
> +	base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
>   	amdgpu_gmc_vram_location(adev, &adev->gmc, base);
>   	amdgpu_gmc_gart_location(adev, mc);
>   	if (!amdgpu_sriov_vf(adev))
>   		amdgpu_gmc_agp_location(adev, mc);
>   	/* base offset of vram pages */
>   	adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
> +
> +	/* XXX: add the xgmi offset of the physical node? */
> +	adev->vm_manager.vram_base_offset +=
> +		adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size;
>   }
>   
>   /**

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-09-06  7:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 15:29 [PATCH 04/13] drm/amdgpu/gmc9: Adjust xgmi offset shaoyunl
     [not found] ` <1536161364-4280-1-git-send-email-Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org>
2018-09-06  7:39   ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=feee76c4-8e7a-1350-0220-520dd7a00a91@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox