From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, shaoyun liu <shaoyun.liu@amd.com>,
Felix Kuehling <Felix.Kuehling@amd.com>,
Oded Gabbay <oded.gabbay@gmail.com>,
Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.4 30/67] drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode
Date: Fri, 2 Feb 2018 17:57:59 +0100 [thread overview]
Message-ID: <20180202140818.934236769@linuxfoundation.org> (raw)
In-Reply-To: <20180202140815.091718203@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <Felix.Kuehling@amd.com>
[ Upstream commit cf21654b40968609779751b34e7923180968fe5b ]
Fix the SDMA load and unload sequence as suggested by HW document.
Signed-off-by: shaoyun liu <shaoyun.liu@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 47 +++++++++++++++-------
1 file changed, 34 insertions(+), 13 deletions(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
@@ -367,29 +367,50 @@ static int kgd_hqd_sdma_load(struct kgd_
{
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct cik_sdma_rlc_registers *m;
+ unsigned long end_jiffies;
uint32_t sdma_base_addr;
+ uint32_t data;
m = get_sdma_mqd(mqd);
sdma_base_addr = get_sdma_base_addr(m);
- WREG32(sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR,
- m->sdma_rlc_virtual_addr);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
+ m->sdma_rlc_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK));
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE,
- m->sdma_rlc_rb_base);
+ end_jiffies = msecs_to_jiffies(2000) + jiffies;
+ while (true) {
+ data = RREG32(sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS);
+ if (data & SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK)
+ break;
+ if (time_after(jiffies, end_jiffies))
+ return -ETIME;
+ usleep_range(500, 1000);
+ }
+ if (m->sdma_engine_id) {
+ data = RREG32(mmSDMA1_GFX_CONTEXT_CNTL);
+ data = REG_SET_FIELD(data, SDMA1_GFX_CONTEXT_CNTL,
+ RESUME_CTX, 0);
+ WREG32(mmSDMA1_GFX_CONTEXT_CNTL, data);
+ } else {
+ data = RREG32(mmSDMA0_GFX_CONTEXT_CNTL);
+ data = REG_SET_FIELD(data, SDMA0_GFX_CONTEXT_CNTL,
+ RESUME_CTX, 0);
+ WREG32(mmSDMA0_GFX_CONTEXT_CNTL, data);
+ }
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL,
+ m->sdma_rlc_doorbell);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, 0);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR, 0);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR,
+ m->sdma_rlc_virtual_addr);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdma_rlc_rb_base);
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI,
m->sdma_rlc_rb_base_hi);
-
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO,
m->sdma_rlc_rb_rptr_addr_lo);
-
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI,
m->sdma_rlc_rb_rptr_addr_hi);
-
- WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL,
- m->sdma_rlc_doorbell);
-
WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
m->sdma_rlc_rb_cntl);
@@ -492,9 +513,9 @@ static int kgd_hqd_sdma_destroy(struct k
}
WREG32(sdma_base_addr + mmSDMA0_RLC0_DOORBELL, 0);
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_RPTR, 0);
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_WPTR, 0);
- WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_BASE, 0);
+ WREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL,
+ RREG32(sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) |
+ SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK);
return 0;
}
next prev parent reply other threads:[~2018-02-02 17:02 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 16:57 [PATCH 4.4 00/67] 4.4.115-stable review Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 02/67] bpf: fix branch pruning logic Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 03/67] x86: bpf_jit: small optimization in emit_bpf_tail_call() Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 04/67] bpf: fix bpf_tail_call() x64 JIT Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 05/67] bpf: introduce BPF_JIT_ALWAYS_ON config Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 06/67] bpf: arsh is not supported in 32 bit alu thus reject it Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 07/67] bpf: avoid false sharing of map refcount with max_entries Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 08/67] bpf: fix divides by zero Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 09/67] bpf: fix 32-bit divide " Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 10/67] bpf: reject stores into ctx via st and xadd Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 11/67] x86/pti: Make unpoison of pgd for trusted boot work for real Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 13/67] ALSA: seq: Make ioctls race-free Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 14/67] crypto: aesni - handle zero length dst buffer Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 15/67] crypto: af_alg - whitelist mask and type Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 16/67] power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 17/67] gpio: iop: " Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 18/67] gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 19/67] mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 20/67] igb: Free IRQs when device is hotplugged Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 27/67] ACPI / bus: Leave modalias empty for devices which are not present Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 28/67] cpufreq: Add Loongson machine dependencies Greg Kroah-Hartman
2018-02-02 16:57 ` [PATCH 4.4 29/67] bcache: check return value of register_shrinker Greg Kroah-Hartman
2018-02-02 16:57 ` Greg Kroah-Hartman [this message]
2018-02-02 16:58 ` [PATCH 4.4 31/67] drm/amdkfd: Fix SDMA ring buffer size calculation Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 32/67] drm/amdkfd: Fix SDMA oversubsription handling Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 33/67] openvswitch: fix the incorrect flow action alloc size Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 34/67] mac80211: fix the update of path metric for RANN frame Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 35/67] btrfs: fix deadlock when writing out space cache Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 37/67] xen-netfront: remove warning when unloading module Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 38/67] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 39/67] nfsd: Ensure we check stateid validity in the seqid operation checks Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 40/67] grace: replace BUG_ON by WARN_ONCE in exit_net hook Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 41/67] nfsd: check for use of the closed special stateid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 42/67] lockd: fix "list_add double add" caused by legacy signal interface Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 43/67] hwmon: (pmbus) Use 64bit math for DIRECT format values Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 44/67] net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 45/67] quota: Check for register_shrinker() failure Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 46/67] SUNRPC: Allow connect to return EHOSTUNREACH Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 47/67] kmemleak: add scheduling point to kmemleak_scan() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 48/67] drm/omap: Fix error handling path in omap_dmm_probe() Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 49/67] xfs: ubsan fixes Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 50/67] scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 51/67] scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 52/67] media: usbtv: add a new usbid Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 53/67] usb: gadget: dont dereference g until after it has been null checked Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 54/67] staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 55/67] usb: option: Add support for FS040U modem Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 57/67] USB: cdc-acm: Do not log urb submission errors on disconnect Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 58/67] CDC-ACM: apply quirk for card reader Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 59/67] USB: serial: io_edgeport: fix possible sleep-in-atomic Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 60/67] usbip: prevent bind loops on devices attached to vhci_hcd Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 61/67] usbip: list: dont list " Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 62/67] USB: serial: simple: add Motorola Tetra driver Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 63/67] usb: f_fs: Prevent gadget unbind if it is already unbound Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 64/67] usb: uas: unconditionally bring back host after reset Greg Kroah-Hartman
2018-03-03 0:19 ` Ben Hutchings
2018-03-03 9:14 ` Hans de Goede
2018-02-02 16:58 ` [PATCH 4.4 65/67] selinux: general protection fault in sock_has_perm Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 66/67] serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS Greg Kroah-Hartman
2018-02-02 16:58 ` [PATCH 4.4 67/67] spi: imx: do not access registers while clocks disabled Greg Kroah-Hartman
2018-02-02 18:40 ` [PATCH 4.4 00/67] 4.4.115-stable review Nathan Chancellor
2018-02-03 5:18 ` Greg Kroah-Hartman
2018-02-02 22:20 ` Shuah Khan
2018-02-02 22:33 ` Dan Rue
2018-02-03 15:28 ` Guenter Roeck
2018-02-03 15:44 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180202140818.934236769@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Felix.Kuehling@amd.com \
--cc=alexander.levin@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oded.gabbay@gmail.com \
--cc=shaoyun.liu@amd.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).