-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Linus Torvalds
committed
Jan 12, 2012
1 parent
1d12c3b
commit 962edfd
Showing
335 changed files
with
23,631 additions
and
5,009 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 1c1744cc7cee83b96e3a89c1b9853fc033bafb9c | ||
refs/heads/master: 56c8bc3b7ed3d24c665e2ce992f86a5bedffc852 |
5 changes: 5 additions & 0 deletions
5
trunk/Documentation/devicetree/bindings/power_supply/olpc_battery.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
OLPC battery | ||
~~~~~~~~~~~~ | ||
|
||
Required properties: | ||
- compatible : "olpc,xo1-battery" |
23 changes: 23 additions & 0 deletions
23
trunk/Documentation/devicetree/bindings/power_supply/sbs_sbs-battery.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
SBS sbs-battery | ||
~~~~~~~~~~ | ||
|
||
Required properties : | ||
- compatible : "sbs,sbs-battery" | ||
|
||
Optional properties : | ||
- sbs,i2c-retry-count : The number of times to retry i2c transactions on i2c | ||
IO failure. | ||
- sbs,poll-retry-count : The number of times to try looking for new status | ||
after an external change notification. | ||
- sbs,battery-detect-gpios : The gpio which signals battery detection and | ||
a flag specifying its polarity. | ||
|
||
Example: | ||
|
||
bq20z75@b { | ||
compatible = "sbs,sbs-battery"; | ||
reg = < 0xb >; | ||
sbs,i2c-retry-count = <2>; | ||
sbs,poll-retry-count = <10>; | ||
sbs,battery-detect-gpios = <&gpio-controller 122 1>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Digital Signature Verification API | ||
|
||
CONTENTS | ||
|
||
1. Introduction | ||
2. API | ||
3. User-space utilities | ||
|
||
|
||
1. Introduction | ||
|
||
Digital signature verification API provides a method to verify digital signature. | ||
Currently digital signatures are used by the IMA/EVM integrity protection subsystem. | ||
|
||
Digital signature verification is implemented using cut-down kernel port of | ||
GnuPG multi-precision integers (MPI) library. The kernel port provides | ||
memory allocation errors handling, has been refactored according to kernel | ||
coding style, and checkpatch.pl reported errors and warnings have been fixed. | ||
|
||
Public key and signature consist of header and MPIs. | ||
|
||
struct pubkey_hdr { | ||
uint8_t version; /* key format version */ | ||
time_t timestamp; /* key made, always 0 for now */ | ||
uint8_t algo; | ||
uint8_t nmpi; | ||
char mpi[0]; | ||
} __packed; | ||
|
||
struct signature_hdr { | ||
uint8_t version; /* signature format version */ | ||
time_t timestamp; /* signature made */ | ||
uint8_t algo; | ||
uint8_t hash; | ||
uint8_t keyid[8]; | ||
uint8_t nmpi; | ||
char mpi[0]; | ||
} __packed; | ||
|
||
keyid equals to SHA1[12-19] over the total key content. | ||
Signature header is used as an input to generate a signature. | ||
Such approach insures that key or signature header could not be changed. | ||
It protects timestamp from been changed and can be used for rollback | ||
protection. | ||
|
||
2. API | ||
|
||
API currently includes only 1 function: | ||
|
||
digsig_verify() - digital signature verification with public key | ||
|
||
|
||
/** | ||
* digsig_verify() - digital signature verification with public key | ||
* @keyring: keyring to search key in | ||
* @sig: digital signature | ||
* @sigen: length of the signature | ||
* @data: data | ||
* @datalen: length of the data | ||
* @return: 0 on success, -EINVAL otherwise | ||
* | ||
* Verifies data integrity against digital signature. | ||
* Currently only RSA is supported. | ||
* Normally hash of the content is used as a data for this function. | ||
* | ||
*/ | ||
int digsig_verify(struct key *keyring, const char *sig, int siglen, | ||
const char *data, int datalen); | ||
|
||
3. User-space utilities | ||
|
||
The signing and key management utilities evm-utils provide functionality | ||
to generate signatures, to load keys into the kernel keyring. | ||
Keys can be in PEM or converted to the kernel format. | ||
When the key is added to the kernel keyring, the keyid defines the name | ||
of the key: 5D2B05FC633EE3E8 in the example bellow. | ||
|
||
Here is example output of the keyctl utility. | ||
|
||
$ keyctl show | ||
Session Keyring | ||
-3 --alswrv 0 0 keyring: _ses | ||
603976250 --alswrv 0 -1 \_ keyring: _uid.0 | ||
817777377 --alswrv 0 0 \_ user: kmk | ||
891974900 --alswrv 0 0 \_ encrypted: evm-key | ||
170323636 --alswrv 0 0 \_ keyring: _module | ||
548221616 --alswrv 0 0 \_ keyring: _ima | ||
128198054 --alswrv 0 0 \_ keyring: _evm | ||
|
||
$ keyctl list 128198054 | ||
1 key in keyring: | ||
620789745: --alswrv 0 0 user: 5D2B05FC633EE3E8 | ||
|
||
|
||
Dmitry Kasatkin | ||
06.10.2011 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
Charger Manager | ||
(C) 2011 MyungJoo Ham <myungjoo.ham@samsung.com>, GPL | ||
|
||
Charger Manager provides in-kernel battery charger management that | ||
requires temperature monitoring during suspend-to-RAM state | ||
and where each battery may have multiple chargers attached and the userland | ||
wants to look at the aggregated information of the multiple chargers. | ||
|
||
Charger Manager is a platform_driver with power-supply-class entries. | ||
An instance of Charger Manager (a platform-device created with Charger-Manager) | ||
represents an independent battery with chargers. If there are multiple | ||
batteries with their own chargers acting independently in a system, | ||
the system may need multiple instances of Charger Manager. | ||
|
||
1. Introduction | ||
=============== | ||
|
||
Charger Manager supports the following: | ||
|
||
* Support for multiple chargers (e.g., a device with USB, AC, and solar panels) | ||
A system may have multiple chargers (or power sources) and some of | ||
they may be activated at the same time. Each charger may have its | ||
own power-supply-class and each power-supply-class can provide | ||
different information about the battery status. This framework | ||
aggregates charger-related information from multiple sources and | ||
shows combined information as a single power-supply-class. | ||
|
||
* Support for in suspend-to-RAM polling (with suspend_again callback) | ||
While the battery is being charged and the system is in suspend-to-RAM, | ||
we may need to monitor the battery health by looking at the ambient or | ||
battery temperature. We can accomplish this by waking up the system | ||
periodically. However, such a method wakes up devices unncessary for | ||
monitoring the battery health and tasks, and user processes that are | ||
supposed to be kept suspended. That, in turn, incurs unnecessary power | ||
consumption and slow down charging process. Or even, such peak power | ||
consumption can stop chargers in the middle of charging | ||
(external power input < device power consumption), which not | ||
only affects the charging time, but the lifespan of the battery. | ||
|
||
Charger Manager provides a function "cm_suspend_again" that can be | ||
used as suspend_again callback of platform_suspend_ops. If the platform | ||
requires tasks other than cm_suspend_again, it may implement its own | ||
suspend_again callback that calls cm_suspend_again in the middle. | ||
Normally, the platform will need to resume and suspend some devices | ||
that are used by Charger Manager. | ||
|
||
2. Global Charger-Manager Data related with suspend_again | ||
======================================================== | ||
In order to setup Charger Manager with suspend-again feature | ||
(in-suspend monitoring), the user should provide charger_global_desc | ||
with setup_charger_manager(struct charger_global_desc *). | ||
This charger_global_desc data for in-suspend monitoring is global | ||
as the name suggests. Thus, the user needs to provide only once even | ||
if there are multiple batteries. If there are multiple batteries, the | ||
multiple instances of Charger Manager share the same charger_global_desc | ||
and it will manage in-suspend monitoring for all instances of Charger Manager. | ||
|
||
The user needs to provide all the two entries properly in order to activate | ||
in-suspend monitoring: | ||
|
||
struct charger_global_desc { | ||
|
||
char *rtc_name; | ||
: The name of rtc (e.g., "rtc0") used to wakeup the system from | ||
suspend for Charger Manager. The alarm interrupt (AIE) of the rtc | ||
should be able to wake up the system from suspend. Charger Manager | ||
saves and restores the alarm value and use the previously-defined | ||
alarm if it is going to go off earlier than Charger Manager so that | ||
Charger Manager does not interfere with previously-defined alarms. | ||
|
||
bool (*rtc_only_wakeup)(void); | ||
: This callback should let CM know whether | ||
the wakeup-from-suspend is caused only by the alarm of "rtc" in the | ||
same struct. If there is any other wakeup source triggered the | ||
wakeup, it should return false. If the "rtc" is the only wakeup | ||
reason, it should return true. | ||
}; | ||
|
||
3. How to setup suspend_again | ||
============================= | ||
Charger Manager provides a function "extern bool cm_suspend_again(void)". | ||
When cm_suspend_again is called, it monitors every battery. The suspend_ops | ||
callback of the system's platform_suspend_ops can call cm_suspend_again | ||
function to know whether Charger Manager wants to suspend again or not. | ||
If there are no other devices or tasks that want to use suspend_again | ||
feature, the platform_suspend_ops may directly refer to cm_suspend_again | ||
for its suspend_again callback. | ||
|
||
The cm_suspend_again() returns true (meaning "I want to suspend again") | ||
if the system was woken up by Charger Manager and the polling | ||
(in-suspend monitoring) results in "normal". | ||
|
||
4. Charger-Manager Data (struct charger_desc) | ||
============================================= | ||
For each battery charged independently from other batteries (if a series of | ||
batteries are charged by a single charger, they are counted as one independent | ||
battery), an instance of Charger Manager is attached to it. | ||
|
||
struct charger_desc { | ||
|
||
char *psy_name; | ||
: The power-supply-class name of the battery. Default is | ||
"battery" if psy_name is NULL. Users can access the psy entries | ||
at "/sys/class/power_supply/[psy_name]/". | ||
|
||
enum polling_modes polling_mode; | ||
: CM_POLL_DISABLE: do not poll this battery. | ||
CM_POLL_ALWAYS: always poll this battery. | ||
CM_POLL_EXTERNAL_POWER_ONLY: poll this battery if and only if | ||
an external power source is attached. | ||
CM_POLL_CHARGING_ONLY: poll this battery if and only if the | ||
battery is being charged. | ||
|
||
unsigned int fullbatt_uV; | ||
: If specified with a non-zero value, Charger Manager assumes | ||
that the battery is full (capacity = 100) if the battery is not being | ||
charged and the battery voltage is equal to or greater than | ||
fullbatt_uV. | ||
|
||
unsigned int polling_interval_ms; | ||
: Required polling interval in ms. Charger Manager will poll | ||
this battery every polling_interval_ms or more frequently. | ||
|
||
enum data_source battery_present; | ||
CM_FUEL_GAUGE: get battery presence information from fuel gauge. | ||
CM_CHARGER_STAT: get battery presence from chargers. | ||
|
||
char **psy_charger_stat; | ||
: An array ending with NULL that has power-supply-class names of | ||
chargers. Each power-supply-class should provide "PRESENT" (if | ||
battery_present is "CM_CHARGER_STAT"), "ONLINE" (shows whether an | ||
external power source is attached or not), and "STATUS" (shows whether | ||
the battery is {"FULL" or not FULL} or {"FULL", "Charging", | ||
"Discharging", "NotCharging"}). | ||
|
||
int num_charger_regulators; | ||
struct regulator_bulk_data *charger_regulators; | ||
: Regulators representing the chargers in the form for | ||
regulator framework's bulk functions. | ||
|
||
char *psy_fuel_gauge; | ||
: Power-supply-class name of the fuel gauge. | ||
|
||
int (*temperature_out_of_range)(int *mC); | ||
bool measure_battery_temp; | ||
: This callback returns 0 if the temperature is safe for charging, | ||
a positive number if it is too hot to charge, and a negative number | ||
if it is too cold to charge. With the variable mC, the callback returns | ||
the temperature in 1/1000 of centigrade. | ||
The source of temperature can be battery or ambient one according to | ||
the value of measure_battery_temp. | ||
}; | ||
|
||
5. Other Considerations | ||
======================= | ||
|
||
At the charger/battery-related events such as battery-pulled-out, | ||
charger-pulled-out, charger-inserted, DCIN-over/under-voltage, charger-stopped, | ||
and others critical to chargers, the system should be configured to wake up. | ||
At least the following should wake up the system from a suspend: | ||
a) charger-on/off b) external-power-in/out c) battery-in/out (while charging) | ||
|
||
It is usually accomplished by configuring the PMIC as a wakeup source. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Linux Security Module framework | ||
------------------------------- | ||
|
||
The Linux Security Module (LSM) framework provides a mechanism for | ||
various security checks to be hooked by new kernel extensions. The name | ||
"module" is a bit of a misnomer since these extensions are not actually | ||
loadable kernel modules. Instead, they are selectable at build-time via | ||
CONFIG_DEFAULT_SECURITY and can be overridden at boot-time via the | ||
"security=..." kernel command line argument, in the case where multiple | ||
LSMs were built into a given kernel. | ||
|
||
The primary users of the LSM interface are Mandatory Access Control | ||
(MAC) extensions which provide a comprehensive security policy. Examples | ||
include SELinux, Smack, Tomoyo, and AppArmor. In addition to the larger | ||
MAC extensions, other extensions can be built using the LSM to provide | ||
specific changes to system operation when these tweaks are not available | ||
in the core functionality of Linux itself. | ||
|
||
Without a specific LSM built into the kernel, the default LSM will be the | ||
Linux capabilities system. Most LSMs choose to extend the capabilities | ||
system, building their checks on top of the defined capability hooks. | ||
For more details on capabilities, see capabilities(7) in the Linux | ||
man-pages project. | ||
|
||
Based on http://kerneltrap.org/Linux/Documenting_Security_Module_Intent, | ||
a new LSM is accepted into the kernel when its intent (a description of | ||
what it tries to protect against and in what cases one would expect to | ||
use it) has been appropriately documented in Documentation/security/. | ||
This allows an LSM's code to be easily compared to its goals, and so | ||
that end users and distros can make a more informed decision about which | ||
LSMs suit their requirements. | ||
|
||
For extensive documentation on the available LSM hook interfaces, please | ||
see include/linux/security.h. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.