From patchwork Sun Mar 5 22:10:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 64367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1551589wrd; Sun, 5 Mar 2023 14:14:53 -0800 (PST) X-Google-Smtp-Source: AK7set/mhZOh0BFWDFTfIPdAOsP+OeWUkz3lPN7COvd269XwlSaWvW/6OT27cmCukdLu/F/zmWp0 X-Received: by 2002:a17:907:6e87:b0:8b0:f59e:ab1b with SMTP id sh7-20020a1709076e8700b008b0f59eab1bmr9919558ejc.75.1678054492808; Sun, 05 Mar 2023 14:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678054492; cv=none; d=google.com; s=arc-20160816; b=GlURxSUdaNAC3dUtToKqNaP82CnDBTcuac8msBoG/E3iE6O7SRSnCYm96B0WPMJQeK wEzaIeknt1WV3ZKjeYG+kcWNj2KKBEfmJZU5SY3wFEwypiqOdBKCO3bM8fsKcC2koBZF N1xHvdfO8Zob9ADIhE12CXDdV5P9Bho6Qiwimfem3A/0sFp9vWxeqh9uEudZUkUgBq7B osPmH+vpXAQbJx5oE3v/97yfy/GPC6lnChudUoo3hNB6Ud72mPX0oBX7goC6JfpfL5Zp NYkLENZFokwxi0wWIEb2BH8HFABq19ME5RwORrmS5844Xk5Na53eHMfV6qt0K+cC3NuM 8fCg== 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=mvRnsMHxrHizZ+vDxWR2d/4lNwxY8cimpmD2p3t/zJQ=; b=R5vSOX0pbXTUcuXL9n9ounvcu+eKFp53lbO9qFrnUy0aH1ps/WAnQr1FZfKOLrkrXd cZkJ1rw3Gjv5EaxTdJHx7OtAqdUILcS4T7QWvdSpxhUS1XQSvBYdIuvNrcF6h3JcK01j bBWF1bZKWTGb4kiLtarZxfygkkj6w4uFpH42khZG78a2s3KGp6HfpnlF8O2k/kZw1DV2 bDAYO6T3ktphQU6tKXQPUs55Eb352nyudbN9/lVT61p9riDDqhJIkby/g9KsDF47Svut Io00xsRUBAhtbDzWuOPXTVgooZgiY7VfLE+Bh23Purbsi7P9M+BdE3qt+xHGfrw/Pi7L 7Vug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="byw/5vK6"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o18-20020a170906769200b008cb405fa59csi6072928ejm.73.2023.03.05.14.14.28; Sun, 05 Mar 2023 14:14:52 -0800 (PST) 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="byw/5vK6"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbjCEWMc (ORCPT + 99 others); Sun, 5 Mar 2023 17:12:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjCEWLx (ORCPT ); Sun, 5 Mar 2023 17:11:53 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A841B56C for ; Sun, 5 Mar 2023 14:11:44 -0800 (PST) Received: from workpc.. (unknown [109.252.117.89]) (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 88FF366021D4; Sun, 5 Mar 2023 22:11:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1678054303; bh=TDFrhbBWF0ucqm92sCbpy3xDfts2RbHE70GCYFDMUb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=byw/5vK60u75qY454Bl72GHjzJj560DDhYFhFQJ5C9TD11PhDfK0rtHAUmAFkjZWP 7+oVbeqeK4tgi5eKXmjQ//WhIs+oDsV96QiXmJaoHE28AXYD+yX9z63+DuMg1lT2DM kUv7VMU2lbpQz5rp3SOBewLDOQGfSRc2u/AJwP3LyhDSzgMT7FT6U3M0NNjueAcjNx I8Fk/Bgghohi6d21sbTGUQ7ghMN5W1Sn6qW3nYx0QQ+voCaKdZE/eC5UgdhDo4kJrq gvZVpqElKgvpxbfzWKoUyejlE3/s7UYlp7rj4Q6WlS0hBzL1NsJ48gKu2BWr8aIVsM jkTxVu9Wfrd+A== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gustavo Padovan , Daniel Stone , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , Qiang Yu , Steven Price , Alyssa Rosenzweig , Rob Herring Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org, intel-gfx@lists.freedesktop.org Subject: [PATCH v12 09/11] drm/gem: Export drm_gem_pin/unpin() Date: Mon, 6 Mar 2023 01:10:09 +0300 Message-Id: <20230305221011.1404672-10-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230305221011.1404672-1-dmitry.osipenko@collabora.com> References: <20230305221011.1404672-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759567667821891264?= X-GMAIL-MSGID: =?utf-8?q?1759567667821891264?= Export drm_gem_un/pin() functions. They will be used by VirtIO-GPU driver for pinning of an active framebuffer, preventing it from swapping out by memory shrinker. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 2 ++ drivers/gpu/drm/drm_internal.h | 2 -- include/drm/drm_gem.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 3da34b121c93..6492c47b7142 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1153,12 +1153,14 @@ int drm_gem_pin(struct drm_gem_object *obj) else return 0; } +EXPORT_SYMBOL(drm_gem_pin); void drm_gem_unpin(struct drm_gem_object *obj) { if (obj->funcs->unpin) obj->funcs->unpin(obj); } +EXPORT_SYMBOL(drm_gem_unpin); int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map) { diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index d7e023bbb0d5..55d0ee7475f7 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -173,8 +173,6 @@ void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); void drm_gem_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj); -int drm_gem_pin(struct drm_gem_object *obj); -void drm_gem_unpin(struct drm_gem_object *obj); int drm_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map); void drm_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map); diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index 7bd8e2bbbb36..f7703cb66569 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -493,4 +493,7 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru, int drm_gem_evict(struct drm_gem_object *obj); +int drm_gem_pin(struct drm_gem_object *obj); +void drm_gem_unpin(struct drm_gem_object *obj); + #endif /* __DRM_GEM_H__ */