* Re: [RFC 1/3] lro: Generic LRO for TCP traffic
From: Evgeniy Polyakov @ 2007-07-12 8:01 UTC (permalink / raw)
To: Jan-Bernd Themann
Cc: Thomas Klein, Jan-Bernd Themann, netdev, linux-kernel, linux-ppc,
Christoph Raisch, Marcus Eder, Stefan Roscher
In-Reply-To: <200707111621.34376.ossthema@de.ibm.com>
Hi, Jan-Bernd.
I have couple of comments over implementation besides one you saw
previous time.
On Wed, Jul 11, 2007 at 04:21:34PM +0200, Jan-Bernd Themann (ossthema@de.ibm.com) wrote:
> +static int lro_tcp_ip_check(struct sk_buff *skb, struct iphdr *iph,
> + struct tcphdr *tcph, struct net_lro_desc *lro_desc)
> +{
> + /* check ip header: packet length */
> + if (ntohs(iph->tot_len) > skb->len)
> + return -1;
> +
> + if (TCP_PAYLOAD_LENGTH(iph, tcph) == 0)
> + return -1;
> +
> + if (iph->ihl != IPH_LEN_WO_OPTIONS)
> + return -1;
> +
> + if (tcph->cwr || tcph->ece || tcph->urg || !tcph->ack || tcph->psh
> + || tcph->rst || tcph->syn || tcph->fin)
> + return -1;
I think you do not want to break lro frame because of push flag - it is
pretty common flag, which does not brak processing (and I'm not sure if
it has any special meaning this days).
> + if (INET_ECN_is_ce(ipv4_get_dsfield(iph)))
> + return -1;
> +
> + if (tcph->doff != TCPH_LEN_WO_OPTIONS
> + && tcph->doff != TCPH_LEN_W_TIMESTAMP)
> + return -1;
> +
> + /* check tcp options (only timestamp allowed) */
> + if (tcph->doff == TCPH_LEN_W_TIMESTAMP) {
> + u32 *topt = (u32 *)(tcph + 1);
> +
> + if (*topt != htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
> + | (TCPOPT_TIMESTAMP << 8)
> + | TCPOLEN_TIMESTAMP))
> + return -1;
> +
> + /* timestamp should be in right order */
> + topt++;
> + if (lro_desc && (ntohl(lro_desc->tcp_rcv_tsval) > ntohl(*topt)))
> + return -1;
This still does not handle wrapping over 32 bits.
What about
if (lro_desc && after(ntohl(lro_desc->tcp_rcv_tsval), ntohl(*topt)))
return -1;
> + /* timestamp reply should not be zero */
> + topt++;
> + if (*topt == 0)
> + return -1;
> + }
> +
> + return 0;
> +}
> +static struct net_lro_desc *lro_get_desc(struct net_lro_mgr *mgr,
> + struct net_lro_desc *lro_arr,
> + struct iphdr *iph,
> + struct tcphdr *tcph)
> +{
> + struct net_lro_desc *lro_desc = NULL;
> + struct net_lro_desc *tmp;
> + int max_desc = mgr->max_desc;
> + int i;
> +
> + for (i = 0; i < max_desc; i++) {
> + tmp = &lro_arr[i];
> + if (tmp->active)
> + if (!lro_check_tcp_conn(tmp, iph, tcph)) {
> + lro_desc = tmp;
> + goto out;
> + }
> + }
Ugh... What about tree structure or hash here?
> + for (i = 0; i < max_desc; i++) {
> + if(!lro_arr[i].active) {
> + lro_desc = &lro_arr[i];
> + goto out;
> + }
> + }
> +
> +out:
> + return lro_desc;
> +}
> +int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
> + struct vlan_group *vgrp, u16 vlan_tag, void *priv)
> +{
> + struct net_lro_desc *lro_desc;
> + struct iphdr *iph;
> + struct tcphdr *tcph;
> +
> + if (!lro_mgr->get_ip_tcp_hdr
> + || lro_mgr->get_ip_tcp_hdr(skb, &iph, &tcph, priv))
> + goto out;
> +
> + lro_desc = lro_get_desc(lro_mgr, lro_mgr->lro_arr, iph, tcph);
> + if (!lro_desc)
> + goto out;
There is no protection of the descriptor array from accessing from
different CPUs. Is it forbidden to share net_lro_mgr structure?
--
Evgeniy Polyakov
^ permalink raw reply
* RE: [PATCH 2/4] Add dma sector to mpc8641hpcn board dts
From: Zhang Wei-r63237 @ 2007-07-12 9:51 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, paulus
In-Reply-To: <1460BC39-B1B7-4025-9D4C-368FB473A260@kernel.crashing.org>
=20
> -----Original Message-----
> From: Segher Boessenkool [mailto:segher@kernel.crashing.org]=20
>=20
> >>> + dma@21000{
> >>> + compatible =3D "fsl,mpc8xxx-dma";
> >>
> >> Please use a real name, not this "xxx" stuff.
> >
> > Does the "xxx" seems to be an evil name? :-)
>=20
> You are stating this particular device is compatible to
> the "mpc8xxx-dma" device, which doesn't exist. If it is
> supposed to mean it is compatible to the DMA controller
> on any 8000-series device, that is incorrect; in the future,
> there might be many such devices with an incompatible DMA
> controller.
>=20
> Just put in some real device model name.
Ok, I'll use the first (or almost) real device model name.=20
>=20
> >>> + reg =3D <21000 100>;
> >>> + ranges =3D <0 21000 1000>;
> >>
> >> These overlap, that can't be right; it is just begging for
> >> trouble.
> >
> > There is no overlap. The 'reg' is used for the register of DMA
> > controller. And the ranges is used for belows channel registers.
>=20
> And 21000..210ff is a subset of 21000..21fff. So there _is_
> overlap.
>=20
All right. Avoid this.
> > Such as ch0@100, reg=3D<100 80>, in fact, the ch0 register address =
is
> > 0x21100.
>=20
> Sure, none of the "reg"s in any of the children overlap the
> parent "reg", but the parent "reg" overlaps the "ranges".
>=20
> >>> + ch0@100{
> >>> + reg =3D <100 80>;
> >>> + extended;
> >>
> >> I think you want a little more detailed property name
> >> than "extended" here?
> >
> > I've explained it in [PATCH 1/4] Add DMA sector to
> > Documentation/powerpc/booting-without-of.txt file.
> > As below:
> > + - extended : Set the DMA channel to work at extended=20
> chain mode.
> > + If not set, the DMA channel will work at basic
> > + chain mode.
>=20
> Sure it's documented, but it would be good if the property
> name itself would say a bit more than just "extended". Property
> names can be 31 characters, there's no need to make short names
> (terse is good, content-free isn't).
>=20
Ok.
Thanks!
Wei.
^ permalink raw reply
* RE: [PATCH 1/4] Add DMA sector to Documentation/powerpc/booting-without-of.txt file.
From: Zhang Wei-r63237 @ 2007-07-12 9:48 UTC (permalink / raw)
To: Segher Boessenkool, Wood Scott-B07421; +Cc: linuxppc-dev, paulus
In-Reply-To: <368E1200-1315-4C24-9876-C92CCF65EFE3@kernel.crashing.org>
=20
> -----Original Message-----
> From: Segher Boessenkool [mailto:segher@kernel.crashing.org]=20
> Sent: Thursday, July 12, 2007 1:54 AM
> To: Wood Scott-B07421
> Cc: Zhang Wei-r63237; linuxppc-dev@ozlabs.org; paulus@samba.org
> Subject: Re: [PATCH 1/4] Add DMA sector to=20
> Documentation/powerpc/booting-without-of.txt file.
>=20
> >>> I'd rather just treat the different DMA channels as independent =20
> >>> devices,
> >>> rather than children of a dma "bus", and change the compatible =20
> >>> name if
> >>> they're not general purpose. There's only one register that's =20
> >>> shared
> >>> among the channels, and it's a superfluous status summary=20
> register.
> >>>
> >> Your and my ideas are both sides of a coin. :-)
> >
> > I think there's a substantive difference between them. =20
> Making each =20
> > channel an independent device makes it easier for other drivers to =20
> > use them.
>=20
> True. If the DMA channels are independent enough, putting them
> in nodes of their own isn't too cumbersome, either.
>=20
>=20
If you want to use DMA engine driver for the reserved channel, you
should add it to dma-controller node and assign 'reserved'.
If you don't want to use DMA engine driver, just remove it from
dma-controller node and put the channel to special device node.
Thanks!
Wei.
^ permalink raw reply
* Re: [PATCH] Treat ISI faults as read faults on classic 32-bit PowerPC
From: Johannes Berg @ 2007-07-12 9:47 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <5d56173bee3f9ea0050aa508e7f27cc932af7229.1184104284.git.segher@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 2146 bytes --]
On Wed, 2007-07-11 at 20:18 +0200, Segher Boessenkool wrote:
> Some old software on ppc32 executes from pages it hasn't marked
> executable. Since "classic" hardware doesn't distinguish between
> execute and read accesses, the do_page_fault() code shouldn't
> either. This makes glibc-2.2 work again on such hardware.
>
> Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> ---
> Tested by Scott on 32-bit, glibc-2.2.5 and glibc-2.3.3 (no new
> failures and problem solved), needs confirmation from Johannes
> on his glibc-2.4 "---p" testcase. Could use testing on ppc64
> and BookE too, for good measure.
Acked-by: Johannes Berg <johannes@sipsolutions.net>
I tested this patch and it does fix the problem I was seeing.
> This reverts the previous change and makes the bugfix behave
> more like the arch/ppc code.
> arch/powerpc/mm/fault.c | 14 ++++++++++----
> 1 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 115b25f..5d7add0 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -278,14 +278,17 @@ good_area:
> goto bad_area;
> #endif /* CONFIG_8xx */
>
> +#ifdef CONFIG_PPC64
> if (is_exec) {
> -#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
> /* protection fault */
> if (error_code & DSISR_PROTFAULT)
> goto bad_area;
> if (!(vma->vm_flags & VM_EXEC))
> goto bad_area;
> -#else
> + } else
> + /* A read or write, code continues below... */
> +#elsif defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
> + if (is_exec) {
> pte_t *ptep;
> pmd_t *pmdp;
>
> @@ -310,9 +313,12 @@ good_area:
> }
> pte_unmap_unlock(ptep, ptl);
> }
> + } else
> + /* A read or write, code continues below... */
> #endif
> - /* a write */
> - } else if (is_write) {
> +
> + /* A read or write. Classic PPC32 execute is considered a read. */
> + if (is_write) {
> if (!(vma->vm_flags & VM_WRITE))
> goto bad_area;
> /* a read */
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply
* RE: [PATCH 1/4] Add DMA sector to Documentation/powerpc/booting-without-of.txt file.
From: Zhang Wei-r63237 @ 2007-07-12 9:45 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, paulus
In-Reply-To: <3325F1D3-5C03-492C-B1CE-7626DC791656@kernel.crashing.org>
Hi,=20
> -----Original Message-----
> From: Segher Boessenkool [mailto:segher@kernel.crashing.org]=20
> >> Call it "extended-chain-mode", perhaps?
> >
> > Is it maybe too long?
>=20
> Not really no. It's only 19 characters, and it isn't used
> all over the place, so that should be fine.
Ok,
>=20
> >>> + - reserved : Reserve the DMA channel to device.
> >>
> >> What does this do? Reserve it for what device, and where?
> >> The OS driver?
> >>
> >
> > Yes, it reserve for the special device, which must use the fixed
> > channel. Thus, reserve channels requested by that device.
> >
> > And in the device node of dts file, you can use such as
> > "dma-channel=3D<&dma-ch0>" to reference the below channel:
> >
> > dma-ch0: ch0@100 {
> > ...
> > }
>=20
> Right, so you don't need a "reserved" property, that information
> is in the tree already.
Ok, I'll remove "reserved" description.
>=20
> Alternatively, for ease of use, you could put a "reserved" bitmap
> in the master DMA controller node. I wouldn't make nodes per
> channel anyway, just describe the channels using properties -- that
> takes care of the "reg" vs. "ranges" thing too, etc.
Bitmap for reserved? Not very clear. :(
Thanks!
Wei.
^ permalink raw reply
* Re: [PATCH] do firmware feature fixups after features are initialised
From: Arnd Bergmann @ 2007-07-12 9:36 UTC (permalink / raw)
To: Michael Neuling; +Cc: paulus, linuxppc-dev
In-Reply-To: <27356.1184196225@neuling.org>
On Thursday 12 July 2007, Michael Neuling wrote:
>
> > If I'm understanding this right, the first solution should be something
> > along the lines of the patch below (not tested), which even removes
> > more lines than it adds. It doesn't seem that annoying to me, and it
> > makes sense to assume that the fw_features are set up after returning
> > from the ppc_md probe.
>
> I'm not sure this patch is going to work as the do_feature_fixups isn't
> called any earlier?
Right, my patch still assumes that yours gets removed.
Arnd <><
^ permalink raw reply
* [PATCH/RFT] powerpc: 64-bit irqtrace support
From: Johannes Berg @ 2007-07-11 13:03 UTC (permalink / raw)
To: linuxppc-dev list; +Cc: Paul Mackerras, Christoph Hellwig
This adds irqtrace support to 64-bit powerpc.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
Requires Christoph's stack trace patch.
I'm more confident with this now so I'm taking it out of the ancient
subthread... This version comes with the suggestions from Sergei
incorporated and with my assembly cleanups (and they worked exactly as I
wrote them without testing), I also removed a bogus patch hunk modifying
some 32-bit only code, added a license statement to the new file and
some more minor cleanups.
I'd like to have this tested on some other platforms (especially
iSeries) to make sure it doesn't blow up there and also reviewed by
someone more familiar with the exception handling; maybe some of the
calls don't need to be wrapped.
arch/powerpc/Kconfig | 9 ++++
arch/powerpc/kernel/Makefile | 1
arch/powerpc/kernel/entry_64.S | 21 +++++++++
arch/powerpc/kernel/head_64.S | 44 +++++++++++++++-----
arch/powerpc/kernel/irq.c | 3 -
arch/powerpc/kernel/irqtrace.S | 87 ++++++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/ppc_ksyms.c | 4 -
arch/powerpc/kernel/setup_64.c | 6 ++
include/asm-powerpc/hw_irq.h | 13 +++--
include/asm-powerpc/irqflags.h | 23 +++++-----
include/asm-powerpc/rwsem.h | 38 +++++++++++++----
include/asm-powerpc/spinlock.h | 1
12 files changed, 208 insertions(+), 42 deletions(-)
--- linux-2.6-git.orig/arch/powerpc/Kconfig 2007-07-11 13:44:03.673155498 +0200
+++ linux-2.6-git/arch/powerpc/Kconfig 2007-07-11 13:44:20.171155498 +0200
@@ -38,6 +38,15 @@ config STACKTRACE_SUPPORT
bool
default y
+config TRACE_IRQFLAGS_SUPPORT
+ bool
+ depends on PPC64
+ default y
+
+config LOCKDEP_SUPPORT
+ bool
+ default y
+
config RWSEM_GENERIC_SPINLOCK
bool
--- linux-2.6-git.orig/arch/powerpc/kernel/irq.c 2007-07-11 13:44:03.704155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/irq.c 2007-07-11 14:34:58.718829293 +0200
@@ -114,7 +114,7 @@ static inline void set_soft_enabled(unsi
: : "r" (enable), "i" (offsetof(struct paca_struct, soft_enabled)));
}
-void local_irq_restore(unsigned long en)
+void raw_local_irq_restore(unsigned long en)
{
/*
* get_paca()->soft_enabled = en;
@@ -175,6 +175,7 @@ void local_irq_restore(unsigned long en)
__hard_irq_enable();
}
+EXPORT_SYMBOL(raw_local_irq_restore);
#endif /* CONFIG_PPC64 */
int show_interrupts(struct seq_file *p, void *v)
--- linux-2.6-git.orig/arch/powerpc/kernel/ppc_ksyms.c 2007-07-11 13:44:03.734155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/ppc_ksyms.c 2007-07-11 14:34:44.572829293 +0200
@@ -49,10 +49,6 @@
#include <asm/commproc.h>
#endif
-#ifdef CONFIG_PPC64
-EXPORT_SYMBOL(local_irq_restore);
-#endif
-
#ifdef CONFIG_PPC32
extern void transfer_to_handler(void);
extern void do_IRQ(struct pt_regs *regs);
--- linux-2.6-git.orig/include/asm-powerpc/hw_irq.h 2007-07-11 13:44:03.926155498 +0200
+++ linux-2.6-git/include/asm-powerpc/hw_irq.h 2007-07-11 14:33:56.956829293 +0200
@@ -27,7 +27,7 @@ static inline unsigned long local_get_fl
return flags;
}
-static inline unsigned long local_irq_disable(void)
+static inline unsigned long raw_local_irq_disable(void)
{
unsigned long flags, zero;
@@ -39,14 +39,15 @@ static inline unsigned long local_irq_di
return flags;
}
-extern void local_irq_restore(unsigned long);
+extern void raw_local_irq_restore(unsigned long);
extern void iseries_handle_interrupts(void);
-#define local_irq_enable() local_irq_restore(1)
-#define local_save_flags(flags) ((flags) = local_get_flags())
-#define local_irq_save(flags) ((flags) = local_irq_disable())
+#define raw_local_irq_enable() raw_local_irq_restore(1)
+#define raw_local_save_flags(flags) ((flags) = local_get_flags())
+#define raw_local_irq_save(flags) ((flags) = raw_local_irq_disable())
-#define irqs_disabled() (local_get_flags() == 0)
+#define raw_irqs_disabled() (local_get_flags() == 0)
+#define raw_irqs_disabled_flags(flags) ((flags) == 0)
#define __hard_irq_enable() __mtmsrd(mfmsr() | MSR_EE, 1)
#define __hard_irq_disable() __mtmsrd(mfmsr() & ~MSR_EE, 1)
--- linux-2.6-git.orig/include/asm-powerpc/irqflags.h 2007-07-11 13:44:03.957155498 +0200
+++ linux-2.6-git/include/asm-powerpc/irqflags.h 2007-07-11 14:48:41.372829293 +0200
@@ -2,30 +2,29 @@
* include/asm-powerpc/irqflags.h
*
* IRQ flags handling
- *
- * This file gets included from lowlevel asm headers too, to provide
- * wrapped versions of the local_irq_*() APIs, based on the
- * raw_local_irq_*() macros from the lowlevel headers.
*/
#ifndef _ASM_IRQFLAGS_H
#define _ASM_IRQFLAGS_H
+#ifndef __ASSEMBLY__
/*
* Get definitions for raw_local_save_flags(x), etc.
*/
#include <asm-powerpc/hw_irq.h>
+#else
+#ifdef CONFIG_TRACE_IRQFLAGS
/*
- * Do the CPU's IRQ-state tracing from assembly code. We call a
- * C function, so save all the C-clobbered registers:
+ * Most of the CPU's IRQ-state tracing is done from assembly code; we
+ * have to call a C function so call a wrapper that saves all the
+ * C-clobbered registers.
*/
-#ifdef CONFIG_TRACE_IRQFLAGS
-
-#error No support on PowerPC yet for CONFIG_TRACE_IRQFLAGS
-
+#define TRACE_ENABLE_INTS_WRAPPED bl .powerpc_trace_hardirqs_on
+#define TRACE_DISABLE_INTS_WRAPPED bl .powerpc_trace_hardirqs_off
#else
-# define TRACE_IRQS_ON
-# define TRACE_IRQS_OFF
+#define TRACE_ENABLE_INTS_WRAPPED
+#define TRACE_DISABLE_INTS_WRAPPED
+#endif
#endif
#endif
--- linux-2.6-git.orig/include/asm-powerpc/rwsem.h 2007-07-11 13:44:03.988155498 +0200
+++ linux-2.6-git/include/asm-powerpc/rwsem.h 2007-07-11 14:58:53.821899865 +0200
@@ -1,6 +1,10 @@
#ifndef _ASM_POWERPC_RWSEM_H
#define _ASM_POWERPC_RWSEM_H
+#ifndef _LINUX_RWSEM_H
+#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
+#endif
+
#ifdef __KERNEL__
/*
@@ -28,11 +32,21 @@ struct rw_semaphore {
#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
spinlock_t wait_lock;
struct list_head wait_list;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ struct lockdep_map dep_map;
+#endif
};
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
+#else
+# define __RWSEM_DEP_MAP_INIT(lockname)
+#endif
+
#define __RWSEM_INITIALIZER(name) \
{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \
- LIST_HEAD_INIT((name).wait_list) }
+ LIST_HEAD_INIT((name).wait_list) \
+ __RWSEM_DEP_MAP_INIT(name) }
#define DECLARE_RWSEM(name) \
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -42,12 +56,15 @@ extern struct rw_semaphore *rwsem_down_w
extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
-static inline void init_rwsem(struct rw_semaphore *sem)
-{
- sem->count = RWSEM_UNLOCKED_VALUE;
- spin_lock_init(&sem->wait_lock);
- INIT_LIST_HEAD(&sem->wait_list);
-}
+extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
+ struct lock_class_key *key);
+
+#define init_rwsem(sem) \
+ do { \
+ static struct lock_class_key __key; \
+ \
+ __init_rwsem((sem), #sem, &__key); \
+ } while (0)
/*
* lock for reading
@@ -74,7 +91,7 @@ static inline int __down_read_trylock(st
/*
* lock for writing
*/
-static inline void __down_write(struct rw_semaphore *sem)
+static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
{
int tmp;
@@ -84,6 +101,11 @@ static inline void __down_write(struct r
rwsem_down_write_failed(sem);
}
+static inline void __down_write(struct rw_semaphore *sem)
+{
+ __down_write_nested(sem, 0);
+}
+
static inline int __down_write_trylock(struct rw_semaphore *sem)
{
int tmp;
--- linux-2.6-git.orig/include/asm-powerpc/spinlock.h 2007-07-11 13:44:04.033155498 +0200
+++ linux-2.6-git/include/asm-powerpc/spinlock.h 2007-07-11 13:44:20.182155498 +0200
@@ -19,6 +19,7 @@
*
* (the type definitions are in asm/spinlock_types.h)
*/
+#include <linux/irqflags.h>
#ifdef CONFIG_PPC64
#include <asm/paca.h>
#include <asm/hvcall.h>
--- linux-2.6-git.orig/arch/powerpc/kernel/head_64.S 2007-07-11 13:44:03.768155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/head_64.S 2007-07-11 14:32:20.468829293 +0200
@@ -34,6 +34,7 @@
#include <asm/iseries/lpar_map.h>
#include <asm/thread_info.h>
#include <asm/firmware.h>
+#include <asm/irqflags.h>
#define DO_SOFT_DISABLE
@@ -405,14 +406,15 @@ BEGIN_FW_FTR_SECTION; \
mfmsr r10; \
ori r10,r10,MSR_EE; \
mtmsrd r10,1; \
-END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
+END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES); \
+ TRACE_DISABLE_INTS_WRAPPED
#else
#define DISABLE_INTS \
li r11,0; \
stb r11,PACASOFTIRQEN(r13); \
- stb r11,PACAHARDIRQEN(r13)
-
+ stb r11,PACAHARDIRQEN(r13); \
+ TRACE_DISABLE_INTS_WRAPPED
#endif /* CONFIG_PPC_ISERIES */
#define ENABLE_INTS \
@@ -965,24 +967,35 @@ bad_stack:
*/
fast_exc_return_irq: /* restores irq state too */
ld r3,SOFTE(r1)
- ld r12,_MSR(r1)
+#ifdef CONFIG_TRACE_IRQFLAGS
+ cmpdi r3,0
+ bne 1f
+ stb r3,PACASOFTIRQEN(r13) /* restore paca->soft_enabled */
+ bl .trace_hardirqs_off
+ b 2f
+1:
+ bl .trace_hardirqs_on
+ ld r3,SOFTE(r1)
+#endif
stb r3,PACASOFTIRQEN(r13) /* restore paca->soft_enabled */
+2:
+ ld r12,_MSR(r1)
rldicl r4,r12,49,63 /* get MSR_EE to LSB */
stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
- b 1f
+ b 3f
.globl fast_exception_return
fast_exception_return:
ld r12,_MSR(r1)
-1: ld r11,_NIP(r1)
+3: ld r11,_NIP(r1)
andi. r3,r12,MSR_RI /* check if RI is set */
beq- unrecov_fer
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
andi. r3,r12,MSR_PR
- beq 2f
+ beq 4f
ACCOUNT_CPU_USER_EXIT(r3, r4)
-2:
+4:
#endif
ld r3,_CCR(r1)
@@ -1387,11 +1400,22 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISER
/*
* hash_page couldn't handle it, set soft interrupt enable back
- * to what it was before the trap. Note that .local_irq_restore
+ * to what it was before the trap. Note that .raw_local_irq_restore
* handles any interrupts pending at this point.
*/
ld r3,SOFTE(r1)
- bl .local_irq_restore
+#ifdef CONFIG_TRACE_IRQFLAGS
+ cmpdi r3,0
+ bne 14f
+ bl .raw_local_irq_restore
+ bl .trace_hardirqs_off
+ b 15f
+14:
+ bl .trace_hardirqs_on
+ li r3,1
+#endif
+ bl .raw_local_irq_restore
+15:
b 11f
/* Here we have a page fault that hash_page can't handle. */
--- linux-2.6-git.orig/arch/powerpc/kernel/setup_64.c 2007-07-11 13:44:03.799155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/setup_64.c 2007-07-11 13:44:20.192155498 +0200
@@ -33,6 +33,7 @@
#include <linux/serial_8250.h>
#include <linux/bootmem.h>
#include <linux/pci.h>
+#include <linux/lockdep.h>
#include <asm/io.h>
#include <asm/kdump.h>
#include <asm/prom.h>
@@ -359,6 +360,11 @@ void __init setup_system(void)
&__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
/*
+ * start lockdep
+ */
+ lockdep_init();
+
+ /*
* Unflatten the device-tree passed by prom_init or kexec
*/
unflatten_device_tree();
--- linux-2.6-git.orig/arch/powerpc/kernel/entry_64.S 2007-07-11 13:44:03.830155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/entry_64.S 2007-07-11 14:31:51.903829293 +0200
@@ -29,6 +29,7 @@
#include <asm/cputable.h>
#include <asm/firmware.h>
#include <asm/bug.h>
+#include <asm/irqflags.h>
/*
* System calls.
@@ -88,6 +89,13 @@ system_call_common:
addi r9,r1,STACK_FRAME_OVERHEAD
ld r11,exception_marker@toc(r2)
std r11,-16(r9) /* "regshere" marker */
+#ifdef CONFIG_TRACE_IRQFLAGS
+ bl .trace_hardirqs_on
+ REST_GPR(0,r1)
+ REST_4GPRS(3,r1)
+ REST_2GPRS(7,r1)
+ addi r9,r1,STACK_FRAME_OVERHEAD
+#endif
li r10,1
stb r10,PACASOFTIRQEN(r13)
stb r10,PACAHARDIRQEN(r13)
@@ -491,8 +499,18 @@ BEGIN_FW_FTR_SECTION
4:
END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
#endif
+#ifdef CONFIG_TRACE_IRQFLAGS
+ cmpdi r5,0
+ bne 5f
stb r5,PACASOFTIRQEN(r13)
-
+ bl .trace_hardirqs_off
+ b 6f
+5:
+ bl .trace_hardirqs_on
+ li r5,1
+#endif
+ stb r5,PACASOFTIRQEN(r13)
+6:
/* extract EE bit and use it to restore paca->hard_enabled */
ld r3,_MSR(r1)
rldicl r4,r3,49,63 /* r0 = (r3 >> 15) & 1 */
@@ -560,6 +578,7 @@ do_work:
bne restore
/* here we are preempting the current task */
1:
+ TRACE_ENABLE_INTS_WRAPPED
li r0,1
stb r0,PACASOFTIRQEN(r13)
stb r0,PACAHARDIRQEN(r13)
--- linux-2.6-git.orig/arch/powerpc/kernel/Makefile 2007-07-11 13:44:03.860155498 +0200
+++ linux-2.6-git/arch/powerpc/kernel/Makefile 2007-07-11 13:44:20.196155498 +0200
@@ -62,6 +62,7 @@ obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
+obj-$(CONFIG_TRACE_IRQFLAGS) += irqtrace.o
module-$(CONFIG_PPC64) += module_64.o
obj-$(CONFIG_MODULES) += $(module-y)
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-git/arch/powerpc/kernel/irqtrace.S 2007-07-11 14:43:35.324829293 +0200
@@ -0,0 +1,87 @@
+/*
+ * helpers for irq-trace
+ *
+ * We invoke the hardirq trace functions from various inconvenient
+ * places; these helpers save all callee-saved registers.
+ *
+ * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+
+#ifdef CONFIG_PPC64
+#define ST std
+#define STU stdu
+#define L ld
+#define WSZ 8
+#define FREE 32
+#else
+#error double-check please
+#define ST stw
+#define STU stwu
+#define L lwz
+#define WSZ 4
+#define FREE 16
+#endif
+
+#define STACKSPACE (FREE + 16*WSZ)
+#define SAVE(n) (FREE + n*WSZ)
+
+_GLOBAL(powerpc_trace_hardirqs_on)
+ ST r3, (SAVE(2)-STACKSPACE)(r1)
+ LOAD_REG_IMMEDIATE(r3, .trace_hardirqs_on)
+ b powerpc_trace_hardirqs
+
+_GLOBAL(powerpc_trace_hardirqs_off)
+ ST r3, (SAVE(2)-STACKSPACE)(r1)
+ LOAD_REG_IMMEDIATE(r3, .trace_hardirqs_off)
+
+powerpc_trace_hardirqs:
+ ST r0, (SAVE(0)-STACKSPACE)(r1)
+ mflr r0
+ ST r0, LRSAVE(r1)
+ STU r1, -STACKSPACE(r1)
+ mfctr r0
+ ST r0, SAVE(14)(r1)
+ mtctr r3
+ ST r2, SAVE(1)(r1)
+ ST r4, SAVE(3)(r1)
+ ST r5, SAVE(4)(r1)
+ ST r6, SAVE(5)(r1)
+ ST r7, SAVE(6)(r1)
+ ST r8, SAVE(7)(r1)
+ ST r9, SAVE(8)(r1)
+ ST r10, SAVE(9)(r1)
+ ST r11, SAVE(10)(r1)
+ ST r12, SAVE(11)(r1)
+ ST r13, SAVE(12)(r1)
+ mfcr r0
+ ST r0, SAVE(13)(r1)
+ bctrl
+ L r2, SAVE(1)(r1)
+ L r3, SAVE(2)(r1)
+ L r4, SAVE(3)(r1)
+ L r5, SAVE(4)(r1)
+ L r6, SAVE(5)(r1)
+ L r7, SAVE(6)(r1)
+ L r8, SAVE(7)(r1)
+ L r9, SAVE(8)(r1)
+ L r10, SAVE(9)(r1)
+ L r11, SAVE(10)(r1)
+ L r12, SAVE(11)(r1)
+ L r13, SAVE(12)(r1)
+ L r0, SAVE(13)(r1)
+ mtcr r0
+ L r0, SAVE(14)(r1)
+ mtctr r0
+ L r1, 0(r1)
+ L r0, LRSAVE(r1)
+ mtlr r0
+ L r0, (SAVE(0)-STACKSPACE)(r1)
+ blr
^ permalink raw reply
* Re: [patch 3/6] Add 8548 CDS PCI express controller node and PCI-X device node
From: Kumar Gala @ 2007-07-12 9:00 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <1184228873.27622.11.camel@localhost.localdomain>
On Jul 12, 2007, at 3:27 AM, Zang Roy-r61911 wrote:
> From: Roy Zang <tie-fei.zang@freescale.com>
>
> Add 8548 CDS PCI express controller node and PCI-X device node.
> The current dts file is suitable for 8548 Rev 2.0 board with
> Arcadia 3.1.
> This kind of board combination is the most popular.
>
> Indentify pci, pcie host by compatible property "fsl,mpc85xx-pci"
> and "fsl, mpc85xx-pciex".
>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
> Fix the PCI Express b,c,d, irq sense.
is this the only fix, I've already applied a version of this to my
tree (with the irq sense fix) and just want to make sure there isn't
anything else.
- k
^ permalink raw reply
* PS3 improved video mode autodetection for HDMI/DVI
From: Geert Uytterhoeven @ 2007-07-12 8:40 UTC (permalink / raw)
To: Linux/PPC Development, Cell Broadband Engine OSS Development; +Cc: Ben Collins
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1742 bytes --]
Hi,
As of 8d28c70b27cb70cf01d21aab8e51a6dc43c10d70, Geoff's git tree[*] has
improved support for video mode autodetection on both HDMI and DVI-D(+HDCP)
monitors. By default the kernel will select the `best' videomode for your
monitor, now also including VESA modes (e.g. 1920x1200). You can still override
it with the traditional `video=' kernel command line option.
If you're using a PS3 with a HDMI or DVI-D(+HDCP) monitor, please give it a
try.
If it fails, please add `#define DEBUG' to drivers/ps3/ps3av.c, send me the
`Monitor Info' output in the kernel log (dmesg), and tell me which of the
PS3 video modes (1-13) work and which don't. ps3av has a quirk database for
monitors that advertise non-working modes, so it can probably be fixed.
(BTW, even if autodetect works fine, I always welcome this information)
In case you have a big pile of monitors at your site, you don't have to reboot
to try them all. Just plug in the new monitor and run `ps3videomode -v 0' to
switch to the best resolution of the newly-connected monitor.
Thanks for your feedback!
[*] git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git/
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
^ permalink raw reply
* Re: [patch 3/6] Add 8548 CDS PCI express controller node and PCI-X device node
From: Zang Roy-r61911 @ 2007-07-12 8:27 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <7431AAFD-73B7-4337-94CB-878285D298E3@kernel.crashing.org>
From: Roy Zang <tie-fei.zang@freescale.com>
Add 8548 CDS PCI express controller node and PCI-X device node.
The current dts file is suitable for 8548 Rev 2.0 board with
Arcadia 3.1.
This kind of board combination is the most popular.
Indentify pci, pcie host by compatible property "fsl,mpc85xx-pci"
and "fsl, mpc85xx-pciex".
Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
---
Fix the PCI Express b,c,d, irq sense.
arch/powerpc/boot/dts/mpc8548cds.dts | 156 +++++++++++++++++++++++-----------
1 files changed, 105 insertions(+), 51 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index 9d0b84b..d60821b 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -1,5 +1,5 @@
/*
- * MPC8555 CDS Device Tree Source
+ * MPC8548 CDS Device Tree Source
*
* Copyright 2006 Freescale Semiconductor Inc.
*
@@ -186,67 +186,96 @@
pci1: pci@8000 {
interrupt-map-mask = <1f800 0 0 7>;
interrupt-map = <
+ /* IDSEL 0x4 (PCIX Slot 2) */
+ 02000 0 0 1 &mpic 0 1
+ 02000 0 0 2 &mpic 1 1
+ 02000 0 0 3 &mpic 2 1
+ 02000 0 0 4 &mpic 3 1
+
+ /* IDSEL 0x5 (PCIX Slot 3) */
+ 02800 0 0 1 &mpic 1 1
+ 02800 0 0 2 &mpic 2 1
+ 02800 0 0 3 &mpic 3 1
+ 02800 0 0 4 &mpic 0 1
+
+ /* IDSEL 0x6 (PCIX Slot 4) */
+ 03000 0 0 1 &mpic 2 1
+ 03000 0 0 2 &mpic 3 1
+ 03000 0 0 3 &mpic 0 1
+ 03000 0 0 4 &mpic 1 1
+
+ /* IDSEL 0x8 (PCIX Slot 5) */
+ 04000 0 0 1 &mpic 0 1
+ 04000 0 0 2 &mpic 1 1
+ 04000 0 0 3 &mpic 2 1
+ 04000 0 0 4 &mpic 3 1
+
+ /* IDSEL 0xC (Tsi310 bridge) */
+ 06000 0 0 1 &mpic 0 1
+ 06000 0 0 2 &mpic 1 1
+ 06000 0 0 3 &mpic 2 1
+ 06000 0 0 4 &mpic 3 1
+
+ /* IDSEL 0x14 (Slot 2) */
+ 0a000 0 0 1 &mpic 0 1
+ 0a000 0 0 2 &mpic 1 1
+ 0a000 0 0 3 &mpic 2 1
+ 0a000 0 0 4 &mpic 3 1
+
+ /* IDSEL 0x15 (Slot 3) */
+ 0a800 0 0 1 &mpic 1 1
+ 0a800 0 0 2 &mpic 2 1
+ 0a800 0 0 3 &mpic 3 1
+ 0a800 0 0 4 &mpic 0 1
+
+ /* IDSEL 0x16 (Slot 4) */
+ 0b000 0 0 1 &mpic 2 1
+ 0b000 0 0 2 &mpic 3 1
+ 0b000 0 0 3 &mpic 0 1
+ 0b000 0 0 4 &mpic 1 1
+
+ /* IDSEL 0x18 (Slot 5) */
+ 0c000 0 0 1 &mpic 0 1
+ 0c000 0 0 2 &mpic 1 1
+ 0c000 0 0 3 &mpic 2 1
+ 0c000 0 0 4 &mpic 3 1
+
+ /* IDSEL 0x1C (Tsi310 bridge PCI primary) */
+ 0E000 0 0 1 &mpic 0 1
+ 0E000 0 0 2 &mpic 1 1
+ 0E000 0 0 3 &mpic 2 1
+ 0E000 0 0 4 &mpic 3 1
+
+ /* bus 1 , idsel 0x2 Tsi310 bridge secondary */
+ 11000 0 0 1 &mpic 2 1
+ 11000 0 0 2 &mpic 3 1
+ 11000 0 0 3 &mpic 0 1
+ 11000 0 0 4 &mpic 1 1
+
+ /* VIA chip */
+ 12000 0 0 1 &mpic 0 1
+ 12000 0 0 2 &mpic 1 1
+ 12000 0 0 3 &mpic 2 1
+ 12000 0 0 4 &mpic 3 1>;
- /* IDSEL 0x10 */
- 08000 0 0 1 &mpic 0 1
- 08000 0 0 2 &mpic 1 1
- 08000 0 0 3 &mpic 2 1
- 08000 0 0 4 &mpic 3 1
-
- /* IDSEL 0x11 */
- 08800 0 0 1 &mpic 0 1
- 08800 0 0 2 &mpic 1 1
- 08800 0 0 3 &mpic 2 1
- 08800 0 0 4 &mpic 3 1
-
- /* IDSEL 0x12 (Slot 1) */
- 09000 0 0 1 &mpic 0 1
- 09000 0 0 2 &mpic 1 1
- 09000 0 0 3 &mpic 2 1
- 09000 0 0 4 &mpic 3 1
-
- /* IDSEL 0x13 (Slot 2) */
- 09800 0 0 1 &mpic 1 1
- 09800 0 0 2 &mpic 2 1
- 09800 0 0 3 &mpic 3 1
- 09800 0 0 4 &mpic 0 1
-
- /* IDSEL 0x14 (Slot 3) */
- 0a000 0 0 1 &mpic 2 1
- 0a000 0 0 2 &mpic 3 1
- 0a000 0 0 3 &mpic 0 1
- 0a000 0 0 4 &mpic 1 1
-
- /* IDSEL 0x15 (Slot 4) */
- 0a800 0 0 1 &mpic 3 1
- 0a800 0 0 2 &mpic 0 1
- 0a800 0 0 3 &mpic 1 1
- 0a800 0 0 4 &mpic 2 1
-
- /* Bus 1 (Tundra Bridge) */
- /* IDSEL 0x12 (ISA bridge) */
- 19000 0 0 1 &mpic 0 1
- 19000 0 0 2 &mpic 1 1
- 19000 0 0 3 &mpic 2 1
- 19000 0 0 4 &mpic 3 1>;
interrupt-parent = <&mpic>;
interrupts = <18 2>;
bus-range = <0 0>;
- ranges = <02000000 0 80000000 80000000 0 20000000
- 01000000 0 00000000 e2000000 0 00100000>;
+ ranges = <02000000 0 80000000 80000000 0 10000000
+ 01000000 0 00000000 e2000000 0 00800000>;
clock-frequency = <3f940aa>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <8000 1000>;
- compatible = "85xx";
+ compatible = "fsl,mpc85xx-pci","85xx";
device_type = "pci";
- i8259@19000 {
+ i8259@4 {
clock-frequency = <0>;
interrupt-controller;
device_type = "interrupt-controller";
- reg = <19000 0 0 0 1>;
+ reg = <12000 0 0 0 1>;
#address-cells = <0>;
#interrupt-cells = <2>;
built-in;
@@ -266,17 +295,42 @@
a800 0 0 2 &mpic b 1
a800 0 0 3 &mpic b 1
a800 0 0 4 &mpic b 1>;
+
interrupt-parent = <&mpic>;
interrupts = <19 2>;
bus-range = <0 0>;
- ranges = <02000000 0 a0000000 a0000000 0 20000000
- 01000000 0 00000000 e3000000 0 00100000>;
+ ranges = <02000000 0 90000000 90000000 0 10000000
+ 01000000 0 00000000 e2800000 0 00800000>;
clock-frequency = <3f940aa>;
#interrupt-cells = <1>;
#size-cells = <2>;
#address-cells = <3>;
reg = <9000 1000>;
- compatible = "85xx";
+ compatible = "fsl,mpc85xx-pci","85xx";
+ device_type = "pci";
+ };
+ /* PCI Express */
+ pci@a000 {
+ interrupt-map-mask = <f800 0 0 7>;
+ interrupt-map = <
+
+ /* IDSEL 0x0 (PEX) */
+ 00000 0 0 1 &mpic 0 1
+ 00000 0 0 2 &mpic 1 1
+ 00000 0 0 3 &mpic 2 1
+ 00000 0 0 4 &mpic 3 1>;
+
+ interrupt-parent = <&mpic>;
+ interrupts = <1a 2>;
+ bus-range = <0 ff>;
+ ranges = <02000000 0 a0000000 a0000000 0 20000000
+ 01000000 0 00000000 e3000000 0 08000000>;
+ clock-frequency = <1fca055>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <a000 1000>;
+ compatible = "fsl,mpc86xx-pciex","86xx";
device_type = "pci";
};
--
1.5.1
^ permalink raw reply related
* Re: [PATCH] Fix mpc7448hpc2 tsi108 device_type bug
From: Zang Roy-r61911 @ 2007-07-12 8:17 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list, Paul Mackerras, David Gibson
In-Reply-To: <C0041903-5892-4B77-962E-A5877667BBEE@kernel.crashing.org>
On Thu, 2007-07-12 at 15:39, Kumar Gala wrote:
> On Jul 11, 2007, at 1:39 AM, Zang Roy-r61911 wrote:
>
> > From: Roy Zang <tie-fei.zang@freescale.com>
> >
> > Fix mpc7448hpc2 tsi108 device_type bug.
> > Wrong device type will break the board startup.
> >
> > Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> > ---
> > Please apply this patch. The bug breaks the board
> > startup.
> > Please copy patches about 74xx and tsi bridge
> > to me.
> >
> > arch/powerpc/boot/dts/mpc7448hpc2.dts | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts b/arch/powerpc/
> > boot/dts/mpc7448hpc2.dts
> > index 0e3d314..b9158eb 100644
> > --- a/arch/powerpc/boot/dts/mpc7448hpc2.dts
> > +++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts
> > @@ -45,7 +45,7 @@
> > #address-cells = <1>;
> > #size-cells = <1>;
> > #interrupt-cells = <2>;
> > - device_type = "tsi108-bridge";
> > + device_type = "tsi-bridge";
>
> Is there a reason we don't add:
>
> compatible = "tsi108-bridge";
>
> like the holly dts has?
I noticed it.
Until now, it does not affect the function.
I plan to update the mpc7448hpc2 dts file reflecting tsi109 chip.
I will add the compatible field in that patch.
Please apply this one first.
Roy
^ permalink raw reply
* [PATCH] fix showing xmon help
From: Ishizaki Kou @ 2007-07-12 7:59 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In some configuration, xmon help string is larger than xmon output
buffer. To show whole help string, this patch splits it into 2 parts.
Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---
Index: linux-powerpc-git/arch/powerpc/xmon/xmon.c
===================================================================
RCS file: /home/public/cvs/linux-powerpc-git/arch/powerpc/xmon/xmon.c,v
retrieving revision 1.1.1.7
diff -u -p -r1.1.1.7 xmon.c
--- linux-powerpc-git/arch/powerpc/xmon/xmon.c 11 Jul 2007 02:15:32 -0000 1.1.1.7
+++ linux-powerpc-git/arch/powerpc/xmon/xmon.c 11 Jul 2007 10:08:41 -0000
@@ -182,7 +182,7 @@ extern void xmon_save_regs(struct pt_reg
|| ('A' <= (c) && (c) <= 'Z'))
#define isspace(c) (c == ' ' || c == '\t' || c == 10 || c == 13 || c == 0)
-static char *help_string = "\
+static char *help_string1 = "\
Commands:\n\
b show breakpoints\n\
bd set data breakpoint\n\
@@ -210,7 +210,9 @@ Commands:\n\
md compare two blocks of memory\n\
ml locate a block of memory\n\
mz zero a block of memory\n\
- mi show information about memory allocation\n\
+ mi show information about memory allocation\n"
+;
+static char *help_string2 = "\
p call a procedure\n\
r print registers\n\
s single step\n"
@@ -833,7 +835,8 @@ cmds(struct pt_regs *excp)
mdelay(2000);
return cmd;
case '?':
- printf(help_string);
+ printf(help_string1);
+ printf(help_string2);
break;
case 'b':
bpt_cmds();
^ permalink raw reply
* Re: [patch 3/6] Add 8548 CDS PCI express controller node and PCI-X device node
From: Kumar Gala @ 2007-07-12 7:55 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: Paul Mackerras, linuxppc-dev list
In-Reply-To: <0E17851B-A642-43E2-9A5D-39DFC6F30E77@kernel.crashing.org>
>
>>>> + pci@a000 {
>>>> + interrupt-map-mask = <f800 0 0 7>;
>>>> + interrupt-map = <
>>>> +
>>>> + /* IDSEL 0x0 (PEX) */
>>>> + 00000 0 0 1 &mpic 0 1
>>>> + 00000 0 0 2 &mpic 1 0
>>>> + 00000 0 0 3 &mpic 2 0
>>>> + 00000 0 0 4 &mpic 3 0>;
>>>
>>> Why sense 0 for all but the first entry in this map?
>> Now, only the first entry is used.
>
> Sure, but the other three entries are incorrect. Either
> provide correct entries, or just leave the unused entries
> out of the map; if those three interrupts aren't wired up,
> that is the right thing to do, too.
Yeah these should be sense 1 for irq b, c, d. I'll fix that up when
I apply the patch.
- k
^ permalink raw reply
* Re: [PATCH v2] Allow exec on 32-bit from readable, non-exec pages, with a warning.
From: Kumar Gala @ 2007-07-12 7:40 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <4694F81A.4010708@freescale.com>
On Jul 11, 2007, at 10:32 AM, Scott Wood wrote:
> Segher Boessenkool wrote:
>>> Actually I see no good reason to enforce no-exec at all if we
>>> can't do
>>> it consistently. And if we're not going to enforce it then there is
>>> no point whinging about it.
>>
>>
>> I have a new patch with just this behaviour, Scott is
>> testing it on old glibc (I think it succeeded, need
>> confirmation though),
>
> It worked fine on glibc 2.2.5 and 2.3.3 (the former of which failed
> without the patch).
It sounds like this is a candidate for stable 2.6.22.x as well once
you release the patch.
- k
^ permalink raw reply
* Re: [PATCH] Fix mpc7448hpc2 tsi108 device_type bug
From: Kumar Gala @ 2007-07-12 7:39 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras, David Gibson
In-Reply-To: <1184135957.23157.6.camel@localhost.localdomain>
On Jul 11, 2007, at 1:39 AM, Zang Roy-r61911 wrote:
> From: Roy Zang <tie-fei.zang@freescale.com>
>
> Fix mpc7448hpc2 tsi108 device_type bug.
> Wrong device type will break the board startup.
>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
> Please apply this patch. The bug breaks the board
> startup.
> Please copy patches about 74xx and tsi bridge
> to me.
>
> arch/powerpc/boot/dts/mpc7448hpc2.dts | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/mpc7448hpc2.dts b/arch/powerpc/
> boot/dts/mpc7448hpc2.dts
> index 0e3d314..b9158eb 100644
> --- a/arch/powerpc/boot/dts/mpc7448hpc2.dts
> +++ b/arch/powerpc/boot/dts/mpc7448hpc2.dts
> @@ -45,7 +45,7 @@
> #address-cells = <1>;
> #size-cells = <1>;
> #interrupt-cells = <2>;
> - device_type = "tsi108-bridge";
> + device_type = "tsi-bridge";
Is there a reason we don't add:
compatible = "tsi108-bridge";
like the holly dts has?
- k
> ranges = <00000000 c0000000 00010000>;
> reg = <c0000000 00010000>;
> bus-frequency = <0>;
> --
> 1.5.1
>
>
>
^ permalink raw reply
* Re: [RFC][PATCH 3/8] 4xx MMU
From: Kumar Gala @ 2007-07-12 7:09 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev
In-Reply-To: <200707112256.38312.arnd@arndb.de>
On Jul 11, 2007, at 3:56 PM, Arnd Bergmann wrote:
> On Wednesday 11 July 2007, Josh Boyer wrote:
>> +#elif defined(CONFIG_40x)
>> +/* 40x-style software loaded TLB */
>> +# include <asm/mmu-4xx.h>
>> #elif defined(CONFIG_44x)
>> /* 44x-style software loaded TLB */
>> # include <asm/mmu-44x.h>
>
> If you call it mmu-4xx, shouldn't it be used
> for 44x as well? I would think this either
> should be
>
>> +#elif defined(CONFIG_4xx)
>> +/* 40x-style software loaded TLB */
>> +# include <asm/mmu-4xx.h>
>> -#elif defined(CONFIG_44x)
>> -/* 44x-style software loaded TLB */
>> -# include <asm/mmu-44x.h>
>
> or
>
>> +#elif defined(CONFIG_40x)
>> +/* 40x-style software loaded TLB */
>> +# include <asm/mmu-40x.h>
>> #elif defined(CONFIG_44x)
>> /* 44x-style software loaded TLB */
>> # include <asm/mmu-44x.h>
>
> Is it actually feasible to get to a point where
> you can build a kernel that boots on both
> 40x and 44x, or is it just too different?
I'm guessing its too different since 40x probably has a real mode and
44x doesnt.
However, I agree we should go ahead and rename 4xx to 40x at this
point in arch/powerpc.
- k
^ permalink raw reply
* Re: [PATCH 0/2] Move DTC Technical specs out of b-w-o.txt into DTC Repo
From: Kumar Gala @ 2007-07-12 7:01 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org, Jon Loeliger
In-Reply-To: <1184190325.25384.125.camel@ld0161-tx32>
On Jul 11, 2007, at 4:45 PM, Jon Loeliger wrote:
> Folks,
>
> Here are two patches, one to the kernel, the other to
> the DTC repo, that moves the technical description
> portions of the booting-without-of.txt documentation
> out of the kernel and into the DTC repository.
Why remove it from the kernel? It seems like this part should change
infrequently and it would be good to keep its documentation with the
kernel as well?
- k
^ permalink raw reply
* Re: Tickless Hz/hrtimers/etc. on PowerPC
From: Domen Puncer @ 2007-07-12 6:51 UTC (permalink / raw)
To: Matt Sealey; +Cc: ppc-dev
In-Reply-To: <46951C1A.4080001@genesi-usa.com>
[-- Attachment #1: Type: text/plain, Size: 472 bytes --]
On 11/07/07 19:06 +0100, Matt Sealey wrote:
> Does anyone have the definitive patchset to enable the tickless hz,
> some kind of hrtimer and the other related improvements in the
> PowerPC tree?
I use attached patches for tickless.
Order in which they're applied:
PowerPC_GENERIC_CLOCKEVENTS.patch
PowerPC_GENERIC_TIME.linux-2.6.18-rc6_timeofday-arch-ppc_C6.patch
PowerPC_enable_HRT_and_dynticks_support.patch
PowerPC_no_hz_fix.patch
tickless-enable.patch
HTH
Domen
[-- Attachment #2: PowerPC_GENERIC_CLOCKEVENTS.patch --]
[-- Type: text/plain, Size: 6823 bytes --]
===================================================================
---
arch/powerpc/Kconfig | 12 +++-
arch/powerpc/kernel/time.c | 124 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 134 insertions(+), 2 deletions(-)
Index: work-powerpc.git/arch/powerpc/Kconfig
===================================================================
--- work-powerpc.git.orig/arch/powerpc/Kconfig
+++ work-powerpc.git/arch/powerpc/Kconfig
@@ -347,7 +347,7 @@ config PPC_MM_SLICES
config VIRT_CPU_ACCOUNTING
bool "Deterministic task and CPU time accounting"
- depends on PPC64
+ depends on PPC64 && !GENERIC_CLOCKEVENTS
default y
help
Select this option to enable more accurate task and CPU time
@@ -406,6 +406,16 @@ config HIGHMEM
depends on PPC32
source kernel/Kconfig.hz
+
+config GENERIC_CLOCKEVENTS
+ bool "Clock event devices support"
+ default n
+ help
+ Enable support for the clock event devices necessary for the
+ high-resolution timers and the tickless system support.
+ NOTE: This is not compatible with the deterministic time accounting
+ option on PPC64.
+
source kernel/Kconfig.preempt
source "fs/Kconfig.binfmt"
Index: work-powerpc.git/arch/powerpc/kernel/time.c
===================================================================
--- work-powerpc.git.orig/arch/powerpc/kernel/time.c
+++ work-powerpc.git/arch/powerpc/kernel/time.c
@@ -52,6 +52,7 @@
#include <linux/jiffies.h>
#include <linux/posix-timers.h>
#include <linux/irq.h>
+#include <linux/clockchips.h>
#include <asm/io.h>
#include <asm/processor.h>
@@ -127,6 +128,83 @@ unsigned long ppc_tb_freq;
static u64 tb_last_jiffy __cacheline_aligned_in_smp;
static DEFINE_PER_CPU(u64, last_jiffy);
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#define DECREMENTER_MAX 0xffffffff
+#else
+#define DECREMENTER_MAX 0x7fffffff /* setting MSB triggers an interrupt */
+#endif
+
+static int decrementer_set_next_event(unsigned long evt,
+ struct clock_event_device *dev)
+{
+#if defined(CONFIG_40x)
+ mtspr(SPRN_PIT, evt); /* 40x has a hidden PIT auto-reload register */
+#elif defined(CONFIG_BOOKE)
+ mtspr(SPRN_DECAR, evt); /* Book E has separate auto-reload register */
+ set_dec(evt);
+#else
+ set_dec(evt - 1); /* Classic decrementer interrupts at -1 */
+#endif
+ return 0;
+}
+
+static void decrementer_set_mode(enum clock_event_mode mode,
+ struct clock_event_device *dev)
+{
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+ u32 tcr = mfspr(SPRN_TCR);
+
+ tcr |= TCR_DIE;
+ switch (mode) {
+ case CLOCK_EVT_MODE_PERIODIC:
+ tcr |= TCR_ARE;
+ break;
+ case CLOCK_EVT_MODE_ONESHOT:
+ tcr &= ~TCR_ARE;
+ break;
+ case CLOCK_EVT_MODE_UNUSED:
+ case CLOCK_EVT_MODE_SHUTDOWN:
+ tcr &= ~TCR_DIE;
+ break;
+ }
+ mtspr(SPRN_TCR, tcr);
+#endif
+ if (mode == CLOCK_EVT_MODE_PERIODIC)
+ decrementer_set_next_event(tb_ticks_per_jiffy, dev);
+}
+
+static struct clock_event_device decrementer_clockevent = {
+ .name = "decrementer",
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+ .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
+#else
+ .features = CLOCK_EVT_FEAT_ONESHOT,
+#endif
+ .shift = 32,
+ .rating = 200,
+ .irq = -1,
+ .set_next_event = decrementer_set_next_event,
+ .set_mode = decrementer_set_mode,
+};
+
+static DEFINE_PER_CPU(struct clock_event_device, decrementers);
+
+static void register_decrementer(void)
+{
+ int cpu = smp_processor_id();
+ struct clock_event_device *decrementer = &per_cpu(decrementers, cpu);
+
+ memcpy(decrementer, &decrementer_clockevent, sizeof(*decrementer));
+
+ decrementer->cpumask = cpumask_of_cpu(cpu);
+
+ clockevents_register_device(decrementer);
+}
+
+#endif /* CONFIG_GENERIC_CLOCKEVENTS */
+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
/*
* Factors for converting from cputime_t (timebase ticks) to
@@ -312,6 +390,9 @@ void snapshot_timebase(void)
{
__get_cpu_var(last_jiffy) = get_tb();
snapshot_purr();
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+ register_decrementer();
+#endif
}
void __delay(unsigned long loops)
@@ -627,7 +708,31 @@ void timer_interrupt(struct pt_regs * re
old_regs = set_irq_regs(regs);
irq_enter();
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+#ifdef CONFIG_PPC_MULTIPLATFORM
+ /*
+ * We must write a positive value to the decrementer to clear
+ * the interrupt on the IBM 970 CPU series. In periodic mode,
+ * this happens when the decrementer gets reloaded later, but
+ * in one-shot mode, we have to do it here since an event handler
+ * may skip loading the new value...
+ */
+ if (per_cpu(decrementers, cpu).mode != CLOCK_EVT_MODE_PERIODIC)
+ set_dec(DECREMENTER_MAX);
+#endif
+ /*
+ * We can't disable the decrementer, so in the period between
+ * CPU being marked offline and calling stop-self, it's taking
+ * timer interrupts...
+ */
+ if (!cpu_is_offline(cpu)) {
+ struct clock_event_device *dev = &per_cpu(decrementers, cpu);
+
+ dev->event_handler(dev);
+ }
+#else
profile_tick(CPU_PROFILING);
+#endif
calculate_steal_time();
#ifdef CONFIG_PPC_ISERIES
@@ -643,6 +748,7 @@ void timer_interrupt(struct pt_regs * re
if (__USE_RTC() && per_cpu(last_jiffy, cpu) >= 1000000000)
per_cpu(last_jiffy, cpu) -= 1000000000;
+#ifndef CONFIG_GENERIC_CLOCKEVENTS
/*
* We cannot disable the decrementer, so in the period
* between this cpu's being marked offline in cpu_online_map
@@ -652,6 +758,7 @@ void timer_interrupt(struct pt_regs * re
*/
if (!cpu_is_offline(cpu))
account_process_time(regs);
+#endif
/*
* No need to check whether cpu is offline here; boot_cpuid
@@ -664,15 +771,19 @@ void timer_interrupt(struct pt_regs * re
tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
tb_last_jiffy = tb_next_jiffy;
+#ifndef CONFIG_GENERIC_CLOCKEVENTS
do_timer(1);
+#endif
timer_recalc_offset(tb_last_jiffy);
timer_check_rtc();
}
write_sequnlock(&xtime_lock);
}
-
+
+#ifndef CONFIG_GENERIC_CLOCKEVENTS
next_dec = tb_ticks_per_jiffy - ticks;
set_dec(next_dec);
+#endif
#ifdef CONFIG_PPC_ISERIES
if (firmware_has_feature(FW_FEATURE_ISERIES) && hvlpevent_is_pending())
@@ -996,8 +1107,19 @@ void __init time_init(void)
-xtime.tv_sec, -xtime.tv_nsec);
write_sequnlock_irqrestore(&xtime_lock, flags);
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+ decrementer_clockevent.mult = div_sc(ppc_tb_freq, NSEC_PER_SEC,
+ decrementer_clockevent.shift);
+ decrementer_clockevent.max_delta_ns =
+ clockevent_delta2ns(DECREMENTER_MAX, &decrementer_clockevent);
+ decrementer_clockevent.min_delta_ns =
+ clockevent_delta2ns(0xf, &decrementer_clockevent);
+
+ register_decrementer();
+#else
/* Not exact, but the timer interrupt takes care of this */
set_dec(tb_ticks_per_jiffy);
+#endif
}
[-- Attachment #3: PowerPC_GENERIC_TIME.linux-2.6.18-rc6_timeofday-arch-ppc_C6.patch --]
[-- Type: text/plain, Size: 10567 bytes --]
Early pass on powerpc conversion to generic timekeeping.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
arch/powerpc/Kconfig | 4
arch/powerpc/kernel/time.c | 278 +++++----------------------------------------
2 files changed, 37 insertions(+), 245 deletions(-)
linux-2.6.18-rc6_timeofday-arch-ppc_C6.patch
============================================
Index: work-powerpc.git/arch/powerpc/Kconfig
===================================================================
--- work-powerpc.git.orig/arch/powerpc/Kconfig
+++ work-powerpc.git/arch/powerpc/Kconfig
@@ -31,6 +31,10 @@ config MMU
bool
default y
+config GENERIC_TIME
+ bool
+ default y
+
config GENERIC_HARDIRQS
bool
default y
Index: work-powerpc.git/arch/powerpc/kernel/time.c
===================================================================
--- work-powerpc.git.orig/arch/powerpc/kernel/time.c
+++ work-powerpc.git/arch/powerpc/kernel/time.c
@@ -117,8 +117,6 @@ EXPORT_SYMBOL_GPL(rtc_lock);
u64 tb_to_ns_scale;
unsigned tb_to_ns_shift;
-struct gettimeofday_struct do_gtod;
-
extern struct timezone sys_tz;
static long timezone_offset;
@@ -456,160 +454,6 @@ static __inline__ void timer_check_rtc(v
}
}
-/*
- * This version of gettimeofday has microsecond resolution.
- */
-static inline void __do_gettimeofday(struct timeval *tv)
-{
- unsigned long sec, usec;
- u64 tb_ticks, xsec;
- struct gettimeofday_vars *temp_varp;
- u64 temp_tb_to_xs, temp_stamp_xsec;
-
- /*
- * These calculations are faster (gets rid of divides)
- * if done in units of 1/2^20 rather than microseconds.
- * The conversion to microseconds at the end is done
- * without a divide (and in fact, without a multiply)
- */
- temp_varp = do_gtod.varp;
-
- /* Sampling the time base must be done after loading
- * do_gtod.varp in order to avoid racing with update_gtod.
- */
- data_barrier(temp_varp);
- tb_ticks = get_tb() - temp_varp->tb_orig_stamp;
- temp_tb_to_xs = temp_varp->tb_to_xs;
- temp_stamp_xsec = temp_varp->stamp_xsec;
- xsec = temp_stamp_xsec + mulhdu(tb_ticks, temp_tb_to_xs);
- sec = xsec / XSEC_PER_SEC;
- usec = (unsigned long)xsec & (XSEC_PER_SEC - 1);
- usec = SCALE_XSEC(usec, 1000000);
-
- tv->tv_sec = sec;
- tv->tv_usec = usec;
-}
-
-void do_gettimeofday(struct timeval *tv)
-{
- if (__USE_RTC()) {
- /* do this the old way */
- unsigned long flags, seq;
- unsigned int sec, nsec, usec;
-
- do {
- seq = read_seqbegin_irqsave(&xtime_lock, flags);
- sec = xtime.tv_sec;
- nsec = xtime.tv_nsec + tb_ticks_since(tb_last_jiffy);
- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
- usec = nsec / 1000;
- while (usec >= 1000000) {
- usec -= 1000000;
- ++sec;
- }
- tv->tv_sec = sec;
- tv->tv_usec = usec;
- return;
- }
- __do_gettimeofday(tv);
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-/*
- * There are two copies of tb_to_xs and stamp_xsec so that no
- * lock is needed to access and use these values in
- * do_gettimeofday. We alternate the copies and as long as a
- * reasonable time elapses between changes, there will never
- * be inconsistent values. ntpd has a minimum of one minute
- * between updates.
- */
-static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
- u64 new_tb_to_xs)
-{
- unsigned temp_idx;
- struct gettimeofday_vars *temp_varp;
-
- temp_idx = (do_gtod.var_idx == 0);
- temp_varp = &do_gtod.vars[temp_idx];
-
- temp_varp->tb_to_xs = new_tb_to_xs;
- temp_varp->tb_orig_stamp = new_tb_stamp;
- temp_varp->stamp_xsec = new_stamp_xsec;
- smp_mb();
- do_gtod.varp = temp_varp;
- do_gtod.var_idx = temp_idx;
-
- /*
- * tb_update_count is used to allow the userspace gettimeofday code
- * to assure itself that it sees a consistent view of the tb_to_xs and
- * stamp_xsec variables. It reads the tb_update_count, then reads
- * tb_to_xs and stamp_xsec and then reads tb_update_count again. If
- * the two values of tb_update_count match and are even then the
- * tb_to_xs and stamp_xsec values are consistent. If not, then it
- * loops back and reads them again until this criteria is met.
- * We expect the caller to have done the first increment of
- * vdso_data->tb_update_count already.
- */
- vdso_data->tb_orig_stamp = new_tb_stamp;
- vdso_data->stamp_xsec = new_stamp_xsec;
- vdso_data->tb_to_xs = new_tb_to_xs;
- vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
- vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
- smp_wmb();
- ++(vdso_data->tb_update_count);
-}
-
-/*
- * When the timebase - tb_orig_stamp gets too big, we do a manipulation
- * between tb_orig_stamp and stamp_xsec. The goal here is to keep the
- * difference tb - tb_orig_stamp small enough to always fit inside a
- * 32 bits number. This is a requirement of our fast 32 bits userland
- * implementation in the vdso. If we "miss" a call to this function
- * (interrupt latency, CPU locked in a spinlock, ...) and we end up
- * with a too big difference, then the vdso will fallback to calling
- * the syscall
- */
-static __inline__ void timer_recalc_offset(u64 cur_tb)
-{
- unsigned long offset;
- u64 new_stamp_xsec;
- u64 tlen, t2x;
- u64 tb, xsec_old, xsec_new;
- struct gettimeofday_vars *varp;
-
- if (__USE_RTC())
- return;
- tlen = current_tick_length();
- offset = cur_tb - do_gtod.varp->tb_orig_stamp;
- if (tlen == last_tick_len && offset < 0x80000000u)
- return;
- if (tlen != last_tick_len) {
- t2x = mulhdu(tlen << TICKLEN_SHIFT, ticklen_to_xs);
- last_tick_len = tlen;
- } else
- t2x = do_gtod.varp->tb_to_xs;
- new_stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC;
- do_div(new_stamp_xsec, 1000000000);
- new_stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC;
-
- ++vdso_data->tb_update_count;
- smp_mb();
-
- /*
- * Make sure time doesn't go backwards for userspace gettimeofday.
- */
- tb = get_tb();
- varp = do_gtod.varp;
- xsec_old = mulhdu(tb - varp->tb_orig_stamp, varp->tb_to_xs)
- + varp->stamp_xsec;
- xsec_new = mulhdu(tb - cur_tb, t2x) + new_stamp_xsec;
- if (xsec_new < xsec_old)
- new_stamp_xsec += xsec_old - xsec_new;
-
- update_gtod(cur_tb, new_stamp_xsec, t2x);
-}
-
#ifdef CONFIG_SMP
unsigned long profile_pc(struct pt_regs *regs)
{
@@ -659,11 +503,7 @@ static void iSeries_tb_recal(void)
tb_ticks_per_sec = new_tb_ticks_per_sec;
calc_cputime_factors();
div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres );
- do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
tb_to_xs = divres.result_low;
- do_gtod.varp->tb_to_xs = tb_to_xs;
- vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
- vdso_data->tb_to_xs = tb_to_xs;
}
else {
printk( "Titan recalibrate: FAILED (difference > 4 percent)\n"
@@ -849,76 +689,6 @@ unsigned long long sched_clock(void)
return mulhdu(get_tb(), tb_to_ns_scale) << tb_to_ns_shift;
}
-int do_settimeofday(struct timespec *tv)
-{
- time_t wtm_sec, new_sec = tv->tv_sec;
- long wtm_nsec, new_nsec = tv->tv_nsec;
- unsigned long flags;
- u64 new_xsec;
- unsigned long tb_delta;
-
- if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
- return -EINVAL;
-
- write_seqlock_irqsave(&xtime_lock, flags);
-
- /*
- * Updating the RTC is not the job of this code. If the time is
- * stepped under NTP, the RTC will be updated after STA_UNSYNC
- * is cleared. Tools like clock/hwclock either copy the RTC
- * to the system time, in which case there is no point in writing
- * to the RTC again, or write to the RTC but then they don't call
- * settimeofday to perform this operation.
- */
-#ifdef CONFIG_PPC_ISERIES
- if (firmware_has_feature(FW_FEATURE_ISERIES) && first_settimeofday) {
- iSeries_tb_recal();
- first_settimeofday = 0;
- }
-#endif
-
- /* Make userspace gettimeofday spin until we're done. */
- ++vdso_data->tb_update_count;
- smp_mb();
-
- /*
- * Subtract off the number of nanoseconds since the
- * beginning of the last tick.
- */
- tb_delta = tb_ticks_since(tb_last_jiffy);
- tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */
- new_nsec -= SCALE_XSEC(tb_delta, 1000000000);
-
- wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - new_sec);
- wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - new_nsec);
-
- set_normalized_timespec(&xtime, new_sec, new_nsec);
- set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
-
- /* In case of a large backwards jump in time with NTP, we want the
- * clock to be updated as soon as the PLL is again in lock.
- */
- last_rtc_update = new_sec - 658;
-
- ntp_clear();
-
- new_xsec = xtime.tv_nsec;
- if (new_xsec != 0) {
- new_xsec *= XSEC_PER_SEC;
- do_div(new_xsec, NSEC_PER_SEC);
- }
- new_xsec += (u64)xtime.tv_sec * XSEC_PER_SEC;
- update_gtod(tb_last_jiffy, new_xsec, do_gtod.varp->tb_to_xs);
-
- vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
- vdso_data->tz_dsttime = sys_tz.tz_dsttime;
-
- write_sequnlock_irqrestore(&xtime_lock, flags);
- clock_was_set();
- return 0;
-}
-
-EXPORT_SYMBOL(do_settimeofday);
static int __init get_freq(char *name, int cells, unsigned long *val)
{
@@ -1085,20 +855,6 @@ void __init time_init(void)
xtime.tv_sec = tm;
xtime.tv_nsec = 0;
- do_gtod.varp = &do_gtod.vars[0];
- do_gtod.var_idx = 0;
- do_gtod.varp->tb_orig_stamp = tb_last_jiffy;
- __get_cpu_var(last_jiffy) = tb_last_jiffy;
- do_gtod.varp->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
- do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
- do_gtod.varp->tb_to_xs = tb_to_xs;
- do_gtod.tb_to_us = tb_to_us;
-
- vdso_data->tb_orig_stamp = tb_last_jiffy;
- vdso_data->tb_update_count = 0;
- vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
- vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
- vdso_data->tb_to_xs = tb_to_xs;
time_freq = 0;
@@ -1122,7 +878,6 @@ void __init time_init(void)
#endif
}
-
#define FEBRUARY 2
#define STARTOFTIME 1970
#define SECDAY 86400L
@@ -1267,3 +1022,36 @@ void div128_by_32(u64 dividend_high, u64
dr->result_low = ((u64)y << 32) + z;
}
+
+
+/* powerpc clocksource code */
+
+#include <linux/clocksource.h>
+static cycle_t timebase_read(void)
+{
+ return (cycle_t)get_tb();
+}
+
+struct clocksource clocksource_timebase = {
+ .name = "timebase",
+ .rating = 200,
+ .read = timebase_read,
+ .mask = (cycle_t)-1,
+ .mult = 0,
+ .shift = 22,
+};
+
+
+/* XXX - this should be calculated or properly externed! */
+static int __init init_timebase_clocksource(void)
+{
+ if (__USE_RTC())
+ return -ENODEV;
+
+ clocksource_timebase.mult = clocksource_hz2mult(tb_ticks_per_sec,
+ clocksource_timebase.shift);
+ return clocksource_register(&clocksource_timebase);
+}
+
+module_init(init_timebase_clocksource);
+
[-- Attachment #4: PowerPC_enable_HRT_and_dynticks_support.patch --]
[-- Type: text/plain, Size: 1350 bytes --]
---
arch/powerpc/Kconfig | 1 +
arch/powerpc/kernel/idle.c | 3 +++
2 files changed, 4 insertions(+)
Index: work-powerpc.git/arch/powerpc/Kconfig
===================================================================
--- work-powerpc.git.orig/arch/powerpc/Kconfig
+++ work-powerpc.git/arch/powerpc/Kconfig
@@ -416,6 +416,7 @@ config GENERIC_CLOCKEVENTS
NOTE: This is not compatible with the deterministic time accounting
option on PPC64.
+source kernel/time/Kconfig
source kernel/Kconfig.preempt
source "fs/Kconfig.binfmt"
Index: work-powerpc.git/arch/powerpc/kernel/idle.c
===================================================================
--- work-powerpc.git.orig/arch/powerpc/kernel/idle.c
+++ work-powerpc.git/arch/powerpc/kernel/idle.c
@@ -24,6 +24,7 @@
#include <linux/smp.h>
#include <linux/cpu.h>
#include <linux/sysctl.h>
+#include <linux/tick.h>
#include <asm/system.h>
#include <asm/processor.h>
@@ -59,6 +60,7 @@ void cpu_idle(void)
set_thread_flag(TIF_POLLING_NRFLAG);
while (1) {
+ tick_nohz_stop_sched_tick();
while (!need_resched() && !cpu_should_die()) {
ppc64_runlatch_off();
@@ -92,6 +94,7 @@ void cpu_idle(void)
ppc64_runlatch_on();
if (cpu_should_die())
cpu_die();
+ tick_nohz_restart_sched_tick();
preempt_enable_no_resched();
schedule();
preempt_disable();
[-- Attachment #5: PowerPC_no_hz_fix.patch --]
[-- Type: text/plain, Size: 577 bytes --]
---
arch/powerpc/kernel/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: work-powerpc.git/arch/powerpc/kernel/time.c
===================================================================
--- work-powerpc.git.orig/arch/powerpc/kernel/time.c
+++ work-powerpc.git/arch/powerpc/kernel/time.c
@@ -614,7 +614,7 @@ void timer_interrupt(struct pt_regs * re
#ifndef CONFIG_GENERIC_CLOCKEVENTS
do_timer(1);
#endif
- timer_recalc_offset(tb_last_jiffy);
+ /*timer_recalc_offset(tb_last_jiffy);*/
timer_check_rtc();
}
write_sequnlock(&xtime_lock);
[-- Attachment #6: tickless-enable.patch --]
[-- Type: text/plain, Size: 701 bytes --]
This is needed for hrtimer_switch_to_hres() to get called.
hrtimer_run_queues()
|-tick_check_oneshot_change()
| \-timekeeping_is_continuous()
| \- flags check
\-hrtimer_switch_to_hres()
Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
---
arch/powerpc/kernel/time.c | 1 +
1 file changed, 1 insertion(+)
Index: work-powerpc.git/arch/powerpc/kernel/time.c
===================================================================
--- work-powerpc.git.orig/arch/powerpc/kernel/time.c
+++ work-powerpc.git/arch/powerpc/kernel/time.c
@@ -1039,6 +1039,7 @@ struct clocksource clocksource_timebase
.mask = (cycle_t)-1,
.mult = 0,
.shift = 22,
+ .flags = CLOCK_SOURCE_VALID_FOR_HRES,
};
^ permalink raw reply
* Re: Tickless Hz/hrtimers/etc. on PowerPC
From: Tony Breeds @ 2007-07-12 6:41 UTC (permalink / raw)
To: Matt Sealey; +Cc: ppc-dev, Michael Neuling
In-Reply-To: <46955674.9090304@genesi-usa.com>
On Wed, Jul 11, 2007 at 11:15:16PM +0100, Matt Sealey wrote:
> And I don't want to run -rt or wireless-dev for the benefit of a single
> feature. What I am after is something like Ingo Molnar throws out..
> single patches done the old way, not git trees. It's so much easier to
> handle and integrate for example into a Gentoo ebuild or to make a
> tarball of accumulated patches from a certain release kernel.
Hi Matt,
In the near future I will have something that I can pass around
for review. Which will be a quilt series of about 5 patches (based on
mainline). I'll make sure to include you in the reviewers list. At
this stage I'd hope they'll be in 2.6.24.
I have HRT in a state where you can enable it and it works, but NO_HZ
isn't quite right yet.
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
^ permalink raw reply
* RE: [PATCH 3/4] Extend the DMA-engine API.
From: Zhang Wei-r63237 @ 2007-07-12 6:31 UTC (permalink / raw)
To: Dan Williams; +Cc: shannon.nelson, linux-kernel, linuxppc-dev, paulus, akpm
In-Reply-To: <e9c3a7c20707110956r5ea91fd1q1d0b33b9583fe91c@mail.gmail.com>
Hi, Dan,
Thanks! I get it.
It's so lucky we have the same target.
When your patch could be accepted?
Cheers,
Wei.=20
> -----Original Message-----
> From: dan.j.williams@gmail.com=20
> [mailto:dan.j.williams@gmail.com] On Behalf Of Dan Williams
> Sent: Thursday, July 12, 2007 12:57 AM
> To: Zhang Wei-r63237
> Cc: akpm@linux-foundation.org; paulus@samba.org;=20
> galak@kernel.crashing.org; linuxppc-dev@ozlabs.org;=20
> linux-kernel@vger.kernel.org; shannon.nelson@intel.com
> Subject: Re: [PATCH 3/4] Extend the DMA-engine API.
>=20
> On 7/11/07, Zhang Wei-r63237 <Wei.Zhang@freescale.com> wrote:
> > Hi, Dan,
> >
> > Do you mention here:=20
> http://marc.info/?l=3Dlinux-raid&m=3D118290909614463&w=3D2 ?
> > I see the async_tx is located at crypto/ of the above page,=20
> but my patch is for DMA engine in drivers/dma and for DMA=20
> engine driver.
> >
> > Thanks!
> > Wei.
>=20
> Hi Wei,
>=20
> I was referring to:
> http://marc.info/?l=3Dlinux-raid&m=3D118290909528910&w=3D2
>=20
> async_tx is an api that exploits the raw capabilities of the new
> dmaengine interface. For your case when the existing api calls do not
> provide the proper interface you can open code something like the
> following:
>=20
> tx =3D dev->device_prep_dma_<operation>(chan, len, int_flag)
> tx->tx_set_src(dma_addr_t, tx, index /* for multi-source ops */)
> tx->tx_set_dest(dma_addr_t, tx, index)
> tx->tx_submit(tx)
>=20
> The expectation is that the most common usages of dmaengines will use
> async_tx calls, or the 'dma_async_memcpy_foo_to_bar' helper routines.
>=20
> --
> Dan
>=20
^ permalink raw reply
* [PATCH] [POWERPC] of_detach_node now modifies its argument
From: Stephen Rothwell @ 2007-07-12 6:21 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
Commit 6a281856c02d2291df2f7d9df5bfdee2e7bdd747 modified of_detach_node
so that it now sets a flag in the passed device_node. Remove the const
from the parameter to get rid of this warning:
arch/powerpc/kernel/prom.c: In function 'of_detach_node':
arch/powerpc/kernel/prom.c:1468: warning: passing argument 1 of 'of_node_set_flag' discards qualifiers from pointer target type
The only caller was already passing a non-const device_node.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/prom.c | 2 +-
include/asm-powerpc/prom.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Paul, another for 2.6.23.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 37ff99b..67a1bda 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1433,7 +1433,7 @@ void of_attach_node(struct device_node *np)
* a reference to the node. The memory associated with the node
* is not freed until its refcount goes to zero.
*/
-void of_detach_node(const struct device_node *np)
+void of_detach_node(struct device_node *np)
{
struct device_node *parent;
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 1632baa..1bba741 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -160,7 +160,7 @@ extern unsigned long __init of_get_flat_dt_root(void);
/* For updating the device tree at runtime */
extern void of_attach_node(struct device_node *);
-extern void of_detach_node(const struct device_node *);
+extern void of_detach_node(struct device_node *);
/* Other Prototypes */
extern void finish_device_tree(void);
^ permalink raw reply related
* Re: [PATCH 1/2] Kernel: Move all technical descriptons of the Device Tree Complier
From: Paul Mackerras @ 2007-07-12 3:42 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org, Jon Loeliger
In-Reply-To: <1184190359.25384.129.camel@ld0161-tx32>
Jon Loeliger writes:
> and its formats, command lines, descriptions, etc,
> over to the Device Tree Compiler repositories now.
Hrm, section II (DT block format) is a description of a kernel
interface, and I think it should stay. After all, there's nothing
that says that you have to use dtc to generate the device tree blob,
so there is no reason for the dtc source to be the only place where
the format is specified.
I have no problem with that section being copied over to the dtc
source.
I also don't mind section IV being removed, although a sentence saying
that dtc is useful for generating dtbs, and where to find dtc, would
be useful.
Paul.
^ permalink raw reply
* Re: [PATCH 5/5] Add dcr_map_reg() helper
From: Benjamin Herrenschmidt @ 2007-07-12 0:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <4c7183d665eed57f8ef2067c1f2c71b3c0e5246c.1182493056.git.michael@ellerman.id.au>
On Fri, 2007-06-22 at 16:18 +1000, Michael Ellerman wrote:
> Add a helper routine to map dcr's based on the "dcr-reg" property of
> a device node.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> arch/powerpc/sysdev/dcr.c | 17 +++++++++++++++++
> include/asm-powerpc/dcr.h | 1 +
> 2 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
> index f3c5646..da2ac7c 100644
> --- a/arch/powerpc/sysdev/dcr.c
> +++ b/arch/powerpc/sysdev/dcr.c
> @@ -123,6 +123,23 @@ dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
> return ret;
> }
>
> +dcr_host_t dcr_map_reg(struct device_node *dev, unsigned int index)
> +{
> + dcr_host_t ret = { .token = NULL };
> +
> + unsigned int dcr_n, dcr_c;
> +
> + dcr_n = dcr_resource_start(dev, index);
> + if (!dcr_n)
> + return ret;
> +
> + dcr_c = dcr_resource_len(dev, index);
> + if (!dcr_c)
> + return ret;
> +
> + return dcr_map(dev, dcr_n, dcr_c);
> +}
> +
> void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c)
> {
> dcr_host_t h = host;
> diff --git a/include/asm-powerpc/dcr.h b/include/asm-powerpc/dcr.h
> index 9338d50..4d42f01 100644
> --- a/include/asm-powerpc/dcr.h
> +++ b/include/asm-powerpc/dcr.h
> @@ -38,6 +38,7 @@ extern unsigned int dcr_resource_start(struct device_node *np,
> unsigned int index);
> extern unsigned int dcr_resource_len(struct device_node *np,
> unsigned int index);
> +extern dcr_host_t dcr_map_reg(struct device_node *np, unsigned int index);
> #endif /* CONFIG_PPC_MERGE */
>
> #endif /* CONFIG_PPC_DCR */
^ permalink raw reply
* Re: [PATCH 4/5] Add dcr_host_t.base in dcr_read()/dcr_write()
From: Benjamin Herrenschmidt @ 2007-07-12 0:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <e7d461c6fbf2cdc3d255ebaed8ebfcc66ff2a7e9.1182493056.git.michael@ellerman.id.au>
On Fri, 2007-06-22 at 16:18 +1000, Michael Ellerman wrote:
> Now that all users of dcr_read()/dcr_write() add the dcr_host_t.base, we can
> save them the trouble and do it in dcr_read()/dcr_write().
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> arch/powerpc/sysdev/mpic.c | 4 ++--
> drivers/net/ibm_emac/ibm_emac_mal.h | 4 ++--
> include/asm-powerpc/dcr-mmio.h | 4 ++--
> include/asm-powerpc/dcr-native.h | 4 ++--
> 4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index 6c2e467..8cb8e13 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -156,7 +156,7 @@ static inline u32 _mpic_read(enum mpic_reg_type type,
> switch(type) {
> #ifdef CONFIG_PPC_DCR
> case mpic_access_dcr:
> - return dcr_read(rb->dhost, rb->dhost.base + reg);
> + return dcr_read(rb->dhost, reg);
> #endif
> case mpic_access_mmio_be:
> return in_be32(rb->base + (reg >> 2));
> @@ -173,7 +173,7 @@ static inline void _mpic_write(enum mpic_reg_type type,
> switch(type) {
> #ifdef CONFIG_PPC_DCR
> case mpic_access_dcr:
> - return dcr_write(rb->dhost, rb->dhost.base + reg, value);
> + return dcr_write(rb->dhost, reg, value);
> #endif
> case mpic_access_mmio_be:
> return out_be32(rb->base + (reg >> 2), value);
> diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
> index 6b1fbeb..10dc978 100644
> --- a/drivers/net/ibm_emac/ibm_emac_mal.h
> +++ b/drivers/net/ibm_emac/ibm_emac_mal.h
> @@ -208,12 +208,12 @@ struct ibm_ocp_mal {
>
> static inline u32 get_mal_dcrn(struct ibm_ocp_mal *mal, int reg)
> {
> - return dcr_read(mal->dcrhost, mal->dcrhost.base + reg);
> + return dcr_read(mal->dcrhost, reg);
> }
>
> static inline void set_mal_dcrn(struct ibm_ocp_mal *mal, int reg, u32 val)
> {
> - dcr_write(mal->dcrhost, mal->dcrhost.base + reg, val);
> + dcr_write(mal->dcrhost, reg, val);
> }
>
> /* Register MAL devices */
> diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
> index 6b82c3b..a7d9eaf 100644
> --- a/include/asm-powerpc/dcr-mmio.h
> +++ b/include/asm-powerpc/dcr-mmio.h
> @@ -37,12 +37,12 @@ extern void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c);
>
> static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n)
> {
> - return in_be32(host.token + dcr_n * host.stride);
> + return in_be32(host.token + ((host.base + dcr_n) * host.stride));
> }
>
> static inline void dcr_write(dcr_host_t host, unsigned int dcr_n, u32 value)
> {
> - out_be32(host.token + dcr_n * host.stride, value);
> + out_be32(host.token + ((host.base + dcr_n) * host.stride), value);
> }
>
> extern u64 of_translate_dcr_address(struct device_node *dev,
> diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
> index f41058c..3bc780f 100644
> --- a/include/asm-powerpc/dcr-native.h
> +++ b/include/asm-powerpc/dcr-native.h
> @@ -30,8 +30,8 @@ typedef struct {
>
> #define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) })
> #define dcr_unmap(host, dcr_n, dcr_c) do {} while (0)
> -#define dcr_read(host, dcr_n) mfdcr(dcr_n)
> -#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)
> +#define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base)
> +#define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value)
>
> /* Device Control Registers */
> void __mtdcr(int reg, unsigned int val);
^ permalink raw reply
* Re: [PATCH 3/5] Use dcr_host_t.base in ibm_emac_mal
From: Benjamin Herrenschmidt @ 2007-07-12 0:30 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <3e7d30667d5ac0b6aabc197fb5d500b9c6c82feb.1182493056.git.michael@ellerman.id.au>
On Fri, 2007-06-22 at 16:18 +1000, Michael Ellerman wrote:
> This requires us to do a sort-of fake dcr_map(), so that base is set
> properly. This will be fixed/removed when the device-tree-aware emac driver
> is merged.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/net/ibm_emac/ibm_emac_mal.c | 5 ++++-
> drivers/net/ibm_emac/ibm_emac_mal.h | 5 ++---
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ibm_emac/ibm_emac_mal.c b/drivers/net/ibm_emac/ibm_emac_mal.c
> index cabd984..b08da96 100644
> --- a/drivers/net/ibm_emac/ibm_emac_mal.c
> +++ b/drivers/net/ibm_emac/ibm_emac_mal.c
> @@ -421,7 +421,10 @@ static int __init mal_probe(struct ocp_device *ocpdev)
> ocpdev->def->index);
> return -ENOMEM;
> }
> - mal->dcrbase = maldata->dcr_base;
> +
> + /* XXX This only works for native dcr for now */
> + mal->dcrhost = dcr_map(NULL, maldata->dcr_base, 0);
> +
> mal->def = ocpdev->def;
>
> INIT_LIST_HEAD(&mal->poll_list);
> diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
> index 64bc338..6b1fbeb 100644
> --- a/drivers/net/ibm_emac/ibm_emac_mal.h
> +++ b/drivers/net/ibm_emac/ibm_emac_mal.h
> @@ -191,7 +191,6 @@ struct mal_commac {
> };
>
> struct ibm_ocp_mal {
> - int dcrbase;
> dcr_host_t dcrhost;
>
> struct list_head poll_list;
> @@ -209,12 +208,12 @@ struct ibm_ocp_mal {
>
> static inline u32 get_mal_dcrn(struct ibm_ocp_mal *mal, int reg)
> {
> - return dcr_read(mal->dcrhost, mal->dcrbase + reg);
> + return dcr_read(mal->dcrhost, mal->dcrhost.base + reg);
> }
>
> static inline void set_mal_dcrn(struct ibm_ocp_mal *mal, int reg, u32 val)
> {
> - dcr_write(mal->dcrhost, mal->dcrbase + reg, val);
> + dcr_write(mal->dcrhost, mal->dcrhost.base + reg, val);
> }
>
> /* Register MAL devices */
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox