Re: [PATCH v7 6/8] scsi: ufs: make the UFS variant a platform device

2015-10-22 Thread subhashj
Comments inline below:

> This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
> a platform device.
> In order to do so a few additional changes are required:
> 1. The ufshcd-pltfrm is no longer serves as a platform device.
>Now it only serves as a group of platform APIs such as PM APIs
>(runtime suspend/resume, system suspend/resume etc), parsers of
>clocks, regulators and pm_levels from DT.
> 2. What used to be the old platform "probe" is now "only"
>a pltfrm_init() routine, that does exactly the same, but only
>being called by the new probe function of the UFS variant.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 +
>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-
>  drivers/scsi/ufs/ufs-qcom.c| 62 +-
>  drivers/scsi/ufs/ufshcd-pltfrm.c   | 98
> ++
>  drivers/scsi/ufs/ufshcd-pltfrm.h   | 41 +
>  drivers/scsi/ufs/ufshcd.c  | 10 +++
>  drivers/scsi/ufs/ufshcd.h  |  1 +
>  7 files changed, 199 insertions(+), 74 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/ufs/ufs-qcom.txt
>  create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.h
>
> diff --git a/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
> b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
> new file mode 100644
> index 000..452e4ef
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
> @@ -0,0 +1,57 @@
> +* Qualcomm Technologies Inc Universal Flash Storage (UFS) PHY
> +
> +UFSPHY nodes are defined to describe on-chip UFS PHY hardware macro.
> +Each UFS PHY node should have its own node.
> +
> +To bind UFS PHY with UFS host controller, the controller node should
> +contain a phandle reference to UFS PHY node.
> +
> +Required properties:
> +- compatible: compatible list, contains "qcom,ufs-phy-qmp-20nm"
> +   or "qcom,ufs-phy-qmp-14nm" according to the relevant phy 
> in use.
> +- reg   : should contain PHY register address space
> (mandatory),
> +- reg-names : indicates various resources passed to driver (via
> reg proptery) by name.
> +  Required "reg-names" is "phy_mem".
> +- #phy-cells: This property shall be set to 0
> +- vdda-phy-supply   : phandle to main PHY supply for analog domain
> +- vdda-pll-supply   : phandle to PHY PLL and Power-Gen block power supply
> +- clocks : List of phandle and clock specifier pairs
> +- clock-names   : List of clock input name strings sorted in the same
> +   order as the clocks property. "ref_clk_src", "ref_clk",
> +   "tx_iface_clk" & "rx_iface_clk" are mandatory but
> +   "ref_clk_parent" is optional
> +
> +Optional properties:
> +- vdda-phy-max-microamp : specifies max. load that can be drawn from phy
> supply
> +- vdda-pll-max-microamp : specifies max. load that can be drawn from pll
> supply
> +- vddp-ref-clk-supply   : phandle to UFS device ref_clk pad power supply
> +- vddp-ref-clk-max-microamp : specifies max. load that can be drawn from
> this supply
> +- vddp-ref-clk-always-on : specifies if this supply needs to be kept
> always on
> +
> +Example:
> +
> + ufsphy1: ufsphy@0xfc597000 {
> + compatible = "qcom,ufs-phy-qmp-20nm";
> + reg = <0xfc597000 0x800>;
> + reg-names = "phy_mem";
> + #phy-cells = <0>;
> + vdda-phy-supply = <_l4>;
> + vdda-pll-supply = <_l12>;
> + vdda-phy-max-microamp = <5>;
> + vdda-pll-max-microamp = <1000>;
> + clock-names = "ref_clk_src",
> + "ref_clk_parent",
> + "ref_clk",
> + "tx_iface_clk",
> + "rx_iface_clk";
> + clocks = <_rpm clk_ln_bb_clk>,
> + <_gcc clk_pcie_1_phy_ldo >,
> + <_gcc clk_ufs_phy_ldo>,
> + <_gcc clk_gcc_ufs_tx_cfg_clk>,
> + <_gcc clk_gcc_ufs_rx_cfg_clk>;
> + };
> +
> + ufshc@0xfc598000 {
> + ...
> + phys = <>;
> + };
> diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> index 5357919..c0f10d3 100644
> --- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> +++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
> @@ -4,7 +4,9 @@ UFSHC nodes are defined to describe on-chip UFS host
> controllers.
>  Each UFS controller instance should have its own node.
>
>  Required properties:
> -- compatible: compatible list, contains "jedec,ufs-1.1"
> +- compatible: compatible list, contains "jedec,ufs-1.1" or
> +   "qcom,msm8994-ufshc" or "qcom,msm8996-ufshc"

Are we really using 

Re: [PATCH v3 02/15] scsi: ufs: clear fields UTRD, UPIU req and rsp before new transfers

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 



> Some of the data structures (like response UPIU) and/or its elements
> (unused fields) should be cleared before sending out the respective
> command to UFS device.
>
> This change clears the UPIU response data structure for query commands
> and NOP command before sending out the command. We also initialize the
> PRDT table length to zero which should take care of commands which doesn't
> have any data associated with it. We are also clearing the unused fields
> in
> request UPIU for NOP command.
>
> Signed-off-by: Subhash Jadavani 
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 3428f72..2d3ebca 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1129,6 +1129,8 @@ static void ufshcd_prepare_req_desc_hdr(struct
> ufshcd_lrb *lrbp,
>   cpu_to_le32(OCS_INVALID_COMMAND_STATUS);
>   /* dword_3 is reserved, hence it is set to 0 */
>   req_desc->header.dword_3 = 0;
> +
> + req_desc->prd_table_length = 0;
>  }
>
>  /**
> @@ -1198,6 +1200,7 @@ static void ufshcd_prepare_utp_query_req_upiu(struct
> ufs_hba *hba,
>   if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
>   memcpy(descp, query->descriptor, len);
>
> + memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
>  }
>
>  static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
> @@ -1210,6 +1213,11 @@ static inline void
> ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
>   ucd_req_ptr->header.dword_0 =
>   UPIU_HEADER_DWORD(
>   UPIU_TRANSACTION_NOP_OUT, 0, 0, lrbp->task_tag);
> + /* clear rest of the fields of basic header */
> + ucd_req_ptr->header.dword_1 = 0;
> + ucd_req_ptr->header.dword_2 = 0;
> +
> + memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
>  }
>
>  /**
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 4/8] add ufshcd_get_variant ufshcd_set_variant

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 


> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 34 +-
>  drivers/scsi/ufs/ufshcd.h   | 21 +
>  2 files changed, 38 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 6c23bbf..64c54b7 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -155,7 +155,7 @@ out:
>
>  static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct phy *phy = host->generic_phy;
>   u32 tx_lanes;
>   int err = 0;
> @@ -211,7 +211,7 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
>
>  static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct phy *phy = host->generic_phy;
>   int ret = 0;
>   bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
> @@ -273,7 +273,7 @@ static void ufs_qcom_enable_hw_clk_gating(struct
> ufs_hba *hba)
>
>  static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, bool status)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   int err = 0;
>
>   switch (status) {
> @@ -307,7 +307,7 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba
> *hba, bool status)
>  static unsigned long
>  ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear, u32 hs, u32 rate)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct ufs_clk_info *clki;
>   u32 core_clk_period_in_ns;
>   u32 tx_clk_cycles_per_us = 0;
> @@ -448,7 +448,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba
> *hba, bool status)
>
>  static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct phy *phy = host->generic_phy;
>   int ret = 0;
>
> @@ -479,7 +479,7 @@ out:
>
>  static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct phy *phy = host->generic_phy;
>   int err;
>
> @@ -621,7 +621,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba
> *hba,
>   struct ufs_pa_layer_attr *dev_req_params)
>  {
>   u32 val;
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   struct phy *phy = host->generic_phy;
>   struct ufs_qcom_dev_params ufs_qcom_cap;
>   int ret = 0;
> @@ -696,7 +696,7 @@ out:
>
>  static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>
>   if (host->hw_ver.major == 0x1)
>   return UFSHCI_VERSION_11;
> @@ -715,7 +715,7 @@ static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba
> *hba)
>   */
>  static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>
>   if (host->hw_ver.major == 0x01) {
>   hba->quirks |= UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS
> @@ -740,7 +740,7 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba
> *hba)
>
>  static void ufs_qcom_set_caps(struct ufs_hba *hba)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>
>   if (host->hw_ver.major >= 0x2)
>   host->caps = UFS_QCOM_CAP_QUNIPRO;
> @@ -811,7 +811,7 @@ static void ufs_qcom_get_speed_mode(struct
> ufs_pa_layer_attr *p, char *result)
>
>  static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
>  {
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   int err = 0;
>   int vote = 0;
>
> @@ -866,7 +866,7 @@ show_ufs_to_mem_max_bus_bw(struct device *dev, struct
> device_attribute *attr,
>   char *buf)
>  {
>   struct ufs_hba *hba = dev_get_drvdata(dev);
> - struct ufs_qcom_host *host = hba->priv;
> + struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>
>   return snprintf(buf, PAGE_SIZE, "%u\n",
>   host->bus_vote.is_max_bw_needed);
> @@ -877,7 +877,7 @@ store_ufs_to_mem_max_bus_bw(struct device *dev, struct
> device_attribute *attr,
>   const char *buf, size_t count)
>  {
>   struct ufs_hba *hba = dev_get_drvdata(dev);
> - struct ufs_qcom_host *host = hba->priv;
> + 

Re: [PATCH v7 8/8] scsi: ufs-qcom: add QUniPro hardware support and power optimizations

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 

> New revisions of UFS host controller supports the new UniPro
> hardware controller (referred as QUniPro). This patch adds
> the support to enable this new UniPro controller hardware.
>
> This change also adds power optimization for bus scaling feature,
> as well as support for HS-G3 power mode.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 640
> 
>  drivers/scsi/ufs/ufs-qcom.h |  31 ++-
>  drivers/scsi/ufs/ufshcd.c   |   8 +-
>  drivers/scsi/ufs/ufshcd.h   |  27 +-
>  4 files changed, 525 insertions(+), 181 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 1633808..4f38d00 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -44,11 +44,11 @@ enum {
>
>  static struct ufs_qcom_host *ufs_qcom_hosts[MAX_UFS_QCOM_HOSTS];
>
> -static void ufs_qcom_get_speed_mode(struct ufs_pa_layer_attr *p, char
> *result);
> -static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host,
> - const char *speed_mode);
>  static int ufs_qcom_set_bus_vote(struct ufs_qcom_host *host, int vote);
>  static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host);
> +static int ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div(struct ufs_hba
> *hba,
> +u32 clk_cycles);
> +
>  static void ufs_qcom_dump_regs(struct ufs_hba *hba, int offset, int len,
>   char *prefix)
>  {
> @@ -177,6 +177,7 @@ static int ufs_qcom_init_lane_clks(struct
> ufs_qcom_host *host)
>
>   err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk",
>   >tx_l1_sync_clk);
> +
>  out:
>   return err;
>  }
> @@ -209,7 +210,9 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
>
>   do {
>   err = ufshcd_dme_get(hba,
> - UIC_ARG_MIB(MPHY_TX_FSM_STATE), _fsm_val);
> + UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE,
> + UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
> + _fsm_val);
>   if (err || tx_fsm_val == TX_FSM_HIBERN8)
>   break;
>
> @@ -223,7 +226,9 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
>*/
>   if (time_after(jiffies, timeout))
>   err = ufshcd_dme_get(hba,
> - UIC_ARG_MIB(MPHY_TX_FSM_STATE), _fsm_val);
> + UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE,
> + UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
> + _fsm_val);
>
>   if (err) {
>   dev_err(hba->dev, "%s: unable to get TX_FSM_STATE, err %d\n",
> @@ -237,6 +242,15 @@ static int ufs_qcom_check_hibern8(struct ufs_hba
> *hba)
>   return err;
>  }
>
> +static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host)
> +{
> + ufshcd_rmwl(host->hba, QUNIPRO_SEL,
> +ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0,
> +REG_UFS_CFG1);
> + /* make sure above configuration is applied before we return */
> + mb();
> +}
> +
>  static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
>  {
>   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
> @@ -251,9 +265,11 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba
> *hba)
>   usleep_range(1000, 1100);
>
>   ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B);
> +
>   if (ret) {
> - dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret 
> =
> %d\n",
> - __func__, ret);
> + dev_err(hba->dev,
> + "%s: ufs_qcom_phy_calibrate_phy()failed, ret = %d\n",
> + __func__, ret);
>   goto out;
>   }
>
> @@ -274,9 +290,12 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba
> *hba)
>
>   ret = ufs_qcom_phy_is_pcs_ready(phy);
>   if (ret)
> - dev_err(hba->dev, "%s: is_physical_coding_sublayer_ready() 
> failed, ret
> = %d\n",
> + dev_err(hba->dev,
> + "%s: is_physical_coding_sublayer_ready() failed, ret = 
> %d\n",
>   __func__, ret);
>
> + ufs_qcom_select_unipro_mode(host);
> +
>  out:
>   return ret;
>  }
> @@ -299,7 +318,8 @@ static void ufs_qcom_enable_hw_clk_gating(struct
> ufs_hba *hba)
>   mb();
>  }
>
> -static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, bool status)
> +static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
> +   enum ufs_notify_change_status status)
>  {
>   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>   int err = 0;
> @@ -329,12 +349,12 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba
> *hba, bool status)
>  }
>
>  /**
> - * Returns non-zero for success (which rate of core_clk) and 0
> - * in case of a failure
> + * Returns 

Re: [PATCH v7 6/8] scsi: ufs: make the UFS variant a platform device

2015-10-22 Thread Arnd Bergmann
On Thursday 22 October 2015 07:02:14 subha...@codeaurora.org wrote:
> >
> >  Required properties:
> > -- compatible: compatible list, contains "jedec,ufs-1.1"
> > +- compatible: compatible list, contains "jedec,ufs-1.1" or
> > + "qcom,msm8994-ufshc" or "qcom,msm8996-ufshc"
> 
> Are we really using these "qcom,msm8994-ufshc" or "qcom,msm8996-ufshc"
> compatible string anywhere?

We should list them in either case, but it could be clarified as:

compatible  : must contain "jedec,ufs-1.1", may also list one or more
  of the following:
"qcom,msm8994-ufshc"
"qcom,msm8996-ufshc"
"qcom,ufshc"

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4] scsi: ufs: add ioctl interface for query request

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 

> This patch exposes the ioctl interface for UFS driver via SCSI device
> ioctl interface. As of now UFS driver would provide the ioctl for query
> interface to connected UFS device.
>
> Signed-off-by: Dolev Raviv 
> Signed-off-by: Noa Rubens 
> Signed-off-by: Raviv Shvili 
> Signed-off-by: Gilad Broner 
> Signed-off-by: Yaniv Gardi 
> ---
>  drivers/scsi/ufs/ufs.h|  53 +++
>  drivers/scsi/ufs/ufshcd.c | 208
> +-
>  include/uapi/scsi/Kbuild  |   1 +
>  include/uapi/scsi/ufs/Kbuild  |   3 +
>  include/uapi/scsi/ufs/ioctl.h |  58 
>  include/uapi/scsi/ufs/ufs.h   |  67 ++
>  6 files changed, 347 insertions(+), 43 deletions(-)
>  create mode 100644 include/uapi/scsi/ufs/Kbuild
>  create mode 100644 include/uapi/scsi/ufs/ioctl.h
>  create mode 100644 include/uapi/scsi/ufs/ufs.h
>
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 05e0f23..eab739d 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -38,6 +38,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #define MAX_CDB_SIZE 16
>  #define GENERAL_UPIU_REQUEST_SIZE 32
> @@ -72,6 +73,16 @@ enum {
>   UFS_UPIU_RPMB_WLUN  = 0xC4,
>  };
>
> +/**
> + * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit
> descriptor
> + * @lun: LU number to check
> + * @return: true if the lun has a matching unit descriptor, false
> otherwise
> + */
> +static inline bool ufs_is_valid_unit_desc_lun(u8 lun)
> +{
> + return lun == UFS_UPIU_RPMB_WLUN || (lun < UFS_UPIU_MAX_GENERAL_LUN);
> +}
> +
>  /*
>   * UFS Protocol Information Unit related definitions
>   */
> @@ -127,35 +138,6 @@ enum {
>   UPIU_QUERY_FUNC_STANDARD_WRITE_REQUEST  = 0x81,
>  };
>
> -/* Flag idn for Query Requests*/
> -enum flag_idn {
> - QUERY_FLAG_IDN_FDEVICEINIT  = 0x01,
> - QUERY_FLAG_IDN_PWR_ON_WPE   = 0x03,
> - QUERY_FLAG_IDN_BKOPS_EN = 0x04,
> -};
> -
> -/* Attribute idn for Query requests */
> -enum attr_idn {
> - QUERY_ATTR_IDN_ACTIVE_ICC_LVL   = 0x03,
> - QUERY_ATTR_IDN_BKOPS_STATUS = 0x05,
> - QUERY_ATTR_IDN_EE_CONTROL   = 0x0D,
> - QUERY_ATTR_IDN_EE_STATUS= 0x0E,
> -};
> -
> -/* Descriptor idn for Query requests */
> -enum desc_idn {
> - QUERY_DESC_IDN_DEVICE   = 0x0,
> - QUERY_DESC_IDN_CONFIGURAION = 0x1,
> - QUERY_DESC_IDN_UNIT = 0x2,
> - QUERY_DESC_IDN_RFU_0= 0x3,
> - QUERY_DESC_IDN_INTERCONNECT = 0x4,
> - QUERY_DESC_IDN_STRING   = 0x5,
> - QUERY_DESC_IDN_RFU_1= 0x6,
> - QUERY_DESC_IDN_GEOMETRY = 0x7,
> - QUERY_DESC_IDN_POWER= 0x8,
> - QUERY_DESC_IDN_MAX,
> -};
> -
>  enum desc_header_offset {
>   QUERY_DESC_LENGTH_OFFSET= 0x00,
>   QUERY_DESC_DESC_TYPE_OFFSET = 0x01,
> @@ -278,19 +260,6 @@ enum bkops_status {
>   BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL,
>  };
>
> -/* UTP QUERY Transaction Specific Fields OpCode */
> -enum query_opcode {
> - UPIU_QUERY_OPCODE_NOP   = 0x0,
> - UPIU_QUERY_OPCODE_READ_DESC = 0x1,
> - UPIU_QUERY_OPCODE_WRITE_DESC= 0x2,
> - UPIU_QUERY_OPCODE_READ_ATTR = 0x3,
> - UPIU_QUERY_OPCODE_WRITE_ATTR= 0x4,
> - UPIU_QUERY_OPCODE_READ_FLAG = 0x5,
> - UPIU_QUERY_OPCODE_SET_FLAG  = 0x6,
> - UPIU_QUERY_OPCODE_CLEAR_FLAG= 0x7,
> - UPIU_QUERY_OPCODE_TOGGLE_FLAG   = 0x8,
> -};
> -
>  /* Query response result code */
>  enum {
>   QUERY_RESULT_SUCCESS= 0x00,
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 786df28..efeb252 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -38,6 +38,7 @@
>   */
>
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -2208,7 +2209,7 @@ static inline int ufshcd_read_unit_desc_param(struct
> ufs_hba *hba,
>* Unit descriptors are only available for general purpose LUs (LUN id
>* from 0 to 7) and RPMB Well known LU.
>*/
> - if (lun != UFS_UPIU_RPMB_WLUN && (lun >= UFS_UPIU_MAX_GENERAL_LUN))
> + if (!ufs_is_valid_unit_desc_lun(lun))
>   return -EOPNOTSUPP;
>
>   return ufshcd_read_desc_param(hba, QUERY_DESC_IDN_UNIT, lun,
> @@ -5047,6 +5048,207 @@ out:
>  }
>
>  /**
> + * ufshcd_query_ioctl - perform user read queries
> + * @hba: per-adapter instance
> + * @lun: used for lun specific queries
> + * @buffer: user space buffer for reading and submitting query data and
> params
> + * @return: 0 for success negative error code otherwise
> + *
> + * Expected/Submitted buffer structure is struct ufs_ioctl_query_data.
> + * It will read the opcode, idn and buf_length parameters, 

Re: [PATCH v7 3/8] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 


> This change is required in order to be able to build the component
> as a module.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
> index e945383..5f45307 100644
> --- a/drivers/scsi/ufs/Kconfig
> +++ b/drivers/scsi/ufs/Kconfig
> @@ -72,7 +72,7 @@ config SCSI_UFSHCD_PLATFORM
> If unsure, say N.
>
>  config SCSI_UFS_QCOM
> - bool "QCOM specific hooks to UFS controller platform driver"
> + tristate "QCOM specific hooks to UFS controller platform driver"
>   depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
>   select PHY_QCOM_UFS
>   help
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: wd719x: Use module_pci_driver

2015-10-22 Thread Johannes Thumshirn
On Thu, 2015-10-22 at 04:16 +0530, Muhammad Falak R Wani wrote:
> Remove boilerplate code by using macro module_pci_driver.
> For drivers whose __init and __exit paths only register and
> unregister to the pci API, it is preferred to use this macro.
> 
> Signed-off-by: Muhammad Falak R Wani 
> ---
>  drivers/scsi/wd719x.c | 13 +
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
> index 2a9da2e..6d3bce3 100644
> --- a/drivers/scsi/wd719x.c
> +++ b/drivers/scsi/wd719x.c
> @@ -976,18 +976,7 @@ static struct pci_driver wd719x_pci_driver = {
>   .remove =   wd719x_pci_remove,
>  };
>  
> -static int __init wd719x_init(void)
> -{
> - return pci_register_driver(_pci_driver);
> -}
> -
> -static void __exit wd719x_exit(void)
> -{
> - pci_unregister_driver(_pci_driver);
> -}
> -
> -module_init(wd719x_init);
> -module_exit(wd719x_exit);
> +module_pci_driver(wd719x_pci_driver);
>  
>  MODULE_DESCRIPTION("Western Digital WD7193/7197/7296 SCSI driver");
>  MODULE_AUTHOR("Ondrej Zary, Aaron Dewell, Juergen Gaertner");

Reviewed-by: Johannes Thumshirn 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: wd719x: Remove use of macro DEFINE_PCI_DEVICE_TABLE

2015-10-22 Thread Johannes Thumshirn
On Thu, 2015-10-22 at 03:53 +0530, Muhammad Falak R Wani wrote:
> Use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE with
> the goal of getting rid of this macro completely, as this macro
> is deprecated.
> 
> Signed-off-by: Muhammad Falak R Wani 
> ---
>  drivers/scsi/wd719x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
> index e3da1a2..2a9da2e 100644
> --- a/drivers/scsi/wd719x.c
> +++ b/drivers/scsi/wd719x.c
> @@ -962,7 +962,7 @@ static void wd719x_pci_remove(struct pci_dev
> *pdev)
>   scsi_host_put(sh);
>  }
>  
> -static DEFINE_PCI_DEVICE_TABLE(wd719x_pci_table) = {
> +static const struct pci_device_id wd719x_pci_table[] = {
>   { PCI_DEVICE(PCI_VENDOR_ID_WD, 0x3296) },
>   {}
>  };

Reviewed-by: Johannes Thumshirn 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 1/8] phy: qcom-ufs: fix build error when the component is built as a module

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 

> Export the following functions in order to avoid build errors
> when the component PHY_QCOM_UFS is compiled as a module:
>
> ERROR: "ufs_qcom_phy_disable_ref_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_enable_ref_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_is_pcs_ready"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_disable_iface_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_start_serdes"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_calibrate_phy"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_enable_dev_ref_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_set_tx_lane_enable"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_disable_dev_ref_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_save_controller_version"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> ERROR: "ufs_qcom_phy_enable_iface_clk"
>   [drivers/scsi/ufs/ufs-qcom.ko] undefined!
> make[1]: *** [__modpost] Error 1
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/phy/phy-qcom-ufs.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
> index f9c618f..6140a8b 100644
> --- a/drivers/phy/phy-qcom-ufs.c
> +++ b/drivers/phy/phy-qcom-ufs.c
> @@ -432,6 +432,7 @@ out_disable_src:
>  out:
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_ref_clk);
>
>  static
>  int ufs_qcom_phy_disable_vreg(struct phy *phy,
> @@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy
> *generic_phy)
>   phy->is_ref_clk_enabled = false;
>   }
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_ref_clk);
>
>  #define UFS_REF_CLK_EN   (1 << 5)
>
> @@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy
> *generic_phy)
>  {
>   ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
>
>  void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
>  {
>   ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
>
>  /* Turn ON M-PHY RMMI interface clocks */
>  int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
> @@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy
> *generic_phy)
>  out:
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_iface_clk);
>
>  /* Turn OFF M-PHY RMMI interface clocks */
>  void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
> @@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy
> *generic_phy)
>   phy->is_iface_clk_enabled = false;
>   }
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_iface_clk);
>
>  int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
>  {
> @@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
>
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_start_serdes);
>
>  int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32
> tx_lanes)
>  {
> @@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy
> *generic_phy, u32 tx_lanes)
>
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);
>
>  void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
> u8 major, u16 minor, u16 step)
> @@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy
> *generic_phy,
>   ufs_qcom_phy->host_ctrl_rev_minor = minor;
>   ufs_qcom_phy->host_ctrl_rev_step = step;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_save_controller_version);
>
>  int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
>  {
> @@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy
> *generic_phy, bool is_rate_B)
>
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate_phy);
>
>  int ufs_qcom_phy_remove(struct phy *generic_phy,
>   struct ufs_qcom_phy *ufs_qcom_phy)
> @@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)
>   return ufs_qcom_phy->phy_spec_ops->
>   is_physical_coding_sublayer_ready(ufs_qcom_phy);
>  }
> +EXPORT_SYMBOL_GPL(ufs_qcom_phy_is_pcs_ready);
>
>  int ufs_qcom_phy_power_on(struct phy *generic_phy)
>  {
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 7/8] scsi: ufs-qcom: add debug prints for test bus

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 

> Adds support for configuring and reading the test bus and debug
> registers. This change also adds another vops in order to print the
> debug registers.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 165
> +++-
>  drivers/scsi/ufs/ufs-qcom.h |  37 +-
>  drivers/scsi/ufs/ufshcd.c   |   2 +
>  drivers/scsi/ufs/ufshcd.h   |   8 +++
>  4 files changed, 208 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index b275a9a..1633808 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -23,6 +23,24 @@
>  #include "unipro.h"
>  #include "ufs-qcom.h"
>  #include "ufshci.h"
> +#define UFS_QCOM_DEFAULT_DBG_PRINT_EN\
> + (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
> +
> +enum {
> + TSTBUS_UAWM,
> + TSTBUS_UARM,
> + TSTBUS_TXUC,
> + TSTBUS_RXUC,
> + TSTBUS_DFC,
> + TSTBUS_TRLUT,
> + TSTBUS_TMRLUT,
> + TSTBUS_OCSC,
> + TSTBUS_UTP_HCI,
> + TSTBUS_COMBINED,
> + TSTBUS_WRAPPER,
> + TSTBUS_UNIPRO,
> + TSTBUS_MAX,
> +};
>
>  static struct ufs_qcom_host *ufs_qcom_hosts[MAX_UFS_QCOM_HOSTS];
>
> @@ -30,6 +48,15 @@ static void ufs_qcom_get_speed_mode(struct
> ufs_pa_layer_attr *p, char *result);
>  static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host,
>   const char *speed_mode);
>  static int ufs_qcom_set_bus_vote(struct ufs_qcom_host *host, int vote);
> +static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host);
> +static void ufs_qcom_dump_regs(struct ufs_hba *hba, int offset, int len,
> + char *prefix)
> +{
> + print_hex_dump(KERN_ERR, prefix,
> + len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE,
> + 16, 4, (void __force *)hba->mmio_base + offset,
> + len * 4, false);
> +}
>
>  static int ufs_qcom_get_connected_tx_lanes(struct ufs_hba *hba, u32
> *tx_lanes)
>  {
> @@ -996,6 +1023,15 @@ static int ufs_qcom_init(struct ufs_hba *hba)
>   if (hba->dev->id < MAX_UFS_QCOM_HOSTS)
>   ufs_qcom_hosts[hba->dev->id] = host;
>
> + host->dbg_print_en |= UFS_QCOM_DEFAULT_DBG_PRINT_EN;
> + ufs_qcom_get_default_testbus_cfg(host);
> + err = ufs_qcom_testbus_config(host);
> + if (err) {
> + dev_warn(dev, "%s: failed to configure the testbus %d\n",
> + __func__, err);
> + err = 0;
> + }
> +
>   goto out;
>
>  out_disable_phy:
> @@ -1025,12 +1061,134 @@ void ufs_qcom_clk_scale_notify(struct ufs_hba
> *hba)
>
>   if (!dev_req_params)
>   return;
> +}
> +
> +static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host)
> +{
> + /* provide a legal default configuration */
> + host->testbus.select_major = TSTBUS_UAWM;
> + host->testbus.select_minor = 1;
> +}
> +
> +static bool ufs_qcom_testbus_cfg_is_ok(struct ufs_qcom_host *host)
> +{
> + if (host->testbus.select_major >= TSTBUS_MAX) {
> + dev_err(host->hba->dev,
> + "%s: UFS_CFG1[TEST_BUS_SEL} may not equal 0x%05X\n",
> + __func__, host->testbus.select_major);
> + return false;
> + }
> +
> + /*
> +  * Not performing check for each individual select_major
> +  * mappings of select_minor, since there is no harm in
> +  * configuring a non-existent select_minor
> +  */
> + if (host->testbus.select_minor > 0x1F) {
> + dev_err(host->hba->dev,
> + "%s: 0x%05X is not a legal testbus option\n",
> + __func__, host->testbus.select_minor);
> + return false;
> + }
> +
> + return true;
> +}
> +
> +int ufs_qcom_testbus_config(struct ufs_qcom_host *host)
> +{
> + int reg;
> + int offset;
> + u32 mask = TEST_BUS_SUB_SEL_MASK;
> +
> + if (!host)
> + return -EINVAL;
>
> - ufs_qcom_cfg_timers(hba, dev_req_params->gear_rx,
> - dev_req_params->pwr_rx,
> - dev_req_params->hs_rate);
> + if (!ufs_qcom_testbus_cfg_is_ok(host))
> + return -EPERM;
> +
> + switch (host->testbus.select_major) {
> + case TSTBUS_UAWM:
> + reg = UFS_TEST_BUS_CTRL_0;
> + offset = 24;
> + break;
> + case TSTBUS_UARM:
> + reg = UFS_TEST_BUS_CTRL_0;
> + offset = 16;
> + break;
> + case TSTBUS_TXUC:
> + reg = UFS_TEST_BUS_CTRL_0;
> + offset = 8;
> + break;
> + case TSTBUS_RXUC:
> + reg = UFS_TEST_BUS_CTRL_0;
> + offset = 0;
> + break;
> + case TSTBUS_DFC:
> + reg = UFS_TEST_BUS_CTRL_1;
> + offset = 24;
> + 

Re: [PATCH v3 04/15] scsi: ufs: clear outstanding_request bit in case query timeout

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 



> When sending a query to the device returns with a timeout error,
> we clear the corresponding bit in the DOORBELL register but
> we don't clear the outstanding_request field as we should.
> This patch fixes this bug.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 22 --
>  1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 8860a57..e0b8755 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -364,6 +364,16 @@ static inline void ufshcd_utrl_clear(struct ufs_hba
> *hba, u32 pos)
>  }
>
>  /**
> + * ufshcd_outstanding_req_clear - Clear a bit in outstanding request
> field
> + * @hba: per adapter instance
> + * @tag: position of the bit to be cleared
> + */
> +static inline void ufshcd_outstanding_req_clear(struct ufs_hba *hba, int
> tag)
> +{
> + __clear_bit(tag, >outstanding_reqs);
> +}
> +
> +/**
>   * ufshcd_get_lists_status - Check UCRDY, UTRLRDY and UTMRLRDY
>   * @reg: Register value of host controller status
>   *
> @@ -1502,9 +1512,17 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba
> *hba,
>
>   if (!time_left) {
>   err = -ETIMEDOUT;
> + dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
> + __func__, lrbp->task_tag);
>   if (!ufshcd_clear_cmd(hba, lrbp->task_tag))
> - /* sucessfully cleared the command, retry if needed */
> + /* successfully cleared the command, retry if needed */
>   err = -EAGAIN;
> + /*
> +  * in case of an error, after clearing the doorbell,
> +  * we also need to clear the outstanding_request
> +  * field in hba
> +  */
> + ufshcd_outstanding_req_clear(hba, lrbp->task_tag);
>   }
>
>   return err;
> @@ -3942,7 +3960,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
>   scsi_dma_unmap(cmd);
>
>   spin_lock_irqsave(host->host_lock, flags);
> - __clear_bit(tag, >outstanding_reqs);
> + ufshcd_outstanding_req_clear(hba, tag);
>   hba->lrb[tag].cmd = NULL;
>   spin_unlock_irqrestore(host->host_lock, flags);
>
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 03/15] scsi: ufs: verify command tag validity

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 


> A race condition appear to exist between request completion when
> scsi_done() is called to end the request and set the tag back to
> -1 (at blk_queue_end_tag() scsi_end_request), and scsi layer error
> handling which aborts the command and reuses it to request sense
> data. Sending the request sense is done with tag which was set to -1
> and so it is invalid.
> Assert command tag passed from scsi layer is valid.
>
> Signed-off-by: Gilad Broner 
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 24 ++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 2d3ebca..8860a57 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -190,6 +190,10 @@ static int ufshcd_config_pwr_mode(struct ufs_hba
> *hba,
>   struct ufs_pa_layer_attr *desired_pwr_mode);
>  static int ufshcd_change_power_mode(struct ufs_hba *hba,
>struct ufs_pa_layer_attr *pwr_mode);
> +static inline bool ufshcd_valid_tag(struct ufs_hba *hba, int tag)
> +{
> + return tag >= 0 && tag < hba->nutrs;
> +}
>
>  static inline int ufshcd_enable_irq(struct ufs_hba *hba)
>  {
> @@ -1310,6 +1314,12 @@ static int ufshcd_queuecommand(struct Scsi_Host
> *host, struct scsi_cmnd *cmd)
>   hba = shost_priv(host);
>
>   tag = cmd->request->tag;
> + if (!ufshcd_valid_tag(hba, tag)) {
> + dev_err(hba->dev,
> + "%s: invalid command tag %d: cmd=0x%p, 
> cmd->request=0x%p",
> + __func__, tag, cmd, cmd->request);
> + BUG();
> + }
>
>   spin_lock_irqsave(hba->host->host_lock, flags);
>   switch (hba->ufshcd_state) {
> @@ -3862,13 +3872,23 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
>   host = cmd->device->host;
>   hba = shost_priv(host);
>   tag = cmd->request->tag;
> + if (!ufshcd_valid_tag(hba, tag)) {
> + dev_err(hba->dev,
> + "%s: invalid command tag %d: cmd=0x%p, 
> cmd->request=0x%p",
> + __func__, tag, cmd, cmd->request);
> + BUG();
> + }
>
>   ufshcd_hold(hba, false);
> + reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
>   /* If command is already aborted/completed, return SUCCESS */
> - if (!(test_bit(tag, >outstanding_reqs)))
> + if (!(test_bit(tag, >outstanding_reqs))) {
> + dev_err(hba->dev,
> + "%s: cmd at tag %d already completed, outstanding=0x%lx,
> doorbell=0x%x\n",
> + __func__, tag, hba->outstanding_reqs, reg);
>   goto out;
> + }
>
> - reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
>   if (!(reg & (1 << tag))) {
>   dev_err(hba->dev,
>   "%s: cmd was completed, but without a notifying intr, tag = %d",
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 5/8] scsi: ufs: creates wrapper functions for vops

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 


> In order to simplify the code a set of wrapper functions is created
> to test and call each of the variant operations.
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufs-qcom.c |   1 -
>  drivers/scsi/ufs/ufshcd.c   | 104
> +---
>  drivers/scsi/ufs/ufshcd.h   |  98
> +
>  3 files changed, 137 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 64c54b7..329ac84 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -1049,6 +1049,5 @@ static const struct ufs_hba_variant_ops
> ufs_hba_qcom_vops = {
>   .suspend= ufs_qcom_suspend,
>   .resume = ufs_qcom_resume,
>  };
> -EXPORT_SYMBOL(ufs_hba_qcom_vops);
>
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index b0ade73..9e79c33 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -271,10 +271,8 @@ static inline u32 ufshcd_get_intr_mask(struct ufs_hba
> *hba)
>   */
>  static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
>  {
> - if (hba->quirks & UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION) {
> - if (hba->vops && hba->vops->get_ufs_hci_version)
> - return hba->vops->get_ufs_hci_version(hba);
> - }
> + if (hba->quirks & UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION)
> + return ufshcd_vops_get_ufs_hci_version(hba);
>
>   return ufshcd_readl(hba, REG_UFS_VERSION);
>  }
> @@ -2473,9 +2471,8 @@ static int ufshcd_change_power_mode(struct ufs_hba
> *hba,
>   dev_err(hba->dev,
>   "%s: power mode change failed %d\n", __func__, ret);
>   } else {
> - if (hba->vops && hba->vops->pwr_change_notify)
> - hba->vops->pwr_change_notify(hba,
> - POST_CHANGE, NULL, pwr_mode);
> + ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL,
> + pwr_mode);
>
>   memcpy(>pwr_info, pwr_mode,
>   sizeof(struct ufs_pa_layer_attr));
> @@ -2495,10 +2492,10 @@ static int ufshcd_config_pwr_mode(struct ufs_hba
> *hba,
>   struct ufs_pa_layer_attr final_params = { 0 };
>   int ret;
>
> - if (hba->vops && hba->vops->pwr_change_notify)
> - hba->vops->pwr_change_notify(hba,
> -  PRE_CHANGE, desired_pwr_mode, _params);
> - else
> + ret = ufshcd_vops_pwr_change_notify(hba, PRE_CHANGE,
> + desired_pwr_mode, _params);
> +
> + if (ret)
>   memcpy(_params, desired_pwr_mode, sizeof(final_params));
>
>   ret = ufshcd_change_power_mode(hba, _params);
> @@ -2647,8 +2644,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
>   /* UniPro link is disabled at this point */
>   ufshcd_set_link_off(hba);
>
> - if (hba->vops && hba->vops->hce_enable_notify)
> - hba->vops->hce_enable_notify(hba, PRE_CHANGE);
> + ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE);
>
>   /* start controller initialization sequence */
>   ufshcd_hba_start(hba);
> @@ -2681,8 +2677,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
>   /* enable UIC related interrupts */
>   ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);
>
> - if (hba->vops && hba->vops->hce_enable_notify)
> - hba->vops->hce_enable_notify(hba, POST_CHANGE);
> + ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);
>
>   return 0;
>  }
> @@ -2735,8 +2730,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
>   int retries = DME_LINKSTARTUP_RETRIES;
>
>   do {
> - if (hba->vops && hba->vops->link_startup_notify)
> - hba->vops->link_startup_notify(hba, PRE_CHANGE);
> + ufshcd_vops_link_startup_notify(hba, PRE_CHANGE);
>
>   ret = ufshcd_dme_link_startup(hba);
>
> @@ -2767,11 +2761,9 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
>   }
>
>   /* Include any host controller configuration via UIC commands */
> - if (hba->vops && hba->vops->link_startup_notify) {
> - ret = hba->vops->link_startup_notify(hba, POST_CHANGE);
> - if (ret)
> - goto out;
> - }
> + ret = ufshcd_vops_link_startup_notify(hba, POST_CHANGE);
> + if (ret)
> + goto out;
>
>   ret = ufshcd_make_hba_operational(hba);
>  out:
> @@ -4578,8 +4570,7 @@ static int __ufshcd_setup_clocks(struct ufs_hba
> *hba, bool on,
>   }
>   }
>
> - if (hba->vops && hba->vops->setup_clocks)
> - ret = hba->vops->setup_clocks(hba, on);
> + ret = ufshcd_vops_setup_clocks(hba, on);
>  out:
>   if (ret) {
>   

Re: [PATCH v7 2/8] scsi: ufs-qcom: fix compilation warning if compiled as a module

2015-10-22 Thread subhashj
Looks good to me.
Reviewed-by: Subhash Jadavani 


> This change fixes a compilation warning that happens if SCSI_UFS_QCOM
> is compiled as a module.
> Also this patch fixes an error happens when insmod the module:
> "ufs_qcom: module license 'unspecified' taints kernel."
>
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 4cdffa4..6c23bbf 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -917,12 +917,15 @@ out:
>
>  #define  ANDROID_BOOT_DEV_MAX30
>  static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
> -static int get_android_boot_dev(char *str)
> +
> +#ifndef MODULE
> +static int __init get_android_boot_dev(char *str)
>  {
>   strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
>   return 1;
>  }
>  __setup("androidboot.bootdevice=", get_android_boot_dev);
> +#endif
>
>  /**
>   * ufs_qcom_init - bind phy with controller
> @@ -1047,3 +1050,5 @@ static const struct ufs_hba_variant_ops
> ufs_hba_qcom_vops = {
>   .resume = ufs_qcom_resume,
>  };
>  EXPORT_SYMBOL(ufs_hba_qcom_vops);
> +
> +MODULE_LICENSE("GPL v2");
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi_sysfs: protect against double execution of __scsi_remove_device()

2015-10-22 Thread Bart Van Assche

On 10/22/2015 10:12 AM, Vitaly Kuznetsov wrote:

On some host errors storvsc module tries to remove sdev by scheduling a job
which does the following:

sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun);
if (sdev) {
scsi_remove_device(sdev);
scsi_device_put(sdev);
}

While this code seems correct the following crash is observed:

  general protection fault:  [#1] SMP DEBUG_PAGEALLOC
  RIP: 0010:[]  [] bdi_destroy+0x39/0x220
  ...
  [] ? _raw_spin_unlock_irq+0x2c/0x40
  [] blk_cleanup_queue+0x17b/0x270
  [] __scsi_remove_device+0x54/0xd0 [scsi_mod]
  [] scsi_remove_device+0x2b/0x40 [scsi_mod]
  [] storvsc_remove_lun+0x3d/0x60 [hv_storvsc]
  [] process_one_work+0x1b1/0x530
  ...

The problem comes with the fact that many such jobs (for the same device)
are being scheduled simultaneously. While scsi_remove_device() uses
shost->scan_mutex and scsi_device_lookup() will fail for a device in
SDEV_DEL state there is no protection against someone who did
scsi_device_lookup() before we actually entered __scsi_remove_device(). So
the whole scenario looks like that: two callers do simultaneous (or
preemption happens) calls to scsi_device_lookup() ant these calls succeed
for all of them, after that both callers try doing scsi_remove_device().
shost->scan_mutex only serializes their calls to __scsi_remove_device()
and we end up doing the cleanup path twice.

Signed-off-by: Vitaly Kuznetsov 
---
  drivers/scsi/scsi_sysfs.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b89..e0d2707 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1076,6 +1076,14 @@ void __scsi_remove_device(struct scsi_device *sdev)
  {
struct device *dev = >sdev_gendev;

+   /*
+* This cleanup path is not reentrant and while it is impossible
+* to get a new reference with scsi_device_get() someone can still
+* hold a previously acquired one.
+*/
+   if (sdev->sdev_state == SDEV_DEL)
+   return;
+
if (sdev->is_visible) {
if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
return;


Hello Vitaly,

Sorry but I don't see how the above patch could be a proper fix. If two 
calls to __scsi_remove_device() occur concurrently the crash explained 
above can still occur. The storsvc driver should be modified such that 
concurrent __scsi_remove_device() calls do not occur. How about 
preventing concurrent calls via a mutex ? Another possible approach is 
to use the workqueue mechanism. An example can be found in the SRP 
initiator driver (ib_srp).


Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 35/37] cxlflash: Fix to avoid corrupting port selection mask

2015-10-22 Thread Manoj Kumar

Acked-by: Manoj Kumar 

On 10/21/2015 3:16 PM, Matthew R. Ochs wrote:

The port selection mask of a LUN can be corrupted when the manage LUN
ioctl (DK_CXLFLASH_MANAGE_LUN) is issued more than once for any device.


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 37/37] cxlflash: Fix to avoid bypassing context cleanup

2015-10-22 Thread Manoj Kumar

Acked-by: Manoj Kumar 

On 10/21/2015 3:16 PM, Matthew R. Ochs wrote:

Contexts may be skipped over for cleanup in situations where contention
for the adapter's table-list mutex is experienced in the presence of a
signal during the execution of the release handler.


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 36/37] cxlflash: Fix to avoid lock instrumentation rejection

2015-10-22 Thread Manoj Kumar

Acked-by: Manoj Kumar 

On 10/21/2015 3:16 PM, Matthew R. Ochs wrote:

When running with lock instrumentation (e.g. lockdep), some of the
instrumentation can become disabled at probe time for a cxlflash
adapter. This is due to a missing lock registration for the tmf_slock.

The fix is to call spin_lock_init() for the tmf_slock during probe.


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi: wd719x: Remove use of macro DEFINE_PCI_DEVICE_TABLE

2015-10-22 Thread Vaishali Thakkar
On Thu, Oct 22, 2015 at 3:53 AM, Muhammad Falak R Wani
 wrote:
> Use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE with
> the goal of getting rid of this macro completely, as this macro
> is deprecated.

Duplicate of :https://lkml.org/lkml/2015/7/17/62

> Signed-off-by: Muhammad Falak R Wani 
> ---
>  drivers/scsi/wd719x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
> index e3da1a2..2a9da2e 100644
> --- a/drivers/scsi/wd719x.c
> +++ b/drivers/scsi/wd719x.c
> @@ -962,7 +962,7 @@ static void wd719x_pci_remove(struct pci_dev *pdev)
> scsi_host_put(sh);
>  }
>
> -static DEFINE_PCI_DEVICE_TABLE(wd719x_pci_table) = {
> +static const struct pci_device_id wd719x_pci_table[] = {
> { PCI_DEVICE(PCI_VENDOR_ID_WD, 0x3296) },
> {}
>  };
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Vaishali
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Robbie Capp

2015-10-22 Thread Robbie Capp
Robbie Capp
Equity Analyst badania.
E-mail: robbiecappu...@outlook.com

Cze przyjacielu,

Jestem Robbie Capp Equity Research Analystat Banku z Londynu, Ulica: 1
Finsbury Avenue Londyn, EC2M 2PP w Londynie (UBS AG, Bank Inwestycyjny)
Pisz o propozycji biznesowych, które bd ogromne i
wzajemne korzyci dla nas obu. To moe Ci
zainteresowa wiedzie, e w moim departamencie, jako szef
Equity Research Analystat, odkryem pewn sum 18,5 £
Million (osiemnacie milionów piset tysicy Great
British Pounds Sterling) na koncie nalecym do jednego z
naszego pónego zagranicznego klienta amerykaski inwestor
(GUARCH VIVIAN) by zaangaowany w katastrofie lotniczej na 21
lutego 2008 roku; Santa Barbara Airlines.
 
Jednak wybór skontaktowa si budzi z charakter geograficzny,
gdzie mieszkasz, w szczególnoci ze wzgldu na
wraliwo transakcji i tym
poufno w niniejszym dokumencie. Teraz nasz bank zosta
czeka na którykolwiek z krewnymi, aby si-up na roszczenia bez
powodzenia w cigu roku. Ja osobicie byem
niepowodzeniem w odnalezieniu krewnych; Szukam Twojej zgody, aby
zaprezentowa Pastwu jak najbliszych krewnych /
Beneficjenta do zmarego tak, e wpywy z tego konta
wyceniono na 18,5 mln £ Brytyjski funt szterling Wielki moe by
wypacane i przekazywane do was jako nazwany najbliszych
krewnych / beneficjenta.

To bdzie wypacane lub udostpniane w tych procentów, 55%
do 45% mnie i dla Ciebie. Mam zabezpieczone wszystkie niezbdne
dokumenty prawne, które mog by wykorzystane do wykonania kopii
zapasowej tego twierdzenia. All I need to wypeni swoje
nazwiska do dokumentów i zalegalizowa go w sdzie, aby
udowodni Ci za prawowitego beneficjenta. All I wymagaj teraz
jest uczciwy wspópracy, poufnoci i zaufania w celu
umoliwienia nam widzi poprzez t transakcj.
Gwarantuj, e bdzie to wykonane zgodnie zakresem
zabezpieczonych prawem rozwizanie, które bdzie chroni
komputer z wszelkich przypadków naruszenia prawa. Prosz Po
rozpatrzenia i akceptacji tej oferty, naley natychmiast
wysa do mnie nastpujce informacje.

- Twoje pene imi:
- Twój Adres kontaktowy:
- Twój bezporedni numer Telefon komórkowy:
- Twoja data urodzenia:
- Twój zawód:
- Twój prywatny e-mail:

Wic mog wysa swoje dane do naszej bazy danych
banku, aby pojawi si w systemie bankowym, które s o
nazwie najbliszych krewnych / spadkobierców beneficjenta funduszu, a
nastpnie bd prowadzi komunikacj z UBS Bank
Inwestycyjny do natychmiastowego uwolnienia i transferu Fundusz do ciebie,
czekam na twój natychmiastowej odpowiedzi na mój prywatny e-mail:
Robbiecappubs1 @ outlook.com, wic moemy od razu
rozpocz transakcj.

Twoja odpowied jest bardzo ceniona.

z powaaniem,
Robbie Capp
Equity Analyst badania.
E-mail: robbiecappu...@outlook.com.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Robbie Capp

2015-10-22 Thread Robbie Capp
Robbie Capp
Equity Analyst badania.
E-mail: robbiecappu...@outlook.com

Cze przyjacielu,

Jestem Robbie Capp Equity Research Analystat Banku z Londynu, Ulica: 1
Finsbury Avenue Londyn, EC2M 2PP w Londynie (UBS AG, Bank Inwestycyjny)
Pisz o propozycji biznesowych, które bd ogromne i
wzajemne korzyci dla nas obu. To moe Ci
zainteresowa wiedzie, e w moim departamencie, jako szef
Equity Research Analystat, odkryem pewn sum 18,5 £
Million (osiemnacie milionów piset tysicy Great
British Pounds Sterling) na koncie nalecym do jednego z
naszego pónego zagranicznego klienta amerykaski inwestor
(GUARCH VIVIAN) by zaangaowany w katastrofie lotniczej na 21
lutego 2008 roku; Santa Barbara Airlines.
 
Jednak wybór skontaktowa si budzi z charakter geograficzny,
gdzie mieszkasz, w szczególnoci ze wzgldu na
wraliwo transakcji i tym
poufno w niniejszym dokumencie. Teraz nasz bank zosta
czeka na którykolwiek z krewnymi, aby si-up na roszczenia bez
powodzenia w cigu roku. Ja osobicie byem
niepowodzeniem w odnalezieniu krewnych; Szukam Twojej zgody, aby
zaprezentowa Pastwu jak najbliszych krewnych /
Beneficjenta do zmarego tak, e wpywy z tego konta
wyceniono na 18,5 mln £ Brytyjski funt szterling Wielki moe by
wypacane i przekazywane do was jako nazwany najbliszych
krewnych / beneficjenta.

To bdzie wypacane lub udostpniane w tych procentów, 55%
do 45% mnie i dla Ciebie. Mam zabezpieczone wszystkie niezbdne
dokumenty prawne, które mog by wykorzystane do wykonania kopii
zapasowej tego twierdzenia. All I need to wypeni swoje
nazwiska do dokumentów i zalegalizowa go w sdzie, aby
udowodni Ci za prawowitego beneficjenta. All I wymagaj teraz
jest uczciwy wspópracy, poufnoci i zaufania w celu
umoliwienia nam widzi poprzez t transakcj.
Gwarantuj, e bdzie to wykonane zgodnie zakresem
zabezpieczonych prawem rozwizanie, które bdzie chroni
komputer z wszelkich przypadków naruszenia prawa. Prosz Po
rozpatrzenia i akceptacji tej oferty, naley natychmiast
wysa do mnie nastpujce informacje.

- Twoje pene imi:
- Twój Adres kontaktowy:
- Twój bezporedni numer Telefon komórkowy:
- Twoja data urodzenia:
- Twój zawód:
- Twój prywatny e-mail:

Wic mog wysa swoje dane do naszej bazy danych
banku, aby pojawi si w systemie bankowym, które s o
nazwie najbliszych krewnych / spadkobierców beneficjenta funduszu, a
nastpnie bd prowadzi komunikacj z UBS Bank
Inwestycyjny do natychmiastowego uwolnienia i transferu Fundusz do ciebie,
czekam na twój natychmiastowej odpowiedzi na mój prywatny e-mail:
Robbiecappubs1 @ outlook.com, wic moemy od razu
rozpocz transakcj.

Twoja odpowied jest bardzo ceniona.

z powaaniem,
Robbie Capp
Equity Analyst badania.
E-mail: robbiecappu...@outlook.com.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] bnx2fc: Set ELS transfer length correctly for middle path commands.

2015-10-22 Thread Tomas Henzl
On 19.10.2015 21:40, Chad Dupuis wrote:
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Chad Dupuis 

Reviewed-by: Tomas Henzl 

Tomas


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 13/15] scsi: ufs: add missing memory barriers

2015-10-22 Thread Akinobu Mita
2015-09-02 19:13 GMT+09:00 Yaniv Gardi :
> Performing several writes to UFS host controller registers has
> no gurrantee of ordering, so we must make sure register writes
> to setup request list base address etc. are performed before the
> run/stop register is enabled.
> In addition, when setting up a task request, we must make sure
> the updating of descriptors takes places before ringing the
> doorbell, similarly to setting up a transfer request.
>
> Signed-off-by: Gilad Broner 
> Signed-off-by: Yaniv Gardi 
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 21 +++--
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index fc2a52d..298511a 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -401,11 +401,9 @@ static inline int ufshcd_get_lists_status(u32 reg)
>  *  1   UTRLRDY
>  *  2   UTMRLRDY
>  *  3   UCRDY
> -*  4   HEI
> -*  5   DEI
> -* 6-7  reserved
> +* 4-7  reserved
>  */
> -   return (((reg) & (0xFF)) >> 1) ^ (0x07);
> +   return ((reg & 0xFF) >> 1) ^ 0x07;
>  }
>
>  /**
> @@ -2726,7 +2724,7 @@ out:
>   * To bring UFS host controller to operational state,
>   * 1. Enable required interrupts
>   * 2. Configure interrupt aggregation
> - * 3. Program UTRL and UTMRL base addres
> + * 3. Program UTRL and UTMRL base address
>   * 4. Configure run-stop-registers
>   *
>   * Returns 0 on success, non-zero value on failure
> @@ -2756,8 +2754,13 @@ static int ufshcd_make_hba_operational(struct ufs_hba 
> *hba)
> REG_UTP_TASK_REQ_LIST_BASE_H);
>
> /*
> +* Make sure base address and interrupt setup are updated before
> +* enabling the run/stop registers below.
> +*/
> +   wmb();
> +
> +   /*
>  * UCRDY, UTMRLDY and UTRLRDY bits must be 1
> -* DEI, HEI bits must be 0
>  */
> reg = ufshcd_readl(hba, REG_CONTROLLER_STATUS);
> if (!(ufshcd_get_lists_status(reg))) {
> @@ -3920,7 +3923,13 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, 
> int lun_id, int task_id,
>
> /* send command to the controller */
> __set_bit(free_slot, >outstanding_tasks);
> +
> +   /* Make sure descriptors are ready before ringing the task doorbell */
> +   wmb();
> +
> ufshcd_writel(hba, 1 << free_slot, REG_UTP_TASK_REQ_DOOR_BELL);
> +   /* Make sure that doorbell is committed immediately */
> +   wmb();

Is this wmb() after ringing tm doorbell is needed?

>
> spin_unlock_irqrestore(host->host_lock, flags);
>
> --
> 1.8.5.2
>
> --
> QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
> Code Aurora Forum, hosted by The Linux Foundation
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] bnx2fc: Remove 'NetXtreme II' from source files.

2015-10-22 Thread Tomas Henzl
On 19.10.2015 21:40, Chad Dupuis wrote:
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Chad Dupuis 

Reviewed-by: Tomas Henzl 

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] bnx2fc: Remove explicit logouts.

2015-10-22 Thread Tomas Henzl
On 19.10.2015 21:40, Chad Dupuis wrote:
> Explicit logouts from bnx2fc were causing race conditions in either returning
> stale SCSI commands or not allowing a target to log back in.
>
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Chad Dupuis 

Reviewed-by: Tomas Henzl 

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/7] bnx2fc: Fix FCP RSP residual parsing.

2015-10-22 Thread Tomas Henzl
On 19.10.2015 21:40, Chad Dupuis wrote:
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Chad Dupuis 

Reviewed-by: Tomas Henzl 

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/7] bnx2fc: Update version number to 2.9.6.

2015-10-22 Thread Tomas Henzl
On 19.10.2015 21:40, Chad Dupuis wrote:
> Signed-off-by: Giridhar Malavali 
> Signed-off-by: Chad Dupuis 

Reviewed-by: Tomas Henzl 

Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 36/37] cxlflash: Fix to avoid lock instrumentation rejection

2015-10-22 Thread Andrew Donnellan

On 22/10/15 07:16, Matthew R. Ochs wrote:

When running with lock instrumentation (e.g. lockdep), some of the
instrumentation can become disabled at probe time for a cxlflash
adapter. This is due to a missing lock registration for the tmf_slock.

The fix is to call spin_lock_init() for the tmf_slock during probe.

Signed-off-by: Matthew R. Ochs 


Reviewed-by: Andrew Donnellan 

--
Andrew Donnellan  Software Engineer, OzLabs
andrew.donnel...@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)IBM Australia Limited

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 16/37] cxlflash: Fix async interrupt bypass logic

2015-10-22 Thread Andrew Donnellan

On 22/10/15 07:13, Matthew R. Ochs wrote:

A bug was introduced earlier in the development cycle when cleaning
up logic statements. Instead of skipping bits that are not set, set
bits are skipped, causing async interrupts to not be handled correctly.

To fix, simply add back in the proper evaluation for an unset bit.

Signed-off-by: Matthew R. Ochs 
Signed-off-by: Manoj N. Kumar 
Reviewed-by: Brian King 


Reviewed-by: Andrew Donnellan 

--
Andrew Donnellan  Software Engineer, OzLabs
andrew.donnel...@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)IBM Australia Limited

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 35/37] cxlflash: Fix to avoid corrupting port selection mask

2015-10-22 Thread Andrew Donnellan

On 22/10/15 07:16, Matthew R. Ochs wrote:

The port selection mask of a LUN can be corrupted when the manage LUN
ioctl (DK_CXLFLASH_MANAGE_LUN) is issued more than once for any device.


> ...


Signed-off-by: Matthew R. Ochs 


Reviewed-by: Andrew Donnellan 

--
Andrew Donnellan  Software Engineer, OzLabs
andrew.donnel...@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)IBM Australia Limited

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 12/15] scsi: ufs: reduce the interrupts for power mode change requests

2015-10-22 Thread Akinobu Mita
2015-10-21 23:57 GMT+09:00 Akinobu Mita :
> 2015-09-02 19:13 GMT+09:00 Yaniv Gardi :
>> DME commands such as Hibern8 enter/exit and gear switch generate 2
>> completion interrupts, one for confirmation that command is received
>> by local UniPro and 2nd one is the final confirmation after communication
>> with remote UniPro. Currently both of these completions are registered
>> as interrupt events which is not quite necessary and instead we can
>> just wait for the interrupt of 2nd completion, this should reduce
>> the number of interrupts and could reduce the unnecessary CPU wakeups
>> to handle extra interrupts.
>>
>> Signed-off-by: Subhash Jadavani 
>> Signed-off-by: Yaniv Gardi 
>>
>> ---
>>  drivers/scsi/ufs/ufshcd.c | 41 +++--
>>  1 file changed, 27 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index f2d4301..fc2a52d 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -986,13 +986,15 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct 
>> uic_command *uic_cmd)
>>   * __ufshcd_send_uic_cmd - Send UIC commands and retrieve the result
>>   * @hba: per adapter instance
>>   * @uic_cmd: UIC command
>> + * @completion: initialize the completion only if this is set to true
>>   *
>>   * Identical to ufshcd_send_uic_cmd() expect mutex. Must be called
>>   * with mutex held and host_lock locked.
>>   * Returns 0 only if success.
>>   */
>>  static int
>> -__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
>> +__ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd,
>> + bool completion)
>>  {
>> if (!ufshcd_ready_for_uic_cmd(hba)) {
>> dev_err(hba->dev,
>> @@ -1000,7 +1002,8 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct 
>> uic_command *uic_cmd)
>> return -EIO;
>> }
>>
>> -   init_completion(_cmd->done);
>> +   if (completion)
>> +   init_completion(_cmd->done);
>>
>> ufshcd_dispatch_uic_cmd(hba, uic_cmd);
>>
>> @@ -1025,7 +1028,7 @@ ufshcd_send_uic_cmd(struct ufs_hba *hba, struct 
>> uic_command *uic_cmd)
>> ufshcd_add_delay_before_dme_cmd(hba);
>>
>> spin_lock_irqsave(hba->host->host_lock, flags);
>> -   ret = __ufshcd_send_uic_cmd(hba, uic_cmd);
>> +   ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true);
>> spin_unlock_irqrestore(hba->host->host_lock, flags);
>> if (!ret)
>> ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
>> @@ -2346,6 +2349,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, 
>> struct uic_command *cmd)
>> unsigned long flags;
>> u8 status;
>> int ret;
>> +   bool reenable_intr = false;
>>
>> mutex_lock(>uic_cmd_mutex);
>> init_completion(_async_done);
>> @@ -2353,15 +2357,17 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, 
>> struct uic_command *cmd)
>>
>> spin_lock_irqsave(hba->host->host_lock, flags);
>> hba->uic_async_done = _async_done;
>> -   ret = __ufshcd_send_uic_cmd(hba, cmd);
>> -   spin_unlock_irqrestore(hba->host->host_lock, flags);
>> -   if (ret) {
>> -   dev_err(hba->dev,
>> -   "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
>> -   cmd->command, cmd->argument3, ret);
>> -   goto out;
>> +   if (ufshcd_readl(hba, REG_INTERRUPT_ENABLE) & UIC_COMMAND_COMPL) {
>> +   ufshcd_disable_intr(hba, UIC_COMMAND_COMPL);
>> +   /*
>> +* Make sure UIC command completion interrupt is disabled 
>> before
>> +* issuing UIC command.
>> +*/
>> +   wmb();
>> +   reenable_intr = true;

mmiowb() is more suitable here?  Please see
"ACQUIRES VS I/O ACCESSES" subsection in Documentation/memory-barriers.txt

>> }
>> -   ret = ufshcd_wait_for_uic_cmd(hba, cmd);
>> +   ret = __ufshcd_send_uic_cmd(hba, cmd, false);
>> +   spin_unlock_irqrestore(hba->host->host_lock, flags);
>> if (ret) {
>> dev_err(hba->dev,
>> "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
>> @@ -2387,7 +2393,10 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, 
>> struct uic_command *cmd)
>> }
>>  out:
>> spin_lock_irqsave(hba->host->host_lock, flags);
>> +   hba->active_uic_cmd = NULL;
>> hba->uic_async_done = NULL;
>> +   if (reenable_intr)
>> +   ufshcd_enable_intr(hba, UIC_COMMAND_COMPL);
>> spin_unlock_irqrestore(hba->host->host_lock, flags);
>> mutex_unlock(>uic_cmd_mutex);
>>
>> @@ -3812,16 +3821,20 @@ static void ufshcd_sl_intr(struct ufs_hba *hba, u32 
>> intr_status)
>>   */
>>  static irqreturn_t ufshcd_intr(int irq, void *__hba)
>>  

[PATCH] scsi_sysfs: protect against double execution of __scsi_remove_device()

2015-10-22 Thread Vitaly Kuznetsov
On some host errors storvsc module tries to remove sdev by scheduling a job
which does the following:

   sdev = scsi_device_lookup(wrk->host, 0, 0, wrk->lun);
   if (sdev) {
   scsi_remove_device(sdev);
   scsi_device_put(sdev);
   }

While this code seems correct the following crash is observed:

 general protection fault:  [#1] SMP DEBUG_PAGEALLOC
 RIP: 0010:[]  [] bdi_destroy+0x39/0x220
 ...
 [] ? _raw_spin_unlock_irq+0x2c/0x40
 [] blk_cleanup_queue+0x17b/0x270
 [] __scsi_remove_device+0x54/0xd0 [scsi_mod]
 [] scsi_remove_device+0x2b/0x40 [scsi_mod]
 [] storvsc_remove_lun+0x3d/0x60 [hv_storvsc]
 [] process_one_work+0x1b1/0x530
 ...

The problem comes with the fact that many such jobs (for the same device)
are being scheduled simultaneously. While scsi_remove_device() uses
shost->scan_mutex and scsi_device_lookup() will fail for a device in
SDEV_DEL state there is no protection against someone who did
scsi_device_lookup() before we actually entered __scsi_remove_device(). So
the whole scenario looks like that: two callers do simultaneous (or
preemption happens) calls to scsi_device_lookup() ant these calls succeed
for all of them, after that both callers try doing scsi_remove_device().
shost->scan_mutex only serializes their calls to __scsi_remove_device()
and we end up doing the cleanup path twice.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/scsi/scsi_sysfs.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b89..e0d2707 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1076,6 +1076,14 @@ void __scsi_remove_device(struct scsi_device *sdev)
 {
struct device *dev = >sdev_gendev;
 
+   /*
+* This cleanup path is not reentrant and while it is impossible
+* to get a new reference with scsi_device_get() someone can still
+* hold a previously acquired one.
+*/
+   if (sdev->sdev_state == SDEV_DEL)
+   return;
+
if (sdev->is_visible) {
if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
return;
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html