lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42feceb8-512a-4be3-aefa-116bbde000c1@kernel.org>
Date: Tue, 10 Dec 2024 15:47:49 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Raj Kumar Bhagat <quic_rajkbhag@...cinc.com>, ath12k@...ts.infradead.org
Cc: linux-wireless@...r.kernel.org, Kalle Valo <kvalo@...nel.org>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>, Jeff Johnson <jjohnson@...nel.org>,
 linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
 Balamurugan S <quic_bselvara@...cinc.com>,
 P Praneesh <quic_ppranees@...cinc.com>
Subject: Re: [PATCH v4 08/13] wifi: ath12k: add AHB driver support for IPQ5332

On 10/12/2024 08:41, Raj Kumar Bhagat wrote:
> From: Balamurugan S <quic_bselvara@...cinc.com>
> 
> Add Initial Ath12k AHB driver support for IPQ5332. IPQ5332 is AHB
> based IEEE802.11be 2 GHz 2x2 WiFi device.
> 
> Tested-on: IPQ5332 hw1.0 AHB WLAN.WBE.1.3.1-00130-QCAHKSWPL_SILICONZ-1
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00210-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Balamurugan S <quic_bselvara@...cinc.com>
> Co-developed-by: P Praneesh <quic_ppranees@...cinc.com>
> Signed-off-by: P Praneesh <quic_ppranees@...cinc.com>
> Co-developed-by: Raj Kumar Bhagat <quic_rajkbhag@...cinc.com>
> Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@...cinc.com>
> ---
>  drivers/net/wireless/ath/ath12k/ahb.c  | 878 +++++++++++++++++++++++++
>  drivers/net/wireless/ath/ath12k/ahb.h  |  37 ++
>  drivers/net/wireless/ath/ath12k/core.h |   4 +
>  drivers/net/wireless/ath/ath12k/hal.h  |   1 +
>  drivers/net/wireless/ath/ath12k/hw.h   |   1 +
>  5 files changed, 921 insertions(+)
>  create mode 100644 drivers/net/wireless/ath/ath12k/ahb.c
>  create mode 100644 drivers/net/wireless/ath/ath12k/ahb.h
> 
> diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
> new file mode 100644
> index 000000000000..fcd949faea9f
> --- /dev/null
> +++ b/drivers/net/wireless/ath/ath12k/ahb.c
> @@ -0,0 +1,878 @@
> +// SPDX-License-Identifier: BSD-3-Clause-Clear
> +/*
> + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
> + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#include <linux/dma-mapping.h>
> +#include <linux/iommu.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>

You don't use this header.

> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +#include <linux/remoteproc.h>

More headers here look unused.

> +#include <linux/soc/qcom/smem.h>
> +#include <linux/soc/qcom/smem_state.h>
> +#include "ahb.h"
> +#include "debug.h"
> +#include "hif.h"
> +
> +static const struct of_device_id ath12k_ahb_of_match[] = {
> +	{ .compatible = "qcom,ipq5332-wifi",
> +	  .data = (void *)ATH12K_HW_IPQ5332_HW10,
> +	},
> +	{ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, ath12k_ahb_of_match);

This goes to driver struct declaration. It is really unusual to see it
in some other places.


> +
> +#define ATH12K_IRQ_CE0_OFFSET 4
> +


...

> +
> +static int ath12k_ahb_probe(struct platform_device *pdev)
> +{
> +	struct ath12k_base *ab;
> +	const struct ath12k_hif_ops *hif_ops;
> +	struct device_node *mem_node;
> +	enum ath12k_hw_rev hw_rev;
> +	u32 addr;
> +	int ret;
> +
> +	hw_rev = ath12k_ahb_get_hw_rev(pdev);
> +	switch (hw_rev) {
> +	case ATH12K_HW_IPQ5332_HW10:
> +		hif_ops = &ath12k_ahb_hif_ops_ipq5332;
> +		break;
> +	default:
> +		dev_err(&pdev->dev, "Unsupported device type %d\n", hw_rev);

You already print once in ath12k_ahb_get_hw_rev() and none of these can
happen. No need to print impossible conditions at all. No need to print
impossible things twice.

> +		return -EOPNOTSUPP;
> +	}
> +

> +	ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret) {
> +		dev_err(&pdev->dev, "Failed to set 32-bit coherent dma\n");
> +		return ret;
> +	}
> +
> +	ab = ath12k_core_alloc(&pdev->dev, sizeof(struct ath12k_ahb),
> +			       ATH12K_BUS_AHB);
> +	if (!ab) {
> +		dev_err(&pdev->dev, "failed to allocate ath12k base\n");
> +		return -ENOMEM;
> +	}
> +
> +	ab->hif.ops = hif_ops;
> +	ab->pdev = pdev;
> +	ab->hw_rev = hw_rev;
> +	platform_set_drvdata(pdev, ab);
> +
> +	/* Set fixed_mem_region to true for platforms that support fixed memory
> +	 * reservation from DT. If memory is reserved from DT for FW, ath12k driver
> +	 * need not to allocate memory.
> +	 */
> +	if (!of_property_read_u32(ab->dev->of_node, "memory-region", &addr)) {
> +		set_bit(ATH12K_FLAG_FIXED_MEM_REGION, &ab->dev_flags);
> +
> +		/* If the platform supports fixed memory, then it should define/
> +		 * reserve MLO global memory in DT to support Multi Link Operation
> +		 * (IEEE 802.11be).
> +		 * If MLO global memory is not reserved in fixed memory mode, then
> +		 * MLO cannot be supported.
> +		 */
> +		mem_node = of_find_node_by_name(NULL, "mlo_global_mem_0");

NAK. Incorrect name, not conforming to coding style. Undocumented ABI.

Drop all calls to of_find_node_by_name() or any other stuff like this.

> +		if (!mem_node)
> +			ab->single_chip_mlo_supp = false;
> +	}
> +
> +	ret = ath12k_core_pre_init(ab);
> +	if (ret)
> +		goto err_core_free;

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ