linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Kconfig: microMIPS and SmartMIPS are mutually exclusiv

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] MIPS: Kconfig: microMIPS and SmartMIPS are mutually exclusive
From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Tue, 3 Jun 2014 14:56:50 +0100 (BST)
Cc: Markos Chandras <markos.chandras@imgtec.com>, linux-mips@linux-mips.org
In-reply-to: <20140603122451.GS17197@linux-mips.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1401785177-7904-1-git-send-email-markos.chandras@imgtec.com> <20140603093434.GQ17197@linux-mips.org> <alpine.LFD.2.11.1406031214390.18344@eddie.linux-mips.org> <20140603122451.GS17197@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Alpine 2.11 (LFD 23 2013-08-11)
On Tue, 3 Jun 2014, Ralf Baechle wrote:

> >  Do we need this CPU_HAS_SMARTMIPS setting at all?  Can't we just 
> > save/restore this SmartMIPS ACX register on context switches where 
> > available (straightforward to detect at the run time) and have the 
> > relevant pieces of code excluded (#ifdef-ed out or suchlike) on 
> > non-supported configurations such as microMIPS or MIPS64?
> 
> SmartMIPS has new instructions which are hardcoded in various assembler
> fragments, where something like if (cpu_has_smartmips) won't work.
> So until a more complex solution is implemented CPU_HAS_SMARTMIPS is
> what there is.

 Well:

        .set    push
        .set    smartmips
        # Whatever SmartMIPS stuff.
        .set    pop

should do.  It has been supported by GAS since forever (well, since it has 
included SmartMIPS instructions that is, which is 2.18; to support older 
versions we can use $(call as-instr,...) and some #ifdef-ry that we have 
anyway).  It's <asm/stackframe.h> only BTW for six instructions total.

 So I think that is straightforward to implement and much more reasonable 
than the hacks we have now.  A SmartMIPS-enabled kernel doesn't even check 
if the CPU it's run on implements the ASE so it'll just crash at some 
point trying to execute MFLHXU or MTLHX if it does not -- and obviously if 
two SmartMIPS user programs are run concurrently on a SmartMIPS-disabled 
kernel and use the ACX register, then they will yield random results.

  Maciej

<Prev in Thread] Current Thread [Next in Thread>