Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp652395rwe; Wed, 31 Aug 2022 08:44:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR68hK6F29jO7yehP5OaZ9h6ZG43sFrCaeYXCQAu/Hlsu+aUx/4/CwYDe3U44uHs0ma72vSL X-Received: by 2002:a05:6402:2804:b0:439:83c2:8be2 with SMTP id h4-20020a056402280400b0043983c28be2mr25255578ede.292.1661960661454; Wed, 31 Aug 2022 08:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661960661; cv=none; d=google.com; s=arc-20160816; b=r1Gv0s06EjlADpcAAr4ebrL2eaN+Ouz9OgyB114MGeMXllW4L7Q0R0oRAV5+U1hE13 U1kJ8FklYYHCFkKPxWLLwUszXFyw7e+Kj8KuqCfhzBeSlwRbk4NyEzmi4mCFN6YUQ2g8 V4cWc+aUofNhaosnCr/kh3v6SfpdUxYHrMpDHkf/1gp6cz6Wnrf4kH1Elq9hNI2qijX7 GgoLzqx3yTh1ksMB0DFG0qsCzyM2DM+gK1AgpIBPUcSDArwd+mLGMLfOmBsPx354lBUp 7b907ggfmWFbAs+7Lz5Al6mOHiZSVfIQQNCIPzJm8xVIJy5WloFgTerU7qGpIV5pEGYH L2sA== 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=a7cJXC25AqtwQX5jlUsxYQnez2v2feZ283zuA3AJMdQ=; b=pqgTsqAheF5MzuUAr7keC89BgE1IICqBYY3entzwtaINVM9anXPP3Tt21t59L7DhUv sOYH4fSLIk4lBz2iKlcrKWRWjnb7vjefIzNr3zFjAjXVKw8rrzajilLzX2+stVQxUnr4 1gAnyniFVBbQnwASb+UpPEQDSF6PV1kHcjcdwpCWIBF9Kw+gvH6bc0njZtAOkZAqZV+G rFDQjdkJc0datl2oxhT2yn+8iTKJWxrS5XOc+uixOMOERsdm1RILaTl3AwsvqMrtNGmY uDIic60D4BMaBmpPisc1A2OCEEsP5DzQ7ixkkZSMDgjbvec1tfeI8oSj3iK5csbYTd4K M9EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eDTg8soN; 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 m20-20020a056402511400b004489e0b42b0si6302090edd.530.2022.08.31.08.43.46; Wed, 31 Aug 2022 08:44:21 -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=eDTg8soN; 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 S232196AbiHaPlh (ORCPT + 99 others); Wed, 31 Aug 2022 11:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbiHaPlD (ORCPT ); Wed, 31 Aug 2022 11:41:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E695FF77; Wed, 31 Aug 2022 08:40:16 -0700 (PDT) Received: from dimapc.. (109-252-119-13.nat.spd-mgts.ru [109.252.119.13]) (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 B09946601E0B; Wed, 31 Aug 2022 16:39:58 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661960401; bh=gIw0LiJmbclTWGOdwrfcgGOZXkgbb+7eQ2rM8JMcCFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDTg8soNjJsESfVNNrUcTFbA9XH0ERxZfrDcBM3uq+ZSIdqUh20nNOEarUQbWs34k PFovJnbPzxF3EogbvS9BRbnL/c7KFsOaMbXMGkLz+0smFOPc1ddV26U0FR64kswUkc jwaxe7WMdo6rb5rFo/X5ftYeCZx7KkQRBMpqNqdC0Z1EX7fxh+ptv6eyTCVs1tvNW2 mh+y5yP4InDFFgDKc62A/v7x4OJBD9p6Tta3U4v0sv2KP03fDz1R1ye/kDMTZRkMFm V4whnjGGGtVsCrWU/YGsXT6X/6PNrrJM992r/7+W/w6Xmct9aupP7YCY2SVTZJP3aR 5kYLzMmbuKgYg== 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 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 v4 15/21] dma-buf: Move dma_buf_vmap() to dynamic locking specification Date: Wed, 31 Aug 2022 18:37:51 +0300 Message-Id: <20220831153757.97381-16-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220831153757.97381-1-dmitry.osipenko@collabora.com> References: <20220831153757.97381-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, T_SCC_BODY_TEXT_LINE 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_unlocked() functions to the dynamic locking specification by asserting that the reservation lock is held. 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 51fb69048853..ceea4839c641 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1449,6 +1449,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; @@ -1509,6 +1511,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.2