Patchwork Re: EFI console stopped working in Qemu 0.14.0

login
register
mail settings
Submitter vagran
Date March 3, 2011, 6:43 a.m.
Message ID <4D6F387F.2000505@gmail.com>
Download mbox | patch
Permalink /patch/85236/
State New
Headers show

Comments

vagran - March 3, 2011, 6:43 a.m.
I am using TianoCore EFI by Tristan Gingold which is published
on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
see nothing on VGA display or serial console. But it still will be
able to load OS after timeout if you have proper disk image.
> It seems your EFI BIOS doesn't enable memor, io or master bits
> in command register.
>   
>
> or disableintx.
>   
I have checked your guess and figured out that it works only
if both memory and io bits are not cleared. So the following
patch also works:
                                  pci_get_word(dev->w1cmask + PCI_STATUS));

So probably the problem is in EFI BIOS. But I was not able to find
its source code. Anyone knows how is it built?

Best regards,
Artyom.


Isaku Yamahata wrote:
> On Thu, Mar 03, 2011 at 12:03:53PM +0900, Isaku Yamahata wrote:
>   
>> Hi. Thank you for reporting.
>> Can you elaborate on the changeset that you pointed out and
>> your work around?
>>
>> Regarding to the changeset, it had the issue, but I suppose
>> 80376c3fc2c38fdd45354e4b0eb45031f35587ed fixed it.
>> Do you found any other issue?
>>
>> Regarding to your workaround, what was the problem?
>> What EFI BIOS are you using? Tiano-core derivatives that
>> Tristan Gingold worked on? Or other one?
>> It seems your EFI BIOS doesn't enable memor, io or master bits
>> in command register.
>>     
>
> or disableintx.
>
>   
>> If so, the issue is in the bios, not qemu.
>>
>> thanks,
>>
>> On Wed, Mar 02, 2011 at 11:27:31PM +0200, vagran wrote:
>>     
>>> vagran wrote:
>>>       
>>>> Hi,
>>>> I have noted that Qemu VGA and serial console with EFI BIOS stopped  
>>>> working in
>>>> 0.14.0 (and in latest development snapshot is still not working).  
>>>> Everything was
>>>> fine in 0.13.0. However EFI BIOS itself is able to load kernel if it was
>>>> properly configured on used disk image. The only effect is that  
>>>> neither VGA nor
>>>> serial console is not functioning. After short investigation I have  
>>>> discovered
>>>> that this functionality was broken by this commit:
>>>>
>>>> commit 9bb3358627d87d8de25fb41b7276575539d799a7
>>>> Author: Isaku Yamahata <yamahata@valinux.co.jp>
>>>> Date:   Fri Nov 19 18:56:02 2010 +0900
>>>>
>>>> Do you have any idea how this change could affect EFI consoles?
>>>>
>>>>         
>>> After further investigation I have found that the following patch provides
>>> a workaround for the problem, may be it could be useful for somebody who
>>> is more familiar with Qemu PCI code:
>>>
>>> diff --git a/hw/pci.c b/hw/pci.c
>>> index 8b76cea..06dd7ab 100644
>>> --- a/hw/pci.c
>>> +++ b/hw/pci.c
>>> @@ -162,9 +162,11 @@ void pci_device_reset(PCIDevice *dev)
>>>     pci_update_irq_status(dev);
>>>     pci_device_deassert_intx(dev);
>>>     /* Clear all writeable bits */
>>> +#if 0
>>>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
>>>                                  pci_get_word(dev->wmask + PCI_COMMAND) |
>>>                                  pci_get_word(dev->w1cmask + PCI_COMMAND));
>>> +#endif
>>>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
>>>                                  pci_get_word(dev->wmask + PCI_STATUS) |
>>>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
>>>
>>> Best regards,
>>> Artyom.
>>>
>>>       
>> -- 
>> yamahata
>>
>>
Isaku Yamahata - March 3, 2011, 7:38 a.m.
On Thu, Mar 03, 2011 at 08:43:11AM +0200, vagran wrote:
> I am using TianoCore EFI by Tristan Gingold which is published
> on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
> to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
> see nothing on VGA display or serial console. But it still will be
> able to load OS after timeout if you have proper disk image.

Thank you for the info. Then I can also test it locally.

thanks,

>> It seems your EFI BIOS doesn't enable memor, io or master bits
>> in command register.
>>   
>>
>> or disableintx.
>>   
> I have checked your guess and figured out that it works only
> if both memory and io bits are not cleared. So the following
> patch also works:
> diff --git a/hw/pci.c b/hw/pci.c
> index 8b76cea..bcf9b16 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -163,8 +163,9 @@ void pci_device_reset(PCIDevice *dev)
>     pci_device_deassert_intx(dev);
>     /* Clear all writeable bits */
>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
> -                                 pci_get_word(dev->wmask + PCI_COMMAND) |
> -                                 pci_get_word(dev->w1cmask + PCI_COMMAND));
> +                                 (pci_get_word(dev->wmask + PCI_COMMAND) |
> +                                 pci_get_word(dev->w1cmask +  
> PCI_COMMAND)) &
> +                                 ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
>                                  pci_get_word(dev->wmask + PCI_STATUS) |
>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
>
> So probably the problem is in EFI BIOS. But I was not able to find
> its source code. Anyone knows how is it built?
>
> Best regards,
> Artyom.
>
>
> Isaku Yamahata wrote:
>> On Thu, Mar 03, 2011 at 12:03:53PM +0900, Isaku Yamahata wrote:
>>   
>>> Hi. Thank you for reporting.
>>> Can you elaborate on the changeset that you pointed out and
>>> your work around?
>>>
>>> Regarding to the changeset, it had the issue, but I suppose
>>> 80376c3fc2c38fdd45354e4b0eb45031f35587ed fixed it.
>>> Do you found any other issue?
>>>
>>> Regarding to your workaround, what was the problem?
>>> What EFI BIOS are you using? Tiano-core derivatives that
>>> Tristan Gingold worked on? Or other one?
>>> It seems your EFI BIOS doesn't enable memor, io or master bits
>>> in command register.
>>>     
>>
>> or disableintx.
>>
>>   
>>> If so, the issue is in the bios, not qemu.
>>>
>>> thanks,
>>>
>>> On Wed, Mar 02, 2011 at 11:27:31PM +0200, vagran wrote:
>>>     
>>>> vagran wrote:
>>>>       
>>>>> Hi,
>>>>> I have noted that Qemu VGA and serial console with EFI BIOS 
>>>>> stopped  working in
>>>>> 0.14.0 (and in latest development snapshot is still not working). 
>>>>>  Everything was
>>>>> fine in 0.13.0. However EFI BIOS itself is able to load kernel if it was
>>>>> properly configured on used disk image. The only effect is that   
>>>>> neither VGA nor
>>>>> serial console is not functioning. After short investigation I 
>>>>> have  discovered
>>>>> that this functionality was broken by this commit:
>>>>>
>>>>> commit 9bb3358627d87d8de25fb41b7276575539d799a7
>>>>> Author: Isaku Yamahata <yamahata@valinux.co.jp>
>>>>> Date:   Fri Nov 19 18:56:02 2010 +0900
>>>>>
>>>>> Do you have any idea how this change could affect EFI consoles?
>>>>>
>>>>>         
>>>> After further investigation I have found that the following patch provides
>>>> a workaround for the problem, may be it could be useful for somebody who
>>>> is more familiar with Qemu PCI code:
>>>>
>>>> diff --git a/hw/pci.c b/hw/pci.c
>>>> index 8b76cea..06dd7ab 100644
>>>> --- a/hw/pci.c
>>>> +++ b/hw/pci.c
>>>> @@ -162,9 +162,11 @@ void pci_device_reset(PCIDevice *dev)
>>>>     pci_update_irq_status(dev);
>>>>     pci_device_deassert_intx(dev);
>>>>     /* Clear all writeable bits */
>>>> +#if 0
>>>>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
>>>>                                  pci_get_word(dev->wmask + PCI_COMMAND) |
>>>>                                  pci_get_word(dev->w1cmask + PCI_COMMAND));
>>>> +#endif
>>>>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
>>>>                                  pci_get_word(dev->wmask + PCI_STATUS) |
>>>>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
>>>>
>>>> Best regards,
>>>> Artyom.
>>>>
>>>>       
>>> -- 
>>> yamahata
>>>
>>>     
>
Isaku Yamahata - March 3, 2011, 7:46 a.m.
Seabios has the patch to address the similar issue with
the changeset of b82a1e49fc0e72fb9bf1a642d6aa707345b0f398,
which enables memory/io unconditionally.

I suppose the EFI bios is very old so that it has the same issue.
I think the following file is the one to modify.

efi-vfirmware.hg/edk2-sparse/EdkQemuPkg/Pei/BochsPciScan/BochsPciScan.c

thanks,

On Thu, Mar 03, 2011 at 08:43:11AM +0200, vagran wrote:
> I am using TianoCore EFI by Tristan Gingold which is published
> on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
> to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
> see nothing on VGA display or serial console. But it still will be
> able to load OS after timeout if you have proper disk image.
>> It seems your EFI BIOS doesn't enable memor, io or master bits
>> in command register.
>>   
>>
>> or disableintx.
>>   
> I have checked your guess and figured out that it works only
> if both memory and io bits are not cleared. So the following
> patch also works:
> diff --git a/hw/pci.c b/hw/pci.c
> index 8b76cea..bcf9b16 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -163,8 +163,9 @@ void pci_device_reset(PCIDevice *dev)
>     pci_device_deassert_intx(dev);
>     /* Clear all writeable bits */
>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
> -                                 pci_get_word(dev->wmask + PCI_COMMAND) |
> -                                 pci_get_word(dev->w1cmask + PCI_COMMAND));
> +                                 (pci_get_word(dev->wmask + PCI_COMMAND) |
> +                                 pci_get_word(dev->w1cmask +  
> PCI_COMMAND)) &
> +                                 ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
>                                  pci_get_word(dev->wmask + PCI_STATUS) |
>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
>
> So probably the problem is in EFI BIOS. But I was not able to find
> its source code. Anyone knows how is it built?
>
> Best regards,
> Artyom.
>
>
> Isaku Yamahata wrote:
>> On Thu, Mar 03, 2011 at 12:03:53PM +0900, Isaku Yamahata wrote:
>>   
>>> Hi. Thank you for reporting.
>>> Can you elaborate on the changeset that you pointed out and
>>> your work around?
>>>
>>> Regarding to the changeset, it had the issue, but I suppose
>>> 80376c3fc2c38fdd45354e4b0eb45031f35587ed fixed it.
>>> Do you found any other issue?
>>>
>>> Regarding to your workaround, what was the problem?
>>> What EFI BIOS are you using? Tiano-core derivatives that
>>> Tristan Gingold worked on? Or other one?
>>> It seems your EFI BIOS doesn't enable memor, io or master bits
>>> in command register.
>>>     
>>
>> or disableintx.
>>
>>   
>>> If so, the issue is in the bios, not qemu.
>>>
>>> thanks,
>>>
>>> On Wed, Mar 02, 2011 at 11:27:31PM +0200, vagran wrote:
>>>     
>>>> vagran wrote:
>>>>       
>>>>> Hi,
>>>>> I have noted that Qemu VGA and serial console with EFI BIOS 
>>>>> stopped  working in
>>>>> 0.14.0 (and in latest development snapshot is still not working). 
>>>>>  Everything was
>>>>> fine in 0.13.0. However EFI BIOS itself is able to load kernel if it was
>>>>> properly configured on used disk image. The only effect is that   
>>>>> neither VGA nor
>>>>> serial console is not functioning. After short investigation I 
>>>>> have  discovered
>>>>> that this functionality was broken by this commit:
>>>>>
>>>>> commit 9bb3358627d87d8de25fb41b7276575539d799a7
>>>>> Author: Isaku Yamahata <yamahata@valinux.co.jp>
>>>>> Date:   Fri Nov 19 18:56:02 2010 +0900
>>>>>
>>>>> Do you have any idea how this change could affect EFI consoles?
>>>>>
>>>>>         
>>>> After further investigation I have found that the following patch provides
>>>> a workaround for the problem, may be it could be useful for somebody who
>>>> is more familiar with Qemu PCI code:
>>>>
>>>> diff --git a/hw/pci.c b/hw/pci.c
>>>> index 8b76cea..06dd7ab 100644
>>>> --- a/hw/pci.c
>>>> +++ b/hw/pci.c
>>>> @@ -162,9 +162,11 @@ void pci_device_reset(PCIDevice *dev)
>>>>     pci_update_irq_status(dev);
>>>>     pci_device_deassert_intx(dev);
>>>>     /* Clear all writeable bits */
>>>> +#if 0
>>>>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
>>>>                                  pci_get_word(dev->wmask + PCI_COMMAND) |
>>>>                                  pci_get_word(dev->w1cmask + PCI_COMMAND));
>>>> +#endif
>>>>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
>>>>                                  pci_get_word(dev->wmask + PCI_STATUS) |
>>>>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
>>>>
>>>> Best regards,
>>>> Artyom.
>>>>
>>>>       
>>> -- 
>>> yamahata
>>>
>>>     
>
Isaku Yamahata - March 3, 2011, 7:48 a.m.
Added CC to Tristan. I doubt that he is still interested in EFI, though.

On Thu, Mar 03, 2011 at 04:46:34PM +0900, Isaku Yamahata wrote:
> 
> Seabios has the patch to address the similar issue with
> the changeset of b82a1e49fc0e72fb9bf1a642d6aa707345b0f398,
> which enables memory/io unconditionally.
> 
> I suppose the EFI bios is very old so that it has the same issue.
> I think the following file is the one to modify.
> 
> efi-vfirmware.hg/edk2-sparse/EdkQemuPkg/Pei/BochsPciScan/BochsPciScan.c
> 
> thanks,
> 
> On Thu, Mar 03, 2011 at 08:43:11AM +0200, vagran wrote:
> > I am using TianoCore EFI by Tristan Gingold which is published
> > on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
> > to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
> > see nothing on VGA display or serial console. But it still will be
> > able to load OS after timeout if you have proper disk image.
> >> It seems your EFI BIOS doesn't enable memor, io or master bits
> >> in command register.
> >>   
> >>
> >> or disableintx.
> >>   
> > I have checked your guess and figured out that it works only
> > if both memory and io bits are not cleared. So the following
> > patch also works:
> > diff --git a/hw/pci.c b/hw/pci.c
> > index 8b76cea..bcf9b16 100644
> > --- a/hw/pci.c
> > +++ b/hw/pci.c
> > @@ -163,8 +163,9 @@ void pci_device_reset(PCIDevice *dev)
> >     pci_device_deassert_intx(dev);
> >     /* Clear all writeable bits */
> >     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
> > -                                 pci_get_word(dev->wmask + PCI_COMMAND) |
> > -                                 pci_get_word(dev->w1cmask + PCI_COMMAND));
> > +                                 (pci_get_word(dev->wmask + PCI_COMMAND) |
> > +                                 pci_get_word(dev->w1cmask +  
> > PCI_COMMAND)) &
> > +                                 ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
> >     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
> >                                  pci_get_word(dev->wmask + PCI_STATUS) |
> >                                  pci_get_word(dev->w1cmask + PCI_STATUS));
> >
> > So probably the problem is in EFI BIOS. But I was not able to find
> > its source code. Anyone knows how is it built?
> >
> > Best regards,
> > Artyom.
> >
> >
> > Isaku Yamahata wrote:
> >> On Thu, Mar 03, 2011 at 12:03:53PM +0900, Isaku Yamahata wrote:
> >>   
> >>> Hi. Thank you for reporting.
> >>> Can you elaborate on the changeset that you pointed out and
> >>> your work around?
> >>>
> >>> Regarding to the changeset, it had the issue, but I suppose
> >>> 80376c3fc2c38fdd45354e4b0eb45031f35587ed fixed it.
> >>> Do you found any other issue?
> >>>
> >>> Regarding to your workaround, what was the problem?
> >>> What EFI BIOS are you using? Tiano-core derivatives that
> >>> Tristan Gingold worked on? Or other one?
> >>> It seems your EFI BIOS doesn't enable memor, io or master bits
> >>> in command register.
> >>>     
> >>
> >> or disableintx.
> >>
> >>   
> >>> If so, the issue is in the bios, not qemu.
> >>>
> >>> thanks,
> >>>
> >>> On Wed, Mar 02, 2011 at 11:27:31PM +0200, vagran wrote:
> >>>     
> >>>> vagran wrote:
> >>>>       
> >>>>> Hi,
> >>>>> I have noted that Qemu VGA and serial console with EFI BIOS 
> >>>>> stopped  working in
> >>>>> 0.14.0 (and in latest development snapshot is still not working). 
> >>>>>  Everything was
> >>>>> fine in 0.13.0. However EFI BIOS itself is able to load kernel if it was
> >>>>> properly configured on used disk image. The only effect is that   
> >>>>> neither VGA nor
> >>>>> serial console is not functioning. After short investigation I 
> >>>>> have  discovered
> >>>>> that this functionality was broken by this commit:
> >>>>>
> >>>>> commit 9bb3358627d87d8de25fb41b7276575539d799a7
> >>>>> Author: Isaku Yamahata <yamahata@valinux.co.jp>
> >>>>> Date:   Fri Nov 19 18:56:02 2010 +0900
> >>>>>
> >>>>> Do you have any idea how this change could affect EFI consoles?
> >>>>>
> >>>>>         
> >>>> After further investigation I have found that the following patch provides
> >>>> a workaround for the problem, may be it could be useful for somebody who
> >>>> is more familiar with Qemu PCI code:
> >>>>
> >>>> diff --git a/hw/pci.c b/hw/pci.c
> >>>> index 8b76cea..06dd7ab 100644
> >>>> --- a/hw/pci.c
> >>>> +++ b/hw/pci.c
> >>>> @@ -162,9 +162,11 @@ void pci_device_reset(PCIDevice *dev)
> >>>>     pci_update_irq_status(dev);
> >>>>     pci_device_deassert_intx(dev);
> >>>>     /* Clear all writeable bits */
> >>>> +#if 0
> >>>>     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
> >>>>                                  pci_get_word(dev->wmask + PCI_COMMAND) |
> >>>>                                  pci_get_word(dev->w1cmask + PCI_COMMAND));
> >>>> +#endif
> >>>>     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
> >>>>                                  pci_get_word(dev->wmask + PCI_STATUS) |
> >>>>                                  pci_get_word(dev->w1cmask + PCI_STATUS));
> >>>>
> >>>> Best regards,
> >>>> Artyom.
> >>>>
> >>>>       
> >>> -- 
> >>> yamahata
> >>>
> >>>     
> >
> 
> -- 
> yamahata
>
Tristan Gingold - March 3, 2011, 8:20 a.m.
On Mar 3, 2011, at 7:43 AM, vagran wrote:

> I am using TianoCore EFI by Tristan Gingold which is published
> on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
> to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
> see nothing on VGA display or serial console. But it still will be
> able to load OS after timeout if you have proper disk image.

This is very old work...  AFAIK, tianocore can now produce a binary that work on qemu.  You'd better to switch to it.

Tristan.
vagran - March 3, 2011, 6:02 p.m.
I have taken EFI BIOS image from 
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF
32-bit version works perfectly. However 64-bit version for some reason 
doesn't work on
qemu-system-x86_64. But anyway, it is enough for me. Thank you.

Best regards,
Artyom.

Tristan Gingold wrote:
> On Mar 3, 2011, at 7:43 AM, vagran wrote:
>
>   
>> I am using TianoCore EFI by Tristan Gingold which is published
>> on http://wiki.qemu.org/download/efi-bios.tar.bz2. If you would try
>> to load it on Qemu 0.14.0 (built either for i386 or x86_64) you will
>> see nothing on VGA display or serial console. But it still will be
>> able to load OS after timeout if you have proper disk image.
>>     
>
> This is very old work...  AFAIK, tianocore can now produce a binary that work on qemu.  You'd better to switch to it.
>
> Tristan.
>
>
Jordan Justen - March 6, 2011, 3:35 a.m.
On Thu, Mar 3, 2011 at 10:02, vagran <vagran.ast@gmail.com> wrote:
> I have taken EFI BIOS image from
> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF
> 32-bit version works perfectly. However 64-bit version for some reason
> doesn't work on
> qemu-system-x86_64.

Hi.  I was wondering if you could describe the OVMF issue you saw with
qemu-system-x86_64.

I tried 0.14.0 with OVMF X64 (r11337), and it was able to boot to the EFI shell.

I did see an issue while booting the 64-bit Ubuntu 10.10 live-cd, but
occurred on both the legacy (seabios) and uefi (ovmf) firmware.  With
kvm 0.14.0, in both cases the OS boots most of the way, but the
graphics do not start properly when X starts.

Thanks,

-Jordan
vagran - March 6, 2011, 10:10 a.m.
When I trying to specify 64-bit EFI BIOS nothing happens on VGA
nor serial console. It seems that CPU is continuously restarting.

Build and host system is Ubuntu 9.10:
Linux AST-mobile 2.6.31-22-generic-pae #73-Ubuntu SMP Fri Feb 11 
18:39:01 UTC 2011 i686 GNU/Linux

Qemu 0.14.0 was built with the following configuration options:
../src/configure --prefix=$PREFIX --target-list=x86_64-softmmu 
--source-path=../src --enable-kvm
--extra-cflags=-I$PREFIX/include --extra-ldflags=-L$PREFIX/lib

And launched:
qemu-system-x86_64 -L $PHOBOS_PREFIX/share/qemu/phobos64 -bios OVMF.fd 
-m 768 -cpu core2duo
-vga cirrus -monitor stdio -serial tcp::666,server -s -hdb 
$PHOBOS_PREFIX/share/qemu/phobos.disk -usb -enable-kvm

OVMF X64 is r11337.

"log cpu_reset" provides this information (continuously in a loop):
CPU Reset (CPU 0)
EAX=00000100 EBX=fffee0e4 ECX=c0000080 EDX=00000000
ESI=fffee2c4 EDI=00005042 EBP=fffee000 ESP=00000000
EIP=ffffff21 EFL=00010082 [--S----] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
CS =0010 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA]
SS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
DS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
FS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
GS =0008 00000000 ffffffff 00c09300 DPL=0 DS   [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT=     ffffff80 0000001f
IDT=     00000000 0000ffff
CR0=40000023 CR2=00000000 CR3=ffffe000 CR4=00000660
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 
DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
CCS=00000000 CCD=00000000 CCO=DYNAMIC
EFER=0000000000000000
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00000000
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 
XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 
XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 
XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 
XMM07=00000000000000000000000000000000

Best regards,
Artyom.

Jordan Justen wrote:
> On Thu, Mar 3, 2011 at 10:02, vagran <vagran.ast@gmail.com> wrote:
>   
>> I have taken EFI BIOS image from
>> http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF
>> 32-bit version works perfectly. However 64-bit version for some reason
>> doesn't work on
>> qemu-system-x86_64.
>>     
>
> Hi.  I was wondering if you could describe the OVMF issue you saw with
> qemu-system-x86_64.
>
> I tried 0.14.0 with OVMF X64 (r11337), and it was able to boot to the EFI shell.
>
> I did see an issue while booting the 64-bit Ubuntu 10.10 live-cd, but
> occurred on both the legacy (seabios) and uefi (ovmf) firmware.  With
> kvm 0.14.0, in both cases the OS boots most of the way, but the
> graphics do not start properly when X starts.
>
> Thanks,
>
> -Jordan
>
vagran - March 6, 2011, 9:26 p.m.
>
> Hey, can you tell me about $PHOBOS_PREFIX/share/qemu/phobos64?  Does
> it have an alternative vgabios-cirrus.bin?  Is the contents of this
> directory available publicly?
I have followed the instructions "How to run OVMF". This directory has
the contents of OVMF package - "OVMF.fd" and "vgabios-cirrus.bin" which
is renamed "CirrusLogic5446.rom". Also it has "pxe-e1000.bin" copied from
"$PHOBOS_PREFIX/share/qemu".
> Can you try disabling KVM?
>   
Yes, it helped. Problem exists only when using KVM. Thanks.

Best regards,
Artyom.

Jordan Justen wrote:
> On Sun, Mar 6, 2011 at 02:10, vagran <vagran.ast@gmail.com> wrote:
>   
>> And launched:
>> qemu-system-x86_64 -L $PHOBOS_PREFIX/share/qemu/phobos64 -bios OVMF.fd -m
>> 768 -cpu core2duo
>> -vga cirrus -monitor stdio -serial tcp::666,server -s -hdb
>> $PHOBOS_PREFIX/share/qemu/phobos.disk -usb -enable-kvm
>>     
>
> Hey, can you tell me about $PHOBOS_PREFIX/share/qemu/phobos64?  Does
> it have an alternative vgabios-cirrus.bin?  Is the contents of this
> directory available publicly?
>
> Does it work if you follow these steps?
> https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_run_OVMF
>
> Can you try disabling KVM?
>
> If you try the "-d in_asm" option (while KVM is disabled), do you see
> the reset loop happen in the /tmp/qemu.log file?
>
> Thanks for your time,
>
> -Jordan
>
Jordan Justen - March 6, 2011, 11:36 p.m.
On Sun, Mar 6, 2011 at 13:26, vagran <vagran.ast@gmail.com> wrote:
> > Can you try disabling KVM?
>
> Yes, it helped. Problem exists only when using KVM. Thanks.

One thing I suspect is that the kernel side of kvm had an issue around
this time (Ubuntu 9.10) with a bios.bin larger than 256kb.

With qemu 0.14.0, you could investigate what value is being used for
identity_base in target-i386/kvm.c:kvm_arch_init.
(Notice it will be a lower value if KVM_CAP_SET_IDENTITY_MAP_ADDR is
defined, and this will allow for a larger bios.bin.)

I think I was able to use OVMF X64 with kvm on Ubuntu 10.04, but I
don't have a system set up right now to verify this.  I am able to use
OVMF X64 with kvm on Ubuntu 10.10.

-Jordan
vagran - March 7, 2011, 6:35 p.m.
Yes, you are right, identity_base is 0xfffbc000 in my case and
KVM_CAP_SET_IDENTITY_MAP_ADDR is not defined. So,
as I understand, the problem is that BIOS size is too large
and I have too old KVM module.
Also I'm not sure if I can use KVM on 32-bit host for
emulating 64-bit guests.

Best regards,
Artyom.

Jordan Justen wrote:
> On Sun, Mar 6, 2011 at 13:26, vagran <vagran.ast@gmail.com> wrote:
>   
>>> Can you try disabling KVM?
>>>       
>> Yes, it helped. Problem exists only when using KVM. Thanks.
>>     
>
> One thing I suspect is that the kernel side of kvm had an issue around
> this time (Ubuntu 9.10) with a bios.bin larger than 256kb.
>
> With qemu 0.14.0, you could investigate what value is being used for
> identity_base in target-i386/kvm.c:kvm_arch_init.
> (Notice it will be a lower value if KVM_CAP_SET_IDENTITY_MAP_ADDR is
> defined, and this will allow for a larger bios.bin.)
>
> I think I was able to use OVMF X64 with kvm on Ubuntu 10.04, but I
> don't have a system set up right now to verify this.  I am able to use
> OVMF X64 with kvm on Ubuntu 10.10.
>
> -Jordan
>

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 8b76cea..bcf9b16 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -163,8 +163,9 @@  void pci_device_reset(PCIDevice *dev)
     pci_device_deassert_intx(dev);
     /* Clear all writeable bits */
     pci_word_test_and_clear_mask(dev->config + PCI_COMMAND,
-                                 pci_get_word(dev->wmask + PCI_COMMAND) |
-                                 pci_get_word(dev->w1cmask + PCI_COMMAND));
+                                 (pci_get_word(dev->wmask + PCI_COMMAND) |
+                                 pci_get_word(dev->w1cmask + 
PCI_COMMAND)) &
+                                 ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
     pci_word_test_and_clear_mask(dev->config + PCI_STATUS,
                                  pci_get_word(dev->wmask + PCI_STATUS) |