[PATCH 1/5] dt-bindings: phy: Add PHY_TYPE_UFS definition
Add definition for UFS phy type. Signed-off-by: Vivek Gautam --- include/dt-bindings/phy/phy.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h index 6c901930eb3e..d16e8755f6a9 100644 --- a/include/dt-bindings/phy/phy.h +++ b/include/dt-bindings/phy/phy.h @@ -15,5 +15,6 @@ #define PHY_TYPE_PCIE 2 #define PHY_TYPE_USB2 3 #define PHY_TYPE_USB3 4 +#define PHY_TYPE_UFS 5 #endif /* _DT_BINDINGS_PHY */ -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH 2/5] phy: Add UFS PHY modes
UFS phy has two modes for each High speed generation. These modes are identified by two rates of operations - Rate A, and Rate B. Add these UFS phy modes to phy framework. Signed-off-by: Vivek Gautam --- include/linux/phy/phy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 78bb0d7f6b11..27e25bb78bfb 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -27,6 +27,8 @@ enum phy_mode { PHY_MODE_USB_HOST, PHY_MODE_USB_DEVICE, PHY_MODE_USB_OTG, + PHY_MODE_UFS_HS_A, + PHY_MODE_UFS_HS_B, }; /** -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH 4/5] scsi/ufs: qcom: Set phy mode based on the controllers HS MODE
Set the phy mode based on the UFS HS PA mode. This lets the controller let phy know the mode in which the PHY Adapter is running and set the phy rates accordingly. Signed-off-by: Vivek Gautam --- drivers/scsi/ufs/ufs-qcom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index c87d770b519a..44c21d5818ee 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -273,6 +273,9 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B) ? true : false; + if (is_rate_B) + phy_set_mode(phy, PHY_MODE_UFS_HS_B); + /* Assert PHY reset and apply PHY calibration values */ ufs_qcom_assert_reset(hba); /* provide 1ms delay to let the reset pulse propagate */ -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH 3/5] phy: qcom-ufs: Add support to set phy mode
Adding support to set desired UFS phy mode that can be set from the host controller. Signed-off-by: Vivek Gautam --- drivers/phy/qualcomm/phy-qcom-ufs-i.h| 2 ++ drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c | 14 ++ drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c | 14 ++ 3 files changed, 30 insertions(+) diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h index 13b02b7de30b..94326ed107c3 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h +++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h @@ -115,6 +115,8 @@ struct ufs_qcom_phy { int cached_regs_table_size; bool is_powered_on; struct ufs_qcom_phy_specific_ops *phy_spec_ops; + + enum phy_mode mode; }; /** diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c index 12a1b498dc4b..af65785230b5 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c @@ -53,6 +53,19 @@ static int ufs_qcom_phy_qmp_14nm_exit(struct phy *generic_phy) } static +int ufs_qcom_phy_qmp_14nm_set_mode(struct phy *generic_phy, enum phy_mode mode) +{ + struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy); + + phy_common->mode = PHY_MODE_INVALID; + + if (mode > 0) + phy_common->mode = mode; + + return 0; +} + +static void ufs_qcom_phy_qmp_14nm_power_control(struct ufs_qcom_phy *phy, bool val) { writel_relaxed(val ? 0x1 : 0x0, phy->mmio + UFS_PHY_POWER_DOWN_CONTROL); @@ -102,6 +115,7 @@ static int ufs_qcom_phy_qmp_14nm_is_pcs_ready(struct ufs_qcom_phy *phy_common) .exit = ufs_qcom_phy_qmp_14nm_exit, .power_on = ufs_qcom_phy_power_on, .power_off = ufs_qcom_phy_power_off, + .set_mode = ufs_qcom_phy_qmp_14nm_set_mode, .owner = THIS_MODULE, }; diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c index 4f68acb58b73..5c18c41dbdb4 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c @@ -72,6 +72,19 @@ static int ufs_qcom_phy_qmp_20nm_exit(struct phy *generic_phy) } static +int ufs_qcom_phy_qmp_20nm_set_mode(struct phy *generic_phy, enum phy_mode mode) +{ + struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy); + + phy_common->mode = PHY_MODE_INVALID; + + if (mode > 0) + phy_common->mode = mode; + + return 0; +} + +static void ufs_qcom_phy_qmp_20nm_power_control(struct ufs_qcom_phy *phy, bool val) { bool hibern8_exit_after_pwr_collapse = phy->quirks & @@ -160,6 +173,7 @@ static int ufs_qcom_phy_qmp_20nm_is_pcs_ready(struct ufs_qcom_phy *phy_common) .exit = ufs_qcom_phy_qmp_20nm_exit, .power_on = ufs_qcom_phy_power_on, .power_off = ufs_qcom_phy_power_off, + .set_mode = ufs_qcom_phy_qmp_20nm_set_mode, .owner = THIS_MODULE, }; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH 5/5] ufs/phy: qcom: Refactor to use phy_init call
Refactor ufs_qcom_power_up_sequence() to get rid of ugly exported phy APIs and use the phy_init() and phy_power_on() to do the phy initialization. Signed-off-by: Vivek Gautam --- drivers/phy/qualcomm/phy-qcom-ufs-i.h| 2 -- drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c | 9 +-- drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c | 9 +-- drivers/phy/qualcomm/phy-qcom-ufs.c | 38 drivers/scsi/ufs/ufs-qcom.c | 36 ++ include/linux/phy/phy-qcom-ufs.h | 3 --- 6 files changed, 38 insertions(+), 59 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h index 94326ed107c3..495fd5941231 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h +++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h @@ -123,7 +123,6 @@ struct ufs_qcom_phy { * struct ufs_qcom_phy_specific_ops - set of pointers to functions which have a * specific implementation per phy. Each UFS phy, should implement * those functions according to its spec and requirements - * @calibrate_phy: pointer to a function that calibrate the phy * @start_serdes: pointer to a function that starts the serdes * @is_physical_coding_sublayer_ready: pointer to a function that * checks pcs readiness. returns 0 for success and non-zero for error. @@ -132,7 +131,6 @@ struct ufs_qcom_phy { * and writes to QSERDES_RX_SIGDET_CNTRL attribute */ struct ufs_qcom_phy_specific_ops { - int (*calibrate_phy)(struct ufs_qcom_phy *phy, bool is_rate_B); void (*start_serdes)(struct ufs_qcom_phy *phy); int (*is_physical_coding_sublayer_ready)(struct ufs_qcom_phy *phy); void (*set_tx_lane_enable)(struct ufs_qcom_phy *phy, u32 val); diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c index af65785230b5..c39440b56b6d 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c @@ -44,7 +44,13 @@ void ufs_qcom_phy_qmp_14nm_advertise_quirks(struct ufs_qcom_phy *phy_common) static int ufs_qcom_phy_qmp_14nm_init(struct phy *generic_phy) { - return 0; + struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy); + bool is_rate_B = false; + + if (phy_common->mode == PHY_MODE_UFS_HS_B) + is_rate_B = true; + + return ufs_qcom_phy_qmp_14nm_phy_calibrate(phy_common, is_rate_B); } static int ufs_qcom_phy_qmp_14nm_exit(struct phy *generic_phy) @@ -120,7 +126,6 @@ static int ufs_qcom_phy_qmp_14nm_is_pcs_ready(struct ufs_qcom_phy *phy_common) }; static struct ufs_qcom_phy_specific_ops phy_14nm_ops = { - .calibrate_phy = ufs_qcom_phy_qmp_14nm_phy_calibrate, .start_serdes = ufs_qcom_phy_qmp_14nm_start_serdes, .is_physical_coding_sublayer_ready = ufs_qcom_phy_qmp_14nm_is_pcs_ready, .set_tx_lane_enable = ufs_qcom_phy_qmp_14nm_set_tx_lane_enable, diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c index 5c18c41dbdb4..5705a2d4c6d2 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c @@ -63,7 +63,13 @@ void ufs_qcom_phy_qmp_20nm_advertise_quirks(struct ufs_qcom_phy *phy_common) static int ufs_qcom_phy_qmp_20nm_init(struct phy *generic_phy) { - return 0; + struct ufs_qcom_phy *phy_common = get_ufs_qcom_phy(generic_phy); + bool is_rate_B = false; + + if (phy_common->mode == PHY_MODE_UFS_HS_B) + is_rate_B = true; + + return ufs_qcom_phy_qmp_20nm_phy_calibrate(phy_common, is_rate_B); } static int ufs_qcom_phy_qmp_20nm_exit(struct phy *generic_phy) @@ -178,7 +184,6 @@ static int ufs_qcom_phy_qmp_20nm_is_pcs_ready(struct ufs_qcom_phy *phy_common) }; static struct ufs_qcom_phy_specific_ops phy_20nm_ops = { - .calibrate_phy = ufs_qcom_phy_qmp_20nm_phy_calibrate, .start_serdes = ufs_qcom_phy_qmp_20nm_start_serdes, .is_physical_coding_sublayer_ready = ufs_qcom_phy_qmp_20nm_is_pcs_ready, .set_tx_lane_enable = ufs_qcom_phy_qmp_20nm_set_tx_lane_enable, diff --git a/drivers/phy/qualcomm/phy-qcom-ufs.c b/drivers/phy/qualcomm/phy-qcom-ufs.c index 43865ef340e2..1febe3294fe3 100644 --- a/drivers/phy/qualcomm/phy-qcom-ufs.c +++ b/drivers/phy/qualcomm/phy-qcom-ufs.c @@ -518,9 +518,8 @@ void ufs_qcom_phy_disable_iface_clk(struct ufs_qcom_phy *phy) } } -int ufs_qcom_phy_start_serdes(struct phy *generic_phy) +static int ufs_qcom_phy_start_serdes(struct ufs_qcom_phy *ufs_qcom_phy) { - struct ufs_qcom_phy *ufs_qcom_phy = get_ufs_qcom_phy(generic_phy); int ret = 0; if (!ufs_qcom_phy->phy_spec_ops->start_serdes) { @@ -533,7 +532,6 @@ 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_
[PATCH 0/5] qcom-ufs: phy/hcd: Refactor phy initialization code
Refactoring the qcom-ufs phy and host controller code to move further towards the generic phy usage. Right now the qcom-ufs exports a bunch of APIs that are used by the host controller to initialize the phy. With this patch series, we populate the phy_init() which was a no-op earlier. The host controller then calls the phy_init() at the designated place rather than doing it invariably in ufs_hcd_init(). As part of this series, we introduce phy modes for ufs phy. The M-PHY has two data rates defined for each generations (Gears) - Rate A and Rate B. These can serve as the two modes of ufs HS phy. Host controller can direct the phy to set the respective configurations based on the phy modes. The patch-series has been tested with necessary dt patches on db820c. Vivek Gautam (5): dt-bindings: phy: Add PHY_TYPE_UFS definition phy: Add UFS PHY modes phy: qcom-ufs: Add support to set phy mode scsi/ufs: qcom: Set phy mode based on the controllers HS MODE ufs/phy: qcom: Refactor to use phy_init call drivers/phy/qualcomm/phy-qcom-ufs-i.h| 4 +-- drivers/phy/qualcomm/phy-qcom-ufs-qmp-14nm.c | 23 ++-- drivers/phy/qualcomm/phy-qcom-ufs-qmp-20nm.c | 23 ++-- drivers/phy/qualcomm/phy-qcom-ufs.c | 38 +++ drivers/scsi/ufs/ufs-qcom.c | 39 include/dt-bindings/phy/phy.h| 1 + include/linux/phy/phy-qcom-ufs.h | 3 --- include/linux/phy/phy.h | 2 ++ 8 files changed, 74 insertions(+), 59 deletions(-) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH] scsi_dh_alua: suppress errors from unsupported devices
ALUA is only relevant for disk-like devices, so we shouldn't be printing out warning messages for other device types. Signed-off-by: Hannes Reinecke --- drivers/scsi/device_handler/scsi_dh_alua.c | 2 ++ drivers/scsi/scsi_dh.c | 5 +++-- drivers/scsi/scsi_sysfs.c | 7 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 0962fd5..c3aea06 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -1100,6 +1100,8 @@ static int alua_bus_attach(struct scsi_device *sdev) err = alua_initialize(sdev, h); if (err == SCSI_DH_NOMEM) ret = -ENOMEM; + if (err == SCSI_DH_DEV_UNSUPP) + ret = -ENODEV; if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED) goto failed; diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c index 84addee..16e780d 100644 --- a/drivers/scsi/scsi_dh.c +++ b/drivers/scsi/scsi_dh.c @@ -133,8 +133,9 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev, error = scsi_dh->attach(sdev); if (error) { - sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n", - scsi_dh->name, error); + if (error != -ENODEV) + sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n", + scsi_dh->name, error); module_put(scsi_dh->module); } else sdev->handler = scsi_dh; diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index d6984df..5e8ace2 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1222,12 +1222,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) scsi_autopm_get_device(sdev); error = scsi_dh_add_device(sdev); - if (error) - /* -* device_handler is optional, so any error can be ignored -*/ - sdev_printk(KERN_INFO, sdev, - "failed to add device handler: %d\n", error); + /* device_handler is optional, so any error can be ignored */ error = device_add(&sdev->sdev_gendev); if (error) { -- 1.8.5.6
[PATCH 3/5] scsi/esp_scsi: Clean up control flow and dead code
This patch improves readability. There are no functional changes. Since this touches on a questionable ESP_INTR_DC conditional, add some commentary to help others who may (as I did) find themselves chasing an "Invalid Command" error after the device flags this condition. This cleanup also eliminates a warning from "make W=1": drivers/scsi/esp_scsi.c: In function 'esp_finish_select': drivers/scsi/esp_scsi.c:1233:5: warning: variable 'orig_select_state' set but not used [-Wunused-but-set-variable] u8 orig_select_state; Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/esp_scsi.c | 40 ++-- drivers/scsi/esp_scsi.h | 1 - 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 71cb05b1c3eb..93fef2b3d357 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -597,14 +597,12 @@ static int esp_alloc_lun_tag(struct esp_cmd_entry *ent, lp->non_tagged_cmd = ent; return 0; - } else { - /* Tagged command, see if blocked by a -* non-tagged one. -*/ - if (lp->non_tagged_cmd || lp->hold) - return -EBUSY; } + /* Tagged command. Check that it isn't blocked by a non-tagged one. */ + if (lp->non_tagged_cmd || lp->hold) + return -EBUSY; + BUG_ON(lp->tagged_cmds[ent->orig_tag[1]]); lp->tagged_cmds[ent->orig_tag[1]] = ent; @@ -1210,12 +1208,6 @@ static int esp_reconnect(struct esp *esp) esp->active_cmd = ent; - if (ent->flags & ESP_CMD_FLAG_ABORT) { - esp->msg_out[0] = ABORT_TASK_SET; - esp->msg_out_len = 1; - scsi_esp_cmd(esp, ESP_CMD_SATN); - } - esp_event(esp, ESP_EVENT_CHECK_PHASE); esp_restore_pointers(esp, ent); esp->flags |= ESP_FLAG_QUICKIRQ_CHECK; @@ -1230,9 +1222,6 @@ static int esp_finish_select(struct esp *esp) { struct esp_cmd_entry *ent; struct scsi_cmnd *cmd; - u8 orig_select_state; - - orig_select_state = esp->select_state; /* No longer selecting. */ esp->select_state = ESP_SELECT_NONE; @@ -1745,7 +1734,6 @@ static int esp_process_event(struct esp *esp) return 0; } goto again; - break; case ESP_EVENT_DATA_IN: write = 1; @@ -1956,12 +1944,14 @@ static int esp_process_event(struct esp *esp) } else { if (esp->msg_out_len > 1) esp->ops->dma_invalidate(esp); - } - if (!(esp->ireg & ESP_INTR_DC)) { - if (esp->rev != FASHME) + /* XXX if the chip went into disconnected mode, +* we can't run the phase state machine anyway. +*/ + if (!(esp->ireg & ESP_INTR_DC)) scsi_esp_cmd(esp, ESP_CMD_NULL); } + esp_event(esp, ESP_EVENT_CHECK_PHASE); goto again; case ESP_EVENT_MSGIN: @@ -2022,7 +2012,6 @@ static int esp_process_event(struct esp *esp) } esp_schedule_reset(esp); return 0; - break; case ESP_EVENT_RESET: scsi_esp_cmd(esp, ESP_CMD_RS); @@ -2033,7 +2022,6 @@ static int esp_process_event(struct esp *esp) "Unexpected event %x, resetting\n", esp->event); esp_schedule_reset(esp); return 0; - break; } return 1; } @@ -2170,14 +2158,14 @@ static void __esp_interrupt(struct esp *esp) esp_schedule_reset(esp); } else { - if (!(esp->ireg & ESP_INTR_RSEL)) { - /* Some combination of FDONE, BSERV, DC. */ - if (esp->select_state != ESP_SELECT_NONE) - intr_done = esp_finish_select(esp); - } else if (esp->ireg & ESP_INTR_RSEL) { + if (esp->ireg & ESP_INTR_RSEL) { if (esp->active_cmd) (void) esp_finish_select(esp); intr_done = esp_reconnect(esp); + } else { + /* Some combination of FDONE, BSERV, DC. */ + if (esp->select_state != ESP_SELECT_NONE) + intr_done = esp_finish_select(esp); } } while (!intr_done) diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h index 84dcbe4a6268..7e8932ae91f8 100644 --- a/drivers/scsi/esp_scsi.h +++ b/drivers/scsi/esp_scsi.h @@ -281,7 +281,6 @@ struct esp_cmd_entry { u8 flags; #define ESP_CMD_FLAG_WRITE 0x01 /* DM
[PATCH 4/5] scsi/esp_scsi: Avoid sending ABORT TASK SET messages
If an LLD aborts a task set, it should complete the affected commands with the appropriate result code. In a couple of cases esp_scsi doesn't do so. When the initiator receives an unhandled message, just respond by sending a MESSAGE REJECT instead of ABORT TASK SET, and thus avoid the issue. OTOH, a MESSAGE REJECT sent by a target can be taken as an indication that the initiator messed up somehow. It isn't always possible to abort correctly, so just fall back on a SCSI bus reset, which will complete the affected commands with the appropriate result code. For example, certain Apple (Sony) CD-ROM drives, when the non-existent LUN 1 is scanned, can't handle the INQUIRY command. The problem is not detected until the initiator gets a MESSAGE REJECT. Whenever esp_scsi sees that message, it raises ATN and sends ABORT TASK SET -- but neglects to complete the failed scmd. The target then goes into DATA OUT phase (probably bogus), while the ESP device goes into disconnected mode (surprising, given the bus phase). The next Transfer Information command from esp_scsi then causes an Invalid Command interrupt because that command is not valid when in disconnected mode: mac_esp: using PDMA for controller 0 mac_esp mac_esp.0: esp0: regs[50f1:(null)] irq[19] mac_esp mac_esp.0: esp0: is a ESP236, 16 MHz (ccf=4), SCSI ID 7 scsi host0: esp scsi 0:0:0:0: Direct-Access SEAGATE ST318416N0010 PQ: 0 ANSI: 3 scsi target0:0:0: Beginning Domain Validation scsi target0:0:0: asynchronous scsi target0:0:0: Domain Validation skipping write tests scsi target0:0:0: Ending Domain Validation scsi 0:0:3:0: CD-ROMSONY CD-ROM CDU-8003A 1.9a PQ: 0 ANSI: 2 CCS scsi target0:0:3: Beginning Domain Validation scsi target0:0:3: FAST-5 SCSI 2.0 MB/s ST (500 ns, offset 15) scsi target0:0:3: Domain Validation skipping write tests scsi target0:0:3: Ending Domain Validation scsi host0: unexpected IREG 40 scsi host0: Dumping command log scsi host0: ent[2] CMD val[c2] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c] scsi host0: ent[3] CMD val[00] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c] scsi host0: ent[4] EVENT val[0d] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c] scsi host0: ent[5] EVENT val[03] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0d] scsi host0: ent[6] CMD val[90] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[03] scsi host0: ent[7] EVENT val[05] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[03] scsi host0: ent[8] EVENT val[0d] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[05] scsi host0: ent[9] CMD val[01] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d] scsi host0: ent[10] CMD val[11] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d] scsi host0: ent[11] EVENT val[0b] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d] scsi host0: ent[12] CMD val[12] sreg[97] seqreg[cc] sreg2[00] ireg[08] ss[00] event[0b] scsi host0: ent[13] EVENT val[0c] sreg[97] seqreg[cc] sreg2[00] ireg[08] ss[00] event[0b] scsi host0: ent[14] CMD val[44] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[00] event[0c] scsi host0: ent[15] CMD val[01] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c] scsi host0: ent[16] CMD val[c2] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c] scsi host0: ent[17] CMD val[00] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0c] scsi host0: ent[18] EVENT val[0d] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0c] scsi host0: ent[19] EVENT val[06] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0d] scsi host0: ent[20] CMD val[01] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[06] scsi host0: ent[21] CMD val[10] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[06] scsi host0: ent[22] CMD val[1a] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06] scsi host0: ent[23] CMD val[12] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06] scsi host0: ent[24] EVENT val[0d] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06] scsi host0: ent[25] EVENT val[09] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[0d] scsi host0: ent[26] CMD val[01] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09] scsi host0: ent[27] CMD val[10] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09] scsi host0: ent[28] EVENT val[0a] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09] scsi host0: ent[29] EVENT val[0d] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[0a] scsi host0: ent[30] EVENT val[04] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[0d] scsi host0: ent[31] CMD val[01] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04] scsi host0: ent[0] CMD val[90] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04] scsi host0: ent[1] EVENT val[05] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04] scsi target0:0:3: FAST-5 SCSI 2.0 MB/s ST (500 ns, offset 15) scsi target0:0:0: asynchronous sr 0:0:3:0: [sr0] scsi-1 drive cdrom: Uniform CD-ROM driver Revision: 3.20 sd 0:0:0:
[PATCH 5/5] scsi/esp_scsi: Always clear msg_out_len after MESSAGE OUT phase
After sending a message, always clear esp->msg_out_len. Otherwise, eh_abort_handler may subsequently fail to send an ABORT TASK SET message. Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/esp_scsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 4d1e08a87274..c3fc34b9964d 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -1951,6 +1951,8 @@ static int esp_process_event(struct esp *esp) scsi_esp_cmd(esp, ESP_CMD_NULL); } + esp->msg_out_len = 0; + esp_event(esp, ESP_EVENT_CHECK_PHASE); goto again; case ESP_EVENT_MSGIN: -- 2.13.0
[PATCH 1/5] scsi/mac_esp: Avoid type warning from sparse
Avoid the following warning from "make C=1": CHECK drivers/scsi/mac_esp.c drivers/scsi/mac_esp.c:357:30: warning: incorrect type in initializer (different address spaces) drivers/scsi/mac_esp.c:357:30:expected unsigned char [usertype] *fifo drivers/scsi/mac_esp.c:357:30:got void [noderef] * Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/scsi/mac_esp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index cdb61eaa2d1f..253142f3cf6f 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c @@ -348,7 +348,7 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, u32 dma_count, int write, u8 cmd) { struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); - u8 *fifo = esp->regs + ESP_FDATA * 16; + u8 __iomem *fifo = esp->regs + ESP_FDATA * 16; cmd &= ~ESP_CMD_DMA; mep->error = 0; -- 2.13.0
[PATCH 2/5] scsi/mac_esp: Fix PIO transfers for MESSAGE IN phase
When in MESSAGE IN phase, the ESP device does not automatically acknowledge each byte that is transferred by PIO. The mac_esp driver neglects to explicitly ack them, which causes a timeout during messages larger than one byte (e.g. tag bytes during reconnect). Fix this with an ESP_CMD_MOK command after each byte. The MESSAGE IN phase is also different in that each byte transferred raises ESP_INTR_FDONE. So don't exit the transfer loop for this interrupt, for this phase. That resolves the "Reconnect IRQ2 timeout" error on those Macs which use PIO transfers instead of PDMA. This patch also improves on the weak tests for unexpected interrupts and phase changes during PIO transfers. Tested-by: Stan Johnson Fixes: 02507a80b35e ("[PATCH] [SCSI] mac_esp: fix PIO mode, take 2") Signed-off-by: Finn Thain --- drivers/scsi/mac_esp.c | 35 ++- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index 253142f3cf6f..eb551f3cc471 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c @@ -349,25 +349,23 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, { struct mac_esp_priv *mep = MAC_ESP_GET_PRIV(esp); u8 __iomem *fifo = esp->regs + ESP_FDATA * 16; + u8 phase = esp->sreg & ESP_STAT_PMASK; cmd &= ~ESP_CMD_DMA; mep->error = 0; if (write) { + u8 *dst = (u8 *)addr; + u8 mask = ~(phase == ESP_MIP ? ESP_INTR_FDONE : ESP_INTR_BSERV); + scsi_esp_cmd(esp, cmd); while (1) { - unsigned int n; - - n = mac_esp_wait_for_fifo(esp); - if (!n) + if (!mac_esp_wait_for_fifo(esp)) break; - if (n > esp_count) - n = esp_count; - esp_count -= n; - - MAC_ESP_PIO_LOOP("%2@,%0@+", n); + *dst++ = esp_read8(ESP_FDATA); + --esp_count; if (!esp_count) break; @@ -375,14 +373,17 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, if (mac_esp_wait_for_intr(esp)) break; - if (((esp->sreg & ESP_STAT_PMASK) != ESP_DIP) && - ((esp->sreg & ESP_STAT_PMASK) != ESP_MIP)) + if ((esp->sreg & ESP_STAT_PMASK) != phase) break; esp->ireg = esp_read8(ESP_INTRPT); - if ((esp->ireg & (ESP_INTR_DC | ESP_INTR_BSERV)) != - ESP_INTR_BSERV) + if (esp->ireg & mask) { + mep->error = 1; break; + } + + if (phase == ESP_MIP) + scsi_esp_cmd(esp, ESP_CMD_MOK); scsi_esp_cmd(esp, ESP_CMD_TI); } @@ -402,14 +403,14 @@ static void mac_esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count, if (mac_esp_wait_for_intr(esp)) break; - if (((esp->sreg & ESP_STAT_PMASK) != ESP_DOP) && - ((esp->sreg & ESP_STAT_PMASK) != ESP_MOP)) + if ((esp->sreg & ESP_STAT_PMASK) != phase) break; esp->ireg = esp_read8(ESP_INTRPT); - if ((esp->ireg & (ESP_INTR_DC | ESP_INTR_BSERV)) != - ESP_INTR_BSERV) + if (esp->ireg & ~ESP_INTR_BSERV) { + mep->error = 1; break; + } n = MAC_ESP_FIFO_SIZE - (esp_read8(ESP_FFLAGS) & ESP_FF_FBYTES); -- 2.13.0
[PATCH 0/5] esp_scsi, mac_esp: Various fixes and cleanups
This series has been tested on m68k Macs (ESP236 equivalent). Some more testing with different targets and devices (FAS236 etc) might be nice. Being that the esp_scsi fixes are on error paths, more review may actually be more valuable than more testing... Finn Thain (5): scsi/mac_esp: Avoid type warning from sparse scsi/mac_esp: Fix PIO transfers for MESSAGE IN phase scsi/esp_scsi: Clean up control flow and dead code scsi/esp_scsi: Avoid sending ABORT TASK SET messages scsi/esp_scsi: Always clear msg_out_len after MESSAGE OUT phase drivers/scsi/esp_scsi.c | 53 + drivers/scsi/esp_scsi.h | 1 - drivers/scsi/mac_esp.c | 37 +- 3 files changed, 42 insertions(+), 49 deletions(-) -- 2.13.0
[PATCH] aacraid: Fix out of bounds in aac_get_name_resp
We terminate the aac_get_name_resp on a byte that is outside the bounds of the structure. Extend the return response by one byte to remove the appearance of out of bounds reference. Thank you Dan for reporting the issue. Thank you Bart Van Assche for suggesting the FIELD_SIZEOF macro. Fixes: b836439faf04 ("aacraid: 4KB sector support") Reported-by: Dan Carpenter Signed-off-by: David Carroll Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/aachba.c |9 +++-- drivers/scsi/aacraid/aacraid.h |2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 707ee2f5954d..a875175d58d1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -549,7 +549,9 @@ static void get_container_name_callback(void *context, struct fib * fibptr) if ((le32_to_cpu(get_name_reply->status) == CT_OK) && (get_name_reply->data[0] != '\0')) { char *sp = get_name_reply->data; - sp[sizeof(((struct aac_get_name_resp *)NULL)->data)] = '\0'; + int data_size = FIELD_SIZEOF(struct aac_get_name_resp, data); + + sp[data_size - 1] = '\0'; while (*sp == ' ') ++sp; if (*sp) { @@ -579,12 +581,15 @@ static void get_container_name_callback(void *context, struct fib * fibptr) static int aac_get_container_name(struct scsi_cmnd * scsicmd) { int status; + int data_size; struct aac_get_name *dinfo; struct fib * cmd_fibcontext; struct aac_dev * dev; dev = (struct aac_dev *)scsicmd->device->host->hostdata; + data_size = FIELD_SIZEOF(struct aac_get_name_resp, data); + cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd); aac_fib_init(cmd_fibcontext); @@ -593,7 +598,7 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd) dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->type = cpu_to_le32(CT_READ_NAME); dinfo->cid = cpu_to_le32(scmd_id(scsicmd)); - dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); + dinfo->count = cpu_to_le32(data_size - 1); status = aac_fib_send(ContainerCommand, cmd_fibcontext, diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 69812994b81e..92fabf2b0c24 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2275,7 +2275,7 @@ struct aac_get_name_resp { __le32 parm3; __le32 parm4; __le32 parm5; - u8 data[16]; + u8 data[17]; }; #define CT_CID_TO_32BITS_UID 165
[PATCH v2 1/5] aic7xxx: remove empty function
ahc_platform_dump_card_state() does nothing. Remove it. Signed-off-by: Michał Mirosław --- drivers/scsi/aic7xxx/aic7xxx_core.c | 1 - drivers/scsi/aic7xxx/aic7xxx_osm.c | 5 - drivers/scsi/aic7xxx/aic7xxx_osm.h | 1 - 3 files changed, 7 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 64ab9eaec428..381846164003 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -7340,7 +7340,6 @@ ahc_dump_card_state(struct ahc_softc *ahc) printk("\n"); } - ahc_platform_dump_card_state(ahc); printk("\n< Dump Card State Ends >>\n"); ahc_outb(ahc, SCBPTR, saved_scbptr); if (paused == 0) diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index fc6a83188c1e..acd687f4554e 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -2329,11 +2329,6 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) return (retval); } -void -ahc_platform_dump_card_state(struct ahc_softc *ahc) -{ -} - static void ahc_linux_set_width(struct scsi_target *starget, int width) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 54c702864103..f8489078f003 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -688,7 +688,6 @@ voidahc_done(struct ahc_softc*, struct scb*); void ahc_send_async(struct ahc_softc *, char channel, u_int target, u_int lun, ac_code); void ahc_print_path(struct ahc_softc *, struct scb *); -void ahc_platform_dump_card_state(struct ahc_softc *ahc); #ifdef CONFIG_PCI #define AHC_PCI_CONFIG 1 -- 2.11.0
[PATCH v2 5/5] aic7[9x]xx: printk() lines unbroken
Current code is not SMP-friendly and since now each printk() call generates a separate line in the log, the output is mostly unreadable. Make it better formatted. Signed-off-by: Michał Mirosław --- drivers/scsi/Kconfig | 3 +- drivers/scsi/aic7xxx/Kconfig | 6 + drivers/scsi/aic7xxx/Kconfig.aic79xx | 1 + drivers/scsi/aic7xxx/Kconfig.aic7xxx | 1 + drivers/scsi/aic7xxx/Makefile| 1 + drivers/scsi/aic7xxx/aic79xx.h | 7 - drivers/scsi/aic7xxx/aic79xx_core.c | 242 +--- drivers/scsi/aic7xxx/aic79xx_reg.h_shipped | 307 +++ drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped | 480 +++ drivers/scsi/aic7xxx/aic7xxx.h | 7 - drivers/scsi/aic7xxx/aic7xxx_core.c | 181 - drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped | 157 drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped | 242 ++-- drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c | 39 +- drivers/scsi/aic7xxx/aiclib.c| 103 +++-- drivers/scsi/aic7xxx/aiclib.h| 32 ++ 16 files changed, 871 insertions(+), 938 deletions(-) diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index f4538d7a3016..b76939b77319 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -452,8 +452,7 @@ config SCSI_AACRAID will be called aacraid. -source "drivers/scsi/aic7xxx/Kconfig.aic7xxx" -source "drivers/scsi/aic7xxx/Kconfig.aic79xx" +source "drivers/scsi/aic7xxx/Kconfig" source "drivers/scsi/aic94xx/Kconfig" source "drivers/scsi/hisi_sas/Kconfig" source "drivers/scsi/mvsas/Kconfig" diff --git a/drivers/scsi/aic7xxx/Kconfig b/drivers/scsi/aic7xxx/Kconfig new file mode 100644 index ..aeae1ba88281 --- /dev/null +++ b/drivers/scsi/aic7xxx/Kconfig @@ -0,0 +1,6 @@ +config SCSI_AICLIB + tristate + default n + +source "drivers/scsi/aic7xxx/Kconfig.aic7xxx" +source "drivers/scsi/aic7xxx/Kconfig.aic79xx" diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx index 3b3d599103f8..7cf29839bc54 100644 --- a/drivers/scsi/aic7xxx/Kconfig.aic79xx +++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx @@ -6,6 +6,7 @@ config SCSI_AIC79XX tristate "Adaptec AIC79xx U320 support" depends on PCI && SCSI select SCSI_SPI_ATTRS + select SCSI_AICLIB help This driver supports all of Adaptec's Ultra 320 PCI-X based SCSI controllers. diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx index 55ac55ee6068..0d6cea939551 100644 --- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx +++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx @@ -6,6 +6,7 @@ config SCSI_AIC7XXX tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)" depends on (PCI || EISA) && SCSI select SCSI_SPI_ATTRS + select SCSI_AICLIB ---help--- This driver supports all of Adaptec's Fast through Ultra 160 PCI based SCSI controllers as well as the aic7770 based EISA and VLB diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index 1a5509d40f8a..3e7565a9d37a 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -7,6 +7,7 @@ # Let kbuild descend into aicasm when cleaning subdir-+= aicasm +obj-$(CONFIG_SCSI_AICLIB) += aiclib.o obj-$(CONFIG_SCSI_AIC7XXX) += aic7xxx.o obj-$(CONFIG_SCSI_AIC79XX) += aic79xx.o diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index d47b527b25dd..f81287db98bb 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h @@ -1468,11 +1468,4 @@ extern uint32_t ahd_debug; void ahd_print_devinfo(struct ahd_softc *ahd, struct ahd_devinfo *devinfo); void ahd_dump_card_state(struct ahd_softc *ahd); -intahd_print_register(const ahd_reg_parse_entry_t *table, - u_int num_entries, - const char *name, - u_int address, - u_int value, - u_int *cur_column, - u_int wrap_point); #endif /* _AIC79XX_H_ */ diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 95d8f25cbcca..b895c43e9a5d 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -2672,6 +2672,7 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) static void ahd_handle_transmission_error(struct ahd_softc *ahd) { + struct aic_dump_buffer buf; struct scb *scb; u_int scbid; u_int lqistat1; @@ -2680,7 +
[PATCH v2 0/4] aic7xxx: fix debugging printks
This series aims to clean up printing of card state after a problem event. Currently, the output is pretty much unreadable, as it is spread over a lot of single-word lines. This series compiles (on x86), but is not tested, yet. v2: rebased after 516b7db593 ("scsi: aic7xxx: fix firmware build with O=path") Michał Mirosław (5): aic7xxx: remove empty function aic7xxx: fix firmware build deps aic7xxx: remove rules for shipped files aic7xxx: regenerate firmware files aic7[9x]xx: printk() lines unbroken drivers/scsi/Kconfig |3 +- drivers/scsi/aic7xxx/Kconfig |6 + drivers/scsi/aic7xxx/Kconfig.aic79xx |1 + drivers/scsi/aic7xxx/Kconfig.aic7xxx |1 + drivers/scsi/aic7xxx/Makefile| 11 +- drivers/scsi/aic7xxx/aic79xx.h |7 - drivers/scsi/aic7xxx/aic79xx_core.c | 242 ++-- drivers/scsi/aic7xxx/aic79xx_reg.h_shipped | 1560 +- drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped | 504 +++ drivers/scsi/aic7xxx/aic7xxx.h |7 - drivers/scsi/aic7xxx/aic7xxx_core.c | 182 +-- drivers/scsi/aic7xxx/aic7xxx_osm.c |5 - drivers/scsi/aic7xxx/aic7xxx_osm.h |1 - drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped | 201 ++- drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped | 242 ++-- drivers/scsi/aic7xxx/aicasm/aicasm_symbol.c | 39 +- drivers/scsi/aic7xxx/aiclib.c| 103 +- drivers/scsi/aic7xxx/aiclib.h| 32 + 18 files changed, 1098 insertions(+), 2049 deletions(-) create mode 100644 drivers/scsi/aic7xxx/Kconfig -- 2.11.0
[PATCH v2 4/5] aic7xxx: regenerate firmware files
Regenerate firmware files to make cleaner base for following fix. This removes some unused definitions and reorders some #defines, but the code remains the same. Signed-off-by: Michał Mirosław --- drivers/scsi/aic7xxx/aic79xx_reg.h_shipped | 1267 -- drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped | 34 +- drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped | 44 +- 3 files changed, 235 insertions(+), 1110 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped index cdcead071ef6..ddcd5a7701ac 100644 --- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped @@ -13,13 +13,6 @@ typedef struct ahd_reg_parse_entry { } ahd_reg_parse_entry_t; #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_mode_ptr_print; -#else -#define ahd_mode_ptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "MODE_PTR", 0x00, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_intstat_print; #else #define ahd_intstat_print(regvalue, cur_col, wrap) \ @@ -27,27 +20,6 @@ ahd_reg_print_t ahd_intstat_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_seqintcode_print; -#else -#define ahd_seqintcode_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "SEQINTCODE", 0x02, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_error_print; -#else -#define ahd_error_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "ERROR", 0x04, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_hescb_qoff_print; -#else -#define ahd_hescb_qoff_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "HESCB_QOFF", 0x08, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_hs_mailbox_print; #else #define ahd_hs_mailbox_print(regvalue, cur_col, wrap) \ @@ -62,27 +34,6 @@ ahd_reg_print_t ahd_seqintstat_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_clrseqintstat_print; -#else -#define ahd_clrseqintstat_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "CLRSEQINTSTAT", 0x0c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_swtimer_print; -#else -#define ahd_swtimer_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "SWTIMER", 0x0e, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_sescb_qoff_print; -#else -#define ahd_sescb_qoff_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "SESCB_QOFF", 0x12, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS ahd_reg_print_t ahd_intctl_print; #else #define ahd_intctl_print(regvalue, cur_col, wrap) \ @@ -111,111 +62,6 @@ ahd_reg_print_t ahd_sg_cache_shadow_print; #endif #if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_lqin_print; -#else -#define ahd_lqin_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "LQIN", 0x20, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_lunptr_print; -#else -#define ahd_lunptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "LUNPTR", 0x22, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_cmdlenptr_print; -#else -#define ahd_cmdlenptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "CMDLENPTR", 0x25, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_attrptr_print; -#else -#define ahd_attrptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "ATTRPTR", 0x26, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_flagptr_print; -#else -#define ahd_flagptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "FLAGPTR", 0x27, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_cmdptr_print; -#else -#define ahd_cmdptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "CMDPTR", 0x28, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_qnextptr_print; -#else -#define ahd_qnextptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "QNEXTPTR", 0x29, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_abrtbyteptr_print; -#else -#define ahd_abrtbyteptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "ABRTBYTEPTR", 0x2b, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_abrtbitptr_print; -#else -#define ahd_abrtbitptr_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "ABRTBITPTR", 0x2c, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_lunlen_print; -#else -#define ahd_lunlen_print(regvalue, cur_col, wrap) \ -ahd_print_register(NULL, 0, "LUNLEN", 0x30, regvalue, cur_col, wrap) -#endif - -#if AIC_DEBUG_REGISTERS -ahd_reg_print_t ahd_cdblimit_print; -#else -#d
[PATCH v2 3/5] aic7xxx: remove rules for shipped files
There are Kbuild rules for that already. Signed-off-by: Michał Mirosław --- drivers/scsi/aic7xxx/Makefile | 4 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index b03ba0df7a83..1a5509d40f8a 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -61,8 +61,6 @@ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm $(aic7xxx-gen-y): $(objtree)/$(obj)/aic7xxx_seq.h @true -else -$(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped endif aic79xx-gen-$(CONFIG_AIC79XX_BUILD_FIRMWARE) := $(obj)/aic79xx_reg.h @@ -79,8 +77,6 @@ $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm $(aic79xx-gen-y): $(objtree)/$(obj)/aic79xx_seq.h @true -else -$(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped endif $(obj)/aicasm/aicasm: $(srctree)/$(src)/aicasm/*.[chyl] -- 2.11.0
[PATCH v2 2/5] aic7xxx: fix firmware build deps
We need to override Kbuild rules for copying shipped files, otherwise aic7xxx_reg.h and aic7xxx_reg_print.c will be ovewritten by old versions. Fixes: 516b7db593f3a541e2e98867575c3c697f41a247 Signed-off-by: Michał Mirosław --- drivers/scsi/aic7xxx/Makefile | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/aic7xxx/Makefile b/drivers/scsi/aic7xxx/Makefile index 07b60a780c06..b03ba0df7a83 100644 --- a/drivers/scsi/aic7xxx/Makefile +++ b/drivers/scsi/aic7xxx/Makefile @@ -59,7 +59,8 @@ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg $(obj)/aicasm/aicasm $(aicasm-7xxx-opts-y) -o $(obj)/aic7xxx_seq.h \ $(srctree)/$(src)/aic7xxx.seq -$(aic7xxx-gen-y): $(obj)/aic7xxx_seq.h +$(aic7xxx-gen-y): $(objtree)/$(obj)/aic7xxx_seq.h + @true else $(obj)/aic7xxx_reg_print.c: $(src)/aic7xxx_reg_print.c_shipped endif @@ -76,7 +77,8 @@ $(obj)/aic79xx_seq.h: $(src)/aic79xx.seq $(src)/aic79xx.reg $(obj)/aicasm/aicasm $(aicasm-79xx-opts-y) -o $(obj)/aic79xx_seq.h \ $(srctree)/$(src)/aic79xx.seq -$(aic79xx-gen-y): $(obj)/aic79xx_seq.h +$(aic79xx-gen-y): $(objtree)/$(obj)/aic79xx_seq.h + @true else $(obj)/aic79xx_reg_print.c: $(src)/aic79xx_reg_print.c_shipped endif -- 2.11.0
[PATCH] scsi-mq: Always unprepare before requeuing a request
One of the two scsi-mq functions that requeue a request unprepares a request before requeueing (scsi_io_completion()) but the other function not (__scsi_queue_insert()). Make sure that a request is unprepared before requeuing it. Fixes: commit d285203cf647 ("scsi: add support for a blk-mq based I/O path.") Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Damien Le Moal Cc: Johannes Thumshirn Cc: --- drivers/scsi/scsi_lib.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 4a2f705cdb14..c7514f3b444a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -44,6 +44,8 @@ static struct kmem_cache *scsi_sense_cache; static struct kmem_cache *scsi_sense_isadma_cache; static DEFINE_MUTEX(scsi_sense_cache_mutex); +static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd); + static inline struct kmem_cache * scsi_select_sense_cache(bool unchecked_isa_dma) { @@ -140,6 +142,12 @@ static void scsi_mq_requeue_cmd(struct scsi_cmnd *cmd) { struct scsi_device *sdev = cmd->device; + if (cmd->request->rq_flags & RQF_DONTPREP) { + cmd->request->rq_flags &= ~RQF_DONTPREP; + scsi_mq_uninit_cmd(cmd); + } else { + WARN_ON_ONCE(true); + } blk_mq_requeue_request(cmd->request, true); put_device(&sdev->sdev_gendev); } @@ -995,8 +1003,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) * A new command will be prepared and issued. */ if (q->mq_ops) { - cmd->request->rq_flags &= ~RQF_DONTPREP; - scsi_mq_uninit_cmd(cmd); scsi_mq_requeue_cmd(cmd); } else { scsi_release_buffers(cmd); -- 2.13.3
Re: [PATCH] scsi: sg: Prevent potential double frees in sg driver
On Thu, Aug 03, 2017 at 12:34:51PM -0700, Nick Desaulniers wrote: > > Why no one on the to: line? > > I usually cc everyone from get_maintainer.pl. Should I be using > --to= then explicitly for named folks, and --cc= for lists? That's usually a good idea, many email clients throw away stuff if there is nothing on the "To:" line. > > And do you want this in the stable kernel trees? > > Looks like I can follow up on option #2 once this patch has > been reviewed+merged by maintainers. I'll note to use > option #1 next time, unless you suggest I send a v2? I can > do so if this patch has a v2+. If you have to resend it, then add it, otherwise please remember when it hits Linus's tree to send the git commit id to stable@vger and the developers there can handle it. thanks, greg k-h
Re: [PATCH] scsi: sg: Prevent potential double frees in sg driver
> Why no one on the to: line? I usually cc everyone from get_maintainer.pl. Should I be using --to= then explicitly for named folks, and --cc= for lists? > And do you want this in the stable kernel trees? Looks like I can follow up on option #2 once this patch has been reviewed+merged by maintainers. I'll note to use option #1 next time, unless you suggest I send a v2? I can do so if this patch has a v2+. -- Thanks, ~Nick Desaulniers
Re: [PATCH] scsi: sg: Prevent potential double frees in sg driver
On Thu, Aug 03, 2017 at 12:02:47PM -0700, Nick Desaulniers wrote: > From: Robb Glasser > > sg_ioctl could be spammed by requests, leading to a double free in > __free_pages. This protects the entry points of sg_ioctl where the > memory could be corrupted by a double call to __free_pages if multiple > requests are happening concurrently. > > Signed-off-by: Robb Glasser > Signed-off-by: Nick Desaulniers > --- > drivers/scsi/sg.c | 2 ++ > 1 file changed, 2 insertions(+) Why no one on the to: line? And do you want this in the stable kernel trees? If so, please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly. thanks, greg k-h
[PATCH] scsi: sg: Prevent potential double frees in sg driver
From: Robb Glasser sg_ioctl could be spammed by requests, leading to a double free in __free_pages. This protects the entry points of sg_ioctl where the memory could be corrupted by a double call to __free_pages if multiple requests are happening concurrently. Signed-off-by: Robb Glasser Signed-off-by: Nick Desaulniers --- drivers/scsi/sg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 4fe606b000b4..40fe71f4c863 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -883,8 +883,10 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg) return -ENXIO; if (!access_ok(VERIFY_WRITE, p, SZ_SG_IO_HDR)) return -EFAULT; + mutex_lock(&sfp->parentdp->open_rel_lock); result = sg_new_write(sfp, filp, p, SZ_SG_IO_HDR, 1, read_only, 1, &srp); + mutex_unlock(&sfp->parentdp->open_rel_lock); if (result < 0) return result; result = wait_event_interruptible(sfp->read_wait, -- 2.14.0.rc1.383.gd1ce394fe2-goog
[Regression 4.13-rc1] Resume does not work on Lenovo X60t
Dear Linux folks, Since the merge windows opened for Linux 4.13, I am unable to resume from ACPI S3 suspend on a Lenovo X60t. The graphics comes back, but I am unable to enter anything, and the system seems to be hung. Magic SysRq keys still work though, but powering the system of doesn’t work. The power button also does not work. Please find the stack trace with Linux 4.13-rc3 captured over the serial console below. > ``` 46.417: [ 58.148083] ata6: port disabled--ignoring 46.417: [ 58.148243] BUG: unable to handle kernel NULL pointer dereference at 00f4 46.417: [ 58.148252] IP: blk_set_runtime_active+0x27/0x60 46.417: [ 58.148253] *pde = 46.417: [ 58.148254] 46.417: [ 58.148256] Oops: 0002 [#1] SMP 46.418: [ 58.148258] Modules linked in: cpufreq_powersave cpufreq_conservative cpufreq_userspace joydev wacom_w8001 serport binfmt_misc iTCO_wdt iTCO_vendor_support coretemp kvm snd_hda_codec_analog snd_hda_codec_generic arc4 irqbypass pcmcia snd_pcsp thinkpad_acpi serio_raw snd_hda_intel snd_hda_codec yenta_socket lpc_ich iwl3945 mfd_core pcmcia_rsrc snd_hda_core iwlegacy snd_hwdep pcmcia_core snd_pcm mac80211 sg rng_core nvram cfg80211 snd_timer snd soundcore rfkill evdev battery ac shpchp acpi_cpufreq parport_pc ppdev lp parport ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 fscrypto ecb cbc algif_skcipher af_alg dm_crypt dm_mod sr_mod cdrom sd_mod ata_generic psmouse i915 i2c_i801 sdhci_pci ahci ata_piix ehci_pci uhci_hcd libahci firewire_ohci sdhci libata firewire_core ehci_hcd mmc_core e1000e crc_itu_t 46.416: [ 58.148310] scsi_mod ptp usbcore video pps_core button i2c_algo_bit drm_kms_helper thermal syscopyarea sysfillrect sysimgblt fb_sys_fops drm 46.416: [ 58.148322] CPU: 0 PID: 808 Comm: kworker/u4:38 Not tainted 4.13.0-rc3+ #94 46.416: [ 58.148323] Hardware name: LENOVO 636338U/636338U, BIOS CBET4000 TIMELESS 01/01/1970 46.416: [ 58.148328] Workqueue: events_unbound async_run_entry_fn 46.416: [ 58.148330] task: f2900180 task.stack: f2902000 46.416: [ 58.148333] EIP: blk_set_runtime_active+0x27/0x60 46.416: [ 58.148334] EFLAGS: 00010046 CPU: 0 46.416: [ 58.148335] EAX: EBX: f5f3c628 ECX: f5f3c720 EDX: 13c5 46.416: [ 58.148337] ESI: f87a5cc0 EDI: 0010 EBP: 0010 ESP: f2903ea4 46.416: [ 58.148338] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 46.416: [ 58.148340] CR0: 80050033 CR2: 00f4 CR3: 363b4000 CR4: 06d0 46.416: [ 58.148342] Call Trace: 46.416: [ 58.148361] ? scsi_bus_resume_common+0x6e/0x110 [scsi_mod] 46.416: [ 58.148366] ? dpm_run_callback+0x4f/0x150 46.416: [ 58.148369] ? wait_for_completion+0x29/0x140 46.416: [ 58.148381] ? scsi_bus_thaw+0x10/0x10 [scsi_mod] 46.416: [ 58.148384] ? device_resume+0x8e/0x180 46.416: [ 58.148387] ? async_resume+0x1b/0x40 46.416: [ 58.148389] ? async_run_entry_fn+0x3f/0x1a0 46.416: [ 58.148392] ? process_one_work+0x136/0x310 46.416: [ 58.148394] ? worker_thread+0x39/0x3b0 46.416: [ 58.148396] ? kthread+0xd7/0x110 46.416: [ 58.148398] ? process_one_work+0x310/0x310 46.416: [ 58.148400] ? kthread_create_on_node+0x30/0x30 46.416: [ 58.148403] ? ret_from_fork+0x19/0x24 46.416: [ 58.148404] Code: 8d 74 26 00 3e 8d 74 26 00 53 89 c3 8b 80 fc 00 00 00 e8 5d 43 32 00 31 c0 8b 15 20 7e 64 cf 89 83 54 01 00 00 8b 83 50 01 00 00 <89> 90 f4 00 00 00 ba 09 00 00 00 8b 83 50 01 00 00 e8 e3 ef 16 46.416: [ 58.148437] EIP: blk_set_runtime_active+0x27/0x60 SS:ESP: 0068:f2903ea4 46.416: [ 58.148438] CR2: 00f4 46.416: [ 58.148441] ---[ end trace 529e3022b2906e41 ]--- > ``` Please find the full log attached. I don’t know, why the Linux kernel messages in the beginning are transferred in the wrong baud rate. Kind regards, Paul === Thu Aug 3 08:52:39 2017 (adjust=1041.7us) 00.000: <1a>F0H<8c>:<8b>ed<08>4 00.012: <8a><0f>v>74I 00.013: u<16><18><15>><0b><0f>X6T 00.015: CA<84><96><02>(<84><18>R4<18><9a>:<9c>X<05><07>d<16><08><92><91>d<1e>>nM*<87>B@<13><1e><81><83><1e><0c><86><12><95>`<80>Z1<89><99><<00> 00.321: <0e><8c>(B<8d><0c>R<14>H)RX)<8a><81><06><06>42JV.<02><90>uR<15>h<94><92>5<09><95><1a>;<96>26<85>:yZ4@<94><18><96>i<83>NXi<02><95>r<88><17>S<16>(E"pl<82> 00.514: <16><96>4,<1a>:+<80><9e>8<0c>P<19><12>xB<86><05><1c>*<18>)xb<02>.'$&- 00.539: <08>:\(<95><12><02><0e><16>i.<16>r"F<08>*<02>%:#<02>F,"<01>p<<8c><1d>Z<92><04><8d><9b>p<85><81><12>$<1a>#<0f><89>l<04><90>l,@<99>T<04> 00.602: <14><85>12<86><86>64z<12>* 00.622: p:<08><0e><80><84> 00.634: P<04>!x$<80><8a>HD 00.641: D*<16>>|<1a><10>dl<86>`<06><16><05><9e>e<08>6%<02>D|*<00> 00.659: <16>2<90><82>\<8c>iF<93><1e><05>K<16>4(]<04> 00.674: HL<1e>d<8a>%<85>$GP<86>>q<82><8c><0e>8|<80>"<86>"n<08> 00.685: <99><86><07>" 00.686: <89><19>yo<90><8e>tYd<16>-<07><01>,M<9c><89><9c>M-9<12>D<94><8a>A<<04><89>F>[%.<89> 00.725: Tf-^p<8e>p<85><91><94><04> 00.725: J<1e><90>a<95>)#<84><07>6<04>o<16><1b>Y$<07><80><1f>m<03><06><83><12>V=5.<80><98><17>D<11><01><86><0b>`<0
Re: [PATCH] tcmu: Oops in unmap_thread_fn()
On 08/01/2017 03:09 PM, Dan Carpenter wrote: > Calling list_del() on the iterator pointer in list_for_each_entry() will > cause an oops. We need to user the _safe() version for that. > > Fixes: c73d02f63c16 ("tcmu: Add fifo type waiter list support to avoid > starvation") > Signed-off-by: Dan Carpenter > > diff --git a/drivers/target/target_core_user.c > b/drivers/target/target_core_user.c > index 9258b7dd2c30..fd9fcea68d23 100644 > --- a/drivers/target/target_core_user.c > +++ b/drivers/target/target_core_user.c > @@ -1985,7 +1985,7 @@ static struct target_backend_ops tcmu_ops = { > > static int unmap_thread_fn(void *data) > { > - struct tcmu_dev *udev; > + struct tcmu_dev *udev, *tmp; > loff_t off; > uint32_t start, end, block; > static uint32_t free_blocks; > @@ -2056,7 +2056,7 @@ static int unmap_thread_fn(void *data) >* for the global data pool blocks. >*/ > mutex_lock(&root_udev_waiter_mutex); > - list_for_each_entry(udev, &root_udev_waiter, waiter) { > + list_for_each_entry_safe(udev, tmp, &root_udev_waiter, waiter) { > mutex_lock(&udev->cmdr_lock); > if (udev->waiting_blocks < free_blocks) { > mutex_unlock(&udev->cmdr_lock); > Thanks. Reviewed-by: Mike Christie
Re: [PATCH 04/14] blk-mq-sched: improve dispatching from sw queue
On Thu, 2017-08-03 at 11:13 +0800, Ming Lei wrote: > On Thu, Aug 03, 2017 at 01:35:29AM +, Bart Van Assche wrote: > > On Wed, 2017-08-02 at 11:31 +0800, Ming Lei wrote: > > > On Tue, Aug 01, 2017 at 03:11:42PM +, Bart Van Assche wrote: > > > > On Tue, 2017-08-01 at 18:50 +0800, Ming Lei wrote: > > > > > On Tue, Aug 01, 2017 at 06:17:18PM +0800, Ming Lei wrote: > > > > > > How can we get the accurate 'number of requests in progress' > > > > > > efficiently? > > > > > > > > Hello Ming, > > > > > > > > How about counting the number of bits that have been set in the tag set? > > > > I am aware that these bits can be set and/or cleared concurrently with > > > > the > > > > dispatch code but that count is probably a good starting point. > > > > > > It has to be atomic_t, which is too too heavy for us, please see the > > > report: > > > > > > http://marc.info/?t=14986844843&r=1&w=2 > > > > > > Both Jens and I want to kill hd_struct.in_flight, but looks still no > > > good way. > > > > Hello Ming, > > > > Sorry but I disagree that a new atomic variable should be added to keep > > track > > of the number of busy requests. Counting the number of bits that are set in > > the tag set should be good enough in this context. > > That won't work because the tag set is host wide and shared by all LUNs. Hello Ming, Are you aware that the SCSI core already keeps track of the number of busy requests per LUN? See also the device_busy member of struct scsi_device. How about giving the block layer core access in some way to that counter? Bart.
Re: [PATCH 01/21] lpfc: Fix opps when ExpressLane is enabled
James Smart writes: > From: Dick Kennedy > > Null pointer dereference in lpfc_sli4_fof_intr_handler > > The driver does not set up cq->assoc_qp for sli4_hba->oas_cq > > Initialize cq->assoc_qp before accessing it > > Signed-off-by: Dick Kennedy > Signed-off-by: James Smart > --- > drivers/scsi/lpfc/lpfc_sli.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c > index e948ea05fd33..0615bf9def23 100644 > --- a/drivers/scsi/lpfc/lpfc_sli.c > +++ b/drivers/scsi/lpfc/lpfc_sli.c > @@ -13557,6 +13557,9 @@ lpfc_sli4_fof_handle_eqe(struct lpfc_hba *phba, > struct lpfc_eqe *eqe) > /* Save EQ associated with this CQ */ > cq->assoc_qp = phba->sli4_hba.fof_eq; > > + /* Save EQ associated with this CQ */ > + cq->assoc_qp = phba->sli4_hba.fof_eq; > + Copy & paste error? Above lines are similar. -- Nikola
Re: [PATCH v2 09/13] mpt3sas: scan and add nvme device after controller reset
On Thu, Aug 3, 2017 at 12:10 PM, Hannes Reinecke wrote: > On 07/14/2017 03:22 PM, Suganath Prabu S wrote: >> After Controller reset, Scan and add nvme device back to the topology. >> >> Signed-off-by: Chaitra P B >> Signed-off-by: Suganath Prabu S >> --- >> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 194 >> +- >> 1 files changed, 190 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> index c5a131f..e3e803c 100644 >> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> @@ -4869,6 +4869,7 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, >> struct scsi_cmnd *scmd, >> char *desc_scsi_state = ioc->tmp_string; >> u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo); >> struct _sas_device *sas_device = NULL; >> + struct _pcie_device *pcie_device = NULL; >> struct scsi_target *starget = scmd->device->sdev_target; >> struct MPT3SAS_TARGET *priv_target = starget->hostdata; >> char *device_str = NULL; >> @@ -5001,6 +5002,28 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, >> struct scsi_cmnd *scmd, >> if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) { >> pr_warn(MPT3SAS_FMT "\t%s wwid(0x%016llx)\n", ioc->name, >> device_str, (unsigned long long)priv_target->sas_address); >> + } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) { >> + pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target); >> + if (pcie_device) { >> + pr_info(MPT3SAS_FMT "\twwid(0x%016llx), port(%d)\n", >> + ioc->name, >> + (unsigned long long)pcie_device->wwid, >> + pcie_device->port_num); >> + if (pcie_device->enclosure_handle != 0) >> + pr_info(MPT3SAS_FMT >> + "\tenclosure logical id(0x%016llx), " >> + "slot(%d)\n", ioc->name, >> + (unsigned long long) >> + pcie_device->enclosure_logical_id, >> + pcie_device->slot); >> + if (pcie_device->connector_name[0]) >> + pr_info(MPT3SAS_FMT >> + "\tenclosure level(0x%04x)," >> + "connector name( %s)\n", >> + ioc->name, pcie_device->enclosure_level, >> + pcie_device->connector_name); >> + pcie_device_put(pcie_device); >> + } >> } else { >> sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target); >> if (sas_device) { >> @@ -5047,11 +5070,10 @@ _scsih_scsi_ioc_info(struct MPT3SAS_ADAPTER *ioc, >> struct scsi_cmnd *scmd, >> struct sense_info data; >> _scsih_normalize_sense(scmd->sense_buffer, &data); >> pr_warn(MPT3SAS_FMT >> - "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], >> count(%d)\n", >> - ioc->name, data.skey, >> - data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount)); >> + "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], >> count(%d)\n", >> + ioc->name, data.skey, >> + data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount)); >> } >> - >> if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) { >> response_info = le32_to_cpu(mpi_reply->ResponseInfo); >> response_bytes = (u8 *)&response_info; >> @@ -8512,6 +8534,130 @@ _scsih_search_responding_sas_devices(struct >> MPT3SAS_ADAPTER *ioc) >> } >> >> /** >> + * _scsih_mark_responding_pcie_device - mark a pcie_device as responding >> + * @ioc: per adapter object >> + * @pcie_device_pg0: PCIe Device page 0 >> + * >> + * After host reset, find out whether devices are still responding. >> + * Used in _scsih_remove_unresponding_devices. >> + * >> + * Return nothing. >> + */ >> +static void >> +_scsih_mark_responding_pcie_device(struct MPT3SAS_ADAPTER *ioc, >> + Mpi26PCIeDevicePage0_t *pcie_device_pg0) >> +{ >> + struct MPT3SAS_TARGET *sas_target_priv_data = NULL; >> + struct scsi_target *starget; >> + struct _pcie_device *pcie_device; >> + unsigned long flags; >> + >> + spin_lock_irqsave(&ioc->pcie_device_lock, flags); >> + list_for_each_entry(pcie_device, &ioc->pcie_device_list, list) { >> + if ((pcie_device->wwid == pcie_device_pg0->WWID) && >> + (pcie_device->slot == pcie_device_pg0->Slot)) { >> + pcie_device->responding = 1; >> + starget = pcie_device->starget; >> + if (starget && starget->hostdata) { >> + sas_target
Re: [PATCH v2 02/13] mpt3sas: Add nvme device support in slave alloc, target alloc and probe
On Thu, Aug 3, 2017 at 11:57 AM, Hannes Reinecke wrote: > On 07/14/2017 03:22 PM, Suganath Prabu S wrote: >> 1) Added support for probing pcie device and adding NVMe drives to >> SML and driver's internal list pcie_device_list. >> >> 2) Added support for determing NVMe as boot device. >> >> 3) Added nvme device support for call back functions scan_finished >> target_alloc,slave_alloc,target destroy and slave destroy. >> >> a) During scan, pcie devices are probed and added to SML to drivers >> internal list. >> >> b) target_alloc & slave alloc API's allocates resources for >> (MPT3SAS_TARGET & MPT3SAS_DEVICE) private datas and holds >> information like handle, target_id etc. >> >> c) slave_destroy & target_destroy are called when driver unregisters >> or removes device. Also frees allocated resources and info. >> >> Signed-off-by: Chaitra P B >> Signed-off-by: Suganath Prabu S >> --- >> drivers/scsi/mpt3sas/mpt3sas_base.h | 110 - >> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 431 >> +++--- >> 2 files changed, 507 insertions(+), 34 deletions(-) >> > Have you considered using 'scan_start()/scan_finished()' SCSI midlayer > callbacks here? > Seeing that you are enumerating the devices internally already that > should give you better control about the scanning process. Yes mpt3sas driver has defined scan_start() & scan_finished() callbacks function. In the scan_start() callback function driver will issue Port Enable request to the HBA Firmware to enable the HBA ports, so the driver can start receiving drives (SAS/SATA/NVMe) discovery events from firmware and add the discovered drives to the respective drive type list. (e.g. SAS & SATA drives are added sas_device_list and NVMe drives are added to pcie_device_list) . Once the driver receives the Port Enable completion reply message from firmware then in the scan_finished() callback function driver will register the SAS & SATA devices added in the sas_device_list to SCSI Transport Layer by using sas_rphy_add() API and NVMe devices added in the pcie_device_list are directly added to SML by using scsi_add_device() API with channel number set to two. Thanks, Sreekanth > > Cheers, > > Hannes > -- > Dr. Hannes ReineckeTeamlead Storage & Networking > h...@suse.de +49 911 74053 688 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton > HRB 21284 (AG Nürnberg)
Re: [PATCH v2 08/13] mpt3sas: Set NVMe device queue depth as 128
On Thu, Aug 3, 2017 at 12:09 PM, Hannes Reinecke wrote: > On 07/14/2017 03:22 PM, Suganath Prabu S wrote: >> Sets nvme device queue depth, name and displays device capabilities >> >> Signed-off-by: Chaitra P B >> Signed-off-by: Suganath Prabu S >> --- >> drivers/scsi/mpt3sas/mpt3sas_base.h |2 +- >> drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40 >> ++ >> 2 files changed, 41 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h >> b/drivers/scsi/mpt3sas/mpt3sas_base.h >> index 0a8187e..b7855c8 100644 >> --- a/drivers/scsi/mpt3sas/mpt3sas_base.h >> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h >> @@ -115,7 +115,7 @@ >> >> #define MPT3SAS_RAID_MAX_SECTORS 8192 >> #define MPT3SAS_HOST_PAGE_SIZE_4K12 >> - >> +#define MPT3SAS_NVME_QUEUE_DEPTH 128 >> #define MPT_NAME_LENGTH 32 /* generic length of >> strings */ >> #define MPT_STRING_LENGTH64 >> >> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> b/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> index 1dd9674..c5a131f 100644 >> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c >> @@ -2290,6 +2290,7 @@ scsih_slave_configure(struct scsi_device *sdev) >> struct MPT3SAS_DEVICE *sas_device_priv_data; >> struct MPT3SAS_TARGET *sas_target_priv_data; >> struct _sas_device *sas_device; >> + struct _pcie_device *pcie_device; >> struct _raid_device *raid_device; >> unsigned long flags; >> int qdepth; >> @@ -2420,6 +2421,45 @@ scsih_slave_configure(struct scsi_device *sdev) >> } >> } >> >> + /* PCIe handling */ >> + if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) { >> + spin_lock_irqsave(&ioc->pcie_device_lock, flags); >> + pcie_device = __mpt3sas_get_pdev_by_wwid(ioc, >> + sas_device_priv_data->sas_target->sas_address); >> + if (!pcie_device) { >> + spin_unlock_irqrestore(&ioc->pcie_device_lock, flags); >> + dfailprintk(ioc, pr_warn(MPT3SAS_FMT >> + "failure at %s:%d/%s()!\n", ioc->name, >> __FILE__, >> + __LINE__, __func__)); >> + return 1; >> + } >> + >> + /*TODO-right Queue Depth?*/ >> + qdepth = MPT3SAS_NVME_QUEUE_DEPTH; >> + ds = "NVMe"; >> + /*TODO-Add device name when defined*/ >> + sdev_printk(KERN_INFO, sdev, >> + "%s: handle(0x%04x), wwid(0x%016llx), port(%d)\n", >> + ds, handle, (unsigned long long)pcie_device->wwid, >> + pcie_device->port_num); >> + if (pcie_device->enclosure_handle != 0) >> + sdev_printk(KERN_INFO, sdev, >> + "%s: enclosure logical id(0x%016llx), slot(%d)\n", >> + ds, >> + (unsigned long long)pcie_device->enclosure_logical_id, >> + pcie_device->slot); >> + if (pcie_device->connector_name[0] != '\0') >> + sdev_printk(KERN_INFO, sdev, >> + "%s: enclosure level(0x%04x)," >> + "connector name( %s)\n", ds, >> + pcie_device->enclosure_level, >> + pcie_device->connector_name); >> + pcie_device_put(pcie_device); >> + spin_unlock_irqrestore(&ioc->pcie_device_lock, flags); >> + scsih_change_queue_depth(sdev, qdepth); >> + return 0; >> + } >> + >> spin_lock_irqsave(&ioc->sas_device_lock, flags); >> sas_device = __mpt3sas_get_sdev_by_addr(ioc, >> sas_device_priv_data->sas_target->sas_address); >> > Well; what are these TODOs doing here? > If you know things are not correct, why not doing them correctly? > If you cannot do them correctly, why? Hannes, These TODOs comments are added during initial development phase. We will remove these TODO comments. Thanks, Sreekanth > > Cheers, > > Hannes > -- > Dr. Hannes ReineckeTeamlead Storage & Networking > h...@suse.de +49 911 74053 688 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton > HRB 21284 (AG Nürnberg)
Re: [PATCH v2 01/13] mpt3sas: Update MPI Header
On Thu, Aug 3, 2017 at 1:25 PM, Johannes Thumshirn wrote: > On Thu, Aug 03, 2017 at 08:24:59AM +0200, Hannes Reinecke wrote: >> > + U32 >> > + IOCLogInfo; /*0x10 */ >> > + U16 >> > + ErrorResponseCount; /*0x14 */ >> > + U16 >> > + Reserved4; /*0x16 */ >> > +} MPI26_NVME_ENCAPSULATED_ERROR_REPLY, >> > + *PTR_MPI26_NVME_ENCAPSULATED_ERROR_REPLY, >> > + Mpi26NVMeEncapsulatedErrorReply_t, >> > + *pMpi26NVMeEncapsulatedErrorReply_t; >> > + >> > + >> > +#endif >> > + >> > + >> Very odd indentation. >> Please reformat to have type and variable on one line. > > And use Linux types and no CamelCase and no typedefs (especially not for > pointers), you're not on Windows here. We will reformat to have type and variable on one line as suggested by Hannes. But it will be going have a huge change in the driver, if we want to remove the CamelCase and typedefs. From legacy days onwards mpi headers has the CamelCase type variable names and the same variables are used in the code in large number of places. Also our MPI headers are common across the OS platforms and so maintaining mpi headers updates will be more difficult. Thanks, Sreekanth > > Thanks, > Johannes > > -- > Johannes Thumshirn Storage > jthumsh...@suse.de+49 911 74053 689 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: Felix Imendörffer, Jane Smithard, Graham Norton > HRB 21284 (AG Nürnberg) > Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH v2 01/13] mpt3sas: Update MPI Header
On Thu, Aug 03, 2017 at 08:24:59AM +0200, Hannes Reinecke wrote: > > + U32 > > + IOCLogInfo; /*0x10 */ > > + U16 > > + ErrorResponseCount; /*0x14 */ > > + U16 > > + Reserved4; /*0x16 */ > > +} MPI26_NVME_ENCAPSULATED_ERROR_REPLY, > > + *PTR_MPI26_NVME_ENCAPSULATED_ERROR_REPLY, > > + Mpi26NVMeEncapsulatedErrorReply_t, > > + *pMpi26NVMeEncapsulatedErrorReply_t; > > + > > + > > +#endif > > + > > + > Very odd indentation. > Please reformat to have type and variable on one line. And use Linux types and no CamelCase and no typedefs (especially not for pointers), you're not on Windows here. Thanks, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850