Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F173733342
D37223.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D37223.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/cpu.h b/sys/compat/linuxkpi/common/include/linux/cpu.h
--- a/sys/compat/linuxkpi/common/include/linux/cpu.h
+++ b/sys/compat/linuxkpi/common/include/linux/cpu.h
@@ -44,6 +44,8 @@
extern cpumask_t cpu_online_mask;
+cpumask_t *lkpi_get_static_single_cpu_mask(int);
+
static __inline int
cpumask_next(int cpuid, cpumask_t mask)
{
@@ -73,4 +75,6 @@
CPU_SET(cpu, mask);
}
+#define cpumask_of(_cpu) (lkpi_get_static_single_cpu_mask(_cpu))
+
#endif /* _LINUXKPI_LINUX_CPU_H */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -132,6 +132,7 @@
static struct vm_area_struct *linux_cdev_handle_find(void *handle);
cpumask_t cpu_online_mask;
+static cpumask_t static_single_cpu_mask[MAXCPU];
struct kobject linux_class_root;
struct device linux_root_device;
struct class linux_class_misc;
@@ -2734,6 +2735,16 @@
struct cpuinfo_x86 boot_cpu_data;
#endif
+cpumask_t *
+lkpi_get_static_single_cpu_mask(int cpuid)
+{
+
+ KASSERT((cpuid >= 0 && cpuid < MAXCPU), ("%s: invalid cpuid %d\n",
+ __func__, cpuid));
+
+ return (&static_single_cpu_mask[cpuid]);
+}
+
static void
linux_compat_init(void *arg)
{
@@ -2771,6 +2782,15 @@
init_waitqueue_head(&linux_var_waitq);
CPU_COPY(&all_cpus, &cpu_online_mask);
+ /*
+ * Generate a single-CPU cpumask_t for each CPU (possibly) in the system.
+ * CPUs are indexed from 0..(MAXCPU-1). The entry for cpuid 0 will only
+ * have itself in the cpumask, cupid 1 only itself on entry 1, and so on.
+ * This is used by cpumask_of() (and possibly others in the future) for,
+ * e.g., drivers to pass hints to irq_set_affinity_hint().
+ */
+ for (i = 0; i < MAXCPU; i++)
+ CPU_SET(i, &static_single_cpu_mask[i]);
}
SYSINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_init, NULL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 29, 12:41 AM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39845961
Default Alt Text
D37223.diff (1 KB)
Attached To
Mode
D37223: LinuxKPI: implement cpumask_of()
Attached
Detach File
Event Timeline
Log In to Comment