diff options
author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2016-04-13 17:08:49 -0700 |
---|---|---|
committer | Jeevan Shriram <jshriram@codeaurora.org> | 2016-05-03 15:51:43 -0700 |
commit | c28b11f041412e6e18a8bd26c1e809ac2cdb92d7 (patch) | |
tree | 0fac352b60d96e6c390ade3ae4da8fd7d3b8dc1a /drivers/iommu/iommu-debug.c | |
parent | 7c01b51556bbfa38cd16acec6ccd9e2fd86db9dc (diff) |
iommu/iommu-debug: Add dummy driver for standalone testing
The IOMMU test framework relies on the `iommus' property, and we
currently rely on these methods for making that happen:
(1) Clients enabling their DT nodes.
(2) We put an `iommus' property in our IOMMU DT nodes themselves.
The problem with (1) is that clients aren't always ready during early
chip validation. The problem with (2) is that it results in us
recursively mapping into the SMMU when we try to do cache maintenance on
our page table memory.
Fix these problems by introducing a dummy driver with associated device
tree bindings that will do absolutely nothing other than wait for the
SMMU driver and IOMMU test framework to slurp it up.
CRs-Fixed: 1003233
Change-Id: I6a5802aff5bab99d29c6ed9d953a203cbd8015bb
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'drivers/iommu/iommu-debug.c')
-rw-r--r-- | drivers/iommu/iommu-debug.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/iommu/iommu-debug.c b/drivers/iommu/iommu-debug.c index dece6cbb9441..6772868d1c9b 100644 --- a/drivers/iommu/iommu-debug.c +++ b/drivers/iommu/iommu-debug.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1143,6 +1143,30 @@ static inline int iommu_debug_init_tests(void) { return 0; } static inline void iommu_debug_destroy_tests(void) { } #endif +/* + * This isn't really a "driver", we just need something in the device tree + * so that our tests can run without any client drivers, and our tests rely + * on parsing the device tree for nodes with the `iommus' property. + */ +static int iommu_debug_pass(struct platform_device *pdev) +{ + return 0; +} + +static const struct of_device_id iommu_debug_of_match[] = { + { .compatible = "iommu-debug-test" }, + { }, +}; + +static struct platform_driver iommu_debug_driver = { + .probe = iommu_debug_pass, + .remove = iommu_debug_pass, + .driver = { + .name = "iommu-debug", + .of_match_table = iommu_debug_of_match, + }, +}; + static int iommu_debug_init(void) { if (iommu_debug_init_tracking()) @@ -1151,11 +1175,12 @@ static int iommu_debug_init(void) if (iommu_debug_init_tests()) return -ENODEV; - return 0; + return platform_driver_register(&iommu_debug_driver); } static void iommu_debug_exit(void) { + platform_driver_unregister(&iommu_debug_driver); iommu_debug_destroy_tracking(); iommu_debug_destroy_tests(); } |