From owner-svn-src-head@freebsd.org Wed Dec 16 14:39:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1D1C4BE63C; Wed, 16 Dec 2020 14:39:25 +0000 (UTC) (envelope-from mmel@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4CwySY4jXkz3FRp; Wed, 16 Dec 2020 14:39:25 +0000 (UTC) (envelope-from mmel@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 94FA827A28; Wed, 16 Dec 2020 14:39:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BGEdPf3078230; Wed, 16 Dec 2020 14:39:25 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BGEdPue078228; Wed, 16 Dec 2020 14:39:25 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012161439.0BGEdPue078228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 16 Dec 2020 14:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368698 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 368698 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 14:39:25 -0000 Author: mmel Date: Wed Dec 16 14:39:24 2020 New Revision: 368698 URL: https://svnweb.freebsd.org/changeset/base/368698 Log: Use the standard method for localizing of MSI-X table bar. Current way, hardcoded value plus heuristic is not conform to the PCI(e) specification and it fails on systems where MSI-X bar is not initialized by BIOS/ACPI (many arm or arm64 systems for example). Instead, use the standard PCI(e) capability for determining of MSIX table bar address. MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D27265 Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Dec 16 14:36:57 2020 (r368697) +++ head/sys/dev/e1000/if_em.c Wed Dec 16 14:39:24 2020 (r368698) @@ -847,9 +847,7 @@ em_if_attach_pre(if_ctx_t ctx) ** use a different BAR, so we need to keep ** track of which is used. */ - scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); - if (pci_read_config(dev, scctx->isc_msix_bar, 4) == 0) - scctx->isc_msix_bar += 4; + scctx->isc_msix_bar = pci_msix_table_bar(dev); } else if (adapter->hw.mac.type >= em_mac_min) { scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN); scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN); @@ -883,7 +881,7 @@ em_if_attach_pre(if_ctx_t ctx) * that it shall give MSI at least a try with other devices. */ if (adapter->hw.mac.type == e1000_82574) { - scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); + scctx->isc_msix_bar = pci_msix_table_bar(dev);; } else { scctx->isc_msix_bar = -1; scctx->isc_disable_msix = 1; Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Wed Dec 16 14:36:57 2020 (r368697) +++ head/sys/dev/e1000/if_em.h Wed Dec 16 14:39:24 2020 (r368698) @@ -316,7 +316,6 @@ #define EM_BAR_MEM_TYPE_MASK 0x00000006 #define EM_BAR_MEM_TYPE_32BIT 0x00000000 #define EM_BAR_MEM_TYPE_64BIT 0x00000004 -#define EM_MSIX_BAR 3 /* On 82575 */ /* More backward compatibility */ #if __FreeBSD_version < 900000