All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v11 12/12] vpci: do not expose unneeded functions to the user-space test harness
Date: Tue, 20 Mar 2018 15:15:43 +0000	[thread overview]
Message-ID: <20180320151543.84348-13-roger.pau@citrix.com> (raw)
In-Reply-To: <20180320151543.84348-1-roger.pau@citrix.com>

Some functions in vpci.c (vpci_remove_device and vpci_add_handlers)
are not used by the user-space test harness, so guard them with
__XEN__ in order to avoid exposing them to the user-space test
harness.

Requested-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/tests/vpci/Makefile |  8 ++------
 xen/drivers/vpci/vpci.c   | 10 ++++++----
 xen/include/xen/vpci.h    |  6 +-----
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index e45fcb5cd9..5075bc2be2 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -24,12 +24,8 @@ distclean: clean
 install:
 
 vpci.c: $(XEN_ROOT)/xen/drivers/vpci/vpci.c
-	# Trick the compiler so it doesn't complain about missing symbols
-	sed -e '/#include/d' \
-	    -e '1s;^;#include "emul.h"\
-	             vpci_register_init_t *const __start_vpci_array[1]\;\
-	             vpci_register_init_t *const __end_vpci_array[1]\;\
-	             ;' <$< >$@
+	# Remove includes and add the test harness header
+	sed -e '/#include/d' -e '1s/^/#include "emul.h"/' <$< >$@
 
 list.h: $(XEN_ROOT)/xen/include/xen/list.h
 vpci.h: $(XEN_ROOT)/xen/include/xen/vpci.h
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
index 8ec9c916ea..2913b56500 100644
--- a/xen/drivers/vpci/vpci.c
+++ b/xen/drivers/vpci/vpci.c
@@ -20,10 +20,6 @@
 #include <xen/sched.h>
 #include <xen/vpci.h>
 
-extern vpci_register_init_t *const __start_vpci_array[];
-extern vpci_register_init_t *const __end_vpci_array[];
-#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
-
 /* Internal struct to store the emulated PCI registers. */
 struct vpci_register {
     vpci_read_t *read;
@@ -34,6 +30,11 @@ struct vpci_register {
     struct list_head node;
 };
 
+#ifdef __XEN__
+extern vpci_register_init_t *const __start_vpci_array[];
+extern vpci_register_init_t *const __end_vpci_array[];
+#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
+
 void vpci_remove_device(struct pci_dev *pdev)
 {
     spin_lock(&pdev->vpci->lock);
@@ -80,6 +81,7 @@ int __hwdom_init vpci_add_handlers(struct pci_dev *pdev)
 
     return rc;
 }
+#endif /* __XEN__ */
 
 static int vpci_register_cmp(const struct vpci_register *r1,
                              const struct vpci_register *r2)
diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
index fc47163ba6..cb39e0ebea 100644
--- a/xen/include/xen/vpci.h
+++ b/xen/include/xen/vpci.h
@@ -90,11 +90,9 @@ struct vpci {
         bool rom_enabled      : 1;
         /* FIXME: currently there's no support for SR-IOV. */
     } header;
-#endif
 
     /* MSI data. */
     struct vpci_msi {
-#ifdef __XEN__
       /* Address. */
         uint64_t address;
         /* Mask bitfield. */
@@ -113,12 +111,10 @@ struct vpci {
         uint8_t vectors     : 5;
         /* Arch-specific data. */
         struct vpci_arch_msi arch;
-#endif
     } *msi;
 
     /* MSI-X data. */
     struct vpci_msix {
-#ifdef __XEN__
         struct pci_dev *pdev;
         /* List link. */
         struct list_head next;
@@ -141,8 +137,8 @@ struct vpci {
             bool updated : 1;
             struct vpci_arch_msix_entry arch;
         } entries[];
-#endif
     } *msix;
+#endif
 };
 
 struct vpci_vcpu {
-- 
2.16.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-03-20 15:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 15:15 [PATCH v11 00/12] vpci: PCI config space emulation Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 01/12] vpci: introduce basic handlers to trap accesses to the PCI config space Roger Pau Monne
2018-03-21  4:39   ` Julien Grall
2018-03-20 15:15 ` [PATCH v11 02/12] x86/mmcfg: add handlers for the PVH Dom0 MMCFG areas Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 03/12] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0 Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 04/12] pci: split code to size BARs from pci_add_device Roger Pau Monne
2018-03-22 10:15   ` Jan Beulich
2018-03-22 10:31     ` Roger Pau Monné
2018-03-22 10:33       ` Jan Beulich
2018-03-20 15:15 ` [PATCH v11 05/12] pci: add support to size ROM BARs to pci_size_mem_bar Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 06/12] xen: introduce rangeset_consume_ranges Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 07/12] vpci: add header handlers Roger Pau Monne
2018-03-20 16:19   ` Jan Beulich
2018-03-21 12:31   ` Paul Durrant
2018-03-20 15:15 ` [PATCH v11 08/12] x86/pt: mask MSI vectors on unbind Roger Pau Monne
2018-03-20 15:15 ` [PATCH v11 09/12] vpci/msi: add MSI handlers Roger Pau Monne
2018-03-21 12:34   ` Paul Durrant
2018-03-20 15:15 ` [PATCH v11 10/12] vpci: add a priority parameter to the vPCI register initializer Roger Pau Monne
2018-03-22  9:57   ` Jan Beulich
2018-03-20 15:15 ` [PATCH v11 11/12] vpci/msix: add MSI-X handlers Roger Pau Monne
2018-03-21 12:36   ` Paul Durrant
2018-03-20 15:15 ` Roger Pau Monne [this message]
2018-03-20 16:20   ` [PATCH v11 12/12] vpci: do not expose unneeded functions to the user-space test harness Jan Beulich

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=20180320151543.84348-13-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=xen-devel@lists.xenproject.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.