From patchwork Mon Jul 10 07:47:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4856688vqx; Mon, 10 Jul 2023 00:57:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4rTRHon40FWL9AmUl/vU2NQCNiHTERze6hMt9XhvlmkpA7Ms4lBP1kKjPYWVHlFz/FrBF X-Received: by 2002:a2e:8688:0:b0:2b6:c0c5:1085 with SMTP id l8-20020a2e8688000000b002b6c0c51085mr8794928lji.19.1688975868556; Mon, 10 Jul 2023 00:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688975868; cv=none; d=google.com; s=arc-20160816; b=kARN2t2+brB30NvZULTvd/jn51x+RSXeWlc+Rl5No9Oy/kJwoGmjJXytEr9qwiXPpz shFDOCtvb7OlzZyqZvVNTYaMjKf2E1eRjYXQFDz7XjQB44pSTjY1COeV66rny9KPX9u7 rrXAVo78IGPQwkomuApx5z2Kn2LTRXUSb1nzDDPEaPEDcqiRLCjmrzyHMBsZFHQDnvb/ 1dBhWE28btabNLyswr1oFzNkr3j2+FMSAbKczB/ogrB2uVu6JrfkV3Jdn43PEkVWk/j8 yy+jg3LN+d/hOC/NTjrmBYR5Bk3BPgmBu+2P4hFo4K8JlsezCE7IpFWiQmac4X84yp6g 7cng== 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=t2HpnsqVc+sAo5tUnlIQBhHTriQAvkHCrKI/PpNlMYE=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=PJqJjKO14RCGy0gSTQnbCiOxBSVLUknW65qV/xAiNllr83JFojK2BVg6XtWXPsC5Pu rHXK2ye+CwpEM6cGfhB1+Oe6jMdIlhpG/rWh0faupUT1PQB9xxas8XiGo+37Q/PQukUP FdzUvQzrB+yqCNnO1aFZuawgzNCR3Q8lAmJFi4EXLPtYdYZXiu6CUrt+jl6ZYpG6QgQB qRHMo2ptcBSzc7JgVTLWogEYS+BnJlRH6kvA2/vscDenRtFlQvQRVABViUoWW9Sd/ND3 G5coq/AvS1aZQHSULlNHZMDpbWmrginb4QG0WVATyY8jOMwSy5C/+1pRCJTssbEloZj+ mKBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BC9eEcKZ; 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 ga20-20020a170906b85400b00993470682fcsi5166345ejb.763.2023.07.10.00.57.25; Mon, 10 Jul 2023 00:57:48 -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=BC9eEcKZ; 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 S231578AbjGJHsL (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbjGJHrs (ORCPT ); Mon, 10 Jul 2023 03:47:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7884B1B9 for ; Mon, 10 Jul 2023 00:47:44 -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 1734360EBC for ; Mon, 10 Jul 2023 07:47:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1955FC433C7; Mon, 10 Jul 2023 07:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975263; bh=2lYoGYtWk31ktlt2bmZpFNtrbTluQtTeAWfgUJXbu8w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BC9eEcKZFIgPUCFoGh862D2q/k94PW3B/ZjOJUm0R+Zu5wU3BnSrA3LxiOk0OXBHR ufDfH8FLqYqBrbj7P+bfU9vansFcBLwqYH/ZN4FEVLmFAOmAJbKN6c0NNIwuUMbHAs y4Hn3US6ErmTjary5i0AlyEOXkjsV+vYq5XB+0rEgsyjJRPLxJ/XD3RO1+W8pPlSb4 T9SREwnCAVH4CS3qn6h9lQYLMJxvsSXrocITyuGPHfaYMeD7q5IFRD/jp7At/AVrUD Y68ngwjQBARIrTbpv5f8pHgNliTp4txgComMF9+vsbgy9N9T+5Cd3pEu6NfYtnO88/ KwU+GDIsod59g== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:32 +0200 Subject: [PATCH 01/11] drm/tests: helpers: Switch to kunit actions MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-1-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2470; i=mripard@kernel.org; h=from:subject:message-id; bh=2lYoGYtWk31ktlt2bmZpFNtrbTluQtTeAWfgUJXbu8w=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt0+fybmcLXMiQ/bv/Dcz3zctP13KrLFq299nnVE/rUUm Ljcv6ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEPBIZ/qd+T0/3mTZFKEsn85vzzN /5po5ldxSfKaaVX5lmWZGRw87I8ETi6V2mJT7H9v/Yyx/6+wWrf/1z3XXZDzY0CJx5Lzl7DSMA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019560368150017 X-GMAIL-MSGID: 1771019560368150017 Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 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..38211fea9ae6 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -35,8 +35,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 +49,31 @@ 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_t *)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_t *)platform_device_put, + pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + ret = platform_device_add(pdev); KUNIT_ASSERT_EQ(test, ret, 0); + kunit_remove_action(test, + (kunit_action_t *)platform_device_put, + pdev); + + ret = kunit_add_action_or_reset(test, + (kunit_action_t *)platform_device_unregister, + pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + return &pdev->dev; } EXPORT_SYMBOL_GPL(drm_kunit_helper_alloc_device); @@ -70,8 +89,13 @@ 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_t *)platform_device_unregister, + pdev); + + kunit_release_action(test, + (kunit_action_t *)platform_driver_unregister, + &fake_platform_driver); } EXPORT_SYMBOL_GPL(drm_kunit_helper_free_device); From patchwork Mon Jul 10 07:47:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4860962vqx; Mon, 10 Jul 2023 01:06:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlGTQjWwhcpi5QRPZ4N7BAtxgZiSjV5vKY+X7rJ/9FMIaix5t21qGGeHlvqj8E0lO8geb52W X-Received: by 2002:a05:6a20:1591:b0:122:a808:dbbe with SMTP id h17-20020a056a20159100b00122a808dbbemr15272025pzj.29.1688976403670; Mon, 10 Jul 2023 01:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688976403; cv=none; d=google.com; s=arc-20160816; b=DhI8igSSQgfacroRuNL+cVhBAMp4iHhIHjkcbHI5ytChNCKRD3djxJzrzp6/K1j1gW /YF3x4tXE3h5ZzIKvpHVQh6X//p3OZQb3MxNgGCYIhf8uqq5xDGAJrngJXkxwfSM9tO1 fv1hiO1NW8iYvtTAnCWakZC9KHf534qI6qv43/jSLGbeMdT/yxp/ExzYb8kOtj/6nhU6 OM+Q8DtXCimBN497rorbGPn+d1MR1faKErmKZu73Jn1I+uQFJ/2MieN2pTIqr5DXdqQb gADyx325eF/PqSC1e3uGI9so0rNz8I28xCqVgUqPK78u1QZJBFLD4FktSkOR+ItkHua7 eQag== 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=jvs+zu3+PqyCT8SV3tjQ9tUaOZqPtlMBzlFa80IvNv8=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=lpEBqa0N4IjxVTvqaQg3E6AhgqNUEMqU1kzjOC++6ye7a0KFg9iOs1pYdt81DlsLpz mrHsMZMbmZh60mTYKduBzMcGeYLIT5zG4TF2Z9uERSSJgwHjgS6/qrJrfjh8JUUdgqnM uGJtp5WsAA+/OEvShYdSx80iYoeF1PJRLD51FXOToGiGzlEtrUm3HN0r/RpknXO672AO ytGYe9Tp3IBD2rzUfGSuar1eTpgf/G/8nQjF/e5NlYtYyVUCoFk/saD7izV7ZQlo7LUO FiuvSmWlF304n24cRYhtkPeVvIGnZ1Lby8fpLz1jWaOV70HH3uPHhSUNdi1el6pYJ+7h uMZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ALd6PxwN; 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 j187-20020a638bc4000000b00542d3727da9si9045396pge.464.2023.07.10.01.06.31; Mon, 10 Jul 2023 01:06:43 -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=ALd6PxwN; 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 S231654AbjGJHsP (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231848AbjGJHrz (ORCPT ); Mon, 10 Jul 2023 03:47:55 -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 1900BE5C for ; Mon, 10 Jul 2023 00:47:48 -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 7DD6660EC3 for ; Mon, 10 Jul 2023 07:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F7DCC433C9; Mon, 10 Jul 2023 07:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975266; bh=xWovrJZer1W7AjsxvLVKMJnE5oarV1IwKSg4Wq6t9kE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ALd6PxwN7gs9AOQ9IIcA1aTr9WugCcwY4yNHmfKBr7AlYy2CXaas4ntrMpr3VvqrY Ev6RA+QI46zmOkcRfm9/Ufn1GovH4i4TG0azF5RpYqvjwFZPyS9kvDhtgs++3t4vhp wTwbsNY0jI+6IpilfVp52Rs3W6LCH1eWLelgxR4BjlVTrSbrgvPCNkQiYW4FaHX4JZ e6+xCv3EvNTAG3aMqhVcwueVPxzSo4R/x0qoskZikJeY02iaINN3KVF7xU3BSx8I1S d+2crBXnTAmkFJMToplXDK8ZHrmdXyQ/W/qynntvl/dpilgb8vvUlHpI+5PJEVr969 e26T+DDC6c2Iw== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:33 +0200 Subject: [PATCH 02/11] drm/tests: client-modeset: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-2-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1345; i=mripard@kernel.org; h=from:subject:message-id; bh=xWovrJZer1W7AjsxvLVKMJnE5oarV1IwKSg4Wq6t9kE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt89YqvEpYsXW57qTdpsVTH83WfZV7lfpqr3TT15sn3U5 5PfN1o5SFgYxLgZZMUWWGGHzJXGnZr3uZOObBzOHlQlkCAMXpwBMRNyA4Z+2/jkvG/6/V1Njchce+M pz+NFy3ug3Czo39604d2L146tLGBmeXvN4qTC/PSDz77GiPJEt3dIXBS8pOHzttj+Y9O/6+Ve8AA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771020121407992782 X-GMAIL-MSGID: 1771020121407992782 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4857596vqx; Mon, 10 Jul 2023 01:00:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPsKGwAp6XT1At32eFlZO/ylld4Fax9mxMG17VcwXl1YWa9Kpb9TtwggtR/7Tqw9MhjuaY X-Received: by 2002:a05:6808:1690:b0:398:1045:17ed with SMTP id bb16-20020a056808169000b00398104517edmr10037508oib.54.1688976014192; Mon, 10 Jul 2023 01:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688976014; cv=none; d=google.com; s=arc-20160816; b=FRBcOOT/SkC+UU5jyRTccOIQcGNHtW8YmALSL7ppF+R72//MsQ+hNqktWT+ZJwcri8 QuF0NjfVwyx842XCODRWKtl6o3ONOcD/OmRHundRUKrImWGbcmD/NmaytLK5bSUR1XSo nlLHly9rJ3S+wCZnO6B5/r+3pmOn1A1QXQQ9fp2eAmgeKs3MNj6XT4SOele+IYg636tT 2LAWjK8VScxCFbJBk/x2C5k6c8IXVjbiZiDZh+gwvLBVR8SPY91itKcrOcBILCUtUuvb 7BheDQNnbespxiUqFt1VsdFQLh7cfM6suc8r87HgR7eGqbVONsYR7j8Z0rgL0dNWY9Lw WzAg== 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=vzTM39QW0fInXmqtyi88yE08tkKW26xo17OX85qvDN0=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=PdXgiWlm1mNy3JviwaQJ2w72DhikD0NnbhWLxczvllEUSv6KwyB0jJMHnZK8Wt0Tyz 66ZLFbzQCiBiSm5P9tY+mSHO2NIzEmuNHy6RNysVgSQYupcSyMH1cYFPTu5A4UY0MIfN PFeokNd3UNbJX0Q8loF+F0WomVvvKzI7e7thWjboo00wR97Xa+224jxg9Str7c4wdyVw /cBZWbc20egv5t6QZ8Sgjtu5idUN+N/ulKf9YtmQdvCxP6yEIKi6QbiCy8yimw5ZIy6b bVP17/kf5x0R4U+NzQegESgjkgQSvdR6sNRQxpfgyQMqeVIOFpaPqlRUV04XLFpTzmz/ w+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pZ8Q6H+e; 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 11-20020a63164b000000b00553e8d95742si8713783pgw.654.2023.07.10.01.00.01; Mon, 10 Jul 2023 01:00:14 -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=pZ8Q6H+e; 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 S231754AbjGJHsZ (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbjGJHr7 (ORCPT ); Mon, 10 Jul 2023 03:47:59 -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 7D224138 for ; Mon, 10 Jul 2023 00:47: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 A7F7A60E9E for ; Mon, 10 Jul 2023 07:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CDD4C433C7; Mon, 10 Jul 2023 07:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975270; bh=ESA0y0NXrSvpPjbIAHKbdqC7HnGx+32+DeIPn5Bsru4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pZ8Q6H+eqITfqMayWd+SJ0YWIwM4w+0mClw1EjmaLdSoGIF4WWFyAqqybxUf16tGL 6ArmiNLhhAvBnhA8KtdGLVXTeXwIJ25f8ULMi3Y8W6pK9y5z+56cFeVjZfsEQiy0SE Yr0+8mzB2CcGtiivAC7EshSeDxDbzbUxcPE0UAN9KgSdrTl/YAQd+Gsuj0ds83+maq u3G9fr7haXi6pwAcpINt5BAnNXFXuvCU0vz1wRFgsWpe2CYNBtbrKM/nWYULgmKIn6 TkWqg/+GddLjaxHZ+UJQU0qrF2i6kWdO/iyRbJLnczGq7R4w0CqYhNDv3vVtZp7iJX PB3P+60woanCw== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:34 +0200 Subject: [PATCH 03/11] drm/tests: modes: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-3-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1235; i=mripard@kernel.org; h=from:subject:message-id; bh=ESA0y0NXrSvpPjbIAHKbdqC7HnGx+32+DeIPn5Bsru4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt8/QyzP82jNtlwaXx53+bdniGR/XtlXOtZRqFtvEeuLw TuONHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiIQx0jw4euqxNvu9sfSxa+tvqr3L RmxVYhsZWt3PPevvxWaniIZy/D/zwrwxO2j/elGTbHNnveMNMJV2BfclB32109zbke0//s5wUA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019713084545306 X-GMAIL-MSGID: 1771019713084545306 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4855871vqx; Mon, 10 Jul 2023 00:55:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlHThzOys+QRKXHGFw2nSOO2qVhio4SZiNf7reYakR/rNbcBx1ziBb/E0tAb+oyjZe6UHdRj X-Received: by 2002:a17:906:7392:b0:993:d616:7ca9 with SMTP id f18-20020a170906739200b00993d6167ca9mr8415672ejl.23.1688975738491; Mon, 10 Jul 2023 00:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688975738; cv=none; d=google.com; s=arc-20160816; b=o/TX57fGk2y4374AIiCGmOWlmAdkDDX/VR0DjVn+q25EzxIwuuZeDXTMnFpJdMeLtD qfscVX1PuEifyLhYYVaiu8fq6FkPD6MJJMjVgxMwdeBzqqnqxjaXsbiqXnByFafxoTAA UhMpD8i8hmrVzI8V0dJBAveO7Af0xz1ksjwOfzQD9Isa3r1jK7mmgwfshyvuisEq3FE3 genFswdpezcBMV7TcJ8NouZBtWyTf1JDf+VJYAMAXq8MueKHg1gQT0x/vpBFWlzKJqdm O60dE37IF//rlYGcoNFphdUnBQbxfSC+tYk8LTr4fG+fT9pxtVmHbDrqfUaX0+CYf+By fGpA== 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=6pqaRbb4RB//MvLyH4K3DA7F9EPxR6UWwcZ+nVpT6tU=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=qDdaE1XA/3NHGe/x4tVAvPAxqlPUzeUZRAeXBWWZnfVKJ87T7hP6wdGboA/NjNVVmb i3jRIQYC6vsUwpmcv6bxgDnXGCyQD4b74inmoALQMBUcUYaDOxmNv1+brWAtq26aW/E3 ldP6SjEw/4w4tQGhY11MKrp9ODGgBWdQOnOa10sEQVdl6atp2MCrMzHy9Tw7iX/T7rqS S0k+Thme8yz6eenQs7xb3YME1sy4p8tpJ1M6iqnw19SIuiLK8/S3L7E0kdvyNHkPs+Mk fqEDs/BhpVUtFbYKUlt3VDbUYRYjI1RtfeMCWt5PZhSQBH+wLulWq26w4xXE3DlJBD1Q US4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mqTyuIWh; 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 rl7-20020a170907216700b00993629dea0csi8597599ejb.134.2023.07.10.00.55.15; Mon, 10 Jul 2023 00:55:38 -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=mqTyuIWh; 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 S231965AbjGJHs3 (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbjGJHsC (ORCPT ); Mon, 10 Jul 2023 03:48:02 -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 0FAB2120 for ; Mon, 10 Jul 2023 00:47:54 -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 999CF60EC6 for ; Mon, 10 Jul 2023 07:47:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B52F9C433C7; Mon, 10 Jul 2023 07:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975273; bh=b3jsj7BIiDtYO4ydj4H5h/qkxK67fbZ/H7CaIS33J9o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mqTyuIWhmfTWFYsc4wzr5/nJCuQaTk4tTZ+B5HbgmzhawJBR6NKKVUXq3aCRP3fgq RuWQt4FFlpOKA8m1QddpC57zLgj9bPwr+jIGlV7dOrDPT+qUBhOEeEQ8R/YSdJYGAc MKKa4F1mXQ6ix8BXPE178SlBFB2pp7dv7NLzlL2P1NIJ+wzrjGrJk+87UPwueGIHBf XyRvV6etN21B/ygNKYWl7aFznehnPxURt1kz7vkEsnjcwRIxsES4wjJYiRxXfy5dYb DUxcpZQqxJggjALzcuhj+fZR1vmqtSJKgeJMbi6LrSj15javuXgIdhuoDFNfXyu808 P2iTGc9PMinYg== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:35 +0200 Subject: [PATCH 04/11] drm/tests: probe-helper: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-4-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1382; i=mripard@kernel.org; h=from:subject:message-id; bh=b3jsj7BIiDtYO4ydj4H5h/qkxK67fbZ/H7CaIS33J9o=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt88QWvBp8qITl77lqIh4fby8j19FcOKMhIkiMoK9svff dmgc6ihlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEQgoZ/qmcDn27zKIkYr2g07Zoba lNJ3bvnfH6qEJYyfprx+ZulTrC8Fd4F6fM8zQ2dcOl95zm61swu964crF1cl1ix/2fG+ee7OICAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019423895174558 X-GMAIL-MSGID: 1771019423895174558 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4856613vqx; Mon, 10 Jul 2023 00:57:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlGEwW/JGaKdLMNxRIIhlfOBiRfEGqYIXM9x/9GnvtD1tfVw6a/epLr1VcT/dF5MA6wytnU1 X-Received: by 2002:a17:907:1248:b0:992:345e:831b with SMTP id wc8-20020a170907124800b00992345e831bmr11349978ejb.50.1688975855795; Mon, 10 Jul 2023 00:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688975855; cv=none; d=google.com; s=arc-20160816; b=rmJbzt/gu8otrMCfu7bbPs+u+4kjJZWU4MsPnyfmtQSczCupgCUdKbkpYa4fFQtQww 5133yIZQpMrYR6xeLO8fAycPb4ssmjroRbo8zfvIlst2+7jQ/SD3BvzHvBSorVVu+0Ku 4F8UWKFCMLOlucsADTGE+Cvz0QqVU24z3bWZPZCzJnEYgWw8Bf8IqzsDtOpyZsDE8PWx Hwgwb1bPBhpAs2HeCE0Sjx+8BeLnPZiy80y5LODQHINiEbnA9kPvWWnkr6a1LNR2qDpu NmoJFf+KVtK1oDu6Vr7buQQWlDv2dCgbzuWjETKbUzrmrKcuibM0xKrv9Y1Je218poyc o9tg== 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=vWQjUpLtxeykdfs4vmekva1wMAjnaef+UE4NO0q7UaA=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=Hv+FQVRP/VU0YcOKXESFO5h7tetfbCX6fHqH77Ff0bXf3VU/N1doTvqVU4fu1BvMEV tgV7jByo458L1bYiumbhTw+cHtIq60bd9VnyHzaAwD+gXEcb9f+tNqejYoxRmo1MWJkG AVf66oiVv8VWqcZdk7PmixMwtVaY4JryLKntDNufOO+nervgGhMmUsEMP50q9ZJrgnV6 DicePzIEXFFJTAb8tUR2lqoa0cz6I0uYWI5XHHdqOkZg4uba8SUupIA17TzbmNkysMcp TmhHh6Zd0aAC+d5ln1vpI9CD7+88m0zfF7En7XRJkLMe3UIiwS6vif8lm9+19mmNyLQD IMYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i4P+qdzQ; 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 h6-20020a17090634c600b00992437c5880si8436186ejb.327.2023.07.10.00.57.12; Mon, 10 Jul 2023 00:57:35 -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=i4P+qdzQ; 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 S232105AbjGJHsc (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbjGJHsD (ORCPT ); Mon, 10 Jul 2023 03:48:03 -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 E5FFCE1 for ; Mon, 10 Jul 2023 00:47:56 -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 7BDA160EB6 for ; Mon, 10 Jul 2023 07:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91087C433C9; Mon, 10 Jul 2023 07:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975275; bh=92Z66pevW+elalzHRPcF5q2TXp4Zof6H0dCZ1lsPh08=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=i4P+qdzQM8FjAv5I66MjcyeKFkZA8kjn/csJpN3q4yC1nyX/nQ8sSnIyBOe995Bs7 KLcKxMOH6mpoy6XfBuoZUtjgPV9dM/A2T2fAw4QfIQ580FttabPI4Z6wttGkgDzRLU ebwdtcyC1XCj51MNv0+9HMPkXro17s6FMYl63/GapMntc9e/a77l9o81d7G3+W+G7l kqEAIkRKcRE05ZcT4+mAPjYzF7z8BoE/bX296bx+ull620ecL0Usr3M2tpmQSgfIyG wdbAPjhBeOg2dNSOhEkszPTMFTRHiEcL0VXcJocqXMtcUk8iCrHp83D7btSTXJgCl3 jq7rcNGBz+TGg== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:36 +0200 Subject: [PATCH 05/11] drm/tests: helpers: Create an helper to allocate a locking ctx MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-5-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2592; i=mripard@kernel.org; h=from:subject:message-id; bh=92Z66pevW+elalzHRPcF5q2TXp4Zof6H0dCZ1lsPh08=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt894fF9O9eqDwqQD4n3qmzXunui2vKk//+CEVv+FPmLF 53M2dJSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi++UZGRojfM6uzt4wI6FEZdoRae EZlryr3ZuX6gROrd9d+eUSmzLDP9OT/Pk7LjR0XbBR8ngxNyXh9d2YQzbvk3/4fxGfcJ/hECsA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019547073948775 X-GMAIL-MSGID: 1771019547073948775 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 38211fea9ae6..40a27c78d692 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -124,5 +124,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 Mon Jul 10 07:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4857467vqx; Mon, 10 Jul 2023 01:00:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFtWgXbr0BAw+/Jpg5E7ktUtZuUMzt5JtdbQZT5ETSCFt85KrUSO50tfGUve1avq0Z9cyKJ X-Received: by 2002:a17:902:e843:b0:1b8:847d:973a with SMTP id t3-20020a170902e84300b001b8847d973amr10998509plg.46.1688976002132; Mon, 10 Jul 2023 01:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688976002; cv=none; d=google.com; s=arc-20160816; b=agRC0IyXObB5PrY7ZhVlBgupamNSXxmKLri20uklCtN3ezRE6+iE9Q8bmYdRxYuQUy Qf3WoSalkTG1mVhgz4C0BgUjG0GWe5O24tBBE16EWXdEQLqsIwSlS17EreeDpK48sk9m uXLADq9flid7CF5eZOrWy7fdlnWTQHxiIUAOGuSx911/R2M6Um773bPojeGbHCcAKPPy 8NRp6qoMt2lb8eOXXMqwcQG36xOwtY2Zv1WQTXchHY5WlyxRHqC3tJo6snKxJ2KRgcAj I+ZvngkxDYMwl2QoyfkCRdBHt1EbQr1fZP+m3Kd/GJwNZVupvQe7nEh6vOZeX1Hk3U1D 2yKw== 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=ycbTDumWZCBlJlDRRP8Hjfn2gMHVpQe79ycN6HC1rio=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=K948vGf710vozJPVvwYnmbyY5x8MpnQIBF0vtO5hBVw5tBbJZRqvlq/OEmq6Rak7Fh ZmDIVS8vztFkYYk2cxfXcn8JKPv8PqzhN7Opk7+C3262Bd/2hr/y93ccbuMxFxti0/HF zi7mRZxDFIHuvESzgbnk2YE4rV/ciuUqRX1kHgWpw6hw4vys6HqOoeYuKsOH+Zm6NHoK iC5rMPtW9jTNOyDm1PPGo2Vg3HSwhF2H0m2mrIsxV8Hgruy2TinTdUDm9tatefIcfpPU vVUjfTan1g0k2/BxryhhG/sb6vT4RJ74K2pVftlX/XNTasF8qgA3b9oGQfsLHTi3PIll 9peA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ev0++KRl; 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 p18-20020a170902ebd200b001b9d2982365si3782054plg.34.2023.07.10.00.59.49; Mon, 10 Jul 2023 01:00: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=Ev0++KRl; 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 S232004AbjGJHtU (ORCPT + 99 others); Mon, 10 Jul 2023 03:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbjGJHsD (ORCPT ); Mon, 10 Jul 2023 03:48:03 -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 044EE115 for ; Mon, 10 Jul 2023 00:48:00 -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 8B57A60EC0 for ; Mon, 10 Jul 2023 07:47:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97EA5C433CC; Mon, 10 Jul 2023 07:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975279; bh=yyOzLwcA8+MLX2ZufFLGFyhRNFINdgUwJ7WOz6NATOo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ev0++KRl7X5fDJRzgC0KAVucSZOr90RLppLhwpgBemBAj0uuGAmS64AiBnjD0BY2B 2FwR4AWNDTstXQvI+Dgid9oYaA15ir6wStflexPmIN5QFu+qkajBJTAPazNv6i1Lxz b6xsXQycMFMEUUU4nMaLMhALmIvUG4gUWWk/lSB1LHA64LzwBSIl5Uf+4j/JGwgixv hUkPONa3CBweO0S5I/cLcDvGtWYDX/Mb8G9+5b0viXN2z30dpaY0ChdZASLqGbU6hB 9ELLjgCoIgzmNcPhc4YJ8vs95K3nQDP8bwyuKEkI7svKD9xdgaWNrGQ3eNoOBws2Yr 0CeRp8RNOhE2w== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:37 +0200 Subject: [PATCH 06/11] drm/tests: helpers: Create an helper to allocate an atomic state MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-6-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2824; i=mripard@kernel.org; h=from:subject:message-id; bh=yyOzLwcA8+MLX2ZufFLGFyhRNFINdgUwJ7WOz6NATOo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt8842N69JPSDNsPi6Zu3qvItcm0TqDt+kOVibJP3lbLd HX3rOkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR6DaGvxKPdc1f2L4P9kvNubCEn3 PG/TUvDI9tWSTr3HXj9+Xb1VMYGXb8zG2IPMnMGsP0aM6lSU+vNJzrS+6dPqWh8q3f8b7E3TwA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019700798157682 X-GMAIL-MSGID: 1771019700798157682 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 an helper to create that atomic state, and call an action when the test is done. This will also clean up the exit path. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 39 +++++++++++++++++++++++++++++++ include/drm/drm_kunit_helpers.h | 5 ++++ 2 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 40a27c78d692..3f3331bc389f 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 @@ -165,5 +166,43 @@ drm_kunit_helper_acquire_ctx_alloc(struct kunit *test) } EXPORT_SYMBOL_GPL(drm_kunit_helper_acquire_ctx_alloc); +/** + * 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_t *)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 Mon Jul 10 07:47:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4871500vqx; Mon, 10 Jul 2023 01:32:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlHCAy0RkG2lGF1cuNCNG/QAQ5K0mJXjfBSPObACOLxjgKRds5Sqd30RNDPoxTVqY5FqBZko X-Received: by 2002:a17:906:5188:b0:993:dd1d:824d with SMTP id y8-20020a170906518800b00993dd1d824dmr8680981ejk.19.1688977936661; Mon, 10 Jul 2023 01:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688977936; cv=none; d=google.com; s=arc-20160816; b=F/xhqm46B23q8tf3i/c96YBlkjgj2buQpQeRYu70+iRjWBmObTfl1Zlejo9Ncghvu2 EBWkfJmZVF3aYgK0Rrz1hnrNR5ZcbXsRmy0DjyyWfhvDRmrSjHqNSqSSxCC5ChRNt+G2 aivGLdoUzHxssK6t/GAkN4wCaa6ZS5PO4+5WemhhQAU8xCyRGNKZg3tgLP4mmRHqkF0t ILJLIOtdjwbqbavoqS9URtjCFXoq5lrhEMhs1O+9023X88GYAXVPdZl/rExFRgRnscoL raIF1cBMdzGyqIlT4c2d8mFFEZMczsK2bQmIVe8ydcH0ONr5tyucgG/Szkyqm3monzi4 DRYQ== 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=+TKleDAJvaKD9/qK5NfcQ/AT57MYMKfOesO/WjGjH3s=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=RXUPIqApii/xpCq1G393dHU/vSCHQgWKnfr4uyWLUfkVT31FkcXkGh44r9jEZj/bMa 6Z/7tMKFvO7rIUz4zbeyhr1rU3Kkf87BMEYn1BYE1N3BPynq2pqXNVdRIBje9+1AfxZh EK4dAxSSaWBEJxduC1QoGc3RUll/3Hi316is9GOc0hRoNdcD+ZsVy3hVS6CZ1j0qGG7f v6zUl56U53SuXOq2CuzNIDMTWU/vDy0ZAwt8BMW7iNsJzCP0yFpFyAleuWD6tcc8iKNc mROH+sOP6nkJhfChq3tR6Y6o3QhfvX3B3LwpiSK4SA+mCKkE5LfEEV+MAHXV8LkyWn7V Uwbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZS2qTM59; 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 le15-20020a170906ae0f00b00992d262fb29si8550671ejb.992.2023.07.10.01.31.51; Mon, 10 Jul 2023 01:32: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=ZS2qTM59; 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 S232161AbjGJHsf (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbjGJHsE (ORCPT ); Mon, 10 Jul 2023 03:48:04 -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 F054413D for ; Mon, 10 Jul 2023 00:48:02 -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 861B560EC3 for ; Mon, 10 Jul 2023 07:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95B71C433C7; Mon, 10 Jul 2023 07:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975281; bh=P6AkzZmEIp/9uMOYra9+RhYe8NGkgtrmUDZAyGSGwBY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZS2qTM59an4tTDOc/lHUMdZ9YWW2KcLdikHB/RwLYbQIQxBy9AQttNMyXpYmiTRmE u3rLEY8OKJqGnuapdPgZIh5DyBJxyua8mSYSs+q/E2/OWAKDskriPj2RdXjU8I8vg0 HWX8fdr0XAl2w8iDuEdWuZJbgOhUh1OKO+6aa4Nbx5xqeNh4xDnKHFjicEpg4V16jB PwKkz8GlYI3dfNx7J+eU1lCFkc3HMvk92le5597HdkbJST72dqbFePH5z1pGd/l46g AXfe8nVNIRjH2MLC3OgJwkTCc1RPddJ9cd3Y8LJFn2ofkX4HeZCsC48XcjIiVulKnQ QwfLGwKiSRBzA== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:38 +0200 Subject: [PATCH 07/11] drm/vc4: tests: pv-muxing: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-7-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=1793; i=mripard@kernel.org; h=from:subject:message-id; bh=P6AkzZmEIp/9uMOYra9+RhYe8NGkgtrmUDZAyGSGwBY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt89o+CqzKlOs84+vi93Tq8Zbmjd8ql4+9dVal+01jn1H F3Ef6ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEFnxn+GdvJlsnJ/36KTObdzeblH jMBOOa8LgHE15u/e+/NyfvlzHDf/9vemerQ1fvuH710F274O3NHnceR1/87xT98Ge51DPHdnYA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771021728937907395 X-GMAIL-MSGID: 1771021728937907395 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4857283vqx; Mon, 10 Jul 2023 00:59:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlFj3fx5lJhxZPaxDMQarc3O7z0j/tWNbvTr9pR8/9DOkXG1uGvkxPVI3zYYyiSPeb1npDmG X-Received: by 2002:a05:6870:b312:b0:1a2:cbdd:c3e with SMTP id a18-20020a056870b31200b001a2cbdd0c3emr10696176oao.2.1688975971226; Mon, 10 Jul 2023 00:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688975971; cv=none; d=google.com; s=arc-20160816; b=fejMS1iC4mYbx593+y669p3zd/v8erlzndpIpMR5urIPU/QIbojyNh4kbb97sLiqUs 3bH7Oo/iBj1QIWo2Vlt7LgaHbyq1y8dZAdoOalW5LGuEfxY5VGiNqQyyVsVB0YzIHnOz LMTH4vLcL46oUFHMAo81/L3hPKHpcMn3y3vpgztKbdxq8fKxvTSVlSQFL7nfowSeEN95 b0wppr/VuR0eaMIvFA6iG17qQT1xu4oL7KVvdGXJeNlN5SW1F3rjTgtpwMtZjw0ktSSI X+CUQ42xYcuFrygmCODXvDiK7J+z44rO5dDFgv1Zx9xnmf2182y0bs05LC2LKZiLZzv9 P1Mw== 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=+KZJ7O+UqJLEewDs/1a5F9IpHl0xpih0CDU8ocgWtm4=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=EnYvZBgXSoB01FUHCY/O3qZBlMFtUlKLQdQLYNv/zmL3IC9GDzH3cUWynz0pvQfG0B mtwZoo/9yJiZLnN4mQdaOhH+2GaERbkHjhRt2C+VLF35ggZRIAefljTLyK+Q7a2FaImY ClBndWSzv0xWvKr2SuBMwJNl/MhZOaWsMsFwA/hgS11cnzqMIRSOY07Fo4LfkBAAeKlG SPLpTvBNYmnnOStxkuPpDTALdJKWISp638C/B8WnSMNxJkdTfOSZF0QY9R7PVclza8Ni KDk8i09TTeooaIaBVTJ9JveFqhZzKETHJaq06SwOea8L5lhQnmFAUzcCYRMK1zgQE2O+ T4/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="E+/jYc+X"; 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 c5-20020a6566c5000000b0054fdb063301si8525102pgw.252.2023.07.10.00.59.18; Mon, 10 Jul 2023 00:59:31 -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="E+/jYc+X"; 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 S231782AbjGJHsq (ORCPT + 99 others); Mon, 10 Jul 2023 03:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232196AbjGJHsG (ORCPT ); Mon, 10 Jul 2023 03:48: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 CAF82EB for ; Mon, 10 Jul 2023 00:48:05 -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 6374E60EB9 for ; Mon, 10 Jul 2023 07:48:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75EA1C433C8; Mon, 10 Jul 2023 07:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975284; bh=fPdxAPJD7CpD3AfQBHyKw92YCMzAMwqXjaFIYguE02o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E+/jYc+X+JfKXjXj4itmX1fGoj+DANb8FwUhV7qUTm3rOWT8eoltcsHw0bLOR9Ort 2ge/7liyze5sejdX6n9qxhJVvrJ9f5LcgtAAd7c2Le5HUcGkNE0Luh2a6E4AJAVmto h5Sw9hG8VPXzYznNfAOW8va+jVrz7edAffgEsm5+GFlqJRymyzoKvs3v7kqBvhikzl SKzzLK4dBdWV3HzMS4zm5WnhYROdkwyINjQgLncAHsK+q+XGNqNMxEYzt07rEYoVGA DiVx3/yIrueyyd8/EuqI4D7Vgzie9oYYtZTzzEvoqf/m5CXx3ukWj89FBirgFP2aDv z3lJSdbVJ4MaQ== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:39 +0200 Subject: [PATCH 08/11] drm/vc4: tests: mock: Use a kunit action to unregister DRM device MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-8-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2647; i=mripard@kernel.org; h=from:subject:message-id; bh=fPdxAPJD7CpD3AfQBHyKw92YCMzAMwqXjaFIYguE02o=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt8+4s67/9OcVT2x9VX4mPp21o8iVZ+I2s8nJ8cnzpD4u Yd3R2VHKwiDGxSArpsgSI2y+JO7UrNedbHzzYOawMoEMYeDiFICJ3L/K8D/YMUd04udJs8TENs+Wv8 EoLnZyVTNjzUdBtprnlvfldKQZGV4rbpzvevn4wZ9lORFMJ6btZe99t4llrsKUv04P0rcG+zIDAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019667982636463 X-GMAIL-MSGID: 1771019667982636463 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/vc4/tests/vc4_mock.c | 5 +++++ drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 6 ------ 2 files changed, 5 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..00825ddc52f0 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -186,6 +186,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_t *)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 Mon Jul 10 07:47:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4872566vqx; Mon, 10 Jul 2023 01:35:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlFl1VjHnGbotUi6fg6dTAJmAxL6be4YsmompL4i5P+huRTK9cWx9RaWdnsI8oiUsrxnYlV0 X-Received: by 2002:a05:6402:6cf:b0:51e:fa7:a292 with SMTP id n15-20020a05640206cf00b0051e0fa7a292mr10895342edy.12.1688978099818; Mon, 10 Jul 2023 01:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688978099; cv=none; d=google.com; s=arc-20160816; b=j4y2a8DI1T2HHSiESAe5Bv5ah19w9T3xLc4jL/PlWnA9BKGM/N1ISXuwEgv5YW+nMH i+BgpQ2h9a/CxoqQJ8r3LfiK6yKglvi39z+yqCxf4S8gR0EBS+aJYX4lvgMkL8IDmsiP TiM7JM0tg6txZH0aOBeCi4kgiY44BMAfxVlGRlwtZJ0o/CF/Lw6hvXAKG6xlhUJrrBQl 1EZh8IDjYPPOFaeZ77+7gXkw0rwyijZZnle998GWUsrOYZOeAH//NDdQqSQtIjyk9bXp QL5AlWz3Bu0eVDVLNTrSfAHq5BBIYfme6C6UpSmdK6jZfZGLnSKTaj6joMW+49cZuVU8 wCuQ== 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=0/L9JhSgCJM/RpjpeVstWU/mqOEBTtWhrsWkoWypCI4=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=w2+yX3kGxjm6ep+BpKnAejt3bk7RVCmEuj3UaWZhV3xL6n9qNSzyU9WXmORlwDfC1Z Ms1Vi4MKMWlJHyvBQ6oKu2wT6Co5ixQOufjDFOnHXfaAQWtpYAhEXmOCuGivCr4eXoyd LGenhIOCAhrzFPYfKG2IClVSbYYc6Z8L9hzEGFmyWq3P9Qp/vhbyrkUPKJHez1B/SoYS JE+36vrWnHU/imj7G1lPVvg/Jdcl51xpXzWWbjIf8jbxoikJ5V+yod89kSxg+RTufEev VzOB1c0H8J+Cyr5KBRcvNerCOHiI0icdmkftb4I/52p9XREtO6pmNUStZKW2ZfPaIgfH 04DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q2z39TMd; 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 h2-20020aa7c602000000b0051e0d47587asi8999846edq.276.2023.07.10.01.34.36; Mon, 10 Jul 2023 01:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q2z39TMd; 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 S231858AbjGJHtC (ORCPT + 99 others); Mon, 10 Jul 2023 03:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231548AbjGJHsJ (ORCPT ); Mon, 10 Jul 2023 03:48:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B83A992 for ; Mon, 10 Jul 2023 00:48:08 -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 55C6E60EB9 for ; Mon, 10 Jul 2023 07:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68AE0C433C8; Mon, 10 Jul 2023 07:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975287; bh=A/pLaw+uJXzMbunZZUuKSY2x3xf0ard7YULxacsm45Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=q2z39TMdCYZM+Q2tQJuFxEf6HqVLTv9g12+ayp23zgEZnd5/eEgS35Mdc6QNJRxi0 +U0u0qcdztqisN0Pqe9a1tfpmO79G04THLzCryM3gKtuvYeiwKCFj8GpyfEAynK9mQ ycgyGYFQ+gsKFcukvesTuNQqDAdROYCq7PE6gjHeDiC3U6nnQKLQOWpB+A5fLIQ7KI f6cLe1mQ/MblUa3iLjB5iY1nch0S4qxaPCTo8KXl7hPAp3nM+unyRmib/Yz8Wneph/ chKCi6ckbwywl9A+dKZl732XiBYYfZ6we1ikeRnTGkhnMV0mQ4YlK2mcBfM419lhZ9 ia667Nv1dCMUA== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:40 +0200 Subject: [PATCH 09/11] drm/vc4: tests: pv-muxing: Switch to managed locking init MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-9-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=6443; i=mripard@kernel.org; h=from:subject:message-id; bh=A/pLaw+uJXzMbunZZUuKSY2x3xf0ard7YULxacsm45Y=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt8+oemwbXvDae/Uz97eLHxj097/m3FhmtGLGthkx839t 5NPq7ChlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBE7pQzMtwRd7rmz7t40XoRm19RDr t6dR9mczB4cb7+ER04Ue1/w2qGvwJ86z8k2PE/nCte/1w+0WKFe/bvtHUluswLd05/sb1MjBsA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771021900200464412 X-GMAIL-MSGID: 1771021900200464412 The new helper to init the locking context allows to remove some boilerplate. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4872273vqx; Mon, 10 Jul 2023 01:34:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEO7gmEUS77NGHl5N33kbfJ70ZFBLB+7tvP4GDxZ9F0AGvPK5S9344tkPPTmKjU50eb2dub X-Received: by 2002:a05:6402:1616:b0:51d:7ed9:c65 with SMTP id f22-20020a056402161600b0051d7ed90c65mr9034128edv.21.1688978053730; Mon, 10 Jul 2023 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688978053; cv=none; d=google.com; s=arc-20160816; b=kg3N8hCPqqqnoSv9Gag02cFMgxTU+jYsLvZjpAzaCX/54iYY3WfQJzx9kVLKGD2VKA T1/nHm5xT94Wc/jEdqINrcOAG1Kb+cXMjHOoESvJ8Wf7qzIwyteyeSbByYb5OVtugcEr Druy4MVOhH8XKNdEsY+WkBVAR/9znh8fo4X8Ff1OyZbCyDe3Ll1xeQC4k1VjSdNnYbVY UmRU7dJte5ONEiBSBuZZQRlz59VpZHUp2vcrzOSX6DAIWlz69DGLPpouqOsu6LKF8n04 4Yh57waQX9KgrFlI2/Ht09Rfc922x0C2bnCiCJSPtm7B5tjEudipYJz8y9etzAXC3rAC NBXA== 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=S523FFmcAiU/jQIvTbAohFS2cr1Ojki0Nw/HnCV4SN4=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=nSfuRrx7yUd87sZ/fc6P7yMk5QwEHByAJYV+YtYVjY2z3k1XK5IWj4v6iLzxUU6iwC HiG3V/5dLq61RDiRK+2aVGyCklbEhx5C7lm+E6JVZe29Rlidjgyjnvz36L3I5eSChG2y DSuihF+B9ZKza6Czip/UbD+D4HgRi6F6Zy6+XDNQU8VuBC93OZXFRMEa23hmDsmNQOyM xvrTjELc/eMTV3pqgr+ns+9vC0o5r04ja2vUp4amjk9Efr8lk5iZK3tO75ExfHHTRbCH 2ZLKG4qjj3urMTFrkj6pHqsdeMGSekaH+kOJjwMKJEnQxoXFPVZyvk0v7ZNlUHtplbfs Li5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H2lP3U9c; 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 x14-20020aa7d6ce000000b0051d9a12291esi5482994edr.449.2023.07.10.01.33.50; Mon, 10 Jul 2023 01:34:13 -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=H2lP3U9c; 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 S232000AbjGJHtJ (ORCPT + 99 others); Mon, 10 Jul 2023 03:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231604AbjGJHsN (ORCPT ); Mon, 10 Jul 2023 03:48:13 -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 91FAAE1 for ; Mon, 10 Jul 2023 00:48:11 -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 275EA60EB6 for ; Mon, 10 Jul 2023 07:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A237C433C8; Mon, 10 Jul 2023 07:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975290; bh=sh661OiebuthJZpmMjfk/uDz8mfCFIBOnwj6laIfZvA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H2lP3U9cY4rSUv9Cw8OH5npmN1IbNMWpBdTRyoHqZiTFZ+N12+8Fx7Amri+c1oH+S 0v1c3c6zPzFuj15OlDjXhM2j4HkG1NbSx0rrPU9nodGgVZu6WiQdU+ZA8ilpKf6hZn yAheO9nrMy8byNlePMvbVDttZhRZ4o3F3k5mAIzF4jyLoxK02/GIpUJOhcXJv30jRQ sCBvkrU/1qxaF21YdWiv2oVGN+qpI2W17jKcZsI44PXp2L/v0iojo6sgL5TopRvvRM NDRUduGvofFZ+FMof3SC7ckWmWWXP+P506Q+eXOSdlL8yPjYvKpjC4IZomS5TPUNNi rRzaJOGneLDiw== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:41 +0200 Subject: [PATCH 10/11] drm/vc4: tests: Switch to atomic state allocation helper MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-10-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=6125; i=mripard@kernel.org; h=from:subject:message-id; bh=sh661OiebuthJZpmMjfk/uDz8mfCFIBOnwj6laIfZvA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt88ITQ9eoX/QfYmP89PJ82c+bGfg1MhIbxFvObPCd2PF 6YVNHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIax+Gv4JTF/ptLczneyz92uRIr1 ZcqOW96zzL/87nWyey98Ly+kuMDLsD/Y0XFIjazrsju0Ona2rHwiw1iZOHzv3d729Tz6zNygYA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771021851805987190 X-GMAIL-MSGID: 1771021851805987190 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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 Mon Jul 10 07:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4857962vqx; Mon, 10 Jul 2023 01:00:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlEAIozxakvetU0mkvas/V4wWyVv9YZJN6ZNXngEFrMOoONiumFxbZ+U9FCDyRSLuXcPI4UJ X-Received: by 2002:a37:b486:0:b0:767:3e13:6017 with SMTP id d128-20020a37b486000000b007673e136017mr10392651qkf.30.1688976047163; Mon, 10 Jul 2023 01:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688976047; cv=none; d=google.com; s=arc-20160816; b=iiquDqa6irfkeeFaG/KffkthRlYTzbMdJFfkdNNZnerWaZ4BhkWiS0Pjwwmc+n84dP IhfKlvMIHPIQ6J30QR4R0S+9S/iL0MdeFT5PlZx03R75Hr6jlpxDUyGTafrNMYr7J5nA BueNHbAUAtdUakGvExSyySnzN9L1x0qUVzc52EhxFKnsUiJvvlLBa6wg11KgOvy+CgcV +/Pnu7trvswYJvgT4YJzTADlgNsl8M3GNEz0FYwqnbD905VBIEIqR9/AiG6v+m4sMDng eLcB9oTizWuk9z92gAopzvBmQvMCVQja74oiLVwBnuStlx7qnXjzc5C3PdnE26pDJENJ 71hQ== 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=Wzk69cPpzHH3OyErLzTff+54nkAMGxLe9ludJoOqMPA=; fh=hv+BGfRnZKm/Mx7Um70Asy2r1y7Zqr2lNnN/bFBL5yk=; b=WG4X5MA2PzDls7T+TAEMDA7c4tGpHLr4Nuj7126QIX2qTuCRc/AmqGNbAx4K1TQbm0 wtHf1plFpSpGc+4sc5zBaU1awt9CMf+G2FpNToQ5RPr/mm4kGRieaPAYxCEE6327LLhx pyXCuZMPvPK+TF2Tt+elgjS0EL/Iio7dy3Io0fyCD9f37loIhC2kMxKZUeIJIObkpn1N LwV2YDcXP3djRM2/7yAXr6tAfEamFljMS5oe5VA6PQ0TIiOaBoxYzUGIwZTX1kPic9Id fH15Lun6BY6aO2Ii2Rg4TS7/q6kAklNNCwF6h0I3KuemR/YVWFlQ6EpTi0EkiuWi3wCV ltzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aPZ/SRyb"; 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 mj13-20020a17090b368d00b00263aff4cd15si6498723pjb.106.2023.07.10.01.00.34; Mon, 10 Jul 2023 01:00:47 -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="aPZ/SRyb"; 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 S232063AbjGJHtN (ORCPT + 99 others); Mon, 10 Jul 2023 03:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjGJHsP (ORCPT ); Mon, 10 Jul 2023 03:48:15 -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 57AED115 for ; Mon, 10 Jul 2023 00:48:14 -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 DE59560EB9 for ; Mon, 10 Jul 2023 07:48:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F130EC433C8; Mon, 10 Jul 2023 07:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688975293; bh=16TekcNJuTfVyllw7nW85RcUQBjN4RlFG7QvXpxKfus=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aPZ/SRybsonfjxn87sVXsQVAfm8/hSViEfIkh2um+Bu/KDfax48CyrSZgSh9NB+gp QLyUg2fsUPjEUwIZkiBuZHgsAKUHhVGdeYeilhiCH4e29ZizFPYcc+B1SH8k+EaSVz HIvjRTVca/pGZ2F9ulezJVqBti6JkxQKRBTd0wzr7jBcyJ62EK08B3qbJ4m4UloL2f p5AjMfOJbpGPdDCLMUiaJyY5YqZCHvb2l/9y5Ncd4/ht0A1k2lxAHCTzCPk5uG4q+N MdzGp3efocrXoBis6u0dIIDqBOccwJN+PLxwcD2ysVIEW3veHml8BG50wCUjRG+61Z PC0YCMDOPe54g== From: Maxime Ripard Date: Mon, 10 Jul 2023 09:47:42 +0200 Subject: [PATCH 11/11] drm/vc4: tests: pv-muxing: Document test scenario MIME-Version: 1.0 Message-Id: <20230710-kms-kunit-actions-rework-v1-11-722c58d72c72@kernel.org> References: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> In-Reply-To: <20230710-kms-kunit-actions-rework-v1-0-722c58d72c72@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.13-dev-099c9 X-Developer-Signature: v=1; a=openpgp-sha256; l=2002; i=mripard@kernel.org; h=from:subject:message-id; bh=16TekcNJuTfVyllw7nW85RcUQBjN4RlFG7QvXpxKfus=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCmrt8/Yo2+y5cu1UPXXup3+aVuktpco688961VxVGVn1f3q JxslO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRCGNGhoXMwuy3I97lPVRwyNRNar 14/8GelZnuk5je5E5+d8ju2gJGhg7damVj7auJfyVOvd39vHFfQn53ycu4uHqV24/zXT4wcAAA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: 1771019747651183683 X-GMAIL-MSGID: 1771019747651183683 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. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas --- 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) {