From patchwork Tue Jul 22 15:42:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 4604051 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3B32BC0514 for ; Tue, 22 Jul 2014 15:42:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68E0820158 for ; Tue, 22 Jul 2014 15:42:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 24F6320155 for ; Tue, 22 Jul 2014 15:42:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 947CC88D3D; Tue, 22 Jul 2014 08:42:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 0939C88D3D for ; Tue, 22 Jul 2014 08:42:37 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id 3932A7253EE for ; Tue, 22 Jul 2014 17:42:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at vodafone.de X-Spam-Score: 0.2 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Authentication-Results: rohrpostix2.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix2.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id udGBHZJZbgKF for ; Tue, 22 Jul 2014 17:42:28 +0200 (CEST) Received: from smtp-05.vodafone.de (xsmail-dmz2.prod.vfnet.de [10.215.254.33]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id 3AEBD7254F4 for ; Tue, 22 Jul 2014 17:42:28 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 3AEBD7254F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafone.de; s=mail; t=1406043748; bh=ecxNvSwOTtG8RMmFmffxVeg8L72TqUjX852byHaRqNk=; h=From:To:Subject:Date; b=1Vss2EIdq3uCX5tjKz/4yH4uIjeRvImvs51cz/7AwkIJXP9cHmJTTH+22KuGUBKfZ 2+/9at1c2UjOByw+lFwQLiquLHg8W75rIv32hL/idj0xkFAQDTyYlyDo+1S5ABgP07 7f5jNOuK3KBvaXRviacEXQe/VFDmRCN9hJDZslec= X-DKIM: OpenDKIM Filter v2.0.2 smtp-05.vodafone.de 0070EE5EF0 X-Virus-Scanned: amavisd-new at vodafone.de Received: from smtp-05.vodafone.de ([127.0.0.1]) by localhost (xsmail-dmz2.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TnhWEHITSXbS for ; Tue, 22 Jul 2014 17:42:21 +0200 (CEST) From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: fix R600_PTE_GART handling Date: Tue, 22 Jul 2014 17:42:20 +0200 Message-Id: <1406043740-7166-1-git-send-email-deathsimple@vodafone.de> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König That didn't worked correctly any more and opened up a security problem. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/cik_sdma.c | 3 +-- drivers/gpu/drm/radeon/radeon.h | 6 +++--- drivers/gpu/drm/radeon/si_dma.c | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 8534068..28ca3cb 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c @@ -775,8 +775,7 @@ void cik_sdma_vm_set_page(struct radeon_device *rdev, trace_radeon_vm_set_page(pe, addr, count, incr, flags); - /* XXX: How to distinguish between GART and other system memory pages? */ - if (flags & R600_PTE_SYSTEM) { + if ((flags & R600_PTE_GART_MASK) == R600_PTE_GART_MASK) { uint64_t src = rdev->gart.table_addr + (addr >> 12) * 8; while (count) { unsigned bytes = count * 8; diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 89b63b9..fd878c7 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -864,9 +864,9 @@ struct radeon_mec { #define R600_PTE_FRAG_64KB (4 << 7) #define R600_PTE_FRAG_256KB (6 << 7) -/* flags used for GART page table entries on R600+ */ -#define R600_PTE_GART ( R600_PTE_VALID | R600_PTE_SYSTEM | R600_PTE_SNOOPED \ - | R600_PTE_READABLE | R600_PTE_WRITEABLE) +/* flags needed to be set so we can copy directly from the GART table */ +#define R600_PTE_GART_MASK ( R600_PTE_READABLE | R600_PTE_WRITEABLE | \ + R600_PTE_SYSTEM | R600_PTE_VALID ) struct radeon_vm_pt { struct radeon_bo *bo; diff --git a/drivers/gpu/drm/radeon/si_dma.c b/drivers/gpu/drm/radeon/si_dma.c index c9da341..a26e842 100644 --- a/drivers/gpu/drm/radeon/si_dma.c +++ b/drivers/gpu/drm/radeon/si_dma.c @@ -79,8 +79,7 @@ void si_dma_vm_set_page(struct radeon_device *rdev, trace_radeon_vm_set_page(pe, addr, count, incr, flags); - /* XXX: How to distinguish between GART and other system memory pages? */ - if (flags & R600_PTE_SYSTEM) { + if ((flags & R600_PTE_GART_MASK) == R600_PTE_GART_MASK) { uint64_t src = rdev->gart.table_addr + (addr >> 12) * 8; while (count) { unsigned bytes = count * 8;