* generic hardirq handling for uml
@ 2004-10-20 0:11 Martin Waitz
2004-10-20 3:18 ` Chris Wedgwood
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Martin Waitz @ 2004-10-20 0:11 UTC (permalink / raw)
To: Andrew Morton, Jeff Dike, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 19080 bytes --]
hoi :)
I just ported arch/um to generic hardirq handling.
It works for me on a 2.6.9-rc4-mm1 kernel.
Without this patch, ARCH=um does not build as it tries
to use arch/hardirq.h which is already ported to generic
hardirq on i386.
Signed-off-by: Martin Waitz <tali@admignilde.org>
Index: linux-2.6/arch/um/Kconfig
===================================================================
--- linux-2.6.orig/arch/um/Kconfig 2004-10-17 18:36:05.000000000 +0200
+++ linux-2.6/arch/um/Kconfig 2004-10-17 18:36:19.000000000 +0200
@@ -7,6 +7,13 @@
bool
default y
+#
+# Use the generic interrupt handling code in kernel/irq/:
+#
+config GENERIC_HARDIRQS
+ bool
+ default y
+
mainmenu "Linux/Usermode Kernel Configuration"
config ISA
Index: linux-2.6/arch/um/kernel/irq.c
===================================================================
--- linux-2.6.orig/arch/um/kernel/irq.c 2004-10-17 18:35:12.000000000 +0200
+++ linux-2.6/arch/um/kernel/irq.c 2004-10-20 00:36:08.000000000 +0200
@@ -5,89 +5,64 @@
* Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
*/
-#include "linux/config.h"
#include "linux/kernel.h"
#include "linux/module.h"
#include "linux/smp.h"
#include "linux/irq.h"
#include "linux/kernel_stat.h"
#include "linux/interrupt.h"
-#include "linux/random.h"
-#include "linux/slab.h"
#include "linux/file.h"
-#include "linux/proc_fs.h"
#include "linux/init.h"
#include "linux/seq_file.h"
#include "linux/profile.h"
#include "linux/hardirq.h"
-#include "asm/irq.h"
-#include "asm/hw_irq.h"
-#include "asm/atomic.h"
-#include "asm/signal.h"
-#include "asm/system.h"
-#include "asm/errno.h"
-#include "asm/uaccess.h"
#include "user_util.h"
#include "kern_util.h"
#include "irq_user.h"
#include "irq_kern.h"
-static void register_irq_proc (unsigned int irq);
-irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
- [0 ... NR_IRQS-1] = {
- .handler = &no_irq_type,
- .lock = SPIN_LOCK_UNLOCKED
- }
-};
+void ack_bad_irq(unsigned int irq)
+{
+ printk("unexpected IQ trap at vector %02x\n", irq);
+}
/*
- * Generic no controller code
+ * do_IRQ handles all normal device IRQ's (the special
+ * SMP cross-CPU interrupts have their own specific
+ * handlers).
*/
+unsigned int do_IRQ(int irq, union uml_pt_regs *regs)
+{
+ irq_enter();
+
+ __do_IRQ(irq, (struct pt_regs *) regs);
+
+ irq_exit();
+
+ return 1;
+}
+
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
-static void ack_none(unsigned int irq)
+int um_request_irq(unsigned int irq, int fd, int type,
+ irqreturn_t (*handler)(int, void *, struct pt_regs *),
+ unsigned long irqflags, const char * devname,
+ void *dev_id)
{
-/*
- * 'what should we do if we get a hw irq event on an illegal vector'.
- * each architecture has to answer this themselves, it doesn't deserve
- * a generic callback i think.
- */
-#ifdef CONFIG_X86
- printk(KERN_ERR "unexpected IRQ trap at vector %02x\n", irq);
-#ifdef CONFIG_X86_LOCAL_APIC
- /*
- * Currently unexpected vectors happen only on SMP and APIC.
- * We _must_ ack these because every local APIC has only N
- * irq slots per priority level, and a 'hanging, unacked' IRQ
- * holds up an irq slot - in excessive cases (when multiple
- * unexpected vectors occur) that might lock up the APIC
- * completely.
- */
- ack_APIC_irq();
-#endif
-#endif
+ int err;
+
+ err = request_irq(irq, handler, irqflags, devname, dev_id);
+ if(err)
+ return(err);
+
+ if(fd != -1)
+ err = activate_fd(irq, fd, type, dev_id);
+ return(err);
}
+EXPORT_SYMBOL(um_request_irq);
+EXPORT_SYMBOL(reactivate_fd);
-/* startup is the same as "enable", shutdown is same as "disable" */
-#define shutdown_none disable_none
-#define end_none enable_none
-
-struct hw_interrupt_type no_irq_type = {
- "none",
- startup_none,
- shutdown_none,
- enable_none,
- disable_none,
- ack_none,
- end_none
-};
-/*
- * Generic, controller-independent functions:
- */
int show_interrupts(struct seq_file *p, void *v)
{
@@ -136,530 +111,6 @@
return 0;
}
-/*
- * This should really return information about whether
- * we should do bottom half handling etc. Right now we
- * end up _always_ checking the bottom half, which is a
- * waste of time and is not what some drivers would
- * prefer.
- */
-int handle_IRQ_event(unsigned int irq, struct pt_regs * regs,
- struct irqaction * action)
-{
- int status = 1; /* Force the "do bottom halves" bit */
- int ret, retval = 0;
-
- if (!(action->flags & SA_INTERRUPT))
- local_irq_enable();
-
- do {
- ret = action->handler(irq, action->dev_id, regs);
- if (ret == IRQ_HANDLED)
- status |= action->flags;
- retval |= ret;
- action = action->next;
- } while (action);
- if (status & SA_SAMPLE_RANDOM)
- add_interrupt_randomness(irq);
-
- local_irq_disable();
-
- return retval;
-}
-
-/*
- * Generic enable/disable code: this just calls
- * down into the PIC-specific version for the actual
- * hardware disable after having gotten the irq
- * controller lock.
- */
-
-/**
- * disable_irq_nosync - disable an irq without waiting
- * @irq: Interrupt to disable
- *
- * Disable the selected interrupt line. Disables of an interrupt
- * stack. Unlike disable_irq(), this function does not ensure existing
- * instances of the IRQ handler have completed before returning.
- *
- * This function may be called from IRQ context.
- */
-
-inline void disable_irq_nosync(unsigned int irq)
-{
- irq_desc_t *desc = irq_desc + irq;
- unsigned long flags;
-
- spin_lock_irqsave(&desc->lock, flags);
- if (!desc->depth++) {
- desc->status |= IRQ_DISABLED;
- desc->handler->disable(irq);
- }
- spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-#ifdef CONFIG_SMP
-inline void synchronize_irq(unsigned int irq)
-{
- /* is there anything to synchronize with? */
- if (!irq_desc[irq].action)
- return;
-
- while (irq_desc[irq].status & IRQ_INPROGRESS)
- cpu_relax();
-}
-#endif
-
-/**
- * disable_irq - disable an irq and wait for completion
- * @irq: Interrupt to disable
- *
- * Disable the selected interrupt line. Disables of an interrupt
- * stack. That is for two disables you need two enables. This
- * function waits for any pending IRQ handlers for this interrupt
- * to complete before returning. If you use this function while
- * holding a resource the IRQ handler may need you will deadlock.
- *
- * This function may be called - with care - from IRQ context.
- */
-
-void disable_irq(unsigned int irq)
-{
- disable_irq_nosync(irq);
- synchronize_irq(irq);
-}
-
-/**
- * enable_irq - enable interrupt handling on an irq
- * @irq: Interrupt to enable
- *
- * Re-enables the processing of interrupts on this IRQ line
- * providing no disable_irq calls are now in effect.
- *
- * This function may be called from IRQ context.
- */
-
-void enable_irq(unsigned int irq)
-{
- irq_desc_t *desc = irq_desc + irq;
- unsigned long flags;
-
- spin_lock_irqsave(&desc->lock, flags);
- switch (desc->depth) {
- case 1: {
- unsigned int status = desc->status & ~IRQ_DISABLED;
- desc->status = status;
- if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
- desc->status = status | IRQ_REPLAY;
- hw_resend_irq(desc->handler,irq);
- }
- desc->handler->enable(irq);
- /* fall-through */
- }
- default:
- desc->depth--;
- break;
- case 0:
- printk(KERN_ERR "enable_irq() unbalanced from %p\n",
- __builtin_return_address(0));
- }
- spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/*
- * do_IRQ handles all normal device IRQ's (the special
- * SMP cross-CPU interrupts have their own specific
- * handlers).
- */
-unsigned int do_IRQ(int irq, union uml_pt_regs *regs)
-{
- /*
- * 0 return value means that this irq is already being
- * handled by some other CPU. (or is disabled)
- */
- irq_desc_t *desc = irq_desc + irq;
- struct irqaction * action;
- unsigned int status;
-
- irq_enter();
- kstat_this_cpu.irqs[irq]++;
- spin_lock(&desc->lock);
- desc->handler->ack(irq);
- /*
- REPLAY is when Linux resends an IRQ that was dropped earlier
- WAITING is used by probe to mark irqs that are being tested
- */
- status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
- status |= IRQ_PENDING; /* we _want_ to handle it */
-
- /*
- * If the IRQ is disabled for whatever reason, we cannot
- * use the action we have.
- */
- action = NULL;
- if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
- action = desc->action;
- status &= ~IRQ_PENDING; /* we commit to handling */
- status |= IRQ_INPROGRESS; /* we are handling it */
- }
- desc->status = status;
-
- /*
- * If there is no IRQ handler or it was disabled, exit early.
- Since we set PENDING, if another processor is handling
- a different instance of this same irq, the other processor
- will take care of it.
- */
- if (!action)
- goto out;
-
- /*
- * Edge triggered interrupts need to remember
- * pending events.
- * This applies to any hw interrupts that allow a second
- * instance of the same irq to arrive while we are in do_IRQ
- * or in the handler. But the code here only handles the _second_
- * instance of the irq, not the third or fourth. So it is mostly
- * useful for irq hardware that does not mask cleanly in an
- * SMP environment.
- */
- for (;;) {
- spin_unlock(&desc->lock);
- handle_IRQ_event(irq, (struct pt_regs *) regs, action);
- spin_lock(&desc->lock);
-
- if (!(desc->status & IRQ_PENDING))
- break;
- desc->status &= ~IRQ_PENDING;
- }
- desc->status &= ~IRQ_INPROGRESS;
-out:
- /*
- * The ->end() handler has to deal with interrupts which got
- * disabled while the handler was running.
- */
- desc->handler->end(irq);
- spin_unlock(&desc->lock);
-
- irq_exit();
-
- return 1;
-}
-
-/**
- * request_irq - allocate an interrupt line
- * @irq: Interrupt line to allocate
- * @handler: Function to be called when the IRQ occurs
- * @irqflags: Interrupt type flags
- * @devname: An ascii name for the claiming device
- * @dev_id: A cookie passed back to the handler function
- *
- * This call allocates interrupt resources and enables the
- * interrupt line and IRQ handling. From the point this
- * call is made your handler function may be invoked. Since
- * your handler function must clear any interrupt the board
- * raises, you must take care both to initialise your hardware
- * and to set up the interrupt handler in the right order.
- *
- * Dev_id must be globally unique. Normally the address of the
- * device data structure is used as the cookie. Since the handler
- * receives this value it makes sense to use it.
- *
- * If your interrupt is shared you must pass a non NULL dev_id
- * as this is required when freeing the interrupt.
- *
- * Flags:
- *
- * SA_SHIRQ Interrupt is shared
- *
- * SA_INTERRUPT Disable local interrupts while processing
- *
- * SA_SAMPLE_RANDOM The interrupt can be used for entropy
- *
- */
-
-int request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long irqflags,
- const char * devname,
- void *dev_id)
-{
- int retval;
- struct irqaction * action;
-
-#if 1
- /*
- * Sanity-check: shared interrupts should REALLY pass in
- * a real dev-ID, otherwise we'll have trouble later trying
- * to figure out which interrupt is which (messes up the
- * interrupt freeing logic etc).
- */
- if (irqflags & SA_SHIRQ) {
- if (!dev_id)
- printk(KERN_ERR "Bad boy: %s (at 0x%x) called us "
- "without a dev_id!\n", devname, (&irq)[-1]);
- }
-#endif
-
- if (irq >= NR_IRQS)
- return -EINVAL;
- if (!handler)
- return -EINVAL;
-
- action = (struct irqaction *)
- kmalloc(sizeof(struct irqaction), GFP_KERNEL);
- if (!action)
- return -ENOMEM;
-
- action->handler = handler;
- action->flags = irqflags;
- cpus_clear(action->mask);
- action->name = devname;
- action->next = NULL;
- action->dev_id = dev_id;
-
- retval = setup_irq(irq, action);
- if (retval)
- kfree(action);
- return retval;
-}
-
-EXPORT_SYMBOL(request_irq);
-
-int um_request_irq(unsigned int irq, int fd, int type,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long irqflags, const char * devname,
- void *dev_id)
-{
- int err;
-
- err = request_irq(irq, handler, irqflags, devname, dev_id);
- if(err)
- return(err);
-
- if(fd != -1)
- err = activate_fd(irq, fd, type, dev_id);
- return(err);
-}
-EXPORT_SYMBOL(um_request_irq);
-EXPORT_SYMBOL(reactivate_fd);
-
-/* this was setup_x86_irq but it seems pretty generic */
-int setup_irq(unsigned int irq, struct irqaction * new)
-{
- int shared = 0;
- unsigned long flags;
- struct irqaction *old, **p;
- irq_desc_t *desc = irq_desc + irq;
-
- /*
- * Some drivers like serial.c use request_irq() heavily,
- * so we have to be careful not to interfere with a
- * running system.
- */
- if (new->flags & SA_SAMPLE_RANDOM) {
- /*
- * This function might sleep, we want to call it first,
- * outside of the atomic block.
- * Yes, this might clear the entropy pool if the wrong
- * driver is attempted to be loaded, without actually
- * installing a new handler, but is this really a problem,
- * only the sysadmin is able to do this.
- */
- rand_initialize_irq(irq);
- }
-
- /*
- * The following block of code has to be executed atomically
- */
- spin_lock_irqsave(&desc->lock,flags);
- p = &desc->action;
- old = *p;
- if (old != NULL) {
- /* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
-
- /* add new interrupt at end of irq queue */
- do {
- p = &old->next;
- old = *p;
- } while (old);
- shared = 1;
- }
-
- *p = new;
-
- if (!shared) {
- desc->depth = 0;
- desc->status &= ~IRQ_DISABLED;
- desc->handler->startup(irq);
- }
- spin_unlock_irqrestore(&desc->lock,flags);
-
- register_irq_proc(irq);
- return 0;
-}
-
-/**
- * free_irq - free an interrupt
- * @irq: Interrupt line to free
- * @dev_id: Device identity to free
- *
- * Remove an interrupt handler. The handler is removed and if the
- * interrupt line is no longer in use by any driver it is disabled.
- * On a shared IRQ the caller must ensure the interrupt is disabled
- * on the card it drives before calling this function. The function
- * does not return until any executing interrupts for this IRQ
- * have completed.
- *
- * This function may be called from interrupt context.
- *
- * Bugs: Attempting to free an irq in a handler for the same irq hangs
- * the machine.
- */
-
-void free_irq(unsigned int irq, void *dev_id)
-{
- irq_desc_t *desc;
- struct irqaction **p;
- unsigned long flags;
-
- if (irq >= NR_IRQS)
- return;
-
- desc = irq_desc + irq;
- spin_lock_irqsave(&desc->lock,flags);
- p = &desc->action;
- for (;;) {
- struct irqaction * action = *p;
- if (action) {
- struct irqaction **pp = p;
- p = &action->next;
- if (action->dev_id != dev_id)
- continue;
-
- /* Found it - now remove it from the list of entries */
- *pp = action->next;
- if (!desc->action) {
- desc->status |= IRQ_DISABLED;
- desc->handler->shutdown(irq);
- }
- free_irq_by_irq_and_dev(irq, dev_id);
- spin_unlock_irqrestore(&desc->lock,flags);
-
- /* Wait to make sure it's not being used on another CPU */
- synchronize_irq(irq);
- kfree(action);
- return;
- }
- printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
- spin_unlock_irqrestore(&desc->lock,flags);
- return;
- }
-}
-
-EXPORT_SYMBOL(free_irq);
-
-/* These are initialized by sysctl_init, which is called from init/main.c */
-static struct proc_dir_entry * root_irq_dir;
-static struct proc_dir_entry * irq_dir [NR_IRQS];
-static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
-
-/* These are read and written as longs, so a read won't see a partial write
- * even during a race.
- */
-static cpumask_t irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
-
-static int irq_affinity_read_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
- if (count - len < 2)
- return -EINVAL;
- len += sprintf(page + len, "\n");
- return len;
-}
-
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
- unsigned long count, void *data)
-{
- int irq = (long) data, full_count = count, err;
- cpumask_t new_value;
-
- if (!irq_desc[irq].handler->set_affinity)
- return -EIO;
-
- err = cpumask_parse(buffer, count, new_value);
- if(err)
- return(err);
-
-#ifdef CONFIG_SMP
- /*
- * Do not allow disabling IRQs completely - it's a too easy
- * way to make the system unusable accidentally :-) At least
- * one online CPU still has to be targeted.
- */
- { cpumask_t tmp;
- cpus_and(tmp, new_value, cpu_online_map);
- if (cpus_empty(tmp))
- return -EINVAL;
- }
-#endif
-
- irq_affinity[irq] = new_value;
- irq_desc[irq].handler->set_affinity(irq, new_value);
-
- return full_count;
-}
-
-#define MAX_NAMELEN 10
-
-static void register_irq_proc (unsigned int irq)
-{
- struct proc_dir_entry *entry;
- char name [MAX_NAMELEN];
-
- if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) ||
- irq_dir[irq])
- return;
-
- memset(name, 0, MAX_NAMELEN);
- sprintf(name, "%d", irq);
-
- /* create /proc/irq/1234 */
- irq_dir[irq] = proc_mkdir(name, root_irq_dir);
-
- /* create /proc/irq/1234/smp_affinity */
- entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]);
-
- entry->nlink = 1;
- entry->data = (void *)(long)irq;
- entry->read_proc = irq_affinity_read_proc;
- entry->write_proc = irq_affinity_write_proc;
-
- smp_affinity_entry[irq] = entry;
-}
-
-void __init init_irq_proc (void)
-{
- int i;
-
- /* create /proc/irq */
- root_irq_dir = proc_mkdir("irq", 0);
-
- /* create /proc/irq/prof_cpu_mask */
- create_prof_cpu_mask(root_irq_dir);
-
- /*
- * Create entries for all existing IRQs.
- */
- for (i = 0; i < NR_IRQS; i++)
- register_irq_proc(i);
-}
-
static spinlock_t irq_spinlock = SPIN_LOCK_UNLOCKED;
unsigned long irq_lock(void)
@@ -675,20 +126,6 @@
spin_unlock_irqrestore(&irq_spinlock, flags);
}
-unsigned long probe_irq_on(void)
-{
- return(0);
-}
-
-EXPORT_SYMBOL(probe_irq_on);
-
-int probe_irq_off(unsigned long val)
-{
- return(0);
-}
-
-EXPORT_SYMBOL(probe_irq_off);
-
static unsigned int startup_SIGIO_irq(unsigned int irq)
{
return(0);
--
Martin Waitz
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 0:11 generic hardirq handling for uml Martin Waitz
@ 2004-10-20 3:18 ` Chris Wedgwood
2004-10-20 9:46 ` Martin Waitz
2004-10-20 22:41 ` Andrew Morton
2004-10-21 6:18 ` generic hardirq handling for uml Jeff Dike
2 siblings, 1 reply; 8+ messages in thread
From: Chris Wedgwood @ 2004-10-20 3:18 UTC (permalink / raw)
To: Andrew Morton, Jeff Dike, linux-kernel
On Wed, Oct 20, 2004 at 02:11:24AM +0200, Martin Waitz wrote:
> I just ported arch/um to generic hardirq handling.
heh, i posted something similat too
> -void free_irq(unsigned int irq, void *dev_id)
[...]
> - free_irq_by_irq_and_dev(irq, dev_id);
that is actually needed and missing from the generic code, if you run
w/o this you will get funnies won't you?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 3:18 ` Chris Wedgwood
@ 2004-10-20 9:46 ` Martin Waitz
2004-10-20 9:49 ` Chris Wedgwood
0 siblings, 1 reply; 8+ messages in thread
From: Martin Waitz @ 2004-10-20 9:46 UTC (permalink / raw)
To: Chris Wedgwood; +Cc: Andrew Morton, Jeff Dike, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
hoi :)
On Tue, Oct 19, 2004 at 08:18:26PM -0700, Chris Wedgwood wrote:
> > -void free_irq(unsigned int irq, void *dev_id)
> [...]
> > - free_irq_by_irq_and_dev(irq, dev_id);
> that is actually needed and missing from the generic code, if you run
> w/o this you will get funnies won't you?
ups, I must have missed that.
Well the system booted but I haven't done stress tests yet.
I guess I'll use your patch for further tests :)
--
Martin Waitz
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 9:46 ` Martin Waitz
@ 2004-10-20 9:49 ` Chris Wedgwood
0 siblings, 0 replies; 8+ messages in thread
From: Chris Wedgwood @ 2004-10-20 9:49 UTC (permalink / raw)
To: Andrew Morton, Jeff Dike, linux-kernel
On Wed, Oct 20, 2004 at 11:46:38AM +0200, Martin Waitz wrote:
> I guess I'll use your patch for further tests :)
it's as clean as it could be yet --- i wanted to make the smallest
diff possible until more of the UML gets merged then i'll do another
pass trimming lots of cruft out
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 0:11 generic hardirq handling for uml Martin Waitz
2004-10-20 3:18 ` Chris Wedgwood
@ 2004-10-20 22:41 ` Andrew Morton
2004-10-22 3:19 ` Jeff Dike
2004-10-21 6:18 ` generic hardirq handling for uml Jeff Dike
2 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2004-10-20 22:41 UTC (permalink / raw)
To: Martin Waitz; +Cc: jdike, linux-kernel, blaisorblade_spam@yahoo.it
Martin Waitz <tali@admingilde.org> wrote:
>
> I just ported arch/um to generic hardirq handling.
OK, I'll add this to 2.6.9-mm1 (which appears to be a few days off yet). If
nobody complains, it goes in. Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 0:11 generic hardirq handling for uml Martin Waitz
2004-10-20 3:18 ` Chris Wedgwood
2004-10-20 22:41 ` Andrew Morton
@ 2004-10-21 6:18 ` Jeff Dike
2 siblings, 0 replies; 8+ messages in thread
From: Jeff Dike @ 2004-10-21 6:18 UTC (permalink / raw)
To: Martin Waitz; +Cc: Andrew Morton, linux-kernel
tali@admingilde.org said:
> I just ported arch/um to generic hardirq handling. It works for me on
> a 2.6.9-rc4-mm1 kernel.
Thanks. I already had most of this in my tree, but you caught a few things
I missed, especially the #include cleanup. However, the removal of config.h
was a bit much since there are still references to CONFIG_SMP.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: generic hardirq handling for uml
2004-10-20 22:41 ` Andrew Morton
@ 2004-10-22 3:19 ` Jeff Dike
2004-10-22 20:04 ` [PATCH] (another!) generic irq handling for UML Chris Wedgwood
0 siblings, 1 reply; 8+ messages in thread
From: Jeff Dike @ 2004-10-22 3:19 UTC (permalink / raw)
To: Andrew Morton; +Cc: Martin Waitz, linux-kernel, blaisorblade_spam@yahoo.it
akpm@osdl.org said:
> OK, I'll add this to 2.6.9-mm1 (which appears to be a few days off
> yet). If nobody complains, it goes in. Thanks.
It's pretty good. I've got it in my tree with a few changes which I'll
send you when I start dealing with -mm again.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] (another!) generic irq handling for UML
2004-10-22 3:19 ` Jeff Dike
@ 2004-10-22 20:04 ` Chris Wedgwood
0 siblings, 0 replies; 8+ messages in thread
From: Chris Wedgwood @ 2004-10-22 20:04 UTC (permalink / raw)
To: Jeff Dike
Cc: Andrew Morton, Martin Waitz, linux-kernel,
blaisorblade_spam@yahoo.it
On Thu, Oct 21, 2004 at 11:19:50PM -0400, Jeff Dike wrote:
> It's pretty good. I've got it in my tree with a few changes which
> I'll send you when I start dealing with -mm again.
I ended with the following patch as a compromise for now. As has been
discussed this entire area needs rewriting at some point but for now I
think this should suffice.
===== arch/um/Kconfig 1.18 vs edited =====
--- 1.18/arch/um/Kconfig 2004-10-13 21:08:32 -07:00
+++ edited/arch/um/Kconfig 2004-10-20 17:47:51 -07:00
@@ -1,3 +1,8 @@
+# UML uses the generic IRQ sugsystem
+config GENERIC_HARDIRQS
+ bool
+ default y
+
config USERMODE
bool
default y
===== arch/um/drivers/line.c 1.23 vs edited =====
--- 1.23/arch/um/drivers/line.c 2004-10-21 10:03:21 -07:00
+++ edited/arch/um/drivers/line.c 2004-10-22 13:00:52 -07:00
@@ -110,7 +110,6 @@ static int flush_buffer(struct line *lin
int line_write(struct line *lines, struct tty_struct *tty, const char *buf, int len)
{
struct line *line;
- char *new;
unsigned long flags;
int n, err, i, ret = 0;
@@ -143,7 +142,6 @@ int line_write(struct line *lines, struc
}
out_up:
up(&line->sem);
- out_free:
return(ret);
}
@@ -203,13 +201,17 @@ void line_disable(struct line *line, int
if(line->driver->read_irq == current_irq)
free_irq_later(line->driver->read_irq, line);
- else
+ else {
+ free_irq_by_irq_and_dev(line->driver->read_irq, line);
free_irq(line->driver->read_irq, line);
+ }
if(line->driver->write_irq == current_irq)
free_irq_later(line->driver->write_irq, line);
- else
+ else {
+ free_irq_by_irq_and_dev(line->driver->write_irq, line);
free_irq(line->driver->write_irq, line);
+ }
line->have_irq = 0;
}
===== arch/um/drivers/net_kern.c 1.19 vs edited =====
--- 1.19/arch/um/drivers/net_kern.c 2004-09-17 00:07:05 -07:00
+++ edited/arch/um/drivers/net_kern.c 2004-10-22 12:58:05 -07:00
@@ -148,6 +148,7 @@ static int uml_net_close(struct net_devi
netif_stop_queue(dev);
spin_lock(&lp->lock);
+ free_irq_by_irq_and_dev(dev->irq, dev);
free_irq(dev->irq, dev);
if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user);
lp->fd = -1;
===== arch/um/drivers/port_kern.c 1.16 vs edited =====
--- 1.16/arch/um/drivers/port_kern.c 2004-08-24 02:08:18 -07:00
+++ edited/arch/um/drivers/port_kern.c 2004-10-22 12:58:05 -07:00
@@ -242,6 +242,7 @@ int port_wait(void *data)
* connection. Then we loop here throwing out failed
* connections until a good one is found.
*/
+ free_irq_by_irq_and_dev(TELNETD_IRQ, conn);
free_irq(TELNETD_IRQ, conn);
if(conn->fd >= 0) break;
===== arch/um/drivers/xterm_kern.c 1.5 vs edited =====
--- 1.5/arch/um/drivers/xterm_kern.c 2004-08-24 02:08:18 -07:00
+++ edited/arch/um/drivers/xterm_kern.c 2004-10-22 12:58:05 -07:00
@@ -63,6 +63,7 @@ int xterm_fd(int socket, int *pid_out)
}
down(&data->sem);
+ free_irq_by_irq_and_dev(XTERM_IRQ, data);
free_irq(XTERM_IRQ, data);
ret = data->new_fd;
===== arch/um/include/irq_user.h 1.4 vs edited =====
--- 1.4/arch/um/include/irq_user.h 2004-09-13 17:23:23 -07:00
+++ edited/arch/um/include/irq_user.h 2004-10-20 19:00:29 -07:00
@@ -10,7 +10,7 @@ enum { IRQ_READ, IRQ_WRITE };
extern void sigio_handler(int sig, union uml_pt_regs *regs);
extern int activate_fd(int irq, int fd, int type, void *dev_id);
-extern void free_irq_by_irq_and_dev(int irq, void *dev_id);
+extern void free_irq_by_irq_and_dev(unsigned int irq, void *dev_id);
extern void free_irq_by_fd(int fd);
extern void reactivate_fd(int fd, int irqnum);
extern void deactivate_fd(int fd, int irqnum);
===== arch/um/kernel/irq.c 1.21 vs edited =====
--- 1.21/arch/um/kernel/irq.c 2004-10-13 21:08:30 -07:00
+++ edited/arch/um/kernel/irq.c 2004-10-22 12:51:49 -07:00
@@ -32,58 +32,6 @@
#include "irq_user.h"
#include "irq_kern.h"
-static void register_irq_proc (unsigned int irq);
-
-irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
- [0 ... NR_IRQS-1] = {
- .handler = &no_irq_type,
- .lock = SPIN_LOCK_UNLOCKED
- }
-};
-
-/*
- * Generic no controller code
- */
-
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
-static void ack_none(unsigned int irq)
-{
-/*
- * 'what should we do if we get a hw irq event on an illegal vector'.
- * each architecture has to answer this themselves, it doesn't deserve
- * a generic callback i think.
- */
-#ifdef CONFIG_X86
- printk(KERN_ERR "unexpected IRQ trap at vector %02x\n", irq);
-#ifdef CONFIG_X86_LOCAL_APIC
- /*
- * Currently unexpected vectors happen only on SMP and APIC.
- * We _must_ ack these because every local APIC has only N
- * irq slots per priority level, and a 'hanging, unacked' IRQ
- * holds up an irq slot - in excessive cases (when multiple
- * unexpected vectors occur) that might lock up the APIC
- * completely.
- */
- ack_APIC_irq();
-#endif
-#endif
-}
-
-/* startup is the same as "enable", shutdown is same as "disable" */
-#define shutdown_none disable_none
-#define end_none enable_none
-
-struct hw_interrupt_type no_irq_type = {
- "none",
- startup_none,
- shutdown_none,
- enable_none,
- disable_none,
- ack_none,
- end_none
-};
/*
* Generic, controller-independent functions:
@@ -126,10 +74,6 @@ int show_interrupts(struct seq_file *p,
skip:
spin_unlock_irqrestore(&irq_desc[i].lock, flags);
} else if (i == NR_IRQS) {
- seq_printf(p, "NMI: ");
- for (j = 0; j < NR_CPUS; j++)
- if (cpu_online(j))
- seq_printf(p, "%10u ", nmi_count(j));
seq_putc(p, '\n');
}
@@ -137,295 +81,18 @@ skip:
}
/*
- * This should really return information about whether
- * we should do bottom half handling etc. Right now we
- * end up _always_ checking the bottom half, which is a
- * waste of time and is not what some drivers would
- * prefer.
- */
-int handle_IRQ_event(unsigned int irq, struct pt_regs * regs,
- struct irqaction * action)
-{
- int status = 1; /* Force the "do bottom halves" bit */
- int ret, retval = 0;
-
- if (!(action->flags & SA_INTERRUPT))
- local_irq_enable();
-
- do {
- ret = action->handler(irq, action->dev_id, regs);
- if (ret == IRQ_HANDLED)
- status |= action->flags;
- retval |= ret;
- action = action->next;
- } while (action);
- if (status & SA_SAMPLE_RANDOM)
- add_interrupt_randomness(irq);
-
- local_irq_disable();
-
- return retval;
-}
-
-/*
- * Generic enable/disable code: this just calls
- * down into the PIC-specific version for the actual
- * hardware disable after having gotten the irq
- * controller lock.
- */
-
-/**
- * disable_irq_nosync - disable an irq without waiting
- * @irq: Interrupt to disable
- *
- * Disable the selected interrupt line. Disables of an interrupt
- * stack. Unlike disable_irq(), this function does not ensure existing
- * instances of the IRQ handler have completed before returning.
- *
- * This function may be called from IRQ context.
- */
-
-inline void disable_irq_nosync(unsigned int irq)
-{
- irq_desc_t *desc = irq_desc + irq;
- unsigned long flags;
-
- spin_lock_irqsave(&desc->lock, flags);
- if (!desc->depth++) {
- desc->status |= IRQ_DISABLED;
- desc->handler->disable(irq);
- }
- spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-#ifdef CONFIG_SMP
-inline void synchronize_irq(unsigned int irq)
-{
- /* is there anything to synchronize with? */
- if (!irq_desc[irq].action)
- return;
-
- while (irq_desc[irq].status & IRQ_INPROGRESS)
- cpu_relax();
-}
-#endif
-
-/**
- * disable_irq - disable an irq and wait for completion
- * @irq: Interrupt to disable
- *
- * Disable the selected interrupt line. Disables of an interrupt
- * stack. That is for two disables you need two enables. This
- * function waits for any pending IRQ handlers for this interrupt
- * to complete before returning. If you use this function while
- * holding a resource the IRQ handler may need you will deadlock.
- *
- * This function may be called - with care - from IRQ context.
- */
-
-void disable_irq(unsigned int irq)
-{
- disable_irq_nosync(irq);
- synchronize_irq(irq);
-}
-
-/**
- * enable_irq - enable interrupt handling on an irq
- * @irq: Interrupt to enable
- *
- * Re-enables the processing of interrupts on this IRQ line
- * providing no disable_irq calls are now in effect.
- *
- * This function may be called from IRQ context.
- */
-
-void enable_irq(unsigned int irq)
-{
- irq_desc_t *desc = irq_desc + irq;
- unsigned long flags;
-
- spin_lock_irqsave(&desc->lock, flags);
- switch (desc->depth) {
- case 1: {
- unsigned int status = desc->status & ~IRQ_DISABLED;
- desc->status = status;
- if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
- desc->status = status | IRQ_REPLAY;
- hw_resend_irq(desc->handler,irq);
- }
- desc->handler->enable(irq);
- /* fall-through */
- }
- default:
- desc->depth--;
- break;
- case 0:
- printk(KERN_ERR "enable_irq() unbalanced from %p\n",
- __builtin_return_address(0));
- }
- spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
* handlers).
*/
unsigned int do_IRQ(int irq, union uml_pt_regs *regs)
-{
- /*
- * 0 return value means that this irq is already being
- * handled by some other CPU. (or is disabled)
- */
- irq_desc_t *desc = irq_desc + irq;
- struct irqaction * action;
- unsigned int status;
-
- irq_enter();
- kstat_this_cpu.irqs[irq]++;
- spin_lock(&desc->lock);
- desc->handler->ack(irq);
- /*
- REPLAY is when Linux resends an IRQ that was dropped earlier
- WAITING is used by probe to mark irqs that are being tested
- */
- status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
- status |= IRQ_PENDING; /* we _want_ to handle it */
-
- /*
- * If the IRQ is disabled for whatever reason, we cannot
- * use the action we have.
- */
- action = NULL;
- if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
- action = desc->action;
- status &= ~IRQ_PENDING; /* we commit to handling */
- status |= IRQ_INPROGRESS; /* we are handling it */
- }
- desc->status = status;
-
- /*
- * If there is no IRQ handler or it was disabled, exit early.
- Since we set PENDING, if another processor is handling
- a different instance of this same irq, the other processor
- will take care of it.
- */
- if (!action)
- goto out;
-
- /*
- * Edge triggered interrupts need to remember
- * pending events.
- * This applies to any hw interrupts that allow a second
- * instance of the same irq to arrive while we are in do_IRQ
- * or in the handler. But the code here only handles the _second_
- * instance of the irq, not the third or fourth. So it is mostly
- * useful for irq hardware that does not mask cleanly in an
- * SMP environment.
- */
- for (;;) {
- spin_unlock(&desc->lock);
- handle_IRQ_event(irq, (struct pt_regs *) regs, action);
- spin_lock(&desc->lock);
-
- if (!(desc->status & IRQ_PENDING))
- break;
- desc->status &= ~IRQ_PENDING;
- }
- desc->status &= ~IRQ_INPROGRESS;
-out:
- /*
- * The ->end() handler has to deal with interrupts which got
- * disabled while the handler was running.
- */
- desc->handler->end(irq);
- spin_unlock(&desc->lock);
-
- irq_exit();
-
- return 1;
-}
-
-/**
- * request_irq - allocate an interrupt line
- * @irq: Interrupt line to allocate
- * @handler: Function to be called when the IRQ occurs
- * @irqflags: Interrupt type flags
- * @devname: An ascii name for the claiming device
- * @dev_id: A cookie passed back to the handler function
- *
- * This call allocates interrupt resources and enables the
- * interrupt line and IRQ handling. From the point this
- * call is made your handler function may be invoked. Since
- * your handler function must clear any interrupt the board
- * raises, you must take care both to initialise your hardware
- * and to set up the interrupt handler in the right order.
- *
- * Dev_id must be globally unique. Normally the address of the
- * device data structure is used as the cookie. Since the handler
- * receives this value it makes sense to use it.
- *
- * If your interrupt is shared you must pass a non NULL dev_id
- * as this is required when freeing the interrupt.
- *
- * Flags:
- *
- * SA_SHIRQ Interrupt is shared
- *
- * SA_INTERRUPT Disable local interrupts while processing
- *
- * SA_SAMPLE_RANDOM The interrupt can be used for entropy
- *
- */
-
-int request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long irqflags,
- const char * devname,
- void *dev_id)
{
- int retval;
- struct irqaction * action;
-
-#if 1
- /*
- * Sanity-check: shared interrupts should REALLY pass in
- * a real dev-ID, otherwise we'll have trouble later trying
- * to figure out which interrupt is which (messes up the
- * interrupt freeing logic etc).
- */
- if (irqflags & SA_SHIRQ) {
- if (!dev_id)
- printk(KERN_ERR "Bad boy: %s (at 0x%x) called us "
- "without a dev_id!\n", devname, (&irq)[-1]);
- }
-#endif
-
- if (irq >= NR_IRQS)
- return -EINVAL;
- if (!handler)
- return -EINVAL;
-
- action = (struct irqaction *)
- kmalloc(sizeof(struct irqaction), GFP_KERNEL);
- if (!action)
- return -ENOMEM;
-
- action->handler = handler;
- action->flags = irqflags;
- cpus_clear(action->mask);
- action->name = devname;
- action->next = NULL;
- action->dev_id = dev_id;
-
- retval = setup_irq(irq, action);
- if (retval)
- kfree(action);
- return retval;
+ irq_enter();
+ __do_IRQ(irq, (struct pt_regs *) regs);
+ irq_exit();
+ return 1;
}
-EXPORT_SYMBOL(request_irq);
-
int um_request_irq(unsigned int irq, int fd, int type,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long irqflags, const char * devname,
@@ -444,222 +111,6 @@ int um_request_irq(unsigned int irq, int
EXPORT_SYMBOL(um_request_irq);
EXPORT_SYMBOL(reactivate_fd);
-/* this was setup_x86_irq but it seems pretty generic */
-int setup_irq(unsigned int irq, struct irqaction * new)
-{
- int shared = 0;
- unsigned long flags;
- struct irqaction *old, **p;
- irq_desc_t *desc = irq_desc + irq;
-
- /*
- * Some drivers like serial.c use request_irq() heavily,
- * so we have to be careful not to interfere with a
- * running system.
- */
- if (new->flags & SA_SAMPLE_RANDOM) {
- /*
- * This function might sleep, we want to call it first,
- * outside of the atomic block.
- * Yes, this might clear the entropy pool if the wrong
- * driver is attempted to be loaded, without actually
- * installing a new handler, but is this really a problem,
- * only the sysadmin is able to do this.
- */
- rand_initialize_irq(irq);
- }
-
- /*
- * The following block of code has to be executed atomically
- */
- spin_lock_irqsave(&desc->lock,flags);
- p = &desc->action;
- old = *p;
- if (old != NULL) {
- /* Can't share interrupts unless both agree to */
- if (!(old->flags & new->flags & SA_SHIRQ)) {
- spin_unlock_irqrestore(&desc->lock,flags);
- return -EBUSY;
- }
-
- /* add new interrupt at end of irq queue */
- do {
- p = &old->next;
- old = *p;
- } while (old);
- shared = 1;
- }
-
- *p = new;
-
- if (!shared) {
- desc->depth = 0;
- desc->status &= ~IRQ_DISABLED;
- desc->handler->startup(irq);
- }
- spin_unlock_irqrestore(&desc->lock,flags);
-
- register_irq_proc(irq);
- return 0;
-}
-
-/**
- * free_irq - free an interrupt
- * @irq: Interrupt line to free
- * @dev_id: Device identity to free
- *
- * Remove an interrupt handler. The handler is removed and if the
- * interrupt line is no longer in use by any driver it is disabled.
- * On a shared IRQ the caller must ensure the interrupt is disabled
- * on the card it drives before calling this function. The function
- * does not return until any executing interrupts for this IRQ
- * have completed.
- *
- * This function may be called from interrupt context.
- *
- * Bugs: Attempting to free an irq in a handler for the same irq hangs
- * the machine.
- */
-
-void free_irq(unsigned int irq, void *dev_id)
-{
- irq_desc_t *desc;
- struct irqaction **p;
- unsigned long flags;
-
- if (irq >= NR_IRQS)
- return;
-
- desc = irq_desc + irq;
- spin_lock_irqsave(&desc->lock,flags);
- p = &desc->action;
- for (;;) {
- struct irqaction * action = *p;
- if (action) {
- struct irqaction **pp = p;
- p = &action->next;
- if (action->dev_id != dev_id)
- continue;
-
- /* Found it - now remove it from the list of entries */
- *pp = action->next;
- if (!desc->action) {
- desc->status |= IRQ_DISABLED;
- desc->handler->shutdown(irq);
- }
- free_irq_by_irq_and_dev(irq, dev_id);
- spin_unlock_irqrestore(&desc->lock,flags);
-
- /* Wait to make sure it's not being used on another CPU */
- synchronize_irq(irq);
- kfree(action);
- return;
- }
- printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
- spin_unlock_irqrestore(&desc->lock,flags);
- return;
- }
-}
-
-EXPORT_SYMBOL(free_irq);
-
-/* These are initialized by sysctl_init, which is called from init/main.c */
-static struct proc_dir_entry * root_irq_dir;
-static struct proc_dir_entry * irq_dir [NR_IRQS];
-static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
-
-/* These are read and written as longs, so a read won't see a partial write
- * even during a race.
- */
-static cpumask_t irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
-
-static int irq_affinity_read_proc (char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
- if (count - len < 2)
- return -EINVAL;
- len += sprintf(page + len, "\n");
- return len;
-}
-
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
- unsigned long count, void *data)
-{
- int irq = (long) data, full_count = count, err;
- cpumask_t new_value;
-
- if (!irq_desc[irq].handler->set_affinity)
- return -EIO;
-
- err = cpumask_parse(buffer, count, new_value);
- if(err)
- return(err);
-
-#ifdef CONFIG_SMP
- /*
- * Do not allow disabling IRQs completely - it's a too easy
- * way to make the system unusable accidentally :-) At least
- * one online CPU still has to be targeted.
- */
- { cpumask_t tmp;
- cpus_and(tmp, new_value, cpu_online_map);
- if (cpus_empty(tmp))
- return -EINVAL;
- }
-#endif
-
- irq_affinity[irq] = new_value;
- irq_desc[irq].handler->set_affinity(irq, new_value);
-
- return full_count;
-}
-
-#define MAX_NAMELEN 10
-
-static void register_irq_proc (unsigned int irq)
-{
- struct proc_dir_entry *entry;
- char name [MAX_NAMELEN];
-
- if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) ||
- irq_dir[irq])
- return;
-
- memset(name, 0, MAX_NAMELEN);
- sprintf(name, "%d", irq);
-
- /* create /proc/irq/1234 */
- irq_dir[irq] = proc_mkdir(name, root_irq_dir);
-
- /* create /proc/irq/1234/smp_affinity */
- entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]);
-
- entry->nlink = 1;
- entry->data = (void *)(long)irq;
- entry->read_proc = irq_affinity_read_proc;
- entry->write_proc = irq_affinity_write_proc;
-
- smp_affinity_entry[irq] = entry;
-}
-
-void __init init_irq_proc (void)
-{
- int i;
-
- /* create /proc/irq */
- root_irq_dir = proc_mkdir("irq", 0);
-
- /* create /proc/irq/prof_cpu_mask */
- create_prof_cpu_mask(root_irq_dir);
-
- /*
- * Create entries for all existing IRQs.
- */
- for (i = 0; i < NR_IRQS; i++)
- register_irq_proc(i);
-}
-
static spinlock_t irq_spinlock = SPIN_LOCK_UNLOCKED;
unsigned long irq_lock(void)
@@ -675,90 +126,27 @@ void irq_unlock(unsigned long flags)
spin_unlock_irqrestore(&irq_spinlock, flags);
}
-unsigned long probe_irq_on(void)
-{
- return(0);
-}
-
-EXPORT_SYMBOL(probe_irq_on);
-
-int probe_irq_off(unsigned long val)
-{
- return(0);
-}
-
-EXPORT_SYMBOL(probe_irq_off);
-
-static unsigned int startup_SIGIO_irq(unsigned int irq)
-{
- return(0);
-}
-
-static void shutdown_SIGIO_irq(unsigned int irq)
-{
-}
-
-static void enable_SIGIO_irq(unsigned int irq)
-{
-}
-
-static void disable_SIGIO_irq(unsigned int irq)
-{
-}
-
-static void mask_and_ack_SIGIO(unsigned int irq)
-{
-}
-
-static void end_SIGIO_irq(unsigned int irq)
-{
-}
-
-static unsigned int startup_SIGVTALRM_irq(unsigned int irq)
-{
- return(0);
-}
-
-static void shutdown_SIGVTALRM_irq(unsigned int irq)
-{
-}
-
-static void enable_SIGVTALRM_irq(unsigned int irq)
-{
-}
-
-static void disable_SIGVTALRM_irq(unsigned int irq)
-{
-}
-
-static void mask_and_ack_SIGVTALRM(unsigned int irq)
-{
-}
-
-static void end_SIGVTALRM_irq(unsigned int irq)
+/* presently hw_interrupt_type must define (startup || enable) &&
+ * disable && end */
+static void dummy(unsigned int irq)
{
}
static struct hw_interrupt_type SIGIO_irq_type = {
- "SIGIO",
- startup_SIGIO_irq,
- shutdown_SIGIO_irq,
- enable_SIGIO_irq,
- disable_SIGIO_irq,
- mask_and_ack_SIGIO,
- end_SIGIO_irq,
- NULL
+ .typename = "SIGIO",
+ .disable = dummy,
+ .enable = dummy,
+ .ack = dummy,
+ .end = dummy
};
static struct hw_interrupt_type SIGVTALRM_irq_type = {
- "SIGVTALRM",
- startup_SIGVTALRM_irq,
- shutdown_SIGVTALRM_irq,
- enable_SIGVTALRM_irq,
- disable_SIGVTALRM_irq,
- mask_and_ack_SIGVTALRM,
- end_SIGVTALRM_irq,
- NULL
+ .typename = "SIGVTALRM",
+ .shutdown = dummy, /* never called */
+ .disable = dummy,
+ .enable = dummy,
+ .ack = dummy,
+ .end = dummy
};
void __init init_IRQ(void)
===== arch/um/kernel/irq_user.c 1.11 vs edited =====
--- 1.11/arch/um/kernel/irq_user.c 2004-09-13 17:23:23 -07:00
+++ edited/arch/um/kernel/irq_user.c 2004-10-20 19:01:06 -07:00
@@ -263,7 +263,7 @@ static int same_irq_and_dev(struct irq_f
return((irq->irq == data->irq) && (irq->id == data->dev));
}
-void free_irq_by_irq_and_dev(int irq, void *dev)
+void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
{
struct irq_and_dev data = ((struct irq_and_dev) { .irq = irq,
.dev = dev });
===== arch/um/kernel/process_kern.c 1.23 vs edited =====
--- 1.23/arch/um/kernel/process_kern.c 2004-09-13 17:23:22 -07:00
+++ edited/arch/um/kernel/process_kern.c 2004-10-20 17:47:51 -07:00
@@ -206,7 +206,6 @@ void default_idle(void)
* although we are an idle CPU, we do not want to
* get into the scheduler unnecessarily.
*/
- irq_stat[smp_processor_id()].idle_timestamp = jiffies;
if(need_resched())
schedule();
===== include/asm-um/hardirq.h 1.1 vs edited =====
--- 1.1/include/asm-um/hardirq.h 2002-09-06 10:29:29 -07:00
+++ edited/include/asm-um/hardirq.h 2004-10-20 17:47:51 -07:00
@@ -1,6 +1,26 @@
-#ifndef __UM_HARDIRQ_H
-#define __UM_HARDIRQ_H
+/* (c) 2004 cw@f00f.org, GPLv2 blah blah */
-#include "asm/arch/hardirq.h"
+#ifndef __ASM_UM_HARDIRQ_H
+#define __ASM_UM_HARDIRQ_H
-#endif
+#include <linux/config.h>
+#include <linux/threads.h>
+#include <linux/irq.h>
+
+/* NOTE: When SMP works again we might want to make this
+ * ____cacheline_aligned or maybe use per_cpu state? --cw */
+typedef struct {
+ unsigned int __softirq_pending;
+} irq_cpustat_t;
+
+#include <linux/irq_cpustat.h>
+
+/* As this would be very strange for UML to get we BUG() after the
+ * printk. */
+static inline void ack_bad_irq(unsigned int irq)
+{
+ printk(KERN_ERR "unexpected IRQ %02x\n", irq);
+ BUG();
+}
+
+#endif /* __ASM_UM_HARDIRQ_H */
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-10-22 20:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-20 0:11 generic hardirq handling for uml Martin Waitz
2004-10-20 3:18 ` Chris Wedgwood
2004-10-20 9:46 ` Martin Waitz
2004-10-20 9:49 ` Chris Wedgwood
2004-10-20 22:41 ` Andrew Morton
2004-10-22 3:19 ` Jeff Dike
2004-10-22 20:04 ` [PATCH] (another!) generic irq handling for UML Chris Wedgwood
2004-10-21 6:18 ` generic hardirq handling for uml Jeff Dike
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.