tcp: add a sysctl to config the tcp_default_init_rwnd

The default initial rwnd was hardcoded to 10.

Now we allow it to be controlled via
  /proc/sys/net/ipv4/tcp_default_init_rwnd
which limits the values from 3 to 100

This is somewhat needed because ipv6 routes are
autoconfigured by the kernel.

See "An Argument for Increasing TCP's Initial Congestion Window"
in https://developers.google.com/speed/articles/tcp_initcwnd_paper.pdf

Change-Id: I7eac8a0a5133371aea9ecb9aec0b608bd7f2cc57
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs

With this set, a lot of dangerous operations (chroot, unshare, etc)
become a lot less dangerous because there is no possibility of
subverting privileged binaries.

This patch completely breaks apparmor.  Someone who understands (and
uses) apparmor should fix it or at least give me a hint.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	kernel/sys.c

Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	include/linux/prctl.h
Fix apparmor for PR_{GET,SET}_NO_NEW_PRIVS

Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Allow unprivileged CLONE_NEWUTS and CLONE_NEWIPC with no_new_privs

They are normally disallowed because they could be used to subvert
setuid programs.  But if setuid is disabled, then they are safe.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Allow unprivileged chroot when safe

Chroot can easily be used to subvert setuid programs.  If no_new_privs,
then setuid programs don't gain any privilege, so allow chroot.

Because chroot is an easy way to break out of chroot jail, CAP_SYS_ADMIN
is still required if the caller is already chrooted.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
OMAP4: PM: IVA AUTO RET relaxed workaround in idle path

AUTO RET for IVA VDD Cannot be permanently enabled during OFF mode due to
potential race between IVA VDD entering RET and start of Device OFF mode.

It is mandatory to have AUTO RET for IVA VDD exlusive with Devide OFF mode.
In order to avoid lockup in OFF mode sequence, system must ensure IVA
voltage domain transitions straight from stable ON to OFF.

In addition, management of IVA VDD SmartReflex sensor at exit of idle path
may introduce a misalignment between IVA Voltage Controller state and IVA
PRCM voltage FSM based on following identified scenario:

IVA Voltage Controller is woken-up due to SmartReflex management while
IVA PRCM voltage FSM stays in RET in absence of any IVA module wake-up event
(which is not systematic in idle path as opposed to MPU and CORE VDDs being
necessarily woken up with MPU and CORE PDs).

WA involves:
Ensure stable ON-OFF transition for IVA voltage domain during OFF mode sequence.
Ensure VCON and PRCM FSM are kept aligned due to IVA SR handling in idle path.
1) AUTO RET for IVA VDD is enabled entering in idle path, disabled exiting idle
   path and IVA VDD is always woken-up with a SW dummy wakeup.
2) OFF mode is enabled only in Suspend path.
3) AUTO RET for IVA VDD remains disabled in Suspend path (before OFF mode).

REVISIT: Update the patch once proper Errata is out for 44xx.

Benefits:
1) This patch ensures it is possible to gate SYS_CLK during OS-Idle LCD OFF
when all domains are idled, saving up to 2mA at VBAT from external clock buffer.

2) IVA voltage domain is now allowed to scale to Retention during idle which
reduces power consumption on all types of use case allowing extensive use of
idle path (e.g.: Home screen, Page reading). Effects are especially visible
if system uses Smart-Reflex Class 1.5 compared to Class 3 considering the
increased difference of voltage from converged Voltage SR vs Retention voltage.

TODO: quantify the actual savings from IVA-RET with further measurements.

Change-Id: I01f0431f7556f0baf0b5b6b42092cd11c2442f00
Signed-off-by: Cedric Vamour <c-vamour@ti.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	arch/arm/mach-omap2/pm44xx.c

Signed-off-by: Dan Trifan <jimsth@gmail.com>
OMAP2+: clock: Fix DPLL clock rounding

Function omap2_dpll_round_rate() succeeds only if it can find exact frequency.
But in current implmentations there are some frequencies that can't be rounded.
Function iterates frequencies that always lower than requested one.
For example 550MHz can be obtain from 38.4MHz reference by M=1375 and N=96,
but the closest MN pair that is tried is 1374/96.

It happens because of flooring scaled_rt_rp variable insted of rounding.
This patch should fix the issue.

Change-Id: Iceadcc695ac3376372b2fdaf29afe8f9454b891f
Signed-off-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
OMAP2+: clock: Round clock to the closest possible frequency.

Currently clock is always rounded to frequency that is <= required.
It leads to not the best divider selection if requested frequncy is
slightly lower than the closest possible frequency.

This patch makes the best possible divider to be choosen.

Change-Id: I732dbf3e2c910b041434ded0df78dd6f85b7c7f4
Signed-off-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
freezer: shorten freezer sleep time using exponential backoff

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
board-tuna-sensors.c: merge Kalim fix to toroplus compass bug.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
whoops
add iva oc

Conflicts:
	arch/arm/configs/nuked_defconfig
add missing attr
gpu oc interace from imoeyon
misc to opp4xxx_data
replace 384mhz with 307 and use trinity teuv voltage
drivers/gpu/pvr/pvr_governor: add a simple PVR GPU governor

this simple PVR GPU governor will scale between 3 speeds:
  idle -- GPU not active
  nominal -- GPU active with low graphical load
  turbo -- GPU active and boosted to max frequency

This should further save battery by intelligently selecting GPU frequency
based on GPU loading.

Signed-off-by: Paul Reioux <reioux@gmail.com>
drivers/gpu/pvr/pvr_governor: add sysfs entry to switch governor type

0 - "performance" ==> always return system turbo speed
1 - "ondemand" ==> return based on GPU loading (by default "ondemand"
governor is active)

Signed-off-by: Paul Reioux <reioux@gmail.com>
drivers/gpu/pvr/pvr_governor: add "powersave" governor as another option

    0 - "performance" ==> always return system turbo speed
    1 - "ondemand" ==> return based on GPU loading (by default "ondemand"
                       governor is active)
    2 - "powersave" ==> run alway at nominal speed

Signed-off-by: Paul Reioux <reioux@gmail.com>
drivers/gpu/pvr/pvr_governor: fix sysfs to show "powersave" governor

Signed-off-by: Paul Reioux <reioux@gmail.com>