Since commit cab673583d96 ("soc: Unconditionally include qcom Makefile"),
we unconditionally include the soc/qcom/Makefile.
This opens up the possibility to compile test the code even when
building for other architectures.
This patch series prepares and enables all but two Kconfigs to be
compile tested even when building for other architectures.
Changes since v5:
-kbuild test robot now uses gcc 8, so it found some new warnings
with -Wstringop-truncation, created 2 new patches for this.
-Removed depends on OF from QCOM_RPMH, new patch.
Niklas Cassel (9):
soc: qcom: smem: Add missing include of sizes.h
soc: qcom: llcc-slice: Add missing include of sizes.h
soc: qcom: smp2p: Add select IRQ_DOMAIN
soc: qcom: smsm: Add select IRQ_DOMAIN
soc: qcom: Remove bogus depends on OF from QCOM_SMD_RPM
soc: qcom: Remove depends on OF from QCOM_RPMH
soc: qcom: wcnss_ctrl: Avoid string overflow
soc: qcom: apr: Avoid string overflow
soc: qcom: Allow COMPILE_TEST of qcom SoC Kconfigs
drivers/soc/qcom/Kconfig | 21 ++++++++++++---------
drivers/soc/qcom/apr.c | 4 ++--
drivers/soc/qcom/llcc-slice.c | 1 +
drivers/soc/qcom/smem.c | 1 +
drivers/soc/qcom/wcnss_ctrl.c | 2 +-
5 files changed, 17 insertions(+), 12 deletions(-)
--
2.17.1
Add missing include of sizes.h.
drivers/soc/qcom/smem.c: In function ‘qcom_smem_get_ptable’:
drivers/soc/qcom/smem.c:666:64: error: ‘SZ_4K’ undeclared
ptable = smem->regions[0].virt_base + smem->regions[0].size - SZ_4K;
^~~~~
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/smem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index bf4bd71ab53f..b77573eed596 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -18,6 +18,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
+#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/soc/qcom/smem.h>
--
2.17.1
Add missing include of sizes.h.
drivers/soc/qcom/llcc-slice.c: In function ‘llcc_update_act_ctrl’:
drivers/soc/qcom/llcc-slice.c:41:44: error: ‘SZ_4K’ undeclared
#define LLCC_TRP_ACT_CTRLn(n) (n * SZ_4K)
^~~~~
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/llcc-slice.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/qcom/llcc-slice.c b/drivers/soc/qcom/llcc-slice.c
index 54063a31132f..344dc2daf431 100644
--- a/drivers/soc/qcom/llcc-slice.c
+++ b/drivers/soc/qcom/llcc-slice.c
@@ -13,6 +13,7 @@
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
+#include <linux/sizes.h>
#include <linux/slab.h>
#include <linux/soc/qcom/llcc-qcom.h>
--
2.17.1
Since we are using irq_domain_add_linear(), add a select on IRQ_DOMAIN.
This is needed in order to be able to remove the depends on ARCH_QCOM.
drivers/soc/qcom/smsm.c: In function ‘smsm_inbound_entry’:
drivers/soc/qcom/smsm.c:411:18: error: implicit declaration of function
‘irq_domain_add_linear’
entry->domain = irq_domain_add_linear(node, 32, &smsm_irq_ops, entry);
^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 6e063202ad0b..7da6e67c7ea1 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -143,6 +143,7 @@ config QCOM_SMSM
tristate "Qualcomm Shared Memory State Machine"
depends on QCOM_SMEM
select QCOM_SMEM_STATE
+ select IRQ_DOMAIN
help
Say yes here to support the Qualcomm Shared Memory State Machine.
The state machine is represented by bits in shared memory.
--
2.17.1
QCOM_SMD_RPM builds perfectly fine without CONFIG_OF set.
Remove the bogus depends on OF.
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 7da6e67c7ea1..ac657164a136 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -114,7 +114,7 @@ config QCOM_SMEM
config QCOM_SMD_RPM
tristate "Qualcomm Resource Power Manager (RPM) over SMD"
depends on ARCH_QCOM
- depends on RPMSG && OF
+ depends on RPMSG
help
If you say yes to this option, support will be included for the
Resource Power Manager system found in the Qualcomm 8974 based
--
2.17.1
'chinfo.name' is used as a NUL-terminated string, but using strncpy() with
the length equal to the buffer size may result in lack of the termination:
drivers//soc/qcom/wcnss_ctrl.c: In function 'qcom_wcnss_open_channel':
drivers//soc/qcom/wcnss_ctrl.c:284:2: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
strncpy(chinfo.name, name, sizeof(chinfo.name));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This changes it to use the safer strscpy() instead.
Signed-off-by: Niklas Cassel <[email protected]>
---
drivers/soc/qcom/wcnss_ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index df3ccb30bc2d..373400dd816d 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -281,7 +281,7 @@ struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss, const char *name, rp
struct rpmsg_channel_info chinfo;
struct wcnss_ctrl *_wcnss = wcnss;
- strncpy(chinfo.name, name, sizeof(chinfo.name));
+ strscpy(chinfo.name, name, sizeof(chinfo.name));
chinfo.src = RPMSG_ADDR_ANY;
chinfo.dst = RPMSG_ADDR_ANY;
--
2.17.1
'adev->name' is used as a NUL-terminated string, but using strncpy() with the
length equal to the buffer size may result in lack of the termination:
In function 'apr_add_device',
inlined from 'of_register_apr_devices' at drivers//soc/qcom/apr.c:264:7,
inlined from 'apr_probe' at drivers//soc/qcom/apr.c:290:2:
drivers//soc/qcom/apr.c:222:3: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
strncpy(adev->name, np->name, APR_NAME_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This changes it to use the safer strscpy() instead.
Signed-off-by: Niklas Cassel <[email protected]>
---
drivers/soc/qcom/apr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index 57af8a537332..ee9197f5aae9 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -219,9 +219,9 @@ static int apr_add_device(struct device *dev, struct device_node *np,
adev->domain_id = id->domain_id;
adev->version = id->svc_version;
if (np)
- strncpy(adev->name, np->name, APR_NAME_SIZE);
+ strscpy(adev->name, np->name, APR_NAME_SIZE);
else
- strncpy(adev->name, id->name, APR_NAME_SIZE);
+ strscpy(adev->name, id->name, APR_NAME_SIZE);
dev_set_name(&adev->dev, "aprsvc:%s:%x:%x", adev->name,
id->domain_id, id->svc_id);
--
2.17.1
QCOM_RPHM already selects ARM64, which always selects OF.
Additionally, the rpmh driver only uses linux/of.h, which has dummy
definitions for all functions, in order for code to to be able to
build without CONFIG_OF set.
Remove the superfluous depends on OF.
Signed-off-by: Niklas Cassel <[email protected]>
---
drivers/soc/qcom/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index ac657164a136..cf4ece232897 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -94,7 +94,7 @@ config QCOM_RMTFS_MEM
config QCOM_RPMH
bool "Qualcomm RPM-Hardened (RPMH) Communication"
- depends on ARCH_QCOM && ARM64 && OF || COMPILE_TEST
+ depends on ARCH_QCOM && ARM64 || COMPILE_TEST
help
Support for communication with the hardened-RPM blocks in
Qualcomm Technologies Inc (QTI) SoCs. RPMH communication uses an
--
2.17.1
Since commit cab673583d96 ("soc: Unconditionally include qcom Makefile"),
we unconditionally include the soc/qcom/Makefile.
This opens up the possibility to compile test the code even when building
for other architectures.
Allow COMPILE_TEST for all qcom SoC Kconfigs, except for two Kconfigs
that depend on QCOM_SCM, since that triggers lots of build errors in
qcom_scm.
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/Kconfig | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index cf4ece232897..684cb51694d1 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -33,7 +33,7 @@ config QCOM_GLINK_SSR
config QCOM_GSBI
tristate "QCOM General Serial Bus Interface"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
select MFD_SYSCON
help
Say y here to enable GSBI support. The GSBI provides control
@@ -42,7 +42,7 @@ config QCOM_GSBI
config QCOM_LLCC
tristate "Qualcomm Technologies, Inc. LLCC driver"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
help
Qualcomm Technologies, Inc. platform specific
Last Level Cache Controller(LLCC) driver. This provides interfaces
@@ -73,7 +73,8 @@ config QCOM_PM
config QCOM_QMI_HELPERS
tristate
- depends on ARCH_QCOM && NET
+ depends on ARCH_QCOM || COMPILE_TEST
+ depends on NET
help
Helper library for handling QMI encoded messages. QMI encoded
messages are used in communication between the majority of QRTR
@@ -104,7 +105,7 @@ config QCOM_RPMH
config QCOM_SMEM
tristate "Qualcomm Shared Memory Manager (SMEM)"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
depends on HWSPINLOCK
help
Say y here to enable support for the Qualcomm Shared Memory Manager.
@@ -113,7 +114,7 @@ config QCOM_SMEM
config QCOM_SMD_RPM
tristate "Qualcomm Resource Power Manager (RPM) over SMD"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
depends on RPMSG
help
If you say yes to this option, support will be included for the
@@ -150,7 +151,7 @@ config QCOM_SMSM
config QCOM_WCNSS_CTRL
tristate "Qualcomm WCNSS control driver"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
depends on RPMSG
help
Client driver for the WCNSS_CTRL SMD channel, used to download nv
@@ -158,7 +159,7 @@ config QCOM_WCNSS_CTRL
config QCOM_APR
tristate "Qualcomm APR Bus (Asynchronous Packet Router)"
- depends on ARCH_QCOM
+ depends on ARCH_QCOM || COMPILE_TEST
depends on RPMSG
help
Enable APR IPC protocol support between
--
2.17.1
Since we are using irq_domain_add_linear(), add a select on IRQ_DOMAIN.
This is needed in order to be able to remove the depends on ARCH_QCOM.
drivers/soc/qcom/smp2p.c: In function ‘qcom_smp2p_inbound_entry’:
drivers/soc/qcom/smp2p.c:317:18: error: implicit declaration of function
‘irq_domain_add_linear’
entry->domain = irq_domain_add_linear(node, 32, &smp2p_irq_ops, entry);
^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Vivek Gautam <[email protected]>
Reviewed-by: Vinod Koul <[email protected]>
---
drivers/soc/qcom/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index ba79b609aca2..6e063202ad0b 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -134,6 +134,7 @@ config QCOM_SMP2P
depends on MAILBOX
depends on QCOM_SMEM
select QCOM_SMEM_STATE
+ select IRQ_DOMAIN
help
Say yes here to support the Qualcomm Shared Memory Point to Point
protocol.
--
2.17.1
On Wed 29 Aug 00:57 PDT 2018, Niklas Cassel wrote:
> 'chinfo.name' is used as a NUL-terminated string, but using strncpy() with
> the length equal to the buffer size may result in lack of the termination:
>
> drivers//soc/qcom/wcnss_ctrl.c: In function 'qcom_wcnss_open_channel':
> drivers//soc/qcom/wcnss_ctrl.c:284:2: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
> strncpy(chinfo.name, name, sizeof(chinfo.name));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This changes it to use the safer strscpy() instead.
>
> Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Regards,
Bjorn
> ---
> drivers/soc/qcom/wcnss_ctrl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
> index df3ccb30bc2d..373400dd816d 100644
> --- a/drivers/soc/qcom/wcnss_ctrl.c
> +++ b/drivers/soc/qcom/wcnss_ctrl.c
> @@ -281,7 +281,7 @@ struct rpmsg_endpoint *qcom_wcnss_open_channel(void *wcnss, const char *name, rp
> struct rpmsg_channel_info chinfo;
> struct wcnss_ctrl *_wcnss = wcnss;
>
> - strncpy(chinfo.name, name, sizeof(chinfo.name));
> + strscpy(chinfo.name, name, sizeof(chinfo.name));
> chinfo.src = RPMSG_ADDR_ANY;
> chinfo.dst = RPMSG_ADDR_ANY;
>
> --
> 2.17.1
>
On Wed 29 Aug 00:57 PDT 2018, Niklas Cassel wrote:
> QCOM_RPHM already selects ARM64, which always selects OF.
Nit. "already depends on ARM64"
>
> Additionally, the rpmh driver only uses linux/of.h, which has dummy
> definitions for all functions, in order for code to to be able to
> build without CONFIG_OF set.
>
> Remove the superfluous depends on OF.
>
> Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Regards,
Bjorn
> ---
> drivers/soc/qcom/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index ac657164a136..cf4ece232897 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -94,7 +94,7 @@ config QCOM_RMTFS_MEM
>
> config QCOM_RPMH
> bool "Qualcomm RPM-Hardened (RPMH) Communication"
> - depends on ARCH_QCOM && ARM64 && OF || COMPILE_TEST
> + depends on ARCH_QCOM && ARM64 || COMPILE_TEST
> help
> Support for communication with the hardened-RPM blocks in
> Qualcomm Technologies Inc (QTI) SoCs. RPMH communication uses an
> --
> 2.17.1
>
On Wed 29 Aug 00:57 PDT 2018, Niklas Cassel wrote:
> 'adev->name' is used as a NUL-terminated string, but using strncpy() with the
> length equal to the buffer size may result in lack of the termination:
>
> In function 'apr_add_device',
> inlined from 'of_register_apr_devices' at drivers//soc/qcom/apr.c:264:7,
> inlined from 'apr_probe' at drivers//soc/qcom/apr.c:290:2:
> drivers//soc/qcom/apr.c:222:3: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
> strncpy(adev->name, np->name, APR_NAME_SIZE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This changes it to use the safer strscpy() instead.
>
> Signed-off-by: Niklas Cassel <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Regards,
Bjorn
> ---
> drivers/soc/qcom/apr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
> index 57af8a537332..ee9197f5aae9 100644
> --- a/drivers/soc/qcom/apr.c
> +++ b/drivers/soc/qcom/apr.c
> @@ -219,9 +219,9 @@ static int apr_add_device(struct device *dev, struct device_node *np,
> adev->domain_id = id->domain_id;
> adev->version = id->svc_version;
> if (np)
> - strncpy(adev->name, np->name, APR_NAME_SIZE);
> + strscpy(adev->name, np->name, APR_NAME_SIZE);
> else
> - strncpy(adev->name, id->name, APR_NAME_SIZE);
> + strscpy(adev->name, id->name, APR_NAME_SIZE);
>
> dev_set_name(&adev->dev, "aprsvc:%s:%x:%x", adev->name,
> id->domain_id, id->svc_id);
> --
> 2.17.1
>
On Wed 29 Aug 00:57 PDT 2018, Niklas Cassel wrote:
> Since commit cab673583d96 ("soc: Unconditionally include qcom Makefile"),
> we unconditionally include the soc/qcom/Makefile.
>
> This opens up the possibility to compile test the code even when building
> for other architectures.
>
> Allow COMPILE_TEST for all qcom SoC Kconfigs, except for two Kconfigs
> that depend on QCOM_SCM, since that triggers lots of build errors in
> qcom_scm.
>
> Signed-off-by: Niklas Cassel <[email protected]>
> Reviewed-by: Vivek Gautam <[email protected]>
> Reviewed-by: Vinod Koul <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Regards,
Bjorn
> ---
> drivers/soc/qcom/Kconfig | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index cf4ece232897..684cb51694d1 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -33,7 +33,7 @@ config QCOM_GLINK_SSR
>
> config QCOM_GSBI
> tristate "QCOM General Serial Bus Interface"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> select MFD_SYSCON
> help
> Say y here to enable GSBI support. The GSBI provides control
> @@ -42,7 +42,7 @@ config QCOM_GSBI
>
> config QCOM_LLCC
> tristate "Qualcomm Technologies, Inc. LLCC driver"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> help
> Qualcomm Technologies, Inc. platform specific
> Last Level Cache Controller(LLCC) driver. This provides interfaces
> @@ -73,7 +73,8 @@ config QCOM_PM
>
> config QCOM_QMI_HELPERS
> tristate
> - depends on ARCH_QCOM && NET
> + depends on ARCH_QCOM || COMPILE_TEST
> + depends on NET
> help
> Helper library for handling QMI encoded messages. QMI encoded
> messages are used in communication between the majority of QRTR
> @@ -104,7 +105,7 @@ config QCOM_RPMH
>
> config QCOM_SMEM
> tristate "Qualcomm Shared Memory Manager (SMEM)"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> depends on HWSPINLOCK
> help
> Say y here to enable support for the Qualcomm Shared Memory Manager.
> @@ -113,7 +114,7 @@ config QCOM_SMEM
>
> config QCOM_SMD_RPM
> tristate "Qualcomm Resource Power Manager (RPM) over SMD"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> depends on RPMSG
> help
> If you say yes to this option, support will be included for the
> @@ -150,7 +151,7 @@ config QCOM_SMSM
>
> config QCOM_WCNSS_CTRL
> tristate "Qualcomm WCNSS control driver"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> depends on RPMSG
> help
> Client driver for the WCNSS_CTRL SMD channel, used to download nv
> @@ -158,7 +159,7 @@ config QCOM_WCNSS_CTRL
>
> config QCOM_APR
> tristate "Qualcomm APR Bus (Asynchronous Packet Router)"
> - depends on ARCH_QCOM
> + depends on ARCH_QCOM || COMPILE_TEST
> depends on RPMSG
> help
> Enable APR IPC protocol support between
> --
> 2.17.1
>
On Wed, Aug 29, 2018 at 09:57:14AM +0200, Niklas Cassel wrote:
> Since commit cab673583d96 ("soc: Unconditionally include qcom Makefile"),
> we unconditionally include the soc/qcom/Makefile.
>
> This opens up the possibility to compile test the code even when
> building for other architectures.
>
> This patch series prepares and enables all but two Kconfigs to be
> compile tested even when building for other architectures.
I picked up this entire set.
Regards,
Andy