From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by ozlabs.org (Postfix) with SMTP id 1B5FEDDF27 for ; Sat, 23 Feb 2008 06:05:32 +1100 (EST) Content-Type: text/plain; charset="iso-8859-1" Date: Fri, 22 Feb 2008 20:05:31 +0100 From: "Gerhard Pircher" In-Reply-To: Message-ID: <20080222190531.103050@gmx.net> MIME-Version: 1.0 References: Subject: Re: How to dynamically disable/enable CPU features? To: Milton Miller Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi, -------- Original-Nachricht -------- > Datum: Fri, 22 Feb 2008 11:24:38 -0600 > Von: Milton Miller > An: Gerhard Pircher > CC: ppcdev > 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