Re: [PATCH] mpc52xx-psc-spi: refactor probe and remove to make use of of_register_spi_devices()

2009-10-30 Thread Stephen Rothwell
Hi Wolfram, On Fri, 30 Oct 2009 20:44:12 +0100 Wolfram Sang wrote: > > static struct of_platform_driver mpc52xx_psc_spi_of_driver = { > .owner = THIS_MODULE, > - .name = "mpc52xx-psc-spi", > + .name = DRIVER_NAME, You no longer need to set either owner or name in the of_platform d

Re: [PATCH 20/27] Split init_new_context and destroy_context

2009-10-30 Thread Stephen Rothwell
Hi Alexander, On Fri, 30 Oct 2009 16:47:20 +0100 Alexander Graf wrote: > > --- a/arch/powerpc/include/asm/mmu_context.h > +++ b/arch/powerpc/include/asm/mmu_context.h > @@ -23,6 +23,11 @@ extern void switch_slb(struct task_struct *tsk, struct > mm_struct *mm); > extern void set_context(unsigned

Re: [PATCH 19/27] Export symbols for KVM module

2009-10-30 Thread Stephen Rothwell
Hi Alexander, On Fri, 30 Oct 2009 16:47:19 +0100 Alexander Graf wrote: > > diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c > index c8b27bb..baf778c 100644 > --- a/arch/powerpc/kernel/ppc_ksyms.c > +++ b/arch/powerpc/kernel/ppc_ksyms.c > @@ -163,11 +163,12 @@ EXPORT_

Filtering bits in set_pte_at()

2009-10-30 Thread Benjamin Herrenschmidt
Hi folks ! So I have a little problem on powerpc ... :-) Due to the way I'm attempting to do my I$/D$ coherency on embedded processors, I basically need to "filter out" _PAGE_EXEC in set_pte_at() if the page isn't clean (PG_arch_1) and the set_pte_at() isn't caused by an exec fault. etc... The p

Re: mpc512x/clock: fix clk_get logic

2009-10-30 Thread Benjamin Herrenschmidt
On Fri, 2009-10-30 at 10:17 +0100, Wolfram Sang wrote: > The matching logic returns a clock even if only the dev-part matches. This is > wrong as devices may utilize more than one clock, so the wrong clock may be > returned due to dev being not unique (noticed while working on the CAN > driver). >

[PATCH] mpc52xx-psc-spi: refactor probe and remove to make use of of_register_spi_devices()

2009-10-30 Thread Wolfram Sang
This driver has a generic part for the probe/remove routines which probably used to be called from a platform driver and an of_platform driver. Meanwhile, the driver is of_platform only, so there is no need for the generic part anymore. Unifying probe/remove finally enables us to call of_register_s

[PATCH V2] mpc512x/clock: fix clk_get logic

2009-10-30 Thread Wolfram Sang
The current matching logic returns a clock even if only one out of two arguments matches. This is wrong as devices may utilize more than one clock, so only the first clock out of those is returned if the dev-match alone is considered sufficent (noticed while working on the CAN driver). The proposed

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Gabriel Paubert
On Fri, Oct 30, 2009 at 10:46:46AM -0600, Jonathan Haws wrote: > > Michael Buesch wrote: > > > Yes, I think the barrier is wrong. > > > Please try with > > > > > > #define mb() __asm__ __volatile__("eieio\n sync\n" : : : > > "memory") > > > > > > For uncached memory, eieio should be enough.

Re: [PATCH 0/8] Fix 8xx MMU/TLB

2009-10-30 Thread Scott Wood
On Fri, Oct 30, 2009 at 12:16:07PM -0500, Scott Wood wrote: > On Sat, Oct 17, 2009 at 02:01:38PM +0200, Joakim Tjernlund wrote: > > + mfspr r10, SPRN_SRR0 > > DO_8xx_CPU6(0x3780, r3) > > mtspr SPRN_MD_EPN, r10 > > mfspr r11, SPRN_M_TWB /* Get level 1 table entry address */ > >

Re: [PATCH 0/8] Fix 8xx MMU/TLB

2009-10-30 Thread Scott Wood
On Sat, Oct 17, 2009 at 02:01:38PM +0200, Joakim Tjernlund wrote: > + mfspr r10, SPRN_SRR0 > DO_8xx_CPU6(0x3780, r3) > mtspr SPRN_MD_EPN, r10 > mfspr r11, SPRN_M_TWB /* Get level 1 table entry address */ > - lwz r11, 0(r11) /* Get the level 1 entry */ > + cmp

[PATCH 10/27] Add book3s.c

2009-10-30 Thread Alexander Graf
This adds the book3s core handling file. Here everything that is generic to desktop PowerPC cores is handled, including interrupt injections, MSR settings, etc. It basically takes over the same role as booke.c for embedded PowerPCs. Signed-off-by: Alexander Graf --- v3 -> v4: - use context_

[PATCH 13/27] Add book3s_32 guest MMU

2009-10-30 Thread Alexander Graf
This patch adds an implementation for a G3/G4 MMU, so we can run G3 and G4 guests in KVM on Book3s_64. Signed-off-by: Alexander Graf --- v5 -> v6: - dprintk instead of scattered #ifdef's - // -> /* */ - 80 characters per line --- arch/powerpc/kvm/book3s_32_mmu.c | 372 +

[PATCH 24/27] Include Book3s_64 target in buildsystem

2009-10-30 Thread Alexander Graf
Now we have everything in place to be able to build KVM, so let's add it as config option and in the Makefile. Signed-off-by: Alexander Graf --- arch/powerpc/kvm/Kconfig | 17 + arch/powerpc/kvm/Makefile | 27 +++ 2 files changed, 40 insertions(+), 4

[PATCH 23/27] Export new PACA constants in asm-offsets

2009-10-30 Thread Alexander Graf
In order to access fields in the PACA from assembly code, we need to generate offsets using asm-offsets.c. So let's add the new PACA related bits, we just introduced! Signed-off-by: Alexander Graf --- arch/powerpc/kernel/asm-offsets.c |5 + 1 files changed, 5 insertions(+), 0 deletions(

[PATCH 25/27] Fix trace.h

2009-10-30 Thread Alexander Graf
It looks like the variable "pc" is defined. At least the current code always failed on me stating that "pc" is already defined somewhere else. Let's use _pc instead, because that doesn't collide. Is this the right approach? Does it break on 440 too? If not, why not? Signed-off-by: Alexander Graf

[PATCH 17/27] Make head_64.S aware of KVM real mode code

2009-10-30 Thread Alexander Graf
We need to run some KVM trampoline code in real mode. Unfortunately, real mode only covers 8MB on Cell so we need to squeeze ourselves as low as possible. Also, we need to trap interrupts to get us back from guest state to host state without telling Linux about it. This patch adds interrupt traps

[PATCH 21/27] Export KVM symbols for module

2009-10-30 Thread Alexander Graf
To be able to keep KVM as module, we need to export the SLB trampoline addresses to the module, so it knows where to jump to. Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_64_exports.c | 24 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100

[PATCH 27/27] Use hrtimers for the decrementer

2009-10-30 Thread Alexander Graf
Following S390's good example we should use hrtimers for the decrementer too! This patch converts the timer from the old mechanism to hrtimers. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/kvm_host.h |6 -- arch/powerpc/kvm/emulate.c | 18 +++--- arch

[PATCH 12/27] Add book3s_64 guest MMU

2009-10-30 Thread Alexander Graf
To be able to run a guest, we also need to implement a guest MMU. This patch adds MMU handling for Book3s_64 guests. Signed-off-by: Alexander Graf --- v5 -> v6: - dprintk instead of scattered #ifdef's - 80 line limit - // -> /* */ --- arch/powerpc/kvm/book3s_64_mmu.c | 476 +++

[PATCH 19/27] Export symbols for KVM module

2009-10-30 Thread Alexander Graf
We want to be able to build KVM as a module. To enable us doing so, we need some more exports from core Linux parts. This patch exports all functions and variables that are required for KVM. Signed-off-by: Alexander Graf --- v3 -> v4: - don't export switch_slb - don't export init_context

[PATCH 18/27] Add Book3s_64 offsets to asm-offsets.c

2009-10-30 Thread Alexander Graf
We need to access some VCPU fields from assembly code. In order to get the proper offsets, we have to define them in asm-offsets.c. Signed-off-by: Alexander Graf --- arch/powerpc/kernel/asm-offsets.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/power

[PATCH 20/27] Split init_new_context and destroy_context

2009-10-30 Thread Alexander Graf
For KVM we need to allocate a new context id, but don't really care about all the mm context around it. So let's split the alloc and destroy functions for the context id, so we can grab one without allocating an mm context. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/mmu_context.

[PATCH 22/27] Add fields to PACA

2009-10-30 Thread Alexander Graf
For KVM we need to store some information in the PACA, so we need to extend it. This patch adds KVM SLB shadow related entries to the PACA and a field that indicates if we're inside a guest. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/paca.h |9 + 1 files changed, 9 i

[PATCH 16/27] Add desktop PowerPC specific emulation

2009-10-30 Thread Alexander Graf
Little opcodes behave differently on desktop and embedded PowerPC cores. In order to reflect those differences, let's add some #ifdef code to emulate.c. We could probably also handle them in the core specific emulation files, but I would prefer to reuse as much code as possible. Signed-off-by: Al

[PATCH 00/27] Add KVM support for Book3s_64 (PPC64) hosts v6

2009-10-30 Thread Alexander Graf
KVM for PowerPC only supports embedded cores at the moment. While it makes sense to virtualize on small machines, it's even more fun to do so on big boxes. So I figured we need KVM for PowerPC64 as well. This patchset implements KVM support for Book3s_64 hosts and guest support for Book3s_64 and

[PATCH 14/27] Add book3s_64 specific opcode emulation

2009-10-30 Thread Alexander Graf
There are generic parts of PowerPC that can be shared across all implementations and specific parts that only apply to BookE or desktop PPCs. This patch adds emulation for desktop specific opcodes that don't apply to BookE CPUs. Signed-off-by: Alexander Graf --- v5 -> v6: - // -> /* */ ---

[PATCH 15/27] Add mfdec emulation

2009-10-30 Thread Alexander Graf
We support setting the DEC to a certain value right now. Doing that basically triggers the CPU local timer. But there's also an mfdec command that enabled the OS to read the decrementor. This is required at least by all desktop and server PowerPC Linux kernels. It can't really hurt to allow embed

[PATCH 01/27] Move dirty logging code to sub-arch

2009-10-30 Thread Alexander Graf
PowerPC code handles dirty logging in the generic parts atm. While this is great for "return -ENOTSUPP", we need to be rather target specific when actually implementing it. So let's split it to implementation specific code, so we can implement it for book3s. Signed-off-by: Alexander Graf --- ar

[PATCH 08/27] Add SLB switching code for entry/exit

2009-10-30 Thread Alexander Graf
This is the really low level of guest entry/exit code. Book3s_64 has an SLB, which stores all ESID -> VSID mappings we're currently aware of. The segments in the guest differ from the ones on the host, so we need to switch the SLB to tell the MMU that we're in a new context. So we store a shadow

[PATCH 05/27] Add asm/kvm_book3s.h

2009-10-30 Thread Alexander Graf
This adds the book3s specific header file that contains structs that are only valid on book3s specific code. Signed-off-by: Alexander Graf --- v3 -> v4: - use context_id instead of mm_alloc --- arch/powerpc/include/asm/kvm_book3s.h | 136 + 1 files changed,

[PATCH 04/27] Add Book3s fields to vcpu structs

2009-10-30 Thread Alexander Graf
We need to store more information than we currently have for vcpus when running on Book3s. So let's extend the internal struct definitions. Signed-off-by: Alexander Graf --- v3 -> v4: - use context_id instead of mm_context v4 -> v5: - always include pvr in vcpu struct --- arch/powerpc/

[PATCH 03/27] Add Book3s definitions

2009-10-30 Thread Alexander Graf
We need quite a bunch of new constants for KVM on Book3s, so let's define them now. These constants will be used in later patches. Signed-off-by: Alexander Graf --- v3 -> v4 - remove old kernel compat code --- arch/powerpc/include/asm/kvm_asm.h | 39

[PATCH 02/27] Pass PVR in sregs

2009-10-30 Thread Alexander Graf
Right now sregs is unused on PPC, so we can use it for initialization of the CPU. KVM on BookE always virtualizes the host CPU. On Book3s we go a step further and take the PVR from userspace that tells us what kind of CPU we are supposed to virtualize, because we support Book3s_32 and Book3s_64 gu

[PATCH 11/27] Add book3s_64 Host MMU handling

2009-10-30 Thread Alexander Graf
We designed the Book3S port of KVM as modular as possible. Most of the code could be easily used on a Book3S_32 host as well. The main difference between 32 and 64 bit cores is the MMU. To keep things well separated, we treat the book3s_64 MMU as one possible compile option. This patch adds all t

[PATCH 07/27] Add book3s_64 highmem asm code

2009-10-30 Thread Alexander Graf
This is the of entry / exit code. In order to switch between host and guest context, we need to switch register state and call the exit code handler on exit. This assembly file does exactly that. To finally enter the guest it calls into book3s_64_slb.S. On exit it gets jumped at from book3s_64_slb

[PATCH 09/27] Add interrupt handling code

2009-10-30 Thread Alexander Graf
Getting from host state to the guest is only half the story. We also need to return to our host context and handle whatever happened to get us out of the guest. On PowerPC every guest exit is an interrupt. So all we need to do is trap the host's interrupt handlers and get into our #VMEXIT code to

[PATCH 06/27] Add Book3s_64 intercept helpers

2009-10-30 Thread Alexander Graf
We need to intercept interrupt vectors. To do that, let's add a file we can always include which only activates the intercepts when we have then configured. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/kvm_book3s_64_asm.h | 58 ++ 1 files changed, 58 inser

[PATCH 26/27] Use Little Endian for Dirty Bitmap

2009-10-30 Thread Alexander Graf
We currently use host endian long types to store information in the dirty bitmap. This works reasonably well on Little Endian targets, because the u32 after the first contains the next 32 bits. On Big Endian this breaks completely though, forcing us to be inventive here. So Ben suggested to alway

R_PPC_PLTREL24 reloc against local symbol

2009-10-30 Thread Pu Yiqiao
Hi, Now I am trying to work on ppc440. And when I compile my program I received this error message while ld: ppc_4xx-ld: fifo_tmp.o(.text+0x6158): R_PPC_PLTREL24 reloc against local symbol fifo_tmp.o: could not read symbols: Bad value I am using ELDK 4.2. and the compile flags is as following: /el

RE: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Jonathan Haws
> Michael Buesch wrote: > > Yes, I think the barrier is wrong. > > Please try with > > > > #define mb()__asm__ __volatile__("eieio\n sync\n" : : : > "memory") > > > For uncached memory, eieio should be enough. I tried eieio alone and it did not work. It needed the above command to take

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Scott Wood
On Fri, Oct 30, 2009 at 04:08:55PM +0100, Alessandro Rubini wrote: > > asm("eieio; sync"); > > Hmm... > : : : "memory" > > And, doesn't ";" start a comment in assembly? (no, not on powerpc it seems) ';' is an instruction separator on all GNU as targets that I'm familiar with (though a quic

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Micha Nelissen
Michael Buesch wrote: Yes, I think the barrier is wrong. Please try with #define mb()__asm__ __volatile__("eieio\n sync\n" : : : "memory") For uncached memory, eieio should be enough. Micha ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlab

RE: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Jonathan Haws
> On Friday 30 October 2009 16:08:55 Alessandro Rubini wrote: > > > asm("eieio; sync"); > > > > Hmm... > > : : : "memory" > > > > And, doesn't ";" start a comment in assembly? (no, not on powerpc > it seems) > > Yes, I think the barrier is wrong. > Please try with > > #define mb() __asm__ __

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Michael Buesch
On Friday 30 October 2009 16:08:55 Alessandro Rubini wrote: > > asm("eieio; sync"); > > Hmm... > : : : "memory" > > And, doesn't ";" start a comment in assembly? (no, not on powerpc it seems) Yes, I think the barrier is wrong. Please try with #define mb()__asm__ __volatile__("eieio\n

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Alessandro Rubini
> asm("eieio; sync"); Hmm... : : : "memory" And, doesn't ";" start a comment in assembly? (no, not on powerpc it seems) Just to make sure, if you replace msync() with another system call, like "kill(1, 0);" you can verify wether it's really useful or if it's only acting as a barrier. /a

RE: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Jonathan Haws
> On Friday 30 October 2009 15:50:22 Jonathan Haws wrote: > > > I suspect that the msync() was merely serving as a very > heavyweight > > > memory barrier. > > > > I did try hacking the mb() calls from the kernel source to use > them in user space, but they had no effect. I still had to include >

Re: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Michael Buesch
On Friday 30 October 2009 15:50:22 Jonathan Haws wrote: > > I suspect that the msync() was merely serving as a very heavyweight > > memory barrier. > > I did try hacking the mb() calls from the kernel source to use them in user > space, but they had no effect. I still had to include the calls to

RE: Accessing flash directly from User Space [SOLVED]

2009-10-30 Thread Jonathan Haws
> On Thu, Oct 29, 2009 at 10:00:28AM +0100, Joakim Tjernlund wrote: > > > I have found the problem. It occurred to me in the shower (okay > not really, > > > but most good ideas happen there). > > > > > > What was happening is that I was in fact able to write to the > correct > > > registers. How

Re: mpc512x/clock: fix clk_get logic

2009-10-30 Thread Mark Brown
On Fri, Oct 30, 2009 at 12:36:44PM +0100, Wolfram Sang wrote: > On Fri, Oct 30, 2009 at 10:54:14AM +, Mark Brown wrote: > > > - require the id field (as _this_ is the unique identifier) > > NULL id fields are supposed to be supported in the cannonical clkdev > > API, unfortunately. > Hmm, ok

Re: mpc512x/clock: fix clk_get logic

2009-10-30 Thread Wolfram Sang
On Fri, Oct 30, 2009 at 10:54:14AM +, Mark Brown wrote: > On Fri, Oct 30, 2009 at 10:17:14AM +0100, Wolfram Sang wrote: > > The matching logic returns a clock even if only the dev-part matches. This > > is > > wrong as devices may utilize more than one clock, so the wrong clock may be > > retu

Re: mpc512x/clock: fix clk_get logic

2009-10-30 Thread Mark Brown
On Fri, Oct 30, 2009 at 10:17:14AM +0100, Wolfram Sang wrote: > The matching logic returns a clock even if only the dev-part matches. This is > wrong as devices may utilize more than one clock, so the wrong clock may be > returned due to dev being not unique (noticed while working on the CAN > dri

mpc512x/clock: fix clk_get logic

2009-10-30 Thread Wolfram Sang
The matching logic returns a clock even if only the dev-part matches. This is wrong as devices may utilize more than one clock, so the wrong clock may be returned due to dev being not unique (noticed while working on the CAN driver). The proposed new method will: - require the id field (as _this_

Re: SPRN_SVR for MPC5121e?

2009-10-30 Thread Wolfram Sang
> We saw > > PVR/SVR = 0x80862010 / 0x80180010 for MPC5121 > and > > PVR/SVR = 0x80862010 / 0x80180030 for MPC5123 Thanx a lot! -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ |