Module Name: src Committed By: joerg Date: Mon Feb 12 23:11:00 UTC 2018
Modified Files: src/sys/arch/amd64/conf: ALL src/sys/conf: files src/sys/dev/ic: ciss.c cissvar.h src/sys/dev/pci: ciss_pci.c Log Message: Add a new option CISS_NO_INTERRUPT_HACK for driving ciss(4) by callouts. This is intended as workaround for certain Xen issues with dom0 kernels and will likely want to have a high HZ value as well for decent performance. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/arch/amd64/conf/ALL cvs rdiff -u -r1.1193 -r1.1194 src/sys/conf/files cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/ciss.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/cissvar.h cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ciss_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/conf/ALL diff -u src/sys/arch/amd64/conf/ALL:1.80 src/sys/arch/amd64/conf/ALL:1.81 --- src/sys/arch/amd64/conf/ALL:1.80 Sat Jan 27 21:46:54 2018 +++ src/sys/arch/amd64/conf/ALL Mon Feb 12 23:11:00 2018 @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.80 2018/01/27 21:46:54 pgoyette Exp $ +# $NetBSD: ALL,v 1.81 2018/02/12 23:11:00 joerg Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.80 $" +#ident "ALL-$Revision: 1.81 $" maxusers 64 # estimated number of users @@ -808,6 +808,8 @@ amr* at pci? dev ? function ? # AMI/LSI arcmsr* at pci? dev ? function ? # Areca SATA RAID controllers cac* at pci? dev ? function ? # Compaq PCI array controllers ciss* at pci? dev ? function ? # HP Smart Array controllers +options CISS_NO_INTERRUPT_HACK + icp* at pci? dev ? function ? # ICP-Vortex GDT & Intel RAID mlx* at pci? dev ? function ? # Mylex DAC960 & DEC SWXCR family twa* at pci? dev ? function ? # 3ware Escalade 95xx RAID controllers Index: src/sys/conf/files diff -u src/sys/conf/files:1.1193 src/sys/conf/files:1.1194 --- src/sys/conf/files:1.1193 Sun Feb 4 17:31:51 2018 +++ src/sys/conf/files Mon Feb 12 23:11:00 2018 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1193 2018/02/04 17:31:51 maxv Exp $ +# $NetBSD: files,v 1.1194 2018/02/12 23:11:00 joerg Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -518,6 +518,7 @@ file dev/ic/ld_cac.c ld_cac # HP/Compaq Command Interface for SCSI-3 Support # +defflag opt_ciss.h CISS_NO_INTERRUPT_HACK device ciss: scsi file dev/ic/ciss.c ciss Index: src/sys/dev/ic/ciss.c diff -u src/sys/dev/ic/ciss.c:1.37 src/sys/dev/ic/ciss.c:1.38 --- src/sys/dev/ic/ciss.c:1.37 Fri Jul 28 14:49:55 2017 +++ src/sys/dev/ic/ciss.c Mon Feb 12 23:11:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ciss.c,v 1.37 2017/07/28 14:49:55 riastradh Exp $ */ +/* $NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $ */ /* $OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */ /* @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.37 2017/07/28 14:49:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $"); #include "bio.h" @@ -593,9 +593,11 @@ ciss_cmd(struct ciss_ccb *ccb, int flags bus_dmamap_sync(sc->sc_dmat, sc->cmdmap, 0, sc->cmdmap->dm_mapsize, BUS_DMASYNC_PREWRITE); +#ifndef CISS_NO_INTERRUPT_HACK if ((wait & (XS_CTL_POLL|XS_CTL_NOSLEEP)) == (XS_CTL_POLL|XS_CTL_NOSLEEP)) bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR, bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) | sc->iem); +#endif mutex_enter(&sc->sc_mutex); TAILQ_INSERT_TAIL(&sc->sc_ccbq, ccb, ccb_link); @@ -637,9 +639,11 @@ ciss_cmd(struct ciss_ccb *ccb, int flags ccb->ccb_err.cmd_stat, ccb->ccb_err.scsi_stat)); } +#ifndef CISS_NO_INTERRUPT_HACK if ((wait & (XS_CTL_POLL|XS_CTL_NOSLEEP)) == (XS_CTL_POLL|XS_CTL_NOSLEEP)) bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR, bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) & ~sc->iem); +#endif return (error); } Index: src/sys/dev/ic/cissvar.h diff -u src/sys/dev/ic/cissvar.h:1.6 src/sys/dev/ic/cissvar.h:1.7 --- src/sys/dev/ic/cissvar.h:1.6 Sat Oct 12 16:52:21 2013 +++ src/sys/dev/ic/cissvar.h Mon Feb 12 23:11:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cissvar.h,v 1.6 2013/10/12 16:52:21 christos Exp $ */ +/* $NetBSD: cissvar.h,v 1.7 2018/02/12 23:11:00 joerg Exp $ */ /* $OpenBSD: cissvar.h,v 1.15 2013/05/30 16:15:02 deraadt Exp $ */ /* @@ -24,6 +24,8 @@ #include <dev/sysmon/sysmonvar.h> #include <sys/envsys.h> +#include "opt_ciss.h" + struct ciss_ld { struct ciss_blink bling; /* a copy of blink state */ char xname[16]; /* copy of the sdN name */ @@ -43,6 +45,9 @@ struct ciss_softc { void *sc_sh; /* shutdown hook */ struct proc *sc_thread; int sc_flush; +#ifdef CISS_NO_INTERRUPT_HACK + struct callout sc_interrupt_hack; +#endif struct scsipi_channel sc_channel; struct scsipi_channel *sc_channel_raw; Index: src/sys/dev/pci/ciss_pci.c diff -u src/sys/dev/pci/ciss_pci.c:1.13 src/sys/dev/pci/ciss_pci.c:1.14 --- src/sys/dev/pci/ciss_pci.c:1.13 Thu Jul 14 04:00:46 2016 +++ src/sys/dev/pci/ciss_pci.c Mon Feb 12 23:11:00 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ciss_pci.c,v 1.13 2016/07/14 04:00:46 msaitoh Exp $ */ +/* $NetBSD: ciss_pci.c,v 1.14 2018/02/12 23:11:00 joerg Exp $ */ /* $OpenBSD: ciss_pci.c,v 1.9 2005/12/13 15:56:01 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ciss_pci.c,v 1.13 2016/07/14 04:00:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciss_pci.c,v 1.14 2018/02/12 23:11:00 joerg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -243,6 +243,20 @@ ciss_pci_match(device_t parent, cfdata_t return 0; } +#ifdef CISS_NO_INTERRUPT_HACK +static void +ciss_intr_wrapper(void *sc_) +{ + struct ciss_softc *sc = sc_; + int s; + + s = splbio(); + ciss_intr(sc); + splx(s); + callout_schedule(&sc->sc_interrupt_hack, 1); +} +#endif + void ciss_pci_attach(device_t parent, device_t self, void *aux) { @@ -256,6 +270,10 @@ ciss_pci_attach(device_t parent, device_ int i; char intrbuf[PCI_INTRSTR_LEN]; +#ifdef CISS_NO_INTERRUPT_HACK + callout_init(&sc->sc_interrupt_hack, 0); + callout_setfunc(&sc->sc_interrupt_hack, ciss_intr_wrapper, sc); +#endif sc->sc_dev = self; aprint_naive("\n"); @@ -316,8 +334,10 @@ ciss_pci_attach(device_t parent, device_ } /* disable interrupts until ready */ +#ifndef CISS_NO_INTERRUPT_HACK bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR, bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) | sc->iem); +#endif if (pci_intr_map(pa, &ih)) { aprint_error_dev(self, "can't map interrupt\n"); @@ -350,7 +370,11 @@ ciss_pci_attach(device_t parent, device_ return; } +#ifndef CISS_NO_INTERRUPT_HACK /* enable interrupts now */ bus_space_write_4(sc->sc_iot, sc->sc_ioh, CISS_IMR, bus_space_read_4(sc->sc_iot, sc->sc_ioh, CISS_IMR) & ~sc->iem); +#else + callout_schedule(&sc->sc_interrupt_hack, 1); +#endif }