Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7045329rwn; Tue, 13 Sep 2022 12:58:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rPhUBKimvQSrb1zAyoktFhGFn1oycPeIQh5GUiAk5YCisyqVT/iCcauFTV7W38ZVPjqCF X-Received: by 2002:aa7:864a:0:b0:53f:dcdf:4614 with SMTP id a10-20020aa7864a000000b0053fdcdf4614mr28765303pfo.38.1663099079803; Tue, 13 Sep 2022 12:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663099079; cv=none; d=google.com; s=arc-20160816; b=QeONydESeM1V5fhvQqMmJnz0UaVdlcjJYnAfeTBO1yNU08WKTGtiNAdqCv5nhpR4mf FbzLTeFSzCEQkC6cqwdsdkv3PRQ4fYiy6hT4pWkpvycA7qQHyzD7rqDNbbhVm9cfuThl RKLGiIsTrEajRIxsopIYhTft9XdoLaGeu3ahfStXpUKrfKEra1ZNVbm1dLBdd5xnL8ia yCuFW3I1vmW1bMoiWBskXT8KHVz6q3YBW/3RQ/ZYqHXu4b11o+PtvKRvPBHeU0ko5JiS LkSSSREl8BnGJWutM1kPlvIZ/o8YRjbtxaFw4xt2ZUft1Xrfcrr/OKl7ldwik6I5x2Y3 IBkA== 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=iPrQ2Lcatdq/1J51K9nB8EzXCboPlFpAlqctfmUKqKs=; b=jV/w1siD9JNKWUsGZf8Tu/jPN13Qs0S99YkHQ9puNNyhY/PPoYF4QMx+L2cQcZkEju 01xWiFxXiX8KN2pBbqJQ43FtL7bsI6ohYGHYxLmWOntY7q8DAREdqox0EAOeiiWA5sgm kt7Fo5YKOBNhEjgRhquxgdvrcvfqoB3guqBuhJPE7B0lPCnxUCeoNRDc7PuadnqmEBnf WeCbgMBtYYsR6/+2sEN4eUtSmModgKeBNsnakK9x/ml7NhOvMQgzXc57aVk9eG3+O8VJ 9A7dQW3VDX5QDnC5itmjc/d9+XBW0NTZLGmawTEyc5p4wKGHBWBPa7S6JES3mD8+b+CU BD2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VRDMXUhv; 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 v69-20020a638948000000b004349d87a601si12936816pgd.27.2022.09.13.12.57.47; Tue, 13 Sep 2022 12:57:59 -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=VRDMXUhv; 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 S229678AbiIMTaw (ORCPT + 99 others); Tue, 13 Sep 2022 15:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbiIMTaI (ORCPT ); Tue, 13 Sep 2022 15:30:08 -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 319BDCE21; Tue, 13 Sep 2022 12:29:34 -0700 (PDT) Received: from dimapc.. (109-252-122-187.nat.spd-mgts.ru [109.252.122.187]) (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 0C6266602016; Tue, 13 Sep 2022 20:29:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1663097373; bh=K63vy2u1HxYl22uNLPWg20VUMf8HQCw+tVGLFD5Os78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRDMXUhvInsuU0o+/dVRNdq4yqC2CrlDEE4qdoez1LR7hFtr3ikFIwro6CZ1v+qGW Z5egwx4pBkHmsoV1P9H+Cf0DRw7WXGUspRfp9/KT28NOm/JBErtdyJm42ksMyWNiKa NcpZAKAGdROl6+bm1Vek4OuZ/xmpE+i8XaB0WhSwTfOnWeMCYLn0Szc4eQcKxJ501r CS4ssY8Ejgu3yQWUWqjvn6qkqXyL2P3LS7DKE1KPLjLrSvNarhmocMEEICPf5Vau8x CXniAqMUsEEuiK4cfwfRu1yKgx9EfVaiO8Zx6txad3aOSSi1t+iWhG0ji40RMoMHrV U5ZTkLCDOup0w== 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 v5 15/21] dma-buf: Move dma_buf_vmap() to dynamic locking specification Date: Tue, 13 Sep 2022 22:27:51 +0300 Message-Id: <20220913192757.37727-16-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913192757.37727-1-dmitry.osipenko@collabora.com> References: <20220913192757.37727-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 50db7571dc4b..80fd6ccc88c6 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; @@ -1510,6 +1512,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