NetBSD Problem Report #40356

From fun@naobsd.org  Sat Jan 10 12:32:05 2009
Return-Path: <fun@naobsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 81B9463B8BA
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 10 Jan 2009 12:32:05 +0000 (UTC)
Message-Id: <200901101232.n0ACW0Ux004285@mail.naobsd.org>
Date: Sat, 10 Jan 2009 21:32:00 +0900 (JST)
From: fun@naobsd.org
Reply-To: fun@naobsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: [PATCH] PCI_ADDR_FIXUP has no effect under xen environment
X-Send-Pr-Version: 3.95

>Number:         40356
>Category:       port-xen
>Synopsis:       [PATCH] PCI_ADDR_FIXUP has no effect under xen environment
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 10 12:35:00 +0000 2009
>Closed-Date:    Thu Jan 22 20:23:00 +0000 2009
>Last-Modified:  Thu Jan 22 20:23:00 +0000 2009
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 5.0_BETA
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD t105.naobsd.org 5.0_BETA NetBSD 5.0_BETA (T105) #0: Thu Jan 8 21:21:25 JST 2009 fun@t105.naobsd.org:/home/fun/src/sys/arch/amd64/compile/T105 amd64
Architecture: x86_64
Machine: amd64
>Description:
	I'm using Dell PowerEdge T105 with netbsd-5/amd64. with GENERIC
	kernel, wd at viaide0 is not attached. (viaide0: couldn't map
	sata regs)
	"options PCI_ADDR_FIXUP" (and PCI_BUS_FIXUP) fixes this problem.

	# kern/38011 states NVIDIA chipset has problem. I'm not sure
	# which is wrong: BIOS or chipset. but it's not important for
	# this PR.

	now, I'm try to setup xen33 environment on T105. XEN3_DOM0
	kernel has same problem, but "options PCI_ADDR_FIXUP" has no
	effect.

	see also:
	 http://mail-index.netbsd.org/port-xen/2009/01/04/msg004617.html
>How-To-Repeat:
	try "options PCI_ADDR_FIXUP" (and PCI_BUS_FIXUP) under xen
	environment.
>Fix:
	below patch fixes this problem. please pullup to netbsd-5.

Index: sys/arch/xen/conf/files.xen
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/conf/files.xen,v
retrieving revision 1.88
diff -u -p -r1.88 files.xen
--- sys/arch/xen/conf/files.xen	3 Aug 2008 19:32:03 -0000	1.88
+++ sys/arch/xen/conf/files.xen	2 Jan 2009 17:15:06 -0000
@@ -254,10 +254,8 @@ file	arch/x86/x86/i8259.c		xen3
 # MP configuration using Intel SMP specification 1.4
 file	arch/x86/x86/mpbios.c		mpbios

-ifdef i386
-file	arch/i386/pci/pci_bus_fixup.c	pci_bus_fixup
-file	arch/i386/pci/pci_addr_fixup.c	pci_addr_fixup
-endif
+file	arch/x86/pci/pci_bus_fixup.c	pci_bus_fixup
+file	arch/x86/pci/pci_addr_fixup.c	pci_addr_fixup

 file	arch/x86/x86/apic.c		ioapic

Index: sys/arch/xen/x86/mainbus.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/x86/mainbus.c,v
retrieving revision 1.5
diff -u -p -r1.5 mainbus.c
--- sys/arch/xen/x86/mainbus.c	21 Oct 2008 15:46:32 -0000	1.5
+++ sys/arch/xen/x86/mainbus.c	2 Jan 2009 17:21:42 -0000
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 

 #include "opt_xen.h"
 #include "opt_mpbios.h"
+#include "opt_pcifixup.h"

 #include "acpi.h"
 #include "ioapic.h"
@@ -71,6 +72,12 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 #ifdef MPBIOS
 #include <machine/mpbiosvar.h>       
 #endif /* MPBIOS */
+#ifdef PCI_BUS_FIXUP
+#include <arch/x86/pci/pci_bus_fixup.h>
+#ifdef PCI_ADDR_FIXUP
+#include <arch/x86/pci/pci_addr_fixup.h>
+#endif  
+#endif

 #if defined(MPBIOS) || NACPI > 0
 struct mp_bus *mp_busses;
@@ -136,6 +143,9 @@ mainbus_attach(device_t parent, device_t
 #if NACPI > 0 || defined(MPBIOS)
 	int numioapics = 0;     
 #endif
+#ifdef PCI_BUS_FIXUP
+	int pci_maxbus = 0;
+#endif
 #endif /* defined(DOM0OPS) && defined(XEN3) */

 	aprint_naive("\n");
@@ -157,14 +167,16 @@ mainbus_attach(device_t parent, device_t
 		/* ACPI needs to be able to access PCI configuration space. */
 		pci_mode = pci_mode_detect();
 #ifdef PCI_BUS_FIXUP
-		pci_maxbus = pci_bus_fixup(NULL, 0);
-		aprint_debug_dev(self, "PCI bus max, after pci_bus_fixup: %i\n",
-		    pci_maxbus);
+		if (pci_mode != 0) {
+			pci_maxbus = pci_bus_fixup(NULL, 0);
+			aprint_debug_dev(self, "PCI bus max, after "
+			    "pci_bus_fixup: %i\n", pci_maxbus);
 #ifdef PCI_ADDR_FIXUP
-		pciaddr.extent_port = NULL;
-		pciaddr.extent_mem = NULL;
-		pci_addr_fixup(NULL, pci_maxbus);
+			pciaddr.extent_port = NULL;
+			pciaddr.extent_mem = NULL;
+			pci_addr_fixup(NULL, pci_maxbus);
 #endif /* PCI_ADDR_FIXUP */
+		}
 #endif /* PCI_BUS_FIXUP */
 #if NACPI > 0
 		acpi_present = acpi_probe();
Index: sys/arch/xen/xen/hypervisor.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.42
diff -u -p -r1.42 hypervisor.c
--- sys/arch/xen/xen/hypervisor.c	24 Oct 2008 21:09:24 -0000	1.42
+++ sys/arch/xen/xen/hypervisor.c	2 Jan 2009 17:15:06 -0000
@@ -125,12 +125,6 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c
 #ifdef MPBIOS
 #include <machine/mpbiosvar.h>       
 #endif
-#ifdef PCI_BUS_FIXUP
-#include <arch/i386/pci/pci_bus_fixup.h>
-#ifdef PCI_ADDR_FIXUP
-#include <arch/i386/pci/pci_addr_fixup.h>
-#endif  
-#endif
 #endif /* NPCI */

 #if NXENBUS > 0
@@ -243,9 +237,6 @@ hypervisor_attach(device_t parent, devic
 	int i, j, busnum;
 #endif

-#ifdef PCI_BUS_FIXUP
-	int pci_maxbus = 0;
-#endif
 #endif /* NPCI */
 	union hypervisor_attach_cookie hac;


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: port-xen-maintainer->bouyer
Responsible-Changed-By: bouyer@NetBSD.org
Responsible-Changed-When: Sun, 18 Jan 2009 20:49:12 +0000
Responsible-Changed-Why:
will handle it.


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40356 CVS commit: src/sys/arch/xen
Date: Sun, 18 Jan 2009 20:50:43 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Jan 18 20:50:43 UTC 2009

 Modified Files:
 	src/sys/arch/xen/conf: files.xen
 	src/sys/arch/xen/x86: mainbus.c
 	src/sys/arch/xen/xen: hypervisor.c

 Log Message:
 The Xen PCI_BUS_FIXUP/PCI_ADDR_FIXUP has rotted, catch up with x86 changes
 in this area. Patch provided by FUKAUMI Naoki in PR#40356.


 To generate a diff of this commit:
 cvs rdiff -r1.91 -r1.92 src/sys/arch/xen/conf/files.xen
 cvs rdiff -r1.6 -r1.7 src/sys/arch/xen/x86/mainbus.c
 cvs rdiff -r1.42 -r1.43 src/sys/arch/xen/xen/hypervisor.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Sun, 18 Jan 2009 21:55:50 +0000
State-Changed-Why:
Patch commited, pullup request sent. THanks !


From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40356 CVS commit: [netbsd-5] src/sys/arch/xen
Date: Thu, 22 Jan 2009 20:17:13 +0000 (UTC)

 Module Name:	src
 Committed By:	snj
 Date:		Thu Jan 22 20:17:13 UTC 2009

 Modified Files:
 	src/sys/arch/xen/conf [netbsd-5]: files.xen
 	src/sys/arch/xen/x86 [netbsd-5]: mainbus.c
 	src/sys/arch/xen/xen [netbsd-5]: hypervisor.c

 Log Message:
 Pull up following revision(s) (requested by bouyer in ticket #286):
 	sys/arch/xen/conf/files.xen: revision 1.92
 	sys/arch/xen/x86/mainbus.c: revision 1.7 via patch
 	sys/arch/xen/xen/hypervisor.c: revision 1.43
 The Xen PCI_BUS_FIXUP/PCI_ADDR_FIXUP has rotted, catch up with x86 changes
 in this area. Patch provided by FUKAUMI Naoki in PR#40356.


 To generate a diff of this commit:
 cvs rdiff -r1.88 -r1.88.4.1 src/sys/arch/xen/conf/files.xen
 cvs rdiff -r1.5 -r1.5.4.1 src/sys/arch/xen/x86/mainbus.c
 cvs rdiff -r1.42 -r1.42.4.1 src/sys/arch/xen/xen/hypervisor.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: bouyer@NetBSD.org
State-Changed-When: Thu, 22 Jan 2009 20:23:00 +0000
State-Changed-Why:
ticket #286 has been processed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.