platform/core/system/pass.git
7 years agopass: core: Remove unused udev module
Wook Song [Mon, 19 Jun 2017 03:57:31 +0000 (12:57 +0900)]
pass: core: Remove unused udev module

This patch removes currently unused udev module.

Change-Id: If230c74e12e42d253677c0e54aeb23ad66655f28
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: Remove unused pass.socket file
Chanwoo Choi [Fri, 16 Jun 2017 07:47:19 +0000 (16:47 +0900)]
pass: Remove unused pass.socket file

This patch just removes the unused pass.socket file.

Change-Id: I76a84018b81d0c6290d10a4b7becc8849709e7de
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Change permission from root to 'system_fw' uid/gid
Chanwoo Choi [Thu, 15 Jun 2017 10:00:56 +0000 (19:00 +0900)]
pass: Change permission from root to 'system_fw' uid/gid

This patch changes the permission from root to 'system_fw' uid/gid for PASS.
Basically, Tizen has the policy to reduce the number of root daemon
to protect the security issues. If PASS has the system_fw uid, it is enough
to handle the h/w resources.

Change-Id: I48aef3da083b6f1f4160ed166fdad89293acc5b6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Fix build warnings caused by unused variables 30/133630/3 accepted/tizen/unified/20170615.020700 submit/tizen/20170614.020920
Wook Song [Tue, 13 Jun 2017 03:03:13 +0000 (12:03 +0900)]
pass: gov: Fix build warnings caused by unused variables

This patch fixes build warnings, which are caused by unused variables,
in the __pass_governor_init and __pass_governor_exit functions.

Change-Id: I9609991e1ef3e2b8136467171a595a68ec000bc3
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agocore: edbus-handler: Eliminate unused code and dynamic memory allocation 29/133629/2
Wook Song [Tue, 13 Jun 2017 02:22:44 +0000 (11:22 +0900)]
core: edbus-handler: Eliminate unused code and dynamic memory allocation

This patch removes the unused code from edbus-handler. In addition,
dynamic memory allocation is also eliminated in order to avoid the
possibility of memory leak.

Change-Id: I7d16b4aac56e2cb59b920db52db6c70a5b445147
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: pmqos: Modify log when the received scenario is not supported 86/133486/4
Chanwoo Choi [Mon, 12 Jun 2017 11:03:15 +0000 (20:03 +0900)]
pass: pmqos: Modify log when the received scenario is not supported

This patch modifies the log when the received scenario is not supported
as following:

1. Remove 'Lock' and 'Unlock' word from scenario name.
- Before : "Unknown scenario (SIOPLock) for 'cpu0' resource"
- After  : "Unknown scenario (SIOP) for 'cpu0' resource"

2. Use 'Not supported' instead of 'cannot support'.
- Before : "cannot support 'AppLaunch' scenario for 'cpu0' resource"
- After  : "Not supported 'AppLaunch' scenario for 'cpu0' resource"

Change-Id: Ibeeb0f2fba3fc46e27fc1e2b16b74d167d83c3e7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Fix bug of 'support' property of pass-pmqos.conf 75/133475/1
Chanwoo Choi [Mon, 12 Jun 2017 10:28:43 +0000 (19:28 +0900)]
pmqos: Fix bug of 'support' property of pass-pmqos.conf

This patch fixes the bug related to 'support' property of pass-pmqos.conf.

PASS PMQoS has the pass-pmqos.conf which contains the supported scenario
name and the number of supported scenarios. Each scenario has the 'support'
property indicating whether scenario is supported or not on platform.

If the 'support' property value is changed from 'yes' to 'no',
PASS shows the following error log during the init step.
[error log]
 edbus-handler.c: register_method(713) > fail to add method (null)!
 edbus-handler.c: register_edbus_method(862) > fail to register /Org/Tizen/System/Pass/Pmqos method(-22)
 pmqos.c: pmqos_init_done(395) > fail to init edbus method from conf(-22)

Change-Id: Icbb0d29c941345f21c3bcc4ae513ff73095a3aff
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Remove hard-coded scenario names 74/133474/1
Chanwoo Choi [Fri, 9 Jun 2017 08:49:53 +0000 (17:49 +0900)]
pmqos: Remove hard-coded scenario names

This patch removes the hard-coded scenario names and unused functions.
When you want to add or remove the scenarios, you have to modify
the /etc/pass/pass-pmqos.conf file without any changes of pmqos code.

Change-Id: Ia267b4de362746aa370b94ed53ad783ad7ff6954
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unneeded log message 08/133208/1
Chanwoo Choi [Fri, 9 Jun 2017 07:32:44 +0000 (16:32 +0900)]
pass: Remove unneeded log message

This patch removes the unneeded and duplicate log messages
in order to simplify the log during init/exit of PASS.

Also, this patch shows the supported scenarios except for un-supported
scenarios.

Change-Id: I5053e9b5b323ed2eb3a83c4ec0418995cbecf9a7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Staticize set_pmqos function 98/133198/1
Chanwoo Choi [Fri, 9 Jun 2017 06:58:46 +0000 (15:58 +0900)]
pmqos: Staticize set_pmqos function

The set_pmqos is accessed only in this file so it can be made as static.

Change-Id: I3e836c8a4d4c3a17621a21b6ad3cc57767397df0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Specify the resource name on log message 97/133197/1
Chanwoo Choi [Fri, 9 Jun 2017 06:50:04 +0000 (15:50 +0900)]
pass: pmqos: Specify the resource name on log message

This patch just adds the correct resource name to pmqos's log message
in order to improve the readability of pmqos's operation.

Example,
- Before: "cannot support 'AppLaunch' scenario (support=0)"
- After : "cannot support 'AppLaunch' scenario for 'cpu0' resource"

Change-Id: Ie337e73a5b310fc72428a7bfce1d5690f07a2863
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: Modify device notifier registering/unregistering mechanism 83/129883/4
Wook Song [Thu, 18 May 2017 08:07:37 +0000 (17:07 +0900)]
core: Modify device notifier registering/unregistering mechanism

This patch modifies the registering and unregistering mechanism of
device_notifier to use a static array instead of dynamically allocated
memory. A bug in the unregister_notifier function is also fixed. Since
the prototype of the function is changed, all locations where this
function is called are also slightly modified.

Change-Id: Iac5afc5f5c283f277220ac49d173bf420e3fb4ee
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agohal: Add new argument of resource name to close and open function 98/127098/2 accepted/tizen/unified/20170426.200227 submit/tizen/20170426.080126 tizen_4.0.m1_release
Chanwoo Choi [Wed, 26 Apr 2017 07:09:44 +0000 (16:09 +0900)]
hal: Add new argument of resource name to close and open function

The open and close functions in the struct pass_resource_info
are used to get/put the h/w resource. And the open and close
functions in the hal implementation save/restore the h/w
resource state. In this case, these functions need the unique
resource name in order to identify the h/w resource.

Change-Id: Icd7977619ed1f09186756a7cacf2c801c4284f1a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Add a function for putting resource 88/121688/3
Wook Song [Tue, 28 Mar 2017 08:08:36 +0000 (17:08 +0900)]
pass: hal: Add a function for putting resource

This patch adds the pass_put_resource function, which is paired up with
pass_get_resource(). When the main daemon is terminated, every hardware
resources resources (which are opened by pass_get_resource()) are closed
via HAL by this function.

Change-Id: I454d931979c5753ad070c44e58e9256429e6f7f7
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopackaging: Remove the ExclusiveArch keyword from pass.spec 25/125125/1 accepted/tizen/unified/20170414.042950 submit/tizen/20170414.022712
Chanwoo Choi [Fri, 14 Apr 2017 01:07:05 +0000 (10:07 +0900)]
packaging: Remove the ExclusiveArch keyword from pass.spec

The commit c2af7de627fef ("packaging: Remove unneeded script code")
used the 'ExclusiveArch' keyword for both armv7l and aarch64 architecture.
It is wrong patch because PASS is common daemon for all profiles and
architectures.

So, this patch remove the specific ExclusiveArch keyword
in order to remove the specific build dependency.

Change-Id: Ia3d33fe2ca2a2ad40d4ed729f42725ae89fe70a9
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove duplicate log when failed to read configuration file 69/124969/3
Chanwoo Choi [Thu, 13 Apr 2017 06:38:12 +0000 (15:38 +0900)]
pass: Remove duplicate log when failed to read configuration file

This patch just removes the duplicate log message. The same meaning logs
makes the confusion.

[Before]
config-parser.c: config_parse(66) > Failed to open file /etc/pass/pass.conf
config-parser.c: config_parse(126) > Failed to read /etc/pass/pass.conf:0!
pass-parser.c: pass_parse_resource(637) > cannot parse /etc/pass/pass.conf
pass.c: pass_init_done(226) > cannot parse /etc/pass/pass.conf
config-parser.c: config_parse(66) > Failed to open file /etc/pass/pass-pmqos.conf
config-parser.c: config_parse(126) > Failed to read /etc/pass/pass-pmqos.conf:0!
pmqos-parser.c: pmqos_get_scenario(156) > failed to load conficuration file(/etc/pass/pass-pmqos.conf) : -5
pmqos.c: pmqos_init_done(497) > failed to load configuration file(/etc/pass/pass-pmqos.conf)

[After]
pass.c: pass_init_done(226) > cannot parse /etc/pass/pass.conf
pmqos.c: pmqos_init_done(497) > failed to load configuration file(/etc/pass/pass-pmqos.conf)

Change-Id: I5b40c199811abf3db9b51d2801e523f8eedaf8a6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: Remove unused code related to run child process 66/124266/1 accepted/tizen/unified/20170412.153331 submit/tizen/20170412.073908
Chanwoo Choi [Tue, 11 Apr 2017 04:24:55 +0000 (13:24 +0900)]
core: Remove unused code related to run child process

This patch just removes the unused code related to run child process.

Change-Id: I563ec183733520a4dd391d5c7f5c02b386bf04b7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopackaging: Remove unneeded script code 07/121207/2 accepted/tizen_mobile accepted/tizen/mobile/20170328.053617 accepted/tizen/unified/20170328.053650 submit/tizen/20170328.004502
Chanwoo Choi [Mon, 27 Mar 2017 08:16:20 +0000 (17:16 +0900)]
packaging: Remove unneeded script code

This patch removes the unneeded script code in the pass.spec file
and add the 'ExclusiveArch' defintion to build the pass only for
both {arm} and aarch64 architecture.

Change-Id: Id3cbb54b2fd4e18d9e909dbf54165ecbf2a7403d
Suggested-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoshared: systemd: Fix use-after-free and double-free defects 74/120074/5
Wook Song [Tue, 21 Mar 2017 06:51:12 +0000 (15:51 +0900)]
shared: systemd: Fix use-after-free and double-free defects

This patch fixes the following code-leve defects according to static
program analysis result:

1. USE_AFTER_FREE: A pointer variable is used after the referenced
memory was deallocated by calling function 'free'.
2. DOUBLE_FREE.EX: A pointer is passed to the function 'free' after the
referenced memory was deallocated.

Change-Id: Ieef15d3432fb72068b9186c5807fedd1685ee79a
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: common: Fix defects including integer overflow case 89/119489/5
Wook Song [Fri, 17 Mar 2017 05:31:52 +0000 (14:31 +0900)]
core: common: Fix defects including integer overflow case

This patch fixes the following code-level defects according to static
program analysis result:

1. NONTERMINATED_STRING: Copying from string to a buffer without null
termination by calling function 'strncpy'.
2. INTEGER_OVERFLOW: Possible integer overflow.

Change-Id: Iee3ed333393fa44cd0c2f4c38431fc833898b30c
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Fix defects including the case that the handle could be lost 88/119488/4
Wook Song [Fri, 17 Mar 2017 01:53:50 +0000 (10:53 +0900)]
pass: hal: Fix defects including the case that the handle could be lost

This patch fixes the following code-level defects according to static
program analysis result:

1. NULL_AFTER_DEREF: A pointer which was dereferenced is compared to
NULL value.
2. HANDLE_LEAK: A handle was created by calling function 'fopen' and
lost at some point.
3. NO_EFFECT: the entire array is compared to 0.
4. NO_CAST.INTEGER_OVERFLOW: Values of an arithmetic expression could be
subject to overflow due to a failure to cast operands to a larger data
type before perfoming arithmetic overflow before widen.

Change-Id: Icd25de37efc3b52aacece3476e697486a1934c3a
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Fix strcpy use and memory leak defects 87/119487/4
Wook Song [Thu, 16 Mar 2017 09:25:06 +0000 (18:25 +0900)]
pmqos: Fix strcpy use and memory leak defects

This patch fixes the following code-level defects according to static
program analysis result:

1. PROC_USE.VULNERABLE: Use of vulnerable function 'strcpy'. For better
security, using strncpy is recommended instead of strcpy.
2. MEMORY_LEAK.EX: Dynamic memory was allocated by calling function
'calloc' and lost at some point.

Change-Id: Ie58bb7073254935b24257f8c9db19dd04c8b25f8
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Fix various defects including nonterminated string cases 66/119266/5
Wook Song [Thu, 16 Mar 2017 06:56:10 +0000 (15:56 +0900)]
pass: parser: Fix various defects including nonterminated string cases

This patch fixes the following code-level defects according to static
program analysis result:

1. PROC_USE.VULNERABLE: Use of vulnerable function 'strcpy'. For better
security, using strncpy is recommended instead of strcpy.
2. UNREACHABLE_CODE: The statement in the source code might be
unreachable during program execution.
3. DEREF_AFTER_NULL.EX: After having been compared to NULL value, some
pointers are dereferenced.
4. NONTERMINATED_STRING: Copying from string to a buffer without null
termination by calling function 'strncpy'.
5. TAINTED_INT.LOOP.MIGHT: Integer value obtained from untrusted source
without checking its higher bound is used as a loop bound.
6. TAINTED_INT/TAINTED_INT.MIGHT: Integer value obtained from untrusted
source without checking its higher bound is used in a trusted operation
by calling function 'calloc'.

Change-Id: Ic24ac658af88c109a22664c7c03eb2c43e8e23c4
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: parser: Fix defects such as tainted integer and use of strcpy 53/118953/5
Wook Song [Wed, 15 Mar 2017 02:00:17 +0000 (11:00 +0900)]
pmqos: parser: Fix defects such as tainted integer and use of strcpy

This patch fixes the following code-level defects according to static
program analysis result:

1. PROC_USE.VULNERABLE: Use of vulnerable function 'strcpy'. For better
security, using strncpy is recommended.
2. TAINTED_INT: Integer value obtained from untrusted source without checking
its higher bound is used in a trusted operation by calling function 'calloc'.

Change-Id: I423c8dcc6cb720673f2c754a39204e140fdb9e79
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove dead-code related to the number of cpu 98/118398/1
Chanwoo Choi [Fri, 10 Mar 2017 07:33:17 +0000 (16:33 +0900)]
pass: Remove dead-code related to the number of cpu

This patch just removes the dead code which is related to the number of CPU
in the same cluster. The pass uses the 'num_cpus' variable of the 'struct
pass_hotplug'.

Change-Id: I6775124230d45f572e99bdb070b786267d6c8c68
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Add callbacks for dbus messages 53/117153/5
Wook Song [Fri, 3 Mar 2017 03:48:25 +0000 (12:48 +0900)]
pmqos: Add callbacks for dbus messages

This patch adds the callback functions for dbus messages that start and
stop the pmqos module.

Change-Id: I6a9203a766469c49ff9b9b96eb594082057288d7
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Move registration of booting-done callback to probe 51/117151/5
Wook Song [Fri, 3 Mar 2017 01:15:52 +0000 (10:15 +0900)]
pmqos: Move registration of booting-done callback to probe

This patch moves the registration of a callback for the booting-done
event from the pmqos_init() function to the pmqos_probe() function,
which is newly added. This booting-done callback is renamed to
pmqos_init_done and slightly modified.

Change-Id: If8b1de698ab03257b5fd67081cad1101c06e47d7
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Add init_done and exit_done callbacks 52/116552/7
Wook Song [Fri, 24 Feb 2017 07:36:41 +0000 (16:36 +0900)]
pass: Add init_done and exit_done callbacks

This patch adds init_done and exit_done callbacks to the pass module.
These callbacks are in charge of actual initialization and finalization
of the daemon, instead of the init and exit functions. Callback
functions for dbus messages such as start and stop are also modified to
use the init_done and exit_done functions now. Especially, the init_done
is registered as a booting-done callback at the probe time.

Change-Id: I2f1a929b8b0b6b64b877c3f627d30af42bb26cfb
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: pmqos: Prevent from accessing variables before initialization 90/116790/5
Wook Song [Tue, 28 Feb 2017 06:54:07 +0000 (15:54 +0900)]
pass: pmqos: Prevent from accessing variables before initialization

This patch modifies the callback function of DEVICE_NOTIFIER_PMQOS
notifier to prevent from accessing variables before their
initialization.

Change-Id: Idc8a760ec8a6a53a1cfbc34f17626ea6c186ed57
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Modify timer interval setting mechanism 89/116789/5
Wook Song [Tue, 28 Feb 2017 08:15:11 +0000 (17:15 +0900)]
pass: gov: Modify timer interval setting mechanism

This patch modifies the timer setting mechanism for the governor to
select either the level-specific timer interval or the default one. The
default timer interval is used when the gov_timeout does not appear in
the Level section of the resource configuration file.

Change-Id: Id1b9d31a3249846ee59b34d00cb41f126440f5bc
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove policy-specific data from struct pass_governor 88/116788/5
Wook Song [Tue, 28 Feb 2017 05:38:59 +0000 (14:38 +0900)]
pass: Remove policy-specific data from struct pass_governor

This patch removes policy-specific data from struct pass_governor. The
policy-specific data should be included in struct pass_policy only.

Change-Id: Id9bd77e9dbd8b0668170696b40a0d40c9c166e42
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Add gov_timeout to Level section in resource conf file 87/116787/5
Wook Song [Tue, 28 Feb 2017 05:19:07 +0000 (14:19 +0900)]
pass: parser: Add gov_timeout to Level section in resource conf file

This patch adds a gov_timeout entry to the Level section in the resource
configuration file. Comparing with pass_gov_timeout in the Pass section,
this entry indicates the timer interval for a specific level. If this
entry does not appear in the Level section, the value of
pass_gov_timeout will be assigned to the governor timer interval for
that level by default.

Change-Id: I57ed24f8666711c11c3ceeeeaab9bfcc13c550a1
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Add new PASS_GOV_BASIC type and adjust the unique number of governor 83/116583/2
Chanwoo Choi [Fri, 17 Feb 2017 06:25:43 +0000 (15:25 +0900)]
pass: Add new PASS_GOV_BASIC type and adjust the unique number of governor

This patch adds new PASS_GOV_BASIC type which uses the 'HAL interface'
and 'Resource controller'. For example, the bus/gpu resources use
this governor type in order to control the min/max frequency
when pass recevies the pmqos debus message with scenario name.

* Detailed description according to each governor type:
---------------------------------------------------------------------------
| Governor name    | HAL       | Resource   | Hotplug   | Runtime         |
|                  | interface | controller | interface | governor        |
 --------------------------------------------------------------------------
| GOV_DUMMY        | Used      | Un-used    | Un-used   | Un-used         |
| GOV_BASIC        | Used      | Used       | Un-used   | Un-used         |
| GOV_HOTPLUG_ONLY | Used      | Used       | Used      | Un-used         |
| GOV_RADIATION    | Used      | Used       | Used      | Used (Radiation)|
| GOV_STEP         | Used      | Used       | Used      | Used (Step)     |
---------------------------------------------------------------------------

* Detailed description according to PASS's feature:
- HAL interface      : Call the HAL implementation such as pass-hal-(board).rpm
- Resource controller: Control the h/w resource such as CPU/BUS/GPU resource.
- Hotplug interface  : Turn on/off the CPU h/w resource.
- Runtime governor   : Monitor the system status and then decide the proper
                       level. After deciding the level, it control the h/w
       resource by using both 'Resource controller' and
       'Hotplug interface'.

Change-Id: I3b7d7a8f5142baa409cbbfe221afad8decfb2149
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Add missing pmqos_put_scenario for freeing data 71/116371/3
Wook Song [Fri, 24 Feb 2017 04:26:09 +0000 (13:26 +0900)]
pmqos: Add missing pmqos_put_scenario for freeing data

This patch adds missing pmqos_put_scenario function calls for avoiding
possible memory leaks.

Change-Id: If3372c279d8115106c9e9cf96a205d080759f7a5
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopmqos: parser: Initialize number of scenarios in pmqos_put_scenario 70/116370/2
Wook Song [Fri, 24 Feb 2017 02:04:39 +0000 (11:04 +0900)]
pmqos: parser: Initialize number of scenarios in pmqos_put_scenario

This patch adds initialization of the variable that indicates the
number of scenarios to the pmqos_put_scenario function.

Change-Id: I22a041054324f0def2db0781c123471a0832de7e
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopmqos: Add cleanup function on normal exit 44/116144/3
Wook Song [Thu, 23 Feb 2017 05:55:27 +0000 (14:55 +0900)]
pmqos: Add cleanup function on normal exit

This patch adds a cleanup function, that frees all the dynamically
allocated data and assigns 0 to the static variables. This cleanup
function is invoked when the pmqos module is normally terminated.

Change-Id: I0471f3ca13a4ba8a385b7829afab16dbf68f4988
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agocore: Add macro which wraps g_list_free_full() 43/116143/1
Wook Song [Thu, 23 Feb 2017 05:37:09 +0000 (14:37 +0900)]
core: Add macro which wraps g_list_free_full()

This patch adds a macro which wraps g_list_free_full(). This functions
frees all the dynamically-allocated data in the GList element so that we
can use it to clean up GLists well.

Change-Id: I2fd538f39620ca1044b5ba3046a8a82a8bd598c4
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agoshared: Add missing free for avoiding memory leaks 42/116142/1
Wook Song [Wed, 22 Feb 2017 01:58:24 +0000 (10:58 +0900)]
shared: Add missing free for avoiding memory leaks

This patch adds missing free() for avoiding possible memory leaks in the
shared directory.

Change-Id: Ie95db189d3d94d08d865ad3d7470d801b47c6dc1
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: Fix build warnings 25/114825/2
Wook Song [Wed, 15 Feb 2017 07:35:56 +0000 (16:35 +0900)]
pass: Fix build warnings

This patch fixes build warnings caused by unused variables.

Change-Id: I5fbd470a4f76571638815a2a9174fa28b138a75c
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: parser: Add parsing of pass_path_compatible 53/114753/5
Wook Song [Wed, 15 Feb 2017 03:41:20 +0000 (12:41 +0900)]
pass: parser: Add parsing of pass_path_compatible

This patch adds a parsing mechanism for the new mandatory entry,
pass_path_compatible, in the PassResource section of the pass.conf file.
This entry indicates the path where the pass can get the compatible
board information.

Change-Id: Ib4e12d8500d62585682319c18af38727e4aa6bac
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: parser: Remove parsing of pass_compatible in resource conf 28/114628/5
Wook Song [Tue, 14 Feb 2017 08:28:03 +0000 (17:28 +0900)]
pass: parser: Remove parsing of pass_compatible in resource conf

This patch removes the parsing mechanism for the entry, pass_compatible,
in the Pass section of the resource conf file.

Change-Id: I27894e8cb97f798d29f215ee04a9c6af1fa51087
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: hal: Remove unused pass_get_num_cpus() 78/114678/1
Chanwoo Choi [Tue, 14 Feb 2017 04:17:18 +0000 (13:17 +0900)]
pass: hal: Remove unused pass_get_num_cpus()

This patch remvoes the unused pass_get_num_cpus() which get
the maximum number of possible online cpus. After applying
the commit 86cd810d6e1a ("pass: Add new helper function to
handle the h/w resource through hal interface"), the core
uses the 'num_cpus' field in the struct pass_conf_data
instead of the pass_get_num_cpus().

Change-Id: I234bace1c199c03ce1a1f7e4d0b933633b6198d6
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Fix minor typo of comment 77/114677/1
Chanwoo Choi [Tue, 14 Feb 2017 01:15:44 +0000 (10:15 +0900)]
pass: Fix minor typo of comment

This patch just the minor typo (hotplulg -> hotplug).

Change-Id: I3afb20902936397ba02521921ced9d78fc8caf37
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Add setting the minimum number of online CPUs to hotplugging 41/114541/2
Wook Song [Tue, 14 Feb 2017 02:17:15 +0000 (11:17 +0900)]
pass: gov: Add setting the minimum number of online CPUs to hotplugging

This patch adds the invocation of the hal interface function that sets
the minimum number of online CPUs to the function in charge of the
hotplugging feature. Since the hotplugging feature in PASS was
implemented by considering the only case that it is supported by the
standard interface of the kernel, it could not handle the case that the
hotplugging feature is separately supported by the kernel. After
applying this patch, the hotplugging feature can flexibly handle such
cases.

Change-Id: I0bbfdd586601597fdee81a0a3f185fe2d8012d9d
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: hal: Add helper functions for the min/max number of online CPUs 40/114540/1
Wook Song [Tue, 14 Feb 2017 02:10:37 +0000 (11:10 +0900)]
pass: hal: Add helper functions for the min/max number of online CPUs

This patch adds new helper functions to handle the minimum and maximum
number of the online CPUs.

Change-Id: I209378b5366743ee45877a40f797a804e94fd4ff
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Add hal functions to handle the min/max number of online cpus 39/114539/1
Wook Song [Tue, 14 Feb 2017 01:59:04 +0000 (10:59 +0900)]
hal: Add hal functions to handle the min/max number of online cpus

This patch adds hal functions that set and get the the minimum/maximum
number of online CPUs in the CPU resourse.

Change-Id: Idcc6f50fd3f3e8f2877124941d68e772bb257f13
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: Clean up duplicate variables for num_cpus 17/114517/2
Wook Song [Mon, 13 Feb 2017 09:03:43 +0000 (18:03 +0900)]
pass: Clean up duplicate variables for num_cpus

This patch cleans up duplicate variables meaning number of CPUs in a
resource. From now, there are only two variables that indicate the
number of CPUs. One is num_cpus in struct pass_conf_data and this is the
value from the resource conf file. The other is the num_cpus in struct
pass_hotplug and this means the possible maximum number of online CPUs.
Currently, the values of these two variables are equivalently assigned
the value in the conf file.However, the latter would be changed by the
upcoming patch as its original intention.

Change-Id: I289247d7dd5611ccfb2030dc5eeefdda83408307
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: gov: Add new GOV_HOTPLUG_ONLY definition 40/114340/1
Chanwoo Choi [Mon, 13 Feb 2017 02:06:29 +0000 (11:06 +0900)]
pass: gov: Add new GOV_HOTPLUG_ONLY definition

This patch adds the new GOV_HOTPLUG_ONLY definition which uses
the hotplug interface for h/w resource such as CPU without
the runtime governors such as GOV_RADIATION, GOV_STEP.

- Detailed description of the PASS governor
: The PASS governor contains both the hotplug and runtime governor
for each resource
------------------------------------------------------------------
Governor name    | Hotplug interface | PASS Runtime governor     |
------------------------------------------------------------------
GOV_DUMMY        | Un-used           | Un-used                   |
GOV_HOTPLUG_ONLY | Used              | Un-used                   |
GOV_RADIATION    | Used              | Used (Radiation governor) |
GOV_STEP         | Used              | Used (Step governor)      |
------------------------------------------------------------------

For example,
- GOV_DUMMY        for TM1/TM2's BUS/GPU resource
- GOV_HOTPLUG_ONLY for TM1's CPU resource
- GOV_RADIATION    for TM2's big.LITTLE CPU resource
- GOV_STEP         for TM2's big.LITTLE CPU resource

Change-Id: Id8caebcf32f00a19dbf63192a6d952384df21bf7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Add the support for multiple scenarios at the same time 76/114176/2
Chanwoo Choi [Fri, 10 Feb 2017 07:30:47 +0000 (16:30 +0900)]
pass: pmqos: Add the support for multiple scenarios at the same time

The PMQoS has the following policy to support the multiple scenarios
at the same time.
- Policy to maintain the current/minimum/maximum level according to scenario:
: If there are the locked scenarios, the PMQoS maintains the largest value of
both min_level and max_level among the locked scenarios in order to support
the high-performance.

For exampel,
Default.   min_level(0) max_level(4) -> range of min/max: 0 ~ 4, curr_level (3)
Lock scn1. min_level(3) max_level(5) -> range of min/max: 3 ~ 5
Lock scn2. min_level(2) max_level(8) -> range of min/max: 3 ~ 8
Lock scn3. min_level(6) max_level(7) -> range of min/max: 6 ~ 8
Unlock scn2.                         -> range of min/max: 6 ~ 8
Unlock scn1.                         -> range of min/max: 6 ~ 8
Unlock scn3.                         -> range of min/max: 6 ~ 8
Unlock all scenarios.                -> range of min/max: 0 ~ 4, curr_level (3)

Second,
This patch changes the definition of pass_governor_change_level_scope()
as following: When this function is called, the desired level should
be passed as the first parameter.
- Before
int pass_governor_change_level_scope(struct pass_policy *policy,
int min_level, int max_level)
- After
int pass_governor_change_level_scope(struct pass_policy *policy,
int new_level, int min_level, int max_level)

Change-Id: Ib61bd408747d91d3bcb3b4326e69b56ade46daf2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Remove the duplicate conditional statement 75/114175/2
Chanwoo Choi [Fri, 10 Feb 2017 05:01:41 +0000 (14:01 +0900)]
pass: pmqos: Remove the duplicate conditional statement

The pass_notifier_pmqos_func has the duplicate 'if' statement
for locked state. This patch removes the duplicate conditional statement.

And, this patch moves the call of pass_governor_change_level_scope()
before prining the locked/unlocked log in order to provide the
more correct timing information.

Change-Id: I012013575bb6846065aa7ea3cafa401863c7451a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove the configuration file of resoures 91/114291/1
Chanwoo Choi [Mon, 13 Feb 2017 01:12:58 +0000 (10:12 +0900)]
pass: Remove the configuration file of resoures

This patch removes the configuration file of resources and then
moves them to the pass-hal-(board name).git repository because
the configuration files contain the specific h/w information.

Change-Id: Ifefb40a0ec26f7775f516ed2e955cf5fd2d9b4a0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopackaging: Modify spec file to include d-bus conf 50/114150/1
Wook Song [Fri, 10 Feb 2017 07:06:24 +0000 (16:06 +0900)]
packaging: Modify spec file to include d-bus conf

This patch modifies the spec file for packaging to include the d-bus
conf file.

Change-Id: Iff9d7f5b64787e25bcec3a772955b550f928c138
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: gov: Fix wrong description and remove specific resource name 63/113963/3
Chanwoo Choi [Thu, 9 Feb 2017 10:54:34 +0000 (19:54 +0900)]
pass: gov: Fix wrong description and remove specific resource name

This patch justs fixes the wrong description and remove the specific
resource name to improve the readability of comments on a text.

Change-Id: I0356b210a97f7325e2d13f7d10e7eab1669f3288
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove the unneeded debug log 48/113948/3
Chanwoo Choi [Thu, 9 Feb 2017 10:23:45 +0000 (19:23 +0900)]
pass: Remove the unneeded debug log

This patch removes the uneeded debug log because this log is used
for only CPU resource. If there is error, pass_get_hotplug() function
will print the error message.

Change-Id: I3109398a2a6ffe33f348838200082cd0a26a6321
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Remove unused code 47/113947/1
Chanwoo Choi [Thu, 9 Feb 2017 06:28:48 +0000 (15:28 +0900)]
pass: pmqos: Remove unused code

This patch removes the unused code.

Change-Id: Ide74984d7a0160c458894f3d80851b40b8243f1e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Rename struct pass_cpufreq_policy to pass_freq_policy 45/113945/1
Chanwoo Choi [Thu, 9 Feb 2017 10:12:15 +0000 (19:12 +0900)]
pass: gov: Rename struct pass_cpufreq_policy to pass_freq_policy

This patch renames 'struct pass_cpufreq_policy' to 'struct pass_freq_policy'
in order to remove the specific h/w dependency from name of structure.
This structure is used for all DVFS resources such as CPU, BUS and GPU.
- struct pass_cpufreq_policy cpufreq -> struct pass_freq_policy freq

Change-Id: I39560cc3f10846cd8f280b60eb8dbf78afb3e19c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agohal: Make separate pass-hal-devel package 88/113288/1
Wook Song [Tue, 7 Feb 2017 05:37:03 +0000 (14:37 +0900)]
hal: Make separate pass-hal-devel package

This patch makes a separate package for pass-hal-devel. This package
includes header files to build the board-specific pass-hal packages.

Change-Id: Ia0581023a588ff7a1d39549c23a56268c808417d
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Add define directive for BUFF_MAX to hal.h 87/113287/1
Wook Song [Tue, 7 Feb 2017 02:10:57 +0000 (11:10 +0900)]
hal: Add define directive for BUFF_MAX to hal.h

This patch moves the define directive for BUFF_MAX to the hal.h. The
directives in the other files related to the hal are removed. This patch
also inserts the include directive for this hal.h to the files, which
require BUFF_MAX.

Change-Id: Id6115ad79b0c43f64518fb2aabdacd04b3745e25
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Add hal-log.h file to hal directory 86/113286/1
Wook Song [Tue, 7 Feb 2017 01:56:51 +0000 (10:56 +0900)]
hal: Add hal-log.h file to hal directory

This patch creates the hal-log.h file in the hal directory. This header
contains useful macros to display dlog messages and is used for the pass
hal.

Change-Id: I0cdd1c96c7c1d40aae2dc73715f9f71ac8c7a67b
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agoshared: Fix warning messages due to LOG_TAG define 85/113285/1
Wook Song [Mon, 6 Feb 2017 03:57:40 +0000 (12:57 +0900)]
shared: Fix warning messages due to LOG_TAG define

This patch eliminates the following warning messages:
In file included from pass-0.0.1/src/shared/dbus.c:27:0:
pass-0.0.1/src/shared/log.h:23:0: warning: "LOG_TAG" redefined
  #define LOG_TAG "PASS"
  ^
In file included from /usr/include/dlog/dlog.h:34:0,
                 from pass-0.0.1/src/shared/log.h:22,
 from pass-0.0.1/src/shared/dbus.c:27:
/usr/include/dlog/dlog-internal.h:41:0: note: this is the
location of the previous definition
 #define LOG_TAG NULL

Change-Id: I072216c79a5daa883097601876cfff1f731ceaef
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agoshared: Arrange common header file 84/113284/1
Wook Song [Mon, 6 Feb 2017 01:59:13 +0000 (10:59 +0900)]
shared: Arrange common header file

This patch removes unnecessary defines and macros from the common header
file in the shared directory.

Change-Id: Id7e6b0c132a9fc2bcec144d2f55fd836729d900a
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: pmqos: Fix bug of locked time 60/113060/2
Chanwoo Choi [Mon, 6 Feb 2017 02:00:59 +0000 (11:00 +0900)]
pass: pmqos: Fix bug of locked time

This patch fixes the bug of the wrong locked time.
On previous pass-pmqos.c show the current time
instead of the locked time.

- Before
UnLock 'AppLaunch' scenario for 'cpu0' resource (1799653344ms)
- After
UnLock 'AppLaunch' scenario for 'cpu0' resource (3001ms)

Change-Id: Iab24f788436604091058cc2bd085a088042bf8e0
Fixes: 8ddcc2d18db8 ("pass: Fix the build warnings")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Rename the pmqos filename from 'pmqos.conf' to 'pass-pmqos.conf' 52/113052/1
Chanwoo Choi [Sat, 4 Feb 2017 11:10:12 +0000 (20:10 +0900)]
pmqos: Rename the pmqos filename from 'pmqos.conf' to 'pass-pmqos.conf'

This patch just renames the file of pmqos configuration file
to keep the consistency of the format of pass configuration file.

Change-Id: Ib195e698c389ff5f044b8b3bad5cc27600ceb5ad
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Change the 'PmqosScenario' to 'PassScenario' section name 51/113051/1
Chanwoo Choi [Sat, 4 Feb 2017 11:03:32 +0000 (20:03 +0900)]
pmqos: Change the 'PmqosScenario' to 'PassScenario' section name

This patch just changes the sectcion name from 'PmqosScenatio'
to 'PassScenario' in order to keep the consistency of property name
between pmqos.conf and pass-*.conf of each resource.

Second, this patch removes the unneeded 'PMQOS' section name
which doesn't include the any propeties.

Change-Id: I978be1ab5df3dec0213a9035a36fb9962df4339a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Change 'limit_max_cpu' name to 'limit_min_cpu' 50/113050/1
Chanwoo Choi [Sat, 4 Feb 2017 10:48:11 +0000 (19:48 +0900)]
pass: parser: Change 'limit_max_cpu' name to 'limit_min_cpu'

The PASS uses the 'limit_max_cpu' as the minimum number of online cpu.
This name is not matched with the meaning of 'limit_max_cpu'.
So, this patch changes the name of 'limit_max_cpu' to 'limit_min_cpu'
to improve the readability of property in configuration files.

Change-Id: I35650f622ecf482606cdbbdf6c7c365582bace15
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoshared: Unify the separate log.h to remove the duplicate header file 43/113043/4
Chanwoo Choi [Sun, 5 Feb 2017 23:47:13 +0000 (08:47 +0900)]
shared: Unify the separate log.h to remove the duplicate header file

This patch unifies the separate log.h header file and remove the duplicate
the log header file.

Change-Id: Id61e07a7a244070e1c139ce007c8a8118137321a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: Remove duplicate log header file 27/112827/4
Wook Song [Fri, 3 Feb 2017 03:42:49 +0000 (12:42 +0900)]
core: Remove duplicate log header file

This patch removes the duplicate log header file in the core directory.
From now, the only log header is the file in the shared directory.

Change-Id: I94d6cae273a7a123c3d65c503d6703d146322f51
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: conf: Update the supported sceanio list for each resource
Chanwoo Choi [Fri, 3 Feb 2017 01:36:23 +0000 (10:36 +0900)]
pass: conf: Update the supported sceanio list for each resource

This patch updates the all configuration files to add the supported scenaio
and the following nine scenarios are supported.
- AppLaunch
- AppLaunchHome
- BrowserJavaScript
- EmailScroll
- TizenStoreScroll
- CallLogScroll
- MyfilesScroll
- MessageScroll

Change-Id: I19c72a6607b725d86e6390f790bdbe0cdec575e7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Add new scenario name for MessageScroll/SIOP/UltraPowerSaving
Chanwoo Choi [Fri, 3 Feb 2017 00:51:16 +0000 (09:51 +0900)]
pmqos: Add new scenario name for MessageScroll/SIOP/UltraPowerSaving

This patch just adds the new scenario name as following:
- MessageScroll
- SIOP
- UltraPowerSaving

Change-Id: I7778fa6d50ce635e32fe0b996bd8fb6d3b160f0f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agohal: Use proper header for dlog message display 98/112798/2
Wook Song [Fri, 3 Feb 2017 00:08:15 +0000 (09:08 +0900)]
hal: Use proper header for dlog message display

This patch changes the log header file used in hal to the proper ont for
dlog message display.

Change-Id: I8d20dad5e4447904f21c7a15911d358cb76baab7
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Change the symbolic name of the HAL info 97/112797/2
Wook Song [Thu, 2 Feb 2017 23:27:41 +0000 (08:27 +0900)]
hal: Change the symbolic name of the HAL info

This patch changes the symbolic name of the HAL info from
TizenHardwareInfo to PassHalInfo. Accordingly, HAL_INFO_TAG is also
changed.

Change-Id: I8fca63caff647655c8ab562227897a94976b61fd
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: Change the usage of the term "hardware" 96/112796/2
Wook Song [Thu, 2 Feb 2017 23:02:33 +0000 (08:02 +0900)]
pass: Change the usage of the term "hardware"

This patch changes most of the usage of the term "hardware" to the usage
of the term "hal".

Change-Id: I2bab96ec6d77ae4a8058e30baf01c223e3856d80
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Add macros for 16/32-bit tag generation 95/112795/2
Wook Song [Thu, 2 Feb 2017 11:55:32 +0000 (20:55 +0900)]
hal: Add macros for 16/32-bit tag generation

This patch adds several macros to generate 16-bit or 32-bit tags, which
can be used for identification variables.

Change-Id: Id633df8f784adf9c0f8d7528f49b35c5b51ab9ea
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: hal: Fix bug in resource name generation 94/112794/2
Wook Song [Thu, 2 Feb 2017 11:47:01 +0000 (20:47 +0900)]
pass: hal: Fix bug in resource name generation

This patch fixes a bug in the procedure of generating resource name.

Change-Id: I01505b7da21e32c843399317782b7fdd9aa54b90
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: conf: Add new configuration for bus/gpu's resource
Chanwoo Choi [Thu, 2 Feb 2017 08:35:31 +0000 (17:35 +0900)]
pass: conf: Add new configuration for bus/gpu's resource

This patch adds the new configuration file for bus/gpu's resource for TM2.
The configuration will move to pass-hal-(board name) package.
- pass-cluser2-bus0.conf
- pass-cluser3-bus1.conf
- pass-cluser4-gpu.conf

And this patch change the section name to remove the dependency
on specific h/w type as following:
- 'CpufreqLevel' -> 'Level'

In the 'Scenario(x)' section:
- 'cpufreq_min_level' -> 'min_level'
- 'cpufreq_max_level' -> 'max_level'

Change-Id: Ie11d713a30c4fab9193cebb1bab9863349487c86
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Show the resource name when lock/unlock the scenario
Chanwoo Choi [Thu, 2 Feb 2017 11:32:06 +0000 (20:32 +0900)]
pass: pmqos: Show the resource name when lock/unlock the scenario

This patch just shows the resource name when locking or unlocking
the scenario for debug.

For example,
Lock   'AppLaunch' scenario for 'cpu0' resource
Lock   'AppLaunch' scenario for 'cpu4' resource
Lock   'AppLaunch' scenario for 'soc:memory_bus@0' resource
Lock   'AppLaunch' scenario for 'soc:memory_bus@1' resource
Lock   'AppLaunch' scenario for '14ac0000.mali' resource

Change-Id: I5e2e990b6fd354f20c07b83ba5bb489e149178a0
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: pmqos: Rename the min/max level property of scenario section
Chanwoo Choi [Thu, 2 Feb 2017 11:18:20 +0000 (20:18 +0900)]
pass: pmqos: Rename the min/max level property of scenario section

This patch renames the min/max level property in 'Scenario(x)' section as
following:
- cpufreq_min_level -> min_level
- cpufreq_max_level -> max_level

It means that if 'Scenario(x)' section contains the minimum/maximum level
property according to each scenario. The renamed property don't depend on
the any specific h/w resource.

Change-Id: I61ec570a5d607bacc63270d0a72a5196057ee392
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Add new pass_gov_dummy governor for unmonitored resources
Chanwoo Choi [Thu, 2 Feb 2017 10:48:14 +0000 (19:48 +0900)]
pass: gov: Add new pass_gov_dummy governor for unmonitored resources

This patchs add the new 'pass_gov_dummy' governor which doesn't contain
the govenory policy to decide the next level. Some resource don't need
to monitor the resource status peridically and to decide the next level
according to the utilization. This dummy governor just initialize the
resource.

Change-Id: Icdf25902e9656ebb6587f430b30ee8c21475de47
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Don't create the timer if timeout is zero
Chanwoo Choi [Thu, 2 Feb 2017 10:59:14 +0000 (19:59 +0900)]
pass: gov: Don't create the timer if timeout is zero

This patch doesn't create the timer if timeout is zero.
if timerout of timer is zero, it means that this governor
don't need to use the timer for monitoring the resource status.

Change-Id: Ie56c5330b3ac3089a254ca067cb22c940ae3b234
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Add new 'limit_min_freq' property in 'Level' section
Chanwoo Choi [Thu, 2 Feb 2017 10:18:42 +0000 (19:18 +0900)]
pass: gov: Add new 'limit_min_freq' property in 'Level' section

This patch adds the new 'limit_min_freq' property in 'Level' section.
It means that if 'Level(x) section' contains the 'limit_min_freq' property,
the governor set the minimum frequency for DVFS h/w resource such as
cpu, memory bus and gpu.

Change-Id: I57f49ad47fa5ebf3e15aee24a448c2b47914779e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Modify the section name from 'CpufreqLevel' to 'Level'
Chanwoo Choi [Thu, 2 Feb 2017 09:55:01 +0000 (18:55 +0900)]
pass: parser: Modify the section name from 'CpufreqLevel' to 'Level'

This patch change the section name to remove the dependency on
specific h/w type as following:
- 'CpufreqLevel' -> 'Level'

Change-Id: I4d5f5209e1156655e5364ea0f5264e7de0c3082c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Fix information of dbus interface
Chanwoo Choi [Thu, 2 Feb 2017 05:39:46 +0000 (14:39 +0900)]
pass: Fix information of dbus interface

This patch fixes the inappropriate information of dbus interface as following:
- Use the 'PASS' prefix instead of 'DEVICED'
- Remove the separate 'DEVICED_PATH_PASS' dbus interface
- Remove the 'DEVICED_PATH_CORE" dbus interface and method
- Use PASS_PATH_CORE dbus to start and stop the pass governor

Change-Id: Ib4a735bbe3ed8136a6be9b225f5feaa3c068c14b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Remove global variable of pmqos
Chanwoo Choi [Thu, 2 Feb 2017 04:54:01 +0000 (13:54 +0900)]
pass: gov: Remove global variable of pmqos

This patch removes the the global variable of pmqos. Instead, the callback
funtcion of each notifier use the 'user_data" provided by device-notifier lib.

And, this patch adds the simple description for callback function of notifier.

Change-Id: I509a94f3e089051eec1c0aa120fffed0289b1153
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: device-notifier: Remove wrong error handling code
Chanwoo Choi [Thu, 2 Feb 2017 04:56:55 +0000 (13:56 +0900)]
core: device-notifier: Remove wrong error handling code

The previous register_notifier() checks whether the function pointer
of callback is already registered or not. But it is wrong because
the different receivers are able to use the same callback function
with the different own user_data.

Change-Id: If9f4a80e91c48f7964f05009dc6ee7098d72f9cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agocore: device-notifier: Support user_data parameter for receiver
Chanwoo Choi [Thu, 2 Feb 2017 04:39:33 +0000 (13:39 +0900)]
core: device-notifier: Support user_data parameter for receiver

The current device-notifier didn't pass ther separate 'void *user_data'
parameter on callback function. So, must need global variables to share
the information. So, This patch supports the 'void *user_data' parameter
for device-notifier.

[Detailed new prototype for register_notifier()]
Before:
- int register_notifier(status, *func);
- int (*func)(void *data));

After:
- int register_notifier(status, *func, void *user_data);
- int (*func)(void *data, void *user_data));

Change-Id: Iec96cc18413a34a14f1a57585b0672548df34c0b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unneeded debug messages
Chanwoo Choi [Thu, 2 Feb 2017 03:22:31 +0000 (12:22 +0900)]
pass: Remove unneeded debug messages

This patch removes the unnedded debug message.

Change-Id: Id1d7d4845ab52393e410f4e5ab968d5afba786a4
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Rename exported function name and removes unneeded prefix
Chanwoo Choi [Thu, 2 Feb 2017 01:58:11 +0000 (10:58 +0900)]
pmqos: Rename exported function name and removes unneeded prefix

This renames the expoerted function name of pmqos as following:
- get_pmqos_table -> pmqos_get_scenario()
- release_pmqos_table() -> pmqos_put_scenario()

And this patch removes the unneeded prefix ('cpu') because
the scenario does not depend on the specific h/w resource.
The scenario name indicate ths specific situation or status
of user-space.

Change-Id: Iaabab609f00206a5d879a3f41475f97a99534b3c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Specify module name on the top of each module
Chanwoo Choi [Thu, 2 Feb 2017 01:41:49 +0000 (10:41 +0900)]
pass: Specify module name on the top of each module

This patch specifies the corerct module name on the top of each module
to improve the readability for each pass module.

Change-Id: Iff2880033bbb0809a512d188c3983c669f225596
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Rename governor module to pass-gov and add governor helper functions
Chanwoo Choi [Thu, 2 Feb 2017 01:33:56 +0000 (10:33 +0900)]
pass: Rename governor module to pass-gov and add governor helper functions

This patch renames the governor module's filename from pass-core.c
to pass-gov.c beceause pass-core.c includes the governor functions.

And it adds new following governor functions. On previous, other module
,such as pass.c, access the field of struct pass_governor direclty without
any wrapper function.
- int pass_governor_init(struct pass_policy *);
- int pass_governor_exit(struct pass_policy *);
- int pass_governor_update(struct pass_policy *, enum pass_gov_state);

Change-Id: I772edc602325409faf0b747cc741be5d83151c23
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Replace hal API to handle the h/w resource
Chanwoo Choi [Wed, 1 Feb 2017 08:41:34 +0000 (17:41 +0900)]
pass: Replace hal API to handle the h/w resource

This patch uses the hal interface function to handle the h/w resource
instead of using the legacy pass-plugin.c which access the h/w interface
without hal interface.

Change-Id: If155cb811b342fb3fa3e23cc11f36a0defbc6420
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Use calloc to initialize the memory instead of malloc
Chanwoo Choi [Wed, 1 Feb 2017 08:29:01 +0000 (17:29 +0900)]
pass: Use calloc to initialize the memory instead of malloc

This patch just uses the calloc() to initialize the memory with zero
insead of malloc.

Change-Id: I1b45cb10101b5e79bad07d73b952a0af31b868b5
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Redesign the pass in order to use the resource model
Chanwoo Choi [Tue, 24 Jan 2017 07:12:33 +0000 (16:12 +0900)]
pass: Redesign the pass in order to use the resource model

The previous pass didn't consider adding h/w resource. It makes the pass
to add new h/w resource. So, This patch redesigns the pass in order to
use the resource model.

The struct pass_resource includes the all information for each h/w resource.
Each h/w resource is working independently between resources.

[Detailed description for struct pass_resource]
struct pass_resource
- struct pass_conf_data: the parsed data from configuration file from pass.conf.
- struct pass_policy   : the policy data to handle the h/w resource.
- struct pass_resource : the resource instance of each h/w resource
  from pass_get_hw_info().

Change-Id: Idf48c318223e303cdebbf9728222315d5a4c812e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Add new helper function to handle the h/w resource through hal interface
Chanwoo Choi [Mon, 23 Jan 2017 10:22:24 +0000 (19:22 +0900)]
pass: Add new helper function to handle the h/w resource through hal interface

This patch adds new helper and wrapper function to handle the hal
interface. The pass core have to call this function to control
the value of each h/w resource.

- Load the h/w resource:
int pass_get_resource(struct pass *pass);

- Following functions to handle the DVFS resource:
int pass_get_curr_governor(struct pass_resource *res, char *governor);
int pass_set_curr_governor(struct pass_resource *res, char *governor);
int pass_get_curr_freq(struct pass_resource *res);
int pass_get_min_freq(struct pass_resource *res);
int pass_set_min_freq(struct pass_resource *res, int freq);
int pass_get_max_freq(struct pass_resource *res);
int pass_set_max_freq(struct pass_resource *res, int freq);
int pass_get_up_threshold(struct pass_resource *res);
int pass_set_up_threshold(struct pass_resource *res, int up_threshold);

- Following functions to handle the CPU Hotpulg resource:
int pass_get_online_state(struct pass_resource *res, int cpu);
int pass_set_online_state(struct pass_resource *res, int cpu, int on);

- Following functions to handle the TMU resource:
int pass_get_temp(struct pass_resource *res);
int pass_get_policy(struct pass_resource *res, char *policy);

* DVFS (Dynamic Voltage & Frequency Scaling)
* TMU (Thermal Management Unit)

Change-Id: I03cbc7dc3debc787d4f4a5cb777db9f7e4bd8f3f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Add new hal interface to handle the h/w resource
Chanwoo Choi [Mon, 23 Jan 2017 01:22:40 +0000 (10:22 +0900)]
pass: hal: Add new hal interface to handle the h/w resource

The pass handle the h/w resources such as CPU, Memory Bus and GPU.

This patch adds the new HAL (Hardware Abstract Layer) interface
to support the pass on all h/w boards. This patch defines the
three type of resources.
- struct pass_resrouce_cpu for CPU h/w.
- struct pass_resrouce_bus for Memory bus h/w.
- struct pass_resrouce_gpu for GPU h/w.

The hal-cpu-example.c is just example to help the implementation
of he real HAL.

Change-Id: I09035678cdeac185a67b79492176986f5e01e23b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unused structure definitions
Chanwoo Choi [Tue, 17 Jan 2017 10:53:29 +0000 (19:53 +0900)]
pass: Remove unused structure definitions

This patch removes the unused structure definitions.

Change-Id: I7b68bce746f6410bcf2d91df671e9318bbf6e7d1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Fix bug radiation governor when the number of load entry is zero
Chanwoo Choi [Thu, 19 Jan 2017 09:46:29 +0000 (18:46 +0900)]
pass: gov: Fix bug radiation governor when the number of load entry is zero

The radiation governor uses the history of CPU utilization
in order to decide the proper pass level. If CPU idle time
is over period time (default 400ms), there is no any history
of cpu utilization. If the number of history is zero,
the governor have to return with previous pass level.

So, this patch handle the error case if the number
of load entry is zero.

Change-Id: If32d334b21059a5c889c866a0e70f41181133ebd
Reported-by: Eunki Hong <eunkiki.hong@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unneeded pass-util.h
Chanwoo Choi [Thu, 19 Jan 2017 02:52:16 +0000 (11:52 +0900)]
pass: Remove unneeded pass-util.h

This patch removes the unneeded pass-util.h. Instead, pass-core.c
includes "core/log.h" header file.

Change-Id: Ide03d8159575fdae9ce4c178742a6b544b0c4b4b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unused code and modify the prefix for pass
Chanwoo Choi [Mon, 16 Jan 2017 07:27:12 +0000 (16:27 +0900)]
pass: Remove unused code and modify the prefix for pass

The pass is developed based on deviced source. There are the specific
features and codes for deviced. This patch removes the unused
features and if there is the used feature for pass, this patch
modifies the naming prefix for pass.

Change-Id: Id078a9070e30b2a1ee87e374bbceaf731ebc7036
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Split out parser feature from plugin module
Chanwoo Choi [Thu, 12 Jan 2017 11:27:38 +0000 (20:27 +0900)]
pass: Split out parser feature from plugin module

This patch split out the parser feature to parse the configuration
from plugin module because plugin module will be removed and renames
the pmqos-plugin.c to pmqos-parser.c.

Change-Id: Iba89a1293678714114846234c303b5e36570408a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Fix the build warnings
Chanwoo Choi [Thu, 12 Jan 2017 08:27:51 +0000 (17:27 +0900)]
pass: Fix the build warnings

This patch fixes the build warnings about following issues:
- pass-plugin.c: warning: unused variable 'level' [-Wunused-variable]
- pass-pmqos.c: warning: implicit declaration of function 'get_time_ms' [-Wimplicit-function-declaration]
- pass-pmqos.c: warning: unused variable 'locked_time' [-Wunused-variable]

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>