From nobody Wed Apr 06 17:46:02 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 3AF971AA610D; Wed, 6 Apr 2022 17:46:03 +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 4KYX4B6W74z3DM6; Wed, 6 Apr 2022 17:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267163; 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=Hyd6mtXgPFCr6C2e7hoYoOlZTBHkJipOkLPxCRPVEIE=; b=g/WStesSZ+BEh5EmHxLZdM3/3yFUlFtBTI0GbSd2qZbTzqgGo9tVQsdEenaJtpZHt2QW4C WOsRI8Zgvvnpfmz3QgzSU9FZa2WeVzeogeeyqXRSkv5k/hVqwpdiL4XZe4DdVPlrKTuvFx Jmx8pnmMYmIPvYvsPOPOUYsmOB9KT80E1EK0eyMk7Fws5m+Rp1xTaU2Xq6MA4tXwcDJAL/ QPrKDDOuBN36rdBvccnk2oUi5EvmgKbPYFFAMYMfEVr4R/8HfoAJ0XpZ8b21JtZY7TRojp VNvS8WlG7IShuqtUxi+CP8pWzmMW/4T5MhdpqT4dw3JSj1LrTko/irgfEcSlOw== 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 6F9811F76A; Wed, 6 Apr 2022 17:46:02 +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 236Hk2SO022554; Wed, 6 Apr 2022 17:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236Hk2uT022553; Wed, 6 Apr 2022 17:46:02 GMT (envelope-from git) Date: Wed, 6 Apr 2022 17:46:02 GMT Message-Id: <202204061746.236Hk2uT022553@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: 0e2ae559a147 - releng/13.1 - 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 0e2ae559a147fd3fe830d343c1cc40bb9a6650ec Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267163; 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=Hyd6mtXgPFCr6C2e7hoYoOlZTBHkJipOkLPxCRPVEIE=; b=sw7VjBIDvv3RXKtPBC2Q9tkZ66R4So0NRn90feegLhFDaXwKs/6tmRjXKkF4wW7+MDlxsy XmnsbksCSdVi/PVmnBrMfaPPgKdn381MLInx+1qGkfAD6tXml5N7x8AKD2JWx29gr+OtBN DUgeOe9cZqgvJImC70EcBsj7FzuhnxXllX+qY1OgpTWelh3WzMP2KJxymI3/mSTRJL7ygW 9mCXpqUOWUC6jsPkfcikyBnVU96M67dP7rv1zFz5gunVxUEQ9s3dl7Ut2oj2NiZcv2E2sa zxFI79dxIbYpklPf1bNZqebzXeQTCbDnp0CdYRUdgu2qDYKzvoW90Z/LOMUzOA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649267163; a=rsa-sha256; cv=none; b=Rgh1DzrKuXoXtArUmXUEylKj+maWvQp48rRD4GDvLedoduqqYqpvfNOWWIg1ejnogMYqR1 0YgHyrhAk5hYSSx/9rJwUECkiVG/Sf7dcFfdXxL85yh6NAfJF/NwDT7QBCKmUpGs+fhLBk Cr82jwMVvJn6+ORBG3HSWUYfxQHChipdwqY6H6oeEkwSByVz5BRcsx5rCV7S8tJeP9ZG+P 8zfKMaCXkUDiTTcXP4a8tvrcclKov7jg93/v7lvQSCbjMEv/Nwz7XnL65mPHYLkEJ5sTkb g4bU7tsPgoYucVcs4xAfwFZeZ3OmBtEeC4ABCblbzXW3CZOTRmcr6XLzvgxt+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0e2ae559a147fd3fe830d343c1cc40bb9a6650ec commit 0e2ae559a147fd3fe830d343c1cc40bb9a6650ec Author: Warner Losh AuthorDate: 2022-04-05 04:54:49 +0000 Commit: Warner Losh CommitDate: 2022-04-06 17:45:10 +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. Approved by: re@ (gjb) Sponsored by: Netflix Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D34754 (cherry picked from commit 86d5c66106610f083deda03ce0c661a51b2dd723) --- 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;