KVM: PPC: BOOK3S: Remove open coded make_dsisr in alignment handler
Use make_dsisr instead of open coding it. This also have the added benefit of handling alignment interrupt on additional instructions. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:

committed by
Alexander Graf

parent
7310f3a5b0
commit
ddca156ae6
@@ -81,4 +81,38 @@ static inline unsigned int get_oc(u32 inst)
|
||||
{
|
||||
return (inst >> 11) & 0x7fff;
|
||||
}
|
||||
|
||||
#define IS_XFORM(inst) (get_op(inst) == 31)
|
||||
#define IS_DSFORM(inst) (get_op(inst) >= 56)
|
||||
|
||||
/*
|
||||
* Create a DSISR value from the instruction
|
||||
*/
|
||||
static inline unsigned make_dsisr(unsigned instr)
|
||||
{
|
||||
unsigned dsisr;
|
||||
|
||||
|
||||
/* bits 6:15 --> 22:31 */
|
||||
dsisr = (instr & 0x03ff0000) >> 16;
|
||||
|
||||
if (IS_XFORM(instr)) {
|
||||
/* bits 29:30 --> 15:16 */
|
||||
dsisr |= (instr & 0x00000006) << 14;
|
||||
/* bit 25 --> 17 */
|
||||
dsisr |= (instr & 0x00000040) << 8;
|
||||
/* bits 21:24 --> 18:21 */
|
||||
dsisr |= (instr & 0x00000780) << 3;
|
||||
} else {
|
||||
/* bit 5 --> 17 */
|
||||
dsisr |= (instr & 0x04000000) >> 12;
|
||||
/* bits 1: 4 --> 18:21 */
|
||||
dsisr |= (instr & 0x78000000) >> 17;
|
||||
/* bits 30:31 --> 12:13 */
|
||||
if (IS_DSFORM(instr))
|
||||
dsisr |= (instr & 0x00000003) << 18;
|
||||
}
|
||||
|
||||
return dsisr;
|
||||
}
|
||||
#endif /* __ASM_PPC_DISASSEMBLE_H__ */
|
||||
|
Reference in New Issue
Block a user