On 11/17/26 17:59, James Zhu wrote:
> On GFX IPs with multiple XCCs each XCC has an own GFXHUB, but the
> setup_vm_pt_regs gfxhub callback programs a VMID's page table base on
> every XCC. Callers which bind a VMID on a single VMHUB, like the SPM
> VMID binding, have no way to reach one GFXHUB through the callback
> interface.
> 
> gfxhub v1.2 and v12.1 already implement an XCC-masked variant
> internally. Expose it as a new setup_vm_pt_regs_xcc callback. GFXHUBs
> of IPs with a single XCC don't implement it, for them the existing
> callback already is per-hub.
> 
> Signed-off-by: James Zhu <[email protected]>
> Assisted-by: Claude:claude-fable-5
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfxhub.h | 2 ++
>  drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c  | 1 +
>  drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c   | 1 +
>  3 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfxhub.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfxhub.h
> index c7b44aeb671b..19b961cb12f6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfxhub.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfxhub.h
> @@ -28,6 +28,8 @@ struct amdgpu_gfxhub_funcs {
>       u64 (*get_mc_fb_offset)(struct amdgpu_device *adev);
>       void (*setup_vm_pt_regs)(struct amdgpu_device *adev, uint32_t vmid,
>                       uint64_t page_table_base);
> +     void (*setup_vm_pt_regs_xcc)(struct amdgpu_device *adev, uint32_t vmid,
> +                     uint64_t page_table_base, uint32_t xcc_mask);

Don't add a new callback, extend the setup_vm_pt_regs with the xcc_mask instead.

Regards,
Christian.

>       int (*gart_enable)(struct amdgpu_device *adev);
>  
>       void (*gart_disable)(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c 
> b/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c
> index b13967a1c8fb..7bc17721f463 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c
> @@ -809,6 +809,7 @@ const struct amdgpu_gfxhub_funcs gfxhub_v12_1_funcs = {
>       .get_fb_location = gfxhub_v12_1_get_fb_location,
>       .get_mc_fb_offset = gfxhub_v12_1_get_mc_fb_offset,
>       .setup_vm_pt_regs = gfxhub_v12_1_setup_vm_pt_regs,
> +     .setup_vm_pt_regs_xcc = gfxhub_v12_1_xcc_setup_vm_pt_regs,
>       .gart_enable = gfxhub_v12_1_gart_enable,
>       .gart_disable = gfxhub_v12_1_gart_disable,
>       .set_fault_enable_default = gfxhub_v12_1_set_fault_enable_default,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c 
> b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
> index e89813590539..a56c072daf15 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c
> @@ -634,6 +634,7 @@ static int gfxhub_v1_2_get_xgmi_info(struct amdgpu_device 
> *adev)
>  const struct amdgpu_gfxhub_funcs gfxhub_v1_2_funcs = {
>       .get_mc_fb_offset = gfxhub_v1_2_get_mc_fb_offset,
>       .setup_vm_pt_regs = gfxhub_v1_2_setup_vm_pt_regs,
> +     .setup_vm_pt_regs_xcc = gfxhub_v1_2_xcc_setup_vm_pt_regs,
>       .gart_enable = gfxhub_v1_2_gart_enable,
>       .gart_disable = gfxhub_v1_2_gart_disable,
>       .set_fault_enable_default = gfxhub_v1_2_set_fault_enable_default,

Reply via email to