pciproxy
Hi,
I updated the pciproxy patch to work against the current CVS.
Additionally I would suggest to integrate the qemu part of it in the official qemu, since it is clean code.
I haven´t looked a the Linux-Host part of pciproxy deeply yet, and I am wondering whether it would be possible to have it as a module?
Ok, here is my version of the qemu part of pciproxy, if anyone is interested:
cvs diff: Diffing .
Index: Makefile.target
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile.target,v
retrieving revision 1.40
Makefile.target 13 Sep 2004 12:20:23 -0000 renamed from Makefile.target 24 Aug 2004 21:57:12 -0000 1.40 +1 -1
@@ -240,7 +240,7 @@ endif # must use static linking to avoid leaving stuff in virtual address space -VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o +VL_OBJS=vl.o osdep.o block.o readline.o monitor.o pci.o console.o pciproxy.o VL_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o ifeq ($(TARGET_ARCH), i386)
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.43
configure 13 Sep 2004 12:20:23 -0000 renamed from configure 3 Aug 2004 21:14:23 -0000 1.43 +5 -0
@@ -400,6 +400,11 @@ echo "CONFIG_DARWIN=yes" >> $config_mak echo "#define CONFIG_DARWIN 1" >> $config_h fi +if test -f "/usr/include/sys/io.h"; then + echo "#define HAVE_SYS_IO_H 1" >> $config_h + echo "#define HAVE_IOPL 1" >> $config_h + echo "#define HAVE_IOPERM 1" >> $config_h +fi if test "$gdbstub" = "yes" ; then echo "CONFIG_GDBSTUB=yes" >> $config_mak echo "#define CONFIG_GDBSTUB 1" >> $config_h
Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.97
vl.c 13 Sep 2004 12:20:25 -0000 renamed from vl.c 6 Sep 2004 00:14:04 -0000 1.97 +2 -1
@@ -99,6 +99,7 @@ /* XXX: use a two level table to limit memory usage */ #define MAX_IOPORTS 65536 +char *pciproxy_devpath = NULL; const char *bios_dir = CONFIG_QEMU_SHAREDIR; char phys_ram_file[1024]; CPUState *global_env;
@@ -1566,7 +1567,7 @@ return -1; } memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP | IFF_NO_PI; + ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE; pstrcpy(ifr.ifr_name, IFNAMSIZ, "tun%d"); ret = ioctl(fd, TUNSETIFF, (void *) &ifr); if (ret != 0) {
@@ -2504,6 +2505,7 @@ "-d item1,... output log to %s (use -d ? for a list of log
items)\n"
"-hdachs c,h,s force hard disk 0 geometry (usually qemu can
guess it)\n"
"-L path set the directory for the BIOS and VGA BIOS\n"
+ "-pciproxy a:b:c proxy pci device\n"
#ifdef USE_CODE_COPY
"-no-code-copy disable code copy acceleration\n"
#endif
@@ -2578,6 +2580,7 @@
QEMU_OPTION_L,
QEMU_OPTION_no_code_copy,
QEMU_OPTION_pci,
+ QEMU_OPTION_pciproxy,
QEMU_OPTION_isa,
QEMU_OPTION_prep,
QEMU_OPTION_localtime,
@@ -2637,6 +2640,7 @@
{ "prep", 0, QEMU_OPTION_prep },
{ "g", 1, QEMU_OPTION_g },
#endif
+ { "pciproxy", HAS_ARG, QEMU_OPTION_pciproxy },
{ "localtime", 0, QEMU_OPTION_localtime },
{ "isa", 0, QEMU_OPTION_isa },
{ "std-vga", 0, QEMU_OPTION_std_vga },
@@ -3040,6 +3044,9 @@
sizeof(serial_devices[0]), optarg);
serial_device_index++;
break;
+ case QEMU_OPTION_pciproxy:
+ pciproxy_devpath = (char *)optarg;
+ break;
}
}
}Index: vl.h
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.h,v
retrieving revision 1.52
vl.h 13 Sep 2004 12:20:26 -0000 renamed from vl.h 24 Aug 2004 21:13:40 -0000 1.52 +4 -0
@@ -498,6 +498,10 @@ void openpic_set_irq (openpic_t *opp, int n_IRQ, int level); openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus); +/* pciproxy.c */ +extern char *pciproxy_devpath; +void pciproxy_add_device(char *devpath); + /* vga.c */ #define VGA_RAM_SIZE (4096 * 1024)
cvs diff: Diffing hw
Index: hw/pc.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/pc.c,v
retrieving revision 1.27
pc.c 13 Sep 2004 12:20:26 -0000 renamed from pc.c 24 Aug 2004 21:13:40 -0000 1.27 +3 -0
@@ -441,6 +441,9 @@ if (pci_enabled) { pci_bus = i440fx_init(); piix3_init(pci_bus); + if ( pciproxy_devpath ) + pciproxy_add_device(pciproxy_devpath); + } else { pci_bus = NULL; }
cvs diff: Diffing linux-user
Index: linux-user/syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v retrieving revision 1.50
syscall.c 13 Sep 2004 12:20:28 -0000 renamed from syscall.c 19 Jun 2004 16:59:03 -0000 1.50 +1 -1
@@ -577,7 +577,7 @@ case SO_OOBINLINE: case SO_NO_CHECK: case SO_PRIORITY: - case SO_BSDCOMPAT: + //case SO_BSDCOMPAT: case SO_PASSCRED: case SO_TIMESTAMP: case SO_RCVLOWAT:
Many greetings,
Philipp Gühring
Quoted 2 lines · Philipp Gühring
I haven´t looked a the Linux-Host part of pciproxy deeply yet, and I am wondering whether it would be possible to have it as a module?
It would be possible strictly, but whats the point? to compile a module you need to have the current kernel sources anyway...
Anyway, the kernel part needs some fixing to make the PCI nodes pollable for IRQs and just use the standard SIGIO mechanism for async notification.
Once that is done I could make a module version of it that will provide a character device that allows any kind of IRQ signalling to a sufficiently privileged task. The only problem here will be in systems that support reconfiguration of PCI IRQs on the fly, but we can probably just ignore that case.
PS. You didn't mention what you are actually using the code for?
Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D