From nobody Tue Apr 05 04:58:17 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B06401AA0EE7; Tue, 5 Apr 2022 04:58:18 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KXb4p1W4Dz3MDW; Tue, 5 Apr 2022 04:58:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649134698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=knSUcQsI7hPif5+ItylYPKTJlwUt42tiK3ZXa61iKp4=; b=s5aNbZWmbnm0Uzn7N6FE6jdptg6rb9myIJQq91VRIepvCtrJAuqLHzDjanrHvG44Zejua3 qYxms0/X0PDuIFMsr3UZn8wXvX9ceMaZykmhdF5i+NFKUO4A+UJNcjZ1hbLQ59EeRL8kVk ofXhUcUPBIH0m6Z+Qq6nciXHfQnTxcIc/GsKe9b9JYXpxM8r7v4zDVaaVdhQmaOdUoRvdO AdY2fGoV0umE5X/++/9xnbpwlMGcsLZv9hWqOHzlbYFaDWAYnwYgfC5iEqiVOD/BD0HFv/ cNoDKLAdSm6ohFLFhdjWH8IT/ueO3x53+O7wIuRLwECzeFJzqM7zYFHbra97Hw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01A6820215; Tue, 5 Apr 2022 04:58:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2354wHgQ037099; Tue, 5 Apr 2022 04:58:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2354wHhH037098; Tue, 5 Apr 2022 04:58:17 GMT (envelope-from git) Date: Tue, 5 Apr 2022 04:58:17 GMT Message-Id: <202204050458.2354wHhH037098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: aa61c28b4242 - stable/13 - linuxkpi: Restore the KBI for struct pci_driver List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa61c28b4242ce3f86f1ae7807ae95887cbe9d11 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649134698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=knSUcQsI7hPif5+ItylYPKTJlwUt42tiK3ZXa61iKp4=; b=DqHCMWP8qUh39AlBYfHo2oj1ahq6svZ9M4pGFJZxZPakmMgnjwdQypCx9/bIZxPoIz0K4L ZZ15zYh3RKOiUeFxFG/ZCkByG2erxY1B3rOuKO0R1VtTiB5n58l4tb2QXfG1YdaFusTSVh MSsbH21g8d6OWwWryS2QXGLtcLMXhBBpf7YIf00reTLwYgHDxgtVRiCo3byIiB6aN6N/jP 5eNHiE5+1PlJszMV8BO5aydhTlQCFCD8qBLWwmLBOS9BIY2Acfb54HNp+c60mEj1gwm9gt 0YnVUHrsCyamd5fg9itwPLGAKI+cdMZXS3jYwsS37EvqOR1DpdS7BPsj+O7kLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649134698; a=rsa-sha256; cv=none; b=Den/p5Zqkn+dsqKxPasPT/PbQvy5a92TYOZnW1NUT1k7W19L9zWlZ9rjGPCCBhYV77fbAH O75OrHwp0P+LmqC0JgpcwKHqVQoZkKmsEXhvbOusMtSWd1MaksBNgTfd6/VJZpzCxLpFes F9ng8S1aCSI9/uhLHPWfhRHNYoQjBSTn2h6pbceGwaOzNBXB1uEmSEtIG+R1wqiIzHqDer PKXfm2mQOKsh0seAZh2+Zz3dmDtSJpcx3iLylntfYP0AyKQhy34YDZCe8+uhaL598UfGXw 90EgUewYIBQjmvEZGb6io5Xu7dfHuanc7W+YBulqHHAI1NFlqdrbsxtmJ9SfhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=aa61c28b4242ce3f86f1ae7807ae95887cbe9d11 commit aa61c28b4242ce3f86f1ae7807ae95887cbe9d11 Author: Warner Losh AuthorDate: 2022-04-02 19:52:53 +0000 Commit: Warner Losh CommitDate: 2022-04-05 04:48:27 +0000 linuxkpi: Restore the KBI for struct pci_driver The size of the 13.0 version of struct pci_driver was 92 or 184 bytes on 32- or 64-bit systems respectively. We recently added bsd_probe_return at the end of this struct, breaking the KBI on the stable/13 branch. Fix this by removing the isdrm member. We don't need it because we can do a strcmp in the few places that need it as they aren't performance critical. Move the newly added bsd_probe_return to that slot. It's the same size in all our supported KBIs as bool and fits into that slot due to padding rules. Direct commit to stable/13 because this is not relevant to main. Sponsored by: Netflix Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D34754 --- sys/compat/linuxkpi/common/include/linux/pci.h | 3 +-- sys/compat/linuxkpi/common/src/linux_pci.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index eb5f46a4879c..7afe426d6b52 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -229,13 +229,12 @@ struct pci_driver { devclass_t bsdclass; struct device_driver driver; const struct pci_error_handlers *err_handler; - bool isdrm; + int bsd_probe_return; int (*bsd_iov_init)(device_t dev, uint16_t num_vfs, const nvlist_t *pf_config); void (*bsd_iov_uninit)(device_t dev); int (*bsd_iov_add_vf)(device_t dev, uint16_t vfnum, const nvlist_t *vf_config); - int bsd_probe_return; }; struct pci_bus { diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 0734acac60ac..0e952c17d7f7 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -119,6 +119,12 @@ struct linux_dma_priv { #define DMA_PRIV_LOCK(priv) mtx_lock(&(priv)->lock) #define DMA_PRIV_UNLOCK(priv) mtx_unlock(&(priv)->lock) +static bool +linux_is_drm(struct pci_driver *pdrv) +{ + return (pdrv->name != NULL && strcmp(pdrv->name, "drmn") == 0); +} + static int linux_pdev_dma_uninit(struct pci_dev *pdev) { @@ -405,7 +411,7 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, linux_set_current(curthread); parent = device_get_parent(dev); - isdrm = pdrv != NULL && pdrv->isdrm; + isdrm = pdrv != NULL && linux_is_drm(pdrv); if (isdrm) { struct pci_devinfo *dinfo; @@ -674,7 +680,6 @@ linux_pci_register_driver(struct pci_driver *pdrv) dc = devclass_find("pci"); if (dc == NULL) return (-ENXIO); - pdrv->isdrm = false; return (_linux_pci_register_driver(pdrv, dc)); } @@ -688,7 +693,7 @@ linux_pci_reserve_bar(struct pci_dev *pdev, struct resource_list *rl, KASSERT(type == SYS_RES_IOPORT || type == SYS_RES_MEMORY, ("trying to reserve non-BAR type %d", type)); - dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? + dev = pdev->pdrv != NULL && linux_is_drm(pdev->pdrv) ? device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; res = pci_reserve_map(device_get_parent(dev), dev, type, &rid, 0, ~0, 1, 1, 0); @@ -706,7 +711,7 @@ pci_resource_start(struct pci_dev *pdev, int bar) if ((rle = linux_pci_get_bar(pdev, bar, true)) == NULL) return (0); - dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? + dev = pdev->pdrv != NULL && linux_is_drm(pdev->pdrv) ? device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; if (BUS_TRANSLATE_RESOURCE(dev, rle->type, rle->start, &newstart)) { device_printf(pdev->dev.bsddev, "translate of %#jx failed\n", @@ -734,7 +739,6 @@ linux_pci_register_drm_driver(struct pci_driver *pdrv) dc = devclass_create("vgapci"); if (dc == NULL) return (-ENXIO); - pdrv->isdrm = true; pdrv->name = "drmn"; return (_linux_pci_register_driver(pdrv, dc)); }