From patchwork Thu Dec 5 00:05:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 3285871 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1343D9F373 for ; Thu, 5 Dec 2013 00:05:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EEE7204FF for ; Thu, 5 Dec 2013 00:05:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B6FB8201ED for ; Thu, 5 Dec 2013 00:05:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2586CFB976; Wed, 4 Dec 2013 16:05:39 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 27A2CFB94F for ; Wed, 4 Dec 2013 16:05:37 -0800 (PST) Received: by mail-ve0-f169.google.com with SMTP id c14so13309944vea.28 for ; Wed, 04 Dec 2013 16:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=H36UL4/edQ5CPCiFjAL7EymMA1xXf96axpXoPccyBCg=; b=FNEDrZwGDajQvMupAxNbXrOGUvgi8zV/8vC2c9dNVfyVFT8TbpLtNlNAqctiShdq+L 4S7mfjp0m/utiHf7I4VwhAnj1MzydvRA5W96ssvCJdrqI6aPiAr9YmCvykCxcRGVYalc pBHsOmO4I959v5n9ik/YbLMEQl2T0G18VpxXHfKWfDyIPOKeoGR3uCXdfE00gWIgVG49 fsJy9NtkHY1TAlBnMVOY1Uv5HNjnYTwcEYD/LwgoC+ni/nKjmfiKpkAoo7Qkv2aT3Bcc hsC8hFRl2AwIru8FFUc++zvsGOSqLsFv0TOW/n4BuzFdd/JoNPcZHEN5YTH+6Tpg4/hm gMDg== MIME-Version: 1.0 X-Received: by 10.221.47.193 with SMTP id ut1mr60966839vcb.8.1386201936737; Wed, 04 Dec 2013 16:05:36 -0800 (PST) Received: by 10.58.19.132 with HTTP; Wed, 4 Dec 2013 16:05:36 -0800 (PST) In-Reply-To: References: <1371477978-25440-1-git-send-email-ajax@redhat.com> <1371485240.13840.78.camel@localhost> <1383863356.4776.202.camel@pasglop> <527CEA7D.4060704@linux.vnet.ibm.com> <1385334947.4882.153.camel@pasglop> <5293E73E.8050704@linux.vnet.ibm.com> <529FA9A5.4060706@linux.vnet.ibm.com> Date: Wed, 4 Dec 2013 19:05:36 -0500 Message-ID: Subject: Re: [PATCH] drm/radeon: Disable writeback by default on ppc From: Alex Deucher To: Kleber Sacilotto de Souza Cc: Maling list - DRI developers , Jerome Glisse , Thadeu Lima de Souza Cascardo , Brian King X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Dec 4, 2013 at 6:56 PM, Alex Deucher wrote: > On Wed, Dec 4, 2013 at 5:16 PM, Kleber Sacilotto de Souza > wrote: >> On 11/25/2013 10:11 PM, Kleber Sacilotto de Souza wrote: >>> >>> On 11/24/2013 09:15 PM, Benjamin Herrenschmidt wrote: >>>> >>>> On Fri, 2013-11-08 at 11:43 -0200, Kleber Sacilotto de Souza wrote: >>>>> >>>>> On 11/07/2013 08:29 PM, Benjamin Herrenschmidt wrote: >>>>>> >>>>>> On Mon, 2013-06-17 at 18:57 -0400, Alex Deucher wrote: >>>>>> >>>>>>> Weird. I wonder if there is an issue with cache snoops on PPC. We >>>>>>> currently use the gart in cached mode (GPU snoops CPU cache) with >>>>>>> cached pages. I wonder if we need to use uncached pages on PPC. >>>>>> >>>>>> There is no such issue and no known bugs with DMA writes on those >>>>>> PCIe host bridges (and they do get hammered pretty bad here). >>>>>> >>>>>> This needs further investigation by the lab/hw guys to find out what's >>>>>> actually happening on the bus and the host bridge. >>>>>> >>>>>> Thadeu, Kleber: Jerome suggested writing a test case in userspace that >>>>>> continuously writes to a spare scratch register (thus triggering the >>>>>> corresponding writeback DMA) and checks the memory location to compare >>>>>> the writeback value (using a debugfs file for example, or mmap). >> >> >> I was not able to reproduce the issue with this method, even after a weekend >> run. >> >> However, doing some more investigation it seems the problem is here, where >> we read the ring rptr: >> >> u32 radeon_ring_generic_get_rptr(struct radeon_device *rdev, >> struct radeon_ring *ring) >> { >> u32 rptr; >> >> if (rdev->wb.enabled) >> rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); >> else >> rptr = RREG32(ring->rptr_reg); >> >> return rptr; >> } >> >> I realized that the DMA'ed rptr value has always the opposite byte order >> from the MMIO value. Since RREG32 already returns the register value on the >> CPU byte order, it seems we don't need to byte-swap the DMA'ed value. If I >> remove the le32_to_cpu() call and use the DMA'ed value directly, I don't get >> the IB scheduling failures and piglit results are the same as with writeback >> disabled. >> >> Is the adapter chipset swapping the bytes before doing the DMA to a >> big-endian host? > > Setting CP_RB_CNTL.BUF_SWAP causes the CP to use the selected byte > swapping for just about everything accessed by the CP (rptr writeback, > indirect buffers, etc.). Looks like the DMA ring supports and enables > rptr writeback as well (DMA_RB_CNTL.DMA_RPTR_WRITEBACK_SWAP_ENABLE) so > I think we can drop the swapping of the rptr writeback. > Obvious patch attached. Alex > Alex > >> >> >> >> -- >> Kleber Sacilotto de Souza >> IBM Linux Technology Center >> From 0f7705c378a14060552df19c0e724e47632da4d8 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 4 Dec 2013 19:02:08 -0500 Subject: [PATCH] drm/radeon: don't byteswap readback of rptr writeback We already enable byteswapping of the rptr writeback in the hw. Fixes incorrect rptr readback on BE systems. Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org --- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 9214403..56ff0cd 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c @@ -338,7 +338,7 @@ u32 radeon_ring_generic_get_rptr(struct radeon_device *rdev, u32 rptr; if (rdev->wb.enabled) - rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); + rptr = rdev->wb.wb[ring->rptr_offs/4]; else rptr = RREG32(ring->rptr_reg); -- 1.8.3.1