Skip to contentSkip to conversation

ACPI: Allow CONFIG_PCI to be unset for reboot

PATCH Superseded Sinan Kaya 3 participants 10 messages Dec 12, 2018 1 message not in the archive

Subsystems (4)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Sinan Kaya

author
#1 lore raw

PATCH v6 1/5 ACPI: Allow CONFIG_PCI to be unset for reboot

Make PCI reboot conditional on PCI support being present on the kernel configuration.

---
 drivers/acpi/reboot.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/acpi/reboot.c +7 -3
index 6fa9c2a4cfe9..d75e637ee36a 100644
@@ -7,8 +7,6 @@
 void acpi_reboot(void)
 {
 	struct acpi_generic_address *rr;
-	struct pci_bus *bus0;
-	unsigned int devfn;
 	u8 reset_value;
 
 	if (acpi_disabled)
@@ -33,6 +31,11 @@ void acpi_reboot(void)
 	 * on a device on bus 0. */
 	switch (rr->space_id) {
 	case ACPI_ADR_SPACE_PCI_CONFIG:
+	{
+#ifdef CONFIG_PCI
+		unsigned int devfn;
+		struct pci_bus *bus0;
+
 		/* The reset register can only live on bus 0. */
 		bus0 = pci_find_bus(0, 0);
 		if (!bus0)
@@ -44,8 +47,9 @@ void acpi_reboot(void)
 		/* Write the value that resets us. */
 		pci_bus_write_config_byte(bus0, devfn,
 				(rr->address & 0xffff), reset_value);
+#endif
 		break;
-
+	}
 	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
 	case ACPI_ADR_SPACE_SYSTEM_IO:
 		printk(KERN_DEBUG "ACPI MEMORY or I/O RESET_REG.\n");
Signature · 1 line
2.19.0
author
#2 lore raw

PATCH v6 2/5 ACPI / OSL: Stub out acpi_os_read_pci_configuration when CONFIG_PCI is unset

In reply to a message not in the archive

Getting ready to allow CONFIG_PCI to be disabled with ACPI enabled. Stub out acpi_os_read_pci_configuration function that depend on PCI.

---
 drivers/acpi/osl.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/osl.c +7 -0
index b48874b8e1ea..fb92b8a0ad31 100644
@@ -773,6 +773,7 @@ acpi_status
 acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 			       u64 *value, u32 width)
 {
+#ifdef CONFIG_PCI
 	int result, size;
 	u32 value32;
 
@@ -799,6 +800,12 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 	*value = value32;
 
 	return (result ? AE_ERROR : AE_OK);
+#else
+	int rc;
+
+	rc = pr_warn_once("PCI configuration space access is not supported\n");
+	return rc ? AE_SUPPORT : AE_OK;
+#endif
 }
 
 acpi_status
Signature · 1 line
2.19.0
author
#3 lore raw

PATCH v6 3/5 ACPI / OSL: Stub out acpi_os_write_pci_configuration when CONFIG_PCI is unset

In reply to a message not in the archive

Getting ready to allow CONFIG_PCI to be disabled with ACPI enabled. Stub out acpi_os_write_pci_configuration function that depend on PCI.

---
 drivers/acpi/osl.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/osl.c +7 -0
index fb92b8a0ad31..524fd5f33ea4 100644
@@ -812,6 +812,7 @@ acpi_status
 acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 				u64 value, u32 width)
 {
+#ifdef CONFIG_PCI
 	int result, size;
 
 	switch (width) {
@@ -833,6 +834,12 @@ acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 				reg, size, value);
 
 	return (result ? AE_ERROR : AE_OK);
+#else
+	int rc;
+
+	rc = pr_warn_once("PCI configuration space access is not supported\n");
+	return rc ? AE_SUPPORT : AE_OK;
+#endif
 }
 
 static void acpi_os_execute_deferred(struct work_struct *work)
Signature · 1 line
2.19.0
author
#4 lore raw

PATCH v6 4/5 PCI/ACPI: Allow ACPI to be built without CONFIG_PCI set

In reply to a message not in the archive

We are compiling PCI code today for systems with ACPI and no PCI device present. Remove the useless code and reduce the tight dependency.

---
 arch/x86/include/asm/pci_x86.h | 7 +++++++
 drivers/acpi/Kconfig           | 1 -
 drivers/acpi/Makefile          | 2 +-
 drivers/acpi/internal.h        | 5 +++++
 drivers/pci/Makefile           | 2 +-
 include/acpi/acpi_drivers.h    | 7 +++++++
 include/linux/acpi.h           | 7 +++++++
 include/linux/pci.h            | 4 ++++
 8 files changed, 32 insertions(+), 3 deletions(-)
arch/x86/include/asm/pci_x86.h +7 -0
index 959d618dbb17..73bb404f4d2a 100644
@@ -121,7 +121,14 @@ extern void __init dmi_check_pciprobe(void);
 extern void __init dmi_check_skip_isa_align(void);
 
 /* some common used subsys_initcalls */
+#ifdef CONFIG_PCI
 extern int __init pci_acpi_init(void);
+#else
+static inline int  __init pci_acpi_init(void)
+{
+	return -EINVAL;
+}
+#endif
 extern void __init pcibios_irq_init(void);
 extern int __init pcibios_init(void);
 extern int pci_legacy_init(void);
drivers/acpi/Kconfig +0 -1
index 7cea769c37df..a0abcb3bd673 100644
@@ -9,7 +9,6 @@ config ARCH_SUPPORTS_ACPI
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"
 	depends on ARCH_SUPPORTS_ACPI
-	depends on PCI
 	select PNP
 	default y if X86
 	help
drivers/acpi/Makefile +1 -1
index edc039313cd6..7c6afc111d76 100644
@@ -39,7 +39,7 @@ acpi-y				+= processor_core.o
 acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
 acpi-y				+= ec.o
 acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
-acpi-y				+= pci_root.o pci_link.o pci_irq.o
+acpi-$(CONFIG_PCI)		+= pci_root.o pci_link.o pci_irq.o
 obj-$(CONFIG_ACPI_MCFG)		+= pci_mcfg.o
 acpi-y				+= acpi_lpss.o acpi_apd.o
 acpi-y				+= acpi_platform.o
drivers/acpi/internal.h +5 -0
index 530a3f675490..b7060dae2789 100644
@@ -25,8 +25,13 @@ int acpi_osi_init(void);
 acpi_status acpi_os_initialize1(void);
 void init_acpi_device_notify(void);
 int acpi_scan_init(void);
+#ifdef CONFIG_PCI
 void acpi_pci_root_init(void);
 void acpi_pci_link_init(void);
+#else
+static inline void acpi_pci_root_init(void) {}
+static inline void acpi_pci_link_init(void) {}
+#endif
 void acpi_processor_init(void);
 void acpi_platform_init(void);
 void acpi_pnp_init(void);
drivers/pci/Makefile +1 -1
index f2bda77a2df1..657d642fcc67 100644
@@ -11,6 +11,7 @@ ifdef CONFIG_PCI
 obj-$(CONFIG_PROC_FS)		+= proc.o
 obj-$(CONFIG_SYSFS)		+= slot.o
 obj-$(CONFIG_OF)		+= of.o
+obj-$(CONFIG_ACPI)		+= pci-acpi.o
 endif
 
 obj-$(CONFIG_PCI_QUIRKS)	+= quirks.o
@@ -20,7 +21,6 @@ obj-$(CONFIG_PCI_MSI)		+= msi.o
 obj-$(CONFIG_PCI_ATS)		+= ats.o
 obj-$(CONFIG_PCI_IOV)		+= iov.o
 obj-$(CONFIG_PCI_BRIDGE_EMUL)	+= pci-bridge-emul.o
-obj-$(CONFIG_ACPI)		+= pci-acpi.o
 obj-$(CONFIG_PCI_LABEL)		+= pci-label.o
 obj-$(CONFIG_X86_INTEL_MID)	+= pci-mid.o
 obj-$(CONFIG_PCI_SYSCALL)	+= syscall.o
include/acpi/acpi_drivers.h +7 -0
index 14499757338f..de1804aeaf69 100644
@@ -88,7 +88,14 @@ int acpi_pci_link_free_irq(acpi_handle handle);
 
 struct pci_bus;
 
+#ifdef CONFIG_PCI
 struct pci_dev *acpi_get_pci_dev(acpi_handle);
+#else
+static inline struct pci_dev *acpi_get_pci_dev(acpi_handle handle)
+{
+	return NULL;
+}
+#endif
 
 /* Arch-defined function to add a bus to the system */
 
include/linux/acpi.h +7 -0
index ed80f147bd50..eb1fdf4c196a 100644
@@ -340,7 +340,14 @@ struct pci_dev;
 int acpi_pci_irq_enable (struct pci_dev *dev);
 void acpi_penalize_isa_irq(int irq, int active);
 bool acpi_isa_irq_available(int irq);
+#ifdef CONFIG_PCI
 void acpi_penalize_sci_irq(int irq, int trigger, int polarity);
+#else
+static inline void acpi_penalize_sci_irq(int irq, int trigger,
+					int polarity)
+{
+}
+#endif
 void acpi_pci_irq_disable (struct pci_dev *dev);
 
 extern int ec_read(u8 addr, u8 *val);
include/linux/pci.h +4 -0
index 11c71c4ecf75..51a5a5217667 100644
@@ -1960,7 +1960,11 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,
 				 enum pcie_reset_state state);
 int pcibios_add_device(struct pci_dev *dev);
 void pcibios_release_device(struct pci_dev *dev);
+#ifdef CONFIG_PCI
 void pcibios_penalize_isa_irq(int irq, int active);
+#else
+static inline void pcibios_penalize_isa_irq(int irq, int active) {}
+#endif
 int pcibios_alloc_irq(struct pci_dev *dev);
 void pcibios_free_irq(struct pci_dev *dev);
 resource_size_t pcibios_default_alignment(void);
Signature · 1 line
2.19.0
author
#5 lore raw

PATCH v6 5/5 ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

In reply to a message not in the archive

Now that we allow CONFIG_PCI to be unset, remove useless code from ACPICA too.

---
 drivers/acpi/acpica/Makefile  | 2 +-
 drivers/acpi/acpica/achware.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/acpi/acpica/Makefile +1 -1
index b14621da5413..59700433a96e 100644
@@ -77,13 +77,13 @@ acpi-y +=		\
 	hwacpi.o	\
 	hwesleep.o	\
 	hwgpe.o		\
-	hwpci.o		\
 	hwregs.o	\
 	hwsleep.o	\
 	hwvalid.o	\
 	hwxface.o	\
 	hwxfsleep.o
 
+acpi-$(CONFIG_PCI) += hwpci.o
 acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
 
 acpi-y +=		\
drivers/acpi/acpica/achware.h +9 -0
index 43ce67a9da1f..1c827184fe64 100644
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 /*
  * hwpci - PCI configuration support
  */
+#ifdef CONFIG_PCI
 acpi_status
 acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id,
 		      acpi_handle root_pci_device, acpi_handle pci_region);
+#else
+static inline acpi_status
+acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, acpi_handle root_pci_device,
+		      acpi_handle pci_region)
+{
+	return AE_SUPPORT;
+}
+#endif
 
 #endif				/* __ACHWARE_H__ */
Signature · 1 line
2.19.0
#6 lore raw

RE: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 47 lines

-----Original Message-----
From: Sinan Kaya [mailto:okaya(a)kernel.org]
Sent: Wednesday, December 12, 2018 9:20 AM
To: linux-acpi(a)vger.kernel.org
Cc: Sinan Kaya <okaya(a)kernel.org>; Moore, Robert <robert.moore(a)intel.com>; Schmauss, Erik <erik.schmauss(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Len Brown <lenb(a)kernel.org>; open list:ACPI COMPONENT ARCHITECTURE (ACPICA) <devel(a)acpica.org>; open list <linux-kernel(a)vger.kernel.org>
Subject: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Now that we allow CONFIG_PCI to be unset, remove useless code from ACPICA too.

Signed-off-by Sinan Kaya <okaya(a)kernel.org>
---
 drivers/acpi/acpica/Makefile  | 2 +-
 drivers/acpi/acpica/achware.h | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/acpi/acpica/Makefile index renamed from drivers/acpi/acpica/Makefile +0 -0

b14621da5413..59700433a96e 100644

drivers/acpi/acpica/Makefile +1 -1
@@ -77,13 +77,13 @@ acpi-y +=		\
 	hwacpi.o	\
 	hwesleep.o	\
 	hwgpe.o		\
-	hwpci.o		\
 	hwregs.o	\
 	hwsleep.o	\
 	hwvalid.o	\
 	hwxface.o	\
 	hwxfsleep.o
 
+acpi-$(CONFIG_PCI) += hwpci.o
 acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
 
 acpi-y +=		\
drivers/acpi/acpica/achware.h +0 -0
index 43ce67a9da1f..1c827184fe64 100644

drivers/acpi/acpica/achware.h acpi_hw_enable_runtime_gpe_block(struct · line 109

Quoted 1 line
drivers/acpi/acpica/achware.h +0 -0
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct
 acpi_gpe_xrupt_info *gpe_xrupt_info,

CONFIG_PCI is a Linux-ism. We should stay with the OS-independent nature of ACPICA. Please use ACPI_PCI_CONFIGURED and put it above the comment like so:

#ifdef ACPI_PCI_CONFIGURED

Quoted 20 lines
drivers/acpi/acpica/achware.h +9 -0
 /*
  * hwpci - PCI configuration support
  */
+#ifdef CONFIG_PCI
 acpi_status
 acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id,
 		      acpi_handle root_pci_device, acpi_handle pci_region);
+#else
+static inline acpi_status
+acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, acpi_handle
 root_pci_device,
+		      acpi_handle pci_region)
+{
+	return AE_SUPPORT;
+}
+#endif

#endif /* __ACHWARE_H__ */
--
2.19.0

author
#7 lore raw

Re: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 7 lines · Erik

Review acpi_hw_enable_runtime_gpe_block(struct · line 109

Quoted 3 lines

++ b/drivers/acpi/acpica/achware.h

(quoted diff) +0 -0
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct
 acpi_gpe_xrupt_info *gpe_xrupt_info,

CONFIG_PCI is a Linux-ism. We should stay with the OS-independent nature of ACPICA. Please use ACPI_PCI_CONFIGURED and put it above the comment like so:

#ifdef ACPI_PCI_CONFIGURED

Thanks for the feedback. My search for ACPI_PCI_CONFIGURED returned nothing.

git grep ACPI_PCI_CONFIGURED

@Rafael,

How do you want to handle this?

#8 lore raw

Re: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 10 lines · Sinan Kaya
Quoted 7 lines · Erik

Review acpi_hw_enable_runtime_gpe_block(struct · line 109

Quoted 3 lines

++ b/drivers/acpi/acpica/achware.h

(quoted diff) +0 -0
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct
 acpi_gpe_xrupt_info *gpe_xrupt_info,

CONFIG_PCI is a Linux-ism. We should stay with the OS-independent nature of ACPICA. Please use ACPI_PCI_CONFIGURED and put it above the comment like so:

#ifdef ACPI_PCI_CONFIGURED

Quoted 7 lines

Thanks for the feedback. My search for ACPI_PCI_CONFIGURED returned nothing.

git grep ACPI_PCI_CONFIGURED

@Rafael,

How do you want to handle this?

I think what Eric suggested is effectively to introduce a new ACPICA symbol. Erik?

#9 lore raw

RE: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 28 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:rafael(a)kernel.org]
Sent: Wednesday, December 12, 2018 1:07 PM
To: okaya(a)kernel.org; Schmauss, Erik <erik.schmauss(a)intel.com>
Cc: ACPI Devel Maling List <linux-acpi(a)vger.kernel.org>; Moore, Robert <robert.moore(a)intel.com>; Wysocki, Rafael J <rafael.j.wysocki(a)intel.com>; Len Brown <lenb(a)kernel.org>; devel(a)acpica.org; Linux Kernel Mailing List <linux-kernel(a)vger.kernel.org>
Subject: Re: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 7 lines · Sinan Kaya
Quoted 5 lines · Erik

Review acpi_hw_enable_runtime_gpe_block(struct · line 109

Quoted 3 lines

++ b/drivers/acpi/acpica/achware.h

(quoted diff) +0 -0
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct
 acpi_gpe_xrupt_info *gpe_xrupt_info,

CONFIG_PCI is a Linux-ism. We should stay with the OS-independent nature of ACPICA. Please use ACPI_PCI_CONFIGURED and put it above

the comment like so:

Quoted 4 lines
Quoted 2 lines

#ifdef ACPI_PCI_CONFIGURED

Thanks for the feedback. My search for ACPI_PCI_CONFIGURED returned

nothing.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

git grep ACPI_PCI_CONFIGURED

@Rafael,

How do you want to handle this?

I think what Eric suggested is effectively to introduce a new ACPICA symbol. Erik?

Yes, that's correct and you can add something like

#ifdef CONFIG_PCI
#define ACPI_PCI_CONFIGURED
#endif

in include/linux/platform/aclinux.h to enable it.

author
#10 lore raw

Re: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 37 lines · Erik
Quoted 28 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, December 12, 2018 1:07 PM
To: [email protected]; Schmauss, Erik <[email protected]>
Cc: ACPI Devel Maling List <[email protected]>; Moore, Robert <[email protected]>; Wysocki, Rafael J <[email protected]>; Len Brown <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH v6 5/5] ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is unset

Quoted 7 lines · Sinan Kaya
Quoted 5 lines · Erik

Review acpi_hw_enable_runtime_gpe_block(struct · line 109

Quoted 3 lines

++ b/drivers/acpi/acpica/achware.h

(quoted diff) +0 -0
@@ -109,8 +109,17 @@ acpi_hw_enable_runtime_gpe_block(struct
 acpi_gpe_xrupt_info *gpe_xrupt_info,

CONFIG_PCI is a Linux-ism. We should stay with the OS-independent nature of ACPICA. Please use ACPI_PCI_CONFIGURED and put it above

the comment like so:

Quoted 4 lines
Quoted 2 lines

#ifdef ACPI_PCI_CONFIGURED

Thanks for the feedback. My search for ACPI_PCI_CONFIGURED returned

nothing.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

git grep ACPI_PCI_CONFIGURED

@Rafael,

How do you want to handle this?

I think what Eric suggested is effectively to introduce a new ACPICA symbol. Erik?

Quoted 8 lines

Yes, that's correct and you can add something like

#ifdef CONFIG_PCI
#define ACPI_PCI_CONFIGURED
#endif

in include/linux/platform/aclinux.h to enable it.

OK. Let me rework this and test.