All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/PCI: fix guest_io_read() when pci_cfg_ok() denies access
@ 2012-06-21 12:17 Jan Beulich
  2012-06-21 16:25 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-06-21 12:17 UTC (permalink / raw)
  To: xen-devel

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

For a multi-byte aligned read, this so far resulted in 0x00ff to be
put in the guest's register rather than 0xffff or 0xffffffff, which in
turn could confuse bus scanning functions (which, when reading vendor
and/or device IDs, expect to get back all zeroes or all ones).

As the value gets masked to the read width when merging back into the
full result, setting the initial value to all ones should not harm any
or the other cases.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1717,7 +1717,7 @@ static uint32_t guest_io_read(
     while ( bytes != 0 )
     {
         unsigned int size = 1;
-        uint32_t sub_data = 0xff;
+        uint32_t sub_data = ~0;
 
         if ( (port == 0x42) || (port == 0x43) || (port == 0x61) )
         {




[-- Attachment #2: x86-PCI-config-read-not-ok.patch --]
[-- Type: text/plain, Size: 889 bytes --]

x86/PCI: fix guest_io_read() when pci_cfg_ok() denies access

For a multi-byte aligned read, this so far resulted in 0x00ff to be
put in the guest's register rather than 0xffff or 0xffffffff, which in
turn could confuse bus scanning functions (which, when reading vendor
and/or device IDs, expect to get back all zeroes or all ones).

As the value gets masked to the read width when merging back into the
full result, setting the initial value to all ones should not harm any
or the other cases.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1717,7 +1717,7 @@ static uint32_t guest_io_read(
     while ( bytes != 0 )
     {
         unsigned int size = 1;
-        uint32_t sub_data = 0xff;
+        uint32_t sub_data = ~0;
 
         if ( (port == 0x42) || (port == 0x43) || (port == 0x61) )
         {

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/PCI: fix guest_io_read() when pci_cfg_ok() denies access
  2012-06-21 12:17 [PATCH] x86/PCI: fix guest_io_read() when pci_cfg_ok() denies access Jan Beulich
@ 2012-06-21 16:25 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-06-21 16:25 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 21/06/2012 13:17, "Jan Beulich" <JBeulich@suse.com> wrote:

> For a multi-byte aligned read, this so far resulted in 0x00ff to be
> put in the guest's register rather than 0xffff or 0xffffffff, which in
> turn could confuse bus scanning functions (which, when reading vendor
> and/or device IDs, expect to get back all zeroes or all ones).
> 
> As the value gets masked to the read width when merging back into the
> full result, setting the initial value to all ones should not harm any
> or the other cases.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -1717,7 +1717,7 @@ static uint32_t guest_io_read(
>      while ( bytes != 0 )
>      {
>          unsigned int size = 1;
> -        uint32_t sub_data = 0xff;
> +        uint32_t sub_data = ~0;
>  
>          if ( (port == 0x42) || (port == 0x43) || (port == 0x61) )
>          {
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-21 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-21 12:17 [PATCH] x86/PCI: fix guest_io_read() when pci_cfg_ok() denies access Jan Beulich
2012-06-21 16:25 ` Keir Fraser

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.