From owner-svn-src-all@freebsd.org Tue May 3 19:37:26 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4B55B2CD65; Tue, 3 May 2016 19:37:26 +0000 (UTC) (envelope-from jhb@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 mx1.freebsd.org (Postfix) with ESMTPS id 840BE170F; Tue, 3 May 2016 19:37:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u43JbPL6058737; Tue, 3 May 2016 19:37:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u43JbPDf058736; Tue, 3 May 2016 19:37:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201605031937.u43JbPDf058736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 May 2016 19:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299000 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Tue, 03 May 2016 19:37:26 -0000 Author: jhb Date: Tue May 3 19:37:25 2016 New Revision: 299000 URL: https://svnweb.freebsd.org/changeset/base/299000 Log: Use the correct location of the SRIOV capability when enabling ARI. While here, check if ARI was enabled by re-reading the config register after writing it and return an error if the write fails. Reviewed by: rstone, vangyzen Modified: head/sys/dev/pci/pci_iov.c Modified: head/sys/dev/pci/pci_iov.c ============================================================================== --- head/sys/dev/pci/pci_iov.c Tue May 3 18:54:20 2016 (r298999) +++ head/sys/dev/pci/pci_iov.c Tue May 3 19:37:25 2016 (r299000) @@ -442,6 +442,7 @@ pci_iov_set_ari(device_t bus) } } } + free(devlist, M_TEMP); /* * If we called this function some device must have the SR-IOV @@ -451,10 +452,14 @@ pci_iov_set_ari(device_t bus) ("Could not find child of %s with SR-IOV capability", device_get_nameunit(bus))); - iov_ctl = pci_read_config(lowest, iov_pos + PCIR_SRIOV_CTL, 2); + iov_ctl = pci_read_config(lowest, lowest_pos + PCIR_SRIOV_CTL, 2); iov_ctl |= PCIM_SRIOV_ARI_EN; - pci_write_config(lowest, iov_pos + PCIR_SRIOV_CTL, iov_ctl, 2); - free(devlist, M_TEMP); + pci_write_config(lowest, lowest_pos + PCIR_SRIOV_CTL, iov_ctl, 2); + if ((pci_read_config(lowest, lowest_pos + PCIR_SRIOV_CTL, 2) & + PCIM_SRIOV_ARI_EN) == 0) { + device_printf(lowest, "failed to enable ARI\n"); + return (ENXIO); + } return (0); }