All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	jbeulich@suse.com, keir@xen.org, ian.jackson@eu.citrix.com,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
	wei.liu2@citrix.com
Cc: dario.faggioli@citrix.com, port-xen@netbsd.org,
	ufimtseva@gmail.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v3 2/7] pci: Do not ignore device's PXM information
Date: Tue, 10 Feb 2015 10:45:21 +0000	[thread overview]
Message-ID: <54D9E141.8050904@citrix.com> (raw)
In-Reply-To: <1423512275-6531-3-git-send-email-boris.ostrovsky@oracle.com>

On 09/02/15 20:04, Boris Ostrovsky wrote:
> If ACPI provides PXM data for IO devices then dom0 will pass it to
> hypervisor during PHYSDEVOP_pci_device_add call. This information,
> however, is currently ignored.
>
> We will store this information (in the form of nodeID) in pci_dev
> structure so that we can provide it, for example, to the toolstack
> when it adds support (in the following patches) for querying the
> hypervisor about device topology
>
> We will also print it when user requests device information dump.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
>  xen/arch/x86/physdev.c        |   23 ++++++++++++++++++++---
>  xen/drivers/passthrough/pci.c |   13 +++++++++----
>  xen/include/public/physdev.h  |    6 ++++++
>  xen/include/xen/pci.h         |    5 ++++-
>  4 files changed, 39 insertions(+), 8 deletions(-)
>
> diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
> index 6b3201b..ab92fa5 100644
> --- a/xen/arch/x86/physdev.c
> +++ b/xen/arch/x86/physdev.c
> @@ -565,7 +565,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
>              break;
>  
> -        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn, NULL);
> +        ret = pci_add_device(0, manage_pci.bus, manage_pci.devfn,
> +                             NULL, NUMA_NO_NODE);
>          break;
>      }
>  
> @@ -597,13 +598,14 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
>          ret = pci_add_device(0, manage_pci_ext.bus,
>                               manage_pci_ext.devfn,
> -                             &pdev_info);
> +                             &pdev_info, NUMA_NO_NODE);
>          break;
>      }
>  
>      case PHYSDEVOP_pci_device_add: {
>          struct physdev_pci_device_add add;
>          struct pci_dev_info pdev_info;
> +        u8 node;
>  
>          ret = -EFAULT;
>          if ( copy_from_guest(&add, arg, 1) != 0 )
> @@ -618,7 +620,22 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          }
>          else
>              pdev_info.is_virtfn = 0;
> -        ret = pci_add_device(add.seg, add.bus, add.devfn, &pdev_info);
> +
> +        if ( add.flags & XEN_PCI_DEV_PXM )
> +        {
> +            uint32_t pxm;
> +            size_t optarr_off = offsetof(struct physdev_pci_device_add, optarr) /
> +                                sizeof(add.optarr[0]);
> +
> +            if ( copy_from_guest_offset(&pxm, arg, optarr_off, 1) )
> +                break;
> +
> +            node = pxm_to_node(pxm);
> +        }
> +        else
> +            node = NUMA_NO_NODE;
> +
> +        ret = pci_add_device(add.seg, add.bus, add.devfn, &pdev_info, node);
>          break;
>      }
>  
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 78c6977..43b4384 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -568,7 +568,8 @@ static void pci_enable_acs(struct pci_dev *pdev)
>      pci_conf_write16(seg, bus, dev, func, pos + PCI_ACS_CTRL, ctrl);
>  }
>  
> -int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
> +int pci_add_device(u16 seg, u8 bus, u8 devfn,
> +                   const struct pci_dev_info *info, u8 node)
>  {
>      struct pci_seg *pseg;
>      struct pci_dev *pdev;
> @@ -586,7 +587,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
>          pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn);
>          spin_unlock(&pcidevs_lock);
>          if ( !pdev )
> -            pci_add_device(seg, info->physfn.bus, info->physfn.devfn, NULL);
> +            pci_add_device(seg, info->physfn.bus, info->physfn.devfn,
> +                           NULL, node);
>          pdev_type = "virtual function";
>      }
>      else
> @@ -609,6 +611,8 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
>      if ( !pdev )
>          goto out;
>  
> +    pdev->node = node;
> +
>      if ( info )
>          pdev->info = *info;
>      else if ( !pdev->vf_rlen[0] )
> @@ -1191,10 +1195,11 @@ static int _dump_pci_devices(struct pci_seg *pseg, void *arg)
>  
>      list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
>      {
> -        printk("%04x:%02x:%02x.%u - dom %-3d - MSIs < ",
> +        printk("%04x:%02x:%02x.%u - dom %-3d - node %-3d - MSIs < ",
>                 pseg->nr, pdev->bus,
>                 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn),
> -               pdev->domain ? pdev->domain->domain_id : -1);
> +               pdev->domain ? pdev->domain->domain_id : -1,
> +               (pdev->node != NUMA_NO_NODE) ? pdev->node : -1);
>          list_for_each_entry ( msi, &pdev->msi_list, list )
>                 printk("%d ", msi->irq);
>          printk(">\n");
> diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
> index d547928..309346b 100644
> --- a/xen/include/public/physdev.h
> +++ b/xen/include/public/physdev.h
> @@ -293,6 +293,12 @@ struct physdev_pci_device_add {
>          uint8_t bus;
>          uint8_t devfn;
>      } physfn;
> +
> +    /*
> +     * Optional parameters array.
> +     * First element ([0]) is PXM domain associated with the device (if
> +     * XEN_PCI_DEV_PXM is set)
> +     */
>  #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
>      uint32_t optarr[];
>  #elif defined(__GNUC__)
> diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
> index 5f295f3..1acab53 100644
> --- a/xen/include/xen/pci.h
> +++ b/xen/include/xen/pci.h
> @@ -56,6 +56,8 @@ struct pci_dev {
>  
>      u8 phantom_stride;
>  
> +    u8 node; /* NUMA node */
> +
>      enum pdev_type {
>          DEV_TYPE_PCI_UNKNOWN,
>          DEV_TYPE_PCIe_ENDPOINT,
> @@ -102,7 +104,8 @@ void setup_hwdom_pci_devices(struct domain *,
>  int pci_release_devices(struct domain *d);
>  int pci_add_segment(u16 seg);
>  const unsigned long *pci_get_ro_map(u16 seg);
> -int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *);
> +int pci_add_device(u16 seg, u8 bus, u8 devfn,
> +                   const struct pci_dev_info *, u8 node);
>  int pci_remove_device(u16 seg, u8 bus, u8 devfn);
>  int pci_ro_device(int seg, int bus, int devfn);
>  void arch_pci_ro_device(int seg, int bdf);

  parent reply	other threads:[~2015-02-10 10:45 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 20:04 [PATCH v3 0/7] Display IO topology when PXM data is available (plus some cleanup) Boris Ostrovsky
2015-02-09 20:04 ` [PATCH v3 1/7] x86/numa: Make use of NUMA_NO_NODE consistent Boris Ostrovsky
2015-02-10 10:41   ` Andrew Cooper
2015-02-10 11:39   ` Jan Beulich
     [not found]   ` <54D9FBE7020000780005E91E@mail.emea.novell.com>
2015-02-10 14:55     ` Boris Ostrovsky
     [not found]   ` <54D9E076.1080604@citrix.com>
2015-02-16 13:57     ` Dario Faggioli
2015-02-09 20:04 ` [PATCH v3 2/7] pci: Do not ignore device's PXM information Boris Ostrovsky
2015-02-09 20:04 ` [PATCH v3 3/7] sysctl: Make topologyinfo and numainfo sysctls a little more efficient Boris Ostrovsky
2015-02-13 12:26   ` Wei Liu
     [not found]   ` <20150213122609.GU13644@zion.uk.xensource.com>
2015-02-13 14:21     ` Boris Ostrovsky
2015-02-16 14:08   ` Dario Faggioli
2015-02-16 15:55     ` Boris Ostrovsky
2015-02-23 16:40   ` Ian Campbell
     [not found]   ` <1424709653.27930.212.camel@citrix.com>
2015-02-23 16:48     ` Boris Ostrovsky
     [not found]     ` <54EB59F0.2070405@oracle.com>
2015-02-23 16:59       ` Jan Beulich
     [not found]       ` <54EB6A770200007800062BDD@mail.emea.novell.com>
2015-02-23 17:15         ` Ian Campbell
2015-02-09 20:04 ` [PATCH v3 4/7] sysctl: Add sysctl interface for querying PCI topology Boris Ostrovsky
2015-02-10 11:13   ` Andrew Cooper
2015-02-10 14:45     ` Boris Ostrovsky
     [not found]     ` <54DA19A4.8070603@oracle.com>
2015-02-10 14:54       ` Andrew Cooper
     [not found]       ` <54DA1BC1.2030205@citrix.com>
2015-02-10 15:06         ` Boris Ostrovsky
     [not found]         ` <54DA1E6D.2010401@oracle.com>
2015-02-10 16:30           ` Jan Beulich
     [not found]           ` <54DA322B02000078000C8167@mail.emea.novell.com>
2015-02-10 16:33             ` Andrew Cooper
2015-02-09 20:04 ` [PATCH v3 5/7] libxl/libxc: Move libxl_get_cpu_topology()'s hypercall buffer management to libxc Boris Ostrovsky
2015-02-10 11:23   ` Andrew Cooper
2015-02-10 14:48     ` Boris Ostrovsky
2015-02-16 14:22   ` Dario Faggioli
2015-02-23 16:44   ` Ian Campbell
     [not found]   ` <1424709863.27930.214.camel@citrix.com>
2015-02-23 16:52     ` Boris Ostrovsky
     [not found]     ` <54EB5AC9.7070409@oracle.com>
2015-02-23 17:14       ` Ian Campbell
2015-02-23 17:59         ` Boris Ostrovsky
2015-02-09 20:04 ` [PATCH v3 6/7] libxl/libxc: Move libxl_get_numainfo()'s " Boris Ostrovsky
2015-02-09 20:04 ` [PATCH v3 7/7] libxl: Add interface for querying hypervisor about PCI topology Boris Ostrovsky
2015-02-13 12:43   ` Wei Liu
     [not found]   ` <20150213124345.GV13644@zion.uk.xensource.com>
2015-02-13 14:22     ` Boris Ostrovsky
2015-02-16 13:45   ` Dario Faggioli
2015-02-16 15:54     ` Boris Ostrovsky
     [not found]     ` <54E212A3.7000802@oracle.com>
2015-02-16 16:06       ` Dario Faggioli
2015-02-16 16:47       ` Wei Liu
2015-02-23 16:52   ` Ian Campbell
2015-02-10  8:52 ` [PATCH v3 0/7] Display IO topology when PXM data is available (plus some cleanup) Jan Beulich
2015-02-10 11:08   ` Andrew Cooper
2015-02-10 10:26 ` [PATCH v3 4/7] sysctl: Add sysctl interface for querying PCI topology Robert Elz
     [not found] ` <1423512275-6531-3-git-send-email-boris.ostrovsky@oracle.com>
2015-02-10 10:45   ` Andrew Cooper [this message]
2015-02-10 11:43   ` [PATCH v3 2/7] pci: Do not ignore device's PXM information Jan Beulich
     [not found] ` <2508.1423564006@perseus.noi.kre.to>
2015-02-10 14:37   ` [PATCH v3 4/7] sysctl: Add sysctl interface for querying PCI topology Boris Ostrovsky
     [not found] ` <1423512275-6531-7-git-send-email-boris.ostrovsky@oracle.com>
2015-02-10 11:45   ` [PATCH v3 6/7] libxl/libxc: Move libxl_get_numainfo()'s hypercall buffer management to libxc Andrew Cooper
     [not found]   ` <54D9EF57.7050308@citrix.com>
2015-02-10 14:59     ` Boris Ostrovsky
2015-02-23 16:45   ` Ian Campbell

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=54D9E141.8050904@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dario.faggioli@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=port-xen@netbsd.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=ufimtseva@gmail.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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.