aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-09-22 14:47:12 +0000
committerWarner Losh <imp@FreeBSD.org>2021-09-22 15:00:16 +0000
commit0437d10e359ea1cbefff8d17cd18ca491dbbd5d7 (patch)
tree9dec62cf8c25b3a9e0b0e9015161c0dd99a72607
parent5d8f8ab1eb4026446883bd0a353d14d8e1175939 (diff)
downloadsrc-0437d10e359ea1cbefff8d17cd18ca491dbbd5d7.tar.gz
src-0437d10e359ea1cbefff8d17cd18ca491dbbd5d7.zip
direct commit: fix KBI for pci_dev
Move all the new elemenets to the end of the structure for 13. We allocate this inside the linuxkpi code, so the size isn't enccoded in client modules. However, the offsets to the different fields are encoded. Tihs modifies 04456f711853, 40a215e38a4d, and 3a606aadf2e7 and will likely create merge conflicts there (and that's a good thing since the elements need to be moved to the end of the structure when merging). Tweak irq_ent to be binary compatible. Since this is inlined into the clients, all clients have to agree on the irq_ent offsets. Restore visibility to linux_kmem_cache_free_rcu linux_kmem_cache_free_rcu was made static in 10235ad0567f, however client drivers depended on calling it directly. Make it visible again to restore the 13.0-Release KBI for linuxkpi. Bump FreeBSD_version to 1300515 for restoration of 13.0 KBI. Since this commmit changes the linuxkpi KBI (this time back to 13.0 release to restore the status quo of), you'll need to recompile everything that uses it (you needed to earlier as well, but those were silent recompilation events). The plus side is that our packages (built using 13.0) for drm-kmod 5.4 work again on -stable systems. Reviewed by: bz, wulf Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31363
-rw-r--r--sys/compat/linuxkpi/common/include/linux/interrupt.h4
-rw-r--r--sys/compat/linuxkpi/common/include/linux/pci.h16
-rw-r--r--sys/compat/linuxkpi/common/include/linux/slab.h2
-rw-r--r--sys/compat/linuxkpi/common/src/linux_slab.c8
-rw-r--r--sys/sys/param.h2
5 files changed, 20 insertions, 12 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h
index 6770adad2293..066157f9b559 100644
--- a/sys/compat/linuxkpi/common/include/linux/interrupt.h
+++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h
@@ -52,9 +52,11 @@ struct irq_ent {
struct resource *res;
void *arg;
irqreturn_t (*handler)(int, void *);
- irqreturn_t (*thread_handler)(int, void *);
void *tag;
unsigned int irq;
+
+ /* XXX All new entries must be after this in stable/13 */
+ irqreturn_t (*thread_handler)(int, void *);
};
void linux_irq_handler(void *);
diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 4784799d82b5..1ec7fe75388d 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -237,7 +237,6 @@ struct pci_dev {
struct list_head links;
struct pci_driver *pdrv;
struct pci_bus *bus;
- struct pci_dev *root;
uint16_t device;
uint16_t vendor;
uint16_t subsystem_vendor;
@@ -246,16 +245,21 @@ struct pci_dev {
unsigned int devfn;
uint32_t class;
uint8_t revision;
- bool managed; /* devres "pcim_*(). */
- bool want_iomap_res;
bool msi_enabled;
- bool msix_enabled;
- phys_addr_t rom;
- size_t romlen;
TAILQ_HEAD(, pci_mmio_region) mmio;
+
+ /* Add all new items at the end of the list in 13 */
+ struct pci_dev *root;
+ phys_addr_t rom;
+ size_t romlen;
+ bool managed; /* devres "pcim_*(). */
+ bool want_iomap_res;
+ bool msix_enabled;
};
+/* XXX add kassert here on the mmio offset */
+
/* We need some meta-struct to keep track of these for devres. */
struct pci_devres {
bool enable_io;
diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h
index ecd39d711eb4..23ba8b9c8ae7 100644
--- a/sys/compat/linuxkpi/common/include/linux/slab.h
+++ b/sys/compat/linuxkpi/common/include/linux/slab.h
@@ -210,5 +210,7 @@ extern void *lkpi_kmem_cache_zalloc(struct linux_kmem_cache *, gfp_t);
extern void lkpi_kmem_cache_free(struct linux_kmem_cache *, void *);
extern void linux_kmem_cache_destroy(struct linux_kmem_cache *);
void linux_kfree_async(void *);
+void linux_kmem_cache_free_rcu_callback(struct rcu_head *head);
+void linux_kmem_cache_free_rcu(struct linux_kmem_cache *, void *);
#endif /* _LINUX_SLAB_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_slab.c b/sys/compat/linuxkpi/common/src/linux_slab.c
index 5dbd87b66d1a..35a88fd7cf42 100644
--- a/sys/compat/linuxkpi/common/src/linux_slab.c
+++ b/sys/compat/linuxkpi/common/src/linux_slab.c
@@ -96,7 +96,7 @@ linux_kmem_ctor(void *mem, int size, void *arg, int flags)
return (0);
}
-static void
+void
linux_kmem_cache_free_rcu_callback(struct rcu_head *head)
{
struct linux_kmem_rcu *rcu =
@@ -145,8 +145,8 @@ linux_kmem_cache_create(const char *name, size_t size, size_t align,
return (c);
}
-static inline void
-lkpi_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m)
+void
+linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, void *m)
{
struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, m);
@@ -183,7 +183,7 @@ void
lkpi_kmem_cache_free(struct linux_kmem_cache *c, void *m)
{
if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU))
- lkpi_kmem_cache_free_rcu(c, m);
+ linux_kmem_cache_free_rcu(c, m);
else if (unlikely(curthread->td_critnest != 0))
lkpi_kmem_cache_free_async(c, m);
else
diff --git a/sys/sys/param.h b/sys/sys/param.h
index ef5eb4206706..c1066baa59f2 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1300514 /* Master, propagated to newvers */
+#define __FreeBSD_version 1300515 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,