From 03df3882b5b7b8ed0ce340891e71688a7038c36f Mon Sep 17 00:00:00 2001 From: Alexander Kudryavtsev Date: Fri, 23 Sep 2011 23:20:31 +0400 Subject: [PATCH 11/32] Allow to specify function number for passed through device --- palacios/src/devices/pci_passthrough.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/palacios/src/devices/pci_passthrough.c b/palacios/src/devices/pci_passthrough.c index 83407d2..262f2b7 100644 --- a/palacios/src/devices/pci_passthrough.c +++ b/palacios/src/devices/pci_passthrough.c @@ -1297,9 +1297,20 @@ static int setup_virt_pci_dev(struct v3_vm_info * vm_info, struct vm_device * de bars[i].bar_write = pci_bar_write; } + int fn = 0, devno = -1; + if(v3_cfg_val(cfg, "func")) { + fn = atoi(v3_cfg_val(cfg, "func")); + V3_ASSERT(fn >= 0 && fn < 8); + } + if(v3_cfg_val(cfg, "dev")) { + devno = atoi(v3_cfg_val(cfg, "dev")); + V3_ASSERT(devno >= 0 && devno < 32); + } + + pci_dev = v3_pci_register_passthrough_device(state->pci_bus, PCI_STD_DEVICE, - bus_num, -1, 0, + bus_num, devno, fn, state->name, bars, pt_config_update, pt_config_read, -- 1.7.5.4