Compile error on QCA SSDK

Hi all,

Am (trying) to add support for IPQ5018 devices but am getting the following error while compiling QCA-SSDK, any help would be highly appreciated as I'm stuck now. Usually incompatible pointers trigger warnings unless CFLAGS have been changed.
I don't want to mess around with changing any of the SSDK code and/or Makefiles. Has anyone encountered this before and/or is able to provide any guidance on how to solve this issue?

/home/gemous/openwrt/mx5500/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq5018/qca-ssdk-2023-06-06-74caf88a/temp/src/hsl/dess/dess_qos.c:1536:39: error: assignment to 'hsl_qos_port_rx_buf_nr_set' {aka 'sw_error_t (*)(unsigned int, unsigned int, unsigned int *, unsigned int )'} from incompatible pointer type 'sw_error_t ()(a_uint32_t, fal_port_t, a_uint32_t )' {aka 'sw_error_t ()(unsigned int, unsigned int, unsigned int *)'} [-Werror=incompatible-pointer-types]
1536 | p_api->qos_port_rx_buf_nr_set = dess_qos_port_rx_buf_nr_set;

My build environment is Debian 12 based and have set it up as per: https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem

this is 3rd party SDK, ask the provider for assistance.
you should already know this from IPQ5018: Potential future support for Linksys MX2000 Atlas 6 & MX5500 Atlas 6 Pro

thanks frollic, I understand it's a 3rd party SDK, but this is as part of compiling openwrt and trying to add openwrt support for new devices. I've seen other threads on issues with this SDK where Qs have been answered here too and am just looking to see if anyone has run into this issue or is able to give me any pointers.

AFAIK IPQ5018 still isn't supported by Linux, so whatever you're using, isn't anywhere near openwrt.

thanks for another very useful reply.

this is openwrt as I'm trying out patches that have been submitted upstream to find out what's working and what's missing (and that's a lot). Nonetheless, it's at very early stages, but am trying to see if we can get openwrt booted and move from there. Serial (UART), SPI, I2C, MDIO, the two switches should be working (QCA8337 and the soc's builtin) based on existing drivers and submitted patches (GCC, pinctrl, and more), perhaps USB2, wireless too (QCN9074, IPQ5018, both available on QUIC and kvalo's repo), and the PWM leds. Obvious components missing are the QPIC nand controller for SPI Nand, USB3 (uniphy), PCIE (uniphy), tsens (though people are working on it). If working and accepted upstream, I intend to submit the patches for 6.1 kernel support such as robimarko has done for IPQ8074.

1 Like

Please post a link to your code (github, gitlab whatever) otherwise it's impossible to analyze the compile error for the qca-ssdk package.

And as I already wrote in the other thread, you need to change the Makefile due to qca-ssdk use different CFLGAS for different hardware.

Yes, makefile is checking the subtarget to pass the codename for the correct soc.
If none is passed it will try and compile for dess(ipq40xx) and that will fail.

I think that codename for IPQ50xx is MP for SSDK.

thanks both, and again, I'm a beginner here so thanks for your patience.

just created a quick repo here: https://github.com/georgemoussalem/openwrt/
guidance on how to setup the Makefile would be highly appreciated

You can do it like this:

Just change the subtarget and codename

1 Like

I've confirmed in the source that MP is the codename for ipq50xx.
Still getting the compile error though, even after removing WError flag from CPU_CFLAGS here in the config file:
openwrt/package/kernel/qca-ssdk/patches/0010-qsdk-config-avoid-werror-heroics.patch at main · georgemoussalem/openwrt (github.com)

I'm probably missing something trivial, perhaps I missed a reference to CONFIG_TARGET_SUBTARGET or setting it to ipq50xx somewhere?

Yes you need to rename your entire SUBTARGET from ipq5018 to ipq50xx

In addition you need a patch for qca-ssdk:

--- a/src/init/ssdk_clk.c
+++ b/src/init/ssdk_clk.c
@@ -721,7 +721,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset,
 {
 	void __iomem *tcsr_base = NULL;
 
-	tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+	tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
 	if (!tcsr_base)
 	{
 		SSDK_ERROR("Failed to map tcsr eth address!\n");
@@ -738,7 +738,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset,
 {
 	void __iomem *tcsr_base = NULL;
 
-	tcsr_base = ioremap_nocache(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
+	tcsr_base = ioremap(TCSR_ETH_ADDR, TCSR_ETH_SIZE);
 	if (!tcsr_base)
 	{
 		SSDK_ERROR("Failed to map tcsr eth address!\n");
@@ -786,7 +786,7 @@ ssdk_mp_cmnblk_stable_check(void)
 	a_uint32_t reg_val;
 	int i, loops = 20;
 
-	pll_lock = ioremap_nocache(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
+	pll_lock = ioremap(CMN_PLL_LOCKED_ADDR, CMN_PLL_LOCKED_SIZE);
 	if (!pll_lock) {
 		SSDK_ERROR("Failed to map CMN PLL LOCK register!\n");
 		return A_FALSE;
@@ -843,7 +843,7 @@ static void ssdk_cmnblk_pll_src_set(enum
 	void __iomem *cmn_pll_src_base = NULL;
 	a_uint32_t reg_val;
 
-	cmn_pll_src_base = ioremap_nocache(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
+	cmn_pll_src_base = ioremap(CMN_BLK_PLL_SRC_ADDR, CMN_BLK_SIZE);
 	if (!cmn_pll_src_base) {
 		SSDK_ERROR("Failed to map cmn pll source address!\n");
 		return;

Place that in the qca-ssdk package patches dir

@robimarko: it looks like QCA missed some ioremap_nocache entries in there kernel 6.1 commit.

1 Like

Next thing would be nss-dp, that ends up with:

build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/nss_dp_main.c:552:13: error: implicit declaration of function 'skb_vlan_tagged_multi' [-Werror=implicit-function-declaration]
  552 |         if (skb_vlan_tagged_multi(skb)) {
      |             ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Not shocking they missed things, they are always doing things half-assed.

NSS-DP errors are also expected as IPQ50xx is using a different ethernet HW and its driver is not patched.

great stuff, ssdk compiles now and is taking a different path based on the subtarget update and your pach!
it now indeed fails on compiling the qca-nss-dp package with:

  CC [M]  /home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/gmac_ops/syn/gmac/syn_if.o
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c: In function 'syn_dp_rx_inval_and_flush':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c:80:17: error: implicit declaration of function 'dmac_flush_range_no_dsb' [-Werror=implicit-function-declaration]
   80 |                 dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c: In function 'syn_dp_rx_refill_page_mode':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c:135:17: error: implicit declaration of function 'dmac_inv_range_no_dsb' [-Werror=implicit-function-declaration]
  135 |                 dmac_inv_range_no_dsb(page_addr, (page_addr + PAGE_SIZE));
      |                 ^~~~~~~~~~~~~~~~~~~~~
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/soc_ops/ipq50xx/nss_ipq50xx.c: In function 'nss_dp_hal_tcsr_set':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/soc_ops/ipq50xx/nss_ipq50xx.c:85:23: error: implicit declaration of function 'qti_scm_tcsr_reg_write' [-Werror=implicit-function-declaration]
   85 |                 err = qti_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
      |                       ^~~~~~~~~~~~~~~~~~~~~~
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c: In function 'syn_dp_tx_process_nr_frags':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c:109:17: error: implicit declaration of function 'dmac_clean_range_no_dsb' [-Werror=implicit-function-declaration]
  109 |                 dmac_clean_range_no_dsb(frag_addr, frag_addr + length);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c: In function 'syn_dp_rx':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c:442:17: error: implicit declaration of function 'dmac_inv_range' [-Werror=implicit-function-declaration]
  442 |                 dmac_inv_range((void *)rx_buf->map_addr_virt,
      |                 ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [scripts/Makefile.build:250: /home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/hal/soc_ops/ipq50xx/nss_ipq50xx.o] Error 1
make[4]: *** Waiting for unfinished jobs....
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/nss_dp_main.c: In function 'nss_dp_feature_check':
/home/gemous/openwrt/ipq5018/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq50xx/qca-nss-dp-2023-06-06-fa674644/nss_dp_main.c:552:13: error: implicit declaration of function 'skb_vlan_tagged_multi' [-Werror=implicit-function-declaration]
  552 |         if (skb_vlan_tagged_multi(skb)) {
      |             ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

getting closer though!

just adding the driver for PWM, PWM leds and ipq5018-wifi now and will do some testing.

Well, they gotta be kidding that they managed to use raw DMA ASM instructions that were dropped over 10 years ago in a new driver.

That was a mess to port to a standard DMA API in NSS-DRV

why i read DMA and ipq50xx...

Seems they are using some Synopsis IP instead of in-house and they are using the same DMA crap like they did in NSS-DRV

found this older thread where you were facing, what seems like, similar issues @robimarko and @Ansuel: Adding OpenWrt support for Xiaomi AX3600 (Part 1) - #1144 by robimarko

not sure if I'm asking a lot, but would you be able to help on the current compilation issues? Found this WIP patch that would maybe help?
openwrt-redmi-ax3000/package/kernel/qca-nss-dp/patches/0101-WiP-use-standard-DMA-api.patch

alright, am able to compile NSS-DP now. I changed the above-mentioned patch to include a missing variable to syn_dp_cfg_rx.c in function sync_dp_cfg_rx_setup_desc_queu():
dma_addr_t dma_addr;

nss_dp_main.c was missing a reference to a header file:

--- a/nss_dp_main.c
+++ b/nss_dp_main.c
@@ -26,6 +26,7 @@
 #include <linux/of_address.h>
 #include <linux/of_mdio.h>
 #include <linux/phy.h>
+#include <linux/if_vlan.h>
 #if defined(NSS_DP_PPE_SUPPORT)
 #include <fal/fal_vsi.h>
 #include <ref/ref_vsi.h>

and last, had to edit the config file of QCA-SSDK and include two extra modules for the MP chiptype as the compiler was throwing modpost errors to undefined functions in QCA-SSDK. The functions were exported though, but they weren't included as modules so the compiler wouldn't pick up on them.

--- a/config
+++ b/config
@@ -363,6 +363,8 @@ ifneq (, $(filter MPPE APPE HPPE CPPE AL
 endif

 ifneq (, $(filter MP, $(CHIP_TYPE)))
+       IN_CTRLPKT=TRUE
+       IN_VSI=TRUE
        IN_UNIPHY=TRUE
 endif

@@ -444,7 +446,7 @@ ifeq (MP, $(CHIP_TYPE))
                IN_QM=FALSE
                IN_PPPOE=FALSE
                IN_VSI=FALSE
-               IN_CTRLPKT=FALSE
+#              IN_CTRLPKT=FALSE
                IN_SERVCODE=FALSE
                IN_BM=FALSE
                IN_SHAPER=FALSE

will now try and configure the switches

I think you're confusing SDK and SSDK. The latter is Qualcomm switch driver code, which is still necessary even on OpenWrt to my knowledge. See also: