
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 0e7be8a8c16e0602692e15d036798142558315f5 commit: c5161d7e11a7e30755b2ec55aaebfd500193cbbc [2976/2976] virtCCA supports SR-IOV in CoDA scenarios. config: arm64-randconfig-004-20251017 (https://download.01.org/0day-ci/archive/20251018/202510180550.YYG7SMcY-lkp@i...) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 754ebc6ebb9fb9fbee7aef33478c74ea74949853) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251018/202510180550.YYG7SMcY-lkp@i...) 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/202510180550.YYG7SMcY-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/coda/coda.c:8: In file included from arch/arm64/include/asm/virtcca_coda.h:13: arch/arm64/include/../../../drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:989:44: error: no member named 'flags' in 'struct iommu_fwspec' 989 | return dev_iommu_fwspec_get(master->dev)->flags & | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ arch/arm64/include/../../../drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:990:9: error: use of undeclared identifier 'IOMMU_FWSPEC_PCI_RC_CANWBS' 990 | IOMMU_FWSPEC_PCI_RC_CANWBS; | ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/coda/coda.c:678:32: error: call to undeclared function 'iommu_get_dma_domain'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 678 | smmu_domain = to_smmu_domain(iommu_get_dma_domain(&(pci_dev->dev))); | ^ drivers/coda/coda.c:678:32: note: did you mean 'iommu_is_dma_domain'? include/linux/iommu.h:295:20: note: 'iommu_is_dma_domain' declared here 295 | static inline bool iommu_is_dma_domain(struct iommu_domain *domain) | ^ drivers/coda/coda.c:678:32: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct iommu_domain *' [-Wint-conversion] 678 | smmu_domain = to_smmu_domain(iommu_get_dma_domain(&(pci_dev->dev))); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/arm64/include/../../../drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h:950:75: note: passing argument to parameter 'dom' here 950 | static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) | ^ drivers/coda/coda.c:765:12: error: call to undeclared function 'iommu_get_dma_domain'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 765 | domain = iommu_get_dma_domain(master->dev); | ^ drivers/coda/coda.c:765:10: error: incompatible integer to pointer conversion assigning to 'struct iommu_domain *' from 'int' [-Wint-conversion] 765 | domain = iommu_get_dma_domain(master->dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/coda/coda.c:908:11: error: call to undeclared function 'dev_iommu_priv_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 908 | master = dev_iommu_priv_get(dev); | ^ drivers/coda/coda.c:908:11: note: did you mean 'dev_iommu_fwspec_get'? include/linux/iommu.h:1633:36: note: 'dev_iommu_fwspec_get' declared here 1633 | static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) | ^ drivers/coda/coda.c:908:9: error: incompatible integer to pointer conversion assigning to 'struct arm_smmu_master *' from 'int' [-Wint-conversion] 908 | master = dev_iommu_priv_get(dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~ drivers/coda/coda.c:976:11: error: call to undeclared function 'dev_iommu_priv_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 976 | master = dev_iommu_priv_get(dev); | ^ drivers/coda/coda.c:976:9: error: incompatible integer to pointer conversion assigning to 'struct arm_smmu_master *' from 'int' [-Wint-conversion] 976 | master = dev_iommu_priv_get(dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~ drivers/coda/coda.c:1035:11: error: call to undeclared function 'dev_iommu_priv_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1035 | master = dev_iommu_priv_get(dev); | ^ drivers/coda/coda.c:1035:9: error: incompatible integer to pointer conversion assigning to 'struct arm_smmu_master *' from 'int' [-Wint-conversion] 1035 | master = dev_iommu_priv_get(dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~ drivers/coda/coda.c:1144:11: error: call to undeclared function 'dev_iommu_priv_get'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 1144 | master = dev_iommu_priv_get(&pci_dev->dev); | ^ drivers/coda/coda.c:1144:9: error: incompatible integer to pointer conversion assigning to 'struct arm_smmu_master *' from 'int' [-Wint-conversion] 1144 | master = dev_iommu_priv_get(&pci_dev->dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 14 errors generated.
Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for ARM_SPE_MEM_SAMPLING Depends on [n]: ARM_SPE_PMU [=n] Selected by [y]: - MEM_SAMPLING [=y] && ARM64 [=y] vim +/iommu_get_dma_domain +678 drivers/coda/coda.c 644 645 /** 646 * virtcca_create_ste_entry - Call the tmi interface to set single STE entry 647 * in the SMMU for the corresponding device 648 * @smmu: An SMMUv3 instance 649 * @master: SMMU private data for each master 650 * @sid: Stream id 651 * @host: Host driver or nvm stage2 652 * @new_vf: After enabling the PCIPC feature, the VF that needs to be created 653 * 654 * Returns: 655 * %0 if set STE config content success 656 * %-ENOMEM alloc STE params failed 657 * %-EINVAL set STE config content failed 658 */ 659 static int virtcca_create_ste_entry(struct pci_dev *pci_dev, bool host, bool new_vf) 660 { 661 int ret = 0; 662 struct tmi_device_create_params *params_ptr = NULL; 663 struct arm_smmu_domain *smmu_domain = NULL; 664 struct io_pgtable *data; 665 struct io_pgtable_cfg *cfg; 666 struct arm_smmu_s2_cfg *s2_cfg; 667 668 params_ptr = kzalloc(sizeof(*params_ptr), GFP_KERNEL); 669 if (!params_ptr) 670 return -ENOMEM; 671 672 /* 673 * If the stage 2 to be set in the secure SMMU for the device is for the host driver side, 674 * it is obtained via the default_domain. If the device is assigned to a CVM, 675 * the stage 2 set in the secure SMMU needs to be obtained via the domain. 676 */ 677 if (host)
678 smmu_domain = to_smmu_domain(iommu_get_dma_domain(&(pci_dev->dev))); 679 else 680 smmu_domain = to_smmu_domain(iommu_get_domain_for_dev(&(pci_dev->dev))); 681 682 data = io_pgtable_ops_to_pgtable(smmu_domain->pgtbl_ops); 683 cfg = &data->cfg; 684 typeof(&cfg->arm_lpae_s2_cfg.vtcr) vtcr = &cfg->arm_lpae_s2_cfg.vtcr; 685 686 s2_cfg = &smmu_domain->s2_cfg; 687 /* Set ste config */ 688 params_ptr->sid = pci_dev_id(pci_dev); 689 params_ptr->smmu_id = smmu_domain->smmu->s_smmu_id; 690 params_ptr->root_bd = get_root_bd(&pci_dev->dev); 691 params_ptr->s2vmid = s2_cfg->vmid; 692 params_ptr->s2ttb = cfg->arm_lpae_s2_cfg.vttbr; 693 params_ptr->s2t0sz = vtcr->tsz; 694 params_ptr->s2sl0 = vtcr->sl; 695 params_ptr->host = host; 696 params_ptr->new_vf = new_vf; 697 ret = tmi_dev_create(__pa(params_ptr)); 698 699 kfree(params_ptr); 700 return ret; 701 } 702 703 static int arm_s_smmu_streams_cmp_key(const void *lhs, const struct rb_node *rhs) 704 { 705 struct arm_smmu_stream *stream_rhs = 706 rb_entry(rhs, struct arm_smmu_stream, node); 707 const u32 *sid_lhs = lhs; 708 709 if (*sid_lhs < stream_rhs->id) 710 return -1; 711 if (*sid_lhs > stream_rhs->id) 712 return 1; 713 return 0; 714 } 715 716 static inline struct arm_smmu_master * 717 arm_s_smmu_find_master(struct arm_smmu_device *smmu, u32 sid) 718 { 719 struct rb_node *node; 720 721 lockdep_assert_held(&smmu->streams_mutex); 722 723 node = rb_find(&sid, &smmu->streams, arm_s_smmu_streams_cmp_key); 724 if (!node) 725 return NULL; 726 return rb_entry(node, struct arm_smmu_stream, node)->master; 727 } 728 729 /** 730 * virtcca_create_ste_entries - Setting up STE entries for all the devices under the same root port 731 * @smmu: An SMMUv3 instance 732 * @dev: CC device 733 * @params: Delegate device parameters 734 * @s2vmid: SMMU STE s2vmid 735 * 736 * Return 737 * %0 if the STE tables on all devices under the root port are set successfully 738 * %-ENOMEM alloc STE params failed 739 * %-EINVAL set STE config content failed or does not find corresponding master info 740 */ 741 static int virtcca_create_ste_entries(struct arm_smmu_device *smmu, 742 struct device *dev, struct tmi_dev_delegate_params *params, uint16_t *s2vmid) 743 { 744 int ret = 0; 745 struct arm_smmu_master *master = NULL; 746 struct iommu_domain *domain = NULL; 747 struct arm_smmu_domain *smmu_domain = NULL; 748 749 /* 750 * Because the PCIPC function will switch all devices under the root port to 751 * the secure state, all devices stage2 under the root port need to be translated 752 * through the secure SMMU. Therefore, before switching to secure state, 753 * it is necessary to configure the security SMMU STE entries 754 * for all PF and VF under the corresponding root port 755 */ 756 for (int i = 0; i < params->num_dev; i++) { 757 mutex_lock(&smmu->streams_mutex); 758 master = arm_s_smmu_find_master(smmu, params->devs[i]); 759 if (!master) { 760 ret = -EINVAL; 761 mutex_unlock(&smmu->streams_mutex); 762 return ret; 763 } 764 mutex_unlock(&smmu->streams_mutex); 765 domain = iommu_get_dma_domain(master->dev); 766 smmu_domain = to_smmu_domain(domain); 767 s2vmid[i] = smmu_domain->s2_cfg.vmid; 768 ret = virtcca_create_ste_entry(to_pci_dev(master->dev), true, false); 769 if (ret) { 770 pr_err("Failed to create dev 0x%x STE\n", params->devs[i]); 771 return ret; 772 } 773 } 774 775 return ret; 776 } 777
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki