[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v7 05/28] build: convert HAS_PASSTHROUGH use to Kconfig



Use the Kconfig generated HAS_PASSTHROUGH defines for the code base.

CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
CC: Keir Fraser <keir@xxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 xen/Rules.mk                    |  1 -
 xen/arch/arm/Kconfig            |  1 +
 xen/arch/arm/Rules.mk           |  1 -
 xen/arch/x86/Kconfig            |  1 +
 xen/arch/x86/Rules.mk           |  1 -
 xen/common/compat/memory.c      |  4 ++--
 xen/common/memory.c             |  8 ++++----
 xen/drivers/Kconfig             |  1 +
 xen/drivers/Makefile            |  2 +-
 xen/drivers/passthrough/Kconfig |  4 ++++
 xen/include/xen/sched.h         |  4 ++--
 xen/include/xsm/dummy.h         |  4 ++--
 xen/include/xsm/xsm.h           |  8 ++++----
 xen/xsm/dummy.c                 |  4 ++--
 xen/xsm/flask/hooks.c           | 10 +++++-----
 15 files changed, 29 insertions(+), 25 deletions(-)
 create mode 100644 xen/drivers/passthrough/Kconfig

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d696206..a822147 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -58,7 +58,6 @@ CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
 CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_GDBSX)     += -DHAS_GDBSX
-CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
 CFLAGS-$(HAS_DEVICE_TREE) += -DHAS_DEVICE_TREE
 CFLAGS-$(HAS_MEM_ACCESS)  += -DHAS_MEM_ACCESS
 CFLAGS-$(HAS_MEM_PAGING)  += -DHAS_MEM_PAGING
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 91b96bc..0fd69a7 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -16,6 +16,7 @@ config ARM_64
 
 config ARM
        def_bool y
+       select HAS_PASSTHROUGH
 
 config ARCH_DEFCONFIG
        string
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index b31770c..86d7b81 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -9,7 +9,6 @@
 HAS_DEVICE_TREE := y
 HAS_VIDEO := y
 HAS_ARM_HDLCD := y
-HAS_PASSTHROUGH := y
 HAS_PDX := y
 
 CFLAGS += -I$(BASEDIR)/include
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 9df34a4..3771256 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -3,6 +3,7 @@ config X86_64
 
 config X86
        def_bool y
+       select HAS_PASSTHROUGH
 
 config ARCH_DEFCONFIG
        string
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 5b8eaed..09f2844 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -8,7 +8,6 @@ HAS_VGA  := y
 HAS_VIDEO  := y
 HAS_CPUFREQ := y
 HAS_PCI := y
-HAS_PASSTHROUGH := y
 HAS_NS16550 := y
 HAS_EHCI := y
 HAS_KEXEC := y
diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c
index bb10993..19a914d 100644
--- a/xen/common/compat/memory.c
+++ b/xen/common/compat/memory.c
@@ -18,7 +18,7 @@ CHECK_TYPE(domid);
 CHECK_mem_access_op;
 CHECK_vmemrange;
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
 struct get_reserved_device_memory {
     struct compat_reserved_device_memory_map map;
     unsigned int used_entries;
@@ -340,7 +340,7 @@ int compat_memory_op(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) compat)
             break;
         }
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
         case XENMEM_reserved_device_memory_map:
         {
             struct get_reserved_device_memory grdm;
diff --git a/xen/common/memory.c b/xen/common/memory.c
index efb6e1a..6b3a755 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -651,7 +651,7 @@ static int xenmem_add_to_physmap(struct domain *d,
     xatp->gpfn += start;
     xatp->size -= start;
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( need_iommu(d) )
         this_cpu(iommu_dont_flush_iotlb) = 1;
 #endif
@@ -674,7 +674,7 @@ static int xenmem_add_to_physmap(struct domain *d,
         }
     }
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
     if ( need_iommu(d) )
     {
         this_cpu(iommu_dont_flush_iotlb) = 0;
@@ -801,7 +801,7 @@ static int construct_memop_from_reservation(
     return 0;
 }
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
 struct get_reserved_device_memory {
     struct xen_reserved_device_memory_map map;
     unsigned int used_entries;
@@ -1245,7 +1245,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         break;
     }
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
     case XENMEM_reserved_device_memory_map:
     {
         struct get_reserved_device_memory grdm;
diff --git a/xen/drivers/Kconfig b/xen/drivers/Kconfig
index 7bc7b6e..57311cc 100644
--- a/xen/drivers/Kconfig
+++ b/xen/drivers/Kconfig
@@ -1,3 +1,4 @@
 menu "Device Drivers"
 
+source "drivers/passthrough/Kconfig"
 endmenu
diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile
index 9c70f20..e283870 100644
--- a/xen/drivers/Makefile
+++ b/xen/drivers/Makefile
@@ -1,6 +1,6 @@
 subdir-y += char
 subdir-$(HAS_CPUFREQ) += cpufreq
 subdir-$(HAS_PCI) += pci
-subdir-$(HAS_PASSTHROUGH) += passthrough
+subdir-$(CONFIG_HAS_PASSTHROUGH) += passthrough
 subdir-$(HAS_ACPI) += acpi
 subdir-$(HAS_VIDEO) += video
diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
new file mode 100644
index 0000000..05a8daf
--- /dev/null
+++ b/xen/drivers/passthrough/Kconfig
@@ -0,0 +1,4 @@
+
+# Select HAS_PASSTHROUGH if device pass through is supported
+config HAS_PASSTHROUGH
+       bool
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 3729b0f..fc61fc3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -366,7 +366,7 @@ struct domain
 
     int64_t          time_offset_seconds;
 
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
     /* Does this guest need iommu mappings (-1 meaning "being set up")? */
     s8               need_iommu;
 #endif
@@ -839,7 +839,7 @@ void watchdog_domain_destroy(struct domain *d);
 #define has_hvm_container_vcpu(v)   (has_hvm_container_domain((v)->domain))
 #define is_pinned_vcpu(v) ((v)->domain->is_pinned || \
                            cpumask_weight((v)->cpu_hard_affinity) == 1)
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
 #define need_iommu(d)    ((d)->need_iommu)
 #else
 #define need_iommu(d)    (0)
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index e43f2a1..50b94a1 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -323,7 +323,7 @@ static XSM_INLINE int xsm_get_vnumainfo(XSM_DEFAULT_ARG 
struct domain *d)
     return xsm_default_action(action, current->domain, d);
 }
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
 static XSM_INLINE int xsm_get_device_group(XSM_DEFAULT_ARG uint32_t 
machine_bdf)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
@@ -350,7 +350,7 @@ static XSM_INLINE int xsm_deassign_device(XSM_DEFAULT_ARG 
struct domain *d, uint
 
 #endif /* HAS_PASSTHROUGH && HAS_PCI */
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
 static XSM_INLINE int xsm_test_assign_dtdevice(XSM_DEFAULT_ARG const char 
*dtpath)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index f48cf60..e5cb088 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -114,14 +114,14 @@ struct xsm_operations {
     int (*iomem_mapping) (struct domain *d, uint64_t s, uint64_t e, uint8_t 
allow);
     int (*pci_config_permission) (struct domain *d, uint32_t machine_bdf, 
uint16_t start, uint16_t end, uint8_t access);
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
     int (*get_device_group) (uint32_t machine_bdf);
     int (*test_assign_device) (uint32_t machine_bdf);
     int (*assign_device) (struct domain *d, uint32_t machine_bdf);
     int (*deassign_device) (struct domain *d, uint32_t machine_bdf);
 #endif
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
     int (*test_assign_dtdevice) (const char *dtpath);
     int (*assign_dtdevice) (struct domain *d, const char *dtpath);
     int (*deassign_dtdevice) (struct domain *d, const char *dtpath);
@@ -469,7 +469,7 @@ static inline int xsm_pci_config_permission (xsm_default_t 
def, struct domain *d
     return xsm_ops->pci_config_permission(d, machine_bdf, start, end, access);
 }
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
 static inline int xsm_get_device_group(xsm_default_t def, uint32_t machine_bdf)
 {
     return xsm_ops->get_device_group(machine_bdf);
@@ -491,7 +491,7 @@ static inline int xsm_deassign_device(xsm_default_t def, 
struct domain *d, uint3
 }
 #endif /* HAS_PASSTHROUGH && HAS_PCI) */
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
 static inline int xsm_assign_dtdevice(xsm_default_t def, struct domain *d,
                                       const char *dtpath)
 {
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 618a96e..036db4b 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -89,14 +89,14 @@ void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, pci_config_permission);
     set_to_dummy_if_null(ops, get_vnumainfo);
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
     set_to_dummy_if_null(ops, get_device_group);
     set_to_dummy_if_null(ops, test_assign_device);
     set_to_dummy_if_null(ops, assign_device);
     set_to_dummy_if_null(ops, deassign_device);
 #endif
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
     set_to_dummy_if_null(ops, test_assign_dtdevice);
     set_to_dummy_if_null(ops, assign_dtdevice);
     set_to_dummy_if_null(ops, deassign_dtdevice);
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index da8d287..3f4ceea 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -588,7 +588,7 @@ static int flask_domctl(struct domain *d, int cmd)
     case XEN_DOMCTL_ioport_permission:
     case XEN_DOMCTL_ioport_mapping:
 #endif
-#ifdef HAS_PASSTHROUGH
+#ifdef CONFIG_HAS_PASSTHROUGH
     /*
      * These have individual XSM hooks
      * (drivers/passthrough/{pci,device_tree.c)
@@ -1213,7 +1213,7 @@ static int flask_mem_sharing(struct domain *d)
 }
 #endif
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
 static int flask_get_device_group(uint32_t machine_bdf)
 {
     u32 rsid;
@@ -1279,7 +1279,7 @@ static int flask_deassign_device(struct domain *d, 
uint32_t machine_bdf)
 }
 #endif /* HAS_PASSTHROUGH && HAS_PCI */
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
 static int flask_test_assign_dtdevice(const char *dtpath)
 {
     u32 rsid;
@@ -1725,14 +1725,14 @@ static struct xsm_operations flask_ops = {
     .remove_from_physmap = flask_remove_from_physmap,
     .map_gmfn_foreign = flask_map_gmfn_foreign,
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
     .get_device_group = flask_get_device_group,
     .test_assign_device = flask_test_assign_device,
     .assign_device = flask_assign_device,
     .deassign_device = flask_deassign_device,
 #endif
 
-#if defined(HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_DEVICE_TREE)
     .test_assign_dtdevice = flask_test_assign_dtdevice,
     .assign_dtdevice = flask_assign_dtdevice,
     .deassign_dtdevice = flask_deassign_dtdevice,
-- 
2.4.10


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.