RE: [BK PATCH] SCSI update for 2.6.3

Moore, Eric Dean
2004-02-25T00:24:03Z

[-- Attachment #1: Type: text/plain, Size: 5099 bytes --]

Please try the attached patch.
Apply against the 2.6.3 kernel, which
comes with mpt fusion 3.00.02 driver.

I expect the same results from mptbase, however
mptscsih driver should load without the panic
in mptscsih_init. Please send dmesg if there
still are issues.

Regards,
Eric Moore
Staff Engineer
Standard Storage Products Division
LSI Logic Corporation
4420 Arrowswest Drive
Colorado Springs, CO 80907
Email: emoore@lsil.com
Web: http://www.lsilogic.com/

On Tuesday, February 24, 2004 9:05 AM, Joe Korty wrote:
>
> On Tue, Feb 24, 2004 at 09:34:25AM -0600, James Bottomley wrote:
> > On Tue, 2004-02-24 at 09:24, Joe Korty wrote:
> > > I am getting a panic out of the 2.6.3 Fusion driver when
> no devices
> > > are attached to it. Does the above update fix it? If so, I would
> > > like to get a copy of the above in patch form. If not, I can send
> > > you a copy of my boot log.
> >
> > Well, without a bug report I don't really have any idea.
> >
> > The patch is here:
> >
> > http://marc.theaimsgroup.com/?l=linux-scsi&m=107670916906716&w=2
>
>
> Hi James,
> Tried the patch, no luck. The panic is on an Opteron board which has
> an IDE rather than a SCSI disk. I have another system,
> identical to the
> above, that has a SCSI rather than IDE disk, and it boots.
> 2.6.1 boots
> on both systems.
>
> Regards,
> Joe
>
>
>
> ...
> Using anticipatory io scheduler
> FDC 0 is a post-1991 82077
> loop: loaded (max 8 devices)
> Intel(R) PRO/1000 Network Driver - version 5.2.30.1-k1
> Copyright (c) 1999-2004 Intel Corporation.
> tg3.c:v2.6 (February 3, 2004)
> eth0: Tigon3 [partno(BCM95704A7) rev 2003 PHY(5704)]
> (PCI:33MHz:64-bit) 10/100/1000BaseT Ethernet 00:e0:81:51:d8:fd
> eth1: Tigon3 [partno(BCM95704A7) rev 2003 PHY(5704)]
> (PCI:33MHz:64-bit) 10/100/1000BaseT Ethernet 00:e0:81:51:d8:fe
> Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
> ide: Assuming 33MHz system bus speed for PIO modes; override
> with idebus=xx
> AMD8111: IDE controller at PCI slot 0000:00:07.1
> AMD8111: chipset revision 3
> AMD8111: not 100% native mode: will probe irqs later
> ide: Assuming 33MHz system bus speed for PIO modes; override
> with idebus=xx
> AMD8111: 0000:00:07.1 (rev 03) UDMA133 controller
> ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio
> ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:pio
> hda: ST380011A, ATA DISK drive
> isa bounce pool size: 16 pages
> ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
> hdc: CD-950E/TKU, ATAPI CD/DVD-ROM drive
> ide1 at 0x170-0x177,0x376 on irq 15
> hda: max request size: 1024KiB
> hda: 156301488 sectors (80026 MB) w/2048KiB Cache,
> CHS=16383/255/63, UDMA(100)
> /dev/ide/host0/bus0/target0/lun0: p1 p2 p3 p4 < p5 p6 >
> hdc: ATAPI 52X CD-ROM drive, 128kB Cache, DMA
> Uniform CD-ROM driver Revision: 3.20
> Red Hat/Adaptec aacraid driver (1.1.2-lk1 Feb 24 2004)
> Fusion MPT base driver 3.00.03
> Copyright (c) 1999-2003 LSI Logic Corporation
> mptbase: Initiating ioc0 bringup
> mptbase: ioc0: ERROR - Doorbell ACK timeout(2)!
> mptbase: ioc0: ERROR - Diagnostic reset FAILED! (102h)
> mptbase: ioc0 NOT READY WARNING!
> mptbase: WARNING - ioc0 did not initialize properly! (-1)
> mptbase: probe of 0000:02:0a.0 failed with error -1
> mptbase: Initiating ioc1 bringup
> mptbase: ioc1: ERROR - Doorbell ACK timeout(2)!
> mptbase: ioc1: ERROR - Diagnostic reset FAILED! (102h)
> mptbase: ioc1 NOT READY WARNING!
> mptbase: WARNING - ioc1 did not initialize properly! (-1)
> mptbase: probe of 0000:02:0a.1 failed with error -1
> Fusion MPT SCSI Host driver 3.00.03
> Unable to handle kernel NULL pointer dereference at
> 0000000000000018 RIP:
> <ffffffff80823a1f>{mptscsih_init+175}PML4 0
> Oops: 0000 [1]
> CPU 0
> Pid: 1, comm: swapper Not tainted
> RIP: 0010:[<ffffffff80823a1f>] <ffffffff80823a1f>{mptscsih_init+175}
> RSP: 0000:000001007afe1f18 EFLAGS: 00010202
> RAX: 0000000000000000 RBX: 00000100089a4d20 RCX: 000000000000000c
> RDX: 00000100089a4d20 RSI: ffffffff804546b0 RDI: 000001017fe1f398
> RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
> R10: 000001017fdfa160 R11: 00000000000000c0 R12: 0000000000000000
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
> FS: 0000000000000000(0000) GS:ffffffff807fa540(0000)
> knlGS:0000000000000000
> CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
> CR2: 0000000000000018 CR3: 0000000000101000 CR4: 00000000000006a0
> Process swapper (pid: 1, stackpage=10008898500)
> Stack: ffffffff8082fb70 ffffffff8080788d 0000000000000246
> 0000000000000000
> 0000000000000000 ffffffff8010b16e 0000000000000000
> ffffffff8010fec7
> 0000000000000000 0000000000000000
> Call Trace:<ffffffff8080788d>{do_initcalls+77}
> <ffffffff8010b16e>{init+110}
> <ffffffff8010fec7>{child_rip+8} <ffffffff8010b100>{init+0}
> <ffffffff8010febf>{child_rip+0}
>
> Code: 48 8b 70 18 e8 68 d4 c2 ff 48 89 df e8 50 66 c2 ff 48 85 c0
> RIP <ffffffff80823a1f>{mptscsih_init+175} RSP <000001007afe1f18>
> CR2: 0000000000000018
> <0>Kernel panic: Attempted to kill init!
>

[-- Attachment #2: mptlinux-3.00.04.patch --]
[-- Type: application/octet-stream, Size: 11411 bytes --]

diff -uarN linux-2.6.3-ref/drivers/message/fusion/Kconfig linux-2.6.3/drivers/message/fusion/Kconfig
--- linux-2.6.3-ref/drivers/message/fusion/Kconfig 2004-02-17 20:59:59.000000000 -0700
+++ linux-2.6.3/drivers/message/fusion/Kconfig 2004-02-24 17:19:50.000000000 -0700
@@ -3,7 +3,6 @@

config FUSION
tristate "Fusion MPT (base + ScsiHost) drivers"
- depends on BLK_DEV_SD
---help---
LSI Logic Fusion(TM) Message Passing Technology (MPT) device support
provides high performance SCSI host initiator, and LAN [1] interface
@@ -14,41 +13,6 @@

[1] LAN is not supported on parallel SCSI medium.

- These drivers require a Fusion MPT compatible PCI adapter installed
- in the host system. MPT adapters contain specialized I/O processors
- to handle I/O workload, and more importantly to offload this work
- from the host CPU(s).
-
- If you have Fusion MPT hardware and want to use it, you can say
- Y or M here to add MPT (base + ScsiHost) drivers.
- <Y> = build lib (fusion), and link [static] into the kernel [2]
- proper
- <M> = compiled as [dynamic] modules [3] named: (mptbase,
- mptscsih)
-
- [2] In order enable capability to boot the linux kernel
- natively from a Fusion MPT target device, you MUST
- answer Y here! (currently requires CONFIG_BLK_DEV_SD)
- [3] To compile this support as modules, choose M here.
-
- If unsure, say N.
-
- If you say Y or M here you will get a choice of these
- additional protocol and support module options: Module Name:
- <M> Enhanced SCSI error reporting (isense)
- <M> Fusion MPT misc device (ioctl) driver (mptctl)
- <M> Fusion MPT LAN driver (mptlan)
-
- ---
- Fusion MPT is trademark of LSI Logic Corporation, and its
- architecture is based on LSI Logic's Message Passing Interface (MPI)
- specification.
-
-config FUSION_BOOT
- bool
- depends on FUSION=y
- default y
-
config FUSION_MAX_SGE
int "Maximum number of scatter gather entries"
depends on FUSION
@@ -62,7 +26,6 @@
necessary (or recommended) unless the user will be running
large I/O's via the raw interface.

-# How can we force these options to module or nothing?
config FUSION_ISENSE
tristate "Enhanced SCSI error reporting"
depends on MODULES && FUSION && m
@@ -132,17 +95,4 @@

If unsure whether you really want or need this, say N.

- NOTES: This feature is NOT available nor supported for linux-2.2.x
- kernels. You must be building a linux-2.3.x or linux-2.4.x kernel
- in order to configure this option.
- Support for building this feature into the linux kernel is not
- yet available.
-
-# if [ "$CONFIG_FUSION_LAN" != "n" ]; then
-# define_bool CONFIG_NET_FC y
-# fi
-# These <should> be define_tristate, but we leave them define_bool
-# for backward compatibility with pre-linux-2.2.15 kernels.
-# (Bugzilla:fibrebugs, #384)
endmenu
-
diff -uarN linux-2.6.3-ref/drivers/message/fusion/mptbase.c linux-2.6.3/drivers/message/fusion/mptbase.c
--- linux-2.6.3-ref/drivers/message/fusion/mptbase.c 2004-02-17 20:57:20.000000000 -0700
+++ linux-2.6.3/drivers/message/fusion/mptbase.c 2004-02-24 17:17:53.000000000 -0700
@@ -714,6 +714,7 @@
MptCallbacks[i] = cbfunc;
MptDriverClass[i] = dclass;
MptEvHandlers[i] = NULL;
+ MptDeviceDriverHandlers[i] = NULL;
last_drv_idx = i;
if (cbfunc != mpt_base_reply) {
mpt_inc_use_count();
@@ -838,11 +839,28 @@
int
mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
{
- if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS)
- return -1;
+ MPT_ADAPTER *ioc;
+ int error=0;
+
+ if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) {
+ error= -EINVAL;
+ return error;
+ }

MptDeviceDriverHandlers[cb_idx] = dd_cbfunc;
- return 0;
+
+ /* call per pci device probe entry point */
+ for(ioc = mpt_adapter_find_first(); ioc != NULL;
+ ioc = mpt_adapter_find_next(ioc)) {
+ if(dd_cbfunc->probe) {
+ error = dd_cbfunc->probe(ioc->pcidev,
+ ioc->pcidev->driver->id_table);
+ if(error != 0)
+ return error;
+ }
+ }
+
+ return error;
}

/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1497,14 +1515,20 @@
|| (ioc->chip_type == C1035) || (ioc->chip_type == FC929X))
mpt_detect_bound_ports(ioc, pdev);

- if ((r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0) {
- printk(KERN_WARNING MYNAM ": WARNING - %s did not initialize properly! (%d)\n",
- ioc->name, r);
- }
-
- if(r != 0 )
+ if ((r = mpt_do_ioc_recovery(ioc,
+ MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0) {
+ printk(KERN_WARNING MYNAM
+ ": WARNING - %s did not initialize properly! (%d)\n",
+ ioc->name, r);
+
+ Q_DEL_ITEM(ioc);
+ mpt_adapters[ioc->id] = NULL;
+ free_irq(ioc->pci_irq, ioc);
+ iounmap(mem);
+ kfree(ioc);
+ pci_set_drvdata(pdev, NULL);
return r;
-
+ }

/* call per device driver probe entry point */
for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) {
diff -uarN linux-2.6.3-ref/drivers/message/fusion/mptbase.h linux-2.6.3/drivers/message/fusion/mptbase.h
--- linux-2.6.3-ref/drivers/message/fusion/mptbase.h 2004-02-17 20:57:17.000000000 -0700
+++ linux-2.6.3/drivers/message/fusion/mptbase.h 2004-02-24 16:42:19.000000000 -0700
@@ -80,8 +80,8 @@
#define COPYRIGHT "Copyright (c) 1999-2003 " MODULEAUTHOR
#endif

-#define MPT_LINUX_VERSION_COMMON "3.00.02"
-#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.00.02"
+#define MPT_LINUX_VERSION_COMMON "3.00.04"
+#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.00.04"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"

#define show_mptmod_ver(s,ver) \
diff -uarN linux-2.6.3-ref/drivers/message/fusion/mptlan.c linux-2.6.3/drivers/message/fusion/mptlan.c
--- linux-2.6.3-ref/drivers/message/fusion/mptlan.c 2004-02-17 20:57:57.000000000 -0700
+++ linux-2.6.3/drivers/message/fusion/mptlan.c 2004-02-24 16:46:29.000000000 -0700
@@ -1437,7 +1437,7 @@
SET_MODULE_OWNER(dev);

if (register_netdev(dev) != 0) {
- kfree(dev);
+ free_netdev(dev);
dev = NULL;
}
return dev;
diff -uarN linux-2.6.3-ref/drivers/message/fusion/mptscsih.c linux-2.6.3/drivers/message/fusion/mptscsih.c
--- linux-2.6.3-ref/drivers/message/fusion/mptscsih.c 2004-02-17 20:57:30.000000000 -0700
+++ linux-2.6.3/drivers/message/fusion/mptscsih.c 2004-02-24 16:40:51.000000000 -0700
@@ -197,11 +197,11 @@
static int mptscsih_setup(char *str);

/* module entry point */
-static int __init mptscsih_init (void);
-static void mptscsih_exit (void);
+static int __init mptscsih_init (void);
+static void __exit mptscsih_exit (void);

-static int __devinit mptscsih_probe (struct pci_dev *, const struct pci_device_id *);
-static void __devexit mptscsih_remove(struct pci_dev *);
+static int mptscsih_probe (struct pci_dev *, const struct pci_device_id *);
+static void mptscsih_remove(struct pci_dev *);
static void mptscsih_shutdown(struct device *);
#ifdef CONFIG_PM
static int mptscsih_suspend(struct pci_dev *pdev, u32 state);
@@ -1405,7 +1405,7 @@
*
*/

-static int __devinit
+static int
mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct Scsi_Host *sh = NULL;
@@ -1418,6 +1418,7 @@
int numSGE = 0;
int scale;
u8 *mem;
+ int error=0;

for (portnum=0; portnum < ioc->facts.NumberOfPorts; portnum++) {

@@ -1542,8 +1543,10 @@
*/
sz = hd->ioc->req_depth * sizeof(void *);
mem = kmalloc(sz, GFP_ATOMIC);
- if (mem == NULL)
+ if (mem == NULL) {
+ error = -ENOMEM;
goto mptscsih_probe_failed;
+ }

memset(mem, 0, sz);
hd->ScsiLookup = (struct scsi_cmnd **) mem;
@@ -1551,15 +1554,19 @@
dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p, sz=%d\n",
ioc->name, hd->ScsiLookup, sz));

- if (mptscsih_initChainBuffers(hd, 1) < 0)
+ if (mptscsih_initChainBuffers(hd, 1) < 0) {
+ error = -EINVAL;
goto mptscsih_probe_failed;
+ }

/* Allocate memory for free and doneQ's
*/
sz = sh->can_queue * sizeof(MPT_DONE_Q);
mem = kmalloc(sz, GFP_ATOMIC);
- if (mem == NULL)
+ if (mem == NULL) {
+ error = -ENOMEM;
goto mptscsih_probe_failed;
+ }

memset(mem, 0xFF, sz);
hd->memQ = mem;
@@ -1591,8 +1598,10 @@
*/
sz = sh->max_id * sizeof(void *);
mem = kmalloc(sz, GFP_ATOMIC);
- if (mem == NULL)
+ if (mem == NULL) {
+ error = -ENOMEM;
goto mptscsih_probe_failed;
+ }

memset(mem, 0, sz);
hd->Targets = (VirtDevice **) mem;
@@ -1683,7 +1692,8 @@

mpt_scsi_hosts++;

- if(scsi_add_host (sh, &ioc->pcidev->dev)) {
+ error = scsi_add_host (sh, &ioc->pcidev->dev);
+ if(error) {
dprintk((KERN_ERR MYNAM,
"scsi_add_host failed\n"));
goto mptscsih_probe_failed;
@@ -1691,7 +1701,6 @@

scsi_scan_host(sh);
return 0;
-
} /* scsi_host_alloc */

} /* for each adapter port */
@@ -1699,8 +1708,7 @@
mptscsih_probe_failed:

mptscsih_remove(pdev);
- return -ENODEV;
-
+ return error;
}

/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1710,7 +1718,7 @@
*
*
*/
-static void __devexit
+static void
mptscsih_remove(struct pci_dev *pdev)
{
MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
@@ -1828,6 +1836,7 @@
}

scsi_host_put(host);
+ mpt_scsi_hosts--;

}

@@ -1911,7 +1920,7 @@

static struct mpt_pci_driver mptscsih_driver = {
.probe = mptscsih_probe,
- .remove = __devexit_p(mptscsih_remove),
+ .remove = mptscsih_remove,
.shutdown = mptscsih_shutdown,
#ifdef CONFIG_PM
.suspend = mptscsih_suspend,
@@ -1928,10 +1937,9 @@
*
* Returns 0 for success, non-zero for failure.
*/
-static int
-__init mptscsih_init(void)
+static int __init
+mptscsih_init(void)
{
- MPT_ADAPTER *ioc;

show_mptmod_ver(my_NAME, my_VERSION);

@@ -1939,12 +1947,6 @@
ScsiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSCSIH_DRIVER);
ScsiScanDvCtx = mpt_register(mptscsih_scandv_complete, MPTSCSIH_DRIVER);

- if(mpt_device_driver_register(&mptscsih_driver,
- MPTSCSIH_DRIVER) != 0 ) {
- dprintk((KERN_INFO MYNAM
- ": failed to register dd callbacks\n"));
- }
-
if (mpt_event_register(ScsiDoneCtx, mptscsih_event_process) == 0) {
dprintk((KERN_INFO MYNAM
": Registered for IOC event notifications\n"));
@@ -1961,20 +1963,13 @@
mptscsih_setup(mptscsih);
#endif

- /* probing for devices */
- for(ioc = mpt_adapter_find_first(); ioc != NULL;
- ioc = mpt_adapter_find_next(ioc)) {
- if(mptscsih_probe(ioc->pcidev, ioc->pcidev->driver->id_table)) {
- dprintk((KERN_INFO MYNAM ": probe failed\n"));
- return -ENODEV;
- }
+ if(mpt_device_driver_register(&mptscsih_driver,
+ MPTSCSIH_DRIVER) != 0 ) {
+ dprintk((KERN_INFO MYNAM
+ ": failed to register dd callbacks\n"));
}

- if (mpt_scsi_hosts > 0)
- return 0;
-
- mptscsih_exit();
- return -ENODEV;
+ return 0;

}

@@ -1984,7 +1979,7 @@
* mptscsih_exit - Unregisters MPT adapter(s)
*
*/
-static void
+static void __exit
mptscsih_exit(void)
{
MPT_ADAPTER *ioc;