mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 06:34:11 +08:00
18280edafe
For para-virtualized guests running under KVM or other equivalent hypervisor. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com> Cc: linux-mips@linux-mips.org Cc: James Hogan <james.hogan@imgtec.com> Cc: kvm@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7004/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
68 lines
1.3 KiB
C
68 lines
1.3 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 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)
|
|
{
|
|
}
|