Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1040352rwb; Wed, 28 Sep 2022 12:20:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ye5gg8mbaZ5fP2U1VH50ToA78CHCB1nrs5472Re8KEuwMkl09z+zLbbLztaohL7803htp X-Received: by 2002:a17:902:e742:b0:176:dc6b:eecc with SMTP id p2-20020a170902e74200b00176dc6beeccmr1294402plf.104.1664392845198; Wed, 28 Sep 2022 12:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664392845; cv=none; d=google.com; s=arc-20160816; b=tW0FnxFIE5Uh70jNj9BcDVhJmOV4cdh+pJO8mFUVrmFKfY5D1YzFf8Y4WPEs2gVieS MRFRgJWg4hT9sdYfjlNKfn/KmNNj1t7dYB9xyLRJ4nxBbNCRYMR5pMsSMQyQFGmrK5qv SwK+kbyt3zTKSXzSGp5M8GJEfvANyPeNHgMY0NBpi/Ewmo3UT9Vlkfz3YyM1E597M0Rx ie1b6yvvEcnZ2f3mHO0eUf/AdxCgu87aPsXjuAe/phhk74i3djI7bZ0M0sfIw18NTaEP /NrBQqmb3htmte2cNfTWx5Riig8Wj7Q1mdqj0M07AYd83nGn8xGe7rbwJHUeZoXVsDGG R8Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BnurdpH5AAftIt7z9E83qlma9USsQljMtnp5kkyuelM=; b=aIWiOzT6SNLirLGjBo65x3+MV3K7jmrsaCpn4iShcp0ERfe8qn32sXpWsl0hH2Q4QV qUJT7N/i1x59SH9/zQ5SsgxMLIbMZI9krdCdNQQNv0wOH2zAFU0SI8nag9zNEB4vr8xE 0PA3SCt7oiW1iPacM+ZL+1nXHNi3tN857L2OlTUxB87kqYPnINDNbfUhL/bHOwN5V31U oUhTp0M5/YMfNred/Awmli5Mb8rZU4sqY0vKzNthoIzfAEEMRuq+xXdKXhJcG54c99+d YBr2CxEJkSUo5Vysz/JRrLCFC2bXSzjH0aQvUQe5gNfAezjV2z+zqjo+zLtvbTWZRNDk wIkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SFpYtabg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj2-20020a17090b4d8200b001f222133d1esi3667142pjb.186.2022.09.28.12.20.32; Wed, 28 Sep 2022 12:20:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SFpYtabg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234367AbiI1TTc (ORCPT + 99 others); Wed, 28 Sep 2022 15:19:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbiI1TSr (ORCPT ); Wed, 28 Sep 2022 15:18:47 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B53FAC6E; Wed, 28 Sep 2022 12:18:13 -0700 (PDT) Received: from dimapc.. (unknown [109.252.125.248]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id D559466022A2; Wed, 28 Sep 2022 20:18:08 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1664392691; bh=zM8eBwVfejy1KJ0qKfTB/C/KoLuYaM62O9H/cjFMEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SFpYtabgSQANS1fsFFpfFKKEOATjANu0v/d0k9Gleq2RPsSYl3ztTx2a+EzLiyeE6 LYKzk4nXKBD8gNWLWYH+VVisIYPq/zxWYo5Mc4KveZls/PqM5Zg8lnDivjZWhG0Wlu iQHW3VOyhWKHequVTYm7oF6TNY26JaF6RcuM1inI1LFuubL+UBEC8BU5W5Ufl2eoOD TCp6+XVnSiLmqrwUG+BlxM2kQWlrNaXxPPWaMnhtICJacWJwSF2RaApG34vfdD3XRW b9QDKAtKUh7oK1R1P395EViJOyVOqViKsM7bbUq8ndY96QTBms0yukesFnQ0Hn5Z20 lpi5IfrgGdNIQ== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Alex Deucher , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Qiang Yu , Srinivas Kandagatla , Amol Maheshwari , Jason Gunthorpe , Leon Romanovsky , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Tomi Valkeinen , Russell King , Lucas Stach , Christian Gmeiner , Ruhl Michael J Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Osipenko , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kernel@collabora.com, virtualization@lists.linux-foundation.org, linux-rdma@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v6 15/21] dma-buf: Move dma_buf_vmap() to dynamic locking specification Date: Wed, 28 Sep 2022 22:15:54 +0300 Message-Id: <20220928191600.5874-16-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928191600.5874-1-dmitry.osipenko@collabora.com> References: <20220928191600.5874-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move dma_buf_vmap/vunmap() functions to the dynamic locking specification by asserting that the reservation lock is held. Acked-by: Sumit Semwal Acked-by: Christian König Signed-off-by: Dmitry Osipenko --- drivers/dma-buf/dma-buf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index f349613790a6..23656f334735 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1450,6 +1450,8 @@ int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map) if (WARN_ON(!dmabuf)) return -EINVAL; + dma_resv_assert_held(dmabuf->resv); + if (!dmabuf->ops->vmap) return -EINVAL; @@ -1513,6 +1515,8 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map) if (WARN_ON(!dmabuf)) return; + dma_resv_assert_held(dmabuf->resv); + BUG_ON(iosys_map_is_null(&dmabuf->vmap_ptr)); BUG_ON(dmabuf->vmapping_counter == 0); BUG_ON(!iosys_map_is_equal(&dmabuf->vmap_ptr, map)); -- 2.37.3