1*b843c749SSergey Zigachev /* 2*b843c749SSergey Zigachev * Copyright 2014 Advanced Micro Devices, Inc. 3*b843c749SSergey Zigachev * Copyright 2008 Red Hat Inc. 4*b843c749SSergey Zigachev * Copyright 2009 Jerome Glisse. 5*b843c749SSergey Zigachev * 6*b843c749SSergey Zigachev * Permission is hereby granted, free of charge, to any person obtaining a 7*b843c749SSergey Zigachev * copy of this software and associated documentation files (the "Software"), 8*b843c749SSergey Zigachev * to deal in the Software without restriction, including without limitation 9*b843c749SSergey Zigachev * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10*b843c749SSergey Zigachev * and/or sell copies of the Software, and to permit persons to whom the 11*b843c749SSergey Zigachev * Software is furnished to do so, subject to the following conditions: 12*b843c749SSergey Zigachev * 13*b843c749SSergey Zigachev * The above copyright notice and this permission notice shall be included in 14*b843c749SSergey Zigachev * all copies or substantial portions of the Software. 15*b843c749SSergey Zigachev * 16*b843c749SSergey Zigachev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17*b843c749SSergey Zigachev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18*b843c749SSergey Zigachev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19*b843c749SSergey Zigachev * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20*b843c749SSergey Zigachev * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21*b843c749SSergey Zigachev * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22*b843c749SSergey Zigachev * OTHER DEALINGS IN THE SOFTWARE. 23*b843c749SSergey Zigachev * 24*b843c749SSergey Zigachev */ 25*b843c749SSergey Zigachev #include <drm/drmP.h> 26*b843c749SSergey Zigachev #include "amdgpu.h" 27*b843c749SSergey Zigachev #include "amdgpu_gfx.h" 28*b843c749SSergey Zigachev 29*b843c749SSergey Zigachev /* 30*b843c749SSergey Zigachev * GPU scratch registers helpers function. 31*b843c749SSergey Zigachev */ 32*b843c749SSergey Zigachev /** 33*b843c749SSergey Zigachev * amdgpu_gfx_scratch_get - Allocate a scratch register 34*b843c749SSergey Zigachev * 35*b843c749SSergey Zigachev * @adev: amdgpu_device pointer 36*b843c749SSergey Zigachev * @reg: scratch register mmio offset 37*b843c749SSergey Zigachev * 38*b843c749SSergey Zigachev * Allocate a CP scratch register for use by the driver (all asics). 39*b843c749SSergey Zigachev * Returns 0 on success or -EINVAL on failure. 40*b843c749SSergey Zigachev */ 41*b843c749SSergey Zigachev int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg) 42*b843c749SSergey Zigachev { 43*b843c749SSergey Zigachev int i; 44*b843c749SSergey Zigachev 45*b843c749SSergey Zigachev i = ffs(adev->gfx.scratch.free_mask); 46*b843c749SSergey Zigachev if (i != 0 && i <= adev->gfx.scratch.num_reg) { 47*b843c749SSergey Zigachev i--; 48*b843c749SSergey Zigachev adev->gfx.scratch.free_mask &= ~(1u << i); 49*b843c749SSergey Zigachev *reg = adev->gfx.scratch.reg_base + i; 50*b843c749SSergey Zigachev return 0; 51*b843c749SSergey Zigachev } 52*b843c749SSergey Zigachev return -EINVAL; 53*b843c749SSergey Zigachev } 54*b843c749SSergey Zigachev 55*b843c749SSergey Zigachev /** 56*b843c749SSergey Zigachev * amdgpu_gfx_scratch_free - Free a scratch register 57*b843c749SSergey Zigachev * 58*b843c749SSergey Zigachev * @adev: amdgpu_device pointer 59*b843c749SSergey Zigachev * @reg: scratch register mmio offset 60*b843c749SSergey Zigachev * 61*b843c749SSergey Zigachev * Free a CP scratch register allocated for use by the driver (all asics) 62*b843c749SSergey Zigachev */ 63*b843c749SSergey Zigachev void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg) 64*b843c749SSergey Zigachev { 65*b843c749SSergey Zigachev adev->gfx.scratch.free_mask |= 1u << (reg - adev->gfx.scratch.reg_base); 66*b843c749SSergey Zigachev } 67*b843c749SSergey Zigachev 68*b843c749SSergey Zigachev /** 69*b843c749SSergey Zigachev * amdgpu_gfx_parse_disable_cu - Parse the disable_cu module parameter 70*b843c749SSergey Zigachev * 71*b843c749SSergey Zigachev * @mask: array in which the per-shader array disable masks will be stored 72*b843c749SSergey Zigachev * @max_se: number of SEs 73*b843c749SSergey Zigachev * @max_sh: number of SHs 74*b843c749SSergey Zigachev * 75*b843c749SSergey Zigachev * The bitmask of CUs to be disabled in the shader array determined by se and 76*b843c749SSergey Zigachev * sh is stored in mask[se * max_sh + sh]. 77*b843c749SSergey Zigachev */ 78*b843c749SSergey Zigachev void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh) 79*b843c749SSergey Zigachev { 80*b843c749SSergey Zigachev unsigned se, sh, cu; 81*b843c749SSergey Zigachev const char *p; 82*b843c749SSergey Zigachev 83*b843c749SSergey Zigachev memset(mask, 0, sizeof(*mask) * max_se * max_sh); 84*b843c749SSergey Zigachev 85*b843c749SSergey Zigachev if (!amdgpu_disable_cu || !*amdgpu_disable_cu) 86*b843c749SSergey Zigachev return; 87*b843c749SSergey Zigachev 88*b843c749SSergey Zigachev p = amdgpu_disable_cu; 89*b843c749SSergey Zigachev for (;;) { 90*b843c749SSergey Zigachev char *next; 91*b843c749SSergey Zigachev int ret = sscanf(p, "%u.%u.%u", &se, &sh, &cu); 92*b843c749SSergey Zigachev if (ret < 3) { 93*b843c749SSergey Zigachev DRM_ERROR("amdgpu: could not parse disable_cu\n"); 94*b843c749SSergey Zigachev return; 95*b843c749SSergey Zigachev } 96*b843c749SSergey Zigachev 97*b843c749SSergey Zigachev if (se < max_se && sh < max_sh && cu < 16) { 98*b843c749SSergey Zigachev DRM_INFO("amdgpu: disabling CU %u.%u.%u\n", se, sh, cu); 99*b843c749SSergey Zigachev mask[se * max_sh + sh] |= 1u << cu; 100*b843c749SSergey Zigachev } else { 101*b843c749SSergey Zigachev DRM_ERROR("amdgpu: disable_cu %u.%u.%u is out of range\n", 102*b843c749SSergey Zigachev se, sh, cu); 103*b843c749SSergey Zigachev } 104*b843c749SSergey Zigachev 105*b843c749SSergey Zigachev next = strchr(p, ','); 106*b843c749SSergey Zigachev if (!next) 107*b843c749SSergey Zigachev break; 108*b843c749SSergey Zigachev p = next + 1; 109*b843c749SSergey Zigachev } 110*b843c749SSergey Zigachev } 111*b843c749SSergey Zigachev 112*b843c749SSergey Zigachev static bool amdgpu_gfx_is_multipipe_capable(struct amdgpu_device *adev) 113*b843c749SSergey Zigachev { 114*b843c749SSergey Zigachev if (amdgpu_compute_multipipe != -1) { 115*b843c749SSergey Zigachev DRM_INFO("amdgpu: forcing compute pipe policy %d\n", 116*b843c749SSergey Zigachev amdgpu_compute_multipipe); 117*b843c749SSergey Zigachev return amdgpu_compute_multipipe == 1; 118*b843c749SSergey Zigachev } 119*b843c749SSergey Zigachev 120*b843c749SSergey Zigachev /* FIXME: spreading the queues across pipes causes perf regressions 121*b843c749SSergey Zigachev * on POLARIS11 compute workloads */ 122*b843c749SSergey Zigachev if (adev->asic_type == CHIP_POLARIS11) 123*b843c749SSergey Zigachev return false; 124*b843c749SSergey Zigachev 125*b843c749SSergey Zigachev return adev->gfx.mec.num_mec > 1; 126*b843c749SSergey Zigachev } 127*b843c749SSergey Zigachev 128*b843c749SSergey Zigachev void amdgpu_gfx_compute_queue_acquire(struct amdgpu_device *adev) 129*b843c749SSergey Zigachev { 130*b843c749SSergey Zigachev int i, queue, pipe, mec; 131*b843c749SSergey Zigachev bool multipipe_policy = amdgpu_gfx_is_multipipe_capable(adev); 132*b843c749SSergey Zigachev 133*b843c749SSergey Zigachev /* policy for amdgpu compute queue ownership */ 134*b843c749SSergey Zigachev for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) { 135*b843c749SSergey Zigachev queue = i % adev->gfx.mec.num_queue_per_pipe; 136*b843c749SSergey Zigachev pipe = (i / adev->gfx.mec.num_queue_per_pipe) 137*b843c749SSergey Zigachev % adev->gfx.mec.num_pipe_per_mec; 138*b843c749SSergey Zigachev mec = (i / adev->gfx.mec.num_queue_per_pipe) 139*b843c749SSergey Zigachev / adev->gfx.mec.num_pipe_per_mec; 140*b843c749SSergey Zigachev 141*b843c749SSergey Zigachev /* we've run out of HW */ 142*b843c749SSergey Zigachev if (mec >= adev->gfx.mec.num_mec) 143*b843c749SSergey Zigachev break; 144*b843c749SSergey Zigachev 145*b843c749SSergey Zigachev if (multipipe_policy) { 146*b843c749SSergey Zigachev /* policy: amdgpu owns the first two queues of the first MEC */ 147*b843c749SSergey Zigachev if (mec == 0 && queue < 2) 148*b843c749SSergey Zigachev set_bit(i, adev->gfx.mec.queue_bitmap); 149*b843c749SSergey Zigachev } else { 150*b843c749SSergey Zigachev /* policy: amdgpu owns all queues in the first pipe */ 151*b843c749SSergey Zigachev if (mec == 0 && pipe == 0) 152*b843c749SSergey Zigachev set_bit(i, adev->gfx.mec.queue_bitmap); 153*b843c749SSergey Zigachev } 154*b843c749SSergey Zigachev } 155*b843c749SSergey Zigachev 156*b843c749SSergey Zigachev /* update the number of active compute rings */ 157*b843c749SSergey Zigachev adev->gfx.num_compute_rings = 158*b843c749SSergey Zigachev bitmap_weight(adev->gfx.mec.queue_bitmap, AMDGPU_MAX_COMPUTE_QUEUES); 159*b843c749SSergey Zigachev 160*b843c749SSergey Zigachev /* If you hit this case and edited the policy, you probably just 161*b843c749SSergey Zigachev * need to increase AMDGPU_MAX_COMPUTE_RINGS */ 162*b843c749SSergey Zigachev if (WARN_ON(adev->gfx.num_compute_rings > AMDGPU_MAX_COMPUTE_RINGS)) 163*b843c749SSergey Zigachev adev->gfx.num_compute_rings = AMDGPU_MAX_COMPUTE_RINGS; 164*b843c749SSergey Zigachev } 165*b843c749SSergey Zigachev 166*b843c749SSergey Zigachev static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, 167*b843c749SSergey Zigachev struct amdgpu_ring *ring) 168*b843c749SSergey Zigachev { 169*b843c749SSergey Zigachev int queue_bit; 170*b843c749SSergey Zigachev int mec, pipe, queue; 171*b843c749SSergey Zigachev 172*b843c749SSergey Zigachev queue_bit = adev->gfx.mec.num_mec 173*b843c749SSergey Zigachev * adev->gfx.mec.num_pipe_per_mec 174*b843c749SSergey Zigachev * adev->gfx.mec.num_queue_per_pipe; 175*b843c749SSergey Zigachev 176*b843c749SSergey Zigachev while (queue_bit-- >= 0) { 177*b843c749SSergey Zigachev if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap)) 178*b843c749SSergey Zigachev continue; 179*b843c749SSergey Zigachev 180*b843c749SSergey Zigachev amdgpu_gfx_bit_to_queue(adev, queue_bit, &mec, &pipe, &queue); 181*b843c749SSergey Zigachev 182*b843c749SSergey Zigachev /* 183*b843c749SSergey Zigachev * 1. Using pipes 2/3 from MEC 2 seems cause problems. 184*b843c749SSergey Zigachev * 2. It must use queue id 0, because CGPG_IDLE/SAVE/LOAD/RUN 185*b843c749SSergey Zigachev * only can be issued on queue 0. 186*b843c749SSergey Zigachev */ 187*b843c749SSergey Zigachev if ((mec == 1 && pipe > 1) || queue != 0) 188*b843c749SSergey Zigachev continue; 189*b843c749SSergey Zigachev 190*b843c749SSergey Zigachev ring->me = mec + 1; 191*b843c749SSergey Zigachev ring->pipe = pipe; 192*b843c749SSergey Zigachev ring->queue = queue; 193*b843c749SSergey Zigachev 194*b843c749SSergey Zigachev return 0; 195*b843c749SSergey Zigachev } 196*b843c749SSergey Zigachev 197*b843c749SSergey Zigachev dev_err(adev->dev, "Failed to find a queue for KIQ\n"); 198*b843c749SSergey Zigachev return -EINVAL; 199*b843c749SSergey Zigachev } 200*b843c749SSergey Zigachev 201*b843c749SSergey Zigachev int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, 202*b843c749SSergey Zigachev struct amdgpu_ring *ring, 203*b843c749SSergey Zigachev struct amdgpu_irq_src *irq) 204*b843c749SSergey Zigachev { 205*b843c749SSergey Zigachev struct amdgpu_kiq *kiq = &adev->gfx.kiq; 206*b843c749SSergey Zigachev int r = 0; 207*b843c749SSergey Zigachev 208*b843c749SSergey Zigachev spin_lock_init(&kiq->ring_lock); 209*b843c749SSergey Zigachev 210*b843c749SSergey Zigachev r = amdgpu_device_wb_get(adev, &adev->virt.reg_val_offs); 211*b843c749SSergey Zigachev if (r) 212*b843c749SSergey Zigachev return r; 213*b843c749SSergey Zigachev 214*b843c749SSergey Zigachev ring->adev = NULL; 215*b843c749SSergey Zigachev ring->ring_obj = NULL; 216*b843c749SSergey Zigachev ring->use_doorbell = true; 217*b843c749SSergey Zigachev ring->doorbell_index = AMDGPU_DOORBELL_KIQ; 218*b843c749SSergey Zigachev 219*b843c749SSergey Zigachev r = amdgpu_gfx_kiq_acquire(adev, ring); 220*b843c749SSergey Zigachev if (r) 221*b843c749SSergey Zigachev return r; 222*b843c749SSergey Zigachev 223*b843c749SSergey Zigachev ring->eop_gpu_addr = kiq->eop_gpu_addr; 224*b843c749SSergey Zigachev sprintf(ring->name, "kiq_%d.%d.%d", ring->me, ring->pipe, ring->queue); 225*b843c749SSergey Zigachev r = amdgpu_ring_init(adev, ring, 1024, 226*b843c749SSergey Zigachev irq, AMDGPU_CP_KIQ_IRQ_DRIVER0); 227*b843c749SSergey Zigachev if (r) 228*b843c749SSergey Zigachev dev_warn(adev->dev, "(%d) failed to init kiq ring\n", r); 229*b843c749SSergey Zigachev 230*b843c749SSergey Zigachev return r; 231*b843c749SSergey Zigachev } 232*b843c749SSergey Zigachev 233*b843c749SSergey Zigachev void amdgpu_gfx_kiq_free_ring(struct amdgpu_ring *ring, 234*b843c749SSergey Zigachev struct amdgpu_irq_src *irq) 235*b843c749SSergey Zigachev { 236*b843c749SSergey Zigachev amdgpu_device_wb_free(ring->adev, ring->adev->virt.reg_val_offs); 237*b843c749SSergey Zigachev amdgpu_ring_fini(ring); 238*b843c749SSergey Zigachev } 239*b843c749SSergey Zigachev 240*b843c749SSergey Zigachev void amdgpu_gfx_kiq_fini(struct amdgpu_device *adev) 241*b843c749SSergey Zigachev { 242*b843c749SSergey Zigachev struct amdgpu_kiq *kiq = &adev->gfx.kiq; 243*b843c749SSergey Zigachev 244*b843c749SSergey Zigachev amdgpu_bo_free_kernel(&kiq->eop_obj, &kiq->eop_gpu_addr, NULL); 245*b843c749SSergey Zigachev } 246*b843c749SSergey Zigachev 247*b843c749SSergey Zigachev int amdgpu_gfx_kiq_init(struct amdgpu_device *adev, 248*b843c749SSergey Zigachev unsigned hpd_size) 249*b843c749SSergey Zigachev { 250*b843c749SSergey Zigachev int r; 251*b843c749SSergey Zigachev u32 *hpd; 252*b843c749SSergey Zigachev struct amdgpu_kiq *kiq = &adev->gfx.kiq; 253*b843c749SSergey Zigachev 254*b843c749SSergey Zigachev r = amdgpu_bo_create_kernel(adev, hpd_size, PAGE_SIZE, 255*b843c749SSergey Zigachev AMDGPU_GEM_DOMAIN_GTT, &kiq->eop_obj, 256*b843c749SSergey Zigachev &kiq->eop_gpu_addr, (void **)&hpd); 257*b843c749SSergey Zigachev if (r) { 258*b843c749SSergey Zigachev dev_warn(adev->dev, "failed to create KIQ bo (%d).\n", r); 259*b843c749SSergey Zigachev return r; 260*b843c749SSergey Zigachev } 261*b843c749SSergey Zigachev 262*b843c749SSergey Zigachev memset(hpd, 0, hpd_size); 263*b843c749SSergey Zigachev 264*b843c749SSergey Zigachev r = amdgpu_bo_reserve(kiq->eop_obj, true); 265*b843c749SSergey Zigachev if (unlikely(r != 0)) 266*b843c749SSergey Zigachev dev_warn(adev->dev, "(%d) reserve kiq eop bo failed\n", r); 267*b843c749SSergey Zigachev amdgpu_bo_kunmap(kiq->eop_obj); 268*b843c749SSergey Zigachev amdgpu_bo_unreserve(kiq->eop_obj); 269*b843c749SSergey Zigachev 270*b843c749SSergey Zigachev return 0; 271*b843c749SSergey Zigachev } 272*b843c749SSergey Zigachev 273*b843c749SSergey Zigachev /* create MQD for each compute queue */ 274*b843c749SSergey Zigachev int amdgpu_gfx_compute_mqd_sw_init(struct amdgpu_device *adev, 275*b843c749SSergey Zigachev unsigned mqd_size) 276*b843c749SSergey Zigachev { 277*b843c749SSergey Zigachev struct amdgpu_ring *ring = NULL; 278*b843c749SSergey Zigachev int r, i; 279*b843c749SSergey Zigachev 280*b843c749SSergey Zigachev /* create MQD for KIQ */ 281*b843c749SSergey Zigachev ring = &adev->gfx.kiq.ring; 282*b843c749SSergey Zigachev if (!ring->mqd_obj) { 283*b843c749SSergey Zigachev /* originaly the KIQ MQD is put in GTT domain, but for SRIOV VRAM domain is a must 284*b843c749SSergey Zigachev * otherwise hypervisor trigger SAVE_VF fail after driver unloaded which mean MQD 285*b843c749SSergey Zigachev * deallocated and gart_unbind, to strict diverage we decide to use VRAM domain for 286*b843c749SSergey Zigachev * KIQ MQD no matter SRIOV or Bare-metal 287*b843c749SSergey Zigachev */ 288*b843c749SSergey Zigachev r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE, 289*b843c749SSergey Zigachev AMDGPU_GEM_DOMAIN_VRAM, &ring->mqd_obj, 290*b843c749SSergey Zigachev &ring->mqd_gpu_addr, &ring->mqd_ptr); 291*b843c749SSergey Zigachev if (r) { 292*b843c749SSergey Zigachev dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r); 293*b843c749SSergey Zigachev return r; 294*b843c749SSergey Zigachev } 295*b843c749SSergey Zigachev 296*b843c749SSergey Zigachev /* prepare MQD backup */ 297*b843c749SSergey Zigachev adev->gfx.mec.mqd_backup[AMDGPU_MAX_COMPUTE_RINGS] = kmalloc(mqd_size, GFP_KERNEL); 298*b843c749SSergey Zigachev if (!adev->gfx.mec.mqd_backup[AMDGPU_MAX_COMPUTE_RINGS]) 299*b843c749SSergey Zigachev dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name); 300*b843c749SSergey Zigachev } 301*b843c749SSergey Zigachev 302*b843c749SSergey Zigachev /* create MQD for each KCQ */ 303*b843c749SSergey Zigachev for (i = 0; i < adev->gfx.num_compute_rings; i++) { 304*b843c749SSergey Zigachev ring = &adev->gfx.compute_ring[i]; 305*b843c749SSergey Zigachev if (!ring->mqd_obj) { 306*b843c749SSergey Zigachev r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE, 307*b843c749SSergey Zigachev AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj, 308*b843c749SSergey Zigachev &ring->mqd_gpu_addr, &ring->mqd_ptr); 309*b843c749SSergey Zigachev if (r) { 310*b843c749SSergey Zigachev dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r); 311*b843c749SSergey Zigachev return r; 312*b843c749SSergey Zigachev } 313*b843c749SSergey Zigachev 314*b843c749SSergey Zigachev /* prepare MQD backup */ 315*b843c749SSergey Zigachev adev->gfx.mec.mqd_backup[i] = kmalloc(mqd_size, GFP_KERNEL); 316*b843c749SSergey Zigachev if (!adev->gfx.mec.mqd_backup[i]) 317*b843c749SSergey Zigachev dev_warn(adev->dev, "no memory to create MQD backup for ring %s\n", ring->name); 318*b843c749SSergey Zigachev } 319*b843c749SSergey Zigachev } 320*b843c749SSergey Zigachev 321*b843c749SSergey Zigachev return 0; 322*b843c749SSergey Zigachev } 323*b843c749SSergey Zigachev 324*b843c749SSergey Zigachev void amdgpu_gfx_compute_mqd_sw_fini(struct amdgpu_device *adev) 325*b843c749SSergey Zigachev { 326*b843c749SSergey Zigachev struct amdgpu_ring *ring = NULL; 327*b843c749SSergey Zigachev int i; 328*b843c749SSergey Zigachev 329*b843c749SSergey Zigachev for (i = 0; i < adev->gfx.num_compute_rings; i++) { 330*b843c749SSergey Zigachev ring = &adev->gfx.compute_ring[i]; 331*b843c749SSergey Zigachev kfree(adev->gfx.mec.mqd_backup[i]); 332*b843c749SSergey Zigachev amdgpu_bo_free_kernel(&ring->mqd_obj, 333*b843c749SSergey Zigachev &ring->mqd_gpu_addr, 334*b843c749SSergey Zigachev &ring->mqd_ptr); 335*b843c749SSergey Zigachev } 336*b843c749SSergey Zigachev 337*b843c749SSergey Zigachev ring = &adev->gfx.kiq.ring; 338*b843c749SSergey Zigachev kfree(adev->gfx.mec.mqd_backup[AMDGPU_MAX_COMPUTE_RINGS]); 339*b843c749SSergey Zigachev amdgpu_bo_free_kernel(&ring->mqd_obj, 340*b843c749SSergey Zigachev &ring->mqd_gpu_addr, 341*b843c749SSergey Zigachev &ring->mqd_ptr); 342*b843c749SSergey Zigachev } 343