Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86: Move sysctls into arch/x86

Move the following sysctl tables into arch/x86/kernel/setup.c:

panic_on_{unrecoverable_nmi,io_nmi}
bootloader_{type,version}
io_delay_type
unknown_nmi_panic
acpi_realmode_flags

Variables moved from include/linux/ to arch/x86/include/asm/ because there
is no longer need for them outside arch/x86/kernel:

acpi_realmode_flags
panic_on_{unrecoverable_nmi,io_nmi}

Include <asm/nmi.h> in arch/s86/kernel/setup.h in order to bring in
panic_on_{io_nmi,unrecovered_nmi}.

This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kerenel/sysctl.c.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250218-jag-mv_ctltables-v1-8-cd3698ab8d29@kernel.org

authored by

Joel Granados and committed by
Ingo Molnar
c305a4e9 e8f925c3

+67 -59
+1
arch/x86/include/asm/setup.h
··· 46 46 void early_platform_quirks(void); 47 47 48 48 extern unsigned long saved_video_mode; 49 + extern unsigned long acpi_realmode_flags; 49 50 50 51 extern void reserve_standard_io_resources(void); 51 52 extern void i386_reserve_resources(void);
-2
arch/x86/include/asm/traps.h
··· 35 35 return TRAP_BRKPT; 36 36 } 37 37 38 - extern int panic_on_unrecovered_nmi; 39 - 40 38 void math_emulate(struct math_emu_info *); 41 39 42 40 bool fault_in_kernel_space(unsigned long address);
+66
arch/x86/kernel/setup.c
··· 56 56 #include <asm/unwind.h> 57 57 #include <asm/vsyscall.h> 58 58 #include <linux/vmalloc.h> 59 + #if defined(CONFIG_X86_LOCAL_APIC) 60 + #include <asm/nmi.h> 61 + #endif 59 62 60 63 /* 61 64 * max_low_pfn_mapped: highest directly mapped pfn < 4 GB ··· 148 145 149 146 /* Boot loader ID and version as integers, for the benefit of proc_dointvec */ 150 147 int bootloader_type, bootloader_version; 148 + 149 + static const struct ctl_table x86_sysctl_table[] = { 150 + { 151 + .procname = "panic_on_unrecovered_nmi", 152 + .data = &panic_on_unrecovered_nmi, 153 + .maxlen = sizeof(int), 154 + .mode = 0644, 155 + .proc_handler = proc_dointvec, 156 + }, 157 + { 158 + .procname = "panic_on_io_nmi", 159 + .data = &panic_on_io_nmi, 160 + .maxlen = sizeof(int), 161 + .mode = 0644, 162 + .proc_handler = proc_dointvec, 163 + }, 164 + { 165 + .procname = "bootloader_type", 166 + .data = &bootloader_type, 167 + .maxlen = sizeof(int), 168 + .mode = 0444, 169 + .proc_handler = proc_dointvec, 170 + }, 171 + { 172 + .procname = "bootloader_version", 173 + .data = &bootloader_version, 174 + .maxlen = sizeof(int), 175 + .mode = 0444, 176 + .proc_handler = proc_dointvec, 177 + }, 178 + { 179 + .procname = "io_delay_type", 180 + .data = &io_delay_type, 181 + .maxlen = sizeof(int), 182 + .mode = 0644, 183 + .proc_handler = proc_dointvec, 184 + }, 185 + #if defined(CONFIG_X86_LOCAL_APIC) 186 + { 187 + .procname = "unknown_nmi_panic", 188 + .data = &unknown_nmi_panic, 189 + .maxlen = sizeof(int), 190 + .mode = 0644, 191 + .proc_handler = proc_dointvec, 192 + }, 193 + #endif 194 + #if defined(CONFIG_ACPI_SLEEP) 195 + { 196 + .procname = "acpi_video_flags", 197 + .data = &acpi_realmode_flags, 198 + .maxlen = sizeof(unsigned long), 199 + .mode = 0644, 200 + .proc_handler = proc_doulongvec_minmax, 201 + }, 202 + #endif 203 + }; 204 + 205 + static int __init init_x86_sysctl(void) 206 + { 207 + register_sysctl_init("kernel", x86_sysctl_table); 208 + return 0; 209 + } 210 + arch_initcall(init_x86_sysctl); 151 211 152 212 /* 153 213 * Setup options
-1
include/linux/acpi.h
··· 330 330 } 331 331 332 332 extern int sbf_port; 333 - extern unsigned long acpi_realmode_flags; 334 333 335 334 int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); 336 335 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
-56
kernel/sysctl.c
··· 1831 1831 .mode = 0444, 1832 1832 .proc_handler = proc_dointvec, 1833 1833 }, 1834 - #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 1835 - { 1836 - .procname = "unknown_nmi_panic", 1837 - .data = &unknown_nmi_panic, 1838 - .maxlen = sizeof (int), 1839 - .mode = 0644, 1840 - .proc_handler = proc_dointvec, 1841 - }, 1842 - #endif 1843 - 1844 1834 #if (defined(CONFIG_X86_32) || defined(CONFIG_PARISC)) && \ 1845 1835 defined(CONFIG_DEBUG_STACKOVERFLOW) 1846 1836 { 1847 1837 .procname = "panic_on_stackoverflow", 1848 1838 .data = &sysctl_panic_on_stackoverflow, 1849 - .maxlen = sizeof(int), 1850 - .mode = 0644, 1851 - .proc_handler = proc_dointvec, 1852 - }, 1853 - #endif 1854 - #if defined(CONFIG_X86) 1855 - { 1856 - .procname = "panic_on_unrecovered_nmi", 1857 - .data = &panic_on_unrecovered_nmi, 1858 - .maxlen = sizeof(int), 1859 - .mode = 0644, 1860 - .proc_handler = proc_dointvec, 1861 - }, 1862 - { 1863 - .procname = "panic_on_io_nmi", 1864 - .data = &panic_on_io_nmi, 1865 - .maxlen = sizeof(int), 1866 - .mode = 0644, 1867 - .proc_handler = proc_dointvec, 1868 - }, 1869 - { 1870 - .procname = "bootloader_type", 1871 - .data = &bootloader_type, 1872 - .maxlen = sizeof (int), 1873 - .mode = 0444, 1874 - .proc_handler = proc_dointvec, 1875 - }, 1876 - { 1877 - .procname = "bootloader_version", 1878 - .data = &bootloader_version, 1879 - .maxlen = sizeof (int), 1880 - .mode = 0444, 1881 - .proc_handler = proc_dointvec, 1882 - }, 1883 - { 1884 - .procname = "io_delay_type", 1885 - .data = &io_delay_type, 1886 1839 .maxlen = sizeof(int), 1887 1840 .mode = 0644, 1888 1841 .proc_handler = proc_dointvec, ··· 1857 1904 .maxlen = sizeof (int), 1858 1905 .mode = 0644, 1859 1906 .proc_handler = proc_dointvec, 1860 - }, 1861 - #endif 1862 - #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 1863 - { 1864 - .procname = "acpi_video_flags", 1865 - .data = &acpi_realmode_flags, 1866 - .maxlen = sizeof (unsigned long), 1867 - .mode = 0644, 1868 - .proc_handler = proc_doulongvec_minmax, 1869 1907 }, 1870 1908 #endif 1871 1909 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN