From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Igor Kozhukhov <ikozhukhov@gmail.com>
Cc: xen-devel@lists.xen.org
Subject: Re: translate pirq to irq
Date: Sun, 12 Jan 2014 21:10:44 +0000 [thread overview]
Message-ID: <52D304D4.3030704@citrix.com> (raw)
In-Reply-To: <BA268314-38BF-4948-B69C-AD5A3916D5B9@gmail.com>
On 12/01/2014 21:01, Igor Kozhukhov wrote:
> On Jan 13, 2014, at 12:34 AM, Andrew Cooper wrote:
>
>> On 12/01/2014 19:26, Igor Kozhukhov wrote:
>>> Hi Andrew,
>>>
>>> On Jan 12, 2014, at 10:29 PM, Andrew Cooper wrote:
>>>
>>>> On 11/01/2014 22:59, Igor Kozhukhov wrote:
>>>>> Hello All,
>>>>>
>>>>> I see a comment in physdev.h for 'struct physdev_map_pirq', var 'pirq':
>>>>> /* IN - high 16 bits hold segment for MAP_PIRQ_TYPE_MSI_SEG */
>>>>>
>>>>> i have received 'pirq' from hypervisor > 255.
>>>>>
>>>>> map_irq.domid = DOMID_SELF;
>>>>> map_irq.type = MAP_PIRQ_TYPE_MSI;
>>>>> map_irq.index = -1; /* hypervisor auto allocates vector */
>>>>> map_irq.pirq = -1;
>>>>> map_irq.bus = busnum;
>>>>> map_irq.devfn = devfn;
>>>>> map_irq.entry_nr = i;
>>>>> map_irq.table_base = 0;
>>>>> rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
>>>>> irqno = map_irq.pirq;
>>>>>
>>>>> i have:
>>>>> irqno = 279 - it is more APIC_MAX_VECTOR(255)
>>>>>
>>>>> i have a question: how to correct translate pirq to irq for APIC map table ?
>>>>>
>>>>> all work well on xen-3.4, but it has another realization in function physdev_map_pirq() then for xen-4.2.
>>>> Is this for a PV or HVM guest? I suspect PV, in which case the irqno
>>>> handed back will be the event channel on which the notification will
>>>> arrive, and has nothing to do with regular IDT vectors.
>>> it is for dom0.
>>>
>>> full boot log with xen debug info and DDI_DEBUG on illumos you can find here :
>>> http://apt2.dilos.org/dilos/logs/putty.log.dom0.txt
>>>
>>>
>>> if it is possible - could you please let me know how to work MSI irq translation to APIC irq table for xen-4.2 ?
>>>
>>> i see - in xen code we have a range from 16 to 784 for 4 CPU for MSI IRQ (irq_create() function)
>>> but - how to correct translate it to APIC IRQ (physical irq)?
>> Why do you need to know?
>>
>> Xen controls all interrupts on the system. Event channels which you
>> register with Xen have no mapping/relation to local apic vectors. Your
>> device drivers should not expect to have an apic vector in their hand.
>>
>> The reason behind this is that as virtual cpus get scheduled around
>> physical cpus, Xen needs to move the interrupts from IDT to IDT at which
>> point their vector will change.
> is it possible to receive IRQ from APIC table from Xen as index ?
No.
> i need it for local APIC pointer to APIC table array as index.
> all others functions is using index from apic_irq_table[] as APIC IRQ.
>
> i have function apic_find_irq() for this.
> it is not my realization - it is original code.
Nothing in a dom0 system should know/care about apic vectors. Dom0
cannot use the IDT, nor can it even write to MSI/MSI-X configuration
registers (they get trapped and fixed-up by Xen).
Even if there were a hypercall to map an event channel back to an
apic-id/vector, it is possible that the data would be stale by the time
the vcpu ran again.
~Andrew
next prev parent reply other threads:[~2014-01-12 21:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-11 22:59 translate pirq to irq Igor Kozhukhov
2014-01-12 18:29 ` Andrew Cooper
2014-01-12 19:26 ` Igor Kozhukhov
2014-01-12 20:34 ` Andrew Cooper
2014-01-12 21:01 ` Igor Kozhukhov
2014-01-12 21:10 ` Andrew Cooper [this message]
2014-01-14 20:50 ` Igor Kozhukhov
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=52D304D4.3030704@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ikozhukhov@gmail.com \
--cc=xen-devel@lists.xen.org \
/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.