[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback
From: |
Eric Auger |
Subject: |
Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback |
Date: |
Fri, 24 Apr 2015 11:48:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 04/24/2015 11:29 AM, Paolo Bonzini wrote:
>
>
> On 24/04/2015 11:18, Eric Auger wrote:
>>>>>> I implemented this alternative but my concern is the check method is
>>>>>> called before the qemu_irq setting. So on this callback I cannot
>>>>>> retrieve the qemu_irq VFIOINTp struct container object needed to setup
>>>>>> irqfd hence does not work for me.
>>>>
>>>> Isn't the qemu_irq passed as the third argument to the callback? I
>>>> thought this solution was fine because you weren't passing the "int n"
>>>> from sysbus_connect_irq to your notifier.
>> Yes it is. But I need to access the EventNotifiers for trigger &
>> resample which were initialized before for eventfd trigger and stored in
>> the container object. Will study if I can restructure the code ...
>
> What did the notifier code look like with your patch?
Currently both notifiers are stored in the VFIOINTp struct. They are
initialized in vfio_init_intp. VFIO platform device holds a list of
VFIOINTp struct.
When the vfio_start_irqfd callback is called the qemuirq is not yet
initialized so I cannot retrieve the EventNotifiers by container_of.
I can allocate and initialize them in the callback but I need a place to
store them to close the eventfd.
Also at the moment I start irqfd I must take some actions to stop (user
side) eventfd trigger; this also urges me to get access to VFIOINTp
struct. Some extracted pieces below (under work).
Eric
typedef struct VFIOINTp {
QLIST_ENTRY(VFIOINTp) next; /* entry for IRQ list */
QSIMPLEQ_ENTRY(VFIOINTp) pqnext; /* entry for pending IRQ queue */
EventNotifier interrupt; /* eventfd triggered on interrupt */
EventNotifier unmask; /* eventfd for unmask on QEMU bypass */
qemu_irq qemuirq;
struct VFIOPlatformDevice *vdev; /* back pointer to device */
int state; /* inactive, pending, active */
uint8_t pin; /* index */
uint32_t flags; /* IRQ info flags */
bool kvm_accel; /* set when QEMU bypass through KVM enabled */
} VFIOINTp;
static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev,
struct vfio_irq_info info)
{
int ret;
VFIOPlatformDevice *vdev =
container_of(vbasedev, VFIOPlatformDevice, vbasedev);
SysBusDevice *sbdev = SYS_BUS_DEVICE(vdev);
VFIOINTp *intp;
intp = g_malloc0(sizeof(*intp));
intp->vdev = vdev;
intp->pin = info.index;
intp->flags = info.flags;
intp->state = VFIO_IRQ_INACTIVE;
intp->kvm_accel = false;
sysbus_init_irq(sbdev, &intp->qemuirq);
/* Get an eventfd for trigger */
ret = event_notifier_init(&intp->interrupt, 0);
if (ret) {
g_free(intp);
error_report("vfio: Error: trigger event_notifier_init failed ");
return NULL;
}
/* Get an eventfd for resample/unmask */
ret = event_notifier_init(&intp->unmask, 0);
if (ret) {
g_free(intp);
error_report("vfio: Error: resample event_notifier_init failed ");
return NULL;
}
static void vfio_start_irqfd(Object *obj, const char *name,
Object *child, Error ** err)
{
VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(obj);
qemu_irq irq = OBJECT_CHECK(struct IRQState, (child), TYPE_IRQ);
struct VFIOINTp *tmp, *intp = container_of(&irq, struct VFIOINTp,
qemuirq);
EventNotifier *interrupt, *unmask;
vfio_stop_vfio_signaling(intp);
interrupt = g_new(EventNotifier, 1);
unmask = g_new(EventNotifier, 1);
/* Get an eventfd for trigger */
ret = event_notifier_init(interrupt, 0);
if (ret) {
return NULL;
}
/* Get an eventfd for resample/unmask */
ret = event_notifier_init(unmask, 0);
if (ret) {
return NULL;
}
kvm_irqchip_add_qemuirq_irqfd_notifier(kvm_state,
interrupt,
unmask,
irq);
../..
}
>
> Paolo
>
- [Qemu-devel] [PATCH 1/2] irq: add get_gsi callback, (continued)
- [Qemu-devel] [PATCH 1/2] irq: add get_gsi callback, Eric Auger, 2015/04/23
- [Qemu-devel] [PATCH 2/2] intc: arm_gic_kvm: set the get_gsi callback, Eric Auger, 2015/04/23
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/23
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Eric Auger, 2015/04/23
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/23
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Eric Auger, 2015/04/23
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Eric Auger, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Eric Auger, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback,
Eric Auger <=
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Eric Auger, 2015/04/24
- Re: [Qemu-devel] [PATCH 0/2] irq: add get_gsi callback, Paolo Bonzini, 2015/04/24