From: "Gerhard Pircher" <gerhard_pircher@gmx•net>
To: Milton Miller <miltonm@bga•com>
Cc: linuxppc-dev@ozlabs•org
Subject: Re: How to dynamically disable/enable CPU features?
Date: Fri, 22 Feb 2008 20:05:31 +0100 [thread overview]
Message-ID: <20080222190531.103050@gmx.net> (raw)
In-Reply-To: <ebff4ecb45908616728fb5c8ede8b0bf@bga.com>
Hi,
-------- Original-Nachricht --------
> Datum: Fri, 22 Feb 2008 11:24:38 -0600
> Von: Milton Miller <miltonm@bga•com>
> An: Gerhard Pircher <gerhard_pircher@gmx•net>
> CC: ppcdev <linuxppc-dev@ozlabs•org>
> Betreff: Re: How to dynamically disable/enable CPU features?
> We handle cpu features in a couple of ways:
> (1) we replace assembly instructions with nop early in the kernel boot
I'm pretty sure that is the problem.
> (2) we test the feature flags in c code
>
> In (2), we form two expressions for features that are
> (a) always set
> (b) never set
> so that the compiler can eliminate the test based on the config.
>
> To change a flag, you must make sure its in POSSIBLE but not ALWAYS,
> and also set it before it is used, either to nop out instructions (see
> early_init in setup-32.c for 32 bit), or tested by c code (in this
> case, maybe the initial_mmu setup is testing NEED_COHERENT, which is
> between early_init and probe). The code path is a bit different for 64
> bit.
The flag is in POSSIBLE. I now use this code in the platform probe
function to nop out the code affected by the flag:
cur_cpu_spec->cpu_features &= ~CPU_FTR_NEED_COHERENT;
/* Patch out unwanted feature. */
do_feature_fixups(cur_cpu_spec->cpu_features,
PTRRELOC(&__start___ftr_fixup),
PTRRELOC(&__stop___ftr_fixup));
It seems to work so far, but I would like to know if this is the right
way to do it, or if calling do_feature_fixups() more than once can have
any side effects.
regards,
Gerhard
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
next prev parent reply other threads:[~2008-02-22 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 20:07 How to dynamically disable/enable CPU features? Gerhard Pircher
2008-02-22 17:24 ` Milton Miller
2008-02-22 19:05 ` Gerhard Pircher [this message]
2008-02-22 22:32 ` Benjamin Herrenschmidt
2008-02-24 14:47 ` Gerhard Pircher
2008-02-22 22:26 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080222190531.103050@gmx.net \
--to=gerhard_pircher@gmx$(echo .)net \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=miltonm@bga$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox