From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kvm: libkvm: support for irq routing
Date: Thu, 15 Jan 2009 12:10:09 +0200 [thread overview]
Message-ID: <496F0B81.30202@redhat.com> (raw)
In-Reply-To: <200901151805.03447.sheng@linux.intel.com>
Sheng Yang wrote:
> On Thursday 15 January 2009 17:59:43 Avi Kivity wrote:
>
>> Sheng Yang wrote:
>>
>>> On Thursday 15 January 2009 14:17:16 Sheng Yang wrote:
>>>
>>>> On Wednesday 14 January 2009 21:53:10 Avi Kivity wrote:
>>>>
>>>>> Signed-off-by: Avi Kivity <avi@redhat.com>
>>>>>
>>>> Do we need a lock for the table?
>>>>
>>> And kvm_add_irq_route/kvm_del_irq_route should be generic used, how about
>>> transfer a kvm_irq_routing_entry as parameter?
>>>
>> These structures + selectors + unions are clumsy. For libkvm, I'd
>> prefer adding kvm_add_msi() and kvm_del_msi().
>>
>
> But...
>
>> +int kvm_add_irq_route(kvm_context_t kvm, int gsi, int irqchip, int pin)
>> +{
>> +#ifdef KVM_CAP_IRQ_ROUTING
>> + struct kvm_irq_routing *z;
>> + struct kvm_irq_routing_entry *e;
>> + int n, size;
>> +
>> + if (kvm->irq_routes->nr == kvm->nr_allocated_irq_routes) {
>> + n = kvm->nr_allocated_irq_routes * 2;
>> + if (n < 64)
>> + n = 64;
>> + size = sizeof(struct kvm_irq_routing);
>> + size += n * sizeof(*e);
>> + z = realloc(kvm->irq_routes, size);
>> + if (!z)
>> + return -ENOMEM;
>> + kvm->nr_allocated_irq_routes = n;
>> + kvm->irq_routes = z;
>> + }
>> + n = kvm->irq_routes->nr++;
>> + e = &kvm->irq_routes->entries[n];
>> + memset(e, 0, sizeof(*e));
>> + e->gsi = gsi;
>> + e->type = KVM_IRQ_ROUTING_IRQCHIP;
>> + e->flags = 0;
>> + e->u.irqchip.irqchip = irqchip;
>> + e->u.irqchip.pin = pin;
>> + return 0;
>> +#else
>> + return -ENOSYS;
>> +#endif
>> +}
>>
>
> Besides three lines, all can be reused... I don't see the reason for another
> function...
>
> And the name here is irq_route, I suppose it should be generic used. Can be
> core function which can be wrapped.
>
Yes, I guess we can rename it irqchip_route. When we add msis, both
this function and the new msi function can share code.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2009-01-15 10:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-14 13:53 [PATCH 0/2] irq routing userspace Avi Kivity
2009-01-14 13:53 ` [PATCH 1/2] kvm: libkvm: support for irq routing Avi Kivity
2009-01-15 6:17 ` Sheng Yang
2009-01-15 6:20 ` Sheng Yang
2009-01-15 9:59 ` Avi Kivity
2009-01-15 10:05 ` Sheng Yang
2009-01-15 10:10 ` Avi Kivity [this message]
2009-01-15 9:58 ` Avi Kivity
2009-01-14 13:53 ` [PATCH 2/2] kvm: qemu: initialize irq routing table Avi Kivity
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=496F0B81.30202@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=sheng@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox