2011-02-05 20:09:04

by Thomas Gleixner

[permalink] [raw]
Subject: [patch 2/4] xen: Switch to new irq_chip functions

Convert Xen to the new irq_chip functions. Brings us closer to enable
CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED

Signed-off-by: Thomas Gleixner <[email protected]>
---
drivers/xen/events.c | 97 +++++++++++++++++++++++++++------------------------
1 file changed, 52 insertions(+), 45 deletions(-)

Index: linux-next/drivers/xen/events.c
===================================================================
--- linux-next.orig/drivers/xen/events.c
+++ linux-next/drivers/xen/events.c
@@ -277,7 +277,7 @@ static void bind_evtchn_to_cpu(unsigned

BUG_ON(irq == -1);
#ifdef CONFIG_SMP
- cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu));
+ cpumask_copy(irq_to_desc(irq)->irq_data.affinity, cpumask_of(cpu));
#endif

clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq)));
@@ -294,7 +294,7 @@ static void init_evtchn_cpu_bindings(voi

/* By default all event channels notify CPU#0. */
for_each_irq_desc(i, desc) {
- cpumask_copy(desc->affinity, cpumask_of(0));
+ cpumask_copy(desc->irq_data.affinity, cpumask_of(0));
}
#endif

@@ -470,7 +470,7 @@ static bool probing_irq(int irq)
return desc && desc->action == NULL;
}

-static unsigned int startup_pirq(unsigned int irq)
+static unsigned int __startup_pirq(unsigned int irq)
{
struct evtchn_bind_pirq bind_pirq;
struct irq_info *info = info_for_irq(irq);
@@ -508,9 +508,15 @@ out:
return 0;
}

-static void shutdown_pirq(unsigned int irq)
+static unsigned int startup_pirq(struct irq_data *data)
+{
+ return __startup_pirq(data->irq);
+}
+
+static void shutdown_pirq(struct irq_data *data)
{
struct evtchn_close close;
+ unsigned int irq = data->irq;
struct irq_info *info = info_for_irq(irq);
int evtchn = evtchn_from_irq(irq);

@@ -530,20 +536,20 @@ static void shutdown_pirq(unsigned int i
info->evtchn = 0;
}

-static void enable_pirq(unsigned int irq)
+static void enable_pirq(struct irq_data *data)
{
- startup_pirq(irq);
+ startup_pirq(data);
}

-static void disable_pirq(unsigned int irq)
+static void disable_pirq(struct irq_data *data)
{
}

-static void ack_pirq(unsigned int irq)
+static void ack_pirq(struct irq_data *data)
{
- int evtchn = evtchn_from_irq(irq);
+ int evtchn = evtchn_from_irq(data->irq);

- move_native_irq(irq);
+ irq_move_irq(data);

if (VALID_EVTCHN(evtchn)) {
mask_evtchn(evtchn);
@@ -1211,11 +1217,12 @@ static int rebind_irq_to_cpu(unsigned ir
return 0;
}

-static int set_affinity_irq(unsigned irq, const struct cpumask *dest)
+static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest,
+ bool force)
{
unsigned tcpu = cpumask_first(dest);

- return rebind_irq_to_cpu(irq, tcpu);
+ return rebind_irq_to_cpu(data->irq, tcpu);
}

int resend_irq_on_evtchn(unsigned int irq)
@@ -1234,35 +1241,35 @@ int resend_irq_on_evtchn(unsigned int ir
return 1;
}

-static void enable_dynirq(unsigned int irq)
+static void enable_dynirq(struct irq_data *data)
{
- int evtchn = evtchn_from_irq(irq);
+ int evtchn = evtchn_from_irq(data->irq);

if (VALID_EVTCHN(evtchn))
unmask_evtchn(evtchn);
}

-static void disable_dynirq(unsigned int irq)
+static void disable_dynirq(struct irq_data *data)
{
- int evtchn = evtchn_from_irq(irq);
+ int evtchn = evtchn_from_irq(data->irq);

if (VALID_EVTCHN(evtchn))
mask_evtchn(evtchn);
}

-static void ack_dynirq(unsigned int irq)
+static void ack_dynirq(struct irq_data *data)
{
- int evtchn = evtchn_from_irq(irq);
+ int evtchn = evtchn_from_irq(data->irq);

- move_masked_irq(irq);
+ move_masked_irq(data->irq);

if (VALID_EVTCHN(evtchn))
unmask_evtchn(evtchn);
}

-static int retrigger_dynirq(unsigned int irq)
+static int retrigger_dynirq(struct irq_data *data)
{
- int evtchn = evtchn_from_irq(irq);
+ int evtchn = evtchn_from_irq(data->irq);
struct shared_info *sh = HYPERVISOR_shared_info;
int ret = 0;

@@ -1311,7 +1318,7 @@ static void restore_cpu_pirqs(void)

printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);

- startup_pirq(irq);
+ __startup_pirq(irq);
}
}

@@ -1463,44 +1470,44 @@ void xen_irq_resume(void)
}

static struct irq_chip xen_dynamic_chip __read_mostly = {
- .name = "xen-dyn",
+ .name = "xen-dyn",

- .disable = disable_dynirq,
- .mask = disable_dynirq,
- .unmask = enable_dynirq,
-
- .eoi = ack_dynirq,
- .set_affinity = set_affinity_irq,
- .retrigger = retrigger_dynirq,
+ .irq_disable = disable_dynirq,
+ .irq_mask = disable_dynirq,
+ .irq_unmask = enable_dynirq,
+
+ .irq_eoi = ack_dynirq,
+ .irq_set_affinity = set_affinity_irq,
+ .irq_retrigger = retrigger_dynirq,
};

static struct irq_chip xen_pirq_chip __read_mostly = {
- .name = "xen-pirq",
+ .name = "xen-pirq",

- .startup = startup_pirq,
- .shutdown = shutdown_pirq,
+ .irq_startup = startup_pirq,
+ .irq_shutdown = shutdown_pirq,

- .enable = enable_pirq,
- .unmask = enable_pirq,
+ .irq_enable = enable_pirq,
+ .irq_unmask = enable_pirq,

- .disable = disable_pirq,
- .mask = disable_pirq,
+ .irq_disable = disable_pirq,
+ .irq_mask = disable_pirq,

- .ack = ack_pirq,
+ .irq_ack = ack_pirq,

- .set_affinity = set_affinity_irq,
+ .irq_set_affinity = set_affinity_irq,

- .retrigger = retrigger_dynirq,
+ .irq_retrigger = retrigger_dynirq,
};

static struct irq_chip xen_percpu_chip __read_mostly = {
- .name = "xen-percpu",
+ .name = "xen-percpu",

- .disable = disable_dynirq,
- .mask = disable_dynirq,
- .unmask = enable_dynirq,
+ .irq_disable = disable_dynirq,
+ .irq_mask = disable_dynirq,
+ .irq_unmask = enable_dynirq,

- .ack = ack_dynirq,
+ .irq_ack = ack_dynirq,
};

int xen_set_callback_via(uint64_t via)


2011-02-07 11:08:42

by Ian Campbell

[permalink] [raw]
Subject: Re: [patch 2/4] xen: Switch to new irq_chip functions

On Sat, 2011-02-05 at 20:08 +0000, Thomas Gleixner wrote:
>
> -static void ack_pirq(unsigned int irq)
> +static void ack_pirq(struct irq_data *data)
> {
> - int evtchn = evtchn_from_irq(irq);
> + int evtchn = evtchn_from_irq(data->irq);
>
> - move_native_irq(irq);
> + irq_move_irq(data);

I tried to test with Linus latest but with this patch:

/local/scratch/ianc/devel/kernels/linux-2.6/drivers/xen/events.c: In function 'ack_pirq':
/local/scratch/ianc/devel/kernels/linux-2.6/drivers/xen/events.c:568: error: implicit declaration of function 'irq_move_irq'

I can't find irq_move_irq in any of the tip.git branches (incl. master,
auto-latest and .*irq.*), via google or in any of the other conversion
patches you posted for other arches. Am I just looking in the wrong
places or was this a mistake?

For now I went with the following sort-of-reversion to allow me to
continue:

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 65f05e2..6f5dd38 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -565,7 +565,7 @@ static void ack_pirq(struct irq_data *data)
{
int evtchn = evtchn_from_irq(data->irq);

- irq_move_irq(data);
+ move_native_irq(data->irq);

if (VALID_EVTCHN(evtchn)) {
mask_evtchn(evtchn);

Ian.

2011-02-07 11:30:20

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [patch 2/4] xen: Switch to new irq_chip functions

On Mon, 7 Feb 2011, Ian Campbell wrote:

> On Sat, 2011-02-05 at 20:08 +0000, Thomas Gleixner wrote:
> >
> > -static void ack_pirq(unsigned int irq)
> > +static void ack_pirq(struct irq_data *data)
> > {
> > - int evtchn = evtchn_from_irq(irq);
> > + int evtchn = evtchn_from_irq(data->irq);
> >
> > - move_native_irq(irq);
> > + irq_move_irq(data);
>
> I tried to test with Linus latest but with this patch:
>
> /local/scratch/ianc/devel/kernels/linux-2.6/drivers/xen/events.c: In function 'ack_pirq':
> /local/scratch/ianc/devel/kernels/linux-2.6/drivers/xen/events.c:568: error: implicit declaration of function 'irq_move_irq'
>
> I can't find irq_move_irq in any of the tip.git branches (incl. master,
> auto-latest and .*irq.*), via google or in any of the other conversion
> patches you posted for other arches. Am I just looking in the wrong
> places or was this a mistake?
>
> For now I went with the following sort-of-reversion to allow me to
> continue:
>
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index 65f05e2..6f5dd38 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -565,7 +565,7 @@ static void ack_pirq(struct irq_data *data)
> {
> int evtchn = evtchn_from_irq(data->irq);
>
> - irq_move_irq(data);
> + move_native_irq(data->irq);

Sorry, had another patch applied before that. Did not recheck before
sending it. Yes, that's the correct resolution.

Thanks,

tglx