From patchwork Tue Jul 3 16:10:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10506049 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 654B960325 for ; Wed, 4 Jul 2018 07:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DE6628CDD for ; Wed, 4 Jul 2018 07:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4194228CF6; Wed, 4 Jul 2018 07:05:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E942B28CDD for ; Wed, 4 Jul 2018 07:05:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7143E6EAA0; Wed, 4 Jul 2018 07:04:18 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id A42FB6E049 for ; Tue, 3 Jul 2018 16:08:13 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id x5-v6so1190848pgp.7 for ; Tue, 03 Jul 2018 09:08:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=cscXmuOb+JzLly+J2MScdfFx0Ib6Chh3Jndyt4wx4/4=; b=KFdprHDtFC9F9u42Q7AWy6gS4lCnT4U+j2Mh2OJp1d+YAEthePzdWx+Cu9WVFNKD+d T6GB/p+07Anzievft0YZ+auey0wL/T6RkdhpM5mcszEOe9KbZtkeAkWwk9czabcqu6Vm S2h5IBLqL/xHAghaR+mNNrds6qt4yR0Oe2KNkoVwIIWZjneFTkW+855/6imffSTKQdHn B9iI/Pt4upvorfZ+9JiVey98AMrBqtihnBoMrR0VvMBfJ3o29nHEo6Q1iMBoFAs6xo7d nWWOCchsjFSdnS10MJ+nALx2smV2qlD+C8F3wpa8IpXHsbKfjlfHBsUpV1bzmVTZH069 E6EQ== X-Gm-Message-State: APt69E3FvcQ5id/gKGymqNB8TQlGOfQIHh3TzG/jfRexoefCjMChT1mq 0o4tKZWbgQ6BHYK3cjDIxgo= X-Google-Smtp-Source: AAOMgpeOU4XA+KAVl02eg35nNtgsm5FV6YLo0XsN9aNgOK3+G0gLgc89T0MZ+In6Gx/YCDRFwDBwcg== X-Received: by 2002:a62:c00c:: with SMTP id x12-v6mr20325363pff.216.1530634093055; Tue, 03 Jul 2018 09:08:13 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC ([183.82.19.17]) by smtp.gmail.com with ESMTPSA id m21-v6sm2354614pgv.27.2018.07.03.09.08.11 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jul 2018 09:08:11 -0700 (PDT) Date: Tue, 3 Jul 2018 21:40:43 +0530 From: Souptick Joarder To: willy@infradead.org, eric@anholt.net, airlied@linux.ie Subject: [PATCH] gpu: drm: v3d: use new return type vm_fault_t Message-ID: <20180703161043.GA26927@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Wed, 04 Jul 2018 07:04:13 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ajitn.linux@gmail.com, svptas.linux@gmail.com, sabyasachi.linux@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, brajeswar.linux@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use new return type vm_fault_t for fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type. see commit 1c8f422059ae ("mm: change return type to vm_fault_t") for reference. Previously vm_insert_mixed returns err which driver mapped into VM_FAULT_* type. The new function vmf_insert_mixed will replace this inefficiency by returning VM_FAULT_* type. Signed-off-by: Souptick Joarder --- drivers/gpu/drm/v3d/v3d_bo.c | 23 +++-------------------- drivers/gpu/drm/v3d/v3d_drv.h | 3 ++- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c index 7b1e2a5..f4e8de4 100644 --- a/drivers/gpu/drm/v3d/v3d_bo.c +++ b/drivers/gpu/drm/v3d/v3d_bo.c @@ -227,37 +227,20 @@ struct reservation_object *v3d_prime_res_obj(struct drm_gem_object *obj) vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags)); } -int v3d_gem_fault(struct vm_fault *vmf) +vm_fault_t v3d_gem_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; struct drm_gem_object *obj = vma->vm_private_data; struct v3d_bo *bo = to_v3d_bo(obj); unsigned long pfn; pgoff_t pgoff; - int ret; /* We don't use vmf->pgoff since that has the fake offset: */ pgoff = (vmf->address - vma->vm_start) >> PAGE_SHIFT; pfn = page_to_pfn(bo->pages[pgoff]); - ret = vm_insert_mixed(vma, vmf->address, __pfn_to_pfn_t(pfn, PFN_DEV)); - - switch (ret) { - case -EAGAIN: - case 0: - case -ERESTARTSYS: - case -EINTR: - case -EBUSY: - /* - * EBUSY is ok: this just means that another thread - * already did the job. - */ - return VM_FAULT_NOPAGE; - case -ENOMEM: - return VM_FAULT_OOM; - default: - return VM_FAULT_SIGBUS; - } + return vmf_insert_mixed(vma, vmf->address, + __pfn_to_pfn_t(pfn, PFN_DEV)); } int v3d_mmap(struct file *filp, struct vm_area_struct *vma) diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h index a043ac3..09aa634 100644 --- a/drivers/gpu/drm/v3d/v3d_drv.h +++ b/drivers/gpu/drm/v3d/v3d_drv.h @@ -2,6 +2,7 @@ /* Copyright (C) 2015-2018 Broadcom */ #include +#include #include #include #include @@ -248,7 +249,7 @@ int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); -int v3d_gem_fault(struct vm_fault *vmf); +vm_fault_t v3d_gem_fault(struct vm_fault *vmf); int v3d_mmap(struct file *filp, struct vm_area_struct *vma); struct reservation_object *v3d_prime_res_obj(struct drm_gem_object *obj); int v3d_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);