From patchwork Thu Jul 20 11:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3048879vqt; Thu, 20 Jul 2023 04:30:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlEi6mZ6utMRevI/r0ZNQRKqbtka7KLmmmBr+nouO0L1GVUdW2HgQukhmtnwhy+5oDFWay8b X-Received: by 2002:ac2:58ec:0:b0:4f9:596d:c803 with SMTP id v12-20020ac258ec000000b004f9596dc803mr1933462lfo.53.1689852626854; Thu, 20 Jul 2023 04:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852626; cv=none; d=google.com; s=arc-20160816; b=Rqp5gGParId5UwNb21Db/K8E9xoYWp0EApHYbbOl2lvVB2as8FFVqel/y3ZAc+Q/26 3RKcsChF3YfcfyDoavtkdLtIXA7oLQ4IIFkCObqSh55DPxDGbmWTF9mFzgMUJVf07QRZ KOXjNuAAscR3U3Udhawmk3HZgTqf2svT/BeDEXTBUvkpUEkkabNITMZzBO6UY3Ga7bpI Gw6cgWTAZAQ4KO6dhDK+VDeMe0W2TZY6RjBoMGlf/qHI5GD2KiDCn2bUDiqqqF19Jslm eANdwBnEamRVPGUxCGbDrIxvrkj3hTLvGt3g5CYoWZBe6iKhvL9+xKQbUMblfI2seV2F /QSw== 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=XWRLlE18qznDGvjQSof2ldeDzMoiKwqx02lI5BBHLlE=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=Jza8O8m2rT1ELeg+TT+gKQn8q97qc1bL2k/pjOHRwZzlAiwLEKLznrvW3hrrkmvqCa F8Q5GjFDgaCXFAOxMyUXHDmzV1jaaubo/dxaLUdUnuSfy7mVvn6JRSQg3d2pSRtCN/Mb sc4xkeUsyLDbt8VQ0mCHpOAhev1H0O8H0iVFR/X2Wb2tgHuvadIDm5HMAJUx+KmJbMd/ 4WCdEv6JTcSBEnEMpq9CZSl0VMpbIwCCXEwGhpze3JRlB3ZYTVofE1k+WjVziULe8rMJ kkBxTmwIn5IVQh0IRKSOTDdfbZTBZItI5BXKvIVmFKIAL6Ne5+Rf3p3mRKxObEfm7vCI iWcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O8ku5xZO; 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 u25-20020aa7d899000000b0051e162ffa28si619115edq.691.2023.07.20.04.30.01; Thu, 20 Jul 2023 04:30:26 -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=O8ku5xZO; 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 S230137AbjGTLQb (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbjGTLQ3 (ORCPT ); Thu, 20 Jul 2023 07:16:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E2A2D4A; Thu, 20 Jul 2023 04:16:01 -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 264FB61A32; Thu, 20 Jul 2023 11:15:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11272C433C8; Thu, 20 Jul 2023 11:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851758; bh=/rkNjrxerN0rrN6VUl+VmzclsPanUGawK+BoOr9yqMg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O8ku5xZOj45PrctUd2XegxQhPy1mG9fVcUNBMBjoGEBdUh8u4DOpmf8bicCWQIBtQ 4tIHgHKK6IfNunA2aYGMvMsaY73KpDI/CYldneB3s3lnrZihTpShKs6WcoWAEtVO6s 8N00iNyfXWWgifqzlvim9hv/0D2WV1L8vgvGkBveIXNUhhpGd4TyUrR9DgTOoavLGD /C2sHgA1hRtrRdAmBjFlFKHTn3j4XQzMF1HvaMQZ4xL7QG61JpTER939YIRJ7O+dX6 KFG7vSybXmJ4iG357J8nC8mEnC6YBnsNnCUXblQNPSyGWeHFaH2jnSikqcuvD3/y+T bl6xf2pehay9Q== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:46 +0200 Subject: [PATCH v2 01/11] drm/tests: helpers: Switch to kunit actions MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-1-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2424; i=mripard@kernel.org; h=from:subject:message-id; bh=/rkNjrxerN0rrN6VUl+VmzclsPanUGawK+BoOr9yqMg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTOqRM/cfHv0Ztw5hlTmmjvMJxQN3t1QPPXx1zfRR SLrLufu6ShlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBE7m9gZHi/6fO9X4/qlT1D Z3R8XXZ6gbRnrVm25M+UkxM+lV7ekt/KyPBu12zLcpMVk/K+qrKsleG8/PLfhvlOSjtmJilkfb4 SrsgDAA== 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: 1771938907797664291 X-GMAIL-MSGID: 1771938907797664291 Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 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..5856beb7f7d7 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,27 @@ struct device *drm_kunit_helper_alloc_device(struct kunit *test) ret = platform_driver_register(&fake_platform_driver); KUNIT_ASSERT_EQ(test, ret, 0); + ret = kunit_add_action_or_reset(test, + (kunit_action_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); + ret = kunit_add_action_or_reset(test, + (kunit_action_t *)platform_device_del, + pdev); + KUNIT_ASSERT_EQ(test, ret, 0); + return &pdev->dev; } EXPORT_SYMBOL_GPL(drm_kunit_helper_alloc_device); @@ -70,8 +85,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 Thu Jul 20 11:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3049064vqt; Thu, 20 Jul 2023 04:30:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlEqak0wOl1NsM2udgDLF8GUomCMuNJAZM54hCo/MABWibxKhjjaL8/2u4c5hW9a5O0rximy X-Received: by 2002:a17:907:16a3:b0:995:3c9e:a629 with SMTP id hc35-20020a17090716a300b009953c9ea629mr5713912ejc.31.1689852643367; Thu, 20 Jul 2023 04:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852643; cv=none; d=google.com; s=arc-20160816; b=M6T9VvH+Bv52+l6mMy3zpG8iM/6YKBqcdTNz0FzC2GbDObqzQQ94zmLdj8PujA9DN7 Z+HOdkXBZpg6d4OmUe72LYMQSPij2xwjd7L3E3sk1D125jhR2+5vgxlfyUwcKZwboypj 9IMsaUh8fZsH0waM89UT7Fe4I3dtuZD+wDricV4ljPJWmxN/KfW2SrYlpk9spf4XkByN E3nz8Mloj0qNFa8LfDe5SOB5tdYw4fZP8OFctALu6FpUOekAWhRBv+PQzDn/pXM/02hq Hzt6EUeoARQksX12BQNNnKqyExNFawLRb7smM7EfH/mTkR+RecG7X3KOzPQXYZ+OCwJB F76g== 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=L0vm748A5fNe/QZaOzgRYQjxZL+dwMQF/1RXzoLAcI8=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=dFDqmR/aENHy0w4xQ0hu2A0SvnhrKrRioX8mAxBGW4KGlyWu8GwBAGFfw89H+ULMDF i3MbI9FWrutJa1XS3iFoQ/CZqsLME6TtXWK4cv49nCeuwwHdROY6ADslHmeWHg764Bu3 wXx8AelmuHjk0lPlxr5OMhR29KAxGwN7iCURpd6PzhP8qNKmuRkYsGQ6Ghv4e0fi5cnK zv9pBqus3J180GjXVpXruK9Cn9c2HuIpqDkbAcAutHqKuoQLmppdbNUiKtKZFqM1/8nV FKySlvCH/lI7O3kX3UElqfiIcE0WvvZgPnmx5pIKAk7TvRQOtfRNMMNM9mYa8EwQuQQB wbCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=llG11i4E; 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 j19-20020a170906411300b00988a6f59292si482247ejk.600.2023.07.20.04.30.19; Thu, 20 Jul 2023 04:30: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=llG11i4E; 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 S230147AbjGTLQi (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjGTLQb (ORCPT ); Thu, 20 Jul 2023 07:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53AA02D58; Thu, 20 Jul 2023 04:16: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 E23FB61A28; Thu, 20 Jul 2023 11:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D216EC433C7; Thu, 20 Jul 2023 11:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851761; bh=on1Ib/kmGdNbcufdxrj7WeqtPtfL4L5bH7r+5VawDuk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=llG11i4EVQXKrbvkGXtR1u46+LVcmwYBDERDalrk8JDZXiDyhHL8TGR/NwHOOMvNz 1PWyswk6BwwW7bADHTdCleZ1q+vqrR3D3u3eaufT50uTXj60V1Su0aWH9Ba7sJbIF9 C1lIZS6rDfVEXMfQ2RyGo3KTZUkp1v12raxzjCB7vJhIu1rE8VExCd3ofIP27V6UuG kswXF7cP+gbLMfATq2j2h+Agerjhq+i/iFBA8bWywwvLa84PCUTtHVsRaZXPcA4wrO XZiq9fsnDj4348m77XsPXkDF3ePIYbvnggXL5vqW7Ya+MGp5OB0kFEID0KZ1GyGlSQ lytxEZwckbsbg== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:47 +0200 Subject: [PATCH v2 02/11] drm/tests: client-modeset: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-2-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1405; i=mripard@kernel.org; h=from:subject:message-id; bh=on1Ib/kmGdNbcufdxrj7WeqtPtfL4L5bH7r+5VawDuk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTMutReF1l6zX6Prf8JdTimR747i00X/wr9cjlP+s PSsZL1wRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbyl5vhf45OjvbEhkh2RtlL 2yz0e+fl+WevT8w0X1sz22zH0st3JRn+6W68zv7FoE1pB59SzjMVVw+r+StS0v92ZK1zC3mx0qO WAwA= 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: 1771938925558314912 X-GMAIL-MSGID: 1771938925558314912 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_client_modeset_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c index 416a279b6dae..7516f6cb36e4 100644 --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c @@ -82,13 +82,6 @@ static int drm_client_modeset_test_init(struct kunit *test) return 0; } -static void drm_client_modeset_test_exit(struct kunit *test) -{ - struct drm_client_modeset_test_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - static void drm_test_pick_cmdline_res_1920_1080_60(struct kunit *test) { struct drm_client_modeset_test_priv *priv = test->priv; @@ -188,7 +181,6 @@ static struct kunit_case drm_test_pick_cmdline_tests[] = { static struct kunit_suite drm_test_pick_cmdline_test_suite = { .name = "drm_test_pick_cmdline", .init = drm_client_modeset_test_init, - .exit = drm_client_modeset_test_exit, .test_cases = drm_test_pick_cmdline_tests }; From patchwork Thu Jul 20 11:15:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3043650vqt; Thu, 20 Jul 2023 04:19:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlFSCOIU4CnY8CTG0XNwFRf3XfbpV0UXiIpTNHCdiFf+I6YtNovNRwfzpGS9PoPp9BS7G2nE X-Received: by 2002:a05:6870:212:b0:1b0:1a20:7e34 with SMTP id j18-20020a056870021200b001b01a207e34mr1454140oad.48.1689851987118; Thu, 20 Jul 2023 04:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689851987; cv=none; d=google.com; s=arc-20160816; b=q313YpBYuqLuyUIYuIrwOO2jbwNOciUplQ7vizAd3dUkl/ovXw5GOW75mIpAwAnwek N4S4mojea3qRDGY2bkBPhDnYWJ2iLcP6U7XPwhqkrkeihISFcDxquYxgPKorkst1Y/Hi E0u3scKCgrcFoXH/tclACgbnp4idXWPDW6cRy7v43BDOTi+wNpBoWd5UZCVnSHip5Mgk Zl9+ctf/O+jNU593n1T1yFFSQdH8y+eCPkXWUOmoKPvgzCn1agB+MyOlmrq3bk+V6NN3 hwWpFNPHOYrRGuWlc+OO9frrqR/w8erdJLpMSY+BZoli6Gfo+EPMEd58ZO/cgWKd86Q5 qAoA== 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=FeJkulhZkdisNN109vijvOoUFVkmg9JqLhnC7sZVkB4=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=glhY3mT0XOXzxOD8woOD369rKPe0ZLySyfv7Xj3wvM+5yLD5azo/CQ12y/aOFu+rNL nyTpuEzo7uWmaXgSZUGLw3SUDhHBl6Gmi0cF5EZUVVInfAGKQ0MfVEPO3iMWYZXawhnS ZCH8qn/19EvM5xGkW8gv0DMfq7XWgjTwnVkyTh3etXk3I5f7QigDywD6UZ9lUsA6BW3z g3IXSZMDJHmYjy9NSrXu2AU9K/yyIJRkGlZKFKD3qbSmz2fhbGAYsZSClROFyornOsKc Ufa+/WFYBce9aLWe9lffWJ7FJmi7g5cA29BGlWH+wnb2s41xYRkJk/ZBxkqNH+rthxNT AMtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UNaf6uTb; 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 x4-20020a636304000000b00553859c59c1si622967pgb.695.2023.07.20.04.19.34; Thu, 20 Jul 2023 04:19: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=UNaf6uTb; 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 S230324AbjGTLQf (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbjGTLQb (ORCPT ); Thu, 20 Jul 2023 07:16:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D78682D56; Thu, 20 Jul 2023 04:16:04 -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 B1D3561A2A; Thu, 20 Jul 2023 11:16:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A1C8C433C8; Thu, 20 Jul 2023 11:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851764; bh=WCfLzKJ9sM8i+BLjxKY6Cmt+LRE3//pdjKIz70DXm0E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UNaf6uTbWK2GPJonf5J7mfU2ptw6C7UGMCgxsyCSYwLHB3D636hw4r33zJpx9bYeZ VD6RTESqqz2fi3vosR8f3K4hw6Mnl5bWI5Hj9SBSYMQskpG+sDUVlPk8ZwQgfcsdFz 43zNnRa6famQsILB7m+ijEZKIw0YZysU1unNJrtHfcK+sqUfzoCroZ+SLzG5MAesP+ 9a5HGw1UMS1MKys0T7NCe21aARXQrw1nM2jcHkM2b7tXuQL0po2RN6OeVrUHfyJ6cP uo054JNiLq9ulYxTGQnzcVTPcndy7HsUIus2nHsxaeRW8a1+DewnAMBQoe6RjYiOga GB+eELLrpjqcw== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:48 +0200 Subject: [PATCH v2 03/11] drm/tests: modes: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-3-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1295; i=mripard@kernel.org; h=from:subject:message-id; bh=WCfLzKJ9sM8i+BLjxKY6Cmt+LRE3//pdjKIz70DXm0E=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTNce5ez58hlbNrX8dW3Q625/pewoty87DUhp/96n nWv23q1o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABNZY8Tw3+eTaXLC9wYzG7Eb e8OeXuayXSIW43jS58j8ct11PRGn0hgZPl2/fPBtQvY5L8tb9pPF89n+S3av9Ni/7IuaiPV3q/g 7DAA= 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: 1771938237456502634 X-GMAIL-MSGID: 1771938237456502634 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_modes_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c index bc4aa2ce78be..1e9f63fbfead 100644 --- a/drivers/gpu/drm/tests/drm_modes_test.c +++ b/drivers/gpu/drm/tests/drm_modes_test.c @@ -36,13 +36,6 @@ static int drm_test_modes_init(struct kunit *test) return 0; } -static void drm_test_modes_exit(struct kunit *test) -{ - struct drm_test_modes_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - static void drm_test_modes_analog_tv_ntsc_480i(struct kunit *test) { struct drm_test_modes_priv *priv = test->priv; @@ -148,7 +141,6 @@ static struct kunit_case drm_modes_analog_tv_tests[] = { static struct kunit_suite drm_modes_analog_tv_test_suite = { .name = "drm_modes_analog_tv", .init = drm_test_modes_init, - .exit = drm_test_modes_exit, .test_cases = drm_modes_analog_tv_tests, }; From patchwork Thu Jul 20 11:15:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3044180vqt; Thu, 20 Jul 2023 04:20:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjqVB2mknRCFDsN02qSygduWm5lA4OzHteRiHKIed+i2xTJVPBl2is/n7jWjkINGIO1d76 X-Received: by 2002:aa7:dcc6:0:b0:51e:54ad:ba8f with SMTP id w6-20020aa7dcc6000000b0051e54adba8fmr4698144edu.24.1689852048421; Thu, 20 Jul 2023 04:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852048; cv=none; d=google.com; s=arc-20160816; b=U6EyECrSt4ao1bjAJYy3Q87u4/0SKSEOeQIlPz6E0hsrrEt8vPcvbJZrUH+uxReTlp YGKsIvhWgpXoCHENMkr10W6S7IrTz4ZOnV+782I66hYDivB1V72bwJd8YwCX1trzsJrK 5V7sJAcrOpKxqrNc8XyW3iVOQm6fEEzzdUY3KZzTUMYYN3t5Af64SiVC6GrXX5qG5mM0 kOOxS+2SDKTGFhYYALVeMLbYnImRjPn+IfowD6IdLkd76aCjdf77zKZqt9nfNdMqv8n7 IFrsS5U/E4t56PO/WytYHJlD4C17oiP6rVlTczqmuMfa8j9EVPd4IR2bISGZBCBCOipK vTIQ== 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=3tArEZR8iOOhiJec+wDuvUdxk+pdYsgm3l9TbVN3DGY=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=RZ7c2H6x13UHKdQzGQrjSlNcLhfjQNdtGMG/JsSGqJTgBd7lV9vG4ZmEGYUbuo2taz WR/uOhsCLN9sk2elTzmsXPH7g8wnPMCuHf0OSL6kEGqPDL30giNTM2e9CcMxWi62mK0x 0woFPh2ryhdNRrivGVyYDVBLQHH9Myafa/EwlbhBhbL08FRTXMooGBLXtFn7NSQOx1aS LmU49nKSJE8AQzexStglItfXY5pfIX2KnFJMXZ4vu6b/lGPd4RpBTiMkNHaYrL4eReQX 5CZ4MDXr/P4JSF/gS440IwXwxWikgOC06vI0AJQbIbCFJ2A/BqnxtlROE9eMcvuZ+KHe DDHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dTYuZxfd; 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 p13-20020a056402074d00b0051e2819d4a1si623524edy.543.2023.07.20.04.20.24; Thu, 20 Jul 2023 04:20: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=dTYuZxfd; 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 S230497AbjGTLQo (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbjGTLQd (ORCPT ); Thu, 20 Jul 2023 07:16:33 -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 F142D270B; Thu, 20 Jul 2023 04:16:07 -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 634F061A22; Thu, 20 Jul 2023 11:16:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61B63C433C7; Thu, 20 Jul 2023 11:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851766; bh=lolA781m2pvNRYndxxR6VFXpaiQRr55iVDwxTaDQ5Cg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dTYuZxfdBdBE4uVyYSw1okw02GNpd3y/cPPtAQH5kOZN05SRokADcJOknZmXVWvuE 3GVK6YatJzb3/7INyVcGVPXS/K7Dv4YF9y0JAiCMiC6s+lAmTkW3QWPkf5f+qLLwo3 DDt8ojhhGirvs63NQqLzBv7zKaejXoPaqoBI9JjYDt9uDw+L+wK9VxORVAbaoIHTNH Om+lfBGw7an1vRpNb25o5edTtjIBoSVcGWHwgIcnQ6OtO0O6ru1jvzbPCevP8MbYns fmEok7SZIrHuDAGCez4A0vfJ88CzhmlYm6nvGniEkV4p1Ix7MvuRdFcuLBJ/qgVFVd ASXMThOuUR2cA== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:49 +0200 Subject: [PATCH v2 04/11] drm/tests: probe-helper: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-4-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1442; i=mripard@kernel.org; h=from:subject:message-id; bh=lolA781m2pvNRYndxxR6VFXpaiQRr55iVDwxTaDQ5Cg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTN+ed+ROjlv+d053PHpDT9F7Cy6r0czLD/5QeDR/ uW2BzsEO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjARbR+G/84z1p/Vt4iSEfVZ 7qTu/UJT/Z1W4v1Uk3OO7Wv0sxL95zAyLGoMM+ap3J7fGjpDem/pO+Npf687vcze8HnmQTPrx+E neQE= 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: 1771938301968540647 X-GMAIL-MSGID: 1771938301968540647 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_probe_helper_test.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_probe_helper_test.c b/drivers/gpu/drm/tests/drm_probe_helper_test.c index 0ee65828623e..1a2044070a6c 100644 --- a/drivers/gpu/drm/tests/drm_probe_helper_test.c +++ b/drivers/gpu/drm/tests/drm_probe_helper_test.c @@ -60,13 +60,6 @@ static int drm_probe_helper_test_init(struct kunit *test) return 0; } -static void drm_probe_helper_test_exit(struct kunit *test) -{ - struct drm_probe_helper_test_priv *priv = test->priv; - - drm_kunit_helper_free_device(test, priv->dev); -} - typedef struct drm_display_mode *(*expected_mode_func_t)(struct drm_device *); struct drm_connector_helper_tv_get_modes_test { @@ -208,7 +201,6 @@ static struct kunit_case drm_test_connector_helper_tv_get_modes_tests[] = { static struct kunit_suite drm_test_connector_helper_tv_get_modes_suite = { .name = "drm_connector_helper_tv_get_modes", .init = drm_probe_helper_test_init, - .exit = drm_probe_helper_test_exit, .test_cases = drm_test_connector_helper_tv_get_modes_tests, }; From patchwork Thu Jul 20 11:15:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3044058vqt; Thu, 20 Jul 2023 04:20:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlHQQFVXVpFEy5rf89U7nSH8hMes/vhls5l3kRT5SdwPzCafaOmp9a2iMyZa1A4jqdrmWzVv X-Received: by 2002:a05:6402:1295:b0:51a:3159:53c7 with SMTP id w21-20020a056402129500b0051a315953c7mr4461349edv.30.1689852034311; Thu, 20 Jul 2023 04:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852034; cv=none; d=google.com; s=arc-20160816; b=TCAtNfzrSQmJeHe18YWXdp7SZmapCSsXCMP/PCJikWKEzvGf17Js5sqHfeSsXqTxA1 pNIG+hKorETu5DMJC4B8zsEPXYasDd4H9ayQmVa0KY28C0CMAYWVgZpFrO3YejF4GF8T a/vyXQa2ocIQD7Rf8mRevtpdhwibNWKwXibX3j2dVzzUcH/7X+is+5R46KuNTV61qcOE pTPCI7BJDsYGQFMNanp4dR71nfs+OOhAcbqwpMqhRsk1CQhiAgUhUBO/8ON69GCLkne6 JKShSQafrOjDj8hGJOmAjNMxN0M7jT2BpQd1gXRprtnlsG+fDwft/MqnhhQCbZEpEME0 amwA== 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=eqrhzIYNn52lMZe4570iCTbn1rTyWaMEUi5d/UX23k8=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=qgxVD3Z1knwzjwORne7eKdPePkl70DBr6fTICa4573oBN4uMdJAj5Xh/C9FQvf5xzz wJBcT2paj0XPFp5SOr+1zIbLeTjg/I7RVkqZ6gGXcQZqX4UBbyL11+GhvcjDjFJFzoiv vOlr6D4pYEdFWVkQpHUlV1ddqaxEgEHHE3dYvuac/7oFyqPNcF/cZNw2YHl/SKcDG6CO cC6FwCLxFUxlrMYTerxaoe35s7zRL1Bmpv3Y2CYyN1wEP6+XvL7FHBhPYft8OjSol8ZN RbIWw0aCbS+qSmH0Qs775+K6i97gX3J1AzCLilHVKNSBG4zAeMuUEiABErm1XAWc9Zai ZjBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=peC6XHDl; 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 bc6-20020a056402204600b0051e0d936760si670824edb.14.2023.07.20.04.20.10; Thu, 20 Jul 2023 04:20:34 -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=peC6XHDl; 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 S230493AbjGTLQk (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjGTLQd (ORCPT ); Thu, 20 Jul 2023 07:16:33 -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 31D152706; Thu, 20 Jul 2023 04:16: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 7C43C61A33; Thu, 20 Jul 2023 11:16:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67340C433C8; Thu, 20 Jul 2023 11:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851769; bh=CXPsdCVxz77cgfDGMI4BSalP4ePPYu8Tjf40VvpURr4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=peC6XHDlEo9ViqK8GjRcdygHlyFRs4WTMcmRssoW59KEKeh3xvg9kpYr+4c/3R7Wq d6VUIrqPvsBxv6MWCQ5huSN+Nm/oOFrtPjBeL8gJa5oeL8o4dpLIRv9w89rkWloDuu aWaEQJgNtCOvyv0ELmmuFoy3xKTS1uxGQyvCd6lTaFFIQoyFgu8mwaB4u0g6uJyHV5 A4ET8iadCrvlGJ2doFhrrWS1SeVwHIEknYq1+VDbRysTskWEB12h1ho0qMIOZ6anUk 7tGJfrB6SdjO3/PE+RR6eh17XxtlvOFBzLRNXtfKPPdOA5/gY7EW1TfVWjHUPfecgF kHeyl98s0yTnQ== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:50 +0200 Subject: [PATCH v2 05/11] drm/tests: helpers: Create a helper to allocate a locking ctx MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-5-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2652; i=mripard@kernel.org; h=from:subject:message-id; bh=CXPsdCVxz77cgfDGMI4BSalP4ePPYu8Tjf40VvpURr4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTOKj0Vt+pHu+uzCVas+w/2m0qWbm/zXOqXZ+9/5s WffA9XVHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZgIz39Ghom3ShRDzrhZBcdO va37oeD4z0v8+153n3Xb6rP+bXcN90ZGhrcd5V85I9QfbDk3gYlrVqGr4CWpsC/SnrUuJ9q4Vx5 7zQkA 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: 1771938286617991990 X-GMAIL-MSGID: 1771938286617991990 As we get more and more tests, the locking context initialisation creates more and more boilerplate, both at creation and destruction. Let's create a helper that will allocate, initialise a context, and register kunit actions to clean up once the test is done. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/tests/drm_kunit_helpers.c | 41 +++++++++++++++++++++++++++++++ include/drm/drm_kunit_helpers.h | 2 ++ 2 files changed, 43 insertions(+) diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c index 5856beb7f7d7..5130d4553262 100644 --- a/drivers/gpu/drm/tests/drm_kunit_helpers.c +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -120,5 +120,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 Thu Jul 20 11:15:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3056001vqt; Thu, 20 Jul 2023 04:44:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlE3acM0zjE95DIqqEIFpRxKUHKcYc6xr5MlZm3Z3rpMLY9B3+D34g69u6z22XN7Cd9RAbx2 X-Received: by 2002:a05:6a00:2484:b0:668:7494:384a with SMTP id c4-20020a056a00248400b006687494384amr6502142pfv.12.1689853495443; Thu, 20 Jul 2023 04:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689853495; cv=none; d=google.com; s=arc-20160816; b=bRo5UivQ2Nddlzdt3N8VLQo73C2is6YxYXqqc+C/qXvsWCcIIb2aR/PWvWrJ4gav/T LxVVLgeX/H5YJFb9ruWQ3soc1lEZY3YQ65CfgFqiHs6D8ubOL30Oi5F3MeM7s+eJ3hv9 40cQCO+ukxXSrThdd3LJT2m+BKbJmY6IuE87Pvndz+o4xS7miB4fHQELzH4u3XdzY6vU ENG398xvkFIBcmgoy29Pn7NL4STsSeVt17zqqAIwnJ6yXYt0N/5SDyjTLQU0xtJh3sz3 P1DAO/y5RCKlYTfEE6g2ROYrjkkVorkhaeDyuflt2IBF4cFfjjTQvGf5ebJOeOnBZD67 +EKg== 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=gW6u07GpO1PzJOOyWdLecCobPAe2lOMbaKWX0KhivMI=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=bGcllvtKgaI0tc9LpWrfGnlIxNyLx3Arjie/lI9JfQcFnDfBMISvOt10R4Ji0+65JP aelbrwXoq61ZzxBzq4TebO756C5npN91T2ipiadM2pX/wJ2KfZRswkUZDLmODqBz0oya Fs1U/57uCiDSCP8OMxe4vpZ4A+rwLn1xTZo9KeTentk/V//JgI9FiQWu3ox/SDxA2nxD CTKspdB9Sq4zoMDcIRXe8z44c/lB09ruqL8dtOOXu98C6VSnfDXDjjm1r2s81ED14h1D 6PcI4+lf6wvPYOo4zPR/XlNHykTVdShEoR4fJWewrCpfIbPnYXXdNE/KXJCuzAjjr1wW WZ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LGJjo1Rl; 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 i21-20020aa78d95000000b0067dac801f59si759438pfr.224.2023.07.20.04.44.42; Thu, 20 Jul 2023 04:44:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LGJjo1Rl; 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 S231128AbjGTLQs (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjGTLQd (ORCPT ); Thu, 20 Jul 2023 07:16:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E607270A; Thu, 20 Jul 2023 04:16: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 9756061A30; Thu, 20 Jul 2023 11:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7122EC433C8; Thu, 20 Jul 2023 11:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851772; bh=RTSEK9AuzInb7QEn851gyVYlX2dE99c4ygJyZxMvK4w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LGJjo1RlmLqvxcMtAHqsnDWNrG5LnXneK5Yg0asEY0wUnpmxf5EQlxVYZJ8fb68ZI lBh084z2BgcXsxbtV/T1m272twTAM1vFVk9Hg34KEldAaPxAIzxtphK6ntKVgLHfPr jhY2pI01EwRFI1TwI5Hh/0k0aayQyCEZXjPsTpN/LGzff2+gzAzhMK+2qyY979qd+2 nSim8I6Nq+K3ofrZt7GZEO+gFtJxsSoQ0FM9pnNr40woS40ERxBQD0RGKNX3T0ACu/ Gk4wux8xPAAqc0P/hcRTC/pzVhFAyOwzGT8N9jwiEsrzqLfV4RsD9Ai4fceVMrhQW3 t+JJX09qz25hg== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:51 +0200 Subject: [PATCH v2 06/11] drm/tests: helpers: Create a helper to allocate an atomic state MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-6-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2883; i=mripard@kernel.org; h=from:subject:message-id; bh=RTSEK9AuzInb7QEn851gyVYlX2dE99c4ygJyZxMvK4w=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTN2dsp7mT+PKRU0fMZ0W2y+0tkJTOdv7lYX9XqXw 7Pw487tHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiI9D+Gf5o9nI4NK7yXLVTa fmQLo2K/59RURseeN08+bVy5oEfvxhuG/5E2IpVf37O1V4YvvvtnpfA1uXMiYR25zy4KJCZJ7+q oYwcA 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: 1771939818847697540 X-GMAIL-MSGID: 1771939818847697540 As we gain more tests, boilerplate to allocate an atomic state and free it starts to be there more and more as well. In order to reduce the allocation boilerplate, we can create a helper to create that atomic state, and call an action when the test is done. This will also clean up the exit path. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- 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 5130d4553262..d3b2c6b48163 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 @@ -161,5 +162,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 Thu Jul 20 11:15:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3049512vqt; Thu, 20 Jul 2023 04:31:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEmLjO1yKIpzCxRzsZpCm+FR/Btpye7jZeTWBJRfKjEv9Pmzz5PU4y+NDhkRUQtP+Hq7Ot X-Received: by 2002:a17:906:2c9:b0:987:6372:c31f with SMTP id 9-20020a17090602c900b009876372c31fmr4947280ejk.37.1689852678602; Thu, 20 Jul 2023 04:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852678; cv=none; d=google.com; s=arc-20160816; b=pssU00On7yvaU12ubBxEs//0QGihUygwJfv2L7P93nBLq+MjC22HRshggVz78gpnFY LOY5ygIWkyOMKNm9JA3x1CgQ3U2SF/Wq1LjTPKGkS576jcl9ps8HTxZd8/95Gh+PxEUo gYhPJTvz7HqnMF0Foh6x5bmQ6nIeqY2/K/OdcNC5ZcgqYQ8NP8s0ZOH27XJ3nVycCKzS I1RWifflEHcD8neV0WcrtVxkLNbcdqOJiU0m2iDW2CypmP8B0OBttzM++dNNlIMzoMBl WHU2q8M62tkBRsU8Tgt0KFM/lLd+Dtwyh+C7EQJ3FW3ZuMX5tcYU/TLbWUny0iTCm7Mx NTTg== 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=FoamQLLhyp49TBQESkR1Z7yT9TUZCdeLwxt3wl6ORa8=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=N4OnNx0P05GtQnyEMQZx9fwfzGi/Mqe+A4kVKlzHNqsBA9e7xAkW/Db2U5BTA04E31 EQkuzMsECx/MoXMDR9djaEgvHmmFrhvevz1yxoAWDesXHs5FVAw2krzUVMc+H3VPH149 XdGd7+JPVWhFcV7Rsl7u1OQR0/KUMIlhNQUNOSZzY7zSxLRQM/wohqT3Quon/3Yc7eBo tEaYu8vo/qFjSLhyDaRxdRFaCPXKtt+lOKcFS6/2kB+ZZnd513msDoZsylE/1m+7RiQS 1zlRUL5LOjjgUDY6yUpwpx7H9QFux49qSseHV29tJwYRb9UA45HBmGl8hyb3HqoncNaH OJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wo0cwtVm; 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 j19-20020a170906411300b00988a6f59292si482247ejk.600.2023.07.20.04.30.54; Thu, 20 Jul 2023 04:31:18 -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=Wo0cwtVm; 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 S231186AbjGTLQ4 (ORCPT + 99 others); Thu, 20 Jul 2023 07:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjGTLQg (ORCPT ); Thu, 20 Jul 2023 07:16:36 -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 C6FEB26B5; Thu, 20 Jul 2023 04:16:16 -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 51E1661A04; Thu, 20 Jul 2023 11:16:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 297AFC433C7; Thu, 20 Jul 2023 11:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851775; bh=aEbBH90Q7xkJQdnrDQMeL1MCCt2R23BBm7z0R3SziVE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Wo0cwtVmdDvOk9uIrmrFk6ErNrzUBBnsC1KZRI0wB6MqBpUTTifHbXi+Q4ti9Pbko 12mq6XNT8eOBWCdWlbwzOBlhe9KVggkqh+EKhyEeZyG/iP6X3PnsoZBPvzHkk648Wq rtqP2cp9ScuibEqlH3GCvC3OWvhXwDm2HEPBy0CZXlQz681b01VoBnYsviO78MC5cf 1WWoOK9D0delsBrtpsrRg7t9/zFEu7AazZ+aTLKEmDJ849xEvcL65lzDsra6FZGHSI IDWrl+5h+vsFQsI70F8zz6UHV3d2dCpT6fHEoTNgwhgVCsKAEt6Mm2T7Bdg6xy0ZHg zSehdjDP93cuw== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:52 +0200 Subject: [PATCH v2 07/11] drm/vc4: tests: pv-muxing: Remove call to drm_kunit_helper_free_device() MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-7-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1853; i=mripard@kernel.org; h=from:subject:message-id; bh=aEbBH90Q7xkJQdnrDQMeL1MCCt2R23BBm7z0R3SziVE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTM439+7/nvW7ivPzsaz771auWPBlMt35ySmWTOye NgGxRbHd5SyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi/9YwMnyOn6ax4phyFusi 94dmrS7bJut2Otc9vHfP/RjDe8dZbosY/ln5yfjZvcm+9W3/+Ul1wk1K8iz6wp65WSzuOX6+jRp RjAA= 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: 1771938962165887843 X-GMAIL-MSGID: 1771938962165887843 Calling drm_kunit_helper_free_device() to clean up the resources allocated by drm_kunit_helper_alloc_device() is now optional and not needed in most cases. Remove it. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index ae0bd0f81698..6c982e72cae8 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -762,7 +762,6 @@ static void vc4_pv_muxing_test_exit(struct kunit *test) drm_modeset_drop_locks(&priv->ctx); drm_modeset_acquire_fini(&priv->ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static struct kunit_case vc4_pv_muxing_tests[] = { @@ -873,7 +872,6 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) @@ -963,7 +961,6 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static void @@ -1017,7 +1014,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); drm_dev_unregister(drm); - drm_kunit_helper_free_device(test, vc4->dev); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Thu Jul 20 11:15:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3049870vqt; Thu, 20 Jul 2023 04:31:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlGK0hLBVgRS49vqdv8YtgmtY47mdbVeyuyO5qMdz3V+luEE/m87gSvjD1F5hngfR0ftQfzv X-Received: by 2002:ac2:5e2e:0:b0:4f9:586b:dba6 with SMTP id o14-20020ac25e2e000000b004f9586bdba6mr1290019lfg.10.1689852715368; Thu, 20 Jul 2023 04:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852715; cv=none; d=google.com; s=arc-20160816; b=aZovNTuAgFPqXfzpa7MZC5GIime2TG1b7RxAdCMFlGf7A0m4r8vwpD4PEg2xgjRANT nojkvwdpN2ox01BzrSVJe08lmdFGFtAmTwbiBqwcDd8olAuKMfuAgLCz5568LqSO8ia6 TCfo0XWFzz723820pktGE93Q5dha+AMwM8Er29BP8CRPArQd6gT/fomxDx/OOK6XHxu6 6mdyshGJI/OGCd25RgL6RjhGd+IfSbbtlAatw0522W9UbLNaeKUSrkiz6YG0FobhYt+U d/XFSuSVUxrFersgqrKVZT5Aqj/kxThAKPsdcYkLxoLkCeeCJkxp9pSOcJhv8Al1ecNz Y7Jw== 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=YipAF+ek1uNXYmxZbA94gsReUkZd+OabYgSDSuLqhCo=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=ssflwxqtNg4CNNGP7s8h/aL9UxxLKcNZ12GJmY+ZcYqct3Xbvj8lvuKM05DsbdbPU1 YV4r3nYfV4mMoZeM7pB06lybO/AThbzsoPTtFwGrFt+yU+1ek+muFbmVYVFBkVUwzikR GiG4FG+N9plRVqc1QxzpVuyw8S9HSTMb95JtqlVQ4y7N+QTTgDo2ZMHTBEX+itX44F6f Q6RWaP9Xg7W6PUir3X+3EwQMhBYdExsg+putaBRqgzsafzmHRdS4xEFuAA6hF4UAiCkd ZBo1+l9UbQsCiw8zbqKQp3Cpjd8tNT5sBmJx/KwCApfTWZMDANYvngsq9urHNOstslB1 waGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rEatctXr; 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 v15-20020a17090606cf00b009937e7c4e50si511745ejb.546.2023.07.20.04.31.30; Thu, 20 Jul 2023 04:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rEatctXr; 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 S231365AbjGTLRJ (ORCPT + 99 others); Thu, 20 Jul 2023 07:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbjGTLQr (ORCPT ); Thu, 20 Jul 2023 07:16:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E79726B7; Thu, 20 Jul 2023 04:16:27 -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 5A36461A40; Thu, 20 Jul 2023 11:16:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45EFBC433C8; Thu, 20 Jul 2023 11:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851778; bh=JWFUwbalD9zxa7dO/ypOz2ghZPZM+ydDXz32zJavDmo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rEatctXrj2El/Oqy1p1LuoVHjODRVKHwABdheYr7D+onnRgjPQTdG04aSVp5k6iJ6 ONrLpEmbwfdS3BxkhZGwQFFpldyp9azcoIZ0aYplDhEuXeccqzPcp4hwLrWLIzASZ3 bcdaCziIgQLc2VnyxscUOXxsJk2eHVlI8CJtgqdyVgmJfTtMPEVWHIiPphmCmhtSRJ oOCHKeXaJjrI7rAjpFzveNdCKwaHz6Pr0378if2GvSQSyLqD9niZrOPiM191dy5Mu8 NODcJukr9fAyDiyPODWUv0u/TR9oywflLWAy+fdXNRtXxkLEXcW+WotSumAN8hu762 WiAT/WaGzWHWg== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:53 +0200 Subject: [PATCH v2 08/11] drm/vc4: tests: mock: Use a kunit action to unregister DRM device MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-8-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2707; i=mripard@kernel.org; h=from:subject:message-id; bh=JWFUwbalD9zxa7dO/ypOz2ghZPZM+ydDXz32zJavDmo=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTNeBN0RPz+jjEX21DPrzuOxy6YveKE35Yznh8v9j vta1heqdZSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi/2UZ/kdYbWP8pSvxfSfn VO67jkdayo8wb39xZJZT3HvDt0/uMmYw/OGde3vF5/su7RukFuiu4dP83rgt/5r1rLKGi1M/L33 2qpgJAA== 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: 1771939000932842057 X-GMAIL-MSGID: 1771939000932842057 The *_mock_device functions allocate a DRM device that needs to be released using drm_dev_unregister. Now that we have a kunit release action API, we can switch to it and don't require any kind of garbage collection from the caller. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- 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 Thu Jul 20 11:15:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3047301vqt; Thu, 20 Jul 2023 04:27:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlE8ZKGKIBXtReCI6+2FW0Mkb4cYlQiW8+FOXB9GpMYIcnFUbRFD9wbtIhLJeoVN4CY5d82r X-Received: by 2002:aa7:d6d1:0:b0:51d:95ac:22ed with SMTP id x17-20020aa7d6d1000000b0051d95ac22edmr5642573edr.1.1689852430198; Thu, 20 Jul 2023 04:27:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852430; cv=none; d=google.com; s=arc-20160816; b=tcaIIqp1AMakq6rvHSe2rcwKlgSIHq1TI5xU7aZLjHAubs35Cf8PCgkFzkwvSoJDHv L9tpq4GEBzt/c7OUo5ZtZXp6BuM8vXK5z/E/ewhAGhmgAgYHaqReLVMy3uYXKhTuUwel 8tCoSA/sSAgmdB5eqkqa3HwX6HVKptkLGon54v0OsNcKDP8qEAJKfqyPFAb3RmprPRO/ 03s8yWiwJ/EZOEHRUPLtG5D9GuN4/roJtJYwGa6vpWbsL0IsnTlIJDmenJYXiE1Keeqq yGXv2QBQ0reKwT5Skkgvu4KbpmYGG/L41GmSsOoIFBir8rKvNiKeWET63Me1zjHv2FiY ih7Q== 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=v5tHBDyKHodFhECrpM0Byt7Es0as9U5HSAjUCpzgQx8=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=OFpeWtrjcj8pXmdO5ymC11qu72oaYMrtqdmWOWz+D60MVO5K72vAV1IhRGGJiXEYF6 uMVbLYWBYysac7jXHhzq7JQ2pFI0pP1F27Fs2dEgQAj5+7ovqHXS9KZyM9AlX1KLcesV N3UW8gZu2TluRWgAhmn9GJnf1C7q1os9H+swef/9kc83pNtgi2zoRuL6IH+BS8tXG8Qs y8lEh6jbZIx0S2woHvZ9fIUsjB2cRXI7KZ0Of4RacZPu/cHLIzu+va02n5FenACq4isA 4Y0Wa6ezC56M18H/BNd1VcLTMckMBNPE9Vmv6wX0c8MWS8roVAoXc+VFAe8nOrv0edv5 3P7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u5K6U4tw; 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 f2-20020aa7d842000000b0051e10e83750si659111eds.294.2023.07.20.04.26.44; Thu, 20 Jul 2023 04:27:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u5K6U4tw; 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 S231138AbjGTLRG (ORCPT + 99 others); Thu, 20 Jul 2023 07:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230502AbjGTLQr (ORCPT ); Thu, 20 Jul 2023 07:16:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075C026A4; Thu, 20 Jul 2023 04:16:27 -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 0F03961943; Thu, 20 Jul 2023 11:16:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A4EFC433C7; Thu, 20 Jul 2023 11:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851781; bh=juQ2m7xou5mMg6r42FUm4fzdZ7mTdNjeC346O1aspUU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u5K6U4twXCxqhcSDvnRP1UfLNhlkbKUFgB9NPFSYz4RJQ3OlfJ9bE+ObxBxQuNHFl l990FFRmvZ8MZDiaLnA2+3+aYSHID/2pKSAr8I7N6BM/fTPmjo+iG0QThb15Pb2Rpt ihBzyNfT99InGFR6EtFMPQ+GTEiZJxSK3perz+AJ+xcxfad2CSmUXJ+wnUVqEnx3+l TT0izJtBayWf5/CC2zJLQYgA+U6Y4gZvue0nbYsVmli6ioYfkHEE+SIDFUfynUPEJo DXHSWYn3ww2lkxGqvnH24D2DJ54li2F2Cz8RSuZfUS9SOC/v9N93JZtk9az6vxCaCl FR6gLPf/rJh9g== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:54 +0200 Subject: [PATCH v2 09/11] drm/vc4: tests: pv-muxing: Switch to managed locking init MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-9-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6503; i=mripard@kernel.org; h=from:subject:message-id; bh=juQ2m7xou5mMg6r42FUm4fzdZ7mTdNjeC346O1aspUU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTMq91Y/+8R4aurp74GLlZYw/Fn22qtJr+oKG3/J7 MInrD9CO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR7esYGToPLLyZMTWhdzcP 91KvTTWSXyRyFA9fMOvu+vv0e5nz1K+MDO9NrN/MvpTwkGGp/+9MKZXf236xCR+U+OU35cO+rGN X3dgB 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: 1771938701726888459 X-GMAIL-MSGID: 1771938701726888459 The new helper to init the locking context allows to remove some boilerplate. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 42 ++++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index 776a7b01608f..ff1deaed0cab 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -20,7 +20,6 @@ struct pv_muxing_priv { struct vc4_dev *vc4; - struct drm_modeset_acquire_ctx ctx; struct drm_atomic_state *state; }; @@ -725,6 +724,7 @@ static void drm_vc4_test_pv_muxing_invalid(struct kunit *test) static int vc4_pv_muxing_test_init(struct kunit *test) { const struct pv_muxing_param *params = test->param_value; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct pv_muxing_priv *priv; struct drm_device *drm; @@ -738,13 +738,14 @@ static int vc4_pv_muxing_test_init(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); priv->vc4 = vc4; - drm_modeset_acquire_init(&priv->ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &priv->ctx; + state->acquire_ctx = ctx; priv->state = state; @@ -757,8 +758,6 @@ static void vc4_pv_muxing_test_exit(struct kunit *test) struct drm_atomic_state *state = priv->state; drm_atomic_state_put(state); - drm_modeset_drop_locks(&priv->ctx); - drm_modeset_acquire_fini(&priv->ctx); } static struct kunit_case vc4_pv_muxing_tests[] = { @@ -798,7 +797,7 @@ static struct kunit_suite vc5_pv_muxing_test_suite = { */ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct vc4_hvs_state *new_hvs_state; @@ -811,13 +810,14 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -844,7 +844,7 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -866,13 +866,11 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct vc4_hvs_state *new_hvs_state; @@ -885,13 +883,14 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -929,7 +928,7 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_del_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -954,14 +953,12 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) } drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct kunit *test) { - struct drm_modeset_acquire_ctx ctx; + struct drm_modeset_acquire_ctx *ctx; struct drm_atomic_state *state; struct vc4_crtc_state *new_vc4_crtc_state; struct drm_device *drm; @@ -971,13 +968,14 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku vc4 = vc5_mock_device(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, vc4); - drm_modeset_acquire_init(&ctx, 0); + ctx = drm_kunit_helper_acquire_ctx_alloc(test); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -993,7 +991,7 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku state = drm_atomic_state_alloc(drm); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = &ctx; + state->acquire_ctx = ctx; ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -1006,8 +1004,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku KUNIT_EXPECT_NULL(test, new_vc4_crtc_state); drm_atomic_state_put(state); - drm_modeset_drop_locks(&ctx); - drm_modeset_acquire_fini(&ctx); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Thu Jul 20 11:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3049909vqt; Thu, 20 Jul 2023 04:32:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlEqakn2adLUln35mtTfdeuklTTZG4FlcyT4ZHtCBZ01sbFxZvmQZEOiPdffNTNwoNQJK+eB X-Received: by 2002:a19:674a:0:b0:4fb:ca59:42d7 with SMTP id e10-20020a19674a000000b004fbca5942d7mr2188032lfj.33.1689852720558; Thu, 20 Jul 2023 04:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689852720; cv=none; d=google.com; s=arc-20160816; b=B8Sgi+4MBkfHs8FK5ZPoKevCutf1fXTEOXUkumS0IeEc3TfhWAWEa601ES1aLKFTMQ ySof9ZRr1RH/j9/y0pXFV9qkVwhyRuSSsXC4I0/EzBK5ofXF3eo2OGZZWrBuPwKuCb18 6+d/0OC6WAutedxEhjCEemdLFyXbo7sbzvUhOjaGQunWet3k8E/H4oISy+D7WNtbt349 /dOhg4ed98iqB9ko4baa3qNzplBRxG8Mb9vvxJljyNvcKnP+8DOxZp8sf5sw6GgQJJ27 x8+2N+QPDwCcVqaqCGbj2OtOtMVC2aVwDFRCkmh7Tg03LR76M58SfsBYo4uVwKWqGccU f47A== 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=8WP5MMozPUZdjiP7Fx5U1SquSmZ+/PSYrRvx21M9yIU=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=pIUx0rorLQHZEKOgu8Lw0r9mo2orus54tuaT1nRbFzFprduVQckkejBwk7l9ghsItF mE46/kA+G1ImbG+BVYnUTJXyQYDNyWxAerZwPs+d+mcLluBsw7i1oZxmlpixwr7vkVRi A/hEtiegtUl3juToeyE6FXewfxQqNkPwGZPWV2ZSaXhD9BjKopbHE0yW2FEEaqga//gU i3/M0mkEtnalKquuOZ+gSTD8OAttsnQh2AdWi2FcYioLLvr1IzVFWruLcfaqhbMjhZEH ozh640E8bB2tAqhFrZzpi/ZowvA8MyXrUwdYgjHwnpXZQge200ZMQ95WVnMlJwGATZLV dueA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lzo1xmCi; 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 i18-20020aa7dd12000000b0051e27e00a96si675667edv.126.2023.07.20.04.31.35; Thu, 20 Jul 2023 04:32:00 -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=lzo1xmCi; 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 S230112AbjGTLRD (ORCPT + 99 others); Thu, 20 Jul 2023 07:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230508AbjGTLQr (ORCPT ); Thu, 20 Jul 2023 07:16:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F59426AD; Thu, 20 Jul 2023 04:16:29 -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 21E28618C8; Thu, 20 Jul 2023 11:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E170C433C8; Thu, 20 Jul 2023 11:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851784; bh=HNjCpgftiIlvFffeczCsnLqPGw+XAfACZlhyJdStoFw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lzo1xmCivendmDDU1pgho+HmsqDv2rh4T4g3SbWZb91SbztWE/BHARezPsy/5VzlE jiO0ROl59GzSLjoJOz12QlZ+CE4T85mskC2jvHi/+YRoD7/T3lxSVvxb6CGz/XN22g R27btFMfBHZrGbrA7NF/i1lXdrJHFNOJCSidVArffoMsUob+3lVfNeY8X6uuIUyk1A Lc8BqbVr/elNDSu7GLNuRNMam44wE1VoK0HCX7NGfsyC2AnEEZFws8OCvfC9xd+r/m Bx4zUTyWWsBHE6H/tMQz/rl4FfIfSFsQWlb7990CTBjS7Nv41oFpjurLwU1z9bqnrR 7TmUD4cEIZkRg== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:55 +0200 Subject: [PATCH v2 10/11] drm/vc4: tests: Switch to atomic state allocation helper MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-10-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6185; i=mripard@kernel.org; h=from:subject:message-id; bh=HNjCpgftiIlvFffeczCsnLqPGw+XAfACZlhyJdStoFw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTP6VjQ0Nk09v//4i5ZXx5c09ATpMH44/7azSTnoy AfxnZ9Pd5SyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiwnMZGdb+esYxWWDJR8dD N49/vxPOOTfkIOPs8zknumbs9/ne+NaNkeHOPGeT+yIK3+dpicVeWJyhdf5ga7ZLYH/NlK67Mwy YHjEBAA== 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: 1771939006043645235 X-GMAIL-MSGID: 1771939006043645235 Now that we have a helper that takes care of an atomic state allocation and cleanup, we can migrate to it to simplify our tests. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 55 ++++---------------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index ff1deaed0cab..5f9f5626329d 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -725,7 +725,6 @@ static int vc4_pv_muxing_test_init(struct kunit *test) { const struct pv_muxing_param *params = test->param_value; struct drm_modeset_acquire_ctx *ctx; - struct drm_atomic_state *state; struct pv_muxing_priv *priv; struct drm_device *drm; struct vc4_dev *vc4; @@ -742,24 +741,12 @@ static int vc4_pv_muxing_test_init(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - - state->acquire_ctx = ctx; - - priv->state = state; + priv->state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv->state); return 0; } -static void vc4_pv_muxing_test_exit(struct kunit *test) -{ - struct pv_muxing_priv *priv = test->priv; - struct drm_atomic_state *state = priv->state; - - drm_atomic_state_put(state); -} - static struct kunit_case vc4_pv_muxing_tests[] = { KUNIT_CASE_PARAM(drm_vc4_test_pv_muxing, vc4_test_pv_muxing_gen_params), @@ -771,7 +758,6 @@ static struct kunit_case vc4_pv_muxing_tests[] = { static struct kunit_suite vc4_pv_muxing_test_suite = { .name = "vc4-pv-muxing-combinations", .init = vc4_pv_muxing_test_init, - .exit = vc4_pv_muxing_test_exit, .test_cases = vc4_pv_muxing_tests, }; @@ -786,7 +772,6 @@ static struct kunit_case vc5_pv_muxing_tests[] = { static struct kunit_suite vc5_pv_muxing_test_suite = { .name = "vc5-pv-muxing-combinations", .init = vc4_pv_muxing_test_init, - .exit = vc4_pv_muxing_test_exit, .test_cases = vc5_pv_muxing_tests, }; @@ -814,11 +799,9 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -839,13 +822,9 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -864,8 +843,6 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_ASSERT_TRUE(test, new_hvs_state->fifo_state[hdmi1_channel].in_use); KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); - - drm_atomic_state_put(state); } static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) @@ -887,11 +864,9 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -923,13 +898,9 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_del_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -951,8 +922,6 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) KUNIT_EXPECT_EQ(test, old_hdmi1_channel, hdmi1_channel); } - - drm_atomic_state_put(state); } static void @@ -972,11 +941,9 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); drm = &vc4->base; - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_ASSERT_EQ(test, ret, 0); @@ -986,13 +953,9 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku ret = drm_atomic_helper_swap_state(state, false); KUNIT_ASSERT_EQ(test, ret, 0); - drm_atomic_state_put(state); - - state = drm_atomic_state_alloc(drm); + state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state); - state->acquire_ctx = ctx; - ret = vc4_mock_atomic_add_output(test, state, VC4_ENCODER_TYPE_HDMI1); KUNIT_ASSERT_EQ(test, ret, 0); @@ -1002,8 +965,6 @@ drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct ku new_vc4_crtc_state = get_vc4_crtc_state_for_encoder(test, state, VC4_ENCODER_TYPE_HDMI0); KUNIT_EXPECT_NULL(test, new_vc4_crtc_state); - - drm_atomic_state_put(state); } static struct kunit_case vc5_pv_muxing_bugs_tests[] = { From patchwork Thu Jul 20 11:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 123209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3055757vqt; Thu, 20 Jul 2023 04:44:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlHwV7P6kq9F6zibCHQrTZiT6Do6pBEkJS6w/ydxzD4RrvOZcLShWyNSzmL+R2mtWtmB2QX/ X-Received: by 2002:a17:90a:1f4e:b0:25c:2260:9f5c with SMTP id y14-20020a17090a1f4e00b0025c22609f5cmr4189938pjy.34.1689853463758; Thu, 20 Jul 2023 04:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689853463; cv=none; d=google.com; s=arc-20160816; b=nDpgWbhDsutMkSWDM9j07HHyLl9tEKaFFFUOqXLUhxUsx3DiINeO9DWkR1hNB9hhZR GnYOrrVQwl62t2pPDbCkOWCqYK+QAp8NpudvUGSnrqth5PDCholUfnLzXTqLTAxC1D62 fiM7U63zYXzEYZKbA5uE0eEEy4dljKI/iFlDhXaUi2sKhbk4DomF63xue8Ykdrt0gLuc kTL8nKFECiY6+rw9pSpv3BYcoiQuq1H4auUsYxiVipAL+XVb54Hw+WjlMXxNhTatRGPE MN4a2/1fB/II/VRMXbcGMFTrVkWXwQqvwgFzmMfYGAuuchxWAB3AIYtGtqY26lkfW7tb JvYw== 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=K10ED8AWPiTyb/N3igFL+BRUMoSFcMnRhC2YfdlCQKs=; fh=r3YnEVRF2ge3yIgpTE2H86lvFoURZyw1nrIW71mPVsw=; b=HDQvE58QK2y3EQeQicadHLCIpCtiJ8QcsT/Psy3egxOekf+jPORp2LnGplrBK1KIxi sojGrzcPKXZyKXe3qE8a/6DkoV+dyhQ/yYnrWyBpAmEek/pf4qopRvSMHUoAhL0ITLdH 4NyD17cfB9xhGHgGAf8wZolEw/jYEIYpRu0WchyElXnrpuxTuHnjJzSgmfovAun3bJ9Z ly3PMLiXMegY2GHNdGVzBCM+FhN54YQRBpsaq00rbMvM/+kcxrT1aVZRpL7nAcXKGC9q OrkbOeFV71TX0+KFZEHjMLTFLkP0+pasXzPZjtGHH7YCY+cZXG7BjJA+d0ZNYQH1atpH JgeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lz8IptbC; 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 c18-20020a17090a8d1200b00263c23a5693si1004245pjo.13.2023.07.20.04.44.11; Thu, 20 Jul 2023 04:44:23 -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=lz8IptbC; 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 S230400AbjGTLRM (ORCPT + 99 others); Thu, 20 Jul 2023 07:17:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbjGTLQr (ORCPT ); Thu, 20 Jul 2023 07:16:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E53626BA; Thu, 20 Jul 2023 04:16:29 -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 EE78861A3C; Thu, 20 Jul 2023 11:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC9B7C433C8; Thu, 20 Jul 2023 11:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689851787; bh=1nrTAqbBZBRZUWDEE1a4SHpcULf4RL/1UmtaRjuNMUQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lz8IptbCLxR2awc9YH2yICNKvrOS1iLA0ys8CGXwD+1ZP9bB6leHWgjd9xk44hFt9 z/HNJuRve2OSgiwQ6MVOAKkQFdcdXk3OwiWojddAcTNK6E39iNt3OEJ9gJVUBNodq9 QgacqYyNYJAhsXxnfFnEGTNENiIpP6J0ySOPJYwgaCe3MvP7BhWydIqyZv8vbjq5Bd k1OvSsI9Zvm9WFZr6e1kMyZeTPl6aQkxGxMgjExGUeG9uHlGmcwRBt5RJwvXsz5wQ9 lgsHMFe2vlINz41eBlt6b0oQWIDr8wbU0OrHUBg60Eupig6CA8MWV781ws9aEOLsDr acEnsjlp4qQJQ== From: Maxime Ripard Date: Thu, 20 Jul 2023 13:15:56 +0200 Subject: [PATCH v2 11/11] drm/vc4: tests: pv-muxing: Document test scenario MIME-Version: 1.0 Message-Id: <20230720-kms-kunit-actions-rework-v2-11-175017bd56ab@kernel.org> References: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> In-Reply-To: <20230720-kms-kunit-actions-rework-v2-0-175017bd56ab@kernel.org> To: David Airlie , Daniel Vetter , Maarten Lankhorst , Thomas Zimmermann , Emma Anholt Cc: =?utf-8?q?Ma=C3=ADra_Canal?= , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, David Gow , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Maxime Ripard , Brendan Higgins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2062; i=mripard@kernel.org; h=from:subject:message-id; bh=1nrTAqbBZBRZUWDEE1a4SHpcULf4RL/1UmtaRjuNMUQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDCk7xTNaps5z1zfa0BmT7dNsLnmD7dCelUXi6zYKbuwRv cKss0+ko5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABPh4WT4K7ki8gvLjBfx+RGv DcQ+Sq3e+7svemfO20LBAnG5xy4PYhkZtrCtZ1jtxlJ0pthq2knuaTuWNs3u8Z8yc1m56q0jQi9 jWAE= 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: 1771939785818112256 X-GMAIL-MSGID: 1771939785818112256 We've had a couple of tests that weren't really obvious, nor did they document what they were supposed to test. Document that to make it hopefully more obvious. Reviewed-by: Javier Martinez Canillas Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c index 5f9f5626329d..61622e951031 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c +++ b/drivers/gpu/drm/vc4/tests/vc4_test_pv_muxing.c @@ -845,6 +845,13 @@ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable(struct kunit *tes KUNIT_EXPECT_NE(test, hdmi0_channel, hdmi1_channel); } +/* + * This test makes sure that we never change the FIFO of an active HVS + * channel if we disable a FIFO with a lower index. + * + * Doing so would result in a FIFO stall and would disrupt an output + * supposed to be unaffected by the commit. + */ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) { struct drm_modeset_acquire_ctx *ctx; @@ -924,6 +931,21 @@ static void drm_test_vc5_pv_muxing_bugs_stable_fifo(struct kunit *test) } } +/* + * Test that if we affect a single output, only the CRTC state of that + * output will be pulled in the global atomic state. + * + * This is relevant for two things: + * + * - If we don't have that state at all, we are unlikely to affect the + * FIFO muxing. This is somewhat redundant with + * drm_test_vc5_pv_muxing_bugs_stable_fifo() + * + * - KMS waits for page flips to occur on all the CRTC found in the + * CRTC state. Since the CRTC is unaffected, we would over-wait, but + * most importantly run into corner cases like waiting on an + * inactive CRTC that never completes. + */ static void drm_test_vc5_pv_muxing_bugs_subsequent_crtc_enable_too_many_crtc_state(struct kunit *test) {