linux-mips
[Top] [All Lists]

Re: [PATCH v6] MIPS: micromips: Fix improper definition of ISA exception

To: "Steven J. Hill" <Steven.Hill@imgtec.com>
Subject: Re: [PATCH v6] MIPS: micromips: Fix improper definition of ISA exception bit.
From: Jonas Gorski <jogo@openwrt.org>
Date: Wed, 5 Jun 2013 23:23:58 +0200
Cc: David Daney <ddaney.cavm@gmail.com>, linux-mips@linux-mips.org
In-reply-to: <51AFAA8C.6080002@imgtec.com>
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: <1370461798-20296-1-git-send-email-Steven.Hill@imgtec.com> <51AFA540.5010207@gmail.com> <51AFAA8C.6080002@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, Jun 5, 2013 at 11:15 PM, Steven J. Hill <Steven.Hill@imgtec.com> wrote:
> On 06/05/2013 03:53 PM, David Daney wrote:
>>
>>
>> You can only manipulate this bit if you know microMIPS is supported.  So
>> I think you should either not touch it for the non-microMIPS case, or
>> make the write conditional on the presence of microMIPS support in the
>> CPU.
>>
> I decided to surround with SYS_SUPPORTS_MICROMIPS so the function could be
> optimized out in v7 of the patch.

Since this is (AFAICT) run after cpu_probe, and cpu probe sets
MIPS_CPU_MICROMIPS in options[0] if config3 has  MIPS_CONF3_ISA set
(as seen in the context), couldn't you do just the following in
cpu_trap:

        if (cpu_has_mmips) {
                unsigned int config3 = read_c0_config3();

                if (IS_ENABLED(CONFIG_CPU_MICROMIPS))
                        write_c0_config3(config3 | MIPS_CONF3_ISA_OE);
                else
                        write_c0_config3(config3 & ~MIPS_CONF3_ISA_OE);
        }


Regards
Jonas

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