arch/x86/kvm/svm/avic.c:984:50: error: implicit declaration of function 'kvm_cpu_get_apicid'; did you mean 'kvm_cpu_get_extint'?

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/intel-lab-lkp/linux/commits/Sairaj-Kodilkar/iommu-amd-kvm-svm-Improve-API-between-SVM-and-AMD-IOMMU/20260806-223438
head:   51c8e1a2e7e7a48f09a27b87014d46f6731728a3
commit: 6cb2b8d8101192002c42cc0fb5b16b5568d583e2 kvm/svm: Update the per-CPU wakeup-list during vCPU load and unload
date:   4 days ago
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260810/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260810/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

   arch/x86/kvm/svm/avic.c: In function 'avic_pi_update_irte':
>> arch/x86/kvm/svm/avic.c:984:50: error: implicit declaration of function 'kvm_cpu_get_apicid'; did you mean 'kvm_cpu_get_extint'? [-Wimplicit-function-declaration]
     984 |                                 pi_data.apicid = kvm_cpu_get_apicid(svm->gappi_cpu);
         |                                                  ^~~~~~~~~~~~~~~~~~
         |                                                  kvm_cpu_get_extint


vim +984 arch/x86/kvm/svm/avic.c

   931	
   932	int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
   933				unsigned int host_irq, uint32_t guest_irq,
   934				struct kvm_vcpu *vcpu, u32 vector)
   935	{
   936		/*
   937		 * If the IRQ was affined to a different vCPU, remove the IRTE metadata
   938		 * from the *previous* vCPU's list.
   939		 */
   940		svm_ir_list_del(irqfd);
   941	
   942		if (vcpu) {
   943			/*
   944			 * Try to enable guest_mode in IRTE, unless AVIC is inhibited,
   945			 * in which case configure the IRTE for legacy mode, but track
   946			 * the IRTE metadata so that it can be converted to guest mode
   947			 * if AVIC is enabled/uninhibited in the future.
   948			 */
   949			struct amd_iommu_pi_data pi_data = {
   950				.ga_tag = AVIC_GATAG(to_kvm_svm(kvm)->avic_vm_id,
   951						     vcpu->vcpu_idx),
   952				.is_guest_mode = kvm_vcpu_apicv_active(vcpu),
   953				.vapic_addr = avic_get_backing_page_address(to_svm(vcpu)),
   954				.vector = vector,
   955			};
   956			struct vcpu_svm *svm = to_svm(vcpu);
   957			u64 entry;
   958			int ret;
   959			int posted_intr;
   960			bool is_vcpu_waiting = false;
   961	
   962			/*
   963			 * Prevent the vCPU from being scheduled out or migrated until
   964			 * the IRTE is updated and its metadata has been added to the
   965			 * list of IRQs being posted to the vCPU, to ensure the IRTE
   966			 * isn't programmed with stale pCPU/IsRunning information.
   967			 */
   968			guard(raw_spinlock_irqsave)(&svm->ir_list_lock);
   969	
   970			/*
   971			 * Update the target pCPU for IOMMU doorbells if the vCPU is
   972			 * running.  If the vCPU is NOT running, i.e. is blocking or
   973			 * scheduled out, KVM will update the pCPU info when the vCPU
   974			 * is awakened and/or scheduled in.  See also avic_vcpu_load().
   975			 */
   976			entry = svm->avic_physical_id_entry;
   977			if (entry & AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK) {
   978				pi_data.apicid = entry & AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK;
   979				pi_data.flags = AMD_IOMMU_FLAG_VCPU_RUNNING;
   980			} else {
   981				posted_intr = !!(entry & AVIC_PHYSICAL_ID_ENTRY_GA_LOG_INTR);
   982				pi_data.flags = posted_intr << AMD_IOMMU_FLAG_POSTED_INTR_SHIFT;
   983				if (amd_iommu_gappi) {
 > 984					pi_data.apicid = kvm_cpu_get_apicid(svm->gappi_cpu);
   985					if (list_empty(&svm->ir_list)) {
   986						avic_add_vcpu_to_gappi_wakeup_list(svm, svm->gappi_cpu);
   987						is_vcpu_waiting = true;
   988					}
   989				}
   990			}
   991	
   992			ret = irq_set_vcpu_affinity(host_irq, &pi_data);
   993			if (ret)
   994				goto gappi_err_out;
   995	
   996			/*
   997			 * Revert to legacy mode if the IOMMU didn't provide metadata
   998			 * for the IRTE, which KVM needs to keep the IRTE up-to-date,
   999			 * e.g. if the vCPU is migrated or AVIC is disabled.
  1000			 */
  1001			if (WARN_ON_ONCE(!pi_data.ir_data)) {
  1002				irq_set_vcpu_affinity(host_irq, NULL);
  1003				ret = -EIO;
  1004				goto gappi_err_out;
  1005			}
  1006	
  1007			irqfd->irq_bypass_data = pi_data.ir_data;
  1008			list_add(&irqfd->vcpu_list, &svm->ir_list);
  1009			return 0;
  1010	gappi_err_out:
  1011			if (is_vcpu_waiting)
  1012				avic_remove_vcpu_from_gappi_wakeup_list(svm, svm->gappi_cpu);
  1013			return ret;
  1014		}
  1015		return irq_set_vcpu_affinity(host_irq, NULL);
  1016	}
  1017	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.