On Wed, 2013-01-09 at 16:04 +0000, Punit Agrawal wrote: > >> > >> I am not quite sure where to send this patch to get it included in Linaro. > >> But > >> you seem to have a few patches in this repo, so maybe you can apply this > >> one. > > > > Yes, I can do that. It looks like it copes OK for devices without any > > A7's but will give it a test to check that first :-) > I tried to ensure this was the case, but don't have anything other than > TC2, so testing on other devices is most appreciated.
I had to fix the line which gets the script called at boot: -service setirqaffinity /set_irq_affinity 0xc07 +service setirqaffinity /set_irq_affinity.sh 0xc07 and testing on TC2, A9, and big.LITTLE Fast Models shows IRQ affinities getting set as we expect, i.e. to A7 cores if they exist, otherwise to all cores. I spoke to someone about the possible issues with IKS (the In Kernel Switcher for big.LITTLE) and the conclusion was that this patch would be innocuous. After fixing some whitespace issues and adding that '.sh' into init.arm-versatileexpress I've pushed the change into Gerrit http://review.android.git.linaro.org/#change,3240 -- Tixy > >> > >> device.mk | 3 ++- > >> init.arm-versatileexpress.rc | 6 ++++++ > >> set_irq_affinity.sh | 45 > >> ++++++++++++++++++++++++++++++++++++++++++ > >> 3 files changed, 53 insertions(+), 1 deletion(-) > >> create mode 100755 set_irq_affinity.sh > >> > >> diff --git a/device.mk b/device.mk > >> index 6e6c6dd..9ca73e3 100644 > >> --- a/device.mk > >> +++ b/device.mk > >> @@ -9,7 +9,8 @@ PRODUCT_COPY_FILES += \ > >> device/linaro/vexpress/init.v2p-aarch64.rc:root/init.v2p-aarch64.rc \ > >> > >> device/linaro/vexpress/ueventd.v2p-aarch64.rc:root/ueventd.v2p-aarch64.rc \ > >> device/linaro/vexpress/init.vexpress.sh:system/etc/init.vexpress.sh \ > >> - device/linaro/vexpress/initlogo.rle:root/initlogo.rle > >> + device/linaro/vexpress/initlogo.rle:root/initlogo.rle \ > >> + device/linaro/vexpress/set_irq_affinity.sh:root/set_irq_affinity.sh > >> > >> PRODUCT_CHARACTERISTICS := tablet,nosdcard > >> > >> diff --git a/init.arm-versatileexpress.rc b/init.arm-versatileexpress.rc > >> index a71e491..d710f36 100644 > >> --- a/init.arm-versatileexpress.rc > >> +++ b/init.arm-versatileexpress.rc > >> @@ -33,6 +33,12 @@ on boot > >> chown system system /sys/class/graphics/fb0/fit_to_screen > >> chown system system /sys/class/graphics/fb1/overlays > >> > >> +# setup IRQ affinity to the A7s > >> +service setirqaffinity /set_irq_affinity 0xc07 > >> + class main > >> + user root > >> + oneshot > >> + > >> service faketsd /system/bin/faketsd > >> class main > >> user bluetooth > >> diff --git a/set_irq_affinity.sh b/set_irq_affinity.sh > >> new file mode 100755 > >> index 0000000..4a09d61 > >> --- /dev/null > >> +++ b/set_irq_affinity.sh > >> @@ -0,0 +1,45 @@ > >> +#!/system/bin/sh > >> + > >> +# This script sets the default affinity to the processors with the given > >> part id. > >> +# - part id is in hex (as seen in /proc/cpuinfo) > >> + > >> +function build_mask_from_part_id { > >> + local IFS > >> + local mask > >> + local ref_part_id > >> + > >> + ref_part_id=$1 > >> + IFS=$'\n' > >> + > >> + for line in `cat /proc/cpuinfo` > >> + do > >> + IFS=':' > >> + set -A tokens $line > >> + > >> + if [ "${line#'processor'}" != "$line" ] > >> + then > >> + cpu="${tokens[1]##' '}" > >> + elif [ "${line#'CPU part'}" != "$line" ] > >> + then > >> + part_id="${tokens[1]##' '}" > >> + > >> + if [ "$part_id" == "$ref_part_id" ] > >> + then > >> + (( mask |= 1 << $cpu )) > >> + fi > >> + fi > >> + done > >> + echo $(printf "%x" $mask) > >> +} > >> + > >> +ref_part_id=$(echo $1 | tr '[A-Z]' '[a-z]') > >> +mask=$(build_mask_from_part_id $ref_part_id) > >> +[ -z "$mask" ] && exit > >> + > >> +echo $mask > /proc/irq/default_smp_affinity > >> + > >> +for i in `ls /proc/irq` > >> +do > >> + affinity_file="/proc/irq/$i/smp_affinity" > >> + [ -e $affinity_file ] && echo $mask > $affinity_file > >> +done > >> -- > >> 1.7.9.5 > > > > > -- IMPORTANT NOTICE: The contents of this email and any attachments are > confidential and may also be privileged. If you are not the intended > recipient, please notify the sender immediately and do not disclose the > contents to any other person, use it for any purpose, or store or copy the > information in any medium. Thank you. > _______________________________________________ linaro-dev mailing list linaro-dev@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-dev