|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCHv2] 05/27] build: convert HAS_PCI use to Kconfig
Use the Kconfig generated CONFIG_HAS_PCI defines in the code base.
Signed-off-by: Doug Goldstein <cardoe@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/x86/Kconfig | 1 +
xen/arch/x86/Rules.mk | 1 -
xen/common/sysctl.c | 2 +-
xen/drivers/Kconfig | 3 +++
xen/drivers/Makefile | 2 +-
xen/drivers/char/ns16550.c | 24 ++++++++++++------------
xen/drivers/passthrough/Makefile | 2 +-
xen/drivers/passthrough/iommu.c | 2 +-
xen/drivers/pci/Kconfig | 4 ++++
xen/include/xen/iommu.h | 10 +++++-----
xen/include/xsm/dummy.h | 4 ++--
xen/include/xsm/xsm.h | 6 +++---
xen/xsm/dummy.c | 2 +-
xen/xsm/flask/hooks.c | 14 +++++++-------
15 files changed, 42 insertions(+), 36 deletions(-)
create mode 100644 xen/drivers/pci/Kconfig
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 15dcedc..fb270f6 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -61,7 +61,6 @@ CFLAGS-$(HAS_GDBSX) += -DHAS_GDBSX
CFLAGS-$(HAS_MEM_ACCESS) += -DHAS_MEM_ACCESS
CFLAGS-$(HAS_MEM_PAGING) += -DHAS_MEM_PAGING
CFLAGS-$(HAS_MEM_SHARING) += -DHAS_MEM_SHARING
-CFLAGS-$(HAS_PCI) += -DHAS_PCI
CFLAGS-$(HAS_IOPORTS) += -DHAS_IOPORTS
CFLAGS-$(HAS_PDX) += -DHAS_PDX
CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index ec4948d..ef71b22 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -4,6 +4,7 @@ config X86_64
config X86
def_bool y
select HAS_PASSTHROUGH
+ select HAS_PCI
select HAS_GDBSX
config ARCH_DEFCONFIG
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index fc36813..931e0b1 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -6,7 +6,6 @@ HAS_ACPI := y
HAS_VGA := y
HAS_VIDEO := y
HAS_CPUFREQ := y
-HAS_PCI := y
HAS_NS16550 := y
HAS_EHCI := y
HAS_KEXEC := y
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index 85e853f..47d115e 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -401,7 +401,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t)
u_sysctl)
break;
#endif
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
case XEN_SYSCTL_pcitopoinfo:
{
xen_sysctl_pcitopoinfo_t *ti = &op->u.pcitopoinfo;
diff --git a/xen/drivers/Kconfig b/xen/drivers/Kconfig
index 57311cc..5362e41 100644
--- a/xen/drivers/Kconfig
+++ b/xen/drivers/Kconfig
@@ -1,4 +1,7 @@
menu "Device Drivers"
source "drivers/passthrough/Kconfig"
+
+source "drivers/pci/Kconfig"
+
endmenu
diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile
index e283870..eb32d69 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-$(CONFIG_HAS_PCI) += pci
subdir-$(CONFIG_HAS_PASSTHROUGH) += passthrough
subdir-$(HAS_ACPI) += acpi
subdir-$(HAS_VIDEO) += video
diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index bd524e6..615124c 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -16,7 +16,7 @@
#include <xen/timer.h>
#include <xen/serial.h>
#include <xen/iocap.h>
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
#include <xen/pci.h>
#include <xen/pci_regs.h>
#include <xen/pci_ids.h>
@@ -64,7 +64,7 @@ static struct ns16550 {
unsigned int timeout_ms;
bool_t intr_works;
bool_t dw_usr_bsy;
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
/* PCI card parameters. */
unsigned int pb_bdf[3]; /* pci bridge BDF */
unsigned int ps_bdf[3]; /* pci serial port BDF */
@@ -97,7 +97,7 @@ struct ns16550_config_param {
};
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
enum {
param_default = 0,
param_trumanage,
@@ -474,7 +474,7 @@ static int ns16550_getc(struct serial_port *port, char *pc)
static void pci_serial_early_init(struct ns16550 *uart)
{
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
return;
@@ -615,7 +615,7 @@ static void __init ns16550_init_postirq(struct serial_port
*port)
ns16550_setup_postirq(uart);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
if ( uart->bar || uart->ps_bdf_enable )
{
if ( !uart->enable_ro )
@@ -644,7 +644,7 @@ static void ns16550_suspend(struct serial_port *port)
stop_timer(&uart->timer);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
if ( uart->bar )
uart->cr = pci_conf_read16(0, uart->ps_bdf[0], uart->ps_bdf[1],
uart->ps_bdf[2], PCI_COMMAND);
@@ -653,7 +653,7 @@ static void ns16550_suspend(struct serial_port *port)
static void _ns16550_resume(struct serial_port *port)
{
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
struct ns16550 *uart = port->uart;
if ( uart->bar )
@@ -791,7 +791,7 @@ static int __init check_existence(struct ns16550 *uart)
return 1; /* Everything is MMIO */
#endif
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
pci_serial_early_init(uart);
#endif
@@ -822,7 +822,7 @@ static int __init check_existence(struct ns16550 *uart)
return (status == 0x90);
}
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
static int __init
pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx)
{
@@ -1022,7 +1022,7 @@ static void __init ns16550_parse_port_config(
if ( *conf == ',' && *++conf != ',' )
{
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
if ( strncmp(conf, "pci", 3) == 0 )
{
if ( pci_uart_config(uart, 1/* skip AMT */, uart - ns16550_com) )
@@ -1045,7 +1045,7 @@ static void __init ns16550_parse_port_config(
if ( *conf == ',' && *++conf != ',' )
uart->irq = simple_strtol(conf, &conf, 10);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
if ( *conf == ',' && *++conf != ',' )
{
conf = parse_pci(conf, NULL, &uart->ps_bdf[0],
@@ -1086,7 +1086,7 @@ static void ns16550_init_common(struct ns16550 *uart)
{
uart->clock_hz = UART_CLOCK_HZ;
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
uart->enable_ro = 0;
#endif
diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Makefile
index 2bb5afb..a6657c5 100644
--- a/xen/drivers/passthrough/Makefile
+++ b/xen/drivers/passthrough/Makefile
@@ -5,5 +5,5 @@ subdir-$(arm) += arm
obj-y += iommu.o
obj-$(x86) += io.o
-obj-$(HAS_PCI) += pci.o
+obj-$(CONFIG_HAS_PCI) += pci.o
obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 3359330..65c2e46 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -342,7 +342,7 @@ int iommu_do_domctl(
if ( !iommu_enabled )
return -ENOSYS;
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
ret = iommu_do_pci_domctl(domctl, d, u_domctl);
#endif
diff --git a/xen/drivers/pci/Kconfig b/xen/drivers/pci/Kconfig
new file mode 100644
index 0000000..68b9953
--- /dev/null
+++ b/xen/drivers/pci/Kconfig
@@ -0,0 +1,4 @@
+
+# Select HAS_PCI if PCI is supported
+config HAS_PCI
+ bool
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index fa10a45..e5ed3be 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -87,7 +87,7 @@ enum iommu_feature
bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
void pt_pci_init(void);
struct pirq;
@@ -107,7 +107,7 @@ int iommu_update_ire_from_msi(struct msi_desc *msi_desc,
struct msi_msg *msg);
void iommu_read_msi_from_ire(struct msi_desc *msi_desc, struct msi_msg *msg);
#define PT_IRQ_TIME_OUT MILLISECS(8)
-#endif /* HAS_PCI */
+#endif /* CONFIG_HAS_PCI */
#ifdef CONFIG_HAS_DEVICE_TREE
#include <xen/device_tree.h>
@@ -141,11 +141,11 @@ struct iommu_ops {
int (*assign_device)(struct domain *, u8 devfn, device_t *dev, u32 flag);
int (*reassign_device)(struct domain *s, struct domain *t,
u8 devfn, device_t *dev);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
int (*get_device_group_id)(u16 seg, u8 bus, u8 devfn);
int (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg);
void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
-#endif /* HAS_PCI */
+#endif /* CONFIG_HAS_PCI */
void (*teardown)(struct domain *d);
int (*map_page)(struct domain *d, unsigned long gfn, unsigned long mfn,
@@ -174,7 +174,7 @@ int iommu_get_reserved_device_memory(iommu_grdm_t *, void
*);
void iommu_share_p2m_table(struct domain *d);
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
int iommu_do_pci_domctl(struct xen_domctl *, struct domain *d,
XEN_GUEST_HANDLE_PARAM(xen_domctl_t));
#endif
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index fa47daa..42e696a 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(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
static XSM_INLINE int xsm_get_device_group(XSM_DEFAULT_ARG uint32_t
machine_bdf)
{
XSM_ASSERT_ACTION(XSM_HOOK);
@@ -348,7 +348,7 @@ static XSM_INLINE int xsm_deassign_device(XSM_DEFAULT_ARG
struct domain *d, uint
return xsm_default_action(action, current->domain, d);
}
-#endif /* CONFIG_HAS_PASSTHROUGH && HAS_PCI */
+#endif /* CONFIG_HAS_PASSTHROUGH && CONFIG_HAS_PCI */
#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE)
static XSM_INLINE int xsm_test_assign_dtdevice(XSM_DEFAULT_ARG const char
*dtpath)
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 02d66c8..c843a41 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -114,7 +114,7 @@ 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(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_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);
@@ -468,7 +468,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(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_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);
@@ -488,7 +488,7 @@ static inline int xsm_deassign_device(xsm_default_t def,
struct domain *d, uint3
{
return xsm_ops->deassign_device(d, machine_bdf);
}
-#endif /* CONFIG_HAS_PASSTHROUGH && HAS_PCI) */
+#endif /* CONFIG_HAS_PASSTHROUGH && CONFIG_HAS_PCI) */
#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE)
static inline int xsm_assign_dtdevice(xsm_default_t def, struct domain *d,
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 880662f..e8741a4 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -89,7 +89,7 @@ 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(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_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);
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 0c9ef87..db01875 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -20,7 +20,7 @@
#include <xen/errno.h>
#include <xen/guest_access.h>
#include <xen/xenoprof.h>
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
#include <asm/msi.h>
#endif
#include <public/xen.h>
@@ -111,7 +111,7 @@ static int get_irq_sid(int irq, u32 *sid, struct
avc_audit_data *ad)
}
return security_irq_sid(irq, sid);
}
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
{
struct irq_desc *desc = irq_to_desc(irq);
if ( desc->msi_desc && desc->msi_desc->dev ) {
@@ -853,7 +853,7 @@ static int flask_map_domain_pirq (struct domain *d)
static int flask_map_domain_msi (struct domain *d, int irq, void *data,
u32 *sid, struct avc_audit_data *ad)
{
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
struct msi_info *msi = data;
u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
@@ -899,7 +899,7 @@ static int flask_unmap_domain_pirq (struct domain *d)
static int flask_unmap_domain_msi (struct domain *d, int irq, void *data,
u32 *sid, struct avc_audit_data *ad)
{
-#ifdef HAS_PCI
+#ifdef CONFIG_HAS_PCI
struct msi_info *msi = data;
u32 machine_bdf = (msi->seg << 16) | (msi->bus << 8) | msi->devfn;
@@ -1213,7 +1213,7 @@ static int flask_mem_sharing(struct domain *d)
}
#endif
-#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
static int flask_get_device_group(uint32_t machine_bdf)
{
u32 rsid;
@@ -1277,7 +1277,7 @@ static int flask_deassign_device(struct domain *d,
uint32_t machine_bdf)
return avc_current_has_perm(rsid, SECCLASS_RESOURCE,
RESOURCE__REMOVE_DEVICE, NULL);
}
-#endif /* CONFIG_HAS_PASSTHROUGH && HAS_PCI */
+#endif /* CONFIG_HAS_PASSTHROUGH && CONFIG_HAS_PCI */
#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE)
static int flask_test_assign_dtdevice(const char *dtpath)
@@ -1725,7 +1725,7 @@ static struct xsm_operations flask_ops = {
.remove_from_physmap = flask_remove_from_physmap,
.map_gmfn_foreign = flask_map_gmfn_foreign,
-#if defined(CONFIG_HAS_PASSTHROUGH) && defined(HAS_PCI)
+#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_PCI)
.get_device_group = flask_get_device_group,
.test_assign_device = flask_test_assign_device,
.assign_device = flask_assign_device,
--
2.4.10
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |