All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: make apic_* operations inline functions
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: unstatic mp_find_ioapic so it can be used elsewhere Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: unstatic ioapic entry funcs Jeremy Fitzhardinge
@ 2009-02-09 20:05 ` Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: add mp_find_ioapic_pin Jeremy Fitzhardinge
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-09 20:05 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

Mainly to get proper type-checking and consistency.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/apic.h |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index b03711d..f4835a1 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -139,12 +139,35 @@ struct apic_ops {
 
 extern struct apic_ops *apic_ops;
 
-#define apic_read (apic_ops->read)
-#define apic_write (apic_ops->write)
-#define apic_icr_read (apic_ops->icr_read)
-#define apic_icr_write (apic_ops->icr_write)
-#define apic_wait_icr_idle (apic_ops->wait_icr_idle)
-#define safe_apic_wait_icr_idle (apic_ops->safe_wait_icr_idle)
+static inline u32 apic_read(u32 reg)
+{
+	return apic_ops->read(reg);
+}
+
+static inline void apic_write(u32 reg, u32 val)
+{
+	apic_ops->write(reg, val);
+}
+
+static inline u64 apic_icr_read(void)
+{
+	return apic_ops->icr_read();
+}
+
+static inline void apic_icr_write(u32 low, u32 high)
+{
+	apic_ops->icr_write(low, high);
+}
+
+static inline void apic_wait_icr_idle(void)
+{
+	apic_ops->wait_icr_idle();
+}
+
+static inline u32 safe_apic_wait_icr_idle(void)
+{
+	return apic_ops->safe_wait_icr_idle();
+}
 
 extern int get_physical_broadcast(void);
 
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] x86: unstatic mp_find_ioapic so it can be used elsewhere
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
@ 2009-02-09 20:05 ` Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: unstatic ioapic entry funcs Jeremy Fitzhardinge
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-09 20:05 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/mpspec.h |    1 +
 arch/x86/kernel/acpi/boot.c   |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 8c56201..b59371a 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -77,6 +77,7 @@ extern int acpi_probe_gsi(void);
 #ifdef CONFIG_X86_IO_APIC
 extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
 				u32 gsi, int triggering, int polarity);
+extern int mp_find_ioapic(int gsi);
 #else
 static inline int
 mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index c334fe7..068b900 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -872,7 +872,7 @@ static struct {
 	DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
 } mp_ioapic_routing[MAX_IO_APICS];
 
-static int mp_find_ioapic(int gsi)
+int mp_find_ioapic(int gsi)
 {
 	int i = 0;
 
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] x86: add mp_find_ioapic_pin
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
                   ` (2 preceding siblings ...)
  2009-02-09 20:05 ` [PATCH] x86: make apic_* operations inline functions Jeremy Fitzhardinge
@ 2009-02-09 20:05 ` Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] xen: expose enable_IO_APIC for 32-bit Ian Campbell
  2009-02-11  9:51 ` apic cleanups Ingo Molnar
  5 siblings, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-09 20:05 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

Add mp_find_ioapic_pin() to find an IO APIC's specific pin from a GSI,
and use this function within acpi/boot.  Make it non-static so other
code can use it too.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/mpspec.h |    1 +
 arch/x86/kernel/acpi/boot.c   |   16 +++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index b59371a..5916c8d 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -78,6 +78,7 @@ extern int acpi_probe_gsi(void);
 extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
 				u32 gsi, int triggering, int polarity);
 extern int mp_find_ioapic(int gsi);
+extern int mp_find_ioapic_pin(int ioapic, int gsi);
 #else
 static inline int
 mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 068b900..bba162c 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -887,6 +887,16 @@ int mp_find_ioapic(int gsi)
 	return -1;
 }
 
+int mp_find_ioapic_pin(int ioapic, int gsi)
+{
+	if (WARN_ON(ioapic == -1))
+		return -1;
+	if (WARN_ON(gsi > mp_ioapic_routing[ioapic].gsi_end))
+		return -1;
+
+	return gsi - mp_ioapic_routing[ioapic].gsi_base;
+}
+
 static u8 __init uniq_ioapic_id(u8 id)
 {
 #ifdef CONFIG_X86_32
@@ -1022,7 +1032,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
 	ioapic = mp_find_ioapic(gsi);
 	if (ioapic < 0)
 		return;
-	pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
+	pin = mp_find_ioapic_pin(ioapic, gsi);
 
 	/*
 	 * TBD: This check is for faulty timer entries, where the override
@@ -1142,7 +1152,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
 		return gsi;
 	}
 
-	ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
+	ioapic_pin = mp_find_ioapic_pin(ioapic, gsi);
 
 #ifdef CONFIG_X86_32
 	if (ioapic_renumber_irq)
@@ -1231,7 +1241,7 @@ int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
 	mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
 	ioapic = mp_find_ioapic(gsi);
 	mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id;
-	mp_irq.dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base;
+	mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi);
 
 	save_mp_irq(&mp_irq);
 #endif
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] x86: unstatic ioapic entry funcs
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: unstatic mp_find_ioapic so it can be used elsewhere Jeremy Fitzhardinge
@ 2009-02-09 20:05 ` Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: make apic_* operations inline functions Jeremy Fitzhardinge
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-09 20:05 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

Unstatic ioapic_write_entry and setup_ioapic_entry functions so that
the Xen code can do its own ioapic routing setup.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/io_apic.h |    6 ++++++
 arch/x86/kernel/io_apic.c      |   10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 309d0e2..59cb4a1 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -169,6 +169,12 @@ extern void reinit_intr_remapped_IO_APIC(int);
 
 extern void probe_nr_irqs_gsi(void);
 
+extern int setup_ioapic_entry(int apic, int irq,
+			      struct IO_APIC_route_entry *entry,
+			      unsigned int destination, int trigger,
+			      int polarity, int vector);
+extern void ioapic_write_entry(int apic, int pin,
+			       struct IO_APIC_route_entry e);
 #else  /* !CONFIG_X86_IO_APIC */
 #define io_apic_assign_pci_irqs 0
 static const int timer_through_8259 = 0;
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index 56e51eb..7248ca1 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -486,7 +486,7 @@ __ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
 	io_apic_write(apic, 0x10 + 2*pin, eu.w1);
 }
 
-static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
+void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e)
 {
 	unsigned long flags;
 	spin_lock_irqsave(&ioapic_lock, flags);
@@ -1478,10 +1478,10 @@ static void ioapic_register_intr(int irq, struct irq_desc *desc, unsigned long t
 					      handle_edge_irq, "edge");
 }
 
-static int setup_ioapic_entry(int apic_id, int irq,
-			      struct IO_APIC_route_entry *entry,
-			      unsigned int destination, int trigger,
-			      int polarity, int vector)
+int setup_ioapic_entry(int apic_id, int irq,
+		       struct IO_APIC_route_entry *entry,
+		       unsigned int destination, int trigger,
+		       int polarity, int vector)
 {
 	/*
 	 * add it to the IO-APIC irq-routing table:
-- 
1.6.0.6



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] xen: expose enable_IO_APIC for 32-bit
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
                   ` (3 preceding siblings ...)
  2009-02-09 20:05 ` [PATCH] x86: add mp_find_ioapic_pin Jeremy Fitzhardinge
@ 2009-02-09 20:05 ` Ian Campbell
  2009-02-11  8:36   ` Yinghai Lu
  2009-02-11  9:51 ` apic cleanups Ingo Molnar
  5 siblings, 1 reply; 8+ messages in thread
From: Ian Campbell @ 2009-02-09 20:05 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

enable_IO_APIC() is defined for both 32- and 64-bit x86, so it should
be declared for both.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/include/asm/hw_irq.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 1b82781..370e1c8 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -65,9 +65,7 @@ extern void disable_IO_APIC(void);
 extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
 extern void setup_ioapic_dest(void);
 
-#ifdef CONFIG_X86_64
 extern void enable_IO_APIC(void);
-#endif
 
 /* Statistics */
 extern atomic_t irq_err_count;
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] *** SUBJECT HERE ***
@ 2009-02-10 20:00 Jeremy Fitzhardinge
  2009-02-09 20:05 ` [PATCH] x86: unstatic mp_find_ioapic so it can be used elsewhere Jeremy Fitzhardinge
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-10 20:00 UTC (permalink / raw)
  Cc: Ingo Molnar, x86, Linux Kernel Mailing List, Yinghai Lu

Hi all,

This series of patches (against tip/x86/apic) makes some fairly
uncontroversial changes and cleanups to lay the groundwork for some more
Xen-specific patches (which will no doubt cause more of a discussion).

These changes can also be pulled from
   git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git x86/apic

Thanks,
	J

Ian Campbell (1):
  xen: expose enable_IO_APIC for 32-bit

Jeremy Fitzhardinge (4):
  x86: make apic_* operations inline functions
  x86: unstatic mp_find_ioapic so it can be used elsewhere
  x86: add mp_find_ioapic_pin
  x86: unstatic ioapic entry funcs

 arch/x86/include/asm/apic.h    |   35 +++++++++++++++++++++++++++++------
 arch/x86/include/asm/hw_irq.h  |    2 --
 arch/x86/include/asm/io_apic.h |    6 ++++++
 arch/x86/include/asm/mpspec.h  |    2 ++
 arch/x86/kernel/acpi/boot.c    |   18 ++++++++++++++----
 arch/x86/kernel/io_apic.c      |   10 +++++-----
 6 files changed, 56 insertions(+), 17 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] xen: expose enable_IO_APIC for 32-bit
  2009-02-09 20:05 ` [PATCH] xen: expose enable_IO_APIC for 32-bit Ian Campbell
@ 2009-02-11  8:36   ` Yinghai Lu
  0 siblings, 0 replies; 8+ messages in thread
From: Yinghai Lu @ 2009-02-11  8:36 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ingo Molnar, x86, Linux Kernel Mailing List

On Mon, Feb 9, 2009 at 12:05 PM, Ian Campbell <ian.campbell@citrix.com> wrote:
> enable_IO_APIC() is defined for both 32- and 64-bit x86, so it should
> be declared for both.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> ---
>  arch/x86/include/asm/hw_irq.h |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
> index 1b82781..370e1c8 100644
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -65,9 +65,7 @@ extern void disable_IO_APIC(void);
>  extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
>  extern void setup_ioapic_dest(void);
>
> -#ifdef CONFIG_X86_64
>  extern void enable_IO_APIC(void);
> -#endif
>
>  /* Statistics */
>  extern atomic_t irq_err_count;
> --
> 1.6.0.6
>
> --

wonder if we should call enable_IO_APIC in 32bit like 64bit...
should be ok.

YH

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: apic cleanups
  2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
                   ` (4 preceding siblings ...)
  2009-02-09 20:05 ` [PATCH] xen: expose enable_IO_APIC for 32-bit Ian Campbell
@ 2009-02-11  9:51 ` Ingo Molnar
  5 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2009-02-11  9:51 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: x86, Linux Kernel Mailing List, Yinghai Lu, Thomas Gleixner,
	H. Peter Anvin


* Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> wrote:

> Hi all,
> 
> This series of patches (against tip/x86/apic) makes some fairly
> uncontroversial changes and cleanups to lay the groundwork for some more
> Xen-specific patches (which will no doubt cause more of a discussion).
> 
> These changes can also be pulled from
>    git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git x86/apic
> 
> Thanks,
> 	J
> 
> Ian Campbell (1):
>   xen: expose enable_IO_APIC for 32-bit
> 
> Jeremy Fitzhardinge (4):
>   x86: make apic_* operations inline functions
>   x86: unstatic mp_find_ioapic so it can be used elsewhere
>   x86: add mp_find_ioapic_pin
>   x86: unstatic ioapic entry funcs
> 
>  arch/x86/include/asm/apic.h    |   35 +++++++++++++++++++++++++++++------
>  arch/x86/include/asm/hw_irq.h  |    2 --
>  arch/x86/include/asm/io_apic.h |    6 ++++++
>  arch/x86/include/asm/mpspec.h  |    2 ++
>  arch/x86/kernel/acpi/boot.c    |   18 ++++++++++++++----
>  arch/x86/kernel/io_apic.c      |   10 +++++-----
>  6 files changed, 56 insertions(+), 17 deletions(-)

Pulled into tip:x86/apic, thanks guys!

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-02-11  9:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-10 20:00 [PATCH] *** SUBJECT HERE *** Jeremy Fitzhardinge
2009-02-09 20:05 ` [PATCH] x86: unstatic mp_find_ioapic so it can be used elsewhere Jeremy Fitzhardinge
2009-02-09 20:05 ` [PATCH] x86: unstatic ioapic entry funcs Jeremy Fitzhardinge
2009-02-09 20:05 ` [PATCH] x86: make apic_* operations inline functions Jeremy Fitzhardinge
2009-02-09 20:05 ` [PATCH] x86: add mp_find_ioapic_pin Jeremy Fitzhardinge
2009-02-09 20:05 ` [PATCH] xen: expose enable_IO_APIC for 32-bit Ian Campbell
2009-02-11  8:36   ` Yinghai Lu
2009-02-11  9:51 ` apic cleanups Ingo Molnar

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.