Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ED0DC433F5 for ; Thu, 16 Sep 2021 09:03:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B8FD60F4C for ; Thu, 16 Sep 2021 09:03:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B8FD60F4C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 055656EB14; Thu, 16 Sep 2021 09:03:30 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 77E4F6EB14; Thu, 16 Sep 2021 09:03:28 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10108"; a="209611527" X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="209611527" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 02:03:27 -0700 X-IronPort-AV: E=Sophos;i="5.85,298,1624345200"; d="scan'208";a="700550770" Received: from mkrygin-mobl1.ccr.corp.intel.com (HELO [10.249.254.218]) ([10.249.254.218]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2021 02:03:25 -0700 Message-ID: <7548b96f116883a4f0db6a6d82c3023488761ea4.camel@linux.intel.com> From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Christian =?ISO-8859-1?Q?K=F6nig?= , Matthew Auld , intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Date: Thu, 16 Sep 2021 11:03:23 +0200 In-Reply-To: <00e355ba-fa5a-945e-d9ea-48260a2c56ae@amd.com> References: <20210915185954.3114858-1-matthew.auld@intel.com> <20210915185954.3114858-6-matthew.auld@intel.com> <00e355ba-fa5a-945e-d9ea-48260a2c56ae@amd.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [Intel-gfx] [PATCH v3 06/12] drm/ttm: add TTM_PAGE_FLAG_EXTERNAL_MAPPABLE X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 2021-09-16 at 08:55 +0200, Christian König wrote: > > > Am 15.09.21 um 20:59 schrieb Matthew Auld: > > In commit: > > > > commit 667a50db0477d47fdff01c666f5ee1ce26b5264c > > Author: Thomas Hellstrom > > Date:   Fri Jan 3 11:17:18 2014 +0100 > > > >      drm/ttm: Refuse to fault (prime-) imported pages > > > > we introduced the restriction that imported pages should not be > > directly > > mappable through TTM(this also extends to userptr). In the next > > patch we > > want to introduce a shmem_tt backend, which should follow all the > > existing rules with TTM_PAGE_FLAG_EXTERNAL, since it will need to > > handle > > swapping itself, but with the above mapping restriction lifted. > > > > Signed-off-by: Matthew Auld > > Cc: Thomas Hellström > > Cc: Christian König > > --- > >   drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 ++++-- > >   include/drm/ttm/ttm_tt.h        | 7 +++++++ > >   2 files changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c > > b/drivers/gpu/drm/ttm/ttm_bo_vm.c > > index 708390588c7c..fd6e18f12f50 100644 > > --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c > > +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c > > @@ -163,8 +163,10 @@ vm_fault_t ttm_bo_vm_reserve(struct > > ttm_buffer_object *bo, > >          * (if at all) by redirecting mmap to the exporter. > >          */ > >         if (bo->ttm && (bo->ttm->page_flags & > > TTM_PAGE_FLAG_EXTERNAL)) { > > -               dma_resv_unlock(bo->base.resv); > > -               return VM_FAULT_SIGBUS; > > +               if (!(bo->ttm->page_flags & > > TTM_PAGE_FLAG_EXTERNAL_MAPPABLE)) { I saw there was previously a thought about testing for ttm_bo_type_sg here. Was that a dead end? Thanks, Thomas