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] [day] [month] [year] [list]
Date:	Thu, 02 May 2013 17:01:18 +0530
From:	Sujit Reddy Thumma <sthumma@...eaurora.org>
To:	Santosh Y <santoshsy@...il.com>
CC:	Vinayak Holikatti <vinholikatti@...il.com>,
	"James E.J. Bottomley" <JBottomley@...allels.com>,
	linux-arm-msm@...r.kernel.org, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU

On 5/2/2013 12:57 PM, Santosh Y wrote:
>> +
>> +/**
>> + * ufshcd_validate_dev_connection() - Check device connection status
>> + * @hba: per-adapter instance
>> + *
>> + * Send NOP OUT UPIU and wait for NOP IN response to check whether the
>> + * device Transport Protocol (UTP) layer is ready after a reset.
>> + * If the UTP layer at the device side is not initialized, it may
>> + * not respond with NOP IN UPIU within timeout of %NOP_OUT_TIMEOUT
>> + * and we retry sending NOP OUT for %NOP_OUT_RETRIES iterations.
>> + */
>> +static int ufshcd_validate_dev_connection(struct ufs_hba *hba)
>> +{
>> +       int err;
>> +       struct ufshcd_lrb *lrbp;
>> +       unsigned long timeout;
>> +       unsigned long flags;
>> +       struct completion wait;
>> +       int retries = NOP_OUT_RETRIES;
>> +
>> +retry:
>> +       spin_lock_irqsave(hba->host->host_lock, flags);
>> +       lrbp = &hba->lrb[INTERNAL_CMD_TAG];
>> +       init_completion(&wait);
>> +
>> +       err = ufshcd_compose_nop_out_upiu(hba, lrbp);
>> +       if (err)
>> +               goto may_retry;
>> +
>> +       lrbp->completion = &wait;
>> +       ufshcd_send_command(hba, INTERNAL_CMD_TAG);
>> +       spin_unlock_irqrestore(hba->host->host_lock, flags);
>> +
>> +       timeout = wait_for_completion_timeout(
>> +                       &wait, msecs_to_jiffies(NOP_OUT_TIMEOUT));
>> +
>> +       spin_lock_irqsave(hba->host->host_lock, flags);
>> +       if (timeout > 0) {
>> +               int ocs;
>> +
>> +               ocs = ufshcd_get_tr_ocs(lrbp);
>> +               switch (ocs) {
>> +               case OCS_SUCCESS:
>> +                       goto out;
>> +               default:
>> +                       dev_dbg(hba->dev, "%s: OCS error %d\n", __func__, ocs);
>> +                       err = -EIO;
>> +                       goto may_retry;
>> +               }
>> +       } else {
>> +               u32 reg;
>> +
>> +               err = -ETIMEDOUT;
>> +
>> +               /* clear outstanding transaction before retry */
>> +               ufshcd_utrl_clear(hba, INTERNAL_CMD_TAG);
>> +               __clear_bit(INTERNAL_CMD_TAG, &hba->outstanding_reqs);
>> +
>> +               /* poll for max. 1 sec to clear door bell register by h/w */
>> +               spin_unlock_irqrestore(hba->host->host_lock, flags);
>> +               if (readl_poll_timeout(
>> +                               hba->mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL,
>> +                               reg, !(reg & INTERNAL_CMD_TAG), 1000, 1000))
>
> Condition is always true here, change it to !(reg & (1 << INTERNAL_CMD_TAG)).

Good catch. I will update.

>
>> +                       retries = 0;
>> +               spin_lock_irqsave(hba->host->host_lock, flags);
>> +               goto may_retry;
>> +       }
>> +
>
>
>

-- 
Regards,
Sujit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ