From: Kevin O'Connor <kevin@koconnor.net>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, anthony.xu@intel.com
Subject: Re: [Qemu-devel] [PATCH] target/i386: enable A20 automatically in system management mode
Date: Thu, 11 May 2017 12:34:47 -0400 [thread overview]
Message-ID: <20170511163447.GA7785@morn.lan> (raw)
In-Reply-To: <618febcf-af6d-5fc6-0274-4f64c53f9763@redhat.com>
On Thu, May 11, 2017 at 05:32:47PM +0200, Paolo Bonzini wrote:
> On 11/05/2017 16:53, Kevin O'Connor wrote:
> > On Thu, May 11, 2017 at 01:35:28PM +0200, Paolo Bonzini wrote:
> >> Ignore env->a20_mask when running in system management mode.
> >
> > Thanks Paolo. I don't think this patch will help SeaBIOS though. The
> > SeaBIOS SMM handler doesn't do much - it doesn't even access ram above
> > 1MiB. See SeaBIOS' code in src/fw/smm.c:handle_smi().
> >
> > Instead, the SeaBIOS code does a cpu state backup/restore to switch
> > into 32bit mode. I thought the A20 state would be part of that cpu
> > backup/restore. However, looking at the Intel SDM docs now, it's not
> > really clear to me how the processor "inhibits" A20 when in SMM mode -
> > does it save/restore that state on SMI/RSM or does it have special
> > logic to ignore A20 while in SMM mode?
>
> There isn't any documented place for A20 in the state save map (I checked
> AMD's BIOS/Kernel Developer Guide which is pretty comprehensive), so I
> think the latter is more plausible. What I'm doing in this patch is
> ignoring A20 while in SMM mode.
Okay.
> Then you would have to add an A20 save/restore in handle_smi; since
> CALL32SMM_ENTERID should not nest, I think you can just do this:
Yes, that should be fine.
> --- a/src/fw/smm.c
> +++ b/src/fw/smm.c
> @@ -54,7 +54,8 @@ struct smm_layout {
> struct smm_state backup2;
> u8 stack[0x7c00];
> u64 codeentry;
> - u8 pad_8008[0x7df8];
> + u8 a20;
> + u8 pad_8009[0x7df7];
> struct smm_state cpu;
> };
In order to avoid mixing code and data in the same cache line we could
do this instead:
struct smm_layout {
struct smm_state backup1;
struct smm_state backup2;
- u8 stack[0x7c00];
+ u32 backup_a20;
+ u8 stack[0x8000 - sizeof(struct smm_state)*2 - sizeof(u32)];
u64 codeentry;
u8 pad_8008[0x7df8];
struct smm_state cpu;
Thanks,
-Kevin
next prev parent reply other threads:[~2017-05-11 16:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-11 11:35 [Qemu-devel] [PATCH] target/i386: enable A20 automatically in system management mode Paolo Bonzini
2017-05-11 11:41 ` no-reply
2017-05-11 11:58 ` no-reply
2017-05-11 14:53 ` Kevin O'Connor
2017-05-11 15:32 ` Paolo Bonzini
2017-05-11 16:34 ` Kevin O'Connor [this message]
2017-05-11 23:55 ` Xu, Anthony
2017-05-12 12:16 ` Paolo Bonzini
2017-05-12 18:55 ` Xu, Anthony
2017-05-12 19:16 ` Paolo Bonzini
2017-05-12 19:38 ` Kevin O'Connor
2017-05-12 23:19 ` Xu, Anthony
2017-05-13 0:01 ` Kevin O'Connor
2017-05-13 1:24 ` Xu, Anthony
2017-05-16 16:24 ` Kevin O'Connor
2017-05-16 20:00 ` Xu, Anthony
2017-05-16 21:42 ` Kevin O'Connor
2017-05-16 22:39 ` Xu, Anthony
2017-05-17 8:18 ` Paolo Bonzini
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=20170511163447.GA7785@morn.lan \
--to=kevin@koconnor.net \
--cc=anthony.xu@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.