All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Fehlig <jfehlig@novell.com>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH] Fix pci passthru in xend interface used by libvirt
Date: Thu, 04 Nov 2010 08:35:37 -0600	[thread overview]
Message-ID: <4CD2C4B9.90202@novell.com> (raw)
In-Reply-To: <461b9d3a643a2c67c961.1288302096@jfehlig3.provo.novell.com>

Could someone review this patch please?

The reporter of the bug has successfully tested the patch, but I'd
prefer an upstream ACK as well before adding it to our patch set.

Thanks,
Jim


Jim Fehlig wrote:
> # HG changeset patch
> # User Jim Fehlig <jfehlig@novell.com>
> # Date 1288301229 21600
> # Branch xend-pci
> # Node ID 461b9d3a643a2c67c961d9fc468a804891f3770d
> # Parent  28a16074681582f1209c9077f870ccf44927133e
> Fix pci passthru in xend interface used by libvirt
>
> Attempting to define or create a domain whose XML config contains a
> passthru PCI device fails with libvirt
>
> xen84: # cat win2k8r2.xml
> ...
>    <hostdev mode='subsystem' type='pci' managed='no'>
>       <source>
>         <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
>       </source>
>     </hostdev>
> ...
>
> xen84: # virsh create ./win2k8r2.xml
> error: Failed to create domain from ./win2k8r2.xml
> error: POST operation failed: xend_post: error from xen daemon:
>   (xend.err "Error creating domain: 'key'")
>
> The PCI device config maintained by xend includes a 'key' field, which is
> initialized by xm client when using that tool and traditional xen config
> file.  libvirt, which uses xend's sexpr-over-http interface (is that the
> proper name for that interface??), does not initialize this field - and
> shouldn't be expected to do so IMO.  Clients should not be bothered with
> xend's internal representation of a PCI device.
>
> This patch populates the 'key' field within xend if it is uninitialized,
> similar to current initialization of 'uuid' field.  The 'vdevfn' field
> suffers a similar problem if not (optionally) specified by user.
> AFAICT, the xm client initializes 'vdevfn' to 0x100 if not specified so
> I've done the same here.
>
>     Signed-off-by: Jim Fehlig <jfehlig@novell.com>
>
> diff -r 28a160746815 -r 461b9d3a643a tools/python/xen/util/pci.py
> --- a/tools/python/xen/util/pci.py	Wed Oct 27 12:24:28 2010 +0100
> +++ b/tools/python/xen/util/pci.py	Thu Oct 28 15:27:09 2010 -0600
> @@ -240,10 +240,16 @@
>          pci_dev_info = dict(pci_dev[1:])
>          if 'opts' in pci_dev_info:
>              pci_dev_info['opts'] = pci_opts_list_from_sxp(pci_dev)
> -        # append uuid to each pci device that does't already have one.
> +        # If necessary, initialize uuid, key, and vdevfn for each pci device
>          if not pci_dev_info.has_key('uuid'):
> -            dpci_uuid = pci_dev_info.get('uuid', uuid.createString())
> -            pci_dev_info['uuid'] = dpci_uuid
> +            pci_dev_info['uuid'] = uuid.createString()
> +        if not pci_dev_info.has_key('key'):
> +            pci_dev_info['key'] = "%02x:%02x.%x" % \
> +            (int(pci_dev_info['bus'], 16),
> +             int(pci_dev_info['slot'], 16),
> +             int(pci_dev_info['func'], 16))
> +        if not pci_dev_info.has_key('vdevfn'):
> +            pci_dev_info['vdevfn'] =  "0x%02x" % AUTO_PHP_SLOT
>          pci_devs.append(pci_dev_info)
>      dev_config['devs'] = pci_devs
>  
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>   

  reply	other threads:[~2010-11-04 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-28 21:41 [PATCH] Fix pci passthru in xend interface used by libvirt Jim Fehlig
2010-11-04 14:35 ` Jim Fehlig [this message]
2010-11-08 16:24   ` [PATCH] Fix pci passthru in xend interface used by libvirt [and 1 more messages] Ian Jackson
2010-11-08 22:26     ` Jim Fehlig
2010-11-09 16:48       ` Ian Jackson
2010-11-09 17:27       ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD2C4B9.90202@novell.com \
    --to=jfehlig@novell.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.