Re: [PATCH 0/2] irq: add get_gsi callback

Eric Auger
2015-04-23T09:35:07Z

Hi Paolo,
On 04/23/2015 11:30 AM, Paolo Bonzini wrote:
>
>
> On 23/04/2015 10:49, Eric Auger wrote:
>> This series introduces a new callback function in IRQState, named
>> get_gsi_cb. It is supposed to be populated by the interrupt controller
>> and its role is to convert the interrupt controller pin number into
>> the global system interrupt (gsi) number. The gsi is used when setting
>> irqfd up.
>>
>> With PCI there is a PCIINTxRoute bus lookup mechanism that enables to
>> retrieve the gsi from the PCI host controller/bridge pin. The conversion
>> is implemented by the PCI host controller. With platform devices, this
>> conversion function is implemented by the interrupt controller.
>>
>> Besides the callback member, a setter is introduced. First user is
>> arm_gic_kvm. A public function wraps the callback, qemu_irq_get_gsi.
>>
>> The first user of qemu_irq_get_gsi might be the VFIO platform device.
>> This will come in the "KVM platform device passthrough" series.
>
> I'm sorry, I cannot understand the point of this without seeing a user.
no problem, I intend to send the KVM platform device passthrough v13
today which will illustrate the usage.
>
> Why can't you just use a GHashTable?

You mean implementing this hash table in the interrupt controller?

The problem is my VFIO device currently has no link to the interrupt
controller object. Besides it has a platform bus in between. Previously
I devised a reset notifier called in the machine file to pass this link
but Alex was not keen about this method. So the idea here is when the
VFIO sysbus device qemuirq is getting connected, a notifier is called,
VFIO device can retrieve the gsi of this qemu_irq and call KVM_IRQFD
with that gsi.

Best Regards

Eric
This mustn't be a hot path, since
> VFIO does all the signalling in the kernel via irqfds.
>
> Paolo
>