Skip to content

Commit 2cf4f94

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Two medium sized fixes, both in drivers. The UFS one adds parsing of clock info structures, which is required by some host drivers and the aacraid one reverts the IRQ affinity mapping patch which has been causing regressions noted in kernel bugzilla 217599" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: core: Store min and max clk freq from OPP table Revert "scsi: aacraid: Reply queue mapping to CPUs based on IRQ affinity"
2 parents 26d6084 + 77a6725 commit 2cf4f94

File tree

5 files changed

+57
-43
lines changed

5 files changed

+57
-43
lines changed

drivers/scsi/aacraid/aacraid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,7 +1678,6 @@ struct aac_dev
16781678
u32 handle_pci_error;
16791679
bool init_reset;
16801680
u8 soft_reset_support;
1681-
u8 use_map_queue;
16821681
};
16831682

16841683
#define aac_adapter_interrupt(dev) \

drivers/scsi/aacraid/commsup.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,8 @@ int aac_fib_setup(struct aac_dev * dev)
223223
struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
224224
{
225225
struct fib *fibptr;
226-
u32 blk_tag;
227-
int i;
228226

229-
blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
230-
i = blk_mq_unique_tag_to_tag(blk_tag);
231-
fibptr = &dev->fibs[i];
227+
fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
232228
/*
233229
* Null out fields that depend on being zero at the start of
234230
* each I/O

drivers/scsi/aacraid/linit.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include <linux/compat.h>
2121
#include <linux/blkdev.h>
22-
#include <linux/blk-mq-pci.h>
2322
#include <linux/completion.h>
2423
#include <linux/init.h>
2524
#include <linux/interrupt.h>
@@ -505,15 +504,6 @@ static int aac_slave_configure(struct scsi_device *sdev)
505504
return 0;
506505
}
507506

508-
static void aac_map_queues(struct Scsi_Host *shost)
509-
{
510-
struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
511-
512-
blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
513-
aac->pdev, 0);
514-
aac->use_map_queue = true;
515-
}
516-
517507
/**
518508
* aac_change_queue_depth - alter queue depths
519509
* @sdev: SCSI device we are considering
@@ -1498,7 +1488,6 @@ static const struct scsi_host_template aac_driver_template = {
14981488
.bios_param = aac_biosparm,
14991489
.shost_groups = aac_host_groups,
15001490
.slave_configure = aac_slave_configure,
1501-
.map_queues = aac_map_queues,
15021491
.change_queue_depth = aac_change_queue_depth,
15031492
.sdev_groups = aac_dev_groups,
15041493
.eh_abort_handler = aac_eh_abort,
@@ -1786,8 +1775,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
17861775
shost->max_lun = AAC_MAX_LUN;
17871776

17881777
pci_set_drvdata(pdev, shost);
1789-
shost->nr_hw_queues = aac->max_msix;
1790-
shost->host_tagset = 1;
17911778

17921779
error = scsi_add_host(shost, &pdev->dev);
17931780
if (error)
@@ -1919,7 +1906,6 @@ static void aac_remove_one(struct pci_dev *pdev)
19191906
struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
19201907

19211908
aac_cancel_rescan_worker(aac);
1922-
aac->use_map_queue = false;
19231909
scsi_remove_host(shost);
19241910

19251911
__aac_shutdown(aac);

drivers/scsi/aacraid/src.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,6 @@ static int aac_src_deliver_message(struct fib *fib)
493493
#endif
494494

495495
u16 vector_no;
496-
struct scsi_cmnd *scmd;
497-
u32 blk_tag;
498-
struct Scsi_Host *shost = dev->scsi_host_ptr;
499-
struct blk_mq_queue_map *qmap;
500496

501497
atomic_inc(&q->numpending);
502498

@@ -509,25 +505,8 @@ static int aac_src_deliver_message(struct fib *fib)
509505
if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE3)
510506
&& dev->sa_firmware)
511507
vector_no = aac_get_vector(dev);
512-
else {
513-
if (!fib->vector_no || !fib->callback_data) {
514-
if (shost && dev->use_map_queue) {
515-
qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
516-
vector_no = qmap->mq_map[raw_smp_processor_id()];
517-
}
518-
/*
519-
* We hardcode the vector_no for
520-
* reserved commands as a valid shost is
521-
* absent during the init
522-
*/
523-
else
524-
vector_no = 0;
525-
} else {
526-
scmd = (struct scsi_cmnd *)fib->callback_data;
527-
blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
528-
vector_no = blk_mq_unique_tag_to_hwq(blk_tag);
529-
}
530-
}
508+
else
509+
vector_no = fib->vector_no;
531510

532511
if (native_hba) {
533512
if (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA_TMF) {

drivers/ufs/host/ufshcd-pltfrm.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Vinayak Holikatti <[email protected]>
99
*/
1010

11+
#include <linux/clk.h>
1112
#include <linux/module.h>
1213
#include <linux/platform_device.h>
1314
#include <linux/pm_opp.h>
@@ -213,6 +214,55 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
213214
}
214215
}
215216

217+
/**
218+
* ufshcd_parse_clock_min_max_freq - Parse MIN and MAX clocks freq
219+
* @hba: per adapter instance
220+
*
221+
* This function parses MIN and MAX frequencies of all clocks required
222+
* by the host drivers.
223+
*
224+
* Returns 0 for success and non-zero for failure
225+
*/
226+
static int ufshcd_parse_clock_min_max_freq(struct ufs_hba *hba)
227+
{
228+
struct list_head *head = &hba->clk_list_head;
229+
struct ufs_clk_info *clki;
230+
struct dev_pm_opp *opp;
231+
unsigned long freq;
232+
u8 idx = 0;
233+
234+
list_for_each_entry(clki, head, list) {
235+
if (!clki->name)
236+
continue;
237+
238+
clki->clk = devm_clk_get(hba->dev, clki->name);
239+
if (IS_ERR(clki->clk))
240+
continue;
241+
242+
/* Find Max Freq */
243+
freq = ULONG_MAX;
244+
opp = dev_pm_opp_find_freq_floor_indexed(hba->dev, &freq, idx);
245+
if (IS_ERR(opp)) {
246+
dev_err(hba->dev, "Failed to find OPP for MAX frequency\n");
247+
return PTR_ERR(opp);
248+
}
249+
clki->max_freq = dev_pm_opp_get_freq_indexed(opp, idx);
250+
dev_pm_opp_put(opp);
251+
252+
/* Find Min Freq */
253+
freq = 0;
254+
opp = dev_pm_opp_find_freq_ceil_indexed(hba->dev, &freq, idx);
255+
if (IS_ERR(opp)) {
256+
dev_err(hba->dev, "Failed to find OPP for MIN frequency\n");
257+
return PTR_ERR(opp);
258+
}
259+
clki->min_freq = dev_pm_opp_get_freq_indexed(opp, idx++);
260+
dev_pm_opp_put(opp);
261+
}
262+
263+
return 0;
264+
}
265+
216266
static int ufshcd_parse_operating_points(struct ufs_hba *hba)
217267
{
218268
struct device *dev = hba->dev;
@@ -279,6 +329,10 @@ static int ufshcd_parse_operating_points(struct ufs_hba *hba)
279329
return ret;
280330
}
281331

332+
ret = ufshcd_parse_clock_min_max_freq(hba);
333+
if (ret)
334+
return ret;
335+
282336
hba->use_pm_opp = true;
283337

284338
return 0;

0 commit comments

Comments
 (0)