* [PATCH] PCI: bus scan adjustments
@ 2012-09-11 11:29 Jan Beulich
2012-09-11 13:11 ` Keir Fraser
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2012-09-11 11:29 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 2151 bytes --]
As done elsewhere, the ns16550 code shouldn't look at non-zero
functions of a device if that isn't multi-function.
Also both there and in pass-through's _scan_pci_devices() skip looking
at non-zero functions when the device at function zero doesn't exist.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Note that to apply cleanly, this has to go on top of the serial console
improvement series posted earlier.
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -470,21 +470,28 @@ static int
pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx)
{
uint32_t bar, len;
- int b, d, f;
+ int b, d, f, nextf;
/* NB. Start at bus 1 to avoid AMT: a plug-in card cannot be on bus 0. */
for ( b = skip_amt ? 1 : 0; b < 0x100; b++ )
{
for ( d = 0; d < 0x20; d++ )
{
- for ( f = 0; f < 0x8; f++ )
+ for ( f = 0; f < 8; f = nextf )
{
+ nextf = (f || (pci_conf_read16(0, b, d, f, PCI_HEADER_TYPE) &
+ 0x80)) ? f + 1 : 8;
+
switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) )
{
case 0x0700: /* single port serial */
case 0x0702: /* multi port serial */
case 0x0780: /* other (e.g serial+parallel) */
break;
+ case 0xffff:
+ if ( !f )
+ nextf = 8;
+ /* fall through */
default:
continue;
}
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -665,7 +665,11 @@ static int __init _scan_pci_devices(stru
for ( func = 0; func < 8; func++ )
{
if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
+ {
+ if ( !func )
+ break;
continue;
+ }
pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
if ( !pdev )
[-- Attachment #2: pci-scan-adjust.patch --]
[-- Type: text/plain, Size: 2174 bytes --]
PCI: bus scan adjustments
As done elsewhere, the ns16550 code shouldn't look at non-zero
functions of a device if that isn't multi-function.
Also both there and in pass-through's _scan_pci_devices() skip looking
at non-zero functions when the device at function zero doesn't exist.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Note that to apply cleanly, this has to go on top of the serial console
improvement series posted earlier.
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -470,21 +470,28 @@ static int
pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx)
{
uint32_t bar, len;
- int b, d, f;
+ int b, d, f, nextf;
/* NB. Start at bus 1 to avoid AMT: a plug-in card cannot be on bus 0. */
for ( b = skip_amt ? 1 : 0; b < 0x100; b++ )
{
for ( d = 0; d < 0x20; d++ )
{
- for ( f = 0; f < 0x8; f++ )
+ for ( f = 0; f < 8; f = nextf )
{
+ nextf = (f || (pci_conf_read16(0, b, d, f, PCI_HEADER_TYPE) &
+ 0x80)) ? f + 1 : 8;
+
switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) )
{
case 0x0700: /* single port serial */
case 0x0702: /* multi port serial */
case 0x0780: /* other (e.g serial+parallel) */
break;
+ case 0xffff:
+ if ( !f )
+ nextf = 8;
+ /* fall through */
default:
continue;
}
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -665,7 +665,11 @@ static int __init _scan_pci_devices(stru
for ( func = 0; func < 8; func++ )
{
if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
+ {
+ if ( !func )
+ break;
continue;
+ }
pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
if ( !pdev )
[-- 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] PCI: bus scan adjustments
2012-09-11 11:29 [PATCH] PCI: bus scan adjustments Jan Beulich
@ 2012-09-11 13:11 ` Keir Fraser
0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2012-09-11 13:11 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 11/09/2012 12:29, "Jan Beulich" <JBeulich@suse.com> wrote:
> As done elsewhere, the ns16550 code shouldn't look at non-zero
> functions of a device if that isn't multi-function.
>
> Also both there and in pass-through's _scan_pci_devices() skip looking
> at non-zero functions when the device at function zero doesn't exist.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> Note that to apply cleanly, this has to go on top of the serial console
> improvement series posted earlier.
Acked-by: Keir Fraser <keir@xen.org>
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -470,21 +470,28 @@ static int
> pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx)
> {
> uint32_t bar, len;
> - int b, d, f;
> + int b, d, f, nextf;
>
> /* NB. Start at bus 1 to avoid AMT: a plug-in card cannot be on bus 0. */
> for ( b = skip_amt ? 1 : 0; b < 0x100; b++ )
> {
> for ( d = 0; d < 0x20; d++ )
> {
> - for ( f = 0; f < 0x8; f++ )
> + for ( f = 0; f < 8; f = nextf )
> {
> + nextf = (f || (pci_conf_read16(0, b, d, f, PCI_HEADER_TYPE) &
> + 0x80)) ? f + 1 : 8;
> +
> switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) )
> {
> case 0x0700: /* single port serial */
> case 0x0702: /* multi port serial */
> case 0x0780: /* other (e.g serial+parallel) */
> break;
> + case 0xffff:
> + if ( !f )
> + nextf = 8;
> + /* fall through */
> default:
> continue;
> }
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -665,7 +665,11 @@ static int __init _scan_pci_devices(stru
> for ( func = 0; func < 8; func++ )
> {
> if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
> + {
> + if ( !func )
> + break;
> continue;
> + }
>
> pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
> if ( !pdev )
>
>
>
> _______________________________________________
> 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-09-11 13:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 11:29 [PATCH] PCI: bus scan adjustments Jan Beulich
2012-09-11 13:11 ` Keir Fraser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).