summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-11-02 08:09:32 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-11-02 08:59:10 +0100
commit1ab627137edd3b05803280b5c682eca8dba6e0e2 (patch)
treeb9a1e005c19a159fb1bd267a3bdc2f211f65ba7b
parent735f0e1ad49fb2087c3387671b4c080b4a198d44 (diff)
nv-conf-systemd: cpu hot-plug configuration and startup
Systemd startup script for NVIDIA T30 CPU hot-plug configuration.
-rw-r--r--recipes-core/nv-conf/files/nv-conf.service12
-rw-r--r--recipes-core/nv-conf/files/nv-conf.sh35
-rw-r--r--recipes-core/nv-conf/nv-conf-systemd.bb32
3 files changed, 79 insertions, 0 deletions
diff --git a/recipes-core/nv-conf/files/nv-conf.service b/recipes-core/nv-conf/files/nv-conf.service
new file mode 100644
index 0000000..3226c6b
--- /dev/null
+++ b/recipes-core/nv-conf/files/nv-conf.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Enable NVIDIA T30 CPU Hot-Plugging
+DefaultDependencies=no
+After=sysinit.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/nv-conf.sh
+
+[Install]
+WantedBy=sysinit.target
diff --git a/recipes-core/nv-conf/files/nv-conf.sh b/recipes-core/nv-conf/files/nv-conf.sh
new file mode 100644
index 0000000..6376c5d
--- /dev/null
+++ b/recipes-core/nv-conf/files/nv-conf.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# NVIDIA specific init script
+
+# power state
+if [ -e /sys/power/state ]; then
+ chmod 0666 /sys/power/state
+fi
+
+# turn off low-power core migration for now
+if [ -e /sys/module/cpu_tegra3/parameters/no_lp ] ; then
+ echo Y > /sys/module/cpu_tegra3/parameters/no_lp
+fi
+
+# enable CPU hot-plugging
+if [ -e /sys/module/cpu_tegra3/parameters/auto_hotplug ] ; then
+ echo 1 > /sys/module/cpu_tegra3/parameters/auto_hotplug
+fi
+
+# lp2 idle state
+if [ -e /sys/module/cpuidle/parameters/lp2_in_idle ] ; then
+ echo "Y" > /sys/module/cpuidle/parameters/lp2_in_idle
+fi
+
+# mmc read ahead size
+if [ -e /sys/block/mmcblk0/queue/read_ahead_kb ]; then
+ echo 2048 > /sys/block/mmcblk0/queue/read_ahead_kb
+fi
+if [ -e /sys/block/mmcblk1/queue/read_ahead_kb ]; then
+ echo 2048 > /sys/block/mmcblk1/queue/read_ahead_kb
+fi
+if [ -e /sys/block/mmcblk2/queue/read_ahead_kb ]; then
+ echo 2048 > /sys/block/mmcblk2/queue/read_ahead_kb
+fi
+
+exit 0
diff --git a/recipes-core/nv-conf/nv-conf-systemd.bb b/recipes-core/nv-conf/nv-conf-systemd.bb
new file mode 100644
index 0000000..c592bc3
--- /dev/null
+++ b/recipes-core/nv-conf/nv-conf-systemd.bb
@@ -0,0 +1,32 @@
+SECTION = "sysinit"
+SUMMARY = "NVIDIA T30 CPU hot-plug configuration and startup"
+RDEPENDS_${PN} = ""
+# The license is meant for this recipe and the files it installs.
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
+
+PR = "r1"
+
+inherit allarch systemd
+
+SRC_URI = " \
+ file://nv-conf.sh \
+ file://nv-conf.service \
+"
+
+do_install() {
+ install -d ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/nv-conf.sh ${D}/${bindir}/
+
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/nv-conf.service ${D}${systemd_unitdir}/system
+}
+
+FILES_${PN} += " \
+ ${systemd_unitdir}/system \
+"
+
+NATIVE_SYSTEMD_SUPPORT = "1"
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "nv-conf.service"
+