Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
Fri, 13 Feb 2009 13:45:22 +1100
* Fix parsing of vslot - the regex was incorrect
* Allow 0x to prefix hex values that are parsed
Index: ioemu-remote/hw/pass-through.c
===================================================================
--- ioemu-remote.orig/hw/pass-through.c 2009-02-17 17:52:08.000000000 +0900
+++ ioemu-remote/hw/pass-through.c 2009-02-17 17:52:13.000000000 +0900
@@ -866,14 +866,15 @@ err:
#define RE_BDF_OPT RE_BDF RE_OPT "\\?"
#define RE_VDEV "\\(0x\\)\\?\\([01]\\?[0-9a-fA-F]\\)"
-#define RE_BDF_OPT_SLOT RE_BDF_OPT "\\(@" RE_VDEV "\\)\\?"
+#define RE_VDEVFN RE_VDEV "\\(\\." RE_FUNC "\\)\\?"
+#define RE_BDF_OPT_SLOT RE_BDF_OPT "\\(@" RE_VDEVFN "\\)\\?"
static struct php_dev *parse_bdf(const char *str)
{
struct php_dev *list = NULL, *e;
regex_t preg;
- regmatch_t pmatch[14];
- int err, nmemb = 0;
+ regmatch_t pmatch[17];
+ int err, nmemb = 0, v_func = 0;
char *err_str;
if ((err = regcomp(&preg, RE_BDF_OPT_SLOT, 0)))
@@ -891,7 +892,7 @@ static struct php_dev *parse_bdf(const c
while (1)
{
- if ((err = regexec(&preg, str, 14, pmatch, 0)))
+ if ((err = regexec(&preg, str, 17, pmatch, 0)))
{
PT_LOG("Error: invalid PCI assignment \"%s\"\n", str);
goto err;
@@ -917,7 +918,12 @@ static struct php_dev *parse_bdf(const c
if (pmatch[12].rm_so >= 0)
{
- e->v_devfn = PCI_DEVFN(strtol(str + pmatch[12].rm_so, NULL, 16),
0);
+ if (pmatch[15].rm_so >= 0)
+ {
+ v_func = strtol(str + pmatch[15].rm_so, NULL, 16);
+ }
+ e->v_devfn = PCI_DEVFN(strtol(str + pmatch[12].rm_so, NULL, 16),
+ v_func);
}
e->valid = 1;
Index: ioemu-remote/xenstore.c
===================================================================
--- ioemu-remote.orig/xenstore.c 2009-02-17 17:28:06.000000000 +0900
+++ ioemu-remote/xenstore.c 2009-02-17 17:52:13.000000000 +0900
@@ -582,6 +582,24 @@ void xenstore_parse_domain_config(int hv
strcat(direct_pci_str, dev);
+ if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/vdevfn-%d",
+ hvm_domid, pci_devid, i) != -1) {
+ free(dev);
+ dev = xs_read(xsh, XBT_NULL, buf, &len);
+ }
+ if ( dev ) {
+ if (strlen(dev) + strlen(direct_pci_str) >
+ DIRECT_PCI_STR_LEN - 2) {
+ fprintf(stderr, "qemu: too many pci pass-through "
+ "devices\n");
+ memset(direct_pci_str, 0, DIRECT_PCI_STR_LEN);
+ goto out;
+ }
+ strcat(direct_pci_str, "@");
+ strcat(direct_pci_str, dev);
+ }
+
+
if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/opts-%d",
hvm_domid, pci_devid, i) != -1) {
free(dev);
--
--
Simon Horman
VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|