From patchwork Fri Apr 27 06:17:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10367483 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 9BF6D602DC for ; Fri, 27 Apr 2018 06:17:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3AF328236 for ; Fri, 27 Apr 2018 06:17:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B882828458; Fri, 27 Apr 2018 06:17:54 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 6C41F28236 for ; Fri, 27 Apr 2018 06:17:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15FA66E7F0; Fri, 27 Apr 2018 06:17:46 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F3E96E1F0 for ; Fri, 27 Apr 2018 06:17:34 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id n10so813955wmc.1 for ; Thu, 26 Apr 2018 23:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w1PgZFPqnlvgTsEbtP5QWgWfLTuf6/Kt4yOeMdMOSig=; b=LPEGWg8aE4VeNzX2NJH8Rxt0BC8J0zict8a2FEX9SgP0Zl+EOhkTZ68C01seO705YP SblrXiNAoMhFhN+ve34SRK7cYMCRvcnnBOlk90KwjjCsNPAxeoBcn1D7Z4io0I5Wa7ca 2iuBMhA6Y4kMZb82q67iBHEswn18zoqNJyUjg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w1PgZFPqnlvgTsEbtP5QWgWfLTuf6/Kt4yOeMdMOSig=; b=aHK9Dq//wjjEjQKNCM2+DCZLEGg/X/rr1o+Ai2h1xBctvVhKuikw+KAhDWpurRyBr7 pDR91ClupIXIgc4NdSAjqjz40SEExG/qxgDCF5ffYc1jdwQXsvVY8QsbMNwonfSMG6lB 1pWWsj2VbkMjfSQSGe5kUzmvlq2ETGLLE/efVD7R1rdxUVsaB+ejI36QJF/rcpUj74zW 7fT0v3C5eH8a6Jq3yOngxPIH7HmP5KabaUyJBRHYPspSZ+IAIJWw7sAUvBSlEZFAQwJo nJmjYMiIYwYpwBO+6fEsujSFM4a7BUCH/YUv8TZd7bw+2R67DfyNM+3q4CpOzGJhIT6S qCFg== X-Gm-Message-State: ALQs6tBxPeS+x/0VukPmc5ZkF1BVoggHWWQBcbY4ofWXBhR6+zfe1yNv VfprnPdTKJ/dOnTXwAs4rTiTaQ== X-Google-Smtp-Source: AB8JxZp1nyJfEkCOip4RJiaZj0psWjxIckOPtLBZC+HUGJ2TdYwWl+nUoOuVhwsr7FnA7HaKJiLeow== X-Received: by 2002:a50:c8cb:: with SMTP id k11-v6mr1716590edh.94.1524809852848; Thu, 26 Apr 2018 23:17:32 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id r15-v6sm468897edq.40.2018.04.26.23.17.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 23:17:32 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 27 Apr 2018 08:17:10 +0200 Message-Id: <20180427061724.28497-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427061724.28497-1-daniel.vetter@ffwll.ch> References: <20180427061724.28497-1-daniel.vetter@ffwll.ch> Subject: [Intel-gfx] [PATCH 03/17] dma-fence: Make ->enable_signaling optional X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel Graphics Development , linaro-mm-sig@lists.linaro.org, Daniel Vetter , Daniel Vetter , Sumit Semwal , linux-media@vger.kernel.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Many drivers have a trivial implementation for ->enable_signaling. Let's make it optional by assuming that signalling is already available when the callback isn't present. Signed-off-by: Daniel Vetter Cc: Sumit Semwal Cc: Gustavo Padovan Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org --- drivers/dma-buf/dma-fence.c | 13 ++++++++++++- include/linux/dma-fence.h | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 4edb9fd3cf47..7b5b40d6b70e 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -181,6 +181,13 @@ void dma_fence_release(struct kref *kref) } EXPORT_SYMBOL(dma_fence_release); +/** + * dma_fence_free - default release function for &dma_fence. + * @fence: fence to release + * + * This is the default implementation for &dma_fence_ops.release. It calls + * kfree_rcu() on @fence. + */ void dma_fence_free(struct dma_fence *fence) { kfree_rcu(fence, rcu); @@ -560,7 +567,7 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, unsigned seqno) { BUG_ON(!lock); - BUG_ON(!ops || !ops->wait || !ops->enable_signaling || + BUG_ON(!ops || !ops->wait || !ops->get_driver_name || !ops->get_timeline_name); kref_init(&fence->refcount); @@ -572,6 +579,10 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, fence->flags = 0UL; fence->error = 0; + if (!ops->enable_signaling) + set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, + &fence->flags); + trace_dma_fence_init(fence); } EXPORT_SYMBOL(dma_fence_init); diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index f9a6848f8558..c730f569621a 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -166,7 +166,8 @@ struct dma_fence_ops { * released when the fence is signalled (through e.g. the interrupt * handler). * - * This callback is mandatory. + * This callback is optional. If this callback is not present, then the + * driver must always have signaling enabled. */ bool (*enable_signaling)(struct dma_fence *fence);