aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-28 20:49:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-28 20:49:53 -0400
commit53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8 (patch)
treeb29473f21270aefd113b298c9402be8b4b3c91b4 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent746bb4ed6d626f3f9e431a7f9b20504538e62ded (diff)
parentf2bfc71aee75feff33ca659322b72ffeed5a243d (diff)
Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie: "This is going to rebuild more than drm as it adds a new helper to list.h for doing bulk updates. Seemed like a reasonable addition to me. Otherwise the usual merge window stuff lots of i915 and amdgpu, not so much nouveau, and piles of everything else. Core: - Adds a new list.h helper for doing bulk list updates for TTM. - Don't leak fb address in smem_start to userspace (comes with EXPORT workaround for people using mali out of tree hacks) - udmabuf device to turn memfd regions into dma-buf - Per-plane blend mode property - ref/unref replacements with get/put - fbdev conflicting framebuffers code cleaned up - host-endian format variants - panel orientation quirk for Acer One 10 bridge: - TI SN65DSI86 chip support vkms: - GEM support. - Cursor support amdgpu: - Merge amdkfd and amdgpu into one module - CEC over DP AUX support - Picasso APU support + VCN dynamic powergating - Raven2 APU support - Vega20 enablement + kfd support - ACP powergating improvements - ABGR/XBGR display support - VCN jpeg support - xGMI support - DC i2c/aux cleanup - Ycbcr 4:2:0 support - GPUVM improvements - Powerplay and powerplay endian fixes - Display underflow fixes vmwgfx: - Move vmwgfx specific TTM code to vmwgfx - Split out vmwgfx buffer/resource validation code - Atomic operation rework bochs: - use more helpers - format/byteorder improvements qxl: - use more helpers i915: - GGTT coherency getparam - Turn off resource streamer API - More Icelake enablement + DMC firmware - Full PPGTT for Ivybridge, Haswell and Valleyview - DDB distribution based on resolution - Limited range DP display support nouveau: - CEC over DP AUX support - Initial HDMI 2.0 support virtio-gpu: - vmap support for PRIME objects tegra: - Initial Tegra194 support - DMA/IOMMU integration fixes msm: - a6xx perf improvements + clock prefix - GPU preemption optimisations - a6xx devfreq support - cursor support rockchip: - PX30 support - rgb output interface support mediatek: - HDMI output support on mt2701 and mt7623 rcar-du: - Interlaced modes on Gen3 - LVDS on R8A77980 - D3 and E3 SoC support hisilicon: - misc fixes mxsfb: - runtime pm support sun4i: - R40 TCON support - Allwinner A64 support - R40 HDMI support omapdrm: - Driver rework changing display pipeline ordering to use common code - DMM memory barrier and irq fixes - Errata workarounds exynos: - out-bridge support for LVDS bridge driver - Samsung 16x16 tiled format support - Plane alpha and pixel blend mode support tilcdc: - suspend/resume update mali-dp: - misc updates" * tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits) firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake. drm/i915/icl: Fix signal_levels drm/i915/icl: Fix DDI/TC port clk_off bits drm/i915/icl: create function to identify combophy port drm/i915/gen9+: Fix initial readout for Y tiled framebuffers drm/i915: Large page offsets for pread/pwrite drm/i915/selftests: Disable shrinker across mmap-exhaustion drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode drm/i915: Fix intel_dp_mst_best_encoder() drm/i915: Skip vcpi allocation for MSTB ports that are gone drm/i915: Don't unset intel_connector->mst_port drm/i915: Only reset seqno if actually idle drm/i915: Use the correct crtc when sanitizing plane mapping drm/i915: Restore vblank interrupts earlier drm/i915: Check fb stride against plane max stride drm/amdgpu/vcn:Fix uninitialized symbol error drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003) drm/amd/amdgpu: Fix debugfs error handling drm/amdgpu: Update gc_9_0 golden settings. drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c558
1 files changed, 287 insertions, 271 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 39bf2ce548c6..1e4dd09a5072 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -62,6 +62,8 @@
62MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin"); 62MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
63MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin"); 63MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
64MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin"); 64MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");
65MODULE_FIRMWARE("amdgpu/picasso_gpu_info.bin");
66MODULE_FIRMWARE("amdgpu/raven2_gpu_info.bin");
65 67
66#define AMDGPU_RESUME_MS 2000 68#define AMDGPU_RESUME_MS 2000
67 69
@@ -652,71 +654,6 @@ void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb)
652} 654}
653 655
654/** 656/**
655 * amdgpu_device_vram_location - try to find VRAM location
656 *
657 * @adev: amdgpu device structure holding all necessary informations
658 * @mc: memory controller structure holding memory informations
659 * @base: base address at which to put VRAM
660 *
661 * Function will try to place VRAM at base address provided
662 * as parameter.
663 */
664void amdgpu_device_vram_location(struct amdgpu_device *adev,
665 struct amdgpu_gmc *mc, u64 base)
666{
667 uint64_t limit = (uint64_t)amdgpu_vram_limit << 20;
668
669 mc->vram_start = base;
670 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
671 if (limit && limit < mc->real_vram_size)
672 mc->real_vram_size = limit;
673 dev_info(adev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n",
674 mc->mc_vram_size >> 20, mc->vram_start,
675 mc->vram_end, mc->real_vram_size >> 20);
676}
677
678/**
679 * amdgpu_device_gart_location - try to find GART location
680 *
681 * @adev: amdgpu device structure holding all necessary informations
682 * @mc: memory controller structure holding memory informations
683 *
684 * Function will place try to place GART before or after VRAM.
685 *
686 * If GART size is bigger than space left then we ajust GART size.
687 * Thus function will never fails.
688 */
689void amdgpu_device_gart_location(struct amdgpu_device *adev,
690 struct amdgpu_gmc *mc)
691{
692 u64 size_af, size_bf;
693
694 mc->gart_size += adev->pm.smu_prv_buffer_size;
695
696 size_af = adev->gmc.mc_mask - mc->vram_end;
697 size_bf = mc->vram_start;
698 if (size_bf > size_af) {
699 if (mc->gart_size > size_bf) {
700 dev_warn(adev->dev, "limiting GART\n");
701 mc->gart_size = size_bf;
702 }
703 mc->gart_start = 0;
704 } else {
705 if (mc->gart_size > size_af) {
706 dev_warn(adev->dev, "limiting GART\n");
707 mc->gart_size = size_af;
708 }
709 /* VCE doesn't like it when BOs cross a 4GB segment, so align
710 * the GART base on a 4GB boundary as well.
711 */
712 mc->gart_start = ALIGN(mc->vram_end + 1, 0x100000000ULL);
713 }
714 mc->gart_end = mc->gart_start + mc->gart_size - 1;
715 dev_info(adev->dev, "GART: %lluM 0x%016llX - 0x%016llX\n",
716 mc->gart_size >> 20, mc->gart_start, mc->gart_end);
717}
718
719/**
720 * amdgpu_device_resize_fb_bar - try to resize FB BAR 657 * amdgpu_device_resize_fb_bar - try to resize FB BAR
721 * 658 *
722 * @adev: amdgpu_device pointer 659 * @adev: amdgpu_device pointer
@@ -1397,7 +1334,12 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
1397 chip_name = "vega12"; 1334 chip_name = "vega12";
1398 break; 1335 break;
1399 case CHIP_RAVEN: 1336 case CHIP_RAVEN:
1400 chip_name = "raven"; 1337 if (adev->rev_id >= 8)
1338 chip_name = "raven2";
1339 else if (adev->pdev->device == 0x15d8)
1340 chip_name = "picasso";
1341 else
1342 chip_name = "raven";
1401 break; 1343 break;
1402 } 1344 }
1403 1345
@@ -1551,6 +1493,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
1551 } 1493 }
1552 1494
1553 adev->powerplay.pp_feature = amdgpu_pp_feature_mask; 1495 adev->powerplay.pp_feature = amdgpu_pp_feature_mask;
1496 if (amdgpu_sriov_vf(adev))
1497 adev->powerplay.pp_feature &= ~PP_GFXOFF_MASK;
1554 1498
1555 for (i = 0; i < adev->num_ip_blocks; i++) { 1499 for (i = 0; i < adev->num_ip_blocks; i++) {
1556 if ((amdgpu_ip_block_mask & (1 << i)) == 0) { 1500 if ((amdgpu_ip_block_mask & (1 << i)) == 0) {
@@ -1581,6 +1525,92 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
1581 return 0; 1525 return 0;
1582} 1526}
1583 1527
1528static int amdgpu_device_ip_hw_init_phase1(struct amdgpu_device *adev)
1529{
1530 int i, r;
1531
1532 for (i = 0; i < adev->num_ip_blocks; i++) {
1533 if (!adev->ip_blocks[i].status.sw)
1534 continue;
1535 if (adev->ip_blocks[i].status.hw)
1536 continue;
1537 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON ||
1538 adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_IH) {
1539 r = adev->ip_blocks[i].version->funcs->hw_init(adev);
1540 if (r) {
1541 DRM_ERROR("hw_init of IP block <%s> failed %d\n",
1542 adev->ip_blocks[i].version->funcs->name, r);
1543 return r;
1544 }
1545 adev->ip_blocks[i].status.hw = true;
1546 }
1547 }
1548
1549 return 0;
1550}
1551
1552static int amdgpu_device_ip_hw_init_phase2(struct amdgpu_device *adev)
1553{
1554 int i, r;
1555
1556 for (i = 0; i < adev->num_ip_blocks; i++) {
1557 if (!adev->ip_blocks[i].status.sw)
1558 continue;
1559 if (adev->ip_blocks[i].status.hw)
1560 continue;
1561 r = adev->ip_blocks[i].version->funcs->hw_init(adev);
1562 if (r) {
1563 DRM_ERROR("hw_init of IP block <%s> failed %d\n",
1564 adev->ip_blocks[i].version->funcs->name, r);
1565 return r;
1566 }
1567 adev->ip_blocks[i].status.hw = true;
1568 }
1569
1570 return 0;
1571}
1572
1573static int amdgpu_device_fw_loading(struct amdgpu_device *adev)
1574{
1575 int r = 0;
1576 int i;
1577
1578 if (adev->asic_type >= CHIP_VEGA10) {
1579 for (i = 0; i < adev->num_ip_blocks; i++) {
1580 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_PSP) {
1581 if (adev->in_gpu_reset || adev->in_suspend) {
1582 if (amdgpu_sriov_vf(adev) && adev->in_gpu_reset)
1583