<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/of/unittest-data, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/of/unittest-data?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/of/unittest-data?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-05-03T16:53:15Z</updated>
<entry>
<title>of: overlay: unittest: add tests for overlay notifiers</title>
<updated>2022-05-03T16:53:15Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2022-05-02T18:17:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=992b0dc5c38a4e79dca17577960c5201275b83f1'/>
<id>urn:sha1:992b0dc5c38a4e79dca17577960c5201275b83f1</id>
<content type='text'>
Add tests for overlay apply and remove notifiers.  Trigger errors
for each of the notifier actions.

These tests will reveal a memory leak problem when a notifier returns
an error for action OF_OVERLAY_POST_APPLY.  The pr_err() message is:

   OF: ERROR: memory leak, expected refcount 1 instead of 3,
   of_node_get()/of_node_put() unbalanced - destroy cset entry: attach
   overlay node /testcase-data/overlay-node/test-bus/test-unittest17

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://lore.kernel.org/r/20220502181742.1402826-3-frowand.list@gmail.com
</content>
</entry>
<entry>
<title>of: unittest: document intentional interrupt-map provider build warning</title>
<updated>2021-11-02T01:33:56Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2021-10-30T01:10:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=9526565591b8db3d363be21a03b66b20575039a2'/>
<id>urn:sha1:9526565591b8db3d363be21a03b66b20575039a2</id>
<content type='text'>
A recently implemented dtc compiler warning reports a dts problem
via a build warning:

   drivers/of/unittest-data/tests-interrupts.dtsi:32.26-35.6: Warning (interrupt_map): /testcase-data/interrupts/intmap1: Missing '#address-cells' in interrupt-map provider

The warning will be addressed by a separate patch by suppressing the
warning for .dts files that include this .dtsi.  This patch documents
why the warning is due to a deliberately incorrect .dtsi file so that
no one will fix the .dtsi file to prevent the build warning.

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Link: https://lore.kernel.org/r/20211030011039.2106946-1-frowand.list@gmail.com
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of/unittest: Disable new dtc node_name_vs_property_name and interrupt_map warnings</title>
<updated>2021-11-02T01:33:56Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2021-10-26T22:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b68d0924ad8391d637f55bad0f987f8696a2d126'/>
<id>urn:sha1:b68d0924ad8391d637f55bad0f987f8696a2d126</id>
<content type='text'>
The unittest dtbs have various intentional errors which cause warnings.
With the latest dtc sync to v1.6.1-19-g0a3a9d3449c8, we need to disable
some new checks: node_name_vs_property_name and interrupt_map warnings.
These warnings are also generated for static_base_1.dtb, so add
DTC_FLAGS for it.

Note that the interrupt_map warnings only appear once interrupt_provider
warning is re-enabled globally.

drivers/of/unittest-data/tests-interrupts.dtsi:32.26-35.6: Warning (interrupt_map): /testcase-data/interrupts/intmap1: Missing '#address-cells' in interrupt-map provider

Fixes: c12632bfb611 ("scripts/dtc: Update to upstream version v1.6.1-19-g0a3a9d3449c8")
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reviewed-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Tested-by: Frank Rowand &lt;frowand.list@gmail.com&gt;
Link: https://lore.kernel.org/r/20211028130423.4025578-1-robh@kernel.org/
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: Statically apply overlays using fdtoverlay</title>
<updated>2021-03-23T21:27:51Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-03-10T05:35:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3b2dccc6747f8466a28ef95e54e6acfdcf5a5eb9'/>
<id>urn:sha1:3b2dccc6747f8466a28ef95e54e6acfdcf5a5eb9</id>
<content type='text'>
Now that fdtoverlay is part of the kernel build, start using it to test
the unitest overlays we have by applying them statically. Create two new
base files static_base_1.dts and static_base_2.dts which includes other
.dtsi files.

Some unittest overlays deliberately contain errors that unittest checks
for. These overlays will cause fdtoverlay to fail, and are thus not
included for static builds.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Tested-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://lore.kernel.org/r/da6b4e6429aae2e7832a8be2ba2da473d449895b.1615354376.git.viresh.kumar@linaro.org
</content>
</entry>
<entry>
<title>of: unittest: Create overlay_common.dtsi and testcases_common.dtsi</title>
<updated>2021-03-23T21:27:51Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-03-10T05:35:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d92e2443221018a09535666ada3975d888b8ccfd'/>
<id>urn:sha1:d92e2443221018a09535666ada3975d888b8ccfd</id>
<content type='text'>
In order to build-test the same unit-test files using fdtoverlay tool,
move the device nodes from the existing overlay_base.dts and
testcases_common.dts files to .dtsi counterparts. The .dts files now
include the new .dtsi files, resulting in exactly the same behavior as
earlier.

The .dtsi files can now be reused for compile time tests using
fdtoverlay (will be done by a later commit).

This is required because the base files passed to fdtoverlay tool
shouldn't be overlays themselves (i.e. shouldn't have the /plugin/;
tag).

Note that this commit also moves "testcase-device2" node to
testcases.dts from tests-interrupts.dtsi, as this node has a deliberate
error in it and is only relevant for runtime testing done with
unittest.c.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Tested-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
Link: https://lore.kernel.org/r/c3354a042ba34a03fd563061cbaa7fc96cb2d71a.1615354376.git.viresh.kumar@linaro.org
</content>
</entry>
<entry>
<title>of: unittest: Use bigger address cells to catch parser regressions</title>
<updated>2020-08-03T22:24:49Z</updated>
<author>
<name>Nicolas Saenz Julienne</name>
<email>nsaenzjulienne@suse.de</email>
</author>
<published>2020-08-03T14:25:47Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=bda2127827e9dd2781ae095cda0b8e5bf685c458'/>
<id>urn:sha1:bda2127827e9dd2781ae095cda0b8e5bf685c458</id>
<content type='text'>
Getting address and size cells for dma-ranges/ranges parsing is tricky
and shouldn't rely on the node's count_cells() method. The function
starts looking for cells on the parent node, as its supposed to work
with device nodes, which doesn't work when input with bus nodes, as
generally done when parsing ranges.

Add test to catch regressions on that specific quirk as developers will
be tempted to edit it out in favor of the default method.

Signed-off-by: Nicolas Saenz Julienne &lt;nsaenzjulienne@suse.de&gt;
Link: https://lore.kernel.org/r/9200970a917a9cabdc5b17483b5a8725111eb9d0.camel@suse.de
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: kmemleak in duplicate property update</title>
<updated>2020-04-17T13:31:34Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-04-16T21:42:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=29acfb65598f91671413869e0d0a1ec4e74ac705'/>
<id>urn:sha1:29acfb65598f91671413869e0d0a1ec4e74ac705</id>
<content type='text'>
kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 5 of 5.

When overlay 'overlay_bad_add_dup_prop' is applied, the apply code
properly detects that a memory leak will occur if the overlay is removed
since the duplicate property is located in a base devicetree node and
reports via printk():

  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail
  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail

The overlay is removed when the apply code detects multiple changesets
modifying the same property.  This is reported via printk():

  OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail

As a result of this error, the overlay is removed resulting in the
expected memory leak.

Add another device node level to the overlay so that the duplicate
property is located in a node added by the overlay, thus no memory
leak will occur when the overlay is removed.

Thus users of kmemleak will not have to debug this leak in the future.

Fixes: 2fe0e8769df9 ("of: overlay: check prevents multiple fragments touching same property")
Reported-by: Erhard F. &lt;erhard_f@mailbox.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: unittest: add overlay gpio test to catch gpio hog problem</title>
<updated>2020-02-26T16:42:04Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2020-02-20T18:40:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f4056e705b2ef7f123a188f6aee23ade70e7d793'/>
<id>urn:sha1:f4056e705b2ef7f123a188f6aee23ade70e7d793</id>
<content type='text'>
Geert reports that gpio hog nodes are not properly processed when
the gpio hog node is added via an overlay reply and provides an
RFC patch to fix the problem [1].

Add a unittest that shows the problem.  Unittest will report "1 failed"
test before applying Geert's RFC patch and "0 failed" after applying
Geert's RFC patch.

[1] https://lore.kernel.org/linux-devicetree/20191230133852.5890-1-geert+renesas@glider.be/

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of/unittest: Add dma-ranges address translation tests</title>
<updated>2019-10-08T18:55:26Z</updated>
<author>
<name>Rob Herring</name>
<email>robh@kernel.org</email>
</author>
<published>2019-09-20T18:28:53Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=04db93a95aef392a98f9ffa8745da2e7c58ba75b'/>
<id>urn:sha1:04db93a95aef392a98f9ffa8745da2e7c58ba75b</id>
<content type='text'>
The functions for parsing 'dma-ranges' ranges are buggy and fail to
handle several conditions. Add new tests for of_dma_get_range() and
for_each_of_pci_range().

With this test, we get 5 new failures which are fixed in subsequent
commits:

OF: translation of DMA address(0) to CPU address failed node(/testcase-data/address-tests/device@70000000)
FAIL of_unittest_dma_ranges_one():798 of_dma_get_range failed on node /testcase-data/address-tests/device@70000000 rc=-22
OF: translation of DMA address(10000000) to CPU address failed node(/testcase-data/address-tests/bus@80000000/device@1000)
FAIL of_unittest_dma_ranges_one():798 of_dma_get_range failed on node /testcase-data/address-tests/bus@80000000/device@1000 rc=-22
OF: translation of DMA address(0) to CPU address failed node(/testcase-data/address-tests/pci@90000000)
FAIL of_unittest_dma_ranges_one():798 of_dma_get_range failed on node /testcase-data/address-tests/pci@90000000 rc=-22
FAIL of_unittest_pci_dma_ranges():851 for_each_of_pci_range wrong CPU addr (d0000000) on node /testcase-data/address-tests/pci@90000000
FAIL of_unittest_pci_dma_ranges():861 for_each_of_pci_range wrong CPU addr (ffffffffffffffff) on node /testcase-data/address-tests/pci@90000000

Cc: Robin Murphy &lt;robin.murphy@arm.com&gt;
Tested-by: Nicolas Saenz Julienne &lt;nsaenzjulienne@suse.de&gt;
Reviewed-by: Nicolas Saenz Julienne &lt;nsaenzjulienne@suse.de&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: overlay: check prevents multiple fragments touching same property</title>
<updated>2018-11-09T06:12:03Z</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2018-10-05T03:36:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2fe0e8769df9fed5098daea7db933bc414c329d7'/>
<id>urn:sha1:2fe0e8769df9fed5098daea7db933bc414c329d7</id>
<content type='text'>
Add test case of two fragments updating the same property.  After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.

Multiple overlay fragments adding, modifying, or deleting the same
property is not supported.  Add check to detect the attempt and fail
the overlay apply.

Before this patch, the first fragment error would terminate
processing.  Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).

After applying this patch, the devicetree unittest messages will
include:

   OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail

   ...

   ### dt-test ### end of unittest - 212 passed, 0 failed

The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.

Tested-by: Alan Tull &lt;atull@kernel.org&gt;
Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
</content>
</entry>
</feed>
