Re: [RFC PATCH v2 1/5] iommu/amd: kvm/svm: Improve API between SVM and AMD IOMMU

From: Sean Christopherson

Date: Fri Jul 10 2026 - 13:19:36 EST


On Thu, Jul 09, 2026, Sairaj Kodilkar wrote:
> On 7/8/2026 7:06 PM, Sean Christopherson wrote:
> >> @@ -949,10 +950,11 @@ int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
> >> */
> >> entry = svm->avic_physical_id_entry;
> >> if (entry & AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK) {
> >> - pi_data.cpu = entry & AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK;
> >> + pi_data.apicid = entry & AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK;
> >> + pi_data.flags = AMD_IOMMU_FLAG_VCPU_RUNNING;
> >> } else {
> >> - pi_data.cpu = -1;
> >> - pi_data.ga_log_intr = entry & AVIC_PHYSICAL_ID_ENTRY_GA_LOG_INTR;
> >> + posted_intr = !!(entry & AVIC_PHYSICAL_ID_ENTRY_GA_LOG_INTR);
> >
> > "posted_intr" is misleading, and IMO flat out wrong. Even when a GA Log Intr
> > and notification is logged/sent, the virtual interrupt is still posted to the
> > vCPU's virtual APIC. I have no idea what you're trying to capture with this
> > code. And that is yet another reason why this patch needs to be split up: so
> > that you can explain the reasoning and logic behind this refactoring.
> >
>
> I needed an generic name for boolean that is being used by both GAPPI
> and GALOG, hence I replaced ga_log_intr with posted_intr. But I can
> understand that it can lead to confusion. How about replacing
> ga_log_intr with wakeup_intr and AVIC_PHYSICAL_ID_ENTRY_GA_LOG_INTR with
> AVIC_PHYSICAL_ID_ENTRY_WAKEUP_INTR

Yeah, wakeup_intr works for me. I don't love bleeding KVM's usage into other
parts of the kernel, but the POSTED_INTR_WAKEUP_VECTOR ship sailed a looong time
ago.