From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 X-Injected-Via-Gmane: http://gmane.org/ To: sisyphus@lists.altlinux.org From: Anton Farygin Date: Tue, 26 Feb 2008 15:15:19 +0300 Message-ID: References: <200802252249.31692.ledest@gmail.com> <200802261151.45083.ledest@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060103010902090104080202" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: altlinux.balabanovo.ru User-Agent: Thunderbird 2.0.0.6 (X11/20070804) In-Reply-To: <200802261151.45083.ledest@gmail.com> Sender: news Subject: Re: [sisyphus] IQ: kernel-image-ice-wks-2.6.24-alt1 X-BeenThere: sisyphus@lists.altlinux.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: ALT Linux Sisyphus discussions List-Id: ALT Linux Sisyphus discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2008 12:15:39 -0000 Archived-At: List-Archive: List-Post: This is a multi-part message in MIME format. --------------060103010902090104080202 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit Led пишет: > Tuesday, 26 February 2008 06:58:21 Anton Farygin написав: >> Led пишет: >>> Monday, 25 February 2008 21:54:27 Anton Farygin написав: >>>> Led пишет: >>>>> В сообщении от Monday 25 February 2008 20:30:00 Anton Farygin > написал(а): >>>>>> Igor Zubkov пишет: >>>>>>> 25.02.08, Valery V. Inozemtsev написал(а): >>>>>>>> В сообщении от 25 февраля 2008 Igor Zubkov написал(a): >>>>>>>>> Hi, All! >>>>>>>>> >>>>>>>> > Я выложил в Сизиф своё первое ядро. Оно основано на конфиге от >>>>>>>> > std-def. Плюс набор патчей: >>>>>>>> > 1) 2.6.24.2 >>>>>>>> > 2) mactel for 2.6.24 (это патчи для яблочного железа) >>>>>>>> > 3) usb-storage-zerowait.patch >>>>>>>> > >>>>>>>> > Так же, к этому ядру я собрал немного модулей: >>>>>>>> > 1) ALSA >>>>>>>> > 2) fglrx >>>>>>>> > 3) drm >>>>>>>> > >>>>>>>> > Это ядро собрано только для i586. У меня нет Сизифа на x86_64 что >>>>>>>> > бы и для него собрать. >>>>>>>> > >>>>>>>> > И так, вопросы: >>>>>>>> > 1) Собирать оставшиеся модули для этого ядра? >>>>>>>> > 2) Нужно ли это ядро для x86_86? >>>>>>>> > 3) С учётом того wks-smp ядро сегодня приказало долго жить, это >>>>>>>> > ядро можеть быть его заменой. Если оно будет заменой, то мне >>>>>>>> > нужно знать каких ещё патчей не хватает в этом ядро? (reiser4 я >>>>>>>> > уже собираюсь добавить в него). >>>>>>>> > >>>>>>>> > Кто-что думает по этому поводу? >>>>>>>> >>>>>>>> macbook специфично, в остальном не интересно и причем здесь wks не >>>>>>>> понятно. больше подойдет -ice-mac >>>>>>> Ничего там нет специфичного. Там патчи из mactel которые правят >>>>>>> только два модуля (applesmc + appletouch). Это да, только macbook. На >>>>>>> всё остальное это не влияет. В всём остальном это практически обычное >>>>>>> 2.6.24. >>>>>> Если тебе очень хочется заморочится, то не хватает: >>>>>> обновлённого v4l2 с linuxtv.org (желательно собранных отдельным >>>>>> пакетом от ядра) >>>>>> патчей для undervolting CPU >>>>>> bootsplash >>>>>> модулей nvidia >>>>>> обновлённого unionfs >>>>>> squashfs >>>>> Всё это, кроме v4l2, есть в kernel-image-2.6.22-led-* >>>> Мы здесь обсуждаем 2.6.24. >>> Да, сорри. >>> >>>> 2.6.22 у меня тоже есть, собственной сборки.. до 2.6.24 руки пока не >>>> дошли. >>>> >>>> А phc у тебя приложен ? >>>> http://phc.athousandnights.de/ >>> Да, изначально там был: >>> linux-phc-0.3.0-kernel-vanilla-2.6.22.patch >> Класс. Для powernow возьмёшь патч ? > > Давай. Патч к powernow или пат к phc? Патч к powernow в духе phc. Был для 2.6.23, надеюсь не далеко уползло в 2.6.24. --------------060103010902090104080202 Content-Type: text/x-patch; name="powernow-ulndervoltage-2.6.23.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="powernow-ulndervoltage-2.6.23.patch" --- linux-2.6.23/arch/i386/kernel/cpu/cpufreq/powernow-k8.c.orig 2007-11-20 23:54:17.000000000 +0200 +++ linux-2.6.23/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2007-11-20 23:55:42.000000000 +0200 @@ -98,6 +98,18 @@ static u32 find_did_from_pstate(u32 psta return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT; } +/* Return a voltage in miliVolts, given an input vid */ +static u32 find_vid_from_millivolts(u32 voltage) +{ + return (1550-voltage)/25; +} + +/* Return a voltage in miliVolts, given an input vid */ +static u32 find_millivolts_from_vid(uint32_t vid) +{ + return 1550 - (vid * 25); +} + /* Return the vco fid for an input fid * * Each "low" fid has corresponding "high" fid, and you can get to "low" fids @@ -379,16 +391,17 @@ static int core_frequency_transition(str { u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid; + if (data->currfid == reqfid) { + printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", data->currfid); + return 0; + } + if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", reqfid, data->currfid); return 1; } - if (data->currfid == reqfid) { - printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", data->currfid); - return 0; - } dprintk("ph2 (cpu%d): starting, currfid 0x%x, currvid 0x%x, reqfid 0x%x\n", smp_processor_id(), @@ -987,6 +1000,7 @@ static int transition_frequency_fidvid(s return 0; } + if ((fid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { printk(KERN_ERR PFX "ignoring illegal change in lo freq table-%x to 0x%x\n", @@ -1305,8 +1319,140 @@ out: return khz; } +/************************** sysfs interface for user defined voltage table ************************/ +static ssize_t show_user_voltage (struct cpufreq_policy *policy, char *buf) +{ + ssize_t bytes_written = 0; + struct powernow_k8_data *data = powernow_data[policy->cpu]; + int j; + for (j = 0; j < data->numps; j++) { + if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID) + { + bytes_written += snprintf (&buf[bytes_written],PAGE_SIZE, "%u",find_millivolts_from_vid((data->powernow_table[j].index & 0xFF00) >> 8)); + if (j < data->numps - 1) + bytes_written += snprintf (&buf[bytes_written],PAGE_SIZE,","); + else + bytes_written += snprintf (&buf[bytes_written],PAGE_SIZE,"\n"); + } + } + + buf[PAGE_SIZE-1] = 0; + return bytes_written; +} + +static ssize_t +store_user_voltage (struct cpufreq_policy *policy, const char *buf, size_t count) +{ + const char *curr_buf; + u32 curr_freq; + u32 op_index; + int isok; + unsigned int cpu; + int i; + static struct cpufreq_frequency_table **original_table = NULL; + struct powernow_k8_data *data = powernow_data[policy->cpu]; + char *next_buf; + u32 op_point; + ssize_t retval; + u32 voltage; + + if (!policy) + return -ENODEV; + + cpu = policy->cpu; + + if (!data || !data->powernow_table) + return -ENODEV; + + if (!original_table) + { + original_table = kmalloc(sizeof(struct cpufreq_frequency_table *)*NR_CPUS, GFP_KERNEL); + for (i=0; i < NR_CPUS; i++) + { + original_table[i] = NULL; + } + } + + if (!original_table[cpu]) + { + /* Allocate memory to store the copy */ + original_table[cpu] = (struct cpufreq_frequency_table*) kmalloc(sizeof(struct cpufreq_frequency_table)*(data->numps+1), GFP_KERNEL); + /* Make copy of frequency/voltage pairs */ + for (i=0; i < data->numps; i++) + { + original_table[cpu][i].frequency = data->powernow_table[i].frequency; + original_table[cpu][i].index = data->powernow_table[i].index; + } + original_table[cpu][i].frequency = CPUFREQ_TABLE_END; + } + op_index = 0; + curr_buf = buf; + next_buf = NULL; + isok = 1; + + while ((data->numps > op_index) + && (isok)) + { + voltage = simple_strtoul(curr_buf, &next_buf, 10); + if ((next_buf != curr_buf) && (next_buf != NULL)) + { + if ((voltage >= 700) && (voltage<=1550)) + { + op_point = (original_table[cpu])[op_index].index; + if (voltage <= find_millivolts_from_vid(op_point >> 8)) + { + op_point = (op_point & 0xFFFF00FF) | (find_vid_from_millivolts(voltage) << 8); + data->powernow_table[op_index].index = op_point; + } + else + { + op_point = (op_point & 0xFFFF00FF) | (find_vid_from_millivolts(voltage) << 8); + printk(KERN_ERR PFX"not setting control value %i to %04x because requested voltage is not lower than the default value\n", op_index, op_point); + // isok = 0; + } + } + else + { + printk(KERN_ERR PFX"voltage value %i is out of bounds: %u mV\n", op_index, voltage); + isok = 0; + } + curr_buf = next_buf; + if (*curr_buf==',') + curr_buf++; + next_buf = NULL; + } + else + { + printk(KERN_ERR PFX"failed to parse voltage value %i\n", op_index); + isok = 0; + } + op_index++; + } + if (isok) + { + retval = count; + curr_freq = policy->cur; + powernowk8_target(policy, curr_freq, CPUFREQ_RELATION_L); + } + else + { + retval = -EINVAL; + } + + return retval; +} + + +static struct freq_attr powernow_freq_attr_voltage_table = +{ + .attr = { .name = "voltage_table", .mode = 0644, .owner = THIS_MODULE }, + .show = show_user_voltage, + .store = store_user_voltage, +}; + static struct freq_attr* powernow_k8_attr[] = { &cpufreq_freq_attr_scaling_available_freqs, + &powernow_freq_attr_voltage_table, NULL, }; --------------060103010902090104080202--