* disable interrput under ppc?
@ 2007-09-04 2:44 ` Wang, Baojun
0 siblings, 0 replies; 5+ messages in thread
From: Wang, Baojun @ 2007-09-04 2:44 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]
hi, list
How can I disable interrput like `cli' in x86? I want the following code
freeze the box but it doesn't, $MSR is altered however the box is still
alive, how can I freeze the box like `cli' in x86? Thanks very much!
static
void cli(void)
{
unsigned long msr;
__asm__ __volatile__("": : :"memory");
msr = mfmsr();
printk("msr: 0x%lx\n", msr);
__asm__ __volatile__("sync" : : :"memory");
__asm__ __volatile__("wrteei 0" : : :"memory");
msr = mfmsr();
printk("msr: 0x%lx\n", msr);
printk(KERN_EMERG"!!msr: 0x%lx\n", msr);
}
P.S: the box is BOOKE compatible, the printk has shown is altered!
Regards,
Wang
--
Wang, Baojun Lanzhou University
Distributed & Embedded System Lab http://dslab.lzu.edu.cn
School of Information Science and Engeneering wangbj@lzu.edu.cn
Tianshui South Road 222. Lanzhou 730000 .P.R.China
Tel:+86-931-8912025 Fax:+86-931-8912022
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* disable interrput under ppc? @ 2007-09-04 2:44 ` Wang, Baojun 0 siblings, 0 replies; 5+ messages in thread From: Wang, Baojun @ 2007-09-04 2:44 UTC (permalink / raw) To: linuxppc-embedded [-- Attachment #1: Type: text/plain, Size: 1084 bytes --] hi, list How can I disable interrput like `cli' in x86? I want the following code freeze the box but it doesn't, $MSR is altered however the box is still alive, how can I freeze the box like `cli' in x86? Thanks very much! static void cli(void) { unsigned long msr; __asm__ __volatile__("": : :"memory"); msr = mfmsr(); printk("msr: 0x%lx\n", msr); __asm__ __volatile__("sync" : : :"memory"); __asm__ __volatile__("wrteei 0" : : :"memory"); msr = mfmsr(); printk("msr: 0x%lx\n", msr); printk(KERN_EMERG"!!msr: 0x%lx\n", msr); } P.S: the box is BOOKE compatible, the printk has shown is altered! Regards, Wang -- Wang, Baojun Lanzhou University Distributed & Embedded System Lab http://dslab.lzu.edu.cn School of Information Science and Engeneering wangbj@lzu.edu.cn Tianshui South Road 222. Lanzhou 730000 .P.R.China Tel:+86-931-8912025 Fax:+86-931-8912022 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: disable interrput under ppc? @ 2007-09-04 18:24 ` Scott Wood 2007-09-04 18:37 ` Josh Boyer [not found] ` <388931546.05165@lzu.edu.cn> 0 siblings, 2 replies; 5+ messages in thread From: Scott Wood @ 2007-09-04 18:24 UTC (permalink / raw) To: Wang, Baojun; +Cc: linuxppc-embedded On Tue, Sep 04, 2007 at 10:44:14AM +0800, Wang, Baojun wrote: > hi, list > > How can I disable interrput like `cli' in x86? local_irq_disable(). > I want the following code freeze the box but it doesn't, $MSR is > altered however the box is still alive, how can I freeze the box like > `cli' in x86? Thanks very much! Disabling interrupts doesn't freeze the machine by itself -- it depends on what you do afterwards, which you didn't show. -Scott ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: disable interrput under ppc? 2007-09-04 18:24 ` Scott Wood @ 2007-09-04 18:37 ` Josh Boyer [not found] ` <388931546.05165@lzu.edu.cn> 1 sibling, 0 replies; 5+ messages in thread From: Josh Boyer @ 2007-09-04 18:37 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-embedded On Tue, 4 Sep 2007 13:24:33 -0500 Scott Wood <scottwood@freescale.com> wrote: > On Tue, Sep 04, 2007 at 10:44:14AM +0800, Wang, Baojun wrote: > > hi, list > > > > How can I disable interrput like `cli' in x86? > > local_irq_disable(). > > > I want the following code freeze the box but it doesn't, $MSR is > > altered however the box is still alive, how can I freeze the box like > > `cli' in x86? Thanks very much! > > Disabling interrupts doesn't freeze the machine by itself -- it depends > on what you do afterwards, which you didn't show. If you're using a BOOKE variant, there is a way to use the DBCR0 register to set debug wait enable or something to basically hang the CPU until something external clears that bit. But why you would want to do that, I have no idea. josh ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <388931546.05165@lzu.edu.cn>]
* Re: disable interrput under ppc? @ 2007-09-05 2:00 ` Wang, Baojun 0 siblings, 0 replies; 5+ messages in thread From: Wang, Baojun @ 2007-09-05 2:00 UTC (permalink / raw) To: Josh Boyer; +Cc: linuxppc-embedded [-- Attachment #1: Type: text/plain, Size: 3778 bytes --] On Wednesday 05 September 2007, you wrote: > On Tue, 4 Sep 2007 13:24:33 -0500 > > Scott Wood <scottwood@freescale.com> wrote: > > On Tue, Sep 04, 2007 at 10:44:14AM +0800, Wang, Baojun wrote: > > > hi, list > > > > > > How can I disable interrput like `cli' in x86? > > > > local_irq_disable(). > > > > > I want the following code freeze the box but it doesn't, $MSR is > > > altered however the box is still alive, how can I freeze the box like > > > `cli' in x86? Thanks very much! > > > > Disabling interrupts doesn't freeze the machine by itself -- it depends > > on what you do afterwards, which you didn't show. I need to check whether the interrupt have been disabled already, so I'm expected after local_irq_disable() ( __asm__ __volatile__ ("wrteei 0": : :"memory) ), the machine is dead but it doesn't. > If you're using a BOOKE variant, there is a way to use the DBCR0 > register to set debug wait enable or something to basically hang the > CPU until something external clears that bit. But why you would want > to do that, I have no idea. Sorry, I just want to check whether disable_irq/enable_irq is functioning. > josh I'm not really getting confused about the following code: // Executing all pending events while ((event = get_next_set_bit_and_clear (pending, xm_root_domain -> events -> masked_events)) != -1) { // An event pending when there is not any handler installed // catching it??? it must be an error //assert (xm_root_domain -> event_handler [event]); if (!xm_root_domain -> events -> event_handler [event]) continue; // Before executing an event handler, events' flag is disabled // and the event is masked printk(KERN_EMERG"sync_root_events: looping!\n"); set_bit (xm_root_domain -> events -> masked_events, event); printk(KERN_EMERG"sync_root_events: looping 2!\n"); disable_events_flag (xm_root_domain); printk(KERN_EMERG"sync_root_events: looping 3!\n"); printk(KERN_EMERG"hw_irq_disabled?: %d\n", hw_irq_disabled()); hw_enable_irq (); printk(KERN_EMERG"sync_root_events: looping 4!\n"); // Here, the event handler is executed always // with the same conditions, that is, event flag disabled // and the executed event masked as well (*xm_root_domain -> events -> event_handler[event]) (event, regs); printk(KERN_EMERG"sync_root_events: looping 5!\n"); hw_disable_irq(); printk(KERN_EMERG"sync_root_events: looping 6!\n"); // Events flag is automatically enabled (iret emulation) enable_events_flag (xm_root_domain); } hw_enable_irq() and hw_disable_irq() is exactly the same as local_irq_enable()/local_irq_disable(), but the output shows while running hw_eable_irq() (at that point irq is disabled), the rest of the code is blocked, and I don't know why: output: [ 172.049381] sync_root_events: looping! [ 172.053159] sync_root_events: looping 2! [ 172.057094] sync_root_events: looping 3! [ 172.061027] hw_irq_disabled?: 1 [ 172.997338] sync_root_events: looping! [ 173.001095] sync_root_events: looping 2! [ 173.005028] sync_root_events: looping 3! [ 173.008961] hw_irq_disabled?: 1 I'm sorry If I'm asking a bad question, I'm not familiar with ppc/kernel programming at this moment. Great thanks to Scott and josh for your reply. Regards, Wang -- Wang, Baojun Lanzhou University Distributed & Embedded System Lab http://dslab.lzu.edu.cn School of Information Science and Engeneering wangbj@lzu.edu.cn Tianshui South Road 222. Lanzhou 730000 .P.R.China Tel:+86-931-8912025 Fax:+86-931-8912022 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: disable interrput under ppc? @ 2007-09-05 2:00 ` Wang, Baojun 0 siblings, 0 replies; 5+ messages in thread From: Wang, Baojun @ 2007-09-05 2:00 UTC (permalink / raw) To: Josh Boyer; +Cc: linuxppc-embedded [-- Attachment #1: Type: text/plain, Size: 3778 bytes --] On Wednesday 05 September 2007, you wrote: > On Tue, 4 Sep 2007 13:24:33 -0500 > > Scott Wood <scottwood@freescale.com> wrote: > > On Tue, Sep 04, 2007 at 10:44:14AM +0800, Wang, Baojun wrote: > > > hi, list > > > > > > How can I disable interrput like `cli' in x86? > > > > local_irq_disable(). > > > > > I want the following code freeze the box but it doesn't, $MSR is > > > altered however the box is still alive, how can I freeze the box like > > > `cli' in x86? Thanks very much! > > > > Disabling interrupts doesn't freeze the machine by itself -- it depends > > on what you do afterwards, which you didn't show. I need to check whether the interrupt have been disabled already, so I'm expected after local_irq_disable() ( __asm__ __volatile__ ("wrteei 0": : :"memory) ), the machine is dead but it doesn't. > If you're using a BOOKE variant, there is a way to use the DBCR0 > register to set debug wait enable or something to basically hang the > CPU until something external clears that bit. But why you would want > to do that, I have no idea. Sorry, I just want to check whether disable_irq/enable_irq is functioning. > josh I'm not really getting confused about the following code: // Executing all pending events while ((event = get_next_set_bit_and_clear (pending, xm_root_domain -> events -> masked_events)) != -1) { // An event pending when there is not any handler installed // catching it??? it must be an error //assert (xm_root_domain -> event_handler [event]); if (!xm_root_domain -> events -> event_handler [event]) continue; // Before executing an event handler, events' flag is disabled // and the event is masked printk(KERN_EMERG"sync_root_events: looping!\n"); set_bit (xm_root_domain -> events -> masked_events, event); printk(KERN_EMERG"sync_root_events: looping 2!\n"); disable_events_flag (xm_root_domain); printk(KERN_EMERG"sync_root_events: looping 3!\n"); printk(KERN_EMERG"hw_irq_disabled?: %d\n", hw_irq_disabled()); hw_enable_irq (); printk(KERN_EMERG"sync_root_events: looping 4!\n"); // Here, the event handler is executed always // with the same conditions, that is, event flag disabled // and the executed event masked as well (*xm_root_domain -> events -> event_handler[event]) (event, regs); printk(KERN_EMERG"sync_root_events: looping 5!\n"); hw_disable_irq(); printk(KERN_EMERG"sync_root_events: looping 6!\n"); // Events flag is automatically enabled (iret emulation) enable_events_flag (xm_root_domain); } hw_enable_irq() and hw_disable_irq() is exactly the same as local_irq_enable()/local_irq_disable(), but the output shows while running hw_eable_irq() (at that point irq is disabled), the rest of the code is blocked, and I don't know why: output: [ 172.049381] sync_root_events: looping! [ 172.053159] sync_root_events: looping 2! [ 172.057094] sync_root_events: looping 3! [ 172.061027] hw_irq_disabled?: 1 [ 172.997338] sync_root_events: looping! [ 173.001095] sync_root_events: looping 2! [ 173.005028] sync_root_events: looping 3! [ 173.008961] hw_irq_disabled?: 1 I'm sorry If I'm asking a bad question, I'm not familiar with ppc/kernel programming at this moment. Great thanks to Scott and josh for your reply. Regards, Wang -- Wang, Baojun Lanzhou University Distributed & Embedded System Lab http://dslab.lzu.edu.cn School of Information Science and Engeneering wangbj@lzu.edu.cn Tianshui South Road 222. Lanzhou 730000 .P.R.China Tel:+86-931-8912025 Fax:+86-931-8912022 [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: disable interrput under ppc? @ 2007-09-05 16:31 ` Scott Wood 0 siblings, 0 replies; 5+ messages in thread From: Scott Wood @ 2007-09-05 16:31 UTC (permalink / raw) To: Wang, Baojun; +Cc: linuxppc-embedded On Wed, Sep 05, 2007 at 10:00:46AM +0800, Wang, Baojun wrote: > hw_enable_irq() and hw_disable_irq() is exactly the same as > local_irq_enable()/local_irq_disable(), but the output shows while running > hw_eable_irq() (at that point irq is disabled), the rest of the code is > blocked, and I don't know why: > > output: > [ 172.049381] sync_root_events: looping! > [ 172.053159] sync_root_events: looping 2! > [ 172.057094] sync_root_events: looping 3! > [ 172.061027] hw_irq_disabled?: 1 > [ 172.997338] sync_root_events: looping! > [ 173.001095] sync_root_events: looping 2! > [ 173.005028] sync_root_events: looping 3! > [ 173.008961] hw_irq_disabled?: 1 What did you expect the output to be? I assume that you're taking an interrupt after you enable interrupts? -Scott ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-09-05 16:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-04 2:44 disable interrput under ppc? Wang, Baojun
2007-09-04 2:44 ` Wang, Baojun
2007-09-04 18:24 ` Scott Wood
2007-09-04 18:37 ` Josh Boyer
[not found] ` <388931546.05165@lzu.edu.cn>
2007-09-05 2:00 ` Wang, Baojun
2007-09-05 2:00 ` Wang, Baojun
2007-09-05 16:31 ` Scott Wood
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.