Skip to content

Commit

Permalink
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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"
  • Loading branch information
Linus Torvalds committed Dec 18, 2023
2 parents 26d6084 + 77a6725 commit 2cf4f94
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 43 deletions.
1 change: 0 additions & 1 deletion drivers/scsi/aacraid/aacraid.h
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,6 @@ struct aac_dev
u32 handle_pci_error;
bool init_reset;
u8 soft_reset_support;
u8 use_map_queue;
};

#define aac_adapter_interrupt(dev) \
Expand Down
6 changes: 1 addition & 5 deletions drivers/scsi/aacraid/commsup.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,8 @@ int aac_fib_setup(struct aac_dev * dev)
struct fib *aac_fib_alloc_tag(struct aac_dev *dev, struct scsi_cmnd *scmd)
{
struct fib *fibptr;
u32 blk_tag;
int i;

blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
i = blk_mq_unique_tag_to_tag(blk_tag);
fibptr = &dev->fibs[i];
fibptr = &dev->fibs[scsi_cmd_to_rq(scmd)->tag];
/*
* Null out fields that depend on being zero at the start of
* each I/O
Expand Down
14 changes: 0 additions & 14 deletions drivers/scsi/aacraid/linit.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <linux/compat.h>
#include <linux/blkdev.h>
#include <linux/blk-mq-pci.h>
#include <linux/completion.h>
#include <linux/init.h>
#include <linux/interrupt.h>
Expand Down Expand Up @@ -505,15 +504,6 @@ static int aac_slave_configure(struct scsi_device *sdev)
return 0;
}

static void aac_map_queues(struct Scsi_Host *shost)
{
struct aac_dev *aac = (struct aac_dev *)shost->hostdata;

blk_mq_pci_map_queues(&shost->tag_set.map[HCTX_TYPE_DEFAULT],
aac->pdev, 0);
aac->use_map_queue = true;
}

/**
* aac_change_queue_depth - alter queue depths
* @sdev: SCSI device we are considering
Expand Down Expand Up @@ -1498,7 +1488,6 @@ static const struct scsi_host_template aac_driver_template = {
.bios_param = aac_biosparm,
.shost_groups = aac_host_groups,
.slave_configure = aac_slave_configure,
.map_queues = aac_map_queues,
.change_queue_depth = aac_change_queue_depth,
.sdev_groups = aac_dev_groups,
.eh_abort_handler = aac_eh_abort,
Expand Down Expand Up @@ -1786,8 +1775,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
shost->max_lun = AAC_MAX_LUN;

pci_set_drvdata(pdev, shost);
shost->nr_hw_queues = aac->max_msix;
shost->host_tagset = 1;

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

aac_cancel_rescan_worker(aac);
aac->use_map_queue = false;
scsi_remove_host(shost);

__aac_shutdown(aac);
Expand Down
25 changes: 2 additions & 23 deletions drivers/scsi/aacraid/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,6 @@ static int aac_src_deliver_message(struct fib *fib)
#endif

u16 vector_no;
struct scsi_cmnd *scmd;
u32 blk_tag;
struct Scsi_Host *shost = dev->scsi_host_ptr;
struct blk_mq_queue_map *qmap;

atomic_inc(&q->numpending);

Expand All @@ -509,25 +505,8 @@ static int aac_src_deliver_message(struct fib *fib)
if ((dev->comm_interface == AAC_COMM_MESSAGE_TYPE3)
&& dev->sa_firmware)
vector_no = aac_get_vector(dev);
else {
if (!fib->vector_no || !fib->callback_data) {
if (shost && dev->use_map_queue) {
qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT];
vector_no = qmap->mq_map[raw_smp_processor_id()];
}
/*
* We hardcode the vector_no for
* reserved commands as a valid shost is
* absent during the init
*/
else
vector_no = 0;
} else {
scmd = (struct scsi_cmnd *)fib->callback_data;
blk_tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmd));
vector_no = blk_mq_unique_tag_to_hwq(blk_tag);
}
}
else
vector_no = fib->vector_no;

if (native_hba) {
if (fib->flags & FIB_CONTEXT_FLAG_NATIVE_HBA_TMF) {
Expand Down
54 changes: 54 additions & 0 deletions drivers/ufs/host/ufshcd-pltfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Vinayak Holikatti <h.vinayak@samsung.com>
*/

#include <linux/clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
Expand Down Expand Up @@ -213,6 +214,55 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
}
}

/**
* ufshcd_parse_clock_min_max_freq - Parse MIN and MAX clocks freq
* @hba: per adapter instance
*
* This function parses MIN and MAX frequencies of all clocks required
* by the host drivers.
*
* Returns 0 for success and non-zero for failure
*/
static int ufshcd_parse_clock_min_max_freq(struct ufs_hba *hba)
{
struct list_head *head = &hba->clk_list_head;
struct ufs_clk_info *clki;
struct dev_pm_opp *opp;
unsigned long freq;
u8 idx = 0;

list_for_each_entry(clki, head, list) {
if (!clki->name)
continue;

clki->clk = devm_clk_get(hba->dev, clki->name);
if (IS_ERR(clki->clk))
continue;

/* Find Max Freq */
freq = ULONG_MAX;
opp = dev_pm_opp_find_freq_floor_indexed(hba->dev, &freq, idx);
if (IS_ERR(opp)) {
dev_err(hba->dev, "Failed to find OPP for MAX frequency\n");
return PTR_ERR(opp);
}
clki->max_freq = dev_pm_opp_get_freq_indexed(opp, idx);
dev_pm_opp_put(opp);

/* Find Min Freq */
freq = 0;
opp = dev_pm_opp_find_freq_ceil_indexed(hba->dev, &freq, idx);
if (IS_ERR(opp)) {
dev_err(hba->dev, "Failed to find OPP for MIN frequency\n");
return PTR_ERR(opp);
}
clki->min_freq = dev_pm_opp_get_freq_indexed(opp, idx++);
dev_pm_opp_put(opp);
}

return 0;
}

static int ufshcd_parse_operating_points(struct ufs_hba *hba)
{
struct device *dev = hba->dev;
Expand Down Expand Up @@ -279,6 +329,10 @@ static int ufshcd_parse_operating_points(struct ufs_hba *hba)
return ret;
}

ret = ufshcd_parse_clock_min_max_freq(hba);
if (ret)
return ret;

hba->use_pm_opp = true;

return 0;
Expand Down

0 comments on commit 2cf4f94

Please sign in to comment.