About GSI and IRQ?
Hi all,
I am confused by the concept GSI and IRQ.
what I figure out is as below,
IRQ is for PIC, PIN is for IOAPIC.
GSI is short for "Global System Interrupt", it is the unique number of one interrupt. GSI=GSI base + pin.
16 IRQ of ISA are mapped to GSI[0,15]
if number > 15, IRQ = GSI.
Vector is the concept of CPU, it is the index of IDT.
I found one function like
int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) {
...
irq = apic_pin_2_gsi_irq(apic, pin);
...
}
static int apic_pin_2_gsi_irq(int apic, int pin)
{
int idx;
if (apic < 0)
return -EINVAL;
idx = find_irq_entry(apic, pin, mp_INT);
return idx >= 0 ? pin_2_irq(idx, apic, pin)
: apic_gsi_base(apic) + pin;
}what make me most confued is the function name of "apic_pin_2_gsi_irq", is the returned value a GSI or a IRQ? when to use GSI? when to use IRQ?
anyone can explain it for me ? or maybe give me some URL to read.
--
Best Regards,
yandong
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 14 lines
Quoted 1 line
Quoted 1 line · hanyandong
static int
apic_pin_2_gsi_irq(int apic, int pin){ int idx; if (apic < 0) return -EINVAL; idx = find_irq_entry(apic, pin, mp_INT); return idx >= 0 ? pin_2_irq(idx, apic, pin) : apic_gsi_base(apic) + pin; }
Quoted 3 lines
what make me most confued is the function name of "
apic_pin_2_gsi_irq", is the returned value a GSI or a IRQ?
when to use GSI? when to use IRQ?
With you having quoted the function above already, I don't think there's much to say here: If it can (valid index into mp_irqs[]), it returns an IRQ, else it returns a GSI. For PCI IRQs the two would always match (i.e. the distinction is only relevant for the other MP_BUS_* types).
Jan
Thank you very much.
Xen get mp_irqs[] from MADT, the mp_irqs[] struct is as below
struct mpc_config_intsrc
{
unsigned char mpc_type;
unsigned char mpc_irqtype;
unsigned short mpc_irqflag;
unsigned char mpc_srcbus; #SOURCE BUS ID
unsigned char mpc_srcbusirq; # SOURCE BUS IRQ
unsigned char mpc_dstapic;
unsigned char mpc_dstirq; #destination IOAPIC INTN
};Can I get the conclusion as blow:
the mp_irqs[] acts as a map between IRQ and IOAPIC PIN, and we can get GSI from mpc_config_intsrc.mpc_dstirq (GSI=GSI base + pin). For PCI IRQs, the IRQ equal to the GSI.
But for ISA IRQs, the two maybe not match, because of the ISO(interrupt source overrides).
And the map between IRQ and GSI is decided by hardware, not by xen.Because the map info was get from MADT.
ps : another question, can I rename "apic_pin_2_gsi_irq" with "apic_pin_2_gsi" for they are the same semantics.
Quoted 24 lines · 在2014-03-21 19:07:33,hanyandong<[email protected]>写道:
Quoted 14 lines
Quoted 1 line
Quoted 1 line · hanyandong
static int
apic_pin_2_gsi_irq(int apic, int pin){ int idx; if (apic < 0) return -EINVAL; idx = find_irq_entry(apic, pin, mp_INT); return idx >= 0 ? pin_2_irq(idx, apic, pin) : apic_gsi_base(apic) + pin; }Quoted 3 lines
what make me most confued is the function name of "
apic_pin_2_gsi_irq", is the returned value a GSI or a IRQ?
when to use GSI? when to use IRQ?With you having quoted the function above already, I don't think there's much to say here: If it can (valid index into mp_irqs[]), it returns an IRQ, else it returns a GSI. For PCI IRQs the two would always match (i.e. the distinction is only relevant for the other MP_BUS_* types).
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel