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: <f9c841f0-9839-47b7-b026-d0cd2138af11@kernel.org>
Date: Mon, 18 Dec 2023 17:19:36 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Dikshita Agarwal <quic_dikshita@...cinc.com>,
 linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
 stanimir.k.varbanov@...il.com, quic_vgarodia@...cinc.com, agross@...nel.org,
 andersson@...nel.org, konrad.dybcio@...aro.org, mchehab@...nel.org,
 bryan.odonoghue@...aro.org
Cc: linux-arm-msm@...r.kernel.org, quic_abhinavk@...cinc.com
Subject: Re: [PATCH v2 12/34] media: iris: add video processing unit(VPU)
 specific register handling

On 18/12/2023 12:32, Dikshita Agarwal wrote:
> Registers are defined differently for different VPUs.
> Define ops for VPU specific handling to accommodate
> different VPUs. Implement boot sequence of firmware and interrupt
> programming.
> 

...

> +
> +int write_register(struct iris_core *core, u32 reg, u32 value)
> +{
> +	void __iomem *base_addr;
> +	int ret;
> +
> +	ret = check_core_lock(core);
> +	if (ret)
> +		return ret;
> +
> +	base_addr = core->reg_base;
> +	base_addr += reg;
> +	writel_relaxed(value, base_addr);
> +
> +	/* Make sure value is written into the register */
> +	wmb();

Just don't use relaxed method. The same applies to other places like that.

> +
> +	return ret;
> +}
> +
> +int read_register(struct iris_core *core, u32 reg, u32 *value)
> +{
> +	void __iomem *base_addr;
> +
> +	base_addr = core->reg_base;
> +
> +	*value = readl_relaxed(base_addr + reg);
> +
> +	/* Make sure value is read correctly from the register */
> +	rmb();
> +
> +	return 0;
> +}
> +
> +static const struct compat_handle compat_handle[] = {
> +	{
> +		.compat                  = "qcom,sm8550-iris",
> +		.init                    = init_iris3,

Uh...

> +	},
> +};
> +
> +int init_vpu(struct iris_core *core)
> +{
> +	struct device *dev = NULL;
> +	int i, ret = 0;
> +
> +	dev = core->dev;
> +
> +	for (i = 0; i < ARRAY_SIZE(compat_handle); i++) {
> +		if (of_device_is_compatible(dev->of_node, compat_handle[i].compat)) {
> +			ret = compat_handle[i].init(core);


This does not look good. Use flags, quirks, type, pointer ops in
structures. Just look at existing code in Linux kernel. Do not
reimplement driver match data.



Best regards,
Krzysztof


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ