driver: update megaraid_sas to 07.721.02.00

Signed-off-by: mayercheng <mayercheng@tencent.com>
This commit is contained in:
mayercheng 2022-11-02 19:10:15 +08:00
parent 817baf6410
commit 619b3eaa48
6 changed files with 1944 additions and 754 deletions

View File

@ -1,10 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Linux MegaRAID driver for SAS based RAID controllers
*
* Copyright (c) 2003-2013 LSI Corporation
* Copyright (c) 2013-2016 Avago Technologies
* Copyright (c) 2016-2018 Broadcom Inc.
* Copyright (c) 2003-2018 LSI Corporation.
* Copyright (c) 2003-2018 Avago Technologies.
* Copyright (c) 2003-2018 Broadcom Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* FILE: megaraid_sas.h
*
@ -18,11 +30,37 @@
#ifndef LSI_MEGARAID_SAS_H
#define LSI_MEGARAID_SAS_H
#if ((defined(RHEL_MAJOR) && (RHEL_MAJOR == 7) && (RHEL_MINOR >= 3)) || \
(defined(CONFIG_SUSE_KERNEL) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21))) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0)))
#include <linux/irq_poll.h>
#define ENABLE_IRQ_POLL
#endif
#if ((defined(RHEL_MAJOR) && (RHEL_MAJOR == 8) && (RHEL_MINOR >= 2)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)))
#define USE_MANAGED_IRQ_API
#endif
#if ((defined(RHEL_MAJOR) && (RHEL_MAJOR == 8) && (RHEL_MINOR >= 4)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)))
#include <linux/blk-mq-pci.h>
#define HOST_TAGSET_SUPPORT
#endif
#if defined(HOST_TAGSET_SUPPORT) && !defined(USE_MANAGED_IRQ_API)
#error "Please use Managed IRQs APIs for shared host tagset to work"
#endif
/*
* MegaRAID SAS Driver meta data
*/
#define MEGASAS_VERSION "07.710.50.00-rc1"
#define MEGASAS_RELDATE "June 28, 2019"
#define MEGASAS_VERSION "07.721.02.00"
#define MEGASAS_RELDATE "Jan 07, 2022"
#define MEGASAS_EXT_VERSION "Jan 07, 17:00:00 PDT 2022"
#define MEGASAS_MSIX_NAME_LEN 32
/*
* Device IDs
@ -48,14 +86,14 @@
#define PCI_DEVICE_ID_LSI_TOMCAT 0x0017
#define PCI_DEVICE_ID_LSI_VENTURA_4PORT 0x001B
#define PCI_DEVICE_ID_LSI_CRUSADER_4PORT 0x001C
#define PCI_DEVICE_ID_LSI_AERO_10E1 0x10e1
#define PCI_DEVICE_ID_LSI_AERO_10E2 0x10e2
#define PCI_DEVICE_ID_LSI_AERO_10E5 0x10e5
#define PCI_DEVICE_ID_LSI_AERO_10E6 0x10e6
#define PCI_DEVICE_ID_LSI_AERO_10E0 0x10e0
#define PCI_DEVICE_ID_LSI_AERO_10E3 0x10e3
#define PCI_DEVICE_ID_LSI_AERO_10E4 0x10e4
#define PCI_DEVICE_ID_LSI_AERO_10E7 0x10e7
#define PCI_DEVICE_ID_LSI_AERO_10E1 0x10e1
#define PCI_DEVICE_ID_LSI_AERO_10E2 0x10e2
#define PCI_DEVICE_ID_LSI_AERO_10E5 0x10e5
#define PCI_DEVICE_ID_LSI_AERO_10E6 0x10e6
#define PCI_DEVICE_ID_LSI_AERO_10E0 0x10e0
#define PCI_DEVICE_ID_LSI_AERO_10E3 0x10e3
#define PCI_DEVICE_ID_LSI_AERO_10E4 0x10e4
#define PCI_DEVICE_ID_LSI_AERO_10E7 0x10e7
/*
* Intel HBA SSDIDs
@ -177,6 +215,10 @@
#define DRV_DCMD_POLLED_MODE 0x1
#define DRV_DCMD_SKIP_REFIRE 0x2
#define MR_HIGH_IOPS_QUEUE_COUNT 8
#define MR_DEVICE_HIGH_IOPS_DEPTH 8
#define MR_HIGH_IOPS_BATCH_COUNT 16
/*
* Definition for cmd_status
*/
@ -193,8 +235,8 @@ enum MFI_CMD_OP {
MFI_CMD_PD_SCSI_IO = 0x4,
MFI_CMD_DCMD = 0x5,
MFI_CMD_ABORT = 0x6,
MFI_CMD_SMP = 0x7,
MFI_CMD_STP = 0x8,
MFI_CMD_SMP = 0x7,
MFI_CMD_STP = 0x8,
MFI_CMD_NVME = 0x9,
MFI_CMD_TOOLBOX = 0xa,
MFI_CMD_OP_COUNT,
@ -509,7 +551,7 @@ union MR_PROGRESS {
*/
struct MR_PD_PROGRESS {
struct {
#ifndef MFI_BIG_ENDIAN
#ifndef __BIG_ENDIAN_BITFIELD
u32 rbld:1;
u32 patrol:1;
u32 clear:1;
@ -535,7 +577,7 @@ struct MR_PD_PROGRESS {
};
struct {
#ifndef MFI_BIG_ENDIAN
#ifndef __BIG_ENDIAN_BITFIELD
u32 rbld:1;
u32 patrol:1;
u32 clear:1;
@ -1453,12 +1495,11 @@ struct megasas_ctrl_info {
u32 size;
u32 pad1;
u8 reserved6[64];
struct {
#if defined(__BIG_ENDIAN_BITFIELD)
u32 reserved:19;
u32 reserved:19;
u32 support_pci_lane_margining: 1;
u32 support_psoc_update:1;
u32 support_force_personality_change:1;
@ -1492,7 +1533,7 @@ struct megasas_ctrl_info {
u8 reserved7[3];
u8 TaskAbortTO; /* Timeout value in seconds used by Abort Task TM */
u8 TaskAbortTO; /* Timeout value in seconds used by Abort Task TM Request. */
u8 MaxResetTO; /* Max Supported Reset timeout in seconds. */
u8 reserved8[3];
} __packed;
@ -1515,6 +1556,7 @@ struct megasas_ctrl_info {
#define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
MEGASAS_MAX_DEV_PER_CHANNEL)
#define MEGASAS_MAX_NAME 32
#define MEGASAS_MAX_SECTORS (2*1024)
#define MEGASAS_MAX_SECTORS_IEEE (2*128)
#define MEGASAS_DBG_LVL 1
@ -1679,7 +1721,7 @@ struct megasas_register_set {
u32 reserved_3[3]; /*00A4h*/
u32 outbound_scratch_pad_0; /*00B0h*/
u32 outbound_scratch_pad_0; /*00B0h*/
u32 outbound_scratch_pad_1; /*00B4h*/
u32 outbound_scratch_pad_2; /*00B8h*/
u32 outbound_scratch_pad_3; /*00BCh*/
@ -1814,10 +1856,11 @@ struct megasas_init_frame {
__le32 queue_info_new_phys_addr_hi; /*1Ch */
__le32 queue_info_old_phys_addr_lo; /*20h */
__le32 queue_info_old_phys_addr_hi; /*24h */
__le32 reserved_4[2]; /*28h */
__le32 driver_ver_lo; /*28h */
__le32 driver_ver_hi; /*2Ch */
__le32 system_info_lo; /*30h */
__le32 system_info_hi; /*34h */
__le32 reserved_5[2]; /*38h */
__le32 reserved_3[2]; /*38h */
} __attribute__ ((packed));
@ -2020,11 +2063,16 @@ union megasas_frame {
*/
struct MR_PRIV_DEVICE {
bool is_tm_capable;
bool is_epd;
bool tm_busy;
bool device_removed_by_fw;
atomic_t r1_ldio_hint;
u8 interface_type;
u8 task_abort_tmo;
u8 target_reset_tmo;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
atomic_t sdev_priv_busy;
#endif
};
struct megasas_cmd;
@ -2203,12 +2251,16 @@ struct megasas_aen_event {
};
struct megasas_irq_context {
char name[MEGASAS_MSIX_NAME_LEN];
struct megasas_instance *instance;
u32 MSIxIndex;
#if defined(ENABLE_IRQ_POLL)
u32 os_irq;
struct irq_poll irqpoll;
bool irq_poll_scheduled;
bool irq_line_enable;
#endif
atomic_t in_use;
};
struct MR_DRV_SYSTEM_INFO {
@ -2230,39 +2282,33 @@ enum MR_PD_TYPE {
/* JBOD Queue depth definitions */
#define MEGASAS_SATA_QD 32
#define MEGASAS_SAS_QD 64
#define MEGASAS_SAS_QD 256
#define MEGASAS_DEFAULT_PD_QD 64
#define MEGASAS_NVME_QD 32
#define MEGASAS_NVME_QD 64
#define MR_DEFAULT_NVME_PAGE_SIZE 4096
#define MR_DEFAULT_NVME_PAGE_SHIFT 12
#define MR_DEFAULT_NVME_MDTS_KB 128
#define MR_NVME_PAGE_SIZE_MASK 0x000000FF
/*Aero performance parameters*/
#define MR_HIGH_IOPS_QUEUE_COUNT 8
#define MR_DEVICE_HIGH_IOPS_DEPTH 8
#define MR_HIGH_IOPS_BATCH_COUNT 16
enum MR_PERF_MODE {
MR_BALANCED_PERF_MODE = 0,
MR_IOPS_PERF_MODE = 1,
MR_LATENCY_PERF_MODE = 2,
enum MEGASAS_LD_TARGET_ID_STATUS {
LD_TARGET_ID_INITIAL,
LD_TARGET_ID_ACTIVE,
LD_TARGET_ID_DELETED,
};
#define MEGASAS_PERF_MODE_2STR(mode) \
((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \
(mode) == MR_IOPS_PERF_MODE ? "IOPS" : \
(mode) == MR_LATENCY_PERF_MODE ? "Latency" : \
"Unknown")
#define MEGASAS_TARGET_ID(sdev) \
(((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
sdev->id)
struct megasas_instance {
unsigned int *reply_map;
__le32 *producer;
dma_addr_t producer_h;
__le32 *consumer;
dma_addr_t consumer_h;
__le32 *verbuf;
dma_addr_t verbuf_h;
struct MR_DRV_SYSTEM_INFO *system_info_buf;
dma_addr_t system_info_h;
struct MR_LD_VF_AFFILIATION *vf_affiliation;
@ -2320,6 +2366,9 @@ struct megasas_instance {
struct megasas_pd_list pd_list[MEGASAS_MAX_PD];
struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD];
u8 ld_ids[MEGASAS_MAX_LD_IDS];
u8 ld_tgtid_status[MEGASAS_MAX_LD_IDS];
u8 ld_ids_prev[MEGASAS_MAX_LD_IDS];
u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS];
s8 init_id;
u16 max_num_sge;
@ -2398,6 +2447,8 @@ struct megasas_instance {
/* Ptr to hba specific information */
void *ctrl_context;
unsigned int msix_vectors;
u8 *reply_map;
struct msix_entry msixentry[MEGASAS_MAX_MSIX_QUEUES];
struct megasas_irq_context irq_context[MEGASAS_MAX_MSIX_QUEUES];
u64 map_id;
u64 pd_seq_map_id;
@ -2434,8 +2485,8 @@ struct megasas_instance {
u8 max_reset_tmo;
u8 snapdump_wait_time;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_root;
struct dentry *raidmap_dump;
struct dentry *debugfs_root;
struct dentry *raidmap_dump;
#endif
u8 enable_fw_dev_list;
bool atomic_desc_support;
@ -2443,6 +2494,8 @@ struct megasas_instance {
bool support_pci_lane_margining;
u8 low_latency_index_start;
int perf_mode;
bool use_blk_mq;
int iopoll_q_count;
};
struct MR_LD_VF_MAP {
@ -2539,6 +2592,9 @@ struct megasas_instance_template {
#define MEGASAS_IS_LOGICAL(sdev) \
((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1)
#define MEGASAS_IS_LUN_VALID(sdev) \
((sdev->lun == 0) ? 1 : 0)
#define MEGASAS_DEV_INDEX(scp) \
(((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
scp->device->id)
@ -2637,12 +2693,32 @@ enum MEGASAS_OCR_CAUSE {
};
enum DCMD_RETURN_STATUS {
DCMD_SUCCESS = 0,
DCMD_TIMEOUT = 1,
DCMD_FAILED = 2,
DCMD_NOT_FIRED = 3,
DCMD_SUCCESS = 0x00,
DCMD_TIMEOUT = 0x01,
DCMD_FAILED = 0x02,
DCMD_BUSY = 0x03,
DCMD_INIT = 0xff,
};
enum MR_PERF_MODE {
MR_BALANCED_PERF_MODE = 0,
MR_IOPS_PERF_MODE = 1,
MR_LATENCY_PERF_MODE = 2,
};
#define MEGASAS_PERF_MODE_2STR(mode) \
((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \
(mode) == MR_IOPS_PERF_MODE ? "IOPs" : \
(mode) == MR_LATENCY_PERF_MODE ? "Latency": \
"Unknown")
#define MEGASAS_PCIE_SPEED2STR(speed) \
((speed) == MEGASAS_PCIE_SPEED_16_0GT ? "16 GT/s" : \
(speed) == MEGASAS_PCIE_SPEED_8_0GT ? "8 GT/s" : \
(speed) == MEGASAS_PCIE_SPEED_5_0GT ? "5 GT/s" : \
(speed) == MEGASAS_PCIE_SPEED_2_5GT ? "2.5 GT/s" : \
"Unknown speed")
u8
MR_BuildRaidContext(struct megasas_instance *instance,
struct IO_REQUEST_INFO *io_info,
@ -2700,9 +2776,14 @@ void megasas_fusion_stop_watchdog(struct megasas_instance *instance);
void megasas_set_dma_settings(struct megasas_instance *instance,
struct megasas_dcmd_frame *dcmd,
dma_addr_t dma_addr, u32 dma_len);
unsigned int megasas_get_irq(struct megasas_instance *instance, int msix_index);
#if defined(ENABLE_IRQ_POLL)
extern int megasas_irqpoll(struct irq_poll *irqpoll, int budget);
#endif
void megasas_dump_fusion_io(struct scsi_cmnd *scmd);
int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance,
bool do_adp_reset,
int ocr_context);
int megasas_irqpoll(struct irq_poll *irqpoll, int budget);
void megasas_dump_fusion_io(struct scsi_cmnd *scmd);
int megasas_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num);
#endif /*LSI_MEGARAID_SAS_H */

File diff suppressed because it is too large Load Diff

View File

@ -25,28 +25,31 @@
*
* Send feedback to: megaraidlinux.pdl@broadcom.com
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/compat.h>
#include <linux/irq_poll.h>
#include <linux/uio.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include "megaraid_sas_fusion.h"
#include "megaraid_sas.h"
#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
struct dentry *megasas_debugfs_root;
struct dentry *megasas_debugfs_root = NULL;
static ssize_t
megasas_debugfs_read(struct file *filp, char __user *ubuf, size_t cnt,
loff_t *ppos)
loff_t *ppos)
{
struct megasas_debugfs_buffer *debug = filp->private_data;
@ -72,7 +75,7 @@ megasas_debugfs_raidmap_open(struct inode *inode, struct file *file)
debug->buf = (void *)fusion->ld_drv_map[(instance->map_id & 1)];
debug->len = fusion->drv_map_sz;
file->private_data = debug;
return 0;
}
@ -111,7 +114,8 @@ void megasas_init_debugfs(void)
*/
void megasas_exit_debugfs(void)
{
debugfs_remove_recursive(megasas_debugfs_root);
if (megasas_debugfs_root)
debugfs_remove_recursive(megasas_debugfs_root);
}
/*
@ -127,8 +131,7 @@ megasas_setup_debugfs(struct megasas_instance *instance)
fusion = instance->ctrl_context;
if (fusion) {
snprintf(name, sizeof(name),
"scsi_host%d", instance->host->host_no);
snprintf(name, sizeof(name), "scsi_host%d", instance->host->host_no);
if (!instance->debugfs_root) {
instance->debugfs_root =
debugfs_create_dir(name, megasas_debugfs_root);
@ -142,8 +145,8 @@ megasas_setup_debugfs(struct megasas_instance *instance)
snprintf(name, sizeof(name), "raidmap_dump");
instance->raidmap_dump =
debugfs_create_file(name, S_IRUGO,
instance->debugfs_root, instance,
&megasas_debugfs_raidmap_fops);
instance->debugfs_root,
instance, &megasas_debugfs_raidmap_fops);
if (!instance->raidmap_dump) {
dev_err(&instance->pdev->dev,
"Cannot create raidmap debugfs file\n");
@ -160,7 +163,8 @@ megasas_setup_debugfs(struct megasas_instance *instance)
*/
void megasas_destroy_debugfs(struct megasas_instance *instance)
{
debugfs_remove_recursive(instance->debugfs_root);
if (instance->debugfs_root)
debugfs_remove_recursive(instance->debugfs_root);
}
#else
@ -177,3 +181,4 @@ void megasas_destroy_debugfs(struct megasas_instance *instance)
{
}
#endif /*CONFIG_DEBUG_FS*/

View File

@ -1,10 +1,22 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Linux MegaRAID driver for SAS based RAID controllers
*
* Copyright (c) 2009-2013 LSI Corporation
* Copyright (c) 2013-2016 Avago Technologies
* Copyright (c) 2016-2018 Broadcom Inc.
* Copyright (c) 2009-2018 LSI Corporation.
* Copyright (c) 2009-2018 Avago Technologies.
* Copyright (c) 2009-2018 Broadcom Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* FILE: megaraid_sas_fp.c
*
@ -18,6 +30,7 @@
* Send feedback to: megaraidlinux.pdl@broadcom.com
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/pci.h>
@ -33,7 +46,6 @@
#include <linux/compat.h>
#include <linux/blkdev.h>
#include <linux/poll.h>
#include <linux/irq_poll.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
@ -59,7 +71,7 @@ MODULE_PARM_DESC(lb_pending_cmds, "Change raid-1 load balancing outstanding "
#define SPAN_INVALID 0xff
/* Prototypes */
static void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
static u8 mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
PLD_SPAN_INFO ldSpanInfo);
static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
u64 stripRow, u16 stripRef, struct IO_REQUEST_INFO *io_info,
@ -74,6 +86,7 @@ u32 mega_mod64(u64 dividend, u32 divisor)
if (!divisor)
printk(KERN_ERR "megasas : DIVISOR is zero, in div fn\n");
d = dividend;
remainder = do_div(d, divisor);
return remainder;
@ -343,13 +356,17 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
}
if (instance->UnevenSpanSupport)
mr_update_span_set(drv_map, ldSpanInfo);
if (mr_update_span_set(drv_map, ldSpanInfo))
return 0;
if (lbInfo)
mr_update_load_balance_params(drv_map, lbInfo);
num_lds = le16_to_cpu(drv_map->raidMap.ldCount);
memcpy(instance->ld_ids_prev, instance->ld_ids_from_raidmap,
sizeof(instance->ld_ids_from_raidmap));
memset(instance->ld_ids_from_raidmap, 0xff, MEGASAS_MAX_LD_IDS);
/*Convert Raid capability values to CPU arch */
for (i = 0; (num_lds > 0) && (i < MAX_LOGICAL_DRIVES_EXT); i++) {
ld = MR_TargetIdToLdGet(i, drv_map);
@ -360,7 +377,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
raid = MR_LdRaidGet(ld, drv_map);
le32_to_cpus((u32 *)&raid->capability);
instance->ld_ids_from_raidmap[i] = i;
num_lds--;
}
@ -494,7 +511,7 @@ static u64 get_row_from_strip(struct megasas_instance *instance,
for (info = 0; info < MAX_QUAD_DEPTH; info++) {
span_set = &(ldSpanInfo[ld].span_set[info]);
if (span_set->span_row_data_width == 0)
if ((span_set->span_row_data_width == 0) || (span_set->diff == 0))
break;
if (strip > span_set->data_strip_end)
continue;
@ -562,6 +579,8 @@ static u64 get_strip_from_row(struct megasas_instance *instance,
block_span_info.noElements) >= info+1) {
quad = &map->raidMap.ldSpanMap[ld].
spanBlock[span].block_span_info.quad[info];
if (le32_to_cpu(quad->diff) == 0)
return -1;
if (le64_to_cpu(quad->logStart) <= row &&
row <= le64_to_cpu(quad->logEnd) &&
mega_mod64((row - le64_to_cpu(quad->logStart)),
@ -708,6 +727,8 @@ static u8 mr_spanset_get_phy_params(struct megasas_instance *instance, u32 ld,
row = io_info->start_row;
span = io_info->start_span;
if (SPAN_ROW_SIZE(map, ld, span) == 0)
return false;
if (raid->level == 6) {
logArm = get_arm_from_strip(instance, ld, stripRow, map);
@ -901,7 +922,7 @@ u8 MR_GetPhyParams(struct megasas_instance *instance, u32 ld, u64 stripRow,
* This routine calculates the logical arm, data Arm, row number and parity arm
* for R56 CTIO write operation.
*/
static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
static u8 mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
u32 ld, u64 stripNo,
struct IO_REQUEST_INFO *io_info,
struct RAID_CONTEXT_G35 *pRAID_Context,
@ -918,6 +939,8 @@ static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
rowNum = mega_div64_32(stripNo, dataArms);
/* parity disk arm, first arm is 0 */
if (arms == 0)
return 1;
rightmostParityArm = (arms - 1) - mega_mod64(rowNum, arms);
/* logical arm within row */
@ -930,7 +953,7 @@ static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
} else {
span = (u8)MR_GetSpanBlock(ld, rowNum, pdBlock, map);
if (span == SPAN_INVALID)
return;
return 1;
}
if (raid->level == 6) {
@ -939,7 +962,7 @@ static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
if (PParityArm < 0)
PParityArm += arms;
/* rightmostParityArm is P-Parity for RAID 5 and Q-Parity for RAID */
pRAID_Context->flow_specific.r56_arm_map = rightmostParityArm;
pRAID_Context->flow_specific.r56_arm_map |=
@ -957,9 +980,10 @@ static void mr_get_phy_params_r56_rmw(struct megasas_instance *instance,
pRAID_Context->raid_flags = (MR_RAID_FLAGS_IO_SUB_TYPE_R56_DIV_OFFLOAD <<
MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT);
return;
return 0;
}
/*
******************************************************************************
*
@ -1023,10 +1047,11 @@ MR_BuildRaidContext(struct megasas_instance *instance,
}
}
io_info->data_arms = raid->rowDataSize;
stripSize = 1 << raid->stripeShift;
stripe_mask = stripSize-1;
io_info->data_arms = raid->rowDataSize;
/*
* calculate starting row and stripe, and number of strips and rows
@ -1170,9 +1195,10 @@ MR_BuildRaidContext(struct megasas_instance *instance,
/* Aero R5/6 Division Offload for WRITE */
if (fusion->r56_div_offload && (raid->level >= 5) && !isRead) {
mr_get_phy_params_r56_rmw(instance, ld, start_strip, io_info,
(struct RAID_CONTEXT_G35 *)pRAID_Context,
map);
if (mr_get_phy_params_r56_rmw(instance, ld, start_strip, io_info,
(struct RAID_CONTEXT_G35 *)pRAID_Context,
map))
return false;
return true;
}
@ -1219,7 +1245,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
* ldSpanInfo - ldSpanInfo per HBA instance
*
*/
void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
static u8 mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
PLD_SPAN_INFO ldSpanInfo)
{
u8 span, count;
@ -1265,6 +1291,8 @@ void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
}
span_set->span_row_data_width = span_row_width;
if (le32_to_cpu(quad->diff) == 0)
return 1;
span_row = mega_div64_32(((le64_to_cpu(quad->logEnd) -
le64_to_cpu(quad->logStart)) + le32_to_cpu(quad->diff)),
le32_to_cpu(quad->diff));
@ -1318,6 +1346,7 @@ void mr_update_span_set(struct MR_DRV_RAID_MAP_ALL *map,
break;
}
}
return 0;
}
void mr_update_load_balance_params(struct MR_DRV_RAID_MAP_ALL *drv_map,

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Linux MegaRAID driver for SAS based RAID controllers
*
* Copyright (c) 2009-2013 LSI Corporation
* Copyright (c) 2013-2016 Avago Technologies
* Copyright (c) 2016-2018 Broadcom Inc.
* Copyright (c) 2009-2018 LSI Corporation.
* Copyright (c) 2009-2018 Avago Technologies.
* Copyright (c) 2009-2018 Broadcom Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* FILE: megaraid_sas_fusion.h
*
@ -140,16 +152,17 @@ struct RAID_CONTEXT_G35 {
u16 nseg_type;
u16 timeout_value; /* 0x02 -0x03 */
u16 routing_flags; // 0x04 -0x05 routing flags
u16 virtual_disk_tgt_id; /* 0x06 -0x07 */
__le64 reg_lock_row_lba; /* 0x08 - 0x0F */
u32 reg_lock_length; /* 0x10 - 0x13 */
union { // flow specific
u16 rmw_op_index; /* 0x14 - 0x15, R5/6 RMW: rmw operation index*/
u16 peer_smid; /* 0x14 - 0x15, R1 Write: peer smid*/
u16 r56_arm_map; /* 0x14 - 0x15, Unused [15], LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */
u16 virtual_disk_tgt_id; /* 0x06 -0x07 */
__le64 reg_lock_row_lba; /* 0x08 - 0x0F */
u32 reg_lock_length; /* 0x10 - 0x13 */
union { // flow specific
u16 rmw_op_index; /* 0x14 - 0x15, R5/6 RMW: rmw operation index*/
u16 peer_smid; /* 0x14 - 0x15, R1 Write: peer smid*/
u16 r56_arm_map; /* 0x14 - 0x15, Unused [15], LogArm[14:10], P-Arm[9:5], Q-Arm[4:0] */
} flow_specific;
u8 ex_status; /* 0x16 : OUT */
u8 status; /* 0x17 status */
u8 raid_flags; /* 0x18 resvd[7:6], ioSubType[5:4],
@ -246,7 +259,7 @@ union RAID_CONTEXT_UNION {
#define RAID_CTX_R56_P_ARM_MASK (0x3E0)
#define RAID_CTX_R56_LOG_ARM_SHIFT (10)
#define RAID_CTX_R56_LOG_ARM_MASK (0x7C00)
/* number of bits per index in U32 TrackStream */
#define BITS_PER_INDEX_STREAM 4
#define INVALID_STREAM_NUM 16
@ -774,7 +787,7 @@ struct MR_SPAN_BLOCK_INFO {
struct MR_CPU_AFFINITY_MASK {
union {
struct {
#ifndef MFI_BIG_ENDIAN
#ifndef __BIG_ENDIAN_BITFIELD
u8 hw_path:1;
u8 cpu0:1;
u8 cpu1:1;
@ -866,8 +879,19 @@ struct MR_LD_RAID {
__le16 seqNum;
struct {
#ifndef __BIG_ENDIAN_BITFIELD
u32 ldSyncRequired:1;
u32 reserved:31;
u32 regTypeReqOnReadIsValid:1; // Qualifier bit for regTypeOnRead
u32 isEPD:1; // Set if LD is an "Enhanced Physical Drive"
u32 enableSLDOnAllRWIOs:1; // If set, driver should unconditionally set SLD bit for all Read Write IOs
u32 reserved:28;
#else
u32 reserved:28;
u32 enableSLDOnAllRWIOs:1; // If set, driver should unconditionally set SLD bit for all Read Write IOs
u32 isEPD:1; // Set if LD is an "Enhanced Physical Drive"
u32 regTypeReqOnReadIsValid:1; // Qualifier bit for regTypeOnRead
u32 ldSyncRequired:1;
#endif
} flags;
u8 LUN[8]; /* 0x24 8 byte LUN field used for SCSI IO's */
@ -878,7 +902,7 @@ struct MR_LD_RAID {
/* 0x30 - 0x33, Logical block size for the LD */
u32 logical_block_length;
struct {
#ifndef MFI_BIG_ENDIAN
#ifndef __BIG_ENDIAN_BITFIELD
/* 0x34, P_I_EXPONENT from READ CAPACITY 16 */
u32 ld_pi_exp:4;
/* 0x34, LOGICAL BLOCKS PER PHYSICAL
@ -1063,6 +1087,7 @@ struct MR_FW_RAID_MAP_DYNAMIC {
#define MPI26_IEEE_SGE_FLAGS_NSF_NVME_PRP (0x08)
#define MPI26_IEEE_SGE_FLAGS_NSF_NVME_SGL (0x10)
#define MEGASAS_DEFAULT_SNAP_DUMP_WAIT_TIME 15
#define MEGASAS_MAX_SNAP_DUMP_WAIT_TIME 60
@ -1292,6 +1317,7 @@ struct fusion_context {
u8 *sense;
dma_addr_t sense_phys_addr;
atomic_t busy_mq_poll[MAX_MSIX_QUEUES_FUSION];
dma_addr_t reply_frames_desc_phys[MAX_MSIX_QUEUES_FUSION];
union MPI2_REPLY_DESCRIPTORS_UNION *reply_frames_desc[MAX_MSIX_QUEUES_FUSION];
struct rdpq_alloc_detail rdpq_tracker[RDPQ_MAX_CHUNK_COUNT];
@ -1355,13 +1381,14 @@ enum CMD_RET_VALUES {
};
struct MR_SNAPDUMP_PROPERTIES {
u8 offload_num;
u8 max_num_supported;
u8 cur_num_supported;
u8 trigger_min_num_sec_before_ocr;
u8 reserved[12];
u8 offload_num;
u8 max_num_supported;
u8 cur_num_supported;
u8 trigger_min_num_sec_before_ocr;
u8 reserved[12];
};
struct megasas_debugfs_buffer {
void *buf;
u32 len;