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]
Date:   Thu, 9 Mar 2023 07:58:42 +0200
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     "Bao D. Nguyen" <quic_nguyenb@...cinc.com>,
        quic_asutoshd@...cinc.com, quic_cang@...cinc.com,
        bvanassche@....org, mani@...nel.org, stanley.chu@...iatek.com,
        beanhuo@...ron.com, avri.altman@....com, martin.petersen@...cle.com
Cc:     linux-scsi@...r.kernel.org, Alim Akhtar <alim.akhtar@...sung.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        Arthur Simchaev <Arthur.Simchaev@....com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v2 1/3] ufs: mcq: Add supporting functions for mcq
 abort

On 9/03/23 07:28, Bao D. Nguyen wrote:
> Add supporting functions to handle ufs abort in mcq mode.
> 
> Signed-off-by: Bao D. Nguyen <quic_nguyenb@...cinc.com>
> ---
>  drivers/ufs/core/ufs-mcq.c     | 181 +++++++++++++++++++++++++++++++++++++++++
>  drivers/ufs/core/ufshcd-priv.h |  14 ++++
>  drivers/ufs/core/ufshcd.c      |   3 +-
>  include/ufs/ufshcd.h           |   1 +
>  include/ufs/ufshci.h           |  16 ++++
>  5 files changed, 214 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
> index 31df052..4c33c1a 100644
> --- a/drivers/ufs/core/ufs-mcq.c
> +++ b/drivers/ufs/core/ufs-mcq.c
> @@ -12,6 +12,9 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include "ufshcd-priv.h"
> +#include <linux/delay.h>
> +#include <scsi/scsi_cmnd.h>
> +#include <linux/bitfield.h>
>  
>  #define MAX_QUEUE_SUP GENMASK(7, 0)
>  #define UFS_MCQ_MIN_RW_QUEUES 2
> @@ -27,6 +30,9 @@
>  #define MCQ_ENTRY_SIZE_IN_DWORD	8
>  #define CQE_UCD_BA GENMASK_ULL(63, 7)
>  
> +/* Max mcq register polling time in millisecond unit */
> +#define MCQ_POLL_MS 500
> +
>  static int rw_queue_count_set(const char *val, const struct kernel_param *kp)
>  {
>  	return param_set_uint_minmax(val, kp, UFS_MCQ_MIN_RW_QUEUES,
> @@ -429,3 +435,178 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
>  	host->host_tagset = 1;
>  	return 0;
>  }
> +
> +static int ufshcd_mcq_poll_register(void __iomem *reg, u32 mask,
> +			u32 val, unsigned long timeout_ms)
> +{
> +	unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
> +	int err = 0;
> +
> +	/* ignore bits that we don't intend to wait on */
> +	val = val & mask;
> +
> +	while ((readl(reg) & mask) != val) {
> +		usleep_range(10, 50);
> +		if (time_after(jiffies, timeout)) {
> +			err = -ETIMEDOUT;
> +			break;
> +		}
> +	}

Should be able to use a macro from include/linux/iopoll.h
here

> +
> +	return err;
> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ