diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-04-21 09:36:11 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-04-21 09:36:11 +0000 |
commit | bc8e0a381c6a1847d3b3f08c0f87843deb2eea0a (patch) | |
tree | bbd11c6840670a9532af0f2a38d9d782180885f1 /sys | |
parent | 6fb7e10d01a48a4fdb84e32330ab3287876dff28 (diff) |
drm/amdgpu/gmc: use PCI BARs for APUs in passthrough
From Alex Deucher
37bc29a445384f4bdfc734dfe7f763ede604acfe in linux 5.15.y/5.15.35
b818a5d374542ccec73dcfe578a081574029820e in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v7_0.c | 5 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v8_0.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index d00a7c9c5f0..48a805c8297 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -5750,7 +5750,7 @@ void amdgpu_device_flush_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring) { #ifdef CONFIG_X86_64 - if (adev->flags & AMD_IS_APU) + if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) return; #endif if (adev->gmc.xgmi.connected_to_cpu) @@ -5766,7 +5766,7 @@ void amdgpu_device_invalidate_hdp(struct amdgpu_device *adev, struct amdgpu_ring *ring) { #ifdef CONFIG_X86_64 - if (adev->flags & AMD_IS_APU) + if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) return; #endif if (adev->gmc.xgmi.connected_to_cpu) diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c index 61b14fa2aa6..ad50e03161e 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c @@ -788,7 +788,7 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev) adev->gmc.aper_size = adev->fb_aper_size; #ifdef CONFIG_X86_64 - if (adev->flags & AMD_IS_APU) { + if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) { adev->gmc.aper_base = adev->gfxhub.funcs->get_mc_fb_offset(adev); adev->gmc.aper_size = adev->gmc.real_vram_size; } diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v7_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v7_0.c index c05c215a9d8..4e0a361f5fa 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v7_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v7_0.c @@ -381,8 +381,9 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev) adev->gmc.aper_size = adev->fb_aper_size; #ifdef CONFIG_X86_64 - if (adev->flags & AMD_IS_APU && - adev->gmc.real_vram_size > adev->gmc.aper_size) { + if ((adev->flags & AMD_IS_APU) && + adev->gmc.real_vram_size > adev->gmc.aper_size && + !amdgpu_passthrough(adev)) { adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22; adev->gmc.aper_size = adev->gmc.real_vram_size; } diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v8_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v8_0.c index 587206dd388..77b8d7608ad 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v8_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v8_0.c @@ -581,7 +581,7 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev) adev->gmc.aper_size = adev->fb_aper_size; #ifdef CONFIG_X86_64 - if (adev->flags & AMD_IS_APU) { + if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) { adev->gmc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22; adev->gmc.aper_size = adev->gmc.real_vram_size; } diff --git a/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c b/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c index d5491e710b2..bf4ddb129b2 100644 --- a/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c @@ -1387,7 +1387,7 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) */ /* check whether both host-gpu and gpu-gpu xgmi links exist */ - if ((adev->flags & AMD_IS_APU) || + if (((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) || (adev->gmc.xgmi.supported && adev->gmc.xgmi.connected_to_cpu)) { adev->gmc.aper_base = |