xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH] x86/boot: Fix BIOS memory corruption on certain IBM systems
Date: Wed, 4 Dec 2013 10:35:34 +0000	[thread overview]
Message-ID: <529F0576.8050606@citrix.com> (raw)
In-Reply-To: <529F0BF60200007800109E0C@nat28.tlf.novell.com>

On 04/12/13 10:03, Jan Beulich wrote:
>>>> On 03.12.13 at 21:34, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/arch/x86/boot/trampoline.S
>> +++ b/xen/arch/x86/boot/trampoline.S
>> @@ -140,10 +140,12 @@ trampoline_boot_cpu_entry:
>>  1:      mov     %cs,%ax
>>          mov     %ax,%ds
>>          mov     %ax,%es
>> +        mov     %ax,%fs
>> +        mov     %ax,%gs
>>          mov     %ax,%ss
>>  
>>          /* Initialise stack pointer and IDT, and enable irqs. */
>> -        xor     %sp,%sp
>> +        xor     %esp,%esp
> According to your findings this one line change is really all that's
> needed.

I believe this to be the case, yes.

>  While I may be willing to accept the setting of %fs and
> %gs, despite them being set to BOOT_PSEUDORM_DS right
> before leaving protected mode (albeit I think it would be better
> to clear them than to make them match %cs), ...

The set to BOOT_PSEUDORM_DS in 32bit mode is quite pointless, as they
are never used and reloaded moments later in 16bit mode.  I have already
queued it up in my Xen-4.5 improvements series to the early boot code
which I have been collecting while debugging this issue.

>
>> @@ -151,6 +153,11 @@ trampoline_boot_cpu_entry:
>>           * Declare that our target operating mode is long mode.
>>           * Initialise 32-bit registers since some buggy BIOSes depend on it.
>>           */
>> +        xor     %ecx,%ecx
>> +        xor     %edx,%edx
>> +        xor     %esi,%esi
>> +        xor     %edi,%edi
>> +        xor     %ebp,%ebp
>>          movl    $0xec00,%eax      # declare target operating mode
>>          movl    $0x0002,%ebx      # long mode
>>          int     $0x15
> ... I can't really see the value of the change here: If we're to
> work around theoretical BIOS bugs, we'd need to do this prior to
> each BIOS call. That's surely overkill. Therefore let's focus on
> what is needed to work around _known_ BIOS bugs.
>
> Jan
>

I admit that I was leaning on the cautious side with these changes.

I can take them out if you think that would be better, but given this
int was already flagged as buggy in some BIOSes, and we have found
another case, I think covering all GPRs is the safer option.

~Andrew

  reply	other threads:[~2013-12-04 10:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 20:34 [PATCH] x86/boot: Fix BIOS memory corruption on certain IBM systems Andrew Cooper
2013-12-04  7:17 ` Keir Fraser
2013-12-04 10:03 ` Jan Beulich
2013-12-04 10:35   ` Andrew Cooper [this message]
2013-12-04 10:47     ` Jan Beulich
2013-12-04 18:59       ` Keir Fraser
2013-12-04 10:09 ` George Dunlap

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=529F0576.8050606@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).