diff mbox

[3/8] KVM: mark apic enabled on start up.

Message ID 1344171513-4659-4-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov Aug. 5, 2012, 12:58 p.m. UTC
According to SDM apic is enabled on start up.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 arch/x86/kvm/lapic.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Avi Kivity Aug. 5, 2012, 2:14 p.m. UTC | #1
On 08/05/2012 03:58 PM, Gleb Natapov wrote:
> According to SDM apic is enabled on start up.
> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>  arch/x86/kvm/lapic.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 49f4ac0..c3f14fe 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1311,7 +1311,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
>  		     HRTIMER_MODE_ABS);
>  	apic->lapic_timer.timer.function = apic_timer_fn;
>  
> -	kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE);
> +	kvm_lapic_set_base(vcpu,
> +			APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE);
>  

I'm guessing that in practice this is a no-op since qemu reset involves
programming this MSR.
Gleb Natapov Aug. 5, 2012, 2:17 p.m. UTC | #2
On Sun, Aug 05, 2012 at 05:14:59PM +0300, Avi Kivity wrote:
> On 08/05/2012 03:58 PM, Gleb Natapov wrote:
> > According to SDM apic is enabled on start up.
> > 
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > ---
> >  arch/x86/kvm/lapic.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> > index 49f4ac0..c3f14fe 100644
> > --- a/arch/x86/kvm/lapic.c
> > +++ b/arch/x86/kvm/lapic.c
> > @@ -1311,7 +1311,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
> >  		     HRTIMER_MODE_ABS);
> >  	apic->lapic_timer.timer.function = apic_timer_fn;
> >  
> > -	kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE);
> > +	kvm_lapic_set_base(vcpu,
> > +			APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE);
> >  
> 
> I'm guessing that in practice this is a no-op since qemu reset involves
> programming this MSR.
> 
Qemu is not the only userspace :) But this is here to avoid unneeded
jump label patching truth to be told.

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity Aug. 5, 2012, 2:39 p.m. UTC | #3
On 08/05/2012 05:17 PM, Gleb Natapov wrote:
> On Sun, Aug 05, 2012 at 05:14:59PM +0300, Avi Kivity wrote:
>> On 08/05/2012 03:58 PM, Gleb Natapov wrote:
>> > According to SDM apic is enabled on start up.
>> > 
>> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
>> > ---
>> >  arch/x86/kvm/lapic.c |    3 ++-
>> >  1 file changed, 2 insertions(+), 1 deletion(-)
>> > 
>> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
>> > index 49f4ac0..c3f14fe 100644
>> > --- a/arch/x86/kvm/lapic.c
>> > +++ b/arch/x86/kvm/lapic.c
>> > @@ -1311,7 +1311,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
>> >  		     HRTIMER_MODE_ABS);
>> >  	apic->lapic_timer.timer.function = apic_timer_fn;
>> >  
>> > -	kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE);
>> > +	kvm_lapic_set_base(vcpu,
>> > +			APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE);
>> >  
>> 
>> I'm guessing that in practice this is a no-op since qemu reset involves
>> programming this MSR.
>> 
> Qemu is not the only userspace :) But this is here to avoid unneeded
> jump label patching truth to be told.

It's also correct, otherwise it wouldn't be here.

But won't the patching happen anyway? since it starts software disabled?
Gleb Natapov Aug. 5, 2012, 2:43 p.m. UTC | #4
On Sun, Aug 05, 2012 at 05:39:33PM +0300, Avi Kivity wrote:
> On 08/05/2012 05:17 PM, Gleb Natapov wrote:
> > On Sun, Aug 05, 2012 at 05:14:59PM +0300, Avi Kivity wrote:
> >> On 08/05/2012 03:58 PM, Gleb Natapov wrote:
> >> > According to SDM apic is enabled on start up.
> >> > 
> >> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> >> > ---
> >> >  arch/x86/kvm/lapic.c |    3 ++-
> >> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >> > 
> >> > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> >> > index 49f4ac0..c3f14fe 100644
> >> > --- a/arch/x86/kvm/lapic.c
> >> > +++ b/arch/x86/kvm/lapic.c
> >> > @@ -1311,7 +1311,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu)
> >> >  		     HRTIMER_MODE_ABS);
> >> >  	apic->lapic_timer.timer.function = apic_timer_fn;
> >> >  
> >> > -	kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE);
> >> > +	kvm_lapic_set_base(vcpu,
> >> > +			APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE);
> >> >  
> >> 
> >> I'm guessing that in practice this is a no-op since qemu reset involves
> >> programming this MSR.
> >> 
> > Qemu is not the only userspace :) But this is here to avoid unneeded
> > jump label patching truth to be told.
> 
> It's also correct, otherwise it wouldn't be here.
> 
Of course.

> But won't the patching happen anyway? since it starts software disabled?
> 
Yes, but different label, so less patching.

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 49f4ac0..c3f14fe 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1311,7 +1311,8 @@  int kvm_create_lapic(struct kvm_vcpu *vcpu)
 		     HRTIMER_MODE_ABS);
 	apic->lapic_timer.timer.function = apic_timer_fn;
 
-	kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE);
+	kvm_lapic_set_base(vcpu,
+			APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE);
 
 	kvm_lapic_reset(vcpu);
 	kvm_iodevice_init(&apic->dev, &apic_mmio_ops);