Re: In kernel PIC support: kernel patch

Avi Kivity
2007-06-23T07:53:14Z

Gregory Haskins wrote:
> On Fri, 2007-06-22 at 13:50 +0300, Avi Kivity wrote:
>
>> Dong, Eddie wrote:
>>
>>
>>> +#include "kvm.h"
>>> +#include "virq.h"
>>> +
>>> +/*
>>> + * check if there is pending interrupt without
>>> + * intack.
>>> + */
>>> +int cpu_has_interrupt(struct kvm_vcpu *v)
>>> +{
>>> + struct pic_state2 *s = kernel_pic(v->kvm);
>>> +
>>>
>>>
>> Isn't the PIC connected to just one cpu?
>>
>
> I agree with Eddie here. Its true that only one CPU would ever
> associate with PIC (and its usually hardwired to the BSP, but it
> technically doesn't have to be depending on the architecture). But the
> PIC(s) are really a system wide resource that should hang off the kvm
> struct, IMHO.
>
> In fact, my own implementation puts the ISA-userint model as hanging off
> the kvm structure as well (which would be replaced with a similar PIC
> model for layer-2 mode in the future).
>
>

The PIC is certainly a system resource, but at least in qemu it's
connected to cpu 0 only. We want to preserve that.

I guess it doesn't really matter because smp configurations will use the
ioapic.