Skip to contentSkip to conversation

make ctrl_if.c can be used in para-driver for unmodified guest

PATCH New Xiaofeng Ling 1 participant 1 message Sep 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make ctrl_if.c can be used in para-driver for unmodified guest

make ctrl_if.c can be used in para-driver for unmodified guest changes are:
1. use bind_evtchn_to_irqhandler instead of setup_irq
2. set safe_to_schedule_task = 1 in ctrl_if_init
3. remove warnings when build.
#ifndef CONFIG_XEN means build with unmodified kernel not xen-linux. xen_start_info.domain_controller_evtchn is set in event channel pci driver.
This file is needed for the front end drivers that is not ported to xenbus.

linux-2.6-xen-sparse/arch/xen/kernel/ctrl_if.c +7 -2
diff -r 287d36b46fa3 linux-2.6-xen-sparse/arch/xen/kernel/ctrl_if.c
@@ -67,10 +67,11 @@
 int initdom_ctrlif_domcontroller_port = -1;
 
 static int        ctrl_if_evtchn;
+#ifdef CONFIG_XEN
 static int        ctrl_if_irq;
+static struct irqaction ctrl_if_irq_action;
+#endif
 static spinlock_t ctrl_if_lock;
-
-static struct irqaction ctrl_if_irq_action;
 
 static ctrl_front_ring_t ctrl_if_tx_ring;
 static ctrl_back_ring_t  ctrl_if_rx_ring;
@@ -475,8 +476,12 @@
 
 void ctrl_if_suspend(void)
 {
+#ifdef CONFIG_XEN
     teardown_irq(ctrl_if_irq, &ctrl_if_irq_action);
     unbind_evtchn_from_irq(ctrl_if_evtchn);
+#else
+    unbind_evtchn_from_irqhandler(ctrl_if_evtchn, NULL);
+#endif
 }
 
 void ctrl_if_resume(void)
@@ -510,12 +515,22 @@
     BACK_RING_ATTACH(&ctrl_if_rx_ring, &ctrl_if->rx_ring, 

CONTROL_RING_MEM);

     ctrl_if_evtchn = xen_start_info.domain_controller_evtchn;
+#ifdef CONFIG_XEN
     ctrl_if_irq    = bind_evtchn_to_irq(ctrl_if_evtchn);

     memset(&ctrl_if_irq_action, 0, sizeof(ctrl_if_irq_action));
     ctrl_if_irq_action.handler = ctrl_if_interrupt;
     ctrl_if_irq_action.name    = "ctrl-if";
     (void)setup_irq(ctrl_if_irq, &ctrl_if_irq_action);

+#else
+ if(bind_evtchn_to_irqhandler(
+ ctrl_if_evtchn, ctrl_if_interrupt, SA_SAMPLE_RANDOM, "ctrl-if", NULL))
+ {
+ printk("bind_evtchn_to_irqhandler failed\n" );
+ return;
+ }
+
+#endif
}

void __init ctrl_if_init(void)
@@ -532,6 +547,9 @@

     spin_lock_init(&ctrl_if_lock);

     ctrl_if_resume();

+#ifndef CONFIG_XEN
+ safe_to_schedule_task = 1;
+#endif
}