From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android15-6.6-2025-10 2/2] drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:795:5: warning: no previous prototype for function 'kvm_arm_smmu_suspend'
Date: Tue, 14 Apr 2026 16:27:18 +0800 [thread overview]
Message-ID: <202604141632.fpG6LXAS-lkp@intel.com> (raw)
Hi Mostafa,
First bad commit (maybe != root cause):
tree: https://android.googlesource.com/kernel/common android15-6.6-2025-10
head: 7fcc81731c664e3fa47ae7141e5508b8f42e2942
commit: 1f7c566fe2211514bf377944f1e9964255b2ba75 [2/2] ANDROID: drivers/arm-smmu-v3-kvm: Modularize driver
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20260414/202604141632.fpG6LXAS-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260414/202604141632.fpG6LXAS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604141632.fpG6LXAS-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:7:
In file included from arch/arm64/include/asm/kvm_pkvm.h:11:
In file included from include/linux/memblock.h:12:
In file included from include/linux/mm.h:2180:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:221:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
221 | int ret;
| ^
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:795:5: warning: no previous prototype for function 'kvm_arm_smmu_suspend' [-Wmissing-prototypes]
795 | int kvm_arm_smmu_suspend(struct device *dev)
| ^
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:795:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
795 | int kvm_arm_smmu_suspend(struct device *dev)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:805:5: warning: no previous prototype for function 'kvm_arm_smmu_resume' [-Wmissing-prototypes]
805 | int kvm_arm_smmu_resume(struct device *dev)
| ^
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:805:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
805 | int kvm_arm_smmu_resume(struct device *dev)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:863:5: warning: no previous prototype for function 'smmu_put_device' [-Wmissing-prototypes]
863 | int smmu_put_device(struct device *dev, void *data)
| ^
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:863:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
863 | int smmu_put_device(struct device *dev, void *data)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:929:15: warning: no previous prototype for function 'kvm_arm_smmu_v3_id' [-Wmissing-prototypes]
929 | pkvm_handle_t kvm_arm_smmu_v3_id(struct device *dev)
| ^
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c:929:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
929 | pkvm_handle_t kvm_arm_smmu_v3_id(struct device *dev)
| ^
| static
10 warnings generated.
--
In file included from drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:7:
In file included from drivers/iommu/arm/arm-smmu-v3/pkvm/arm_smmu_v3.h:5:
In file included from arch/arm64/include/asm/kvm_asm.h:52:
In file included from include/linux/mm.h:2180:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:596:5: warning: no previous prototype for function 'smmu_domain_finalise' [-Wmissing-prototypes]
596 | int smmu_domain_finalise(struct kvm_hyp_iommu_domain *domain)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:596:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
596 | int smmu_domain_finalise(struct kvm_hyp_iommu_domain *domain)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:712:5: warning: no previous prototype for function 'smmu_alloc_domain' [-Wmissing-prototypes]
712 | int smmu_alloc_domain(struct kvm_hyp_iommu_domain *domain)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:712:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
712 | int smmu_alloc_domain(struct kvm_hyp_iommu_domain *domain)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:727:6: warning: no previous prototype for function 'smmu_free_domain' [-Wmissing-prototypes]
727 | void smmu_free_domain(struct kvm_hyp_iommu_domain *domain)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:727:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
727 | void smmu_free_domain(struct kvm_hyp_iommu_domain *domain)
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:739:6: warning: no previous prototype for function 'smmu_dabt_device' [-Wmissing-prototypes]
739 | bool smmu_dabt_device(struct hyp_arm_smmu_v3_device *smmu,
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:739:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
739 | bool smmu_dabt_device(struct hyp_arm_smmu_v3_device *smmu,
| ^
| static
>> drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:782:6: warning: no previous prototype for function 'smmu_dabt_handler' [-Wmissing-prototypes]
782 | bool smmu_dabt_handler(struct kvm_cpu_context *host_ctxt, u64 esr, u64 addr)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:782:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
782 | bool smmu_dabt_handler(struct kvm_cpu_context *host_ctxt, u64 esr, u64 addr)
| ^
| static
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:794:5: warning: no previous prototype for function 'smmu_suspend' [-Wmissing-prototypes]
794 | int smmu_suspend(struct kvm_hyp_iommu *iommu)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:794:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
794 | int smmu_suspend(struct kvm_hyp_iommu *iommu)
| ^
| static
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:807:5: warning: no previous prototype for function 'smmu_resume' [-Wmissing-prototypes]
807 | int smmu_resume(struct kvm_hyp_iommu *iommu)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:807:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
807 | int smmu_resume(struct kvm_hyp_iommu *iommu)
| ^
| static
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:820:5: warning: no previous prototype for function 'smmu_init_hyp_module' [-Wmissing-prototypes]
820 | int smmu_init_hyp_module(const struct pkvm_module_ops *ops)
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/arm-smmu-v3.c:820:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
820 | int smmu_init_hyp_module(const struct pkvm_module_ops *ops)
| ^
| static
13 warnings generated.
--
In file included from drivers/iommu/arm/arm-smmu-v3/pkvm/io-pgtable-arm.c:5:
In file included from drivers/iommu/arm/arm-smmu-v3/pkvm/arm_smmu_v3.h:5:
In file included from arch/arm64/include/asm/kvm_asm.h:52:
In file included from include/linux/mm.h:2180:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iommu/arm/arm-smmu-v3/pkvm/io-pgtable-arm.c:54:5: warning: no previous prototype for function 'kvm_arm_io_pgtable_init' [-Wmissing-prototypes]
54 | int kvm_arm_io_pgtable_init(struct io_pgtable_cfg *cfg,
| ^
drivers/iommu/arm/arm-smmu-v3/pkvm/io-pgtable-arm.c:54:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
54 | int kvm_arm_io_pgtable_init(struct io_pgtable_cfg *cfg,
| ^
| static
6 warnings generated.
vim +/kvm_arm_smmu_suspend +795 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-kvm.c
d4519820851b1db Jean-Philippe Brucker 2022-02-09 794
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 @795 int kvm_arm_smmu_suspend(struct device *dev)
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 796 {
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 797 struct arm_smmu_device *smmu = dev_get_drvdata(dev);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 798 struct host_arm_smmu_device *host_smmu = smmu_to_host(smmu);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 799
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 800 if (host_smmu->hvc_pd)
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 801 return pkvm_iommu_suspend(dev);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 802 return 0;
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 803 }
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 804
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 @805 int kvm_arm_smmu_resume(struct device *dev)
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 806 {
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 807 struct arm_smmu_device *smmu = dev_get_drvdata(dev);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 808 struct host_arm_smmu_device *host_smmu = smmu_to_host(smmu);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 809
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 810 if (host_smmu->hvc_pd)
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 811 return pkvm_iommu_resume(dev);
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 812 return 0;
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 813 }
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 814
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 815 static const struct dev_pm_ops kvm_arm_smmu_pm_ops = {
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 816 SET_RUNTIME_PM_OPS(kvm_arm_smmu_suspend, kvm_arm_smmu_resume, NULL)
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 817 };
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 818
d4519820851b1db Jean-Philippe Brucker 2022-02-09 819 static const struct of_device_id arm_smmu_of_match[] = {
d4519820851b1db Jean-Philippe Brucker 2022-02-09 820 { .compatible = "arm,smmu-v3", },
d4519820851b1db Jean-Philippe Brucker 2022-02-09 821 { },
d4519820851b1db Jean-Philippe Brucker 2022-02-09 822 };
d4519820851b1db Jean-Philippe Brucker 2022-02-09 823
d4519820851b1db Jean-Philippe Brucker 2022-02-09 824 static struct platform_driver kvm_arm_smmu_driver = {
d4519820851b1db Jean-Philippe Brucker 2022-02-09 825 .driver = {
d4519820851b1db Jean-Philippe Brucker 2022-02-09 826 .name = "kvm-arm-smmu-v3",
d4519820851b1db Jean-Philippe Brucker 2022-02-09 827 .of_match_table = arm_smmu_of_match,
94d1b3e12c96365 Jean-Philippe Brucker 2022-10-11 828 .pm = &kvm_arm_smmu_pm_ops,
d4519820851b1db Jean-Philippe Brucker 2022-02-09 829 },
d4519820851b1db Jean-Philippe Brucker 2022-02-09 830 .remove = kvm_arm_smmu_remove,
d4519820851b1db Jean-Philippe Brucker 2022-02-09 831 };
d4519820851b1db Jean-Philippe Brucker 2022-02-09 832
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 833 static int kvm_arm_smmu_array_alloc(void)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 834 {
be3195fe7b08b04 Mostafa Saleh 2023-10-17 835 int smmu_order;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 836 struct device_node *np;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 837
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 838 kvm_arm_smmu_count = 0;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 839 for_each_compatible_node(np, NULL, "arm,smmu-v3")
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 840 kvm_arm_smmu_count++;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 841
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 842 if (!kvm_arm_smmu_count)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 843 return 0;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 844
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 845 /* Allocate the parameter list shared with the hypervisor */
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 846 smmu_order = get_order(kvm_arm_smmu_count * sizeof(*kvm_arm_smmu_array));
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 847 kvm_arm_smmu_array = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 848 smmu_order);
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 849 if (!kvm_arm_smmu_array)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 850 return -ENOMEM;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 851
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 852 return 0;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 853 }
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 854
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 855 static void kvm_arm_smmu_array_free(void)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 856 {
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 857 int order;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 858
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 859 order = get_order(kvm_arm_smmu_count * sizeof(*kvm_arm_smmu_array));
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 860 free_pages((unsigned long)kvm_arm_smmu_array, order);
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 861 }
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 862
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 @863 int smmu_put_device(struct device *dev, void *data)
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 864 {
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 865 pm_runtime_put_noidle(dev);
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 866 return 0;
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 867 }
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 868
d4519820851b1db Jean-Philippe Brucker 2022-02-09 869 /**
d4519820851b1db Jean-Philippe Brucker 2022-02-09 870 * kvm_arm_smmu_v3_init() - Reserve the SMMUv3 for KVM
d4519820851b1db Jean-Philippe Brucker 2022-02-09 871 * Return 0 if all present SMMUv3 were probed successfully, or an error.
d4519820851b1db Jean-Philippe Brucker 2022-02-09 872 * If no SMMU was found, return 0, with a count of 0.
d4519820851b1db Jean-Philippe Brucker 2022-02-09 873 */
5d6af2ce0093f6b Mostafa Saleh 2023-05-01 874 static int kvm_arm_smmu_v3_init(void)
d4519820851b1db Jean-Philippe Brucker 2022-02-09 875 {
d4519820851b1db Jean-Philippe Brucker 2022-02-09 876 int ret;
d4519820851b1db Jean-Philippe Brucker 2022-02-09 877
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 878 /*
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 879 * Check whether any device owned by the host is behind an SMMU.
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 880 */
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 881 ret = kvm_arm_smmu_array_alloc();
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 882 if (ret || !kvm_arm_smmu_count)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 883 return ret;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 884
d4519820851b1db Jean-Philippe Brucker 2022-02-09 885 ret = platform_driver_probe(&kvm_arm_smmu_driver, kvm_arm_smmu_probe);
d4519820851b1db Jean-Philippe Brucker 2022-02-09 886 if (ret)
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 887 goto err_free;
d4519820851b1db Jean-Philippe Brucker 2022-02-09 888
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 889 if (kvm_arm_smmu_cur != kvm_arm_smmu_count) {
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 890 /* A device exists but failed to probe */
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 891 ret = -EUNATCH;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 892 goto err_free;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 893 }
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 894
fcc9e477aaee84d Mostafa Saleh 2023-08-17 895 #ifdef MODULE
fcc9e477aaee84d Mostafa Saleh 2023-08-17 896 ret = pkvm_load_el2_module(kvm_nvhe_sym(smmu_init_hyp_module),
fcc9e477aaee84d Mostafa Saleh 2023-08-17 897 &pkvm_module_token);
fcc9e477aaee84d Mostafa Saleh 2023-08-17 898
fcc9e477aaee84d Mostafa Saleh 2023-08-17 899 if (ret) {
fcc9e477aaee84d Mostafa Saleh 2023-08-17 900 pr_err("Failed to load SMMUv3 IOMMU EL2 module: %d\n", ret);
fcc9e477aaee84d Mostafa Saleh 2023-08-17 901 return ret;
fcc9e477aaee84d Mostafa Saleh 2023-08-17 902 }
fcc9e477aaee84d Mostafa Saleh 2023-08-17 903 #endif
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 904 /*
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 905 * These variables are stored in the nVHE image, and won't be accessible
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 906 * after KVM initialization. Ownership of kvm_arm_smmu_array will be
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 907 * transferred to the hypervisor as well.
f6758993ba0dc87 Jean-Philippe Brucker 2022-11-23 908 *
f6758993ba0dc87 Jean-Philippe Brucker 2022-11-23 909 * kvm_arm_smmu_memcache is shared between hypervisor and host.
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 910 */
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 911 kvm_hyp_arm_smmu_v3_smmus = kvm_arm_smmu_array;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 912 kvm_hyp_arm_smmu_v3_count = kvm_arm_smmu_count;
bb65953ff665bb3 David Brazdil 2023-08-09 913
fcc9e477aaee84d Mostafa Saleh 2023-08-17 914 ret = kvm_iommu_init_hyp(ksym_ref_addr_nvhe(smmu_ops), 0);
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 915
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 916 WARN_ON(driver_for_each_device(&kvm_arm_smmu_driver.driver, NULL,
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 917 NULL, smmu_put_device));
842ddd77ef926ee Jean-Philippe Brucker 2022-10-10 918 return ret;
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 919 err_free:
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 920 kvm_arm_smmu_array_free();
58d165ce27ff4bc Jean-Philippe Brucker 2022-02-09 921 return ret;
d4519820851b1db Jean-Philippe Brucker 2022-02-09 922 }
d4519820851b1db Jean-Philippe Brucker 2022-02-09 923
5d6af2ce0093f6b Mostafa Saleh 2023-05-01 924 static void kvm_arm_smmu_v3_remove(void)
d4519820851b1db Jean-Philippe Brucker 2022-02-09 925 {
d4519820851b1db Jean-Philippe Brucker 2022-02-09 926 platform_driver_unregister(&kvm_arm_smmu_driver);
d4519820851b1db Jean-Philippe Brucker 2022-02-09 927 }
5d6af2ce0093f6b Mostafa Saleh 2023-05-01 928
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 @929 pkvm_handle_t kvm_arm_smmu_v3_id(struct device *dev)
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 930 {
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 931 struct arm_smmu_device *smmu = dev_get_drvdata(dev);
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 932 struct host_arm_smmu_device *host_smmu = smmu_to_host(smmu);
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 933
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 934 return host_smmu->id;
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 935 }
9d5e57d93b40eb3 Mostafa Saleh 2023-08-19 936
:::::: The code at line 795 was first introduced by commit
:::::: 94d1b3e12c96365344527059d9fc1570856dc06e ANDROID: iommu/arm-smmu-v3-kvm: Use HOST_HVC PD if possible
:::::: TO: Jean-Philippe Brucker <jean-philippe@linaro.org>
:::::: CC: Mostafa Saleh <smostafa@google.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-04-14 8:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202604141632.fpG6LXAS-lkp@intel.com \
--to=lkp@intel.com \
--cc=cros-kernel-buildreports@googlegroups.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.