mirror of
https://github.com/torvalds/linux.git
synced 2026-11-26 16:33:17 +00:00
smp_ops providers do not modify their ops structures, so they should be made const for robustness. Since currently the MIPS kernel is not mapped with memory protection, this does not in itself provide any security benefit, but it still makes sense to make this change. There are also slight code size efficincies from the structure being made read-only, saving 128 bytes of kernel text on a pistachio_defconfig. Before: text data bss dec hex filename 7187239 1772752 470224 9430215 8fe4c7 vmlinux After: text data bss dec hex filename 7187111 1772752 470224 9430087 8fe447 vmlinux Signed-off-by: Matt Redfearn <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Marcin Nowakowski <[email protected]> Cc: Bart Van Assche <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Kevin Cernekee <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Doug Ledford <[email protected]> Cc: James Hogan <[email protected]> Cc: Joe Perches <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Paul Burton <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Steven J. Hill <[email protected]> Cc: [email protected] Cc: [email protected] Patchwork: https://patchwork.linux-mips.org/patch/16784/ Signed-off-by: Ralf Baechle <[email protected]>
68 lines
1.4 KiB
C
68 lines
1.4 KiB
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2013 Cavium, Inc.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/kvm_para.h>
|
|
|
|
#include <asm/reboot.h>
|
|
#include <asm/bootinfo.h>
|
|
#include <asm/smp-ops.h>
|
|
#include <asm/time.h>
|
|
|
|
extern const struct plat_smp_ops paravirt_smp_ops;
|
|
|
|
const char *get_system_type(void)
|
|
{
|
|
return "MIPS Para-Virtualized Guest";
|
|
}
|
|
|
|
void __init plat_time_init(void)
|
|
{
|
|
mips_hpt_frequency = kvm_hypercall0(KVM_HC_MIPS_GET_CLOCK_FREQ);
|
|
|
|
preset_lpj = mips_hpt_frequency / (2 * HZ);
|
|
}
|
|
|
|
static void pv_machine_halt(void)
|
|
{
|
|
kvm_hypercall0(KVM_HC_MIPS_EXIT_VM);
|
|
}
|
|
|
|
/*
|
|
* Early entry point for arch setup
|
|
*/
|
|
void __init prom_init(void)
|
|
{
|
|
int i;
|
|
int argc = fw_arg0;
|
|
char **argv = (char **)fw_arg1;
|
|
|
|
#ifdef CONFIG_32BIT
|
|
set_io_port_base(KSEG1ADDR(0x1e000000));
|
|
#else /* CONFIG_64BIT */
|
|
set_io_port_base(PHYS_TO_XKSEG_UNCACHED(0x1e000000));
|
|
#endif
|
|
|
|
for (i = 0; i < argc; i++) {
|
|
strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
|
|
if (i < argc - 1)
|
|
strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
|
|
}
|
|
_machine_halt = pv_machine_halt;
|
|
register_smp_ops(¶virt_smp_ops);
|
|
}
|
|
|
|
void __init plat_mem_setup(void)
|
|
{
|
|
/* Do nothing, the "mem=???" parser handles our memory. */
|
|
}
|
|
|
|
void __init prom_free_prom_memory(void)
|
|
{
|
|
}
|