Attached.
Thanks
El 14/06/15 a les 19:07, Antti Kantee ha escrit:
On 14/06/15 13:57, Robert Millan wrote:
The print still doesn't match the call. How do you know at that
abstraction level that initiopl() will exactly "raise I/O privilege
level"?
Well that's what "iopl" stands for! Perhaps we should pick another name?
:-)
Good point.
Btw, iopl() is a Linux-ism. An x86-ism even, IIRC. For example the
FreeBSD/x86 way is open("/dev/io"). Maybe use something more generic like:
rumpcomp_pci_initio()
?
Sounds good to me.
Also, do we still need RUMP_PCI_IOSPACE? Or can we say that
everything providing iospace access must now define
rumpcomp_pci_initiopl?
A rumpcomp_pci_initiopl() dummy stub is cheap, seems reasonable to
assume it's present.
As long as init$whatever means "initialize io space and return error code", you
can just #define foo 0 in features.
--
Robert Millan
Index: rumpkernel-0~20150607/pci-userspace/src-linux-uio/pci_user-uio_linux.c
===================================================================
--- rumpkernel-0~20150607.orig/pci-userspace/src-linux-uio/pci_user-uio_linux.c 2015-06-13 22:46:57.477209607 +0200
+++ rumpkernel-0~20150607/pci-userspace/src-linux-uio/pci_user-uio_linux.c 2015-06-14 20:38:03.872472936 +0200
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/queue.h>
+#include <sys/io.h>
#include <assert.h>
#include <err.h>
@@ -348,3 +349,12 @@
return paddr;
}
+
+int
+rumpcomp_pci_initio(void)
+{
+ if (iopl(3) == -1)
+ return rumpuser_component_errtrans(errno);
+
+ return 0;
+}
Index: rumpkernel-0~20150607/pci-userspace/src-linux-uio/rumpcomp_userfeatures_pci.h
===================================================================
--- rumpkernel-0~20150607.orig/pci-userspace/src-linux-uio/rumpcomp_userfeatures_pci.h 2015-06-13 22:46:57.477209607 +0200
+++ rumpkernel-0~20150607/pci-userspace/src-linux-uio/rumpcomp_userfeatures_pci.h 2015-06-14 20:37:54.791838415 +0200
@@ -1 +1,2 @@
#define rumpcomp_pci_free rumpcomp_pci_free
+#define rumpcomp_pci_initio rumpcomp_pci_initio
Index: rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_at_mainbus.c
===================================================================
--- rumpkernel-0~20150607.orig/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_at_mainbus.c 2015-06-14 20:38:58.771743871 +0200
+++ rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_at_mainbus.c 2015-06-14 20:39:01.699893370 +0200
@@ -43,6 +43,8 @@
#include "rump_private.h"
#include "rump_vfs_private.h"
+#include "pci_user.h"
+
RUMP_COMPONENT(RUMP_COMPONENT_DEV)
{
extern const struct cdevsw pci_cdevsw;
@@ -68,6 +70,9 @@
{
struct pcibus_attach_args pba;
device_t mainbus;
+#ifdef rumpcomp_pci_initio
+ int error;
+#endif
/* XXX: attach args should come from elsewhere */
memset(&pba, 0, sizeof(pba));
@@ -80,8 +85,13 @@
#endif
pba.pba_flags = PCI_FLAGS_MEM_OKAY |
PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;;
-#ifdef RUMP_PCI_IOSPACE
- pba.pba_flags |= PCI_FLAGS_IO_OKAY;
+#ifdef rumpcomp_pci_initio
+ error = rumpcomp_pci_initio();
+ if (error == 0) {
+ pba.pba_flags |= PCI_FLAGS_IO_OKAY;
+ } else {
+ aprint_error("pci: unable to raise I/O privilege level (error %d), direct I/O will be unavailable\n", error);
+ }
#endif
mainbus = device_find_by_driver_unit("mainbus", 0);
Index: rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_user.h
===================================================================
--- rumpkernel-0~20150607.orig/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_user.h 2015-06-14 20:38:58.771743871 +0200
+++ rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/pci_user.h 2015-06-14 20:39:01.699893370 +0200
@@ -22,3 +22,7 @@
void **);
unsigned long rumpcomp_pci_virt_to_mach(void *);
+
+#ifdef rumpcomp_pci_initio
+int rumpcomp_pci_initio(void);
+#endif
Index: rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/Makefile
===================================================================
--- rumpkernel-0~20150607.orig/buildrump.sh/src/sys/rump/dev/lib/libpci/Makefile 2015-06-07 17:04:56.000000000 +0200
+++ rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/Makefile 2015-06-14 20:40:38.651547693 +0200
@@ -25,10 +25,6 @@
CPPFLAGS+= -I${.CURDIR}/opt -I${RUMPTOP}/librump/rumpkern
CPPFLAGS+= -I${RUMPTOP}/librump/rumpvfs
-.if ${RUMP_PCI_IOSPACE:Uno} == "yes"
-CPPFLAGS+=-DRUMP_PCI_IOSPACE
-.endif
-
.PATH: ${RUMPCOMP_USER_PATH.rumpdev_pci}
RUMPCOMP_USER_SRCS= ${RUMPCOMP_USER_SRCS.rumpdev_pci}
MYDIR:= ${.PARSEDIR}
Index: rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c
===================================================================
--- rumpkernel-0~20150607.orig/buildrump.sh/src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c 2015-06-07 17:04:56.000000000 +0200
+++ rumpkernel-0~20150607/buildrump.sh/src/sys/rump/dev/lib/libpci/rumpdev_bus_space.c 2015-06-14 20:40:21.871081274 +0200
@@ -34,7 +34,7 @@
#include "pci_user.h"
-#if defined(RUMP_PCI_IOSPACE) && (defined(__i386__) || defined(__x86_64__))
+#if defined(rumpcomp_pci_initio) && (defined(__i386__) || defined(__x86_64__))
#define IOSPACE_SUPPORTED
#endif