From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: jbeulich@suse.com, keir@xen.org, ian.jackson@eu.citrix.com,
stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com,
wei.liu2@citrix.com
Cc: andrew.cooper3@citrix.com, dario.faggioli@citrix.com,
boris.ostrovsky@oracle.com, ufimtseva@gmail.com,
xen-devel@lists.xen.org
Subject: [PATCH v2 3/4] sysctl: Add sysctl interface for querying PCI topology
Date: Mon, 5 Jan 2015 21:18:56 -0500 [thread overview]
Message-ID: <1420510737-22813-4-git-send-email-boris.ostrovsky@oracle.com> (raw)
In-Reply-To: <1420510737-22813-1-git-send-email-boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
xen/common/sysctl.c | 60 +++++++++++++++++++++++++++++++++++++++++++
xen/include/public/sysctl.h | 35 ++++++++++++++++++++++++-
2 files changed, 94 insertions(+), 1 deletions(-)
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index 1254a24..f09d377 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -365,6 +365,66 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
}
break;
+ case XEN_SYSCTL_pcitopoinfo:
+ {
+ xen_sysctl_pcitopoinfo_t *ti = &op->u.pcitopoinfo;
+
+ if ( guest_handle_is_null(ti->pcitopo) ||
+ (ti->first_dev >= ti->num_devs) )
+ {
+ ret = -EINVAL;
+ break;
+ }
+
+ for ( ; ti->first_dev < ti->num_devs; ti->first_dev++ )
+ {
+ xen_sysctl_pcitopo_t pcitopo;
+ struct pci_dev *pdev;
+
+ if ( copy_from_guest_offset(&pcitopo, ti->pcitopo,
+ ti->first_dev, 1) )
+ {
+ ret = -EFAULT;
+ break;
+ }
+
+ spin_lock(&pcidevs_lock);
+ pdev = pci_get_pdev(pcitopo.pcidev.seg, pcitopo.pcidev.bus,
+ pcitopo.pcidev.devfn);
+ if ( !pdev || (pdev->node == NUMA_NO_NODE) )
+ pcitopo.node = INVALID_TOPOLOGY_ID;
+ else
+ pcitopo.node = pdev->node;
+ spin_unlock(&pcidevs_lock);
+
+ if ( copy_to_guest_offset(ti->pcitopo, ti->first_dev,
+ &pcitopo, 1) )
+ {
+ ret = -EFAULT;
+ break;
+ }
+
+ if ( hypercall_preempt_check() )
+ break;
+ }
+
+ if ( !ret )
+ {
+ if ( __copy_field_to_guest(u_sysctl, op,
+ u.pcitopoinfo.first_dev) )
+ {
+ ret = -EFAULT;
+ break;
+ }
+
+ if ( ti->first_dev < ti->num_devs )
+ ret = hypercall_create_continuation(__HYPERVISOR_sysctl,
+ "h", u_sysctl);
+
+ }
+ }
+ break;
+
#ifdef TEST_COVERAGE
case XEN_SYSCTL_coverage_op:
ret = sysctl_coverage_op(&op->u.coverage_op);
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 512ad74..628ed6a 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -33,6 +33,7 @@
#include "xen.h"
#include "domctl.h"
+#include "physdev.h"
#define XEN_SYSCTL_INTERFACE_VERSION 0x0000000C
@@ -463,7 +464,7 @@ typedef struct xen_sysctl_lockprof_op xen_sysctl_lockprof_op_t;
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_lockprof_op_t);
/* XEN_SYSCTL_cputopoinfo */
-#define INVALID_TOPOLOGY_ID (~0U)
+#define INVALID_TOPOLOGY_ID (~0U) /* Also used by pcitopo */
struct xen_sysctl_cputopo {
uint32_t core;
@@ -492,6 +493,36 @@ struct xen_sysctl_cputopoinfo {
typedef struct xen_sysctl_cputopoinfo xen_sysctl_cputopoinfo_t;
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cputopoinfo_t);
+/* XEN_SYSCTL_pcitopoinfo */
+struct xen_sysctl_pcitopo {
+ struct physdev_pci_device pcidev;
+ uint32_t node;
+};
+typedef struct xen_sysctl_pcitopo xen_sysctl_pcitopo_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pcitopo_t);
+
+struct xen_sysctl_pcitopoinfo {
+ /* IN: Size of pcitopo array */
+ uint32_t num_devs;
+
+ /*
+ * IN/OUT: First element of pcitopo array that needs to be processed by
+ * hypervisor.
+ * This is used primarily by hypercall continuations and callers will
+ * typically set it to zero
+ */
+ uint32_t first_dev;
+
+ /*
+ * If not NULL, filled with node identifier for each pcidev
+ * If information for a particular device is not avalable then node is set
+ * to INVALID_TOPOLOGY_ID.
+ */
+ XEN_GUEST_HANDLE_64(xen_sysctl_pcitopo_t) pcitopo;
+};
+typedef struct xen_sysctl_pcitopoinfo xen_sysctl_pcitopoinfo_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pcitopoinfo_t);
+
/* XEN_SYSCTL_numainfo */
#define INVALID_NUMAINFO_ID (~0U)
struct xen_sysctl_numainfo {
@@ -681,12 +712,14 @@ struct xen_sysctl {
#define XEN_SYSCTL_scheduler_op 19
#define XEN_SYSCTL_coverage_op 20
#define XEN_SYSCTL_psr_cmt_op 21
+#define XEN_SYSCTL_pcitopoinfo 22
uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
union {
struct xen_sysctl_readconsole readconsole;
struct xen_sysctl_tbuf_op tbuf_op;
struct xen_sysctl_physinfo physinfo;
struct xen_sysctl_cputopoinfo cputopoinfo;
+ struct xen_sysctl_pcitopoinfo pcitopoinfo;
struct xen_sysctl_numainfo numainfo;
struct xen_sysctl_sched_id sched_id;
struct xen_sysctl_perfc_op perfc_op;
--
1.7.1
next prev parent reply other threads:[~2015-01-06 2:18 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 2:18 [PATCH v2 0/4] Display IO topology when PXM data is available Boris Ostrovsky
2015-01-06 2:18 ` [PATCH v2 1/4] pci: Do not ignore device's PXM information Boris Ostrovsky
2015-01-06 11:55 ` Andrew Cooper
2015-01-07 9:01 ` Jan Beulich
2015-01-07 9:06 ` Jan Beulich
2015-01-07 14:42 ` Boris Ostrovsky
2015-01-07 14:47 ` Andrew Cooper
2015-01-07 15:07 ` Jan Beulich
2015-01-07 15:34 ` Boris Ostrovsky
2015-01-07 15:46 ` Jan Beulich
2015-01-07 15:06 ` Jan Beulich
2015-01-07 15:31 ` Boris Ostrovsky
2015-01-07 15:44 ` Jan Beulich
2015-01-06 2:18 ` [PATCH v2 2/4] sysctl: Make XEN_SYSCTL_topologyinfo sysctl a little more efficient Boris Ostrovsky
2015-01-06 13:41 ` Andrew Cooper
2015-01-06 14:45 ` Boris Ostrovsky
2015-01-07 9:12 ` Jan Beulich
2015-01-07 14:45 ` Boris Ostrovsky
2015-01-07 15:09 ` Jan Beulich
2015-01-16 15:56 ` Boris Ostrovsky
2015-01-16 16:06 ` Jan Beulich
2015-01-16 16:14 ` Boris Ostrovsky
2015-01-16 16:20 ` Jan Beulich
2015-01-16 16:34 ` Boris Ostrovsky
2015-01-16 16:42 ` Jan Beulich
2015-01-16 16:16 ` Ian Campbell
2015-01-16 16:34 ` Jan Beulich
2015-01-16 16:38 ` Ian Campbell
2015-01-16 16:45 ` Jan Beulich
2015-01-16 16:57 ` Andrew Cooper
2015-01-16 17:07 ` Boris Ostrovsky
2015-01-19 8:57 ` Jan Beulich
2015-01-19 10:48 ` Ian Campbell
2015-01-07 15:23 ` Jan Beulich
2015-01-19 17:26 ` Ian Campbell
2015-01-06 2:18 ` Boris Ostrovsky [this message]
2015-01-06 16:55 ` [PATCH v2 3/4] sysctl: Add sysctl interface for querying PCI topology Wei Liu
2015-01-06 18:15 ` Boris Ostrovsky
2015-01-07 9:21 ` Jan Beulich
2015-01-07 14:55 ` Boris Ostrovsky
2015-01-07 15:17 ` Jan Beulich
2015-01-07 15:54 ` Boris Ostrovsky
2015-01-07 16:52 ` Jan Beulich
2015-01-07 17:55 ` Dario Faggioli
2015-01-08 9:50 ` Jan Beulich
2015-01-08 15:49 ` Boris Ostrovsky
2015-01-08 15:54 ` Jan Beulich
2015-01-06 2:18 ` [PATCH v2 4/4] libxl: Add interface for querying hypervisor about " Boris Ostrovsky
2015-01-06 17:08 ` Wei Liu
2015-01-07 9:04 ` Dario Faggioli
2015-01-07 14:15 ` Boris Ostrovsky
2015-01-07 14:45 ` Dario Faggioli
2015-01-19 17:32 ` Ian Campbell
2015-01-20 10:54 ` Roger Pau Monné
2015-01-20 10:56 ` Ian Campbell
2015-01-20 15:15 ` Boris Ostrovsky
2015-01-20 15:21 ` Ian Campbell
2015-01-20 16:04 ` Boris Ostrovsky
2015-01-20 16:15 ` Ian Campbell
2015-01-20 16:08 ` Egger, Christoph
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=1420510737-22813-4-git-send-email-boris.ostrovsky@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=andrew.cooper3@citrix.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=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.