Skip to contentSkip to conversation

pass-through: use vdevn in xm_pci_attach()

PATCH In review Simon Horman 2 participants 3 messages Jul 14, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pass-through: use vdevn in xm_pci_attach()

Use vdevfn in xm_pci_attach() for non-zero functions, the vslot element of dev dictionaries no longer exists.

---

With this patch applied the current staging tree (19934:82c6d0b8852e) passes my pass-through tests, which exercise both single and multi-function pass-through.

tools/python/xen/xm/main.py +3 -3
Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
@@ -2555,13 +2555,13 @@ def xm_pci_attach(args):
 
     # If the slot wasn't spefified in the args then use the slot
     # assigned to the head by qemu-xen for the rest of the functions
-    if int(head_dev['vslot'], 16) & AUTO_PHP_SLOT:
+    if int(head_dev['vdevfn'], 16) & AUTO_PHP_SLOT:
         vdevfn = int(find_attached_devfn(attached_pci_dict(dom), head_dev), 16)
         if not vdevfn & AUTO_PHP_SLOT:
             vslot = PCI_SLOT(vdevfn)
             for i in dev:
-                i['vslot'] = '0x%02x' % \
-		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vslot'], 16)))
+                i['vdevfn'] = '0x%02x' % \
+		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vdevfn'], 16)))
 
     for i in dev:
         xm_pci_attach_one(dom, i)
#1 lore raw

Hi Simon,

Quoted 22 lines · Simon Horman

Use vdevfn in xm_pci_attach() for non-zero functions, the vslot element of dev dictionaries no longer exists.

---

With this patch applied the current staging tree (19934:82c6d0b8852e) passes my pass-through tests, which exercise both single and multi-function pass-through.

Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py 2009-07-14 15:49:22.
000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-07-14 15:49:25.
000000000 +1000

tools/python/xen/xm/main.py +0 -1
@@ -2555,13 +2555,13 @@ def xm_pci_attach(args):
 
    # If the slot wasn't spefified in the args then use the slot
    # assigned to the head by qemu-xen for the rest of the functions
-    if int(head_dev['vslot'], 16) & AUTO_PHP_SLOT:

tools/python/xen/xm/main.py def xm_pci_attach(args): · line 2565

Quoted 10 lines
tools/python/xen/xm/main.py +3 -2
+    if int(head_dev['vdevfn'], 16) & AUTO_PHP_SLOT:
        vdevfn = int(find_attached_devfn(attached_pci_dict(dom), head_dev)
 , 16)
        if not vdevfn & AUTO_PHP_SLOT:
            vslot = PCI_SLOT(vdevfn)
            for i in dev:
-                i['vslot'] = '0x%02x' % \
-		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vslot'], 16)))
+                i['vdevfn'] = '0x%02x' % \
+		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vdevfn'], 16)))

The above line includes tab indent.

Best regards,
Kan

#2 lore raw
Quoted 23 lines · Masaki Kanno

Hi Simon,

Quoted 19 lines · Simon Horman

Use vdevfn in xm_pci_attach() for non-zero functions, the vslot element of dev dictionaries no longer exists.

---

With this patch applied the current staging tree (19934:82c6d0b8852e) passes my pass-through tests, which exercise both single and multi-function pass-through.

Index: xen-unstable.hg/tools/python/xen/xm/main.py
===================================================================
--- xen-unstable.hg.orig/tools/python/xen/xm/main.py 2009-07-14 15:49:22.
000000000 +1000
+++ xen-unstable.hg/tools/python/xen/xm/main.py 2009-07-14 15:49:25.
000000000 +1000

(quoted diff) +0 -0
@@ -2555,13 +2555,13 @@ def xm_pci_attach(args):
 
Quoted 15 lines

tools/python/xen/xm/main.py def xm_pci_attach(args): · line 2564

Quoted 13 lines
tools/python/xen/xm/main.py +3 -3
    # If the slot wasn't spefified in the args then use the slot
    # assigned to the head by qemu-xen for the rest of the functions
-    if int(head_dev['vslot'], 16) & AUTO_PHP_SLOT:
+    if int(head_dev['vdevfn'], 16) & AUTO_PHP_SLOT:
        vdevfn = int(find_attached_devfn(attached_pci_dict(dom), head_dev)
 , 16)
        if not vdevfn & AUTO_PHP_SLOT:
            vslot = PCI_SLOT(vdevfn)
            for i in dev:
-                i['vslot'] = '0x%02x' % \
-		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vslot'], 16)))
+                i['vdevfn'] = '0x%02x' % \
+		             PCI_DEVFN(vslot, PCI_FUNC(int(i['vdevfn'], 16)))

The above line includes tab indent.

The dreaded tab! I'll fix it and repost :-)