Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/pci Force PCI mode 1 when running under QEMU, t...



details:   https://anonhg.NetBSD.org/src/rev/f8c6e4480e40
branches:  trunk
changeset: 790390:f8c6e4480e40
user:      gson <gson%NetBSD.org@localhost>
date:      Sat Oct 05 11:20:34 2013 +0000

description:
Force PCI mode 1 when running under QEMU, to work around QEMU bug 897771.
This should also make it possible to boot NetBSD under versions of KVM
that have inherited said QEMU bug.  Fixes PR kern/45671.

diffstat:

 sys/arch/x86/pci/pci_machdep.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 3775d7dc1547 -r f8c6e4480e40 sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c    Sat Oct 05 09:22:43 2013 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c    Sat Oct 05 11:20:34 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_machdep.c,v 1.60 2013/07/31 19:27:51 macallan Exp $        */
+/*     $NetBSD: pci_machdep.c,v 1.61 2013/10/05 11:20:34 gson Exp $    */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.60 2013/07/31 19:27:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.61 2013/10/05 11:20:34 gson Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -526,6 +526,7 @@
        uint32_t sav, val;
        int i;
        pcireg_t idreg;
+       extern char cpu_brand_string[];
 
        if (pci_mode != -1)
                return pci_mode;
@@ -555,6 +556,13 @@
                        return (pci_mode);
                }
        }
+        if (memcmp(cpu_brand_string, "QEMU", 4) == 0) {
+               /* PR 45671, https://bugs.launchpad.net/qemu/+bug/897771 */
+#ifdef DEBUG
+               printf("forcing PCI mode 1 for QEMU\n");
+#endif
+               return (pci_mode);
+       }
 
        /*
         * Strong check for standard compliant mode 1:



Home | Main Index | Thread Index | Old Index