Skip to content

Commit c305a4e

Browse files
JoelgranadosIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e8f925c commit c305a4e

File tree

5 files changed

+67
-59
lines changed

5 files changed

+67
-59
lines changed

arch/x86/include/asm/setup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ void setup_bios_corruption_check(void);
4646
void early_platform_quirks(void);
4747

4848
extern unsigned long saved_video_mode;
49+
extern unsigned long acpi_realmode_flags;
4950

5051
extern void reserve_standard_io_resources(void);
5152
extern void i386_reserve_resources(void);

arch/x86/include/asm/traps.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ static inline int get_si_code(unsigned long condition)
3535
return TRAP_BRKPT;
3636
}
3737

38-
extern int panic_on_unrecovered_nmi;
39-
4038
void math_emulate(struct math_emu_info *);
4139

4240
bool fault_in_kernel_space(unsigned long address);

arch/x86/kernel/setup.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
#include <asm/unwind.h>
5757
#include <asm/vsyscall.h>
5858
#include <linux/vmalloc.h>
59+
#if defined(CONFIG_X86_LOCAL_APIC)
60+
#include <asm/nmi.h>
61+
#endif
5962

6063
/*
6164
* max_low_pfn_mapped: highest directly mapped pfn < 4 GB
@@ -146,6 +149,69 @@ static size_t ima_kexec_buffer_size;
146149
/* Boot loader ID and version as integers, for the benefit of proc_dointvec */
147150
int bootloader_type, bootloader_version;
148151

152+
static const struct ctl_table x86_sysctl_table[] = {
153+
{
154+
.procname = "panic_on_unrecovered_nmi",
155+
.data = &panic_on_unrecovered_nmi,
156+
.maxlen = sizeof(int),
157+
.mode = 0644,
158+
.proc_handler = proc_dointvec,
159+
},
160+
{
161+
.procname = "panic_on_io_nmi",
162+
.data = &panic_on_io_nmi,
163+
.maxlen = sizeof(int),
164+
.mode = 0644,
165+
.proc_handler = proc_dointvec,
166+
},
167+
{
168+
.procname = "bootloader_type",
169+
.data = &bootloader_type,
170+
.maxlen = sizeof(int),
171+
.mode = 0444,
172+
.proc_handler = proc_dointvec,
173+
},
174+
{
175+
.procname = "bootloader_version",
176+
.data = &bootloader_version,
177+
.maxlen = sizeof(int),
178+
.mode = 0444,
179+
.proc_handler = proc_dointvec,
180+
},
181+
{
182+
.procname = "io_delay_type",
183+
.data = &io_delay_type,
184+
.maxlen = sizeof(int),
185+
.mode = 0644,
186+
.proc_handler = proc_dointvec,
187+
},
188+
#if defined(CONFIG_X86_LOCAL_APIC)
189+
{
190+
.procname = "unknown_nmi_panic",
191+
.data = &unknown_nmi_panic,
192+
.maxlen = sizeof(int),
193+
.mode = 0644,
194+
.proc_handler = proc_dointvec,
195+
},
196+
#endif
197+
#if defined(CONFIG_ACPI_SLEEP)
198+
{
199+
.procname = "acpi_video_flags",
200+
.data = &acpi_realmode_flags,
201+
.maxlen = sizeof(unsigned long),
202+
.mode = 0644,
203+
.proc_handler = proc_doulongvec_minmax,
204+
},
205+
#endif
206+
};
207+
208+
static int __init init_x86_sysctl(void)
209+
{
210+
register_sysctl_init("kernel", x86_sysctl_table);
211+
return 0;
212+
}
213+
arch_initcall(init_x86_sysctl);
214+
149215
/*
150216
* Setup options
151217
*/

include/linux/acpi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ static inline bool acpi_sci_irq_valid(void)
330330
}
331331

332332
extern int sbf_port;
333-
extern unsigned long acpi_realmode_flags;
334333

335334
int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
336335
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);

kernel/sysctl.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,16 +1831,6 @@ static const struct ctl_table kern_table[] = {
18311831
.mode = 0444,
18321832
.proc_handler = proc_dointvec,
18331833
},
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-
18441834
#if (defined(CONFIG_X86_32) || defined(CONFIG_PARISC)) && \
18451835
defined(CONFIG_DEBUG_STACKOVERFLOW)
18461836
{
@@ -1851,43 +1841,6 @@ static const struct ctl_table kern_table[] = {
18511841
.proc_handler = proc_dointvec,
18521842
},
18531843
#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-
.maxlen = sizeof(int),
1887-
.mode = 0644,
1888-
.proc_handler = proc_dointvec,
1889-
},
1890-
#endif
18911844
#if defined(CONFIG_MMU)
18921845
{
18931846
.procname = "randomize_va_space",
@@ -1906,15 +1859,6 @@ static const struct ctl_table kern_table[] = {
19061859
.proc_handler = proc_dointvec,
19071860
},
19081861
#endif
1909-
#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1910-
{
1911-
.procname = "acpi_video_flags",
1912-
.data = &acpi_realmode_flags,
1913-
.maxlen = sizeof (unsigned long),
1914-
.mode = 0644,
1915-
.proc_handler = proc_doulongvec_minmax,
1916-
},
1917-
#endif
19181862
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
19191863
{
19201864
.procname = "ignore-unaligned-usertrap",

0 commit comments

Comments
 (0)