Re: [PATCH RFC 12/13] iommu/vt-d: Add a helper to retrieve PID address

From: Thomas Gleixner
Date: Tue Feb 13 2024 - 03:23:12 EST


On Fri, Jan 26 2024 at 15:30, Jacob Pan wrote:
> On Wed, 06 Dec 2023 21:19:11 +0100, Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> wrote:
>> > +static u64 get_pi_desc_addr(struct irq_data *irqd)
>> > +{
>> > + int cpu =
>> > cpumask_first(irq_data_get_effective_affinity_mask(irqd));
>>
>> The effective affinity mask is magically correct when this is called?
>>
> My understanding is that remappable device MSIs have the following
> hierarchy,e.g.

SNIP

> Here the parent APIC chip does apic_set_affinity() which will set up
> effective mask before posted MSI affinity change.
>
> Maybe I missed some cases?

The function is only used in intel_ir_reconfigure_irte_posted() in the
next patch, but it's generally available. So I asked that question
because if it's called in some other context then it's going to be not
guaranteed.

That also begs the question why this function exists in the first
place. This really can be part of intel_ir_reconfigure_irte_posted(),
which makes it clear what the context is, no?

Thanks,

tglx