From owner-svn-src-all@freebsd.org Wed Jul 10 22:24:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3CAD15E4DB7; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 72DCA7501B; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B9721D827; Wed, 10 Jul 2019 22:24:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6AMO0X7062091; Wed, 10 Jul 2019 22:24:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6AMNxHo062084; Wed, 10 Jul 2019 22:23:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201907102223.x6AMNxHo062084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 10 Jul 2019 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349895 - head/sys/dev/isci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/isci X-SVN-Commit-Revision: 349895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72DCA7501B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 22:24:01 -0000 Author: imp Date: Wed Jul 10 22:23:59 2019 New Revision: 349895 URL: https://svnweb.freebsd.org/changeset/base/349895 Log: Enforce a 4GB DMA boundary on isci(4) This device cannot cross a 4GB boundary with DMA. Removing the boundary in r346386 resulted in low frequency memory corruption on machines with isci(4) controllers. Submitted by: gallatin@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20910 Modified: head/sys/dev/isci/isci.c head/sys/dev/isci/isci.h head/sys/dev/isci/isci_controller.c Modified: head/sys/dev/isci/isci.c ============================================================================== --- head/sys/dev/isci/isci.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.c Wed Jul 10 22:23:59 2019 (r349895) @@ -414,7 +414,8 @@ isci_allocate_dma_buffer(device_t device, struct ISCI_ uint32_t status; status = bus_dma_tag_create(bus_get_dma_tag(device), - 0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR, + 0x40 /* cacheline alignment */, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, memory->size, 0x1 /* we want physically contiguous */, memory->size, 0, busdma_lock_mutex, &controller->lock, Modified: head/sys/dev/isci/isci.h ============================================================================== --- head/sys/dev/isci/isci.h Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci.h Wed Jul 10 22:23:59 2019 (r349895) @@ -75,6 +75,9 @@ #define ISCI_NUM_PCI_BARS 2 #define ISCI_MAX_LUN 8 +/* This device cannot DMA across a 4GB boundary */ +#define ISCI_DMA_BOUNDARY ((bus_addr_t)((uint64_t)1 << 32)) + MALLOC_DECLARE(M_ISCI); struct ISCI_TIMER { Modified: head/sys/dev/isci/isci_controller.c ============================================================================== --- head/sys/dev/isci/isci_controller.c Wed Jul 10 21:35:55 2019 (r349894) +++ head/sys/dev/isci/isci_controller.c Wed Jul 10 22:23:59 2019 (r349895) @@ -477,9 +477,9 @@ int isci_controller_allocate_memory(struct ISCI_CONTRO * will enable better performance than creating the DMA maps every time we get * an I/O. */ - status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, 0x0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - isci_io_request_get_max_io_size(), + status = bus_dma_tag_create(bus_get_dma_tag(device), 0x1, + ISCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, isci_io_request_get_max_io_size(), SCI_MAX_SCATTER_GATHER_ELEMENTS, max_segment_size, 0, busdma_lock_mutex, &controller->lock, &controller->buffer_dma_tag);