diff options
author | Warner Losh <imp@FreeBSD.org> | 2022-04-05 04:54:49 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2022-04-05 04:54:49 +0000 |
commit | 86d5c66106610f083deda03ce0c661a51b2dd723 (patch) | |
tree | 6873b67e83b4d301dc65cee0fdcf4b03de82f0ae | |
parent | aa61c28b4242ce3f86f1ae7807ae95887cbe9d11 (diff) | |
download | src-86d5c66106610f083deda03ce0c661a51b2dd723.tar.gz src-86d5c66106610f083deda03ce0c661a51b2dd723.zip |
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
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/pci.h | 19 |
1 files changed, 19 insertions, 0 deletions
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; |