All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
@ 2007-10-25 20:10 Steven A. Falco
  2007-10-25 20:22 ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Steven A. Falco @ 2007-10-25 20:10 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

I applied the uic patch:

diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index eeb38e2..5a38086 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -48,7 +48,7 @@ struct uic {
 	int index;
 	int dcrbase;

-	spinlock_t lock;
+	ipipe_spinlock_t lock;

 	/* The remapper for this UIC */
 	struct irq_host	*irqhost;

However, this would not compile because of a type mismatch.  I have added the attached patch, and it now compiles and runs.  But I'm not sure if this is the right way to fix it.  Comments?

	Steve



[-- Attachment #2: new.patch --]
[-- Type: text/x-patch, Size: 416 bytes --]

--- /home/sfalco/uic.c	2007-10-25 15:59:35.000000000 -0400
+++ arch/powerpc/sysdev/uic.c	2007-10-25 16:06:16.000000000 -0400
@@ -231,7 +231,7 @@
 		return NULL; /* FIXME: panic? */
 
 	memset(uic, 0, sizeof(*uic));
-	spin_lock_init(&uic->lock);
+	uic->lock = IPIPE_SPIN_LOCK_UNLOCKED;
 	uic->of_node = of_node_get(node);
 	indexp = of_get_property(node, "cell-index", &len);
 	if (!indexp || (len != sizeof(u32))) {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
  2007-10-25 20:10 [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch Steven A. Falco
@ 2007-10-25 20:22 ` Philippe Gerum
  2007-10-25 20:37   ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2007-10-25 20:22 UTC (permalink / raw)
  To: Steven A. Falco; +Cc: xenomai

Steven A. Falco wrote:
> I applied the uic patch:
> 
> diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
> index eeb38e2..5a38086 100644
> --- a/arch/powerpc/sysdev/uic.c
> +++ b/arch/powerpc/sysdev/uic.c
> @@ -48,7 +48,7 @@ struct uic {
>     int index;
>     int dcrbase;
> 
> -    spinlock_t lock;
> +    ipipe_spinlock_t lock;
> 
>     /* The remapper for this UIC */
>     struct irq_host    *irqhost;
> 
> However, this would not compile because of a type mismatch.  I have
> added the attached patch, and it now compiles and runs.  But I'm not
> sure if this is the right way to fix it.  Comments?
> 

This will work for the purpose of running an I-pipe enabled kernel, but
would fail with CONFIG_IPIPE disabled. Since we need to provide both,
I'm going to work on the proper patch for fixing the issue both ways.
Still, your patch will work as expected for running Xenomai.

>     Steve
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core


-- 
Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
  2007-10-25 20:22 ` Philippe Gerum
@ 2007-10-25 20:37   ` Jan Kiszka
  2007-10-25 21:03     ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2007-10-25 20:37 UTC (permalink / raw)
  To: rpm; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2722 bytes --]

Philippe Gerum wrote:
> Steven A. Falco wrote:
>> I applied the uic patch:
>>
>> diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
>> index eeb38e2..5a38086 100644
>> --- a/arch/powerpc/sysdev/uic.c
>> +++ b/arch/powerpc/sysdev/uic.c
>> @@ -48,7 +48,7 @@ struct uic {
>>     int index;
>>     int dcrbase;
>>
>> -    spinlock_t lock;
>> +    ipipe_spinlock_t lock;
>>
>>     /* The remapper for this UIC */
>>     struct irq_host    *irqhost;
>>
>> However, this would not compile because of a type mismatch.  I have
>> added the attached patch, and it now compiles and runs.  But I'm not
>> sure if this is the right way to fix it.  Comments?
>>
> 
> This will work for the purpose of running an I-pipe enabled kernel, but
> would fail with CONFIG_IPIPE disabled. Since we need to provide both,
> I'm going to work on the proper patch for fixing the issue both ways.
> Still, your patch will work as expected for running Xenomai.

To be consequent, we would have to wrap spin_lock_init just like the
other operations. Suggestion (not really tested):

Index: linux-2.6.23-ipipe/include/linux/spinlock.h
===================================================================
--- linux-2.6.23-ipipe.orig/include/linux/spinlock.h
+++ linux-2.6.23-ipipe/include/linux/spinlock.h
@@ -89,10 +89,22 @@ extern int __lockfunc generic__raw_read_
 # include <linux/spinlock_up.h>
 #endif
 
+#undef TYPE_EQUAL
+#define TYPE_EQUAL(lock, type) \
+	__builtin_types_compatible_p(typeof(lock), type *)
+
+#define spin_lock_init(lock)						\
+do {									\
+	if (TYPE_EQUAL((lock), __ipipe_spinlock_t))			\
+		*(__ipipe_spinlock_t *)(lock) = IPIPE_SPIN_LOCK_UNLOCKED; \
+	else if (TYPE_EQUAL(lock, spinlock_t))				\
+		_spin_lock_init((spinlock_t *)(lock));			\
+} while (0)
+
 #ifdef CONFIG_DEBUG_SPINLOCK
   extern void __spin_lock_init(spinlock_t *lock, const char *name,
 			       struct lock_class_key *key);
-# define spin_lock_init(lock)					\
+# define _spin_lock_init(lock)					\
 do {								\
 	static struct lock_class_key __key;			\
 								\
@@ -100,7 +112,7 @@ do {								\
 } while (0)
 
 #else
-# define spin_lock_init(lock)					\
+# define _spin_lock_init(lock)					\
 	do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
 #endif
 
@@ -172,10 +184,6 @@ do {								\
 #define read_trylock(lock)		__cond_lock(lock, _read_trylock(lock))
 #define write_trylock(lock)		__cond_lock(lock, _write_trylock(lock))
 
-#undef TYPE_EQUAL
-#define TYPE_EQUAL(lock, type) \
-	__builtin_types_compatible_p(typeof(lock), type *)
-
 #define PICK_SPINOP(op, lock)						\
 do {									\
 	if (TYPE_EQUAL((lock), __ipipe_spinlock_t))			\


Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
  2007-10-25 20:37   ` Jan Kiszka
@ 2007-10-25 21:03     ` Philippe Gerum
  2007-10-26  8:32       ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2007-10-25 21:03 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Philippe Gerum wrote:
>> Steven A. Falco wrote:
>>> I applied the uic patch:
>>>
>>> diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
>>> index eeb38e2..5a38086 100644
>>> --- a/arch/powerpc/sysdev/uic.c
>>> +++ b/arch/powerpc/sysdev/uic.c
>>> @@ -48,7 +48,7 @@ struct uic {
>>>     int index;
>>>     int dcrbase;
>>>
>>> -    spinlock_t lock;
>>> +    ipipe_spinlock_t lock;
>>>
>>>     /* The remapper for this UIC */
>>>     struct irq_host    *irqhost;
>>>
>>> However, this would not compile because of a type mismatch.  I have
>>> added the attached patch, and it now compiles and runs.  But I'm not
>>> sure if this is the right way to fix it.  Comments?
>>>
>> This will work for the purpose of running an I-pipe enabled kernel, but
>> would fail with CONFIG_IPIPE disabled. Since we need to provide both,
>> I'm going to work on the proper patch for fixing the issue both ways.
>> Still, your patch will work as expected for running Xenomai.
> 
> To be consequent, we would have to wrap spin_lock_init just like the
> other operations. Suggestion (not really tested):
>

Thanks. I have committed a tested variant.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
  2007-10-25 21:03     ` Philippe Gerum
@ 2007-10-26  8:32       ` Jan Kiszka
  2007-10-26 10:06         ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2007-10-26  8:32 UTC (permalink / raw)
  To: rpm; +Cc: xenomai

Philippe Gerum wrote:
> Jan Kiszka wrote:
>> Philippe Gerum wrote:
>>> Steven A. Falco wrote:
>>>> I applied the uic patch:
>>>>
>>>> diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
>>>> index eeb38e2..5a38086 100644
>>>> --- a/arch/powerpc/sysdev/uic.c
>>>> +++ b/arch/powerpc/sysdev/uic.c
>>>> @@ -48,7 +48,7 @@ struct uic {
>>>>     int index;
>>>>     int dcrbase;
>>>>
>>>> -    spinlock_t lock;
>>>> +    ipipe_spinlock_t lock;
>>>>
>>>>     /* The remapper for this UIC */
>>>>     struct irq_host    *irqhost;
>>>>
>>>> However, this would not compile because of a type mismatch.  I have
>>>> added the attached patch, and it now compiles and runs.  But I'm not
>>>> sure if this is the right way to fix it.  Comments?
>>>>
>>> This will work for the purpose of running an I-pipe enabled kernel, but
>>> would fail with CONFIG_IPIPE disabled. Since we need to provide both,
>>> I'm going to work on the proper patch for fixing the issue both ways.
>>> Still, your patch will work as expected for running Xenomai.
>> To be consequent, we would have to wrap spin_lock_init just like the
>> other operations. Suggestion (not really tested):
>>
> 
> Thanks. I have committed a tested variant.

The additional #ifdef CONFIG_IPIPE for spin_lock_init should be
redundant, in theory. What makes it necessary in practice?

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch
  2007-10-26  8:32       ` Jan Kiszka
@ 2007-10-26 10:06         ` Philippe Gerum
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Gerum @ 2007-10-26 10:06 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
> Philippe Gerum wrote:
>> Jan Kiszka wrote:
>>> Philippe Gerum wrote:
>>>> Steven A. Falco wrote:
>>>>> I applied the uic patch:
>>>>>
>>>>> diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
>>>>> index eeb38e2..5a38086 100644
>>>>> --- a/arch/powerpc/sysdev/uic.c
>>>>> +++ b/arch/powerpc/sysdev/uic.c
>>>>> @@ -48,7 +48,7 @@ struct uic {
>>>>>     int index;
>>>>>     int dcrbase;
>>>>>
>>>>> -    spinlock_t lock;
>>>>> +    ipipe_spinlock_t lock;
>>>>>
>>>>>     /* The remapper for this UIC */
>>>>>     struct irq_host    *irqhost;
>>>>>
>>>>> However, this would not compile because of a type mismatch.  I have
>>>>> added the attached patch, and it now compiles and runs.  But I'm not
>>>>> sure if this is the right way to fix it.  Comments?
>>>>>
>>>> This will work for the purpose of running an I-pipe enabled kernel, but
>>>> would fail with CONFIG_IPIPE disabled. Since we need to provide both,
>>>> I'm going to work on the proper patch for fixing the issue both ways.
>>>> Still, your patch will work as expected for running Xenomai.
>>> To be consequent, we would have to wrap spin_lock_init just like the
>>> other operations. Suggestion (not really tested):
>>>
>> Thanks. I have committed a tested variant.
> 
> The additional #ifdef CONFIG_IPIPE for spin_lock_init should be
> redundant, in theory. What makes it necessary in practice?
>

Nothing, actually. Fixing your previous patch this way work do it:

-		*(__ipipe_spinlock_t *)(lock) = IPIPE_SPIN_LOCK_UNLOCKED; \
+		*(ipipe_spinlock_t *)(lock) = IPIPE_SPIN_LOCK_UNLOCKED; \

-- 
Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-26 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-25 20:10 [Xenomai-core] Proposed arch/powerpc/sysdev/uic.c patch Steven A. Falco
2007-10-25 20:22 ` Philippe Gerum
2007-10-25 20:37   ` Jan Kiszka
2007-10-25 21:03     ` Philippe Gerum
2007-10-26  8:32       ` Jan Kiszka
2007-10-26 10:06         ` Philippe Gerum

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.