From patchwork Fri Jul 28 09:06:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp301719vqg; Fri, 28 Jul 2023 02:15:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFyl6js8d3ZHYWkGA7Lc2Y0ENNBxlnG/6WbSb8s9S8Mwx7gaZILMW7iLB1lpxt/QluVWBOb X-Received: by 2002:a05:6402:31eb:b0:522:56d8:49c0 with SMTP id dy11-20020a05640231eb00b0052256d849c0mr1265789edb.37.1690535750626; Fri, 28 Jul 2023 02:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690535750; cv=none; d=google.com; s=arc-20160816; b=Zt5c170Pof52hiqlGWeWvFjKPL0sUJYJZkioT56GT3qA1lf6Hn1X4RSzqu7Y+6bh8m lWjq7FEpm1pb8SX5sw5IcQd6OQpSxUJqdCSw2cGvhVHSx/SQKdbAVc5I0YRSbugItLLJ I5K1Y/b0usCr1nHB1awCXmL6NVnenUyR5/CuTGCUaO05wp6S3Dk3oHIixMzp+qgT35fP W9BE9G22IboWz5OtRxRLu26TmyU+fwcKTmqKRv9WGX1es35YMyxe7ev9bdPpl4Q5Cpcv ldfRyU4YTUjewz3O84RexGy+DNfcgx9Fuqp3QUKPcFKVIIgys4wS7JCaqtvelrGnZrS7 hapA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=qjDEfIu+gNPcqTj+SoCZZrd+vlwl9KEjD7bD2/wLMDY=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=oYu32ZGIu2a8Z/5IqHVp7vL5uz6kYgkoiJZUmtyr/mCGwR+fYuBqOzc7FCcxofAfSz QL3A6BsT4eQmapz5DSrBSKp0Mq7+Pd08NbT6O1HX7OdnslcYKQBK+EonfNpGBNY4x9Sh Kz1IaACsmmkG791oab0UZjJcVXrRImhOV18JxmfLoTQ1BK3RQQ4ONvJPbonVLXb8ZIXq uIKHE9P1AIE/FVPY8olmuBs8+VvTy3IM1sF75xAwaivCHOz4d14cwihd/T2iDGLuxEbo nqjKl/0ILkf3vkbV1kR6fhEbXSgeFk6dXXrpPyCyT8moryEA+uV2ZUqo39DXT6BpacQW 2rPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEFjL9Sx; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a056402069300b0052226f46178si2359370edy.353.2023.07.28.02.15.26; Fri, 28 Jul 2023 02:15:50 -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=@kernel.org header.s=k20201202 header.b=CEFjL9Sx; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235176AbjG1JGo (ORCPT + 99 others); Fri, 28 Jul 2023 05:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbjG1JG2 (ORCPT ); Fri, 28 Jul 2023 05:06:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A943582; Fri, 28 Jul 2023 02:06:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E325862081; Fri, 28 Jul 2023 09:06:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0080BC433C8; Fri, 28 Jul 2023 09:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535184; bh=g19Qr7lTEX4DQpW0gKyuC8KKuGZXXC9l7fQhhK+dJSE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=CEFjL9Sx7KXL8EOMQcOXjK4yr3X1qxzElzF8P4uksXp3+8MUkFd7QM63SW0KNshB/ m7gnmqXLfNlJZFywCPGZpam1rw4l0RJuxim36RooRckxbCOEw9sagO8irzYnnlaAMp WZxp3PTYVG1l2IsOb1jgLdoEu+OFYB+B91c2mMAs5cEN8cYMV1A6lCgNfdO6T79GLC 71j3bkf5xTdATo85I4CZhwPJbQFsa94KBFasLpfP7saMSomaUH9nZkKEN5Tq3e0eyv +FVr1az/HIC1vR57CQKMDWjdEpColFwVqhc9UdvYklCc1aso1xdBDsWR7/AiCuHVaO tOU73Z/hFWwAA== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:14 +0200 Subject: [PATCH v3 01/11] drm/tests: helpers: Switch to kunit actions MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-1-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3170; i=mripard@kernel.org; h=from:subject:message-id; bh=g19Qr7lTEX4DQpW0gKyuC8KKuGZXXC9l7fQhhK+dJSE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7kcFk19LujtYX7eSdTX7/TqrR+97EXLLwSc2hr1S TRXj/NIRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACZSrs7IcHmx6o5blq+msj01 ONnBYfAkyXbS2dgdaytVPfbu8ygzcWH4n1X35O6vUOGVjhvuhn6zk/qXqvn1R9CbnIk5K7KXWEy 4xgcA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772655214996759167 X-GMAIL-MSGID: 1772655214996759167 Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 54 ++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 4df47071dc88..cdf35421e641 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -26,6 +26,28 @@ static struct platform_driver fake_platform_driver = { }, }; +static void kunit_action_platform_driver_unregister(void *ptr) +{ + struct platform_driver *drv = ptr; + + platform_driver_unregister(drv); + +} + +static void kunit_action_platform_device_put(void *ptr) +{ + struct platform_device *pdev = ptr; + + platform_device_put(pdev); +} + +static void kunit_action_platform_device_del(void *ptr) +{ + struct platform_device *pdev = ptr; + + platform_device_del(pdev); +} + /** * drm_kunit_helper_alloc_device - Allocate a mock device for a KUnit test * @test: The test context object @@ -35,8 +57,8 @@ static struct platform_driver fake_platform_driver = { * able to leverage the usual infrastructure and most notably the * device-managed resources just like a "real" device. * - * Callers need to make sure drm_kunit_helper_free_device() on the - * device when done. + * Resources will be cleaned up automatically, but the removal can be + * forced using @drm_kunit_helper_free_device. * * Returns: * A pointer to the new device, or an ERR_PTR() otherwise. @@ -49,12 +71,27 @@ struct device *drm_kunit_helper_alloc_device(struct kunit *test) ret = platform_driver_register(&fake_platform_driver); KUNIT_ASSERT_EQ(test, ret, 0); + ret = kunit_add_action_or_reset(test, + kunit_action_platform_driver_unregister, + &fake_platform_driver); + KUNIT_ASSERT_EQ(test, ret, 0); + pdev = platform_device_alloc(KUNIT_DEVICE_NAME, PLATFORM_DEVID_NONE); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); + ret = kunit_add_action_or_reset(test, + kunit_action_platform_device_put, + pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + ret = platform_device_add(pdev); KUNIT_ASSERT_EQ(test, ret, 0); + ret = kunit_add_action_or_reset(test, + kunit_action_platform_device_del, + pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + return &pdev->dev; } EXPORT_SYMBOL_GPL(drm_kunit_helper_alloc_device); @@ -70,8 +107,17 @@ void drm_kunit_helper_free_device(struct kunit *test, struct device *dev) { struct platform_device *pdev = to_platform_device(dev); - platform_device_unregister(pdev); - platform_driver_unregister(&fake_platform_driver); + kunit_release_action(test, + kunit_action_platform_device_del, + pdev); + + kunit_release_action(test, + kunit_action_platform_device_put, + pdev); + + kunit_release_action(test, + kunit_action_platform_driver_unregister, + pdev); } EXPORT_SYMBOL_GPL(drm_kunit_helper_free_device); From patchwork Fri Jul 28 09:06:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp318882vqg; Fri, 28 Jul 2023 02:57:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlF7nH0WxOzUJ23ngi6+AhDKOe/9NskLvmXYWIhWwxXNPKumcUwStsyjmLu7TPtfzt1CsfsP X-Received: by 2002:a17:902:a407:b0:1b6:b703:36f8 with SMTP id p7-20020a170902a40700b001b6b70336f8mr1552171plq.25.1690538222980; Fri, 28 Jul 2023 02:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690538222; cv=none; d=google.com; s=arc-20160816; b=Z455fEkIPndl5fO1wFYRyteNERNvVSpjjNG5anKKPUUToLuxcnYR3Hm5cbv9xZYX0s PBTPPn45hmt/1h555RSyKy1LJIAqZywlPJAMLK9+kdU0xI47p1xN0h2Obtj1PRfQybU1 xAlKiUxnQHppZA/ue/G+eCfJErNizBrbK6Chcg5CsLVdwb4nduTOtWhoyq/tHqE5T/dp gu0F8turpXaT1b1IY0AZsNWd9i/EYLWDnjcmtR1SHCbbXn5Y0iDoSVxwuv6WXOrNO4P4 JXv5ee/FKBqXEYki+DxJ5E66Pc0MOfyWDSdIoaFWabK/DKKRgrAf2KsVhpp9IKIsjSp1 hogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=CAHRwvEdrr0RL3YmNemSdZ87mrpF1AZUmH5ou0Wp5og=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=z8eiZfLhBWM/SN43EwQlwX6mNGCUcmL/a9eSWoz0OTYLrMNWQS9QDYf/H20O3NnaS6 KAEUQ6AlBDlfm6+pXbb4ZDNjxHCILD/myfkkwRMtYM6cfGMnZLE8vRn8MUWtFST+SasK 3Ek6zA7tx7ipZytLXrNNrH6D8XeSkGq3Cie2DzeYpVZQmQ0xt5MxbOYivlSfS/pJdo5+ CN1Jqj4kwPe4bDyxicgANtMxyZaB+ABM5CXELdIedwpFccUzmkxbue/EzW+if4aNPjwp EX5lyLsGZcVUz0epq6oKB0W8BsvONZyOOHhaMbw8xDpzeZngA906xuk1MPF1/ci8txU2 Y9Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VWDLwNhM; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a170902ce8c00b001b8921fbd87si2982586plg.490.2023.07.28.02.56.50; Fri, 28 Jul 2023 02:57:02 -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=@kernel.org header.s=k20201202 header.b=VWDLwNhM; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235290AbjG1JGu (ORCPT + 99 others); Fri, 28 Jul 2023 05:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235224AbjG1JGc (ORCPT ); Fri, 28 Jul 2023 05:06:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BD3273D; Fri, 28 Jul 2023 02:06:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC6C162087; Fri, 28 Jul 2023 09:06:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A6FC433C7; Fri, 28 Jul 2023 09:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535187; bh=gTZ6pxd2ZYEYYmpnt5LVUEVpp6OYKOh/ECpVr3VoqbQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VWDLwNhMJ04fIVVxLW/N4tmkApHKYCVE96oGEGLjdGRm/c+f4LIjivkGvfrDNyqIY IFlE2hH97kWOhzVShr3kkiFwaHkV8NktgqbqwOYSGtQxUQ0GPrz95f3iT0KQ6rricM zLRalJujFIkDn6f+minwS9idapvgbsmK2d3e3rCCcjLZGkdXZZP6uZQxOuLaOKFcwD Ej8BgS5AMJzwkIEe9e7CLj0f0IhQRHgsjo9dOgF6k/l2iovCS+319YEJxWNC6PXUTJ w7HB93NUPtUtIzY3DY8YfAMmB4Ibb62XMP8BCeDnopD9xjQNAYnFLuTZrnY2anKGqg 50iR+dM8eXClg== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:15 +0200 Subject: [PATCH v3 02/11] drm/tests: client-modeset: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-2-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1456; i=mripard@kernel.org; h=from:subject:message-id; bh=gTZ6pxd2ZYEYYmpnt5LVUEVpp6OYKOh/ECpVr3VoqbQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7kmVGiskl7alxi8TaZY4ldHx/JHHxp5jU5s+b5Y+ /mNGUelOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRYnVGhl6WLeGn6q+FT3r8 Pet90XOXBZuYjPSsph6onqO5w+ZiTSPDP8NJd1krfjq+3zy7rvey1cLDVk6qAdNzGzKc46uPGeU a8gMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772657807439894454 X-GMAIL-MSGID: 1772657807439894454 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_client_modeset_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c index 416a279b6dae..7516f6cb36e4 100644 --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c @@ -82,13 +82,6 @@ static int drm_client_modeset_test_init(struct kunit *test) return 0; } -static void drm_client_modeset_test_exit(struct kunit *test) -{ - struct drm_client_modeset_test_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - static void drm_test_pick_cmdline_res_1920_1080_60(struct kunit *test) { struct drm_client_modeset_test_priv *priv = test->priv; @@ -188,7 +181,6 @@ static struct kunit_case drm_test_pick_cmdline_tests[] = { static struct kunit_suite drm_test_pick_cmdline_test_suite = { .name = "drm_test_pick_cmdline", .init = drm_client_modeset_test_init, - .exit = drm_client_modeset_test_exit, .test_cases = drm_test_pick_cmdline_tests }; From patchwork Fri Jul 28 09:06:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp311277vqg; Fri, 28 Jul 2023 02:38:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOnGCqRwWQu+M2+xtz3UAGj9yeKNG+MfyxdieFcA4ADG+jKlC1hxAc/mgGyVaHR3XFFVHw X-Received: by 2002:a19:3803:0:b0:4f8:7617:6445 with SMTP id f3-20020a193803000000b004f876176445mr1160349lfa.48.1690537096768; Fri, 28 Jul 2023 02:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537096; cv=none; d=google.com; s=arc-20160816; b=QNtPQ27PO1IAwMUV56wOvRj5MWtts6lwH3SrQqeC9O2Q/8VGGSKT/My00DB25+DjhF QKOQlTsZT7Fl5mx0qAkVBk/IMTJYGv+wPz39xbCGYG5bTNu7Sn3N41BeRnEFuXhOJsrJ Qqymb+GQPZuU25Sk7yk8cCEgRkIqSaRE9/kmucM4n+uydRssnex+RHIyPF9SlyRTYnby +sZ3VdJC75TEjkjVlKR3zn48qaL18ZHg3SGRj5E4bPr5Hwj6ENOF67/Yjcc1FZRzk7Ij dgnP676m1a+j6L15ol+xfqGlGGrUHvqoxQoIG9OnGHbz08Lc1yvEfbF9PD2S/GJihvAf kUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=hFu5bjjtjg34z19mfrSOM5Kd6WAtZB5nFY5pahKgJk4=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=nQObcj/qQQ9pQsu0eGGrZEyeaFZjRaq6IQQzimN1ixoRDYeMKRCJt/mBBLlmhAcjrO msrgMa2Doqjyk/vsOR1s4Qw2SR7Mjd3kvsDLiRffSk+q9bmapAP7CNaKLZW/6pZ1LSe/ 4OjjUrcyqLHSXkbuL4Cx/elMArhatZZEJmRoKzDqXaMVq+fE4hx5o3ulpGxpCg4cMsYD om3yH2IrxeccDQYuBvfK498Xzz1/N9XUlhLiUgD9RdMBUPPJb+YHuKhZjg16kYMdohjr wWVtM+mepilMn7OdAJxeWuIaS2RtI5QhWAsoGHQcqMP9tOJG/WNFzZuHuUmMfxsOXDey lB9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oBFsRyrw; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a1709062b4e00b00992acf1f370si2490532ejg.939.2023.07.28.02.37.50; Fri, 28 Jul 2023 02:38:16 -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=@kernel.org header.s=k20201202 header.b=oBFsRyrw; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234189AbjG1JG4 (ORCPT + 99 others); Fri, 28 Jul 2023 05:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233581AbjG1JGj (ORCPT ); Fri, 28 Jul 2023 05:06:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5279230E2; Fri, 28 Jul 2023 02:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D90B16208B; Fri, 28 Jul 2023 09:06:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9CEFC433C9; Fri, 28 Jul 2023 09:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535190; bh=MvKIveuNi6K1WIrzaSAMwm4uJlnqwFoe8oWd0p7j5MA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oBFsRyrwGGqH8ckpyDai+ft7frs+cAAFnRiTBP9/RrAwHvwInO0PUuFT4btUCqMYx 8sLGxfWPyLo3+EYguyzLXFP/BdmiAzLZ/aIa5dEziHIPAFQeyJ7bQDtjqrbm0SHre3 MqkKzHni6r8FBCoxtpmN3z6BUlhsHjLK2cHIRYwsafemDKFsGXvQRq/diJ7IVQwDdU lveTJ2F5PnUjvsXOTKBWDX2XL1Kbj7S+KJjtC6VJ9JVBdri+wVsnXQVB80vHWInjp8 IOYJwOZwpd22oITR4lDD2t0IxqRd1Rwk/QmFJfWTFEKkLfa29aX/gDB3Kn9I9lVbXW pueAuAmJO/Y+g== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:16 +0200 Subject: [PATCH v3 03/11] drm/tests: modes: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-3-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1346; i=mripard@kernel.org; h=from:subject:message-id; bh=MvKIveuNi6K1WIrzaSAMwm4uJlnqwFoe8oWd0p7j5MA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7kkXYNmmTxuK4n7Its9i1eJ/efWWO+fLH8zFmSFv hHjrjvWUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIkoODD8TyzyeFFxSf257B2X uNWfwiyLX3rwGyqnp5xtm+W4KdQii+EP5+W/OpEneXrWlmz+EJjkdCHE8g33+turXFiMHj+yWn6 WCQA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772656627017269967 X-GMAIL-MSGID: 1772656627017269967 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_modes_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c index bc4aa2ce78be..1e9f63fbfead 100644 --- a/drivers/gpu/drm/tests/drm_modes_test.c +++ b/drivers/gpu/drm/tests/drm_modes_test.c @@ -36,13 +36,6 @@ static int drm_test_modes_init(struct kunit *test) return 0; } -static void drm_test_modes_exit(struct kunit *test) -{ - struct drm_test_modes_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - static void drm_test_modes_analog_tv_ntsc_480i(struct kunit *test) { struct drm_test_modes_priv *priv = test->priv; @@ -148,7 +141,6 @@ static struct kunit_case drm_modes_analog_tv_tests[] = { static struct kunit_suite drm_modes_analog_tv_test_suite = { .name = "drm_modes_analog_tv", .init = drm_test_modes_init, - .exit = drm_test_modes_exit, .test_cases = drm_modes_analog_tv_tests, }; From patchwork Fri Jul 28 09:06:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp311764vqg; Fri, 28 Jul 2023 02:39:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlEHxXsZkODrZZBqYIBIsNoAiULNixK+hl0nS02I003f7jOqeKIDIa7V6tN3DR5iNUhEkpaV X-Received: by 2002:a05:6512:39c5:b0:4fb:89f2:278e with SMTP id k5-20020a05651239c500b004fb89f2278emr1453938lfu.68.1690537167671; Fri, 28 Jul 2023 02:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537167; cv=none; d=google.com; s=arc-20160816; b=PXTwyBF3RQIngGL1MWJqIK5LFHnGmbogYDqcJ78cN5rRw61sp+sYnQMk8Km4hnmayo WdfXagZWNmhkwnDOQUBam2DTnNgmK0HO6Y7XI2sCgf7hRp777uvnVXIOP48ixJbjnNpZ Qcz0VlpASLF44GATBjKkEvDnts2BvkDevXOfbROh5D1EtXR5xTyM14k3c/QlDl0H61c2 uXA6V8J1yOzTL6oO89WKL/R2VS453XIoRO6EAk6CAf9onPWsvx43CCxXa0zCHxZhdmW/ wcEyKCFynlZoCnU13hi/YskD0Gg9hboid5dV+XWIWo/UmhQlpH8RLcrgvdqk9QsiEqQg ZlPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=4HWS1rQ9SRdXpykN7OS/MY7ST9eMvE9x2FAA7u6MTIE=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=SrHhndQnaKCBOcdd9iwblL47pSAlM58BuLSzbFs+z8Wr9pi9SpERFbrAVqQv8zh0OS KudCxn+5Pj2skwUVbO6HNrE40XoRc6TpWFh5bRqnGtgg/ToMh8Jb3YA42vDTiKma9LWY G0uCjlt2XtaiVtC7olgTakA3VHJ3W/d5TCPqOVtbWf55HafgMi5XJaZI3Et1AOKu1fiW om+Qtx1GM4c4TV9tkmqkfDt/tk0dNLFOoDPjfZRF/aRRd5skZrbl+Mu5mRwqBXI6TdSB eGyHs+SXW0vRQ5S2C1vmBqMcvdSY6Q8dcWblAeS+fiISBINw8R0BWSDfTUfqB5J5YMEg Q37g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PUkgS5Mg; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a17090608c500b00986486cb8d6si2421395eje.705.2023.07.28.02.39.03; Fri, 28 Jul 2023 02:39:27 -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=@kernel.org header.s=k20201202 header.b=PUkgS5Mg; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235168AbjG1JHH (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbjG1JGl (ORCPT ); Fri, 28 Jul 2023 05:06:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 570143AA3; Fri, 28 Jul 2023 02:06:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6F246208A; Fri, 28 Jul 2023 09:06:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAC51C433C9; Fri, 28 Jul 2023 09:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535193; bh=UK1jgKPZq760d+4leDr/t1IScaR42L2ZHmmPQI4t65A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PUkgS5MghRahlUNlrtvWxP6PfwcQZW+A1vejORtsU7U4yyfSUPCVJSx48HOMZB/bQ f2GRin3N74khCrphR1SNTjBJ+Zgh/VwPqLf9LS0YWloAnB9aSQybaoNqOjYiXLqcpa vL2HVeI9zevy7a++hAbxBLMoXUVd+H2SAWdYiwMgXFaqMCGYylgxUTkNaHrUItK6PJ 7BHERs+3/Tq3TUJgcg9TXvI7MJ4CGxeD+c70EdlvaXIYGyxTuSAqLbPeGRncJ5lgkP YqSdXXWPUOajSItGVnMElmOMtpw+RRzGbCq/6dwkW+hzvDUJM1CiGXCrqP/pAvjWnr z+sUIpnFd98bg== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:17 +0200 Subject: [PATCH v3 04/11] drm/tests: probe-helper: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-4-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1493; i=mripard@kernel.org; h=from:subject:message-id; bh=UK1jgKPZq760d+4leDr/t1IScaR42L2ZHmmPQI4t65A=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7l4yuRvvegrvfhG93ducdA8Za7puy8KnZg3q/hxe oB/W9yLjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAExkex0jwxYGB463ltcd0g2T 13n1/u0Inpcvr//A59UcX03BL/sv8zP8T5lUdz+Rn/Vb5auL/h/i22+vSP5Tcvz08++3O9fo5e/ 5zQ8A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772656701334000983 X-GMAIL-MSGID: 1772656701334000983 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_probe_helper_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c index 0ee65828623e..1a2044070a6c 100644 --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c @@ -60,13 +60,6 @@ static int drm_probe_helper_test_init(struct kunit *test) return 0; } -static void drm_probe_helper_test_exit(struct kunit *test) -{ - struct drm_probe_helper_test_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - typedef struct drm_display_mode *(*expected_mode_func_t)(struct drm_device *); struct drm_connector_helper_tv_get_modes_test { @@ -208,7 +201,6 @@ static struct kunit_case drm_test_connector_helper_tv_get_modes_tests[] = { static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = { .name = "drm_connector_helper_tv_get_modes", .init = drm_probe_helper_test_init, - .exit = drm_probe_helper_test_exit, .test_cases = drm_test_connector_helper_tv_get_modes_tests, }; From patchwork Fri Jul 28 09:06:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp311707vqg; Fri, 28 Jul 2023 02:39:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlEa7oKoOAZLWf1TZhQ+CeAF1nhQkS0grFPFU6Fw4OH+bYHgzibz1V/s+BUzjM8MyovIejrQ X-Received: by 2002:a05:6512:e9c:b0:4f9:72a5:2b76 with SMTP id bi28-20020a0565120e9c00b004f972a52b76mr1544697lfb.65.1690537159766; Fri, 28 Jul 2023 02:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537159; cv=none; d=google.com; s=arc-20160816; b=nHT0ok2PWs4NIGo1O2ZhkUUhCQLf9bwAvKVNvzqg+75ni1peAJmjW14id53Lax3AyT UFdYIpiVxcuD1MZ/ADiK/e1LMrD8cglLFBUEq11ixSZIO51Ie8TDgLxQf5fdPgae0l8m YxN+O2C/tUoKb9dNv2U7KIayRZU/VDJWkflJzWCjsPfwXwfMLTqBwCsMMBtb8MwJJMoy wF0A4EipqBtCb6mEjjGqXhCBBrPie3HBwVeIqPeBJZXslGLkLLofowviEYcN5mUAWKu7 EaM6IOmvpbBRJayp4ncaVwRKlkSwneuqBj/PpJDI9IUgocUO7LcB7JPthfRUpdbuf7Eh CgSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=XGoSUVc6/th7389d/S9oD6WemPACbzku6Nmq6ZtUb8w=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=FZOCJgR0UGHb3+bjQ1sKmGpzt6Qu+GfNDjI47RF6BJZTuSUaz3Cx1t71n7Hlx9Lmbw GlXlccb8Br4gYFSP5SxFYaQOnkM67O1T1q0FlzDxkboKJTI5vx49aPOnxlBajB282Shj RAqIy12G8nTODcLxNGvljFB7Gn0eB8JFeJmW1Acuz5Ccb0d4EHkzoNe3vZ+pzEYNDlAF PMQ14kCixWcG1zmCiqyTy3Ff5jhitzgYqfgnJtda7aZgJ735Otj0SzyDwjue3Nazurwj 4I5x6t01e882adb/b1j9fVHLz4PmkHPvZR7QBggORd6KZjTH0MY/MtLEh7FgQidt3kFn d0PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BfiZkwkX; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090616ca00b009662960f217si2409483ejd.303.2023.07.28.02.38.56; Fri, 28 Jul 2023 02:39:19 -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=@kernel.org header.s=k20201202 header.b=BfiZkwkX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235220AbjG1JHM (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235198AbjG1JGn (ORCPT ); Fri, 28 Jul 2023 05:06:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B383C04; Fri, 28 Jul 2023 02:06:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0644862094; Fri, 28 Jul 2023 09:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14D09C433C9; Fri, 28 Jul 2023 09:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535196; bh=rR8033KXv0zZnQXPCqyRQXfcEtV4ucVkU5KdD2FOX+8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BfiZkwkXfy7WLkYzfOkdcBv5YfU7F+Q6m2UJj42jABhHfacU3cmqh0PjuF7IS/b4h ECdB6oA/6Ko8RKrd2STzJ59Is4h4eGABWIB8cOHccg4ujVpUoNjXL8ABQ8JBnE3G5F Pp3Nncbzfqz1BdDA7MdrzZcXmSHWefzo//YKrv2HjQlDrb/A2Q80UN6/AXm9oPVaqa pR9DkUc/xt9nqqSfwy1q7iXwM/L6g17WaovnTvK8UBz7hW8JQ2lYCmy4usRFRvT7zo GtqwpcxWC4YhZlhjq4DmbZrWn0L/+QC9CfKY2UkwGvpcDBFI5E6w/CEBhgHG9V3WvD JTNH2WVH5HIGA== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:18 +0200 Subject: [PATCH v3 05/11] drm/tests: helpers: Create a helper to allocate a locking ctx MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-5-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2703; i=mripard@kernel.org; h=from:subject:message-id; bh=rR8033KXv0zZnQXPCqyRQXfcEtV4ucVkU5KdD2FOX+8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7muGUf+2Sg4L7NBgcdTNDtDcsE3iZN9HbUC4c+TG /SLuRg6SlkYxLgYZMUUWWKEzZfEnZr1upONbx7MHFYmkCEMXJwCMBEpZkaGhn3/ZzSfUDxXMq05 KVaBT3KeydettTYXL7gt2fjr0R51WYb/HmllL0TeCywrLAhO+H4mcPK31h09E6xz7rTWJZ87PKu WAwA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772656692969243635 X-GMAIL-MSGID: 1772656692969243635 As we get more and more tests, the locking context initialisation creates more and more boilerplate, both at creation and destruction. Let's create a helper that will allocate, initialise a context, and register kunit actions to clean up once the test is done. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 41 +++++++++++++++++++++++++++++++ include/drm/drm_kunit_helpers.h | 2 ++ 2 files changed, 43 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index cdf35421e641..35ea4a34909d 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -146,5 +146,46 @@ __drm_kunit_helper_alloc_drm_device_with_driver(struct kunit *test, } EXPORT_SYMBOL_GPL(__drm_kunit_helper_alloc_drm_device_with_driver); +static void action_drm_release_context(void *ptr) +{ + struct drm_modeset_acquire_ctx *ctx = ptr; + + drm_modeset_drop_locks(ctx); + drm_modeset_acquire_fini(ctx); +} + +/** + * drm_kunit_helper_context_alloc - Allocates an acquire context + * @test: The test context object + * + * Allocates and initializes a modeset acquire context. + * + * The context is tied to the kunit test context, so we must not call + * drm_modeset_acquire_fini() on it, it will be done so automatically. + * + * Returns: + * An ERR_PTR on error, a pointer to the newly allocated context otherwise + */ +struct drm_modeset_acquire_ctx * +drm_kunit_helper_acquire_ctx_alloc(struct kunit *test) +{ + struct drm_modeset_acquire_ctx *ctx; + int ret; + + ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, ctx); + + drm_modeset_acquire_init(ctx, 0); + + ret = kunit_add_action_or_reset(test, + action_drm_release_context, + ctx); + if (ret) + return ERR_PTR(ret); + + return ctx; +} +EXPORT_SYMBOL_GPL(drm_kunit_helper_acquire_ctx_alloc); + MODULE_AUTHOR("Maxime Ripard "); MODULE_LICENSE("GPL"); diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h index ed013fdcc1ff..4ba5e10653c6 100644 --- a/include/drm/drm_kunit_helpers.h +++ b/include/drm/drm_kunit_helpers.h @@ -87,5 +87,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test, sizeof(_type), \ offsetof(_type, _member), \ _feat)) +struct drm_modeset_acquire_ctx * +drm_kunit_helper_acquire_ctx_alloc(struct kunit *test); #endif // DRM_KUNIT_HELPERS_H_ From patchwork Fri Jul 28 09:06:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp316601vqg; Fri, 28 Jul 2023 02:51:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtMRrwaj+OsMIoGVZQkvt0rUDOd824Yz7KNTeWBSducUqgwwhwkK3PRDoSd5aGTjiTMD5R X-Received: by 2002:a05:620a:2451:b0:75b:23a1:8336 with SMTP id h17-20020a05620a245100b0075b23a18336mr2346063qkn.49.1690537865837; Fri, 28 Jul 2023 02:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537865; cv=none; d=google.com; s=arc-20160816; b=wG5vsdR1ssOkYR5ePj8mvnL9/crVo6kY+/4e3DiaTQdNE/VZBcXGUW03sYsVM364OM XC8PH2Sm6k++3faor+ojO+rVwWEgxbZF7z9UXRMm9dbpDNkMaYlwzyCzN3kuTsWmVr3C HeaFaf00GrJc7VxJNK+oOWGckLXA38c6S7v9cfGBpS/6KLhSL7iPCar3kKhmSKAty2nU U000a0cs8TzJ1bGCvT4tAbumjKkR+rAFCz1V+cOmQq8I0cgvcmU12NR1d3QU71u3cpXq eazznw7C5mSU/dF4MeyIgLILIHgRJnA/ktMA0r9c65tmd43cqufzIFBOncM0MksiD9Vk PqTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=F5IpNQjsPjK6k+HI+wsFYEWnnXCTnU6M+1uxDqKCbsE=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=uUwhThnp2JIPhkTIMR3H3iGERi2G79fxh3G7RUy+wZdWkamXntCv62bJKpWvrMAYai vmnDFSxdOqAXKC+7tvtAxqPXO8V3qEZpp+jwFDud/uou6sCnVcKPVZj6ti8mLvoIXpxv fqR04NG1SzHmgIbRy+tDye5vus0PcDzCDyjqynx6m2SvZITcL/zARsc4VXtUcHkoIkly i2GIQPih9wF6dcI4wIBcYM0EZtnnt/2ipzsCb3hni6oByeArDQ0pXXTWwVMmQUPhBbyu deASSmvaUi32YT0I/hmGPzp9XcU5IzR3xmRRvKtXJeGvClH0IKFNa5tJLGmJ5HQTWsYQ CQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TCYuV47W; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a1709027c1800b001bb94f4112dsi2686592pll.580.2023.07.28.02.50.52; Fri, 28 Jul 2023 02:51:05 -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=@kernel.org header.s=k20201202 header.b=TCYuV47W; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235334AbjG1JHa (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235284AbjG1JGr (ORCPT ); Fri, 28 Jul 2023 05:06:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5699730DE; Fri, 28 Jul 2023 02:06:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C689D62087; Fri, 28 Jul 2023 09:06:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D706AC433C8; Fri, 28 Jul 2023 09:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535199; bh=glqLVfxH2FzQa0kBwhFP6pFwhRUvrw5EmHCeG8i7sAE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TCYuV47WRfvlWfegR/SM0w+A+x4i6UcNBNxpgEIF7c64NvVpcey7vXwaRxaJmxEO3 AUvQwahhv8RFEPCJctBmJMbRPc0kFrWkGRW+b1yGkC7s4jYx0+XE7xvS7nfsc9t84k zzSOV4YcQQQIXrvYEYN/i6HiSYkG05zhZsayVNj8BE6nmhBBxDQV0+ojAf9h5KOATk ibosE9qoO+GMlNO3dB8ADIYU/uA6GmJO8OndTgUFlMVT7tbAt4K6js3vS5GFxNCXav 6aMiiYcqMpYw+baKHpyd/zIHJF+Sfqp/BCdpI3OJnZiuHZpVvOrNNiuX924QKCeaf+ JWN8ApmyHURGw== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:19 +0200 Subject: [PATCH v3 06/11] drm/tests: helpers: Create a helper to allocate an atomic state MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-6-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3075; i=mripard@kernel.org; h=from:subject:message-id; bh=glqLVfxH2FzQa0kBwhFP6pFwhRUvrw5EmHCeG8i7sAE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7mul79aduU7b2fpY/Ppz//fnFJ9/rDO/2eaLA4Mm 3e3fp07u6OUhUGMi0FWTJElRth8SdypWa872fjmwcxhZQIZwsDFKQATkV3CyHDzg19N666QrMTT XOcVQn0uZS4+8UqvpMps51YzzawjD7gZGRa0PcnU+a3SsvfR8q55J+++8Fp8J7/S+UKo/RGB4DN H1nMBAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772657433192160693 X-GMAIL-MSGID: 1772657433192160693 As we gain more tests, boilerplate to allocate an atomic state and free it starts to be there more and more as well. In order to reduce the allocation boilerplate, we can create a helper to create that atomic state, and call an action when the test is done. This will also clean up the exit path. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 46 +++++++++++++++++++++++++++++++ include/drm/drm_kunit_helpers.h | 5 ++++ 2 files changed, 51 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 35ea4a34909d..3d624ff2f651 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include #include @@ -187,5 +188,50 @@ drm_kunit_helper_acquire_ctx_alloc(struct kunit *test) } EXPORT_SYMBOL_GPL(drm_kunit_helper_acquire_ctx_alloc); +static void kunit_action_drm_atomic_state_put(void *ptr) +{ + struct drm_atomic_state *state = ptr; + + drm_atomic_state_put(state); +} + +/** + * drm_kunit_helper_atomic_state_alloc - Allocates an atomic state + * @test: The test context object + * @drm: The device to alloc the state for + * @ctx: Locking context for that atomic update + * + * Allocates a empty atomic state. + * + * The state is tied to the kunit test context, so we must not call + * drm_atomic_state_put() on it, it will be done so automatically. + * + * Returns: + * An ERR_PTR on error, a pointer to the newly allocated state otherwise + */ +struct drm_atomic_state * +drm_kunit_helper_atomic_state_alloc(struct kunit *test, + struct drm_device *drm, + struct drm_modeset_acquire_ctx *ctx) +{ + struct drm_atomic_state *state; + int ret; + + state = drm_atomic_state_alloc(drm); + if (!state) + return ERR_PTR(-ENOMEM); + + ret = kunit_add_action_or_reset(test, + kunit_action_drm_atomic_state_put, + state); + if (ret) + return ERR_PTR(ret); + + state->acquire_ctx = ctx; + + return state; +} +EXPORT_SYMBOL_GPL(drm_kunit_helper_atomic_state_alloc); + MODULE_AUTHOR("Maxime Ripard "); MODULE_LICENSE("GPL"); diff --git a/include/drm/drm_kunit_helpers.h b/include/drm/drm_kunit_helpers.h index 4ba5e10653c6..514c8a7a32f0 100644 --- a/include/drm/drm_kunit_helpers.h +++ b/include/drm/drm_kunit_helpers.h @@ -90,4 +90,9 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test, struct drm_modeset_acquire_ctx * drm_kunit_helper_acquire_ctx_alloc(struct kunit *test); +struct drm_atomic_state * +drm_kunit_helper_atomic_state_alloc(struct kunit *test, + struct drm_device *drm, + struct drm_modeset_acquire_ctx *ctx); + #endif // DRM_KUNIT_HELPERS_H_ From patchwork Fri Jul 28 09:06:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp301870vqg; Fri, 28 Jul 2023 02:16:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlEh7Y/DXYrG1ShJQEDwj17PGHLa41/TXgU6fGDyDwv4xig1c8wzJ9enZAIKNtc7JwnQZE2d X-Received: by 2002:a05:6402:326:b0:522:5855:ee78 with SMTP id q6-20020a056402032600b005225855ee78mr1389696edw.32.1690535768855; Fri, 28 Jul 2023 02:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690535768; cv=none; d=google.com; s=arc-20160816; b=AmXIvEiT4B94w1RDMxv5W1Kaxyupm8nst9ehr3S50fhoDXKTZvXLGahSCGMKj/Fq1x tOefiLbqVokBSwiiXoV1sLEUWKxmXqNvV8YRaktnjwdMG+c3950CgQ8/r43EVXtfQ2xR jnAb8QFKn2t0/FFBjofdMeLOccb+dIdP4FgyMIANCb9EN+LsgFVWAWhd8VGIuLrC57y1 DOXbihArdB6PoZPQfL/nSAq02R6lKCZx8k/SoJNL8r/aF7MZiaJKYyfVaPxsH1fFT6Nt AXpiHpKzeB8rgdon+CQFOWZGMfBpegel4/lrAPXohwrQhYsf4g0Lii6NPelSNLBPWtjU n0vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Ati8xJCChl7zuZfsDYHSmLOG7qzYIKqsc1AETQlOaBA=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=dIWQSZK42M2Pk7X5jbhRhemj+lWgJ/cKaU4ZE8Ti1AjRPX6PghKF2MDzYV3BCPHAsS eWASu/irJYB45l+UOzHGLPwi+XennvIpjRsyD4C6M7kS7uEE8MmAszXR/r5vM/Yg/6Fl K0ojD2FpN0UHyXXxKuL4VTQK4BeJwxYAcGIpmeEOgJ00augYJ16iNUozXs3HoPNlisn2 154c+7Wis6GFJeRRTUQxHKviDvTkiHoklJFO7BD7oRDDpe2znztt+dLavLyNrhEFYarp CSXDB+bUnUhBiGfKqgVZz/NVoSF2+7ho+eDXbfqvSd2BZCiR1+7f9ixlquUTTwV7ycKk EXUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VvrGDiKU; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020aa7d983000000b005222114ba0asi2380973eds.390.2023.07.28.02.15.43; Fri, 28 Jul 2023 02:16:08 -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=@kernel.org header.s=k20201202 header.b=VvrGDiKU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234748AbjG1JHd (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235296AbjG1JGv (ORCPT ); Fri, 28 Jul 2023 05:06:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B8230F9; Fri, 28 Jul 2023 02:06:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A58AC62085; Fri, 28 Jul 2023 09:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5499C433C8; Fri, 28 Jul 2023 09:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535202; bh=qPRZQkGyxFKuP0t7o+B34vYPs8lDG/wXUsYgJ3yYNaw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VvrGDiKUc+0f7Xy18//Y4e6bS6FVMRFiLkjWhdUJK2tBzbrnjmBWlhRfe8GE7Hqoy +XQVCdOVaC1lm/x8JB6kgbi2oqBrG2jZpnKLfm/zuJdcKOYBJhZOAIwsHyc10xg+AN 1RVzfmn4n60Sm2ZlwDxjJypPY1779Omu0o9MYxH14/aGVuR95YfKUaHGx/fcMuzfvE fMWdxussYbIStujkapPxrmtIIsPv/8TSM97l5ROQZum3QXU3cPrOop3Q4oow2ljuV4 njz7dDI0cjjGRHVtNEld9v9c3hl7qQHbGyJm3jZNxlkulLP45aUaM6B99W5EIHlpxY IdEv80Tjz8Img== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:20 +0200 Subject: [PATCH v3 07/11] drm/vc4: tests: pv-muxing: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-7-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1904; i=mripard@kernel.org; h=from:subject:message-id; bh=qPRZQkGyxFKuP0t7o+B34vYPs8lDG/wXUsYgJ3yYNaw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7mi1Heen7gwWPjr3ja+1OSNhW6zxEqFNmua/XnA1 bLlyqnrHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIhSmMDDftL1tfesDvkMPZ 7xZc53F/mVW3JLfb9Hybx48r16y/+oaR4dFVz9uxSxYlWDL82D5jYcJDwdAHLMa3l6g/Ssrh7hO oYQEA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772655234113010906 X-GMAIL-MSGID: 1772655234113010906 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index ae0bd0f81698..6c982e72cae8 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -762,7 +762,6 @@ static void vc4_pv_muxing_test_exit(struct kunit *test) drm_modeset_drop_locks(&priv->ctx); drm_modeset_acquire_fini(&priv->ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static struct kunit_case vc4_pv_muxing_tests[] = { @@ -873,7 +872,6 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) @@ -963,7 +961,6 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static void @@ -1017,7 +1014,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Fri Jul 28 09:06:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp301877vqg; Fri, 28 Jul 2023 02:16:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlEgORvpLK7OKf+RRXBswQN0mmychikexcGIYYLTJmyCmUtqQU7fqLYmTouNtjRi5knIsQSf X-Received: by 2002:a17:906:9bf6:b0:98e:1b9b:aef7 with SMTP id de54-20020a1709069bf600b0098e1b9baef7mr1654059ejc.64.1690535770154; Fri, 28 Jul 2023 02:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690535770; cv=none; d=google.com; s=arc-20160816; b=fnzlLLeW635766qxHzYltkPrD/i1R6U04khjOUxtCqNvNe5nEN0iEecOgvjkqeXWbt AuYy1lrSXve3tbTjrkJrVgrUwOHtIzwNpFtZvpdovtYZJRfB7nxsxTo6QmQd+B+aRGe0 fGd4sb0CKsMUO4SmOsGFswDk4uBn68LGPytMbeMVkmKAtufVajdZ0i6X9toH+GFfB8Od m/Y0Kn5FJyJSGxtiPhSLBfIiDPJFQkvA/56eT6wPc0ZNmZSOFZihhHi4kSbR/dAX8MNK Wll29/c11GlYcG9ZBeUKZLXBI+/4jT/2zDVg+B3TTfhmZ9d/6vCX70YpgurQvGoNjzO6 GUjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=1kqYCFPivwANRNvRiH/RsTTCvye/Uj/LQIbkfaqFlbY=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=B4yY3ReWiXQitG/mgDCeqcfihndh7n02b6iVTVVLPfc0zgneXhlw3YhHUo/J1uOvV4 tiaijA1YC15gdt8AJMgsFFXuFCMO/M/1UDaExnBsZjfVDLyhYC5uhROw/LFIXMirbyzs of6TADKWdRQdXQCWAN0WRqEIt0qb1M/q/BMvS1ZB//zgnSpmLEqUGyxBxGNDkmteB0Mu kokMA0WXacE8ApSDhyeP41Bplr+4G15TnnD1b/o+alA3Dmj/THnWOnk/+OxASQCViiSn mDdatQE3CZjHEO2i2s+rQAWCM5s4j6c74LGg/jMZQsQI7wDK3l+g4hu4WuKi7lOVV7LQ jkkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aWjLrPtF; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020a170906689500b00992b9bf21casi2131402ejr.445.2023.07.28.02.15.44; Fri, 28 Jul 2023 02:16:10 -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=@kernel.org header.s=k20201202 header.b=aWjLrPtF; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235344AbjG1JHm (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235304AbjG1JGx (ORCPT ); Fri, 28 Jul 2023 05:06:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0929D3C38; Fri, 28 Jul 2023 02:06:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A81362093; Fri, 28 Jul 2023 09:06:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89645C433BB; Fri, 28 Jul 2023 09:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535204; bh=1UiDoJdsZdETlRHbbrWcp8fAOtRJQarLo3aDiFC5mOA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aWjLrPtFeTFF3DUAJFhDwejP+P6UjU+GlD1d308sKt7t+pqX14umsMxTKlEfPjqub CqVJle90LkYEtRk9K2RNBhhnCuqF2wIIYrqijkOYYEvteCjA0+VKe0O26fkH4c+P8n 4h0a40Mh5SFZQxdMbulB6zDpeUznlPYitMpfuC31PqnfehzVV26fqh4c6SAocCQeKC MyMItli1PyAaLN93p1mVhXNFonzw081VZ6yvK7n4Jq18WlQxJO8fRN+RmUDNvrRyuy 2MpaGyke6Wml163Nt2rzxKXwKigrQyXBOIETZ2YdQ/Z09+tEySKcfBPtjZZI4EKMd6 KpGpNSjMetS3g== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:21 +0200 Subject: [PATCH v3 08/11] drm/vc4: tests: mock: Use a kunit action to unregister DRM device MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-8-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3108; i=mripard@kernel.org; h=from:subject:message-id; bh=1UiDoJdsZdETlRHbbrWcp8fAOtRJQarLo3aDiFC5mOA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7ls9Vd1/vIM/ql4a7WB8cTFcjWaKR/dc7V4k0Tnh vLcOCXdUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIk82MPI0DVT2+WywZ+1P6Iz Zotv2Xtm597m5dXH/jYK8J+RZ/92MpGR4feeI3KiGmuvCEc2HfAMnfVwXkLxK55/6/SCs1mZDPj mswEA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772655235780611941 X-GMAIL-MSGID: 1772655235780611941 The *_mock_device functions allocate a DRM device that needs to be released using drm_dev_unregister. Now that we have a kunit release action API, we can switch to it and don't require any kind of garbage collection from the caller. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_mock.c | 12 ++++++++++++ drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tests/vc4_mock.c index a4bed26af32f..63ca46f4cb35 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -153,6 +153,13 @@ static int __build_mock(struct kunit *test, struct drm_device *drm, return 0; } +static void kunit_action_drm_dev_unregister(void *ptr) +{ + struct drm_device *drm = ptr; + + drm_dev_unregister(drm); +} + static struct vc4_dev *__mock_device(struct kunit *test, bool is_vc5) { struct drm_device *drm; @@ -186,6 +193,11 @@ static struct vc4_dev *__mock_device(struct kunit *test, bool is_vc5) ret = drm_dev_register(drm, 0); KUNIT_ASSERT_EQ(test, ret, 0); + ret = kunit_add_action_or_reset(test, + kunit_action_drm_dev_unregister, + drm); + KUNIT_ASSERT_EQ(test, ret, 0); + return vc4; } diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index 6c982e72cae8..776a7b01608f 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -754,14 +754,11 @@ static int vc4_pv_muxing_test_init(struct kunit *test) static void vc4_pv_muxing_test_exit(struct kunit *test) { struct pv_muxing_priv *priv = test->priv; - struct vc4_dev *vc4 = priv->vc4; - struct drm_device *drm = &vc4->base; struct drm_atomic_state *state = priv->state; drm_atomic_state_put(state); drm_modeset_drop_locks(&priv->ctx); drm_modeset_acquire_fini(&priv->ctx); - drm_dev_unregister(drm); } static struct kunit_case vc4_pv_muxing_tests[] = { @@ -871,7 +868,6 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes drm_atomic_state_put(state); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); - drm_dev_unregister(drm); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) @@ -960,7 +956,6 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) drm_atomic_state_put(state); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); - drm_dev_unregister(drm); } static void @@ -1013,7 +1008,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku drm_atomic_state_put(state); drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); - drm_dev_unregister(drm); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Fri Jul 28 09:06:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp316127vqg; Fri, 28 Jul 2023 02:49:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEA7Urd3Tjq1X9I023AJxsWElloePhTREY8t8oD1kuU5RGDcvwASgeRsYw/DMVu9djncsGb X-Received: by 2002:a05:6512:3705:b0:4f6:2b25:194e with SMTP id z5-20020a056512370500b004f62b25194emr1075125lfr.58.1690537793396; Fri, 28 Jul 2023 02:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537793; cv=none; d=google.com; s=arc-20160816; b=yOZP71H+GfUKJUPNsSN57w1j4BYTbSx24iHnz7HlFb+rp0aH2lbwGw7VZokrVigKdu TeQ665uCtroYpfwwmzoL7OG6MI14ygXPP19BOWhGG6W1AG5o0WFVqkgIP3ihE3MzbJJj BdwawZ/9ez2IS/ev0nCD8KUxyWwxiARsV5NS2QBoRkcAa7gmj2Zzx5oclNlfO42NnW3Q 0Bi6bEYHs3iFFPsuBy25fG4062NMAIBDm+UmL2pBFywobopfBW+AQsva4fKX3VeSS/NF xu92wQonELsKfOi/c7fcRfzgqzCs2RvyhtT1BhD5Y02AlfU04PAL8bumruRuYjgSFW2j iPRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=OPhy7aDJtYCuhEaS0EzUjxUsUrAFaTpitltd5ZKMD5E=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=LSXdINq247pTsjbZIY2+MJZduRa0Mc2qNIbLVFs4/Fq3GZBd0XJfit/AEsTHTlks9l +oycc7cDl0NMjiC8yUOQePt/Pt25+QY8DKAEcfNrc1Ozx77Cl7PU8IWelDU4fK1FnQpA hhJT9qY/vm1PdisykaeHav2ICmZcPqVDP9LPTZSKWHdePPxQs0n6cPYRfeLeNA3INLdF /F9zPKxx2M1+a+HeS6yu9ctNM88pqRLCvR9lc8DPdpXRsU+rTtBiTrGev2VDYzzZbsyp n4FdbVmfHEtqn0Pomct+L7NB/yH23fmKEXOFo4oiBfaJoXcQqZ9yyvrCrXnf1Vpf8fzy QybA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BkjGR0GQ; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170906838200b0099bca88ac50si2428661ejx.21.2023.07.28.02.49.29; Fri, 28 Jul 2023 02:49:53 -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=@kernel.org header.s=k20201202 header.b=BkjGR0GQ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235243AbjG1JHz (ORCPT + 99 others); Fri, 28 Jul 2023 05:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235239AbjG1JHD (ORCPT ); Fri, 28 Jul 2023 05:07:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2865420C; Fri, 28 Jul 2023 02:06:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E54936209B; Fri, 28 Jul 2023 09:06:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF1EBC43140; Fri, 28 Jul 2023 09:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535208; bh=/PJy9fXDrFHeCTVzkqLb6iWkphI6XwY0EAi+vbVT1qo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BkjGR0GQZXMDHGmx5LDazP/PpSP5rELwWN+STrYiVgDu1rdUOhslvxOqeCz10GhPH lRKz8wesgMnSDHrsSKspPSdiFDfwUsZj/r8KwyT7dcigN6dvRk9yiu/fDgcnb1H0kt px9opsbrt8sO1YHw3WSrYcFGuMVKAF+gJFlZWpnYV2aBhjhWX6TmnyJ5vetWQKSpVI m2nIkB0eoc2ca8MmylaZd3TqNyaqrqXSSo1e2QQv6b3lZ1NevxPSQRMMBBldLLoqYZ dkl6ajcn4bb7Xn9UqBAzyH7JGAcK182yBGwrX6pe8YYGu7CAA/HDE0Utn7xUEjpTd1 qVL5vw49UIIMw== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:22 +0200 Subject: [PATCH v3 09/11] drm/vc4: tests: pv-muxing: Switch to managed locking init MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-9-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6554; i=mripard@kernel.org; h=from:subject:message-id; bh=/PJy9fXDrFHeCTVzkqLb6iWkphI6XwY0EAi+vbVT1qo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7lqxI5dfbowMFfELO3xklX3JF7d//l8WlsJ886SW 1ZyExmqOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjARNn+G/6FrzknsO5O7ds/8 jdyS1QF7njJPPRD9zf33az1Tk9IX0lEM/+uzNyVqXE2K3LV++zwZ1k5j05m/rSKj/G973PuXeXu LIzcA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772657357387577528 X-GMAIL-MSGID: 1772657357387577528 The new helper to init the locking context allows to remove some boilerplate. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 42 ++++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index 776a7b01608f..ff1deaed0cab 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -20,7 +20,6 @@ struct pv_muxing_priv { struct vc4_dev *vc4; - struct drm_modeset_acquire_ctx ctx; struct drm_atomic_state *state; }; @@ -725,6 +724,7 @@ static void drm_vc4_test_pv_muxing_invalid(struct kunit *test) static int vc4_pv_muxing_test_init(struct kunit *test) { const struct pv_muxing_param *params = test->param_value; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct pv_muxing_priv *priv; struct drm_device *drm; @@ -738,13 +738,14 @@ static int vc4_pv_muxing_test_init(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); priv->vc4 = vc4; - drm_modeset_acquire_init(&priv->ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &priv->ctx; + state->acquire_ctx = ctx; priv->state = state; @@ -757,8 +758,6 @@ static void vc4_pv_muxing_test_exit(struct kunit *test) struct drm_atomic_state *state = priv->state; drm_atomic_state_put(state); - drm_modeset_drop_locks(&priv->ctx); - drm_modeset_acquire_fini(&priv->ctx); } static struct kunit_case vc4_pv_muxing_tests[] = { @@ -798,7 +797,7 @@ static struct kunit_suite vc5_pv_muxing_test_suite = { */ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct vc4_hvs_state *new_hvs_state; @@ -811,13 +810,14 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -844,7 +844,7 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -866,13 +866,11 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct vc4_hvs_state *new_hvs_state; @@ -885,13 +883,14 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -929,7 +928,7 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_del_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -954,14 +953,12 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) } drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct drm_device *drm; @@ -971,13 +968,14 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -993,7 +991,7 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -1006,8 +1004,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku KUNIT_EXPECT_NULL(test, new_vc4_crtc_state); drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Fri Jul 28 09:06:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp316531vqg; Fri, 28 Jul 2023 02:50:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlHY8gyhGxgA9pLF7lJTybN3yAFg8EWv+bxCE4luPeHLJTcJQAAiGdz3wieIzkgc1x9g6Dd3 X-Received: by 2002:a17:90b:1e0b:b0:268:5fd9:b660 with SMTP id pg11-20020a17090b1e0b00b002685fd9b660mr1227756pjb.39.1690537856643; Fri, 28 Jul 2023 02:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537856; cv=none; d=google.com; s=arc-20160816; b=UKekfcDueEfeoWqKQIt4Xc53Sx8SOCOcEhHZ3cDpdEZMgOljWUlOuhJIiXYDa5Dwob FMqU378G2atacO9iQPmgRmPwZc9EMnXwunEYGYE+QRttQ4UlJtFlhanLSmwoYNJwEhFq 7MupGj2SuLjHFrX7VAFRQWqDmjHynCtxepaC+7yMg8bRG7ou9CgKYhpQg6Kl55SJPo5Z WGyRj77+9pWOASkQUbTtAojwoUDdTIduAFiH+KsSC9sH91ifMWZ8bFhQ2gsFkMHoM9cS 1eV7xSlwA6fKAGOo7JvWCWVSEScREPo1Ikbj4f5lNZoIJO72JEvMzxy5OejrMChwKXlm K+Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=SOP0FfRhkXgencpgAW0mYavgCV7aR0SzeOsJ6pIk32Q=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=hkKbqhrjWIvZGrPpavoMVqvqcR7TjZn5gWf15sYvnlhbtfqhk6gl4o4jcKPvhjCzxv 3dxgCyWUBs0/ZVe7aL60WvLnf+R633pjiqnEBX6buL9hL8+ZVUxeWZKKd33BJaYMm5Td /GxIvetyBCFwy0PkRc5iaEfJbkZIHwAEdhs9TDQpA6R+N/Z2mwBfQlHUO4LrZfRHlHv+ +etzVoYcQ4Pm2lEw1PYchaTD0tGjzKyfhgd0XSYa6RAiA01pJVpAlmzGRrIatAV2hApB MwVsqTBrhtWMp/HtkJJXVxDr3EVGeAO6UPJfbFQqMFIbJfzbOrnGiRZenikmwERo2Hsq TRUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UVrz4KM2; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi10-20020a17090b1e4a00b00263c48abf8asi4642077pjb.31.2023.07.28.02.50.43; Fri, 28 Jul 2023 02:50:56 -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=@kernel.org header.s=k20201202 header.b=UVrz4KM2; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233361AbjG1JIV (ORCPT + 99 others); Fri, 28 Jul 2023 05:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235322AbjG1JHG (ORCPT ); Fri, 28 Jul 2023 05:07:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 092DA4227; Fri, 28 Jul 2023 02:06:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA4F262089; Fri, 28 Jul 2023 09:06:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC632C433CA; Fri, 28 Jul 2023 09:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535211; bh=8/tEb5OWseFqbYf8/A/XKTgIA6zjZPi8ZpLNlpJKKpw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UVrz4KM23wFmjfRqT7qkW+QdFNE0JVLImJg98dre5NUS1nIy7PMJcxpCs4qwNwdYS xdk+KsRwBx13qbs//t3YXapXoSkGFmut+QpMqmrQ+HNFZuHsb17Q+f1CjwIvlRLGOz dL7JPjdW2zYc7H+4Tvs2ejRglvu5olWuSUw1GLhpS4fcTBuPZil+Ot4c/nODquBInx uTIGBDUcULWUlaUBqa8wdSZm1qRsc9pfu5lVj4OATNg+KTdqkfJW8HQ3VLLZjg3LBu PanYhABVusGJqYM71hVrGC4EWRwrkQCsmsEntpjbzHmYHLux+cxJjgHee/RmtA6ctF YTpVNpTs3txKg== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:23 +0200 Subject: [PATCH v3 10/11] drm/vc4: tests: Switch to atomic state allocation helper MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-10-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6236; i=mripard@kernel.org; h=from:subject:message-id; bh=8/tEb5OWseFqbYf8/A/XKTgIA6zjZPi8ZpLNlpJKKpw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7k8fsS/bAlfGreBXeAHk2kAY7N/qJupjFekk/n1V 9vFxEw7SlkYxLgYZMUUWWKEzZfEnZr1upONbx7MHFYmkCEMXJwCMJGLWowMDX9LJBey6kZJ/vgd InRXi8thIdvu1x9Zo3Z1XXCZcn/6c4Z/OoJxYVPSzp+65FYbHT31dhHLh77pp94/FXB4dYY95lQ OGwA= X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772657423599229403 X-GMAIL-MSGID: 1772657423599229403 Now that we have a helper that takes care of an atomic state allocation and cleanup, we can migrate to it to simplify our tests. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 55 ++++---------------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index ff1deaed0cab..5f9f5626329d 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -725,7 +725,6 @@ static int vc4_pv_muxing_test_init(struct kunit *test) { const struct pv_muxing_param *params = test->param_value; struct drm_modeset_acquire_ctx *ctx; - struct drm_atomic_state *state; struct pv_muxing_priv *priv; struct drm_device *drm; struct vc4_dev *vc4; @@ -742,24 +741,12 @@ static int vc4_pv_muxing_test_init(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - - state->acquire_ctx = ctx; - - priv->state = state; + priv->state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->state); return 0; } -static void vc4_pv_muxing_test_exit(struct kunit *test) -{ - struct pv_muxing_priv *priv = test->priv; - struct drm_atomic_state *state = priv->state; - - drm_atomic_state_put(state); -} - static struct kunit_case vc4_pv_muxing_tests[] = { KUNIT_CASE_PARAM(drm_vc4_test_pv_muxing, vc4_test_pv_muxing_gen_params), @@ -771,7 +758,6 @@ static struct kunit_case vc4_pv_muxing_tests[] = { static struct kunit_suite vc4_pv_muxing_test_suite = { .name = "vc4-pv-muxing-combinations", .init = vc4_pv_muxing_test_init, - .exit = vc4_pv_muxing_test_exit, .test_cases = vc4_pv_muxing_tests, }; @@ -786,7 +772,6 @@ static struct kunit_case vc5_pv_muxing_tests[] = { static struct kunit_suite vc5_pv_muxing_test_suite = { .name = "vc5-pv-muxing-combinations", .init = vc4_pv_muxing_test_init, - .exit = vc4_pv_muxing_test_exit, .test_cases = vc5_pv_muxing_tests, }; @@ -814,11 +799,9 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -839,13 +822,9 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -864,8 +843,6 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_ASSERT_TRUE(test, new_hvs_state->fifo_state[hdmi1_channel].in_use); KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); - - drm_atomic_state_put(state); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) @@ -887,11 +864,9 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -923,13 +898,9 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_del_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -951,8 +922,6 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) KUNIT_EXPECT_EQ(test, old_hdmi1_channel, hdmi1_channel); } - - drm_atomic_state_put(state); } static void @@ -972,11 +941,9 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -986,13 +953,9 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -1002,8 +965,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku new_vc4_crtc_state = get_vc4_crtc_state_for_encoder(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_EXPECT_NULL(test, new_vc4_crtc_state); - - drm_atomic_state_put(state); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Fri Jul 28 09:06:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 127480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp316520vqg; Fri, 28 Jul 2023 02:50:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlEqHs8/Edq9kkd5QviYgSkw8ef+BUY1rg0JhzVX1NNZ6D7ZX8MOPHcNxjv8qjb+HQu48lKO X-Received: by 2002:a17:902:b714:b0:1bb:2020:be0d with SMTP id d20-20020a170902b71400b001bb2020be0dmr1155348pls.14.1690537855628; Fri, 28 Jul 2023 02:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690537855; cv=none; d=google.com; s=arc-20160816; b=SI7D/0dVTe+3QHFzV0FuKK12iul3JkyveNdnwefk/0WxVl6AMA52sGhyaxtRP+cXHV OkIEOPPX7y2m9iaMK9oP/yhbg31rUXhXWVm5guZLZbKRFg+mIWuBB3KdrbAgJynzQhiB KT0mXwoNsObsobzbhiIdQimmysWhKEvFMkK4u9w9gLYZQDuHBVllRMsjXMc9LrL3Ibii 5dVlZUaIgQvjQ22fUe9+GFlQVOEdDaR0+EqO5pz6OeOVkK4RnzGRTQxLfnK7fC3gnjos Y0Y7DIFvALtFc2nMXQq4z5S1kcW9pm88n/hiEbSoIhFJVzRi/wAJWi1GykbeIw2JFmyd 3oFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=REs++npfS5/tggbeCsBvEz9dxpXXRM6NMtfy+oIEw9U=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=EsRiByOx7SLVah+wW4tIcG+w8OAclxFrStPm9hZWXcxM3gwVUpPKfXdE9MOS2DJo44 NiAtD3xzuTiViLQ76s3B3fR5JeUfygbLlgeBH7Z/c5ZW4TSsJW1+yuFqKBCDwUvrKyzh ejY0czjClIgSU1Beko0/D8My0rERUaPJvTU+yHn4FJ8SzVuxgpCrU4bdQuJiEC7B5p7o 2DJla5dwLrzoG4GJxfzrQpN3AlBDKeMST+NBjQ9+Iaq9sCLgz873+tVYZhxCBKMbPURd WBxYBPEGtHeRoTIjgSPZztDV24S1khw1i80RUJkOv60Bzq8BHZDClQe/oVPgxsrCDUTe WDeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NvZe7XxA; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a170902d4cc00b001b8609ddd28si2974168plg.362.2023.07.28.02.50.41; Fri, 28 Jul 2023 02:50:55 -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=@kernel.org header.s=k20201202 header.b=NvZe7XxA; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235129AbjG1JI3 (ORCPT + 99 others); Fri, 28 Jul 2023 05:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235284AbjG1JHb (ORCPT ); Fri, 28 Jul 2023 05:07:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB69E449F; Fri, 28 Jul 2023 02:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A366962065; Fri, 28 Jul 2023 09:06:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B09DBC433C7; Fri, 28 Jul 2023 09:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690535214; bh=gKdr5wVwnd5iV/T89XpwfyfOVoDtad9S9jijN97ZC8k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NvZe7XxAeMFcwVssgJ6Po1uWqAX+sCgVKij7qFhyIci/SGs3vgp2Q/BBOKi3Z0ZPe NkgrnodZv5N0SBw8D7CAAzyPAHPP88HjYKeXBFavyf7p73bCBtOf7E7Ug9hvCB03DR 09ogUjHXuauDqtkIDqVxy3o1vkhX+Fg8BWAlawzxbByn4BspGM3VeceaBf+JFmfJD6 bQBmClPX88tkzD98Qw6jWrzTlQXV2p+N6NwnFujlwsliJGQ5Nb6pYzZymcIBR9ZPqx RB5trmT8o6wLu9h21Dx8XOp14gwDK0ZZx7EKbgu6NIzJXpkCrJVoeVAhGuhxsrbvLc qIBALymEZ1nsw== From: Maxime Ripard Date: Fri, 28 Jul 2023 11:06:24 +0200 Subject: [PATCH v3 11/11] drm/vc4: tests: pv-muxing: Document test scenario MIME-Version: 1.0 Message-Id: <20230728-kms-kunit-actions-rework-v3-11-952565ccccfe@kernel.org> References: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> In-Reply-To: <20230728-kms-kunit-actions-rework-v3-0-952565ccccfe@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2113; i=mripard@kernel.org; h=from:subject:message-id; bh=gKdr5wVwnd5iV/T89XpwfyfOVoDtad9S9jijN97ZC8k=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmHW7k4XCezyX63vvt+s8yL0lWbVvzor5xkd3rR+y22+ b9YIk3tO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRVV4M/xMMTAy0V6zyXh2u lv1N3fX8svR6Ye164d+s73TV2FW3vWBkOBb/NFzo31S1xf+vlFx9EODwu2Zio2P+vlalVS9OTPo qzAQA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772657422879098329 X-GMAIL-MSGID: 1772657422879098329 We've had a couple of tests that weren't really obvious, nor did they document what they were supposed to test. Document that to make it hopefully more obvious. Reviewed-by: Javier Martinez Canillas Reviewed-by: Maíra Canal Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index 5f9f5626329d..61622e951031 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -845,6 +845,13 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); } +/* + * This test makes sure that we never change the FIFO of an active HVS + * channel if we disable a FIFO with a lower index. + * + * Doing so would result in a FIFO stall and would disrupt an output + * supposed to be unaffected by the commit. + */ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) { struct drm_modeset_acquire_ctx *ctx; @@ -924,6 +931,21 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) } } +/* + * Test that if we affect a single output, only the CRTC state of that + * output will be pulled in the global atomic state. + * + * This is relevant for two things: + * + * - If we don't have that state at all, we are unlikely to affect the + * FIFO muxing. This is somewhat redundant with + * drm_test_vc5_pv_muxing_bugs_stable_fifo() + * + * - KMS waits for page flips to occur on all the CRTC found in the + * CRTC state. Since the CRTC is unaffected, we would over-wait, but + * most importantly run into corner cases like waiting on an + * inactive CRTC that never completes. + */ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct kunit *test) {