From patchwork Thu Feb 25 17:01:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 82055 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1PH3UMP021869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 25 Feb 2010 17:04:06 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nkh6H-0000Iz-KG; Thu, 25 Feb 2010 17:02:09 +0000 Received: from sfi-mx-2.v28.ch3.sourceforge.com ([172.29.28.122] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nkh6G-0000Ir-E7 for dri-devel@lists.sourceforge.net; Thu, 25 Feb 2010 17:02:08 +0000 Received-SPF: fail (sfi-mx-2.v28.ch3.sourceforge.com: domain of redhat.com does not designate 88.191.38.29 as permitted sender) client-ip=88.191.38.29; envelope-from=jglisse@redhat.com; helo=nox.protox.org; Received: from nox.protox.org ([88.191.38.29]) by sfi-mx-2.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Nkh6F-0001WA-CZ for dri-devel@lists.sourceforge.net; Thu, 25 Feb 2010 17:02:08 +0000 Received: from localhost.localdomain (lag77-1-82-238-106-69.fbx.proxad.net [82.238.106.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by nox.protox.org (Postfix) with ESMTPSA id 8FB83169E46; Thu, 25 Feb 2010 18:01:55 +0100 (CET) From: Jerome Glisse To: airlied@gmail.com Subject: [PATCH 8/9] drm/ttm: remove io_ field from TTM V2 Date: Thu, 25 Feb 2010 18:01:48 +0100 Message-Id: <1267117309-1266-9-git-send-email-jglisse@redhat.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1267117309-1266-8-git-send-email-jglisse@redhat.com> References: <1267117309-1266-1-git-send-email-jglisse@redhat.com> <1267117309-1266-2-git-send-email-jglisse@redhat.com> <1267117309-1266-3-git-send-email-jglisse@redhat.com> <1267117309-1266-4-git-send-email-jglisse@redhat.com> <1267117309-1266-5-git-send-email-jglisse@redhat.com> <1267117309-1266-6-git-send-email-jglisse@redhat.com> <1267117309-1266-7-git-send-email-jglisse@redhat.com> <1267117309-1266-8-git-send-email-jglisse@redhat.com> X-Spam-Score: 4.9 (++++) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 4.0 SPF_CHECK_FAIL SPF reports sender host as NOT permitted to send mails from 1.0 SPF_FAIL SPF: sender does not match SPF record (fail) -0.1 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Nkh6F-0001WA-CZ Cc: thellstrom@vmware.com, skeggsb@gmail.com, Jerome Glisse , dri-devel@lists.sf.net X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 25 Feb 2010 17:04:07 +0000 (UTC) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 2a808fc..3bdd44d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -79,8 +79,6 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset); - printk(KERN_ERR TTM_PFX " io_offset: 0x%08lX\n", man->io_offset); - printk(KERN_ERR TTM_PFX " io_size: %ld\n", man->io_size); printk(KERN_ERR TTM_PFX " size: %llu\n", man->size); printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n", man->available_caching); @@ -1560,26 +1558,6 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) return true; } -int ttm_bo_pci_offset(struct ttm_bo_device *bdev, - struct ttm_mem_reg *mem, - unsigned long *bus_base, - unsigned long *bus_offset, unsigned long *bus_size) -{ - struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; - - *bus_size = 0; - if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE)) - return -EINVAL; - - if (ttm_mem_reg_is_pci(bdev, mem)) { - *bus_offset = mem->mm_node->start << PAGE_SHIFT; - *bus_size = mem->num_pages << PAGE_SHIFT; - *bus_base = man->io_offset; - } - - return 0; -} - void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo) { struct ttm_bo_device *bdev = bo->bdev; diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index efce42c..9d601c3 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -90,17 +90,9 @@ int ttm_mem_reg_ioremap(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem, void *addr; *virtual = NULL; - if (bdev->driver->io_mem_reserve) { - ret = bdev->driver->io_mem_reserve(bdev, mem, &pl); - if (unlikely(ret != 0)) { - return ret; - } - } else { - ret = ttm_bo_pci_offset(bdev, mem, &pl.base, &pl.offset, &pl.size); - if (unlikely(ret != 0) || pl.size == 0) { - return ret; - } - pl.is_iomem = (pl.size != 0); + ret = bdev->driver->io_mem_reserve(bdev, mem, &pl); + if (unlikely(ret != 0)) { + return ret; } if (!(man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP)) @@ -393,7 +385,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo, if (!(man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP)) { map->bo_kmap_type = ttm_bo_map_premapped; - map->virtual = (void *)(((u8 *) man->io_addr) + bus_offset); + map->virtual = (void *)(bus_base + bus_offset); } else { map->bo_kmap_type = ttm_bo_map_iomap; if (mem->placement & TTM_PL_FLAG_WC) @@ -468,17 +460,9 @@ int ttm_bo_kmap(struct ttm_buffer_object *bo, if (num_pages > 1 && !DRM_SUSER(DRM_CURPROC)) return -EPERM; #endif - if (bo->bdev->driver->io_mem_reserve) { - ret = bo->bdev->driver->io_mem_reserve(bo->bdev, &bo->mem, &pl); - if (unlikely(ret != 0)) { - return ret; - } - } else { - ret = ttm_bo_pci_offset(bo->bdev, &bo->mem, &pl.base, &pl.offset, &pl.size); - if (unlikely(ret != 0)) { - return ret; - } - pl.is_iomem = (pl.size != 0); + ret = bo->bdev->driver->io_mem_reserve(bo->bdev, &bo->mem, &pl); + if (unlikely(ret != 0)) { + return ret; } if (!pl.is_iomem) { return ttm_bo_kmap_ttm(bo, start_page, num_pages, map); diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index fe4ac95..7afe239 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -101,27 +101,18 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) if (bdev->driver->fault_reserve_notify) bdev->driver->fault_reserve_notify(bo); - if (bdev->driver->fault_reserve) { - ret = bdev->driver->fault_reserve(bo, &pl); - switch (ret) { - case 0: - break; - case -EBUSY: - set_need_resched(); - case -ERESTARTSYS: - retval = VM_FAULT_NOPAGE; - goto out_unlock; - default: - retval = VM_FAULT_SIGBUS; - goto out_unlock; - } - } else { - ret = ttm_bo_pci_offset(bdev, &bo->mem, &pl.base, &pl.offset, &pl.size); - if (unlikely(ret != 0)) { - retval = VM_FAULT_SIGBUS; - goto out_unlock; - } - pl.is_iomem = (pl.size != 0); + ret = bdev->driver->fault_reserve(bo, &pl); + switch (ret) { + case 0: + break; + case -EBUSY: + set_need_resched(); + case -ERESTARTSYS: + retval = VM_FAULT_NOPAGE; + goto out_unlock; + default: + retval = VM_FAULT_SIGBUS; + goto out_unlock; } /* diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 1deb2dd..ad13108 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -190,13 +190,6 @@ struct ttm_tt { * managed by this memory type. * @gpu_offset: If used, the GPU offset of the first managed page of * fixed memory or the first managed location in an aperture. - * @io_offset: The io_offset of the first managed page of IO memory or - * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA - * memory, this should be set to NULL. - * @io_size: The size of a managed IO region (fixed memory or aperture). - * @io_addr: Virtual kernel address if the io region is pre-mapped. For - * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and - * @io_addr should be set to NULL. * @size: Size of the managed region. * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, * as defined in ttm_placement_common.h @@ -222,9 +215,6 @@ struct ttm_mem_type_manager { bool use_type; uint32_t flags; unsigned long gpu_offset; - unsigned long io_offset; - unsigned long io_size; - void *io_addr; uint64_t size; uint32_t available_caching; uint32_t default_caching;