forked from Minki/linux
6fdd68b14a
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 v2: squash in "drm/amdgpu: Init correct fb region for none XGMI configuration" 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> Acked-by: Huang Rui <ray.huang@amd.com>
54 lines
2.0 KiB
C
54 lines
2.0 KiB
C
/*
|
|
* Copyright 2018 Advanced Micro Devices, Inc.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
*/
|
|
#include "amdgpu.h"
|
|
#include "gfxhub_v1_1.h"
|
|
|
|
#include "gc/gc_9_2_1_offset.h"
|
|
#include "gc/gc_9_2_1_sh_mask.h"
|
|
|
|
#include "soc15_common.h"
|
|
|
|
int gfxhub_v1_1_get_xgmi_info(struct amdgpu_device *adev)
|
|
{
|
|
u32 xgmi_lfb_cntl = RREG32_SOC15(GC, 0, mmMC_VM_XGMI_LFB_CNTL);
|
|
u32 max_region =
|
|
REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_MAX_REGION);
|
|
|
|
/* PF_MAX_REGION=0 means xgmi is disabled */
|
|
if (max_region) {
|
|
adev->gmc.xgmi.num_physical_nodes = max_region + 1;
|
|
if (adev->gmc.xgmi.num_physical_nodes > 4)
|
|
return -EINVAL;
|
|
|
|
adev->gmc.xgmi.physical_node_id =
|
|
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;
|
|
}
|