kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: Nadav Amit <nadav.amit@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH] x86: Reset lapic after boot
Date: Wed, 26 Jun 2019 17:26:14 -0700	[thread overview]
Message-ID: <9df90756-003e-0c0f-984e-07293fdc2eb1@oracle.com> (raw)
In-Reply-To: <20190625121042.8957-1-nadav.amit@gmail.com>


On 6/25/19 5:10 AM, Nadav Amit wrote:
> Do not assume that the local APIC is in a xAPIC mode after reset.
> Instead reset it first, since it might be in x2APIC mode, from which a
> transition in xAPIC is invalid.
>
> Note that we do not use the existing disable_apic() for the matter,
> since it also re-initializes apic_ops.


Is there any issue if apic_ops is reset ?


>
> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>   x86/cstart64.S | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/x86/cstart64.S b/x86/cstart64.S
> index 9791282..03726a6 100644
> --- a/x86/cstart64.S
> +++ b/x86/cstart64.S
> @@ -118,6 +118,15 @@ MSR_GS_BASE = 0xc0000101
>   	wrmsr
>   .endm
>   
> +lapic_reset:
> +	mov $0x1b, %ecx


Why not use MSR_IA32_APICBASE instead of 0x1b ?


> +	rdmsr
> +	and $~(APIC_EN | APIC_EXTD), %eax
> +	wrmsr
> +	or $(APIC_EN), %eax
> +	wrmsr
> +	ret
> +
>   .macro setup_segments
>   	mov $MSR_GS_BASE, %ecx
>   	rdmsr
> @@ -228,6 +237,7 @@ save_id:
>   	retq
>   
>   ap_start64:
> +	call lapic_reset
>   	call load_tss
>   	call enable_apic
>   	call save_id
> @@ -240,6 +250,7 @@ ap_start64:
>   	jmp 1b
>   
>   start64:
> +	call lapic_reset
>   	call load_tss
>   	call mask_pic_interrupts
>   	call enable_apic

  reply	other threads:[~2019-06-27  0:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 12:10 [kvm-unit-tests PATCH] x86: Reset lapic after boot Nadav Amit
2019-06-27  0:26 ` Krish Sadhukhan [this message]
2019-06-27 17:09   ` Nadav Amit
2019-06-27 17:47   ` Nadav Amit

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=9df90756-003e-0c0f-984e-07293fdc2eb1@oracle.com \
    --to=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=nadav.amit@gmail.com \
    --cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).