qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target/i386: enable A20 automatically in system


From: Xu, Anthony
Subject: Re: [Qemu-devel] [PATCH] target/i386: enable A20 automatically in system management mode
Date: Sat, 13 May 2017 01:24:30 +0000

> -----Original Message-----
> From: Kevin O'Connor [mailto:address@hidden
> Sent: Friday, May 12, 2017 5:02 PM
> To: Xu, Anthony <address@hidden>
> Cc: Paolo Bonzini <address@hidden>; address@hidden
> Subject: Re: [PATCH] target/i386: enable A20 automatically in system
> management mode
> 
> On Fri, May 12, 2017 at 11:19:00PM +0000, Xu, Anthony wrote:
> > > SeaBIOS defaults to enabling A20 and it's a rare beast that disables
> > > it.  One could change x86.h:set_a20 and romlayout.S:transition32 to
> > > only issue the outb() if the inb() indicates a change is needed.  That
> > > would likely eliminate half the accesses.
> >
> > The 350 port 92 access is for write operation only.
> > If include the inb(), it would be 700, and every time it actually has a 
> > change
> > To be precise, It is about 175 switches from 32 bit to 16 bit, then back to 
> > 32
> bit.
> > call16 is called 175 times during Seabios boot without any option rom,
> > It would be more if some option roms are included.
> >
> >
> > I think A20 is disabled by default in SeaBios.
> 
> I don't know why you think that.  One can check with:
> 
> --- a/src/stacks.c
> +++ b/src/stacks.c
> @@ -99,6 +99,8 @@ call32_post(void)
>          if (cr0_caching)
>              cr0_mask(CR0_CD|CR0_NW, cr0_caching);
>      }
> +    if (!get_a20())
> +        dprintf(1, "a20=0\n");
> 
>      // Restore cmos index register
>      outb(GET_LOW(Call16Data.cmosindex), PORT_CMOS_INDEX);
> 
> With the above I only see a handful of cases where SeaBIOS has to
> restore a20 to a disabled state.

I think it is related to accel and platform, the result I gave before is for 
q35 tcg,

With the above change,   I got below data

Platform        accel           count of restoring A20 to 0
Q35             kvm             96
Q35             tcg             271
PC              kvm             3
PC              tcg             3

A lot of A20 restoring happen when SeaBIOS scans AHCI links.


> 
> The handful I do see are due to cases where yield() is called prior to
> option rom initialization.  Those handful are eliminated for me with
> the following fix:
> 
> --- a/src/stacks.c
> +++ b/src/stacks.c
> @@ -496,6 +496,7 @@ void
>  thread_setup(void)
>  {
>      CanInterrupt = 1;
> +    call16_override(1);
>      if (! CONFIG_THREADS)
>          return;
>      ThreadControl = romfile_loadint("etc/threads", 1);

But I still see a lot of PORT_A20 accesses in QEMU as I expected


> 
> What OS / bootloader are you running?

/x86_64-softmmu/qemu-system-x86_64 -bios /home/root/git/seabios/out/bios.bin 
-smp 1 
-machine q35,accel=tcg -m 1G -drive 
format=raw,file=/home/root/images/centos7.2.img,if=ide,index=0 
-nographic  -nodefaults  -serial stdio -monitor pty

-Anthony



reply via email to

[Prev in Thread] Current Thread [Next in Thread]