diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2009-10-15 12:38:50 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2009-10-15 12:38:50 +0000 |
commit | 53e92725352eac1e8b50d3ebb549af601e383850 (patch) | |
tree | 5ee2fbceb30797bab01958a75ece2e8dbd8f45a9 /sys | |
parent | e13f6ce115e16fb37cec7284ee85a69a14ca0ff9 (diff) |
disable interrupt coalescing (aka mitigation) if the chip comes up with it
turned on. mitigation on io only slows us down.
developed on hardware donated by fox-it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/mpi.c | 49 | ||||
-rw-r--r-- | sys/dev/ic/mpireg.h | 16 |
2 files changed, 63 insertions, 2 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 356f4caaf29..244928877bc 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.113 2009/10/11 02:11:34 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.114 2009/10/15 12:38:49 dlg Exp $ */ /* * Copyright (c) 2005, 2006 David Gwynne <dlg@openbsd.org> @@ -131,6 +131,7 @@ int mpi_iocinit(struct mpi_softc *); int mpi_iocfacts(struct mpi_softc *); int mpi_portfacts(struct mpi_softc *); int mpi_portenable(struct mpi_softc *); +int mpi_cfg_coalescing(struct mpi_softc *); void mpi_get_raid(struct mpi_softc *); int mpi_fwupload(struct mpi_softc *); @@ -246,6 +247,11 @@ mpi_attach(struct mpi_softc *sc) goto free_replies; } + if (mpi_cfg_coalescing(sc) != 0) { + printf("%s: unable to configure coalescing\n", DEVNAME(sc)); + goto free_replies; + } + #ifdef notyet if (mpi_eventnotify(sc) != 0) { printf("%s: unable to get portfacts\n", DEVNAME(sc)); @@ -2045,6 +2051,47 @@ err: } int +mpi_cfg_coalescing(struct mpi_softc *sc) +{ + struct mpi_cfg_hdr hdr; + struct mpi_cfg_ioc_pg1 pg; + u_int32_t flags; + + if (mpi_cfg_header(sc, MPI_CONFIG_REQ_PAGE_TYPE_IOC, 1, 0, &hdr) != 0) { + DNPRINTF(MPI_D_MISC, "%s: unable to fetch IOC page 1 header\n", + DEVNAME(sc)); + return (1); + } + + if (mpi_cfg_page(sc, 0, &hdr, 1, &pg, sizeof(pg)) != 0) { + DNPRINTF(MPI_D_MISC, "%s: mpi_get_raid unable to fetch IOC " + "page 1\n", DEVNAME(sc)); + return (1); + } + + DNPRINTF(MPI_D_MISC, "%s: IOC page 1\n", DEVNAME(sc)); + DNPRINTF(MPI_D_MISC, "%s: flags: 0x08%x\n", DEVNAME(sc), + letoh32(pg.flags)); + DNPRINTF(MPI_D_MISC, "%s: coalescing_timeout: %d\n", DEVNAME(sc), + letoh32(pg.coalescing_timeout)); + DNPRINTF(MPI_D_MISC, "%s: coalescing_depth: %d pci_slot_num: %d\n", + DEVNAME(sc), pg.coalescing_timeout, pg.pci_slot_num); + + flags = letoh32(pg.flags); + if (!ISSET(flags, MPI_CFG_IOC_1_REPLY_COALESCING)) + return (0); + + CLR(pg.flags, htole32(MPI_CFG_IOC_1_REPLY_COALESCING)); + if (mpi_cfg_page(sc, 0, &hdr, 0, &pg, sizeof(pg)) != 0) { + DNPRINTF(MPI_D_MISC, "%s: unable to clear coalescing\n", + DEVNAME(sc)); + return (1); + } + + return (0); +} + +int mpi_eventnotify(struct mpi_softc *sc) { struct mpi_ccb *ccb; diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h index b07e3d1cabf..a99e864f0dc 100644 --- a/sys/dev/ic/mpireg.h +++ b/sys/dev/ic/mpireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpireg.h,v 1.35 2008/10/28 11:00:40 marco Exp $ */ +/* $OpenBSD: mpireg.h,v 1.36 2009/10/15 12:38:49 dlg Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -1170,6 +1170,20 @@ struct mpi_cfg_manufacturing_pg0 { char board_tracer_number[16]; } __packed; +struct mpi_cfg_ioc_pg1 { + struct mpi_cfg_hdr config_header; + + u_int32_t flags; +#define MPI_CFG_IOC_1_REPLY_COALESCING (1<<0) +#define MPI_CFG_IOC_1_CTX_REPLY_DISABLE (1<<4) + + u_int32_t coalescing_timeout; + + u_int8_t coalescing_depth; + u_int8_t pci_slot_num; + u_int8_t _reserved[2]; +} __packed; + struct mpi_cfg_ioc_pg2 { struct mpi_cfg_hdr config_header; |