Message ID | 20230315183729.2376178-1-sboyd@kernel.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp68917wrt; Wed, 15 Mar 2023 12:05:55 -0700 (PDT) X-Google-Smtp-Source: AK7set/UmOv4/LaZ+JIiBFz9q2Pd9QntjQ5WsbZTTGBphzDocyyHmdAHBzTofl0aInbPHihchzaK X-Received: by 2002:a05:6a20:672a:b0:d4:f108:d8d0 with SMTP id q42-20020a056a20672a00b000d4f108d8d0mr820885pzh.36.1678907154907; Wed, 15 Mar 2023 12:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678907154; cv=none; d=google.com; s=arc-20160816; b=VK2p+7lrPZgCOJvx060hJXy7gNEfdsYpqn+yCgRSUU/kgha0eegd0sYpapoxNvR+a3 3dQVjQYlxOyr5CHxjlBapYeBjqZvXBE1YTh4r4Q1jwCw88rFv1petPLcIA2ZyBbljlF5 FADfxMEpD0XtlFAtpxGU5DEQNm5zO85h6RLYsPUxY6ZmqYDi5ePgGmvcqiszi5qsNDVd QK6G3mTGyD3v5P99Sqh4beOdDZT8llCxEe5+FByAQus/6IhFPidMz2XDCFB5dNVq3990 VRtMNJTU9CGM+C/3gOkBH+Z8nEN+9vlA7Z5GDMtdgQ2eiAONmRAyp2VCFhSPhgABDRum ItZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=VQwYtzcxA8GBhsBRozgklB/9CgHcJcVeYEM2KyTu5zA=; b=bVeut0KLNpQRe3h58u34sTnEnb+yBkkVYWHWacKyVRbWX9vQqmPLF6XAvnAny9SfDb +zQB9wtHtrmqM5M0i3+Ev8iUDXdo6/R5Y/XyowyDmc+noUvJl2W/Mmk8/s+T4XIQ7eDt MNqa6ZCVnO9kRXsBJo+VxHG8TsJJGCczwnEVWCSfhEaSmHTB1SHpdgB+5c6IK8bCw0jH XkhkVAS/at5jGbeDhvzTnqF1xyVnIWjcJmWWccE716QRRMY9WWXSb3SsYnkhprHcuDEd ftTK6DIizmHPPjRfl7BpFiniQoh8a1XZzyfzUwnnbwymID6jXjVs011HN+xaPSC1CHu3 msCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZRfAotrk; 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 w32-20020a631620000000b004da377c33bbsi5720947pgl.85.2023.03.15.12.05.40; Wed, 15 Mar 2023 12:05:54 -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=ZRfAotrk; 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 S231135AbjCOSiG (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Wed, 15 Mar 2023 14:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbjCOSiE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Mar 2023 14:38:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A15D2E80E; Wed, 15 Mar 2023 11:37:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D14CCB81EDA; Wed, 15 Mar 2023 18:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD527C433EF; Wed, 15 Mar 2023 18:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678905450; bh=AaKpurosJ1j97dxYAc0JwEaFhzjTwEBlY/xn7R5ple0=; h=From:To:Cc:Subject:Date:From; b=ZRfAotrkR/tcowvtJczP0tt4ZyNvI9Q7qPl22XQVlrb0T0eO4vGZYe284aIicnyMo 5ePPKPmzHEFsm+AxThe7+NPa1fJp5lB2yRgUjYmRbK65Y4BBvydY59q7p40lIcraAN 26fX3poxwZ3gOpzcGv9EETJ4+oReIJtE31QVtJrAhGAEdjt2nbzu61BQKn8STLlb60 G3mtJuDo/6/Uhig0ZT907tygl+F7VNr3Vs0Qp+a5dOkQ1ibauHm+SnN6lgQM0pTmlX 3CAM5IeeBzt06fBt4wVh1yqnAK58hESUHztnQl8XnMTc67oufVlnoBYeUeAzaLMedS C7f30Q7teiC6Q== From: Stephen Boyd <sboyd@kernel.org> To: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, patches@lists.linux.dev, Brendan Higgins <brendan.higgins@linux.dev>, David Gow <davidgow@google.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J . Wysocki" <rafael@kernel.org>, Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, Christian Marangi <ansuelsmth@gmail.com>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, devicetree@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Maxime Ripard <maxime@cerno.tech> Subject: [PATCH v2 00/11] clk: Add kunit tests for fixed rate and parent data Date: Wed, 15 Mar 2023 11:37:17 -0700 Message-Id: <20230315183729.2376178-1-sboyd@kernel.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760461748854903104?= X-GMAIL-MSGID: =?utf-8?q?1760461748854903104?= |
Series |
clk: Add kunit tests for fixed rate and parent data
|
|
Message
Stephen Boyd
March 15, 2023, 6:37 p.m. UTC
This patch series adds unit tests for the clk fixed rate basic type and the clk registration functions that use struct clk_parent_data. To get there, we add support for loading device tree overlays onto the live DTB along with probing platform drivers to bind to device nodes in the overlays. With this series, we're able to exercise some of the code in the common clk framework that uses devicetree lookups to find parents and the fixed rate clk code that scans device tree directly and creates clks. Please review. I Cced everyone to all the patches so they get the full context. I'm hoping I can take the whole pile through the clk tree as they almost all depend on each other. Changes from v1 (https://lore.kernel.org/r/20230302013822.1808711-1-sboyd@kernel.org): * Don't depend on UML, use unittest data approach to attach nodes * Introduce overlay loading API for KUnit * Move platform_device KUnit code to drivers/base/test * Use #define macros for constants shared between unit tests and overlays * Settle on "test" as a vendor prefix * Make KUnit wrappers have "_kunit" postfix Stephen Boyd (11): of: Load KUnit DTB from of_core_init() of: Add test managed wrappers for of_overlay_apply()/of_node_put() dt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends dt-bindings: test: Add KUnit empty node binding of: Add a KUnit test for overlays and test managed APIs platform: Add test managed platform_device/driver APIs dt-bindings: kunit: Add fixed rate clk consumer test clk: Add test managed clk provider/consumer APIs clk: Add KUnit tests for clk fixed rate basic type dt-bindings: clk: Add KUnit clk_parent_data test clk: Add KUnit tests for clks registered with struct clk_parent_data .../clock/test,clk-kunit-parent-data.yaml | 47 ++ .../kunit/test,clk-kunit-fixed-rate.yaml | 35 ++ .../bindings/test/test,kunit-empty.yaml | 30 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + drivers/base/test/Makefile | 3 + drivers/base/test/platform_kunit-test.c | 108 +++++ drivers/base/test/platform_kunit.c | 186 +++++++ drivers/clk/.kunitconfig | 3 + drivers/clk/Kconfig | 7 + drivers/clk/Makefile | 9 +- drivers/clk/clk-fixed-rate_test.c | 299 ++++++++++++ drivers/clk/clk-fixed-rate_test.h | 8 + drivers/clk/clk_kunit.c | 219 +++++++++ drivers/clk/clk_parent_data_test.h | 10 + drivers/clk/clk_test.c | 459 +++++++++++++++++- drivers/clk/kunit_clk_fixed_rate_test.dtso | 19 + drivers/clk/kunit_clk_parent_data_test.dtso | 28 ++ drivers/of/.kunitconfig | 5 + drivers/of/Kconfig | 23 + drivers/of/Makefile | 7 + drivers/of/base.c | 182 +++++++ drivers/of/kunit.dtso | 10 + drivers/of/kunit_overlay_test.dtso | 9 + drivers/of/of_kunit.c | 123 +++++ drivers/of/of_private.h | 6 + drivers/of/of_test.c | 43 ++ drivers/of/overlay_test.c | 107 ++++ drivers/of/unittest.c | 101 +--- include/kunit/clk.h | 28 ++ include/kunit/of.h | 90 ++++ include/kunit/platform_device.h | 15 + 31 files changed, 2119 insertions(+), 102 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/test,clk-kunit-parent-data.yaml create mode 100644 Documentation/devicetree/bindings/kunit/test,clk-kunit-fixed-rate.yaml create mode 100644 Documentation/devicetree/bindings/test/test,kunit-empty.yaml create mode 100644 drivers/base/test/platform_kunit-test.c create mode 100644 drivers/base/test/platform_kunit.c create mode 100644 drivers/clk/clk-fixed-rate_test.c create mode 100644 drivers/clk/clk-fixed-rate_test.h create mode 100644 drivers/clk/clk_kunit.c create mode 100644 drivers/clk/clk_parent_data_test.h create mode 100644 drivers/clk/kunit_clk_fixed_rate_test.dtso create mode 100644 drivers/clk/kunit_clk_parent_data_test.dtso create mode 100644 drivers/of/.kunitconfig create mode 100644 drivers/of/kunit.dtso create mode 100644 drivers/of/kunit_overlay_test.dtso create mode 100644 drivers/of/of_kunit.c create mode 100644 drivers/of/of_test.c create mode 100644 drivers/of/overlay_test.c create mode 100644 include/kunit/clk.h create mode 100644 include/kunit/of.h create mode 100644 include/kunit/platform_device.h base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
Comments
On Thu, 16 Mar 2023 at 02:37, Stephen Boyd <sboyd@kernel.org> wrote: > > This patch series adds unit tests for the clk fixed rate basic type and > the clk registration functions that use struct clk_parent_data. To get > there, we add support for loading device tree overlays onto the live DTB > along with probing platform drivers to bind to device nodes in the > overlays. With this series, we're able to exercise some of the code in > the common clk framework that uses devicetree lookups to find parents > and the fixed rate clk code that scans device tree directly and creates > clks. Please review. > > I Cced everyone to all the patches so they get the full context. I'm > hoping I can take the whole pile through the clk tree as they almost all > depend on each other. > > Changes from v1 (https://lore.kernel.org/r/20230302013822.1808711-1-sboyd@kernel.org): > * Don't depend on UML, use unittest data approach to attach nodes > * Introduce overlay loading API for KUnit > * Move platform_device KUnit code to drivers/base/test > * Use #define macros for constants shared between unit tests and > overlays > * Settle on "test" as a vendor prefix > * Make KUnit wrappers have "_kunit" postfix > Thanks! I like this much better, and it is working fine here under UML and x86_64. There are some issues with other architectures (mostly endianness problems, but I got a refcount underflow in kunit_remove_resource after platform_device_alloc_kunit_test on sparc64 as well), but otherwise it's working on most of the things I've tried. I'll play around with it some more next week and dig into the code in more detail, but I've not seen anything I dislike about the overall design so far. Thanks! -- David > Stephen Boyd (11): > of: Load KUnit DTB from of_core_init() > of: Add test managed wrappers for of_overlay_apply()/of_node_put() > dt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends > dt-bindings: test: Add KUnit empty node binding > of: Add a KUnit test for overlays and test managed APIs > platform: Add test managed platform_device/driver APIs > dt-bindings: kunit: Add fixed rate clk consumer test > clk: Add test managed clk provider/consumer APIs > clk: Add KUnit tests for clk fixed rate basic type > dt-bindings: clk: Add KUnit clk_parent_data test > clk: Add KUnit tests for clks registered with struct clk_parent_data > > .../clock/test,clk-kunit-parent-data.yaml | 47 ++ > .../kunit/test,clk-kunit-fixed-rate.yaml | 35 ++ > .../bindings/test/test,kunit-empty.yaml | 30 ++ > .../devicetree/bindings/vendor-prefixes.yaml | 2 + > drivers/base/test/Makefile | 3 + > drivers/base/test/platform_kunit-test.c | 108 +++++ > drivers/base/test/platform_kunit.c | 186 +++++++ > drivers/clk/.kunitconfig | 3 + > drivers/clk/Kconfig | 7 + > drivers/clk/Makefile | 9 +- > drivers/clk/clk-fixed-rate_test.c | 299 ++++++++++++ > drivers/clk/clk-fixed-rate_test.h | 8 + > drivers/clk/clk_kunit.c | 219 +++++++++ > drivers/clk/clk_parent_data_test.h | 10 + > drivers/clk/clk_test.c | 459 +++++++++++++++++- > drivers/clk/kunit_clk_fixed_rate_test.dtso | 19 + > drivers/clk/kunit_clk_parent_data_test.dtso | 28 ++ > drivers/of/.kunitconfig | 5 + > drivers/of/Kconfig | 23 + > drivers/of/Makefile | 7 + > drivers/of/base.c | 182 +++++++ > drivers/of/kunit.dtso | 10 + > drivers/of/kunit_overlay_test.dtso | 9 + > drivers/of/of_kunit.c | 123 +++++ > drivers/of/of_private.h | 6 + > drivers/of/of_test.c | 43 ++ > drivers/of/overlay_test.c | 107 ++++ > drivers/of/unittest.c | 101 +--- > include/kunit/clk.h | 28 ++ > include/kunit/of.h | 90 ++++ > include/kunit/platform_device.h | 15 + > 31 files changed, 2119 insertions(+), 102 deletions(-) > create mode 100644 Documentation/devicetree/bindings/clock/test,clk-kunit-parent-data.yaml > create mode 100644 Documentation/devicetree/bindings/kunit/test,clk-kunit-fixed-rate.yaml > create mode 100644 Documentation/devicetree/bindings/test/test,kunit-empty.yaml > create mode 100644 drivers/base/test/platform_kunit-test.c > create mode 100644 drivers/base/test/platform_kunit.c > create mode 100644 drivers/clk/clk-fixed-rate_test.c > create mode 100644 drivers/clk/clk-fixed-rate_test.h > create mode 100644 drivers/clk/clk_kunit.c > create mode 100644 drivers/clk/clk_parent_data_test.h > create mode 100644 drivers/clk/kunit_clk_fixed_rate_test.dtso > create mode 100644 drivers/clk/kunit_clk_parent_data_test.dtso > create mode 100644 drivers/of/.kunitconfig > create mode 100644 drivers/of/kunit.dtso > create mode 100644 drivers/of/kunit_overlay_test.dtso > create mode 100644 drivers/of/of_kunit.c > create mode 100644 drivers/of/of_test.c > create mode 100644 drivers/of/overlay_test.c > create mode 100644 include/kunit/clk.h > create mode 100644 include/kunit/of.h > create mode 100644 include/kunit/platform_device.h > > > base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 > -- > https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ > https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git >
Hi, On Wed, Mar 15, 2023 at 11:37:17AM -0700, Stephen Boyd wrote: > This patch series adds unit tests for the clk fixed rate basic type and > the clk registration functions that use struct clk_parent_data. To get > there, we add support for loading device tree overlays onto the live DTB > along with probing platform drivers to bind to device nodes in the > overlays. With this series, we're able to exercise some of the code in > the common clk framework that uses devicetree lookups to find parents > and the fixed rate clk code that scans device tree directly and creates > clks. Please review. > > I Cced everyone to all the patches so they get the full context. I'm > hoping I can take the whole pile through the clk tree as they almost all > depend on each other. > > Changes from v1 (https://lore.kernel.org/r/20230302013822.1808711-1-sboyd@kernel.org): > * Don't depend on UML, use unittest data approach to attach nodes > * Introduce overlay loading API for KUnit > * Move platform_device KUnit code to drivers/base/test > * Use #define macros for constants shared between unit tests and > overlays > * Settle on "test" as a vendor prefix > * Make KUnit wrappers have "_kunit" postfix Maybe I'm overthinking this, but wouldn't it make more sense to have a kunit *prefix* to those functions? Any other function in the kernel taking a kunit test pointer as a parameter starts with kunit (like kunit_kzalloc), so it would make more sense to me that kunit-related clk functions follow the same pattern. Maxime