Re: [PATCH 02/20] MIPS: Clear [MSA]FPE CSR.Cause after notify_die()

2015-03-23 Thread Ralf Baechle
On Wed, Mar 11, 2015 at 02:44:38PM +, James Hogan wrote:

Acked-by: Ralf Baechle 

Feel free to merge this through the KVM tree along with the remainder of
the series.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mips: Accidental removal of paravirt_cpus_done?

2014-06-13 Thread Ralf Baechle
On Fri, Jun 13, 2014 at 12:02:30PM +0200, Geert Uytterhoeven wrote:

> It seems you accidentally assimilated an (unwanted?) kvm change in my
> patch:

I accidentally must have done a git commit --amend with the wrong
patch on top, sorry about that.  The change itself was intensional.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 09/13] MIPS: Add functions for hypervisor call

2014-06-03 Thread Ralf Baechle
On Wed, May 28, 2014 at 11:52:12PM +0200, Andreas Herrmann wrote:

> +/*
> + * Hypercalls for KVM.
> + *
> + * Hypercall number is passed in v0.
> + * Return value will be placed in v0.
> + * Up to 3 arguments are passed in a0, a1, and a2.
> + */
> +static inline unsigned long kvm_hypercall0(unsigned long num)
> +{
> + register unsigned long n asm("v0");
> + register unsigned long r asm("v0");

Btw, is it safe to put two variables in the same register?

The syscall wrappers that used to be in  were occasionally
hitting problems which eventually forced me to stop forcing variables
into particular registers instead using a MOVE instruction to shove
each variable into the right place.

Of course they were being used from non-PIC and PIC code, kernel and userland
so GCC had a much better chance to do evil than in the hypercall wrapper
case - but it made me paranoid ...

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 02/23] MIPS: Export local_flush_icache_range for KVM

2014-05-30 Thread Ralf Baechle
On Thu, May 29, 2014 at 10:16:24AM +0100, James Hogan wrote:

> Export the local_flush_icache_range function pointer for GPL modules so
> that it can be used by KVM for syncing the icache after binary
> translation of trapping instructions.

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 14/23] MIPS: KVM: Override guest kernel timer frequency directly

2014-05-30 Thread Ralf Baechle
On Thu, May 29, 2014 at 10:16:36AM +0100, James Hogan wrote:

> The KVM_HOST_FREQ Kconfig symbol was used by KVM guest kernels to
> override the timer frequency calculation to a value based on the host
> frequency. Now that the KVM timer emulation is implemented independent
> of the host timer frequency and defaults to 100MHz, adjust the working
> of CONFIG_KVM_HOST_FREQ to match.
> 
> The Kconfig symbol now specifies the guest timer frequency directly, and
> has been renamed accordingly to KVM_GUEST_TIMER_FREQ. It now defaults to
> 100MHz too and the help text is updated to make it clear that a zero
> value will allow the normal timer frequency calculation to take place
> (based on the emulated RTC).

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/15] MIPS: Add code for new system 'paravirt'.

2014-05-23 Thread Ralf Baechle
On Fri, May 23, 2014 at 10:28:55PM +0200, Andreas Herrmann wrote:

> > > + wmb();
> > 
> > Wouldn't smp_wmb() be more accurate?
> 
> ... use smp_wmb there ...

A few years ago I reviewed the use of mb()/rmb()/wmb() as opposed to
smp_mb()/smp_rmb()/smp_wmb() throughout the kernel.  Every single use
was a bug should either have been replaced by the smp_* variant because
it was not necessary on uniprocessors, was pure cargocult programming
or was used for a purpose such I/O where other solutions were required.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/15] MIPS: Add minimal support for OCTEON3 to c-r4k.c

2014-05-22 Thread Ralf Baechle
On Wed, May 21, 2014 at 11:02:12PM +0200, Andreas Herrmann wrote:

> On Wed, May 21, 2014 at 02:40:41PM +0200, Ralf Baechle wrote:
> > On Tue, May 20, 2014 at 04:47:07PM +0200, Andreas Herrmann wrote:
> > 
> > > +static inline void r4k_blast_dcache_page_dc128(unsigned long addr)
> > > +{
> > > + R4600_HIT_CACHEOP_WAR_IMPL;
> > 
> > The R4600 has 32 byte cache lines that is this line will never be
> > executed on an R4600 thus can be dropped.
> 
> So the line can also be removed from r4k_blast_dcache_page_dc64?

Yes, indeed.  Just did that now.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/15] MIPS: paravirt: Add pci controller for virtio

2014-05-21 Thread Ralf Baechle
On Tue, May 20, 2014 at 04:47:12PM +0200, Andreas Herrmann wrote:

> +
> +union pci_config_address {
> + struct {
> +#ifdef __LITTLE_ENDIAN
> + unsignedregister_number : 8;/* 7  .. 0  */
> + unsigneddevfn_number: 8;/* 15 .. 8  */
> + unsignedbus_number  : 8;/* 23 .. 16 */
> + unsignedreserved: 7;/* 30 .. 24 */
> + unsignedenable_bit  : 1;/* 31   */
> +#else
> + unsignedenable_bit  : 1;/* 31   */
> + unsignedreserved: 7;/* 30 .. 24 */
> + unsignedbus_number  : 8;/* 23 .. 16 */
> + unsigneddevfn_number: 8;/* 15 .. 8  */
> + unsignedregister_number : 8;/* 7  .. 0  */
> +#endif

For this kind of endianess dependency there is a more elegant way of
defining things in linux-next's  like:

#include 
...

struct {
__BITFIELD_FIELD(unsigned   enable_bit  : 1,/* 31   
*/
__BITFIELD_FIELD(unsigned   reserved: 7,/* 30 
.. 24 */
__BITFIELD_FIELD(unsigned   bus_number  : 8,/* 23 
.. 16 */
__BITFIELD_FIELD(unsigned   devfn_number: 8,/* 15 
.. 8  */
__BITFIELD_FIELD(unsigned   register_number : 8,/* 7  
.. 0  */
);
};

No ifdef, no duplication!

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] MIPS: Don't build fast TLB refill handler with 32-bit kernels.

2014-05-21 Thread Ralf Baechle
On Wed, May 21, 2014 at 10:38:39AM +0100, James Hogan wrote:

> On 20/05/14 15:47, Andreas Herrmann wrote:
> > From: David Daney 
> > 
> > The fast handler only supports 64-bit kernels.
> > 
> > Signed-off-by: David Daney 
> > Signed-off-by: Andreas Herrmann 
> > ---
> >  arch/mips/mm/tlbex.c |8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
> > index ee88367..781e183 100644
> > --- a/arch/mips/mm/tlbex.c
> > +++ b/arch/mips/mm/tlbex.c
> > @@ -1250,13 +1250,17 @@ static void build_r4000_tlb_refill_handler(void)
> > unsigned int final_len;
> > struct mips_huge_tlb_info htlb_info __maybe_unused;
> > enum vmalloc64_mode vmalloc_mode __maybe_unused;
> > -
> > +#ifdef CONFIG_64BIT
> > +   bool is64bit = true;
> > +#else
> > +   bool is64bit = false;
> > +#endif
> > memset(tlb_handler, 0, sizeof(tlb_handler));
> > memset(labels, 0, sizeof(labels));
> > memset(relocs, 0, sizeof(relocs));
> > memset(final_handler, 0, sizeof(final_handler));
> >  
> > -   if ((scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
> > +   if (is64bit && (scratch_reg >= 0 || scratchpad_available()) && 
> > use_bbit_insns()) {
> > htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
> >   scratch_reg);
> > vmalloc_mode = refill_scratch;
> > 
> 
> This looks like a good place to use IS_ENABLED(CONFIG_64BIT) to reduce
> ifdefery.

Or even the classic "if (sizeof(unsigned long) == 8)" which is a little less
expressive but more portable.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/15] MIPS: Add minimal support for OCTEON3 to c-r4k.c

2014-05-21 Thread Ralf Baechle
On Tue, May 20, 2014 at 04:47:07PM +0200, Andreas Herrmann wrote:

> +static inline void r4k_blast_dcache_page_dc128(unsigned long addr)
> +{
> + R4600_HIT_CACHEOP_WAR_IMPL;

The R4600 has 32 byte cache lines that is this line will never be
executed on an R4600 thus can be dropped.

> + blast_dcache128_page(addr);
> +}
> +
>  static void r4k_blast_dcache_page_setup(void)
>  {
>   unsigned long  dc_lsize = cpu_dcache_line_size();
> @@ -121,6 +127,8 @@ static void r4k_blast_dcache_page_setup(void)
>   r4k_blast_dcache_page = r4k_blast_dcache_page_dc32;
>   else if (dc_lsize == 64)
>   r4k_blast_dcache_page = r4k_blast_dcache_page_dc64;
> + else if (dc_lsize == 128)
> + r4k_blast_dcache_page = r4k_blast_dcache_page_dc128;


For another patch - let's see if this can be turned into a switch
construct which hopefully is more readable and produces just as
afficient code with reasonable vintage of gcc.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] mips/kvm: Improve code formatting in arch/mips/kvm/kvm_locore.S

2013-08-05 Thread Ralf Baechle
On Mon, Aug 05, 2013 at 04:43:27PM +0300, Gleb Natapov wrote:
> Date:   Mon, 5 Aug 2013 16:43:27 +0300
> From: Gleb Natapov 
> To: Ralf Baechle 
> Cc: James Hogan , David Daney
>  , linux-m...@linux-mips.org, kvm@vger.kernel.org,
>  Sanjay Lal , linux-ker...@vger.kernel.org, David
>  Daney 
> Subject: Re: [PATCH 1/3] mips/kvm: Improve code formatting in
>  arch/mips/kvm/kvm_locore.S
> Content-Type: text/plain; charset=us-ascii
> 
> On Mon, Aug 05, 2013 at 03:21:57PM +0200, Ralf Baechle wrote:
> > On Mon, Aug 05, 2013 at 02:17:01PM +0100, James Hogan wrote:
> > 
> > > 
> > > On 01/08/13 21:22, David Daney wrote:
> > > > From: David Daney 
> > > > 
> > > > No code changes, just reflowing some comments and consistently using
> > > > tabs and spaces.  Object code is verified to be unchanged.
> > > > 
> > > > Signed-off-by: David Daney 
> > > > Acked-by: Ralf Baechle 
> > > 
> > > 
> > > > +/* Put the saved pointer to vcpu (s1) back into the DDATA_LO 
> > > > Register */
> > > 
> > > git am detects a whitespace error here ("space before tab in indent").
> > > It's got spaces before and after the tab actually.
> > > 
> > > >  /* load the guest context from VCPU and return */
> > > 
> > > this comment could have it's indentation fixed too
> > > 
> > > Otherwise, for all 3 patches:
> > > 
> > > Reviewed-by: James Hogan 
> > 
> > I'm happy with the patch series as well and will fix this issue when
> > applying the patch.
> > 
> kvm fixes usually go through kvm.git tree for all arches. Any special
> reasons you want to get those through mips tree?

MIPS fixes usually go through the MIPS tree ;-)

I don't care which tree this stuff goes through - but a general experience
is that things that affect MIPS systems receive most testing if going
through the MIPS tree.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] mips/kvm: Improve code formatting in arch/mips/kvm/kvm_locore.S

2013-08-05 Thread Ralf Baechle
On Mon, Aug 05, 2013 at 02:17:01PM +0100, James Hogan wrote:

> 
> On 01/08/13 21:22, David Daney wrote:
> > From: David Daney 
> > 
> > No code changes, just reflowing some comments and consistently using
> > tabs and spaces.  Object code is verified to be unchanged.
> > 
> > Signed-off-by: David Daney 
> > Acked-by: Ralf Baechle 
> 
> 
> > +/* Put the saved pointer to vcpu (s1) back into the DDATA_LO 
> > Register */
> 
> git am detects a whitespace error here ("space before tab in indent").
> It's got spaces before and after the tab actually.
> 
> >  /* load the guest context from VCPU and return */
> 
> this comment could have it's indentation fixed too
> 
> Otherwise, for all 3 patches:
> 
> Reviewed-by: James Hogan 

I'm happy with the patch series as well and will fix this issue when
applying the patch.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-19 Thread Ralf Baechle
FYI, Since you intend to resubmit anyway I just dropped the entire series
from patchwork.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 28/31] mips/kvm: Only use KVM_COALESCED_MMIO_PAGE_OFFSET with KVM_MIPSTE

2013-06-16 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:32PM -0700, David Daney wrote:

> From: David Daney 
> 
> The forthcoming MIPSVZ code doesn't currently use this, so it must
> only be enabled for KVM_MIPSTE.
> 
> Signed-off-by: David Daney 
> ---
>  arch/mips/include/asm/kvm_host.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/include/asm/kvm_host.h 
> b/arch/mips/include/asm/kvm_host.h
> index 505b804..9f209e1 100644
> --- a/arch/mips/include/asm/kvm_host.h
> +++ b/arch/mips/include/asm/kvm_host.h
> @@ -25,7 +25,9 @@
>  /* memory slots that does not exposed to userspace */
>  #define KVM_PRIVATE_MEM_SLOTS0
>  
> +#ifdef CONFIG_KVM_MIPSTE
>  #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
> +#endif

What if KVM_MIPSTE and KVM_MIPSVZ both get enabled?

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-16 Thread Ralf Baechle
On Sun, Jun 09, 2013 at 04:23:51PM -0700, David Daney wrote:

> Come to think of it, Emulating SGI hardware might be an interesting
> case.  There may be old IRIX systems and applications that could be
> running low on real hardware.  Some of those systems take up a whole
> room and draw a lot of power.  They might run faster and at much
> lower power consumption on a modern 48-Way SMP SoC based system.

Many SGI MIPS system have RTCs powered by builtin batteries with a
nominal livetime of ten years and for which no more replacements are
available.  This is beginning to limit usable SGI MIPS systems to those
who know how to solve these issues with a Dremel and a soldering iron.

That said, SGI platforms are all more or less weird custom architectures
so the platform emulation - let alone the firmware blobs - will be a
chunk of work.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 29/31] mips/kvm: Add MIPSVZ support.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 30/31] mips/kvm: Enable MIPSVZ in Kconfig/Makefile

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 27/31] mips/kvm: Gate the use of kvm_local_flush_tlb_all() by KVM_MIPSTE

2013-06-16 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:31PM -0700, David Daney wrote:

> From: David Daney 
> 
> Only the trap-and-emulate KVM code needs a Special tlb flusher.  All
> other configurations should use the regular version.
> 
> Signed-off-by: David Daney 
> ---
>  arch/mips/include/asm/mmu_context.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/mmu_context.h 
> b/arch/mips/include/asm/mmu_context.h
> index 5609a32..04d0b74 100644
> --- a/arch/mips/include/asm/mmu_context.h
> +++ b/arch/mips/include/asm/mmu_context.h
> @@ -117,7 +117,7 @@ get_new_asid(unsigned long cpu)
>   if (! ((asid += ASID_INC) & ASID_MASK) ) {
>   if (cpu_has_vtag_icache)
>   flush_icache_all();
> -#ifdef CONFIG_VIRTUALIZATION
> +#if IS_ENABLED(CONFIG_KVM_MIPSTE)
>   kvm_local_flush_tlb_all();  /* start new asid cycle */
>  #else
>   local_flush_tlb_all();  /* start new asid cycle */

Sanjay,

it would seem this is actually a bug if KVM is built as a module and should
be fixed for 3.10?

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 31/31] mips/kvm: Allow for upto 8 KVM vcpus per vm.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 26/31] mips/kvm: Split up Kconfig and Makefile definitions in preperation for MIPSVZ.

2013-06-16 Thread Ralf Baechle
The Trademark guys (and readability in general) sould probably be happier
if MIPSTE was spelled as MIPS_TE and for that matter, MIPZVZ as MIPS_VZ?

Other than that,

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 25/31] mips/kvm: Add some asm-offsets constants used by MIPSVZ.

2013-06-16 Thread Ralf Baechle
Patch looks ok but why not combine this patch with the previous one?

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 24/31] mips/kvm: Add thread_struct fields used by MIPSVZ hosts.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 23/31] mips/kvm: Hook into CP unusable exception handler.

2013-06-16 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:27PM -0700, David Daney wrote:

> From: David Daney 
> 
> The MIPS VZ KVM code needs this to be able to manage the FPU.
> 
> Signed-off-by: David Daney 

Looks good, Acked-by: Ralf Baechle .

However I get cold shivers at the thought of SMTC FPU management with VZ,
it sounds like a source of new entertainment ...  But thinkin gaobu this
is something for another rainy day, not now.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 22/31] mips/kvm: Split get_new_mmu_context into two parts.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 21/31] mips/kvm: Allow set_except_vector() to be used from MIPSVZ code.

2013-06-16 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:25PM -0700, David Daney wrote:

> From: David Daney 
> 
> We need to move it out of __init so we don't have section mismatch problems.
> 
> Signed-off-by: David Daney 
> ---
>  arch/mips/include/asm/uasm.h | 2 +-
>  arch/mips/kernel/traps.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
> index 370d967..90b4f5e 100644
> --- a/arch/mips/include/asm/uasm.h
> +++ b/arch/mips/include/asm/uasm.h
> @@ -11,7 +11,7 @@
>  
>  #include 
>  
> -#ifdef CONFIG_EXPORT_UASM
> +#if defined(CONFIG_EXPORT_UASM) || IS_ENABLED(CONFIG_KVM_MIPSVZ)
>  #include 
>  #define __uasminit
>  #define __uasminitdata

I'd rather keep KVM bits out of uasm.h.  A select EXPORT_UASM in Kconfig
would have been cleaner - but read below.

> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index f008795..fca0a2f 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1457,7 +1457,7 @@ unsigned long ebase;
>  unsigned long exception_handlers[32];
>  unsigned long vi_handlers[64];
>  
> -void __init *set_except_vector(int n, void *addr)
> +void __uasminit *set_except_vector(int n, void *addr)

A __uasminit tag is a bit unobvious because set_except_vector is not part of
uasm.  I could understand __cpuinit - but of course that doesn't sort your
problem.  Maybe we should just drop the __init tag alltogether?  Or if we
really want set_except_vector to become part of the uasm subsystem, then
probably it's declaration should move from setup.h to uasm.h.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 20/31] mips/kvm: Hook into TLB fault handlers.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 19/31] mips/kvm: Add host definitions for MIPS VZ based host.

2013-06-16 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 18/31] mips/kvm: Add pt_regs slots for BadInstr and BadInstrP

2013-06-15 Thread Ralf Baechle
Acked-by: Ralf Baechle 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 16/31] mips/kvm: Add exception handler for MIPSVZ Guest exceptions.

2013-06-15 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:20PM -0700, David Daney wrote:

Acked-by: Ralf Baechle 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 15/31] mips/kvm: Exception handling to leave and reenter guest mode.

2013-06-15 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:19PM -0700, David Daney wrote:

> Currently this is a little complex, here are the facts about how it works:

I'm not so much worried about the intrinic complexity of the job your
code is trying to do rather than stackframe.h getting every more complex.
We're reaching the point where reimplementing is using uasm.c is looking
like a good thing.  But certainly not now.

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/31] mips/kvm: Add thread_info flag to indicate operation in MIPS VZ Guest Mode.

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/31] mips/kvm: Add accessors for MIPS VZ registers.

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/31] MIPS: Add instruction format information for WAIT, MTC0, MFC0, et al.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:16PM -0700, David Daney wrote:

> To: linux-m...@linux-mips.org, r...@linux-mips.org, kvm@vger.kernel.org,
>  Sanjay Lal 
> Cc: linux-ker...@vger.kernel.org, David Daney 
> Subject: [PATCH 12/31] MIPS: Add instruction format information for WAIT,
>  MTC0, MFC0, et al.

Looks good.

Acked-by: Ralf Baechle 

I wonder if somebody could throw in microMIPS equivalent to this patch?

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 11/31] MIPS: Rearrange branch.c so it can be used by kvm code.

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/31] mips/kvm: Implement ioctls to get and set FPU registers.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:14PM -0700, David Daney wrote:

> From: David Daney 
> 
> The current implementation does nothing with them, but future MIPSVZ
> work need them.  Also add the asm-offsets accessors for the fields.

Just as a note, older MIPS FPUs only have fcr0 and fcr31.

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 09/31] mips/kvm: Factor trap-and-emulate support into a pluggable implementation.

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/31] mips/kvm: Fix code formatting in arch/mips/kvm/kvm_locore.S

2013-06-14 Thread Ralf Baechle
Ah, here's you're taking care of my eariler complaint about the formatting
of kvm_locore.S.  I'd have done things in a different order to avoid the
inconsistent formatting - even if that was only a temporary state.  But
anyway,

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 07/31] mips/kvm: Rename VCPU_registername to KVM_VCPU_ARCH_registername

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/31] mips/kvm: Rename kvm_vcpu_arch.pc to kvm_vcpu_arch.epc

2013-06-14 Thread Ralf Baechle
Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/31] mips/kvm: Use generic cache flushing functions.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:09PM -0700, David Daney wrote:

> From: David Daney 
> 
> We don't know if we have the r4k specific functions available, so use
> universally available __flush_cache_all() instead.  This takes longer
> as it flushes both i-cache and d-cache, but is available for all CPUs.
> 
> Signed-off-by: David Daney 
> ---
>  arch/mips/kvm/kvm_mips_emul.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c
> index af9a661..a2c6687 100644
> --- a/arch/mips/kvm/kvm_mips_emul.c
> +++ b/arch/mips/kvm/kvm_mips_emul.c
> @@ -916,8 +916,6 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, 
> uint32_t cause,
>  struct kvm_run *run, struct kvm_vcpu *vcpu)
>  {
>   struct mips_coproc *cop0 = vcpu->arch.cop0;
> - extern void (*r4k_blast_dcache) (void);
> - extern void (*r4k_blast_icache) (void);
>   enum emulation_result er = EMULATE_DONE;
>   int32_t offset, cache, op_inst, op, base;
>   struct kvm_vcpu_arch *arch = &vcpu->arch;
> @@ -954,9 +952,9 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, 
> uint32_t cause,
>arch->gprs[base], offset);
>  
>   if (cache == MIPS_CACHE_DCACHE)
> - r4k_blast_dcache();

Only nukes the D-cache.

> + __flush_cache_all();

This is also going to blow away the I-cache, so will be slower.

>   else if (cache == MIPS_CACHE_ICACHE)
> - r4k_blast_icache();

Only nukes the I-cache.

> + __flush_cache_all();

This is also going to blow away the D-cache, so will be slower.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/31] mips/kvm: Add casts to avoid pointer width mismatch build failures.

2013-06-14 Thread Ralf Baechle
Cast are always a bit ugly, in particular the one double casts - but
a necessary evil here.

Acked-by: Ralf Baechle http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/31] MIPS: Move allocate_kscratch to cpu-probe.c and make it public.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 14, 2013 at 01:41:18PM +0200, Ralf Baechle wrote:
> Date:   Fri, 14 Jun 2013 13:41:18 +0200
> From: Ralf Baechle 
> To: James Hogan 
> Cc: linux-m...@linux-mips.org, kvm@vger.kernel.org, Sanjay Lal
>  , linux-ker...@vger.kernel.org, David Daney
>  
> Subject: Re: [PATCH 01/31] MIPS: Move allocate_kscratch to cpu-probe.c and
>  make it public.
> Content-Type: text/plain; charset=us-ascii
> 
> On Fri, Jun 07, 2013 at 04:03:05PM -0700, David Daney wrote:
> > Date:   Fri,  7 Jun 2013 16:03:05 -0700
> > From: David Daney 
> > To: linux-m...@linux-mips.org, r...@linux-mips.org, kvm@vger.kernel.org,
> >  Sanjay Lal 
> > Cc: linux-ker...@vger.kernel.org, David Daney 
> > Subject: [PATCH 01/31] MIPS: Move allocate_kscratch to cpu-probe.c and make
> >  it public.
> > 
> > From: David Daney 
> 
> I'd just like to add a note about compatibility.  Code optimized for
> LL/SC-less CPUs has made use of the fact that exception handlers will
> clobber k0/k1 to a non-zero value.  On a MIPS II or better CPU a branch
> likely instruction could be used to atomically test k0/k1 and depending
> on the test, execute a store instruction like:
> 
>   .setnoreorder
>   beqzl   $k0, ok
>   sw  $reg, offset($reg)
>   /* if we get here, our SC emulation has failed  */
> ok:   ...
> 
> In particular Sony had elected to do this for the R5900 (after I explained
> the concept to somebody and told it'd be a _bad_ idea for compatibility
> reasons).  Bad ideas are infectious so I'm sure others have used it, too.
> 
> I don't think this should stop your patch nor should we unless this turns
> out to be an actual problem add any kludges to support such cowboy style
> hacks.  But I wanted to mention and document the issue; maybe this should
> be mentioned in the log message of the next version of this patch.
> 
> Acked-by: Ralf Baechle 

Bleh.  I fatfingered mutt.  This of course was the reply intended for
"[PATCH 02/31] MIPS: Save and restore K0/K1 when CONFIG_KVM_MIPSVZ".

As for 1/31:

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/31] mips/kvm: Fix 32-bitisms in kvm_locore.S

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:07PM -0700, David Daney wrote:

> diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S
> index dca2aa6..e86fa2a 100644
> --- a/arch/mips/kvm/kvm_locore.S
> +++ b/arch/mips/kvm/kvm_locore.S
> @@ -310,7 +310,7 @@ NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra)
>  LONG_S  t0, VCPU_R26(k1)
>  
>  /* Get GUEST k1 and save it in VCPU */
> -la  t1, ~0x2ff
> + PTR_LI  t1, ~0x2ff
>  mfc0t0, CP0_EBASE
>  and t0, t0, t1
>  LONG_L  t0, 0x3000(t0)
> @@ -384,14 +384,14 @@ NESTED (MIPSX(GuestException), CALLFRAME_SIZ, ra)
>  mtc0k0, CP0_DDATA_LO
>  
>  /* Restore RDHWR access */
> -la  k0, 0x200F
> + PTR_LI  k0, 0x200F
>  mtc0k0,  CP0_HWRENA
>  
>  /* Jump to handler */
>  FEXPORT(__kvm_mips_jump_to_handler)
>  /* XXXKYMA: not sure if this is safe, how large is the stack?? */
>  /* Now jump to the kvm_mips_handle_exit() to see if we can deal with 
> this in the kernel */
> -la  t9,kvm_mips_handle_exit
> + PTR_LA  t9, kvm_mips_handle_exit
>  jalr.hb t9
>  addiu   sp,sp, -CALLFRAME_SIZ   /* BD Slot */
>  
> @@ -566,7 +566,7 @@ __kvm_mips_return_to_host:
>  mtlok0
>  
>  /* Restore RDHWR access */
> -la  k0, 0x200F
> + PTR_LI  k0, 0x200F
>  mtc0k0,  CP0_HWRENA

Technically ok, there's only a formatting issue because you indent the
changed lines with tabs while the existing file uses tab characters.
I suggest you insert an extra cleanup patch to properly re-indent the
entire file into the series before this one?

So with that sorted:

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/31] MIPS: Move allocate_kscratch to cpu-probe.c and make it public.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:05PM -0700, David Daney wrote:
> Date:   Fri,  7 Jun 2013 16:03:05 -0700
> From: David Daney 
> To: linux-m...@linux-mips.org, r...@linux-mips.org, kvm@vger.kernel.org,
>  Sanjay Lal 
> Cc: linux-ker...@vger.kernel.org, David Daney 
> Subject: [PATCH 01/31] MIPS: Move allocate_kscratch to cpu-probe.c and make
>  it public.
> 
> From: David Daney 

I'd just like to add a note about compatibility.  Code optimized for
LL/SC-less CPUs has made use of the fact that exception handlers will
clobber k0/k1 to a non-zero value.  On a MIPS II or better CPU a branch
likely instruction could be used to atomically test k0/k1 and depending
on the test, execute a store instruction like:

.setnoreorder
beqzl   $k0, ok
sw  $reg, offset($reg)
/* if we get here, our SC emulation has failed  */
ok: ...

In particular Sony had elected to do this for the R5900 (after I explained
the concept to somebody and told it'd be a _bad_ idea for compatibility
reasons).  Bad ideas are infectious so I'm sure others have used it, too.

I don't think this should stop your patch nor should we unless this turns
out to be an actual problem add any kludges to support such cowboy style
hacks.  But I wanted to mention and document the issue; maybe this should
be mentioned in the log message of the next version of this patch.

Acked-by: Ralf Baechle 

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 17/31] MIPS: Quit exposing Kconfig symbols in uapi headers.

2013-06-14 Thread Ralf Baechle
So this one can be dropped.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-14 Thread Ralf Baechle
On Fri, Jun 07, 2013 at 04:03:04PM -0700, David Daney wrote:

> Subject: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the
>  MIPS-VZ extensions.
> 
> From: David Daney 
> 
> These patches take a somewhat different approach to MIPS
> virtualization via the MIPS-VZ extensions than the patches previously
> sent by Sanjay Lal.
> 
> Several facts about the code:
> 
> o Existing exception handlers are modified to hook in to KVM instead
>   of intercepting all exceptions via the EBase register, and then
>   chaining to real exception handlers.
> 
> o Able to boot 64-bit SMP guests that use the FPU (I have booted 4-way
>   SMP 64-bit MIPS/Linux).
> 
> o Additional overhead on every exception even when *no* vCPU is running.
> 
> o Lower interrupt overhead, than the EBase interception method, when
>   vCPU *is* running.
> 
> o This code is somewhat smaller than the existing trap/emulate
>   implementation (about 2100 lines vs. about 5300 lines)
> 
> o Currently probably only usable on the OCTEON III CPU model, as some
>   MIPS-VZ implementation-defined behaviors were assumed to have the
>   OCTEON III behavior.
> 
> Note: I think Ralf already has the 17/31 (MIPS: Quit exposing Kconfig
> symbols in uapi headers.) queued, but I also include it here.

Yes; as the references to CONFIG_* symbols in UAPI were a bug, I've
already merged this patch for 3.10 as 8f657933a3c2086d4731350c98f91a990783c0d3
[MIPS: Quit exposing Kconfig symbols in uapi headers.]

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Commit f9afbd45b0d0 broke mips r4k.

2013-06-13 Thread Ralf Baechle
On Wed, Jun 12, 2013 at 09:35:16PM -0500, Rob Landley wrote:

> My aboriginal linux project builds tiny linux systems to run under
> qemu, producing as close to the same system as possible across a
> bunch of different architectures. The above change broke the mips
> r4k build I've been running under qemu.
> 
> Here's a toolchain and reproduction sequence:
> 
>   wget http://landley.net/aboriginal/bin/cross-compiler-mips.tar.bz2
>   tar xvjf cross-compiler-mips.tar.bz2
>   export PATH=$PWD/cross-compiler-mips/bin:$PATH
>   make ARCH=mips allnoconfig KCONFIG_ALLCONFIG=miniconfig.mips
>   make CROSS_COMPILE=mips- ARCH=mips
> 
> (The file miniconfig.mips is attached.)
> 
> It ends:
> 
>   CC  init/version.o
>   LD  init/built-in.o
> arch/mips/built-in.o: In function `local_r4k_flush_cache_page':
> c-r4k.c:(.text+0xe278): undefined reference to `kvm_local_flush_tlb_all'
> c-r4k.c:(.text+0xe278): relocation truncated to fit: R_MIPS_26
> against `kvm_local_flush_tlb_all'
> arch/mips/built-in.o: In function `local_flush_tlb_range':
> (.text+0xe938): undefined reference to `kvm_local_flush_tlb_all'
> arch/mips/built-in.o: In function `local_flush_tlb_range':
> (.text+0xe938): relocation truncated to fit: R_MIPS_26 against
> `kvm_local_flush_tlb_all'
> arch/mips/built-in.o: In function `local_flush_tlb_mm':
> (.text+0xed38): undefined reference to `kvm_local_flush_tlb_all'
> arch/mips/built-in.o: In function `local_flush_tlb_mm':
> (.text+0xed38): relocation truncated to fit: R_MIPS_26 against
> `kvm_local_flush_tlb_all'
> kernel/built-in.o: In function `__schedule':
> core.c:(.sched.text+0x16a0): undefined reference to
> `kvm_local_flush_tlb_all'
> core.c:(.sched.text+0x16a0): relocation truncated to fit: R_MIPS_26
> against `kvm_local_flush_tlb_all'
> mm/built-in.o: In function `use_mm':
> (.text+0x182c8): undefined reference to `kvm_local_flush_tlb_all'
> mm/built-in.o: In function `use_mm':
> (.text+0x182c8): relocation truncated to fit: R_MIPS_26 against
> `kvm_local_flush_tlb_all'
> fs/built-in.o:(.text+0x7b50): more undefined references to
> `kvm_local_flush_tlb_all' follow
> fs/built-in.o: In function `flush_old_exec':
> (.text+0x7b50): relocation truncated to fit: R_MIPS_26 against
> `kvm_local_flush_tlb_all'
> 
> Revert the above commit and it builds to the end.

Commit d414976d1ca721456f7b7c603a8699d117c2ec07 [MIPS: include:
mmu_context.h: Replace VIRTUALIZATION with KVM] fixes the issue and
was pulled by Linus only yesterday.  I cannot reproduce the error
following your receipe using the latest Linux/MIPS tree.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/31] KVM/MIPS: Implement hardware virtualization via the MIPS-VZ extensions.

2013-06-10 Thread Ralf Baechle
On Mon, Jun 10, 2013 at 12:40:42AM +0100, Maciej W. Rozycki wrote:

> > >   How different MIPS SMP systems are?
> > 
> > o Old SGI heavy metal (several different system architectures).
> > 
> > o Cavium OCTEON SMP SoCs.
> > 
> > o Broadcom (several flavors) SoCs
> > 
> > o Loongson
> 
> o Old DEC hardware (DECsystem 58x0, R3000-based).
> 
> o Malta-based MIPS Technologies CMP solutions (1004K, 1074K, interAptiv).

And more.  It's fairly accurate that MIPS SMP system tend to have little
of their system architecture in common beyond the underlying processor
architecture and everything else should be treated as a lucky coincidence.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next] ia64, metag: Do not export min_low_pfn in arch-specific code

2013-05-22 Thread Ralf Baechle
On Sun, Apr 28, 2013 at 11:24:35AM +0100, James Hogan wrote:

> On 27 April 2013 19:20, Geert Uytterhoeven  wrote:
> > As of commit 787dcbe6984b3638e94f60d807dcb51bb8a07211 ("MIPS: Export
> > symbols used by KVM/MIPS module"), min_low_pfn is already exported by
> > the generic mm/bootmem.c, causing:
> >
> > WARNING: vmlinux: 'min_low_pfn' exported twice. Previous export was in 
> > vmlinux
> >
> > Signed-off-by: Geert Uytterhoeven 
> 
> This has been pointed out several times and needs fixing in the mips
> tree where the warning was introduced.

I've changed the MIPS code to no longer require the export of min_low_pfn
and dropped the export of that particular file.  I still see that IA-64
and metag export min_low_pfn so maybe it should be exported from mm/
after all?

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] KVM/MIPS32: Export min_low_pfn.

2013-05-19 Thread Ralf Baechle
On Fri, May 17, 2013 at 02:42:48PM -0700, David Daney wrote:

> On 05/17/2013 02:06 PM, Sanjay Lal wrote:
> >The KVM module uses the standard MIPS cache management routines, which use 
> >min_low_pfn.
> >This creates and indirect dependency, requiring min_low_pfn to be exported.
> >
> >Signed-off-by: Sanjay Lal 
> >---
> >  arch/mips/kernel/mips_ksyms.c | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> >diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
> >index 6e58e97..0299472 100644
> >--- a/arch/mips/kernel/mips_ksyms.c
> >+++ b/arch/mips/kernel/mips_ksyms.c
> >@@ -14,6 +14,7 @@
> >  #include 
> >  #include 
> >  #include 
> >+#include 
> >
> >  extern void *__bzero(void *__s, size_t __count);
> >  extern long __strncpy_from_user_nocheck_asm(char *__to,
> >@@ -60,3 +61,8 @@ EXPORT_SYMBOL(invalid_pte_table);
> >  /* _mcount is defined in arch/mips/kernel/mcount.S */
> >  EXPORT_SYMBOL(_mcount);
> >  #endif
> >+
> >+/* The KVM module uses the standard MIPS cache functions which use
> >+ * min_low_pfn, requiring it to be exported.

The comment is wrong.  min_low_pfn is being referenced by pfn_valid() which
is implemented (simplified for purposes of this discussion) like:

int pfn_valid(unsigned long pfn)
{
return pfn >= min_low_pfn && pfn < max_mapnr;
}

> >+ */
> >+EXPORT_SYMBOL(min_low_pfn);
> 
> I think I asked this before, but I don't remember the answer:
> 
> Why not put EXPORT_SYMBOL(min_low_pfn) in mm/bootmem.c adjacent to
> where the symbol is defined?
> 
> Cluttering up the kernel with multiple architectures all doing
> architecture specific exports of the same symbol is not a clean way
> of doing things.
> 
> The second time something needs to be done, it should be factored
> out into common code.

pfn_valid() should return 1 if for the pfn passed as the argment a struct
page exists in mem_map[] - this only affects the flatmem case.  However
it is possible that min_low_pfn is bigger than ARCH_PFN_OFFSET in which
case pfn_valid might return 0 even though it should have returned 1.

So I fixed the issue like:

static inline int pfn_valid(unsigned long pfn)
{
return pfn >= ARCH_PFN_OFFSET && pfn < max_mapnr;
}

frv, ia64, metag, microblaze, score and sh are also implementing pfn_valid
referencing min_low_pfn.

Time to move pfn_valid() to asm-generic, fix the min_low_pfn /
ARCH_PFN_OFFSET issue and while at it, harden it against multiple
evaluation of its arguments?

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] KVM/MIPS32: Fix up KVM breakage caused by d532f3d26716a39dfd4b88d687bd344fbe77e390 which allows ASID mask and increment to be determined @ runtime.

2013-05-17 Thread Ralf Baechle
On Fri, May 17, 2013 at 02:25:12PM -0700, Sanjay Lal wrote:
> Date:   Fri, 17 May 2013 14:25:12 -0700
> From: Sanjay Lal 
> To: kvm@vger.kernel.org
> Cc: linux-m...@linux-mips.org, r...@linux-mips.org, g...@redhat.com,
>  mtosa...@redhat.com, Sanjay Lal 
> Subject: [PATCH 3/3] KVM/MIPS32: Fix up KVM breakage caused by
>  d532f3d26716a39dfd4b88d687bd344fbe77e390 which allows ASID mask and
>  increment to be determined @ runtime.

Good grief, yet another bug report against that patch ...  I've reverted
d532f3d26 just before your posting.  So I'm going to drop this patch.

Thanks,

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/18] KVM for MIPS32 Processors

2013-01-24 Thread Ralf Baechle
On Wed, Nov 21, 2012 at 06:33:58PM -0800, Sanjay Lal wrote:

I've queued the patch set.  I've done a few stylistic changes such as
getting rid of all use of ulong and u_long data types in favor of
unsigned long.  I also ran into the following modpost error

  ERROR: "kvm_arch_vcpu_postcreate" [arch/mips/kvm/kvm.ko] undefined!

which I fixed by adding a trivial kvm_arch_vcpu_postcreate function:

int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
{
return 0;
}

which may or may not be sufficient.

Enabling CONFIG_KVM_MIPS_VZ was causing build errors.  Since the support
code for the VZ ASE is not part of this series, I've ripped that out
entirely.

As for the __unused references, some are indeed unused with no apparent
reason for why the variables shouldn't be removed.  There are also
variables marked __unused which are being used - so no point in marking
them.  I've sorted that, too.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 02/18] KVM/MIPS32: Arch specific KVM data structures.

2013-01-24 Thread Ralf Baechle
On Wed, Dec 26, 2012 at 03:14:45PM +0200, Gleb Natapov wrote:

> On Wed, Nov 21, 2012 at 06:34:00PM -0800, Sanjay Lal wrote:
> > +
> > +#ifndef __unused
> > +#define __unused __attribute__((unused))
> > +#endif
> > +
> There are __maybe_unused and __always_unused, no need to define your
> own.

Also the symbol __unused is a member of struct compat_flock in
 which is going to bite on 64 bit.

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 15/18] MIPS: Pull in MIPS fix: fix endless loop when processing signals for kernel tasks.

2013-01-24 Thread Ralf Baechle
On Wed, Nov 21, 2012 at 06:34:13PM -0800, Sanjay Lal wrote:

> This bug is discussed in: 
> http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/00719.html

Dropped, see c90e6fbb220d44988cb65af3707367c57cdb65a8 [MIPS: Fix endless
loop when processing signals for kernel tasks].

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/20] KVM/MIPS32: Infrastructure/build files.

2012-11-10 Thread Ralf Baechle
On Wed, Oct 31, 2012 at 11:17:22AM -0400, Sanjay Lal wrote:

> index 7dd65cf..d2cfe45 100644
> --- a/arch/mips/Kbuild
> +++ b/arch/mips/Kbuild
> @@ -17,3 +17,7 @@ obj- := $(platform-)
>  obj-y += kernel/
>  obj-y += mm/
>  obj-y += math-emu/
> +
> +ifdef CONFIG_KVM
> +obj-y += kvm/
> +endif

Shorter:

obj-$(CONFIG_KVM) += kvm/

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html