提交 e2732547 编写于 作者: N Nicolas Saenz Julienne 提交者: Zheng Zengkai

of: unittest: Add test for of_dma_get_max_cpu_address()

mainline inclusion
from mainline-5.11-rc1
commit 07d13a1d
category: bugfix
bugzilla: 50423
CVE: NA

---------------------------------------------

Introduce a test for of_dma_get_max_cup_address(), it uses the same DT
data as the rest of dma-ranges unit tests.
Signed-off-by: NNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: NRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20201119175400.9995-5-nsaenzjulienne@suse.deSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Reviewed-by: NKefeng  Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 750ee85e
......@@ -869,6 +869,23 @@ static void __init of_unittest_changeset(void)
#endif
}
static void __init of_unittest_dma_get_max_cpu_address(void)
{
struct device_node *np;
phys_addr_t cpu_addr;
np = of_find_node_by_path("/testcase-data/address-tests");
if (!np) {
pr_err("missing testcase data\n");
return;
}
cpu_addr = of_dma_get_max_cpu_address(np);
unittest(cpu_addr == 0x4fffffff,
"of_dma_get_max_cpu_address: wrong CPU addr %pad (expecting %x)\n",
&cpu_addr, 0x4fffffff);
}
static void __init of_unittest_dma_ranges_one(const char *path,
u64 expect_dma_addr, u64 expect_paddr)
{
......@@ -3266,6 +3283,7 @@ static int __init of_unittest(void)
of_unittest_changeset();
of_unittest_parse_interrupts();
of_unittest_parse_interrupts_extended();
of_unittest_dma_get_max_cpu_address();
of_unittest_parse_dma_ranges();
of_unittest_pci_dma_ranges();
of_unittest_match_node();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册