[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202005181412.frC4juFy%lkp@intel.com>
Date: Mon, 18 May 2020 14:16:19 +0800
From: kbuild test robot <lkp@...el.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Joerg Roedel <jroedel@...e.de>
Subject: drivers/iommu/exynos-iommu.c:673:54: error: 'struct dev_archdata'
has no member named 'iommu'
Hi Krzysztof,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce
commit: e93a1695d7fb551376b1c1220a267d032b6ad159 iommu: Enable compile testing for some of drivers
date: 3 months ago
config: ia64-randconfig-s001-20200518 (attached as .config)
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
git checkout e93a1695d7fb551376b1c1220a267d032b6ad159
# save the attached .config to linux build tree
make C=1 ARCH=ia64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@...el.com>
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/iommu/exynos-iommu.c: In function 'exynos_sysmmu_suspend':
>> drivers/iommu/exynos-iommu.c:673:54: error: 'struct dev_archdata' has no member named 'iommu'
673 | struct exynos_iommu_owner *owner = master->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c: In function 'exynos_sysmmu_resume':
drivers/iommu/exynos-iommu.c:691:54: error: 'struct dev_archdata' has no member named 'iommu'
691 | struct exynos_iommu_owner *owner = master->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c: In function 'exynos_iommu_detach_device':
drivers/iommu/exynos-iommu.c:840:50: error: 'struct dev_archdata' has no member named 'iommu'
840 | struct exynos_iommu_owner *owner = dev->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c:176:40: error: 'struct dev_archdata' has no member named 'iommu'
176 | #define has_sysmmu(dev) (dev->archdata.iommu != NULL)
| ^
>> drivers/iommu/exynos-iommu.c:846:7: note: in expansion of macro 'has_sysmmu'
846 | if (!has_sysmmu(dev) || owner->domain != iommu_domain)
| ^~~~~~~~~~
drivers/iommu/exynos-iommu.c: In function 'exynos_iommu_attach_device':
drivers/iommu/exynos-iommu.c:878:50: error: 'struct dev_archdata' has no member named 'iommu'
878 | struct exynos_iommu_owner *owner = dev->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c:176:40: error: 'struct dev_archdata' has no member named 'iommu'
176 | #define has_sysmmu(dev) (dev->archdata.iommu != NULL)
| ^
drivers/iommu/exynos-iommu.c:884:7: note: in expansion of macro 'has_sysmmu'
884 | if (!has_sysmmu(dev))
| ^~~~~~~~~~
drivers/iommu/exynos-iommu.c: In function 'exynos_iommu_add_device':
drivers/iommu/exynos-iommu.c:1240:50: error: 'struct dev_archdata' has no member named 'iommu'
1240 | struct exynos_iommu_owner *owner = dev->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c:176:40: error: 'struct dev_archdata' has no member named 'iommu'
176 | #define has_sysmmu(dev) (dev->archdata.iommu != NULL)
| ^
drivers/iommu/exynos-iommu.c:1244:7: note: in expansion of macro 'has_sysmmu'
1244 | if (!has_sysmmu(dev))
| ^~~~~~~~~~
drivers/iommu/exynos-iommu.c: In function 'exynos_iommu_remove_device':
drivers/iommu/exynos-iommu.c:1269:50: error: 'struct dev_archdata' has no member named 'iommu'
1269 | struct exynos_iommu_owner *owner = dev->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c:176:40: error: 'struct dev_archdata' has no member named 'iommu'
176 | #define has_sysmmu(dev) (dev->archdata.iommu != NULL)
| ^
drivers/iommu/exynos-iommu.c:1272:7: note: in expansion of macro 'has_sysmmu'
1272 | if (!has_sysmmu(dev))
| ^~~~~~~~~~
drivers/iommu/exynos-iommu.c: In function 'exynos_iommu_of_xlate':
drivers/iommu/exynos-iommu.c:1294:50: error: 'struct dev_archdata' has no member named 'iommu'
1294 | struct exynos_iommu_owner *owner = dev->archdata.iommu;
| ^
drivers/iommu/exynos-iommu.c:1312:16: error: 'struct dev_archdata' has no member named 'iommu'
1312 | dev->archdata.iommu = owner;
| ^
sparse warnings: (new ones prefixed by >>)
drivers/iommu/exynos-iommu.c:673:68: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:691:68: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:840:57: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:846:14: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:878:57: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:884:14: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1240:57: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1244:14: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1269:57: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1272:14: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1294:57: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
drivers/iommu/exynos-iommu.c:1312:30: sparse: sparse: using member 'iommu' in incomplete struct dev_archdata
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restrunsigned int [usertype] value @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restrunsigned int [usertype] @@
>> drivers/iommu/exynos-iommu.c:728:14: sparse: expected unsigned int [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: got restricted __le32 [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restrunsigned int [usertype] @@
>> drivers/iommu/exynos-iommu.c:728:14: sparse: expected unsigned int [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: got restricted __le32 [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restrunsigned int [usertype] @@
>> drivers/iommu/exynos-iommu.c:728:14: sparse: expected unsigned int [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: got restricted __le32 [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restrunsigned int [usertype] @@
>> drivers/iommu/exynos-iommu.c:728:14: sparse: expected unsigned int [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: got restricted __le32 [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restrunsigned int [usertype] @@
>> drivers/iommu/exynos-iommu.c:728:14: sparse: expected unsigned int [usertype]
>> drivers/iommu/exynos-iommu.c:728:14: sparse: got restricted __le32 [usertype]
vim +673 drivers/iommu/exynos-iommu.c
2a96536e77b43c KyongHo Cho 2012-05-12 666
9b265536c27116 Marek Szyprowski 2016-11-14 667 static int __maybe_unused exynos_sysmmu_suspend(struct device *dev)
622015e407b082 Marek Szyprowski 2015-05-19 668 {
622015e407b082 Marek Szyprowski 2015-05-19 669 struct sysmmu_drvdata *data = dev_get_drvdata(dev);
47a574fffca102 Marek Szyprowski 2016-11-14 670 struct device *master = data->master;
622015e407b082 Marek Szyprowski 2015-05-19 671
47a574fffca102 Marek Szyprowski 2016-11-14 672 if (master) {
9b265536c27116 Marek Szyprowski 2016-11-14 @673 struct exynos_iommu_owner *owner = master->archdata.iommu;
9b265536c27116 Marek Szyprowski 2016-11-14 674
9b265536c27116 Marek Szyprowski 2016-11-14 675 mutex_lock(&owner->rpm_lock);
92798b4566b1ad Marek Szyprowski 2016-11-14 676 if (data->domain) {
92798b4566b1ad Marek Szyprowski 2016-11-14 677 dev_dbg(data->sysmmu, "saving state\n");
92798b4566b1ad Marek Szyprowski 2016-11-14 678 __sysmmu_disable(data);
92798b4566b1ad Marek Szyprowski 2016-11-14 679 }
9b265536c27116 Marek Szyprowski 2016-11-14 680 mutex_unlock(&owner->rpm_lock);
622015e407b082 Marek Szyprowski 2015-05-19 681 }
622015e407b082 Marek Szyprowski 2015-05-19 682 return 0;
622015e407b082 Marek Szyprowski 2015-05-19 683 }
622015e407b082 Marek Szyprowski 2015-05-19 684
9b265536c27116 Marek Szyprowski 2016-11-14 685 static int __maybe_unused exynos_sysmmu_resume(struct device *dev)
622015e407b082 Marek Szyprowski 2015-05-19 686 {
622015e407b082 Marek Szyprowski 2015-05-19 687 struct sysmmu_drvdata *data = dev_get_drvdata(dev);
47a574fffca102 Marek Szyprowski 2016-11-14 688 struct device *master = data->master;
622015e407b082 Marek Szyprowski 2015-05-19 689
47a574fffca102 Marek Szyprowski 2016-11-14 690 if (master) {
9b265536c27116 Marek Szyprowski 2016-11-14 691 struct exynos_iommu_owner *owner = master->archdata.iommu;
9b265536c27116 Marek Szyprowski 2016-11-14 692
9b265536c27116 Marek Szyprowski 2016-11-14 693 mutex_lock(&owner->rpm_lock);
92798b4566b1ad Marek Szyprowski 2016-11-14 694 if (data->domain) {
92798b4566b1ad Marek Szyprowski 2016-11-14 695 dev_dbg(data->sysmmu, "restoring state\n");
47a574fffca102 Marek Szyprowski 2016-11-14 696 __sysmmu_enable(data);
622015e407b082 Marek Szyprowski 2015-05-19 697 }
9b265536c27116 Marek Szyprowski 2016-11-14 698 mutex_unlock(&owner->rpm_lock);
92798b4566b1ad Marek Szyprowski 2016-11-14 699 }
622015e407b082 Marek Szyprowski 2015-05-19 700 return 0;
622015e407b082 Marek Szyprowski 2015-05-19 701 }
622015e407b082 Marek Szyprowski 2015-05-19 702
622015e407b082 Marek Szyprowski 2015-05-19 703 static const struct dev_pm_ops sysmmu_pm_ops = {
9b265536c27116 Marek Szyprowski 2016-11-14 704 SET_RUNTIME_PM_OPS(exynos_sysmmu_suspend, exynos_sysmmu_resume, NULL)
2f5f44f205cc95 Marek Szyprowski 2016-11-14 705 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
9b265536c27116 Marek Szyprowski 2016-11-14 706 pm_runtime_force_resume)
622015e407b082 Marek Szyprowski 2015-05-19 707 };
622015e407b082 Marek Szyprowski 2015-05-19 708
9d25e3cc83d731 Marek Szyprowski 2017-10-09 709 static const struct of_device_id sysmmu_of_match[] = {
6b21a5db36427d Cho KyongHo 2014-05-12 710 { .compatible = "samsung,exynos-sysmmu", },
6b21a5db36427d Cho KyongHo 2014-05-12 711 { },
6b21a5db36427d Cho KyongHo 2014-05-12 712 };
6b21a5db36427d Cho KyongHo 2014-05-12 713
6b21a5db36427d Cho KyongHo 2014-05-12 714 static struct platform_driver exynos_sysmmu_driver __refdata = {
2a96536e77b43c KyongHo Cho 2012-05-12 715 .probe = exynos_sysmmu_probe,
2a96536e77b43c KyongHo Cho 2012-05-12 716 .driver = {
2a96536e77b43c KyongHo Cho 2012-05-12 717 .name = "exynos-sysmmu",
6b21a5db36427d Cho KyongHo 2014-05-12 718 .of_match_table = sysmmu_of_match,
622015e407b082 Marek Szyprowski 2015-05-19 719 .pm = &sysmmu_pm_ops,
b54b874fbaf5e0 Marek Szyprowski 2016-05-20 720 .suppress_bind_attrs = true,
2a96536e77b43c KyongHo Cho 2012-05-12 721 }
2a96536e77b43c KyongHo Cho 2012-05-12 722 };
2a96536e77b43c KyongHo Cho 2012-05-12 723
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 724 static inline void update_pte(sysmmu_pte_t *ent, sysmmu_pte_t val)
2a96536e77b43c KyongHo Cho 2012-05-12 725 {
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 726 dma_sync_single_for_cpu(dma_dev, virt_to_phys(ent), sizeof(*ent),
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 727 DMA_TO_DEVICE);
6ae5343c26f9cb Ben Dooks 2016-06-08 @728 *ent = cpu_to_le32(val);
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 729 dma_sync_single_for_device(dma_dev, virt_to_phys(ent), sizeof(*ent),
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 730 DMA_TO_DEVICE);
2a96536e77b43c KyongHo Cho 2012-05-12 731 }
2a96536e77b43c KyongHo Cho 2012-05-12 732
e1fd1eaa3323b3 Joerg Roedel 2015-03-26 733 static struct iommu_domain *exynos_iommu_domain_alloc(unsigned type)
2a96536e77b43c KyongHo Cho 2012-05-12 734 {
bfa004893c55ea Marek Szyprowski 2015-05-19 735 struct exynos_iommu_domain *domain;
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 736 dma_addr_t handle;
66a7ed84b345d6 Cho KyongHo 2014-05-12 737 int i;
2a96536e77b43c KyongHo Cho 2012-05-12 738
740a01eee9ada9 Marek Szyprowski 2016-02-18 739 /* Check if correct PTE offsets are initialized */
740a01eee9ada9 Marek Szyprowski 2016-02-18 740 BUG_ON(PG_ENT_SHIFT < 0 || !dma_dev);
e1fd1eaa3323b3 Joerg Roedel 2015-03-26 741
bfa004893c55ea Marek Szyprowski 2015-05-19 742 domain = kzalloc(sizeof(*domain), GFP_KERNEL);
bfa004893c55ea Marek Szyprowski 2015-05-19 743 if (!domain)
e1fd1eaa3323b3 Joerg Roedel 2015-03-26 744 return NULL;
2a96536e77b43c KyongHo Cho 2012-05-12 745
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 746 if (type == IOMMU_DOMAIN_DMA) {
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 747 if (iommu_get_dma_cookie(&domain->domain) != 0)
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 748 goto err_pgtable;
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 749 } else if (type != IOMMU_DOMAIN_UNMANAGED) {
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 750 goto err_pgtable;
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 751 }
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 752
bfa004893c55ea Marek Szyprowski 2015-05-19 753 domain->pgtable = (sysmmu_pte_t *)__get_free_pages(GFP_KERNEL, 2);
bfa004893c55ea Marek Szyprowski 2015-05-19 754 if (!domain->pgtable)
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 755 goto err_dma_cookie;
2a96536e77b43c KyongHo Cho 2012-05-12 756
bfa004893c55ea Marek Szyprowski 2015-05-19 757 domain->lv2entcnt = (short *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
bfa004893c55ea Marek Szyprowski 2015-05-19 758 if (!domain->lv2entcnt)
2a96536e77b43c KyongHo Cho 2012-05-12 759 goto err_counter;
2a96536e77b43c KyongHo Cho 2012-05-12 760
f171abab8f1a75 Sachin Kamat 2014-08-04 761 /* Workaround for System MMU v3.3 to prevent caching 1MiB mapping */
e75276638c1423 Marek Szyprowski 2017-03-24 762 for (i = 0; i < NUM_LV1ENTRIES; i++)
e75276638c1423 Marek Szyprowski 2017-03-24 763 domain->pgtable[i] = ZERO_LV2LINK;
66a7ed84b345d6 Cho KyongHo 2014-05-12 764
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 765 handle = dma_map_single(dma_dev, domain->pgtable, LV1TABLE_SIZE,
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 766 DMA_TO_DEVICE);
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 767 /* For mapping page table entries we rely on dma == phys */
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 768 BUG_ON(handle != virt_to_phys(domain->pgtable));
0d6d3da46ac594 Marek Szyprowski 2017-01-09 769 if (dma_mapping_error(dma_dev, handle))
0d6d3da46ac594 Marek Szyprowski 2017-01-09 770 goto err_lv2ent;
2a96536e77b43c KyongHo Cho 2012-05-12 771
bfa004893c55ea Marek Szyprowski 2015-05-19 772 spin_lock_init(&domain->lock);
bfa004893c55ea Marek Szyprowski 2015-05-19 773 spin_lock_init(&domain->pgtablelock);
bfa004893c55ea Marek Szyprowski 2015-05-19 774 INIT_LIST_HEAD(&domain->clients);
2a96536e77b43c KyongHo Cho 2012-05-12 775
bfa004893c55ea Marek Szyprowski 2015-05-19 776 domain->domain.geometry.aperture_start = 0;
bfa004893c55ea Marek Szyprowski 2015-05-19 777 domain->domain.geometry.aperture_end = ~0UL;
bfa004893c55ea Marek Szyprowski 2015-05-19 778 domain->domain.geometry.force_aperture = true;
3177bb76a8c510 Joerg Roedel 2012-07-11 779
bfa004893c55ea Marek Szyprowski 2015-05-19 780 return &domain->domain;
2a96536e77b43c KyongHo Cho 2012-05-12 781
0d6d3da46ac594 Marek Szyprowski 2017-01-09 782 err_lv2ent:
0d6d3da46ac594 Marek Szyprowski 2017-01-09 783 free_pages((unsigned long)domain->lv2entcnt, 1);
2a96536e77b43c KyongHo Cho 2012-05-12 784 err_counter:
bfa004893c55ea Marek Szyprowski 2015-05-19 785 free_pages((unsigned long)domain->pgtable, 2);
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 786 err_dma_cookie:
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 787 if (type == IOMMU_DOMAIN_DMA)
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 788 iommu_put_dma_cookie(&domain->domain);
2a96536e77b43c KyongHo Cho 2012-05-12 789 err_pgtable:
bfa004893c55ea Marek Szyprowski 2015-05-19 790 kfree(domain);
e1fd1eaa3323b3 Joerg Roedel 2015-03-26 791 return NULL;
2a96536e77b43c KyongHo Cho 2012-05-12 792 }
2a96536e77b43c KyongHo Cho 2012-05-12 793
bfa004893c55ea Marek Szyprowski 2015-05-19 794 static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
2a96536e77b43c KyongHo Cho 2012-05-12 795 {
bfa004893c55ea Marek Szyprowski 2015-05-19 796 struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain);
469acebe4a6890 Marek Szyprowski 2015-05-19 797 struct sysmmu_drvdata *data, *next;
2a96536e77b43c KyongHo Cho 2012-05-12 798 unsigned long flags;
2a96536e77b43c KyongHo Cho 2012-05-12 799 int i;
2a96536e77b43c KyongHo Cho 2012-05-12 800
bfa004893c55ea Marek Szyprowski 2015-05-19 801 WARN_ON(!list_empty(&domain->clients));
2a96536e77b43c KyongHo Cho 2012-05-12 802
bfa004893c55ea Marek Szyprowski 2015-05-19 803 spin_lock_irqsave(&domain->lock, flags);
2a96536e77b43c KyongHo Cho 2012-05-12 804
bfa004893c55ea Marek Szyprowski 2015-05-19 805 list_for_each_entry_safe(data, next, &domain->clients, domain_node) {
e11723000f1641 Marek Szyprowski 2016-11-14 806 spin_lock(&data->lock);
b0d4c861a99d00 Marek Szyprowski 2016-11-14 807 __sysmmu_disable(data);
47a574fffca102 Marek Szyprowski 2016-11-14 808 data->pgtable = 0;
47a574fffca102 Marek Szyprowski 2016-11-14 809 data->domain = NULL;
469acebe4a6890 Marek Szyprowski 2015-05-19 810 list_del_init(&data->domain_node);
e11723000f1641 Marek Szyprowski 2016-11-14 811 spin_unlock(&data->lock);
2a96536e77b43c KyongHo Cho 2012-05-12 812 }
2a96536e77b43c KyongHo Cho 2012-05-12 813
bfa004893c55ea Marek Szyprowski 2015-05-19 814 spin_unlock_irqrestore(&domain->lock, flags);
2a96536e77b43c KyongHo Cho 2012-05-12 815
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 816 if (iommu_domain->type == IOMMU_DOMAIN_DMA)
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 817 iommu_put_dma_cookie(iommu_domain);
58c6f6a3dc97ed Marek Szyprowski 2016-02-18 818
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 819 dma_unmap_single(dma_dev, virt_to_phys(domain->pgtable), LV1TABLE_SIZE,
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 820 DMA_TO_DEVICE);
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 821
2a96536e77b43c KyongHo Cho 2012-05-12 822 for (i = 0; i < NUM_LV1ENTRIES; i++)
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 823 if (lv1ent_page(domain->pgtable + i)) {
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 824 phys_addr_t base = lv2table_base(domain->pgtable + i);
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 825
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 826 dma_unmap_single(dma_dev, base, LV2TABLE_SIZE,
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 827 DMA_TO_DEVICE);
734c3c732ca91a Cho KyongHo 2014-05-12 828 kmem_cache_free(lv2table_kmem_cache,
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 829 phys_to_virt(base));
5e3435eb7e1d8c Marek Szyprowski 2016-02-18 830 }
2a96536e77b43c KyongHo Cho 2012-05-12 831
bfa004893c55ea Marek Szyprowski 2015-05-19 832 free_pages((unsigned long)domain->pgtable, 2);
bfa004893c55ea Marek Szyprowski 2015-05-19 833 free_pages((unsigned long)domain->lv2entcnt, 1);
bfa004893c55ea Marek Szyprowski 2015-05-19 834 kfree(domain);
2a96536e77b43c KyongHo Cho 2012-05-12 835 }
2a96536e77b43c KyongHo Cho 2012-05-12 836
5fa61cbff16224 Marek Szyprowski 2016-02-18 837 static void exynos_iommu_detach_device(struct iommu_domain *iommu_domain,
5fa61cbff16224 Marek Szyprowski 2016-02-18 838 struct device *dev)
5fa61cbff16224 Marek Szyprowski 2016-02-18 839 {
5fa61cbff16224 Marek Szyprowski 2016-02-18 840 struct exynos_iommu_owner *owner = dev->archdata.iommu;
5fa61cbff16224 Marek Szyprowski 2016-02-18 841 struct exynos_iommu_domain *domain = to_exynos_domain(iommu_domain);
5fa61cbff16224 Marek Szyprowski 2016-02-18 842 phys_addr_t pagetable = virt_to_phys(domain->pgtable);
5fa61cbff16224 Marek Szyprowski 2016-02-18 843 struct sysmmu_drvdata *data, *next;
5fa61cbff16224 Marek Szyprowski 2016-02-18 844 unsigned long flags;
5fa61cbff16224 Marek Szyprowski 2016-02-18 845
5fa61cbff16224 Marek Szyprowski 2016-02-18 @846 if (!has_sysmmu(dev) || owner->domain != iommu_domain)
5fa61cbff16224 Marek Szyprowski 2016-02-18 847 return;
5fa61cbff16224 Marek Szyprowski 2016-02-18 848
9b265536c27116 Marek Szyprowski 2016-11-14 849 mutex_lock(&owner->rpm_lock);
9b265536c27116 Marek Szyprowski 2016-11-14 850
9b265536c27116 Marek Szyprowski 2016-11-14 851 list_for_each_entry(data, &owner->controllers, owner_node) {
9b265536c27116 Marek Szyprowski 2016-11-14 852 pm_runtime_get_noresume(data->sysmmu);
9b265536c27116 Marek Szyprowski 2016-11-14 853 if (pm_runtime_active(data->sysmmu))
e11723000f1641 Marek Szyprowski 2016-11-14 854 __sysmmu_disable(data);
e11723000f1641 Marek Szyprowski 2016-11-14 855 pm_runtime_put(data->sysmmu);
e11723000f1641 Marek Szyprowski 2016-11-14 856 }
e11723000f1641 Marek Szyprowski 2016-11-14 857
5fa61cbff16224 Marek Szyprowski 2016-02-18 858 spin_lock_irqsave(&domain->lock, flags);
5fa61cbff16224 Marek Szyprowski 2016-02-18 859 list_for_each_entry_safe(data, next, &domain->clients, domain_node) {
e11723000f1641 Marek Szyprowski 2016-11-14 860 spin_lock(&data->lock);
47a574fffca102 Marek Szyprowski 2016-11-14 861 data->pgtable = 0;
47a574fffca102 Marek Szyprowski 2016-11-14 862 data->domain = NULL;
5fa61cbff16224 Marek Szyprowski 2016-02-18 863 list_del_init(&data->domain_node);
e11723000f1641 Marek Szyprowski 2016-11-14 864 spin_unlock(&data->lock);
5fa61cbff16224 Marek Szyprowski 2016-02-18 865 }
e11723000f1641 Marek Szyprowski 2016-11-14 866 owner->domain = NULL;
5fa61cbff16224 Marek Szyprowski 2016-02-18 867 spin_unlock_irqrestore(&domain->lock, flags);
5fa61cbff16224 Marek Szyprowski 2016-02-18 868
9b265536c27116 Marek Szyprowski 2016-11-14 869 mutex_unlock(&owner->rpm_lock);
5fa61cbff16224 Marek Szyprowski 2016-02-18 870
b0d4c861a99d00 Marek Szyprowski 2016-11-14 871 dev_dbg(dev, "%s: Detached IOMMU with pgtable %pa\n", __func__,
b0d4c861a99d00 Marek Szyprowski 2016-11-14 872 &pagetable);
5fa61cbff16224 Marek Szyprowski 2016-02-18 873 }
5fa61cbff16224 Marek Szyprowski 2016-02-18 874
:::::: The code at line 673 was first introduced by commit
:::::: 9b265536c271163ec4acc140ca0a40a732971cbf iommu/exynos: Add runtime pm support
:::::: TO: Marek Szyprowski <m.szyprowski@...sung.com>
:::::: CC: Joerg Roedel <jroedel@...e.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (41359 bytes)
Powered by blists - more mailing lists