Module Name:    src
Committed By:   snj
Date:           Mon Feb 19 18:19:15 UTC 2018

Modified Files:
        src/sys/dev/pci [netbsd-8]: virtio.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #553):
        sys/dev/pci/virtio_pci.c: 1.2 via patch to sys/dev/pci/virtio.c
Explicitly enable PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_IO_ENABLE.
Recent versions of VirtualBox do not enable bus-mastering by default -
this will be fixed, but it doesn't hurt to do it ourselves too.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/dev/pci/virtio.c

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

Modified files:

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.28 src/sys/dev/pci/virtio.c:1.28.2.1
--- src/sys/dev/pci/virtio.c:1.28	Thu Jun  1 02:45:11 2017
+++ src/sys/dev/pci/virtio.c	Mon Feb 19 18:19:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.28 2017/06/01 02:45:11 chs Exp $	*/
+/*	$NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.28.2.1 2018/02/19 18:19:15 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -392,6 +392,7 @@ virtio_attach(device_t parent, device_t 
 	pcitag_t tag = pa->pa_tag;
 	int revision;
 	pcireg_t id;
+	pcireg_t csr;
 
 	revision = PCI_REVISION(pa->pa_class);
 	if (revision != 0) {
@@ -409,6 +410,10 @@ virtio_attach(device_t parent, device_t 
 			   virtio_device_name[PCI_SUBSYS_ID(id)] : "Unknown"),
 			  revision);
 
+	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+	csr |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_IO_ENABLE;
+	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
+
 	sc->sc_dev = self;
 	sc->sc_pc = pc;
 	sc->sc_tag = tag;

Reply via email to