linux/drivers/of/unittest-data/tests-address.dtsi
Rob Herring 04db93a95a of/unittest: Add dma-ranges address translation tests
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 <robin.murphy@arm.com>
Tested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Rob Herring <robh@kernel.org>
2019-10-08 13:55:26 -05:00

49 lines
1.0 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0
/ {
#address-cells = <1>;
#size-cells = <1>;
testcase-data {
#address-cells = <1>;
#size-cells = <1>;
ranges;
address-tests {
#address-cells = <1>;
#size-cells = <1>;
/* ranges here is to make sure we don't use it for
* dma-ranges translation */
ranges = <0x70000000 0x70000000 0x40000000>,
<0x00000000 0xd0000000 0x20000000>;
dma-ranges = <0x0 0x20000000 0x40000000>;
device@70000000 {
reg = <0x70000000 0x1000>;
};
bus@80000000 {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x80000000 0x100000>;
dma-ranges = <0x10000000 0x0 0x40000000>;
device@1000 {
reg = <0x1000 0x1000>;
};
};
pci@90000000 {
device_type = "pci";
#address-cells = <3>;
#size-cells = <2>;
reg = <0x90000000 0x1000>;
ranges = <0x42000000 0x0 0x40000000 0x40000000 0x0 0x10000000>;
dma-ranges = <0x42000000 0x0 0x80000000 0x00000000 0x0 0x10000000>,
<0x42000000 0x0 0xc0000000 0x20000000 0x0 0x10000000>;
};
};
};
};