Re: [PATCH] Define EFLAGS_IF

2007-04-08 Thread Rusty Russell
On Fri, 2007-04-06 at 08:39 -0700, H. Peter Anvin wrote:
> I will, unless Rusty does, first.  No desire to step on each other.

Oh no, please, after you!

Rusty.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-08 Thread Rusty Russell
On Fri, 2007-04-06 at 08:39 -0700, H. Peter Anvin wrote:
 I will, unless Rusty does, first.  No desire to step on each other.

Oh no, please, after you!

Rusty.


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread H. Peter Anvin

Andi Kleen wrote:

On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:

Andi Kleen wrote:

No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.

Fair enough.  However, I'd still like to see the X86_CR* constants 
moved, too (and constants added for at least CR0 as well.)


Send patches then.


I will, unless Rusty does, first.  No desire to step on each other.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread Andi Kleen
On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:
> Andi Kleen wrote:
> >
> >No processor.h is such a hodgepodge of unrelated stuff that any
> >splitting up is a good thing.
> >
> 
> Fair enough.  However, I'd still like to see the X86_CR* constants 
> moved, too (and constants added for at least CR0 as well.)

Send patches then.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread Andi Kleen
On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:
 Andi Kleen wrote:
 
 No processor.h is such a hodgepodge of unrelated stuff that any
 splitting up is a good thing.
 
 
 Fair enough.  However, I'd still like to see the X86_CR* constants 
 moved, too (and constants added for at least CR0 as well.)

Send patches then.

-Andi
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-06 Thread H. Peter Anvin

Andi Kleen wrote:

On Thu, Apr 05, 2007 at 06:06:16PM -0700, H. Peter Anvin wrote:

Andi Kleen wrote:

No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.

Fair enough.  However, I'd still like to see the X86_CR* constants 
moved, too (and constants added for at least CR0 as well.)


Send patches then.


I will, unless Rusty does, first.  No desire to step on each other.

-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Rusty Russell
On Thu, 2007-04-05 at 18:06 -0700, H. Peter Anvin wrote:
> Andi Kleen wrote:
> > 
> > No processor.h is such a hodgepodge of unrelated stuff that any
> > splitting up is a good thing.
> > 
> 
> Fair enough.  However, I'd still like to see the X86_CR* constants 
> moved, too (and constants added for at least CR0 as well.)

Agreed.  This was on theory of minimum damage, but since it seems to
have received a warm reception, I'd say moving the rest to
processor-flags.h would be a welcome addition.

Cheers,
Rusty.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Andi Kleen wrote:


No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.



Fair enough.  However, I'd still like to see the X86_CR* constants 
moved, too (and constants added for at least CR0 as well.)


-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Andi Kleen
On Thu, Apr 05, 2007 at 05:29:52PM -0700, H. Peter Anvin wrote:
> Jeremy Fitzhardinge wrote:
> >
> >That patch got dropped, and replaced by one which pulled all the flags
> >definitions out of 
> >
> 
> Saw that a little too late :)
> 
> In general, it would be nice if the various CPU constants were all 
> defined in one place, so I'd rather suggest protecting the appropriate 
> parts of asm/processor.h with #ifndef __ASSEMBLY__.

No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Jeremy Fitzhardinge wrote:


That patch got dropped, and replaced by one which pulled all the flags
definitions out of 



Saw that a little too late :)

In general, it would be nice if the various CPU constants were all 
defined in one place, so I'd rather suggest protecting the appropriate 
parts of asm/processor.h with #ifndef __ASSEMBLY__.


-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Jeremy Fitzhardinge
H. Peter Anvin wrote:
> Rusty Russell wrote:
>   
>> There is now more than one place where we use the fact that bit 9 of
>> eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
>> 512 so it can be used in asm, too.
>> 
>
> How about defining all the other EFLAGS in one place?
>   

That patch got dropped, and replaced by one which pulled all the flags
definitions out of 

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Rusty Russell wrote:

There is now more than one place where we use the fact that bit 9 of
eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
512 so it can be used in asm, too.


How about defining all the other EFLAGS in one place?

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Rusty Russell wrote:

There is now more than one place where we use the fact that bit 9 of
eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
512 so it can be used in asm, too.


How about defining all the other EFLAGS in one place?

-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Jeremy Fitzhardinge
H. Peter Anvin wrote:
 Rusty Russell wrote:
   
 There is now more than one place where we use the fact that bit 9 of
 eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
 512 so it can be used in asm, too.
 

 How about defining all the other EFLAGS in one place?
   

That patch got dropped, and replaced by one which pulled all the flags
definitions out of asm/processor.h

J
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Jeremy Fitzhardinge wrote:


That patch got dropped, and replaced by one which pulled all the flags
definitions out of asm/processor.h



Saw that a little too late :)

In general, it would be nice if the various CPU constants were all 
defined in one place, so I'd rather suggest protecting the appropriate 
parts of asm/processor.h with #ifndef __ASSEMBLY__.


-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Andi Kleen
On Thu, Apr 05, 2007 at 05:29:52PM -0700, H. Peter Anvin wrote:
 Jeremy Fitzhardinge wrote:
 
 That patch got dropped, and replaced by one which pulled all the flags
 definitions out of asm/processor.h
 
 
 Saw that a little too late :)
 
 In general, it would be nice if the various CPU constants were all 
 defined in one place, so I'd rather suggest protecting the appropriate 
 parts of asm/processor.h with #ifndef __ASSEMBLY__.

No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.

-Andi
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread H. Peter Anvin

Andi Kleen wrote:


No processor.h is such a hodgepodge of unrelated stuff that any
splitting up is a good thing.



Fair enough.  However, I'd still like to see the X86_CR* constants 
moved, too (and constants added for at least CR0 as well.)


-hpa
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-04-05 Thread Rusty Russell
On Thu, 2007-04-05 at 18:06 -0700, H. Peter Anvin wrote:
 Andi Kleen wrote:
  
  No processor.h is such a hodgepodge of unrelated stuff that any
  splitting up is a good thing.
  
 
 Fair enough.  However, I'd still like to see the X86_CR* constants 
 moved, too (and constants added for at least CR0 as well.)

Agreed.  This was on theory of minimum damage, but since it seems to
have received a warm reception, I'd say moving the rest to
processor-flags.h would be a welcome addition.

Cheers,
Rusty.



-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-03-21 Thread Rusty Russell
On Thu, 2007-03-22 at 14:16 +1100, Rusty Russell wrote:
> There is now more than one place where we use the fact that bit 9 of
> eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
> 512 so it can be used in asm, too.

Belay this: there's a X86_EFLAGS_IF in asm/processor.h which we should
use.  Will send patch.

Thanks to Jeremy Fitzhardinge for the clue.

Rusty.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Define EFLAGS_IF

2007-03-21 Thread Rusty Russell
There is now more than one place where we use the fact that bit 9 of
eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
512 so it can be used in asm, too.

Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>

--- a/arch/i386/lguest/lguest.c
+++ b/arch/i386/lguest/lguest.c
@@ -107,9 +107,8 @@ static void fastcall irq_disable(void)
 
 static void fastcall irq_enable(void)
 {
-   /* Linux i386 code expects bit 9 set. */
/* FIXME: Check if interrupt pending... */
-   lguest_data.irq_enabled = 512;
+   lguest_data.irq_enabled = EFLAGS_IF;
 }
 
 static void fastcall lguest_load_gdt(const struct Xgt_desc_struct *desc)
@@ -394,7 +393,7 @@ static fastcall void lguest_write_idt_en
extern const char start_##name[], end_##name[]; \
asm("start_" #name ": " code "; end_" #name ":")
 DEF_LGUEST(cli, "movl $0," LGUEST_IRQ);
-DEF_LGUEST(sti, "movl $512," LGUEST_IRQ);
+DEF_LGUEST(sti, "movl $"__stringify(EFLAGS_IF)"," LGUEST_IRQ);
 DEF_LGUEST(popf, "movl %eax," LGUEST_IRQ);
 DEF_LGUEST(pushf, "movl " LGUEST_IRQ ",%eax");
 DEF_LGUEST(pushf_cli, "movl " LGUEST_IRQ ",%eax; movl $0," LGUEST_IRQ);
===
--- a/include/asm-i386/irqflags.h
+++ b/include/asm-i386/irqflags.h
@@ -87,6 +87,9 @@ static inline unsigned long __raw_local_
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_PARAVIRT */
 
+/* Bit 9 of eflags means interrupts are enabled: a raw int for asm. */
+#define EFLAGS_IF 512
+
 #ifndef __ASSEMBLY__
 #define raw_local_save_flags(flags) \
do { (flags) = __raw_local_save_flags(); } while (0)
@@ -96,7 +99,7 @@ static inline unsigned long __raw_local_
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-   return !(flags & (1 << 9));
+   return !(flags & EFLAGS_IF);
 }
 
 static inline int raw_irqs_disabled(void)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Define EFLAGS_IF

2007-03-21 Thread Rusty Russell
There is now more than one place where we use the fact that bit 9 of
eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
512 so it can be used in asm, too.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]

--- a/arch/i386/lguest/lguest.c
+++ b/arch/i386/lguest/lguest.c
@@ -107,9 +107,8 @@ static void fastcall irq_disable(void)
 
 static void fastcall irq_enable(void)
 {
-   /* Linux i386 code expects bit 9 set. */
/* FIXME: Check if interrupt pending... */
-   lguest_data.irq_enabled = 512;
+   lguest_data.irq_enabled = EFLAGS_IF;
 }
 
 static void fastcall lguest_load_gdt(const struct Xgt_desc_struct *desc)
@@ -394,7 +393,7 @@ static fastcall void lguest_write_idt_en
extern const char start_##name[], end_##name[]; \
asm(start_ #name :  code ; end_ #name :)
 DEF_LGUEST(cli, movl $0, LGUEST_IRQ);
-DEF_LGUEST(sti, movl $512, LGUEST_IRQ);
+DEF_LGUEST(sti, movl $__stringify(EFLAGS_IF), LGUEST_IRQ);
 DEF_LGUEST(popf, movl %eax, LGUEST_IRQ);
 DEF_LGUEST(pushf, movl  LGUEST_IRQ ,%eax);
 DEF_LGUEST(pushf_cli, movl  LGUEST_IRQ ,%eax; movl $0, LGUEST_IRQ);
===
--- a/include/asm-i386/irqflags.h
+++ b/include/asm-i386/irqflags.h
@@ -87,6 +87,9 @@ static inline unsigned long __raw_local_
 #endif /* __ASSEMBLY__ */
 #endif /* CONFIG_PARAVIRT */
 
+/* Bit 9 of eflags means interrupts are enabled: a raw int for asm. */
+#define EFLAGS_IF 512
+
 #ifndef __ASSEMBLY__
 #define raw_local_save_flags(flags) \
do { (flags) = __raw_local_save_flags(); } while (0)
@@ -96,7 +99,7 @@ static inline unsigned long __raw_local_
 
 static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
-   return !(flags  (1  9));
+   return !(flags  EFLAGS_IF);
 }
 
 static inline int raw_irqs_disabled(void)


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Define EFLAGS_IF

2007-03-21 Thread Rusty Russell
On Thu, 2007-03-22 at 14:16 +1100, Rusty Russell wrote:
 There is now more than one place where we use the fact that bit 9 of
 eflags is the interrupt-enabled flag, so define EFLAGS_IF.  We make it
 512 so it can be used in asm, too.

Belay this: there's a X86_EFLAGS_IF in asm/processor.h which we should
use.  Will send patch.

Thanks to Jeremy Fitzhardinge for the clue.

Rusty.


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/