Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbdLXJ1O (ORCPT ); Sun, 24 Dec 2017 04:27:14 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:40543 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbdLXJ1G (ORCPT ); Sun, 24 Dec 2017 04:27:06 -0500 X-Google-Smtp-Source: ACJfBouB7y9cWP3Rks+srcT9T3qH2n8JOeWo9WQgQtX+FdczLCvpbUYGHEeDGUR8CvuHfYacP2pdKQ== Reply-To: christian.koenig@amd.com Subject: Re: [PATCH 01/12] drm/ttm: Use ttm_bo_default_io_mem_pfn if io_mem_pfn is NULL To: Tan Xiaojun , seanpaul@chromium.org, christian.koenig@amd.com, airlied@linux.ie, michel.daenzer@amd.com, alexander.deucher@amd.com, nicolai.haehnle@amd.com, thomas.lendacky@amd.com, yamada.masahiro@socionext.com, msrb@suse.com, Felix.Kuehling@amd.com, dave.jiang@intel.com, gregkh@linuxfoundation.org, michael.thayer@oracle.com, hdegoede@redhat.com Cc: daniel.vetter@intel.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1514096068-80414-1-git-send-email-tanxiaojun@huawei.com> <1514096068-80414-2-git-send-email-tanxiaojun@huawei.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <7542197c-a821-a5d2-1abd-449c823c53e5@gmail.com> Date: Sun, 24 Dec 2017 10:27:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1514096068-80414-2-git-send-email-tanxiaojun@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1399 Lines: 38 Am 24.12.2017 um 07:14 schrieb Tan Xiaojun: > From: Michal Srb > > The io_mem_pfn field was added in commit ea642c3216cb2a60d1c0e760ae47ee85c9c16447 > and is called unconditionally. However, not all drivers were updated to set it. > > Use the ttm_bo_default_io_mem_pfn function if a driver did not set its own. > > Signed-off-by: Michal Srb > --- > drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c > index c8ebb75..e25a99b 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c > @@ -234,7 +234,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) > if (bo->mem.bus.is_iomem) { > /* Iomem should not be marked encrypted */ > cvma.vm_page_prot = pgprot_decrypted(cvma.vm_page_prot); > - pfn = bdev->driver->io_mem_pfn(bo, page_offset); > + if (bdev->driver->io_mem_pfn) > + pfn = bdev->driver->io_mem_pfn(bo, page_offset); > + else > + pfn = ttm_bo_default_io_mem_pfn(bo, page_offset); Please move this check into a new function ttm_bo_io_mem_pfn(). You can then move the calculation of ttm_bo_default_io_mem_pfn() into this new function in patch #12 as well. Regards, Christian. > } else { > page = ttm->pages[page_offset]; > if (unlikely(!page && i == 0)) {