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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zld8bm1HP1H98+Ws@hu-bjorande-lv.qualcomm.com>
Date: Wed, 29 May 2024 12:05:18 -0700
From: Bjorn Andersson <quic_bjorande@...cinc.com>
To: Chris Lew <quic_clew@...cinc.com>
CC: Bjorn Andersson <andersson@...nel.org>,
        Baolin Wang
	<baolin.wang@...ux.alibaba.com>,
        Peter Zijlstra <peterz@...radead.org>,
        "Ingo
 Molnar" <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long
	<longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
        Jonathan Corbet
	<corbet@....net>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Rob Herring
	<robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley
	<conor+dt@...nel.org>,
        Manivannan Sadhasivam
	<manivannan.sadhasivam@...aro.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        <linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-doc@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
        <devicetree@...r.kernel.org>
Subject: Re: [PATCH v3 3/4] soc: qcom: smem: Add
 qcom_smem_bust_hwspin_lock_by_host()

On Wed, May 29, 2024 at 11:09:57AM -0700, Chris Lew wrote:
> Add qcom_smem_bust_hwspin_lock_by_host to enable remoteproc to bust the
> hwspin_lock owned by smem. In the event the remoteproc crashes
> unexpectedly, the remoteproc driver can invoke this API to try and bust
> the hwspin_lock and release the lock if still held by the remoteproc
> device.
> 

Reviewed-by: Bjorn Andersson <quic_bjorande@...cinc.com>

Regards,
Bjorn

> Signed-off-by: Chris Lew <quic_clew@...cinc.com>
> ---
>  drivers/soc/qcom/smem.c       | 26 ++++++++++++++++++++++++++
>  include/linux/soc/qcom/smem.h |  2 ++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index 7191fa0c087f..50039e983eba 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -359,6 +359,32 @@ static struct qcom_smem *__smem;
>  /* Timeout (ms) for the trylock of remote spinlocks */
>  #define HWSPINLOCK_TIMEOUT	1000
>  
> +/* The qcom hwspinlock id is always plus one from the smem host id */
> +#define SMEM_HOST_ID_TO_HWSPINLOCK_ID(__x) ((__x) + 1)
> +
> +/**
> + * qcom_smem_bust_hwspin_lock_by_host() - bust the smem hwspinlock for a host
> + * @host:	remote processor id
> + *
> + * Busts the hwspin_lock for the given smem host id. This helper is intended
> + * for remoteproc drivers that manage remoteprocs with an equivalent smem
> + * driver instance in the remote firmware. Drivers can force a release of the
> + * smem hwspin_lock if the rproc unexpectedly goes into a bad state.
> + *
> + * Context: Process context.
> + *
> + * Returns: 0 on success, otherwise negative errno.
> + */
> +int qcom_smem_bust_hwspin_lock_by_host(unsigned int host)
> +{
> +	/* This function is for remote procs, so ignore SMEM_HOST_APPS */
> +	if (host == SMEM_HOST_APPS || host >= SMEM_HOST_COUNT)
> +		return -EINVAL;
> +
> +	return hwspin_lock_bust(__smem->hwlock, SMEM_HOST_ID_TO_HWSPINLOCK_ID(host));
> +}
> +EXPORT_SYMBOL_GPL(qcom_smem_bust_hwspin_lock_by_host);
> +
>  /**
>   * qcom_smem_is_available() - Check if SMEM is available
>   *
> diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
> index a36a3b9d4929..03187bc95851 100644
> --- a/include/linux/soc/qcom/smem.h
> +++ b/include/linux/soc/qcom/smem.h
> @@ -14,4 +14,6 @@ phys_addr_t qcom_smem_virt_to_phys(void *p);
>  
>  int qcom_smem_get_soc_id(u32 *id);
>  
> +int qcom_smem_bust_hwspin_lock_by_host(unsigned int host);
> +
>  #endif
> 
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ