/* * Copyright (C) 2001, 2002 Andy Grover * Copyright (C) 2001, 2002 Paul Diefenbaugh * Copyright (C) 2002 - 2004 Dominik Brodowski * Copyright (C) 2006 Denis Sadykov * * Feb 2008 - Liu Jinsong * Add cpufreq limit change handle and per-cpu cpufreq add/del * to cope with cpu hotplug * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* TODO: change to link list later as domain number may be sparse */ static cpumask_t cpufreq_dom_map[NR_CPUS]; int cpufreq_limit_change(unsigned int cpu) { struct processor_performance *perf = &processor_pminfo[cpu]->perf; struct cpufreq_policy *data = cpufreq_cpu_policy[cpu]; struct cpufreq_policy policy; if (!cpu_online(cpu) || !data || !processor_pminfo[cpu]) return -ENODEV; if ((perf->platform_limit < 0) || (perf->platform_limit >= perf->state_count)) return -EINVAL; memcpy(&policy, data, sizeof(struct cpufreq_policy)); policy.max = perf->states[perf->platform_limit].core_frequency * 1000; return __cpufreq_set_policy(data, &policy); } int cpufreq_add_cpu(unsigned int cpu) { int ret = 0; unsigned int firstcpu; unsigned int dom; unsigned int j; struct cpufreq_policy new_policy; struct cpufreq_policy *policy; struct processor_performance *perf = &processor_pminfo[cpu]->perf; /* to protect the case when Px was not controlled by xen */ if (!processor_pminfo[cpu] || !(perf->init & XEN_PX_INIT)) return 0; if (!cpu_online(cpu) || cpufreq_cpu_policy[cpu]) return -EINVAL; ret = cpufreq_statistic_init(cpu); if (ret) return ret; dom = perf->domain_info.domain; if (cpus_weight(cpufreq_dom_map[dom])) { /* share policy with the first cpu since on same boat */ firstcpu = first_cpu(cpufreq_dom_map[dom]); policy = cpufreq_cpu_policy[firstcpu]; cpufreq_cpu_policy[cpu] = policy; cpu_set(cpu, cpufreq_dom_map[dom]); cpu_set(cpu, policy->cpus); printk(KERN_EMERG"adding CPU %u\n", cpu); } else { /* for the first cpu, setup policy and do init work */ policy = xmalloc(struct cpufreq_policy); if (!policy) { cpufreq_statistic_exit(cpu); return -ENOMEM; } memset(policy, 0, sizeof(struct cpufreq_policy)); cpufreq_cpu_policy[cpu] = policy; cpu_set(cpu, cpufreq_dom_map[dom]); cpu_set(cpu, policy->cpus); policy->cpu = cpu; ret = cpufreq_driver->init(policy); if (ret) goto err1; printk(KERN_EMERG"CPU %u initialization completed\n", cpu); } /* * After get full cpumap of t
#!/bin/sh
grep \^CONFIG_TARGET_ .config | head -n3 > tmp/.diffconfig.head
grep \^CONFIG_TARGET_DEVICE_ .config >> tmp/.diffconfig.head
grep '^CONFIG_ALL=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_ALL_KMODS=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_ALL_NONSHARED=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_DEVEL=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_TOOLCHAINOPTS=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_BUSYBOX_CUSTOM=y' .config >> tmp/.diffconfig.head
grep '^CONFIG_TARGET_PER_DEVICE_ROOTFS=y' .config >> tmp/.diffconfig.head
./scripts/config/conf --defconfig=tmp/.diffconfig.head -w tmp/.diffconfig.stage1 Config.in >/dev/null
./scripts/kconfig.pl '>+' tmp/.diffconfig.stage1 .config >> tmp/.diffconfig.head
./scripts/config/conf --defconfig=tmp/.diffconfig.head -w tmp/.diffconfig.stage2 Config.in >/dev/null
./scripts/kconfig.pl '>' tmp/.diffconfig.stage2 .config >> tmp/.diffconfig.head
cat tmp/.diffconfig.head
rm -f tmp/.diffconfig tmp/.diffconfig.head