KVM: MIPS: Add CPUCFG emulation for Loongson-3
Loongson-3 overrides lwc2 instructions to implement CPUCFG and CSR read/write functions. These instructions all cause guest exit so CSR doesn't benifit KVM guest (and there are always legacy methods to provide the same functions as CSR). So, we only emulate CPUCFG and let it return a reduced feature list (which means the virtual CPU doesn't have any other advanced features, including CSR) in KVM. Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> Signed-off-by: Huacai Chen <chenhc@lemote.com> Co-developed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Message-Id: <1590220602-3547-12-git-send-email-chenhc@lemote.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
f21db3090d
commit
7f2a83f1c2
@@ -1012,6 +1012,16 @@ struct loongson3_lsdc2_format { /* Loongson-3 overridden ldc2/sdc2 Load/Store fo
|
||||
;))))))
|
||||
};
|
||||
|
||||
struct loongson3_lscsr_format { /* Loongson-3 CPUCFG&CSR read/write format */
|
||||
__BITFIELD_FIELD(unsigned int opcode : 6,
|
||||
__BITFIELD_FIELD(unsigned int rs : 5,
|
||||
__BITFIELD_FIELD(unsigned int fr : 5,
|
||||
__BITFIELD_FIELD(unsigned int rd : 5,
|
||||
__BITFIELD_FIELD(unsigned int fd : 5,
|
||||
__BITFIELD_FIELD(unsigned int func : 6,
|
||||
;))))))
|
||||
};
|
||||
|
||||
/*
|
||||
* MIPS16e instruction formats (16-bit length)
|
||||
*/
|
||||
@@ -1114,6 +1124,7 @@ union mips_instruction {
|
||||
struct mm16_r5_format mm16_r5_format;
|
||||
struct loongson3_lswc2_format loongson3_lswc2_format;
|
||||
struct loongson3_lsdc2_format loongson3_lsdc2_format;
|
||||
struct loongson3_lscsr_format loongson3_lscsr_format;
|
||||
};
|
||||
|
||||
union mips16e_instruction {
|
||||
|
||||
Reference in New Issue
Block a user