platform/core/system/pass.git
6 years agopass: hal: Move get_time_ms() pass-hal.c to pass-pmqos.c 20/139920/1
Chanwoo Choi [Fri, 14 Jul 2017 02:47:55 +0000 (11:47 +0900)]
pass: hal: Move get_time_ms() pass-hal.c to pass-pmqos.c

The existing get_time_ms() is only used on pass-pmqos.c.
So, this patch moves the definition of get_time_ms()
from pass-hal.c to pass-pmqos.c.

Change-Id: Ic89cb705071633b5093722a4ab26e71133c444cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: hal: Fix build warning of unused variable 19/139919/1
Chanwoo Choi [Thu, 20 Jul 2017 09:17:55 +0000 (18:17 +0900)]
pass: hal: Fix build warning of unused variable

The commit ac65764c65d8 ("pass: hal: Assign resource name directly
instead of copying it) doesn't remove the unused variable. This patch
removes the unused variable to remove the build warning.

Change-Id: Ice9fe962c6ad5a4ec3941baabe0323b1d6748858
Fixes: ac65764c65d8 ("pass: hal: Assign resource name directly instead of copying it)
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agopass: Fix bug to check return value of pass_get_resource() 18/139918/1
Chanwoo Choi [Fri, 14 Jul 2017 01:48:15 +0000 (10:48 +0900)]
pass: Fix bug to check return value of pass_get_resource()

The commit 0e039c5ce2677 ("pass: hal: Modify the definition of
pass_get/put_resource()") add the wrong code related to checking
the return value of pass_get_resource(). This patch fixes the bug
of checking the return value of pass_get_resource().

Change-Id: Ia9704ee96ddec0eecc183fad96fd8583a46b47f9
Fixes: 0e039c5ce2677 ("pass: hal: Modify the definition of pass_get/put_resource()")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
6 years agoscripts: Apply dbus security policy using xml-based conf file 83/139783/2
Wook Song [Thu, 20 Jul 2017 09:52:51 +0000 (18:52 +0900)]
scripts: Apply dbus security policy using xml-based conf file

Until now, there is no specific dbus security policy in PASS. Therefore,
any processes which do not have the root or special privileges can send
dbus messages to the pass daemon. This could be a serious security hole.
In order to solve such problem, this patch applies a dbus security
policy by using the pass.conf file, which is formed in XML format.

From now, without the root privileges, it is not allowed to send dbus
messages to the pass daemon. Only dbus messages sent from the processes
whose user ids are *app_fw* to the pmqos interface can be received by
the pass daemon.

Change-Id: I583eb3a097e1181e9b02b896bd97d54771c63f9c
Signed-off-by: Wook Song <wook16.song@samsung.com>
6 years agopass: Restore resource state after PASS service is stopped 93/138593/12
Dongwoo Lee [Tue, 11 Jul 2017 08:00:44 +0000 (17:00 +0900)]
pass: Restore resource state after PASS service is stopped

The resource state can be changed during PASS operation, but it
should be restored to default state after PASS is over. To do this,
PASS saves initdata of each resource during initalization process
and restores it before putting resources.

Change-Id: If9f3d712cd3288d508187295c5b3def88043c509
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Wook Song <wook16.song@samsung.com>
7 years agocore: Remove unused /var/run/.pass.pid file 13/139413/2 accepted/tizen/unified/20170720.164745 submit/tizen/20170719.015733
Chanwoo Choi [Wed, 19 Jul 2017 01:27:29 +0000 (10:27 +0900)]
core: Remove unused /var/run/.pass.pid file

PASS stores the pid to the /var/run/.pass.pid. But it is not used
and it has the security issue if the path is symbolic link.

This patch removes the /var/run/.pass.pid file.

Change-Id: I816da948f9ebe9203119bc4b21041d0a926aa338
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Assign resource name directly instead of copying it
Dongwoo Lee [Mon, 17 Jul 2017 01:55:15 +0000 (10:55 +0900)]
pass: hal: Assign resource name directly instead of copying it

The resource name is copied from .rodata region, but it is local
variable and is not assigned to other structure or global variable.
Thus, we can easily assign the name instead of copying it.

Change-Id: I6f911d2e35ed52fb0d3a39700e3735d0986360da
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agocore: Remove unused log.c file 33/138833/3
Wook Song [Fri, 14 Jul 2017 04:04:25 +0000 (13:04 +0900)]
core: Remove unused log.c file

For the debugging purpose, in the log.c, there are several functions
which PASS does not use. This patch simply removes the log.c file and
elminates the DEBUG macro, which is not used anywhere but log.c.

Change-Id: Ib40c16f41fd2465bbf5bb48e16559ed7b1c7f209
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopass: hal: Check whether parameter is valid or not 03/138803/2
Chanwoo Choi [Fri, 14 Jul 2017 01:08:21 +0000 (10:08 +0900)]
pass: hal: Check whether parameter is valid or not

This patch checks whether the parameter is valid or not
in order to prevent the unexpected behavior.

Change-Id: Idb0a3c97f15a95231f39569ac528ab4b1001eded
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Permit zero value for setting dvfs data 98/138798/1
Dongwoo Lee [Thu, 13 Jul 2017 04:10:05 +0000 (13:10 +0900)]
pass: hal: Permit zero value for setting dvfs data

Now several set-functions cannot take zero for target value. However,
zero is acceptable value whether it is reasonable or not. Thus, zero
is permitted for function parameter, and functions will only reject
negative value.

Change-Id: Ic363abc239ab521577165768f1e41a61e502f4c3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agopass: Clean-up code to remove unneded prefix (pass_res -> res) 37/138637/1
Chanwoo Choi [Thu, 13 Jul 2017 05:20:00 +0000 (14:20 +0900)]
pass: Clean-up code to remove unneded prefix (pass_res -> res)

The pass core uses the 'pass_res' variable name to indicate the instance
of 'struct pass_resource'. 'pass_' prefix is not beneficial and not necessary.
This patch alters 'pass_res' to 'res' simply and use the 'res_type' name
insted of 'id' variable name in order to improve the understanding
what is meaning of variable.

Change-Id: Idf2a2a8ea1f48d1724d40dc50488097946113d57
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Change the name of pass_resource_init/exit() 36/138636/1
Chanwoo Choi [Thu, 13 Jul 2017 04:29:52 +0000 (13:29 +0900)]
pass: Change the name of pass_resource_init/exit()

The defined function used the following format to make the function name:
- "pass_[verb]_[object]()"

In order to maintain the consistency, this patch changes the function name
as following:
- pass_resource_init() -> pass_init_resource()
- pass_resource_exit() -> pass_exit_resource()

Change-Id: I2438906539c14931681c5883d702dd05a786234f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Remove unnecessary continue statement 53/138453/2
Dongwoo Lee [Wed, 12 Jul 2017 07:45:04 +0000 (16:45 +0900)]
pass: Remove unnecessary continue statement

There is continue statement at the end of while block which have no
meaning. Unnecessary continue statement will be removed.

Change-Id: Ifd014b397bfb867d9fbc13c78e39ee613601fec3
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agopass: Put resource properly to prevent memory leak 10/138110/3
Dongwoo Lee [Tue, 11 Jul 2017 05:54:57 +0000 (14:54 +0900)]
pass: Put resource properly to prevent memory leak

There are two cases which can cause memory leak during pass init/exit:
 1. When resource initialization is failed, it just skips that
    resource without putting it.
 2. In the case of failure while freeing resources, it is also skipped
    putting that resource.

To prevent memory leak, the resource will be put on both cases.

Change-Id: I4008b7785e0dbbc318b38eb573bf739e0a848b6c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
7 years agopass: hal: Rename 'pass_get_policy' to 'pass_get_tmu_policy' 33/137633/3
Wook Song [Fri, 7 Jul 2017 02:14:39 +0000 (11:14 +0900)]
pass: hal: Rename 'pass_get_policy' to 'pass_get_tmu_policy'

This patch renames a HAL interfaces named 'pass_get_policy' to
'pass_get_tmu_policy' because of the ambiguous meaning of its original
function name.

Change-Id: I533191deb87933e8c0d779883fb41f90ceb3d3e8
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agohal: Remove author entry from struct pass_resource_info 35/137635/2 accepted/tizen/unified/20170711.180630 submit/tizen/20170710.060912
Chanwoo Choi [Fri, 7 Jul 2017 02:15:24 +0000 (11:15 +0900)]
hal: Remove author entry from struct pass_resource_info

This patch just removes the author entry because it is not good
to fix the specific person in charge of the h/w resource.
So, all files of pass git repo doesn't have the any author information
for each *.c file.

Change-Id: I1d6b4eaccf2c4410ac07681a327906195c6c818e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Use 'res_thermal_name' as the first argument for TMU HAL 32/137632/6
Wook Song [Fri, 7 Jul 2017 02:03:37 +0000 (11:03 +0900)]
pass: hal: Use 'res_thermal_name' as the first argument for TMU HAL

This patch makes the TMU HAL functions use 'res_thermal_name' as the
first argument, which is previously 'res_name'. This change will allow
the TMU HAL function bodies to be implemented without any hard-coded
sysfs node names.

Change-Id: I702d28bfab3b110a7bdba9c3bb7601bf0e250a23
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Add parsing of pass_res_thermal_name 31/137631/8
Wook Song [Thu, 6 Jul 2017 08:43:59 +0000 (17:43 +0900)]
pass: parser: Add parsing of pass_res_thermal_name

This patch adds a parsing mechanism for the new mandatory entry,
pass_res_thermal_name, in the PassResource section of the pass.conf
file. The value of this property will be used by the TMU HAL interfaces.

Change-Id: I4f063aea6941a82322c3c3a6f1fde153c97061bc
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Remove hard-coded length of path strings in pass_conf_data 54/137454/7
Wook Song [Thu, 6 Jul 2017 04:20:34 +0000 (13:20 +0900)]
pass: parser: Remove hard-coded length of path strings in pass_conf_data

This patch removes the hard-coded length of character arrays, which
indicates file paths, in the pass_conf_data structure.

Change-Id: I3fd48d645560b004a7609a90a97fcf8d4cd3ec32
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Modify the definition of pass_resource_init/exit() 88/137488/5
Chanwoo Choi [Thu, 6 Jul 2017 05:38:22 +0000 (14:38 +0900)]
pass: Modify the definition of pass_resource_init/exit()

This patch uses the 'struct pass_resource *' on pass_resource_init/exit()
instead of 'struct pass_policy' because the 'struct pass_resource' indicates
each h/w resource. Also, this patch maintains the same format for argument
when calling the pass_resource_*() function.

[Before]
pass_resource_init(struct pass_policy *policy)
pass_resource_exit(struct pass_policy *policy)

[After]
pass_resource_init(struct pass_resource *pass_res)
pass_resource_exit(struct pass_resource *pass_res)

Change-Id: I457f02b6a67df5e5c8b484fdea5f83587a2f9b67
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Handle each h/w resource as the independent element 87/137487/5
Chanwoo Choi [Thu, 6 Jul 2017 04:49:38 +0000 (13:49 +0900)]
pass: Handle each h/w resource as the independent element

PASS handles each h/w resource independently. When PASS fail
to initialize or load the library, it should not affect anything else.

So, this patch tries to initialize/exit each h/w resource continuously
when other h/w resource faild to initialize/exit because each h/w resource
is independent.

Change-Id: Ibc0d40347c6b6dbbf4c2576659d937e171fa362e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Modify the definition of pass_get/put_resource() 86/137486/5
Chanwoo Choi [Thu, 6 Jul 2017 04:45:42 +0000 (13:45 +0900)]
pass: hal: Modify the definition of pass_get/put_resource()

The existing pass_get/put_resource() handles the all of resources
with 'struct pass *pass' argument which includes the information
of all h/w resources.

So, this patch modifies the definition of pass_get/put_resrouce()
in order to handle the each h/w resource with 'struct pass_resource *'
argument. And this patch changes the log message in the pass_init/exit_done()
in order to keep the same log format.

And this patch removes the unnecessary log of pass_get/put_resource().

[Before]
- pass_get_resource(struct pass *pass)
- pass_put_resource(struct pass *pass)

[After]
- pass_get_resource(struct pass_resource *pass_res)
- pass_put_resource(struct pass_resource *pass_res)

Change-Id: I704d1b1d9bc2cfe84fd3af05fe12ab8364b21df7
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoshared: Remove unused dbus inferface (sysnoti) 85/137485/2
Chanwoo Choi [Thu, 6 Jul 2017 05:49:13 +0000 (14:49 +0900)]
shared: Remove unused dbus inferface (sysnoti)

This patch removes the unused dbus interface (sysnoti).

Change-Id: I8f1b35d6def8a615502da0282ffad81f7b25a576
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoshared: Remove unused header file 84/137484/2
Chanwoo Choi [Thu, 6 Jul 2017 05:47:16 +0000 (14:47 +0900)]
shared: Remove unused header file

This patch removes the unused header file (deviced-priv.h).

Change-Id: If3651171e2d1b9ec19dccf07fd4c31f489f7aa51
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: gov: Set the raw data of PMQoS to HAL 78/136378/4 accepted/tizen/unified/20170706.193437 submit/tizen/20170705.081057
Chanwoo Choi [Tue, 27 Jun 2017 06:19:55 +0000 (15:19 +0900)]
pass: gov: Set the raw data of PMQoS to HAL

This patch calls the pass_set_pmqos_data() in order to set
the raw data from platform to HAL layer because of supporting
the backward compatibility.

Change-Id: I49b03382596f66682895b8cbd005cfeb7fd921cb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: Add the support for new struct pass_resource_nonstandard type 77/136377/4
Chanwoo Choi [Mon, 26 Jun 2017 08:56:28 +0000 (17:56 +0900)]
pass: Add the support for new struct pass_resource_nonstandard type

This patch support the new 'struct pass_resource_nonstandard'
in order to handle the nonstandard devices except for cpu/bus/gpu.
This h/w resource has the following functions:
- int set_pmqos_data(char *res_name, void *data)

And this patch adds the pass_set_pmqos_data() helper function
in order to bypass the PMQoS's data (scearnio name + 'Lock' or 'Unlock')
from platform to HAL layer. This function calls the .set_pmqos_data()
in the HAL pacakge.

Change-Id: I80f06f7e6bd29c30b9f7ace561642298636230f1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: hal: Add description for helper functions 76/136376/3
Chanwoo Choi [Mon, 26 Jun 2017 09:00:34 +0000 (18:00 +0900)]
pass: hal: Add description for helper functions

This patch adds the simple description for helper functions
in order to improve the readability for the supported range of functions.

Change-Id: Ibbddda47c1f7560291d9fee709bb5da8573fcc93
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agohal: Add new struct pass_resource_nonstandard for nonstandard device 75/136375/3
Chanwoo Choi [Mon, 26 Jun 2017 08:21:20 +0000 (17:21 +0900)]
hal: Add new struct pass_resource_nonstandard for nonstandard device

This patch adds new 'struct pass_resource_nonstandard' in order to
support the nonstandard devices except for cpu/bus/gpu.

This patch just adds the following function in order to support
the backwards compatibility. This function will be removed
after finding the proper method.
- int (*set_pmqos_data)(char *res_name, void*) : Set PMQoS's data to HAL.

Change-Id: Ia0310c43226b0ab000c9470784e9d55ec507d119
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agohal: Add separate description for each struct pass_resource_* 74/136374/1
Chanwoo Choi [Tue, 27 Jun 2017 03:45:47 +0000 (12:45 +0900)]
hal: Add separate description for each struct pass_resource_*

This patch adds the seprate description for each h/w resource
in order to improve the readability of the meaning of struct pass_resource_*.

Change-Id: I44e6a2be7adc7a6e1136d9893f22a168de7588d2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopmqos: Remove unsupported scenarios 73/136373/1
Chanwoo Choi [Tue, 27 Jun 2017 10:29:38 +0000 (19:29 +0900)]
pmqos: Remove unsupported scenarios

This patch removes the unsupported scenarios on platform.

Change-Id: I43f1a19d6332709005b8a493a3d44e6e45533c52
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agopass: parser: Change pass_res_type in pass.conf from number to string 97/134897/2 submit/tizen/20170629.044637
Wook Song [Tue, 20 Jun 2017 08:10:07 +0000 (17:10 +0900)]
pass: parser: Change pass_res_type in pass.conf from number to string

This patch changes the type of the value of "pass_res_type" in each
PassResource section of the pass.conf file from a number to a meaningful
string like cpu, bus, and gpu.

Change-Id: I1d3a33d7a16b93f44b422ca470cd60c70198e3fc
Signed-off-by: Wook Song <wook16.song@samsung.com>
7 years agopmqos: Add 'scenario_max_timeout_ms' property to set the maximum timeout 55/134555/5
Chanwoo Choi [Mon, 19 Jun 2017 05:13:35 +0000 (14:13 +0900)]
pmqos: Add 'scenario_max_timeout_ms' property to set the maximum timeout

Each scenario wants to lock the h/w resources within their own timeout.
If the specific scenario wants to lock the h/w resources for so long time,
it is not reasonable. So, PMQoS core has the maximum timeout in order to
protect the excessive occupation of h/w resources.

This patch adds the new 'scenario_max_timeout_ms' property which means
the maximum timeout for the scenarios on specific h/w board. The owner
of PASS daemon can adjust the maximum timeout according to the h/w board.

Change-Id: Ic38137f667c34230b90e9217d33549d5859fd5fa
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
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>