From nobody Tue Apr 05 04:58:19 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 7F1071AA10CC; Tue, 5 Apr 2022 04:58:19 +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 4KXb4q2HrBz3MH7; Tue, 5 Apr 2022 04:58:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649134699; 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=6ZknDViTt5NXJANeSqUGqRKOuXjCpttJS2NHrSBc0h0=; b=trEM2WpJwvG8nBqg5KqUWP7JV37PpUG5AvWD0TObP5mLRdKvoy+piEl7xeowA7QqyDmTo+ C/aNVyxj4oG9jqPpglxpnXJv1qMCFcOMU/UrFA97ePpLKmM+2APnMpV0UhFfh1sGe6RxEP PAMo+XEIxoQYjOIFepOk7XW/YjQqyf9YqGWCnNC8vInyyqK8ZsrA6jpzXLwiv1GIlxxczo t9MyfKakTXp6CffyOHkklkNoIAOLaBQI2XacfFyey8e7P7KyTXvqY7tV+pvjGFUKyp7HYR Q+byg/NMM2XJ7C4rvzZUMf3wubuxpGxzmx1WQAM1R7IhuQ4nuib9i5iwg8IsAA== 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 21E1B20216; Tue, 5 Apr 2022 04:58:19 +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 2354wJst037123; Tue, 5 Apr 2022 04:58:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2354wJnQ037122; Tue, 5 Apr 2022 04:58:19 GMT (envelope-from git) Date: Tue, 5 Apr 2022 04:58:19 GMT Message-Id: <202204050458.2354wJnQ037122@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: 86d5c6610661 - stable/13 - linuxkpi: add padding to 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: 86d5c66106610f083deda03ce0c661a51b2dd723 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649134699; 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=6ZknDViTt5NXJANeSqUGqRKOuXjCpttJS2NHrSBc0h0=; b=sacnyUXRCUUIFF4ZPa5ld0ERen+Fef1MlcCALx2Mx+zx5cG8MaKiv3WyCssYriz/SwDdh/ Iuz/++9iYj2fB/Q3IWsHNcagp/h9sihwvC57OHhv90yjzSmFaASojOyQPB1apNHlkA//iV mCOVLRZtnrC+cSRIJofnY294UIhAii2/ZpwQ0WTrYj2EvYEEpDIGlKslAn6p+boDyzDzc9 DLjp9ubGnNnLOqLvL3Rz7/57HAEieSqUt0tMSF1ZJ+J+QLjfPL83YUCyJsK2HSxK8p4cA2 4uhvms4hf1vWNhmS4HQtZPfRIJ2R/svdaURAh+gTJrVBK8vizu3WqOS8O3maPQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649134699; a=rsa-sha256; cv=none; b=qOoQl86KbcDaoJJuXXxDDIpQqDP3DkA2amiJx1vnOaJLSvsdp+DRk39gb5lBh/eaCp0Wn/ 4clibrY5W01Kf9yh7DQLVFypBu+4H4ByNTbTkNG9zeL7NzWKMA1A6zXWb9tlsr74PGnH79 VZEM3QnT7A7Qc8k6BypLzhSmHhpLhJ46evFv2jwLD0N69kakmob1h3ILcIXTt4PTSMfYA6 Fp0bPjQ4J6vaqc2HUDMcwbJWP0lzKD246zb0ZNlPVB/HUOJUsRcmr6JProSvN+G9hR3aUH lmoQtwM+S7SnFnd1kmvMhOy4McLKtK63zpu+VHjuylf7PVHj7+LbkwdaNjGAbQ== 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=86d5c66106610f083deda03ce0c661a51b2dd723 commit 86d5c66106610f083deda03ce0c661a51b2dd723 Author: Warner Losh AuthorDate: 2022-04-05 04:54:49 +0000 Commit: Warner Losh CommitDate: 2022-04-05 04:54:49 +0000 linuxkpi: add padding to struct pci_driver Add 32 or 64 bytes of padding to struct pci_driver at the end in the _spare field like we should have done when we branched stable/13, but neglected to do so since we didn't properly anticipate the need. We cannot safely use these spare fields until after 13.0 EOL since drivers compiled on 13.0 won't have that space reserved and we'll step on something else using them. This isn't 100% KBI compatible through the 13.x release branch, but is compatible enough so that drm packages built on the oldest supported release will work on the latest stable/13 and any newer releases. It's not ideal, but makes the best of a bad situation and is a pragmatic approach that belatedly builds in some future proofing. Direct commit to stable/13 because this is not relevant to main in this exact form. Sponsored by: Netflix Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D34754 --- sys/compat/linuxkpi/common/include/linux/pci.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 7afe426d6b52..c4d30a6e293a 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -235,8 +235,27 @@ struct pci_driver { void (*bsd_iov_uninit)(device_t dev); int (*bsd_iov_add_vf)(device_t dev, uint16_t vfnum, const nvlist_t *vf_config); + uintptr_t _spare[8]; }; +/* + * Pseudo-stable KPI. In 13.0 we neglected to include any spare fields to allow + * for growth in struct pci_driver. Those were added in 13.1, but can't be used + * until 13.1 is the oldest supported release so that packages built in 13.0 + * will continue to work on stable/13 and 13.1 release. The 13.0 driver was 92 + * or 182 bytes on 32 or 64 bit systems (respectively). We added 64 or 32 bytes + * of padding, hence the math below (which shouldn't be changed as spare fields + * are used up). + */ +#ifdef __LP64__ +#define __PCI_DRIVER_SIZE (184 + 64) +#else +#define __PCI_DRIVER_SIZE (92 + 32) +#endif +_Static_assert(sizeof(struct pci_driver) == __PCI_DRIVER_SIZE, + "linuxkpi struct pci_driver: Bad size"); +#undef __PCI_DRIVER_SIZE + struct pci_bus { struct pci_dev *self; int domain;