From patchwork Tue Sep 25 14:44:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Cherkasov X-Patchwork-Id: 1507941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id C80393FDAE for ; Wed, 26 Sep 2012 07:48:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C44E8A0E4B for ; Wed, 26 Sep 2012 00:48:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 87345A0967 for ; Tue, 25 Sep 2012 07:44:36 -0700 (PDT) Received: by wibhn17 with SMTP id hn17so5269740wib.12 for ; Tue, 25 Sep 2012 07:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=pb9WlisjGK6gmPQCLbpgEVlFZsfZZgbchxaZcTUsfrs=; b=Ppd39094KzSITtVxLzUP9ilXUuHi4hQvcSY/Iyc5bgw5kNjUZ3caZTiF8gsbMc0Jnd EDVYAF77uxxGrGM280rvDWlI4gFupaSoyLWlx0shwdcM4QlDNZCxOz4uCFywtgBL+2tC kUWvbh4m8bIydJzKYIeVOMGoZOu5R5HO9UVj4dUjxmd6uh1AtPCJgHzEPXMp5n5rOt88 +LRSDsdtVwqnRpC6fcjt4Mw/AWDWEBdn3vj+1nbcInWutf7So6lUuImDHG1ygQ+8Ocqe nGiSQwCXyYhb9ongeq92HumznF5OvqcWdXpxOxrtqWfhZBy/IANuPUCU6oISRaI9J2u9 zfqg== Received: by 10.216.214.209 with SMTP id c59mr9164390wep.214.1348584275644; Tue, 25 Sep 2012 07:44:35 -0700 (PDT) Received: from k-pax.amd.com (tor20.anonymizer.ccc.de. [31.172.30.3]) by mx.google.com with ESMTPS id ga2sm949334wib.2.2012.09.25.07.44.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 07:44:30 -0700 (PDT) From: Dmitry Cherkasov To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/radeon: interface cleanup patch v6 Date: Tue, 25 Sep 2012 18:44:11 +0400 Message-Id: <1348584252-22778-1-git-send-email-Dmitrii.Cherkasov@amd.com> X-Mailer: git-send-email 1.7.10.4 X-Mailman-Approved-At: Wed, 26 Sep 2012 00:47:42 -0700 Cc: Alex Deucher , Dmitry Cherkasov 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: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org add addr_list array to set_page. if it's not NULL these addresses will be put to the ring. Signed-off-by: Dmitry Cherkasov --- to be applied on top of drm/radeon: add 2-level VM pagetables support v9 drivers/gpu/drm/radeon/ni.c | 11 ++++++++--- drivers/gpu/drm/radeon/radeon.h | 4 ++-- drivers/gpu/drm/radeon/radeon_asic.h | 2 +- drivers/gpu/drm/radeon/radeon_gart.c | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index f920a2c..9230815 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -1524,13 +1524,14 @@ uint32_t cayman_vm_page_flags(struct radeon_device *rdev, uint32_t flags) * @addr: dst addr to write into pe * @count: number of page entries to update * @incr: increase next addr by incr bytes + * @addr_list: kmalloced array of u64 addresses to write to pe * @flags: access flags * * Update the page tables using the CP (cayman-si). */ void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe, uint64_t addr, unsigned count, - uint32_t incr, uint32_t flags) + uint32_t incr, uint64_t *addr_list, uint32_t flags) { struct radeon_ring *ring = &rdev->ring[rdev->asic->vm.pt_ring_index]; uint32_t r600_flags = cayman_vm_page_flags(rdev, flags); @@ -1547,8 +1548,12 @@ void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe, addr += incr; } else if (flags & RADEON_VM_PAGE_VALID) { - value = addr; - addr += incr; + if (addr_list == NULL) { + value = addr; + addr += incr; + } else { + value = addr_list[i]; + } } value |= r600_flags; diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 519d8a3..d8a61ed 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -1151,7 +1151,7 @@ struct radeon_asic { u32 pt_ring_index; void (*set_page)(struct radeon_device *rdev, uint64_t pe, uint64_t addr, unsigned count, - uint32_t incr, uint32_t flags); + uint32_t incr, uint64_t *addr_list, uint32_t flags); } vm; /* ring specific callbacks */ struct { @@ -1765,7 +1765,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); #define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart.set_page((rdev), (i), (p)) #define radeon_asic_vm_init(rdev) (rdev)->asic->vm.init((rdev)) #define radeon_asic_vm_fini(rdev) (rdev)->asic->vm.fini((rdev)) -#define radeon_asic_vm_set_page(rdev, pe, addr, count, incr, flags) ((rdev)->asic->vm.set_page((rdev), (pe), (addr), (count), (incr), (flags))) +#define radeon_asic_vm_set_page(rdev, pe, addr, count, incr, addr_list, flags) ((rdev)->asic->vm.set_page((rdev), (pe), (addr), (count), (incr), (addr_list), (flags))) #define radeon_ring_start(rdev, r, cp) (rdev)->asic->ring[(r)].ring_start((rdev), (cp)) #define radeon_ring_test(rdev, r, cp) (rdev)->asic->ring[(r)].ring_test((rdev), (cp)) #define radeon_ib_test(rdev, r, cp) (rdev)->asic->ring[(r)].ib_test((rdev), (cp)) diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 9a71f44..6fe8e75 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -446,7 +446,7 @@ void cayman_vm_flush(struct radeon_device *rdev, struct radeon_ib *ib); uint32_t cayman_vm_page_flags(struct radeon_device *rdev, uint32_t flags); void cayman_vm_set_page(struct radeon_device *rdev, uint64_t pe, uint64_t addr, unsigned count, - uint32_t incr, uint32_t flags); + uint32_t incr, uint64_t *addr_list, uint32_t flags); int evergreen_ib_parse(struct radeon_device *rdev, struct radeon_ib *ib); /* DCE6 - SI */ diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 753b7ca..31d6bfa 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c @@ -977,7 +977,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, pe += (bo_va->soffset / RADEON_GPU_PAGE_SIZE) * 8; radeon_asic_vm_set_page(rdev, pe, addr, nptes, - RADEON_GPU_PAGE_SIZE, bo_va->flags); + RADEON_GPU_PAGE_SIZE, NULL, bo_va->flags); /* update page directory entries */ addr = pe; @@ -986,7 +986,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, pe += ((bo_va->soffset / RADEON_GPU_PAGE_SIZE) >> RADEON_VM_BLOCK_SIZE) * 8; radeon_asic_vm_set_page(rdev, pe, addr, npdes, - RADEON_VM_PTE_COUNT * 8, RADEON_VM_PAGE_VALID); + RADEON_VM_PTE_COUNT * 8, NULL, RADEON_VM_PAGE_VALID); radeon_fence_unref(&vm->fence); r = radeon_fence_emit(rdev, &vm->fence, ridx);