All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
To: weidong.han@intel.com
Cc: xen-devel@lists.xensource.com, Ian.Jackson@eu.citrix.com
Subject: Re: Re: [PATCH][RFC] gfx_passthru: warning when vgabios rom has invalid checksum
Date: Mon, 22 Feb 2010 18:47:17 +0900	[thread overview]
Message-ID: <4B8252A5.4020008@jp.fujitsu.com> (raw)
In-Reply-To: <4B8246C5.4090005@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2942 bytes --]

Hi Weidong,

 > How did you recalculate it? is it possible to recalculate it when detect
 > invalid checksum?

Checking and recalculating the VGABIOS checksum is being processed
in setup_vga_pt() in hw/pass-through.c.
I thought you have written that part.

If the checksum is invalid, current setup_vga_pt() always overwrites
it with the recalculated value.

What I mention is: the VGABIOS checksum must have been already
recalculated by system BIOS. So, when setup_vga_pt() detects the
invalid one, something might be wrong.

But, I'm not sure all BIOS should work as described in PCIFW Spec.
Actually, my Q35 had invalid checksum.


I attach another patch:
This stops loading vgabios if the checksum is wrong.

Signed-off-by: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>

> Noboru Iwamatsu wrote:
>> Hi,
>>
>> >> Intel DX58SO + GeForce GTS250: checksum is OK.
>> >> Intel DX58SO + GeForce 9600GT: checksum is OK.
>> >> Fujitsu Q35 M/B + IGD: checksum is bad.
>> >>
>> > What does "checksum is bad" mean here?
>>
>> It means shadowed VGABIOS has invalid checksum
>> and requires recalculating.
>>
>> >> What do you think, Weidong?
>> >> Is just warning enough? Or, should we stop loading the rom?
>> >>
>> >>
>> > Does it still work or not when checksum is bad? If it works, we should
>> > not stop loading the rom.
>>
>> When the checksum is bad,
>> if it is not recalculated, guest has some trouble about handling the
>> VGA (unable to show BIOS screen, unable to load the gfx driver
>> properly, ...).
> For this case, it's reasonable to warning and stop loading rom. We
> didn't encounter this issue.
>> If it is recalculated, it seems to work fine.
> How did you recalculate it? is it possible to recalculate it when detect
> invalid checksum?
>
> Regards,
> Weidong
>
>> Regards,
>> Noboru.
>>
>>> Noboru Iwamatsu wrote:
>>>> Hi,
>>>>
>>>> According to the "PCI Firmware Spec Rev 3.0",
>>>> the system firmware have to write the new checksum after resizing
>>>> the expansion ROM area.
>>>>
>>>> So, when re-using the shadowed VGABIOS, the checksum must
>>>> be valid, and if it is invalid, we should consider the BIOS has
>>>> a bug or memory area is corrupted.
>>>>
>>>> This patch just add the warning message when checksum requires
>>>> recalculation.
>>>>
>>>> I tried this following environments.
>>>>
>>>> Intel DX58SO + GeForce GTS250: checksum is OK.
>>>> Intel DX58SO + GeForce 9600GT: checksum is OK.
>>>> Fujitsu Q35 M/B + IGD: checksum is bad.
>>>>
>>> What does "checksum is bad" mean here?
>>>> What do you think, Weidong?
>>>> Is just warning enough? Or, should we stop loading the rom?
>>>>
>>>>
>>> Does it still work or not when checksum is bad? If it works, we should
>>> not stop loading the rom.
>>>
>>> Regards,
>>> Weidong
>>>> Regards,
>>>> Noboru.
>>>>
>>
>>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


[-- Attachment #2: vgabios-checksum-validation.patch --]
[-- Type: text/plain, Size: 603 bytes --]

diff --git a/hw/pass-through.c b/hw/pass-through.c
index ecb3d6f..8775956 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -4258,11 +4258,15 @@ static int setup_vga_pt(void)
         goto out;
     }
 
-    /* Adjust the bios checksum */
+    /* Validate the bios checksum */
     for ( c = (char*)bios; c < ((char*)bios + bios_size); c++ )
         checksum += *c;
     if ( checksum )
-        bios[bios_size - 1] -= checksum;
+    {
+        PT_LOG("vga bios checksum is invalid!\n");
+        rc = -1;
+        goto out;
+    }
 
     cpu_physical_memory_rw(0xc0000, bios, bios_size, 1);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2010-02-22  9:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22  5:45 [PATCH][RFC] gfx_passthru: warning when vgabios rom has invalid checksum Noboru Iwamatsu
2010-02-22  7:21 ` Weidong Han
2010-02-22  8:00   ` Noboru Iwamatsu
2010-02-22  8:56     ` Weidong Han
2010-02-22  9:47       ` Noboru Iwamatsu [this message]
2010-02-22 10:08         ` Weidong Han
2010-02-23 17:59           ` Ian Jackson
2010-02-24  1:34             ` Noboru Iwamatsu
2010-02-24  2:50               ` Weidong Han
2010-02-25  4:54                 ` Noboru Iwamatsu
2010-02-25  5:53                   ` Weidong Han

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=4B8252A5.4020008@jp.fujitsu.com \
    --to=n_iwamatsu@jp.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=weidong.han@intel.com \
    --cc=xen-devel@lists.xensource.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 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.