x86: lib: Separate instruction decoder MMIO type from MMIO trace
Subsystems (2)
PATCH 1/1 x86: lib: Separate instruction decoder MMIO type from MMIO trace
Both mmiotrace.h and insn-eval.h define various MMIO_ enum constants. Rename the insn ones to have a INSN_ prefix, so that the headers can be used from the same source file.
---
This doesn't fix any existing compile error that I'm aware of, but if this makes it into 6.2, it would avoid me having to carry it in a series I'm working on, where the clash does result in a compile error.
arch/x86/coco/tdx/tdx.c | 26 +++++++++++++------------- arch/x86/include/asm/insn-eval.h | 18 +++++++++--------- arch/x86/kernel/sev.c | 18 +++++++++--------- arch/x86/lib/insn-eval.c | 20 ++++++++++---------- 4 files changed, 41 insertions(+), 41 deletions(-)
arch/x86/coco/tdx/tdx.c +13 -13
@@ -347,7 +347,7 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)unsigned long *reg, val, vaddr;char buffer[MAX_INSN_SIZE ];struct insn insn = {}; -enum mmio_type mmio; +enum insn_mmio_type mmio;int size, extend_size;u8 extend_val =0 ;
@@ -362,10 +362,10 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EINVAL ; mmio =insn_decode_mmio (&insn, &size); -if (WARN_ON_ONCE (mmio ==MMIO_DECODE_FAILED )) +if (WARN_ON_ONCE (mmio ==INSN_MMIO_DECODE_FAILED ))return -EINVAL ; -if (mmio !=MMIO_WRITE_IMM && mmio !=MMIO_MOVS ) { +if (mmio !=INSN_MMIO_WRITE_IMM && mmio !=INSN_MMIO_MOVS ) { reg =insn_get_modrm_reg_ptr (&insn, regs);if (!reg)return -EINVAL ;
@@ -386,23 +386,23 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)/* Handle writes first */ switch (mmio) { -case MMIO_WRITE : +case INSN_MMIO_WRITE :memcpy (&val, reg, size);if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_WRITE_IMM : +case INSN_MMIO_WRITE_IMM : val = insn.immediate.value;if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_READ : -case MMIO_READ_ZERO_EXTEND : -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ : +case INSN_MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Reads are handled below */ break ; -case MMIO_MOVS : -case MMIO_DECODE_FAILED : +case INSN_MMIO_MOVS : +case INSN_MMIO_DECODE_FAILED :/* * MMIO was accessed with an instruction that could not be * decoded or handled properly. It was likely not using io.h
@@ -419,15 +419,15 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EIO ;switch (mmio) { -case MMIO_READ : +case INSN_MMIO_READ :/* Zero-extend for 32-bit operation */ extend_size = size ==4 ?sizeof (*reg) :0 ;break ; -case MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_ZERO_EXTEND :/* Zero extend based on operand size */ extend_size = insn.opnd_bytes;break ; -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Sign extend based on operand size */ extend_size = insn.opnd_bytes;if (size ==1 && val &BIT (7 ))
arch/x86/include/asm/insn-eval.h +9 -9
@@ -32,16 +32,16 @@ int insn_fetch_from_user_inatomic(struct pt_regs *regs,bool insn_decode_from_regs (struct insn *insn,struct pt_regs *regs,unsigned char buf[MAX_INSN_SIZE ],int buf_size); -enum mmio_type { -MMIO_DECODE_FAILED , -MMIO_WRITE , -MMIO_WRITE_IMM , -MMIO_READ , -MMIO_READ_ZERO_EXTEND , -MMIO_READ_SIGN_EXTEND , -MMIO_MOVS , +enum insn_mmio_type { +INSN_MMIO_DECODE_FAILED , +INSN_MMIO_WRITE , +INSN_MMIO_WRITE_IMM , +INSN_MMIO_READ , +INSN_MMIO_READ_ZERO_EXTEND , +INSN_MMIO_READ_SIGN_EXTEND , +INSN_MMIO_MOVS , }; -enum mmio_type insn_decode_mmio (struct insn *insn,int *bytes); +enum insn_mmio_type insn_decode_mmio (struct insn *insn,int *bytes);#endif /* _ASM_X86_INSN_EVAL_H */
arch/x86/kernel/sev.c +9 -9
@@ -1537,31 +1537,31 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) {struct insn *insn = &ctxt->insn;unsigned int bytes =0 ; -enum mmio_type mmio; +enum insn_mmio_type mmio;enum es_result ret;u8 sign_byte;long *reg_data; mmio =insn_decode_mmio (insn, &bytes); -if (mmio ==MMIO_DECODE_FAILED ) +if (mmio ==INSN_MMIO_DECODE_FAILED )return ES_DECODE_FAILED ; -if (mmio !=MMIO_WRITE_IMM && mmio !=MMIO_MOVS ) { +if (mmio !=INSN_MMIO_WRITE_IMM && mmio !=INSN_MMIO_MOVS ) { reg_data =insn_get_modrm_reg_ptr (insn, ctxt->regs);if (!reg_data)return ES_DECODE_FAILED ; }switch (mmio) { -case MMIO_WRITE : +case INSN_MMIO_WRITE :memcpy (ghcb->shared_buffer, reg_data, bytes); ret =vc_do_mmio (ghcb, ctxt, bytes, false);break ; -case MMIO_WRITE_IMM : +case INSN_MMIO_WRITE_IMM :memcpy (ghcb->shared_buffer, insn->immediate1.bytes, bytes); ret =vc_do_mmio (ghcb, ctxt, bytes, false);break ; -case MMIO_READ : +case INSN_MMIO_READ : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1572,7 +1572,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_ZERO_EXTEND : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1581,7 +1581,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memset (reg_data,0 , insn->opnd_bytes);memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1600,7 +1600,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memset (reg_data, sign_byte, insn->opnd_bytes);memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_MOVS : +case INSN_MMIO_MOVS : ret =vc_handle_mmio_movs (ctxt, bytes);break ;default :
arch/x86/lib/insn-eval.c +10 -10
@@ -1595,16 +1595,16 @@ bool insn_decode_from_regs(struct insn *insn, struct pt_regs *regs,* Returns: * * Type of the instruction. Size of the memory operand is stored in -* @bytes. If decode failed, MMIO_DECODE_FAILED returned. +* @bytes. If decode failed, INSN_MMIO_DECODE_FAILED returned. */ -enum mmio_type insn_decode_mmio (struct insn *insn,int *bytes) +enum insn_mmio_type insn_decode_mmio (struct insn *insn,int *bytes) { -enum mmio_type type =MMIO_DECODE_FAILED ; +enum insn_mmio_type type =INSN_MMIO_DECODE_FAILED ; *bytes =0 ;if (insn_get_opcode (insn)) -return MMIO_DECODE_FAILED ; +return INSN_MMIO_DECODE_FAILED ;switch (insn->opcode.bytes[0 ]) {case 0x88 :/* MOV m8,r8 */
@@ -1613,7 +1613,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0x89 :/* MOV m16/m32/m64, r16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_WRITE ; + type =INSN_MMIO_WRITE ;break ;case 0xc6 :/* MOV m8, imm8 */
@@ -1622,7 +1622,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xc7 :/* MOV m16/m32/m64, imm16/imm32/imm64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_WRITE_IMM ; + type =INSN_MMIO_WRITE_IMM ;break ;case 0x8a :/* MOV r8, m8 */
@@ -1631,7 +1631,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0x8b :/* MOV r16/r32/r64, m16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_READ ; + type =INSN_MMIO_READ ;break ;case 0xa4 :/* MOVS m8, m8 */
@@ -1640,7 +1640,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xa5 :/* MOVS m16/m32/m64, m16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_MOVS ; + type =INSN_MMIO_MOVS ;break ;case 0x0f :/* Two-byte instruction */
@@ -1651,7 +1651,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xb7 :/* MOVZX r32/r64, m16 */ if (!*bytes) *bytes =2 ; - type =MMIO_READ_ZERO_EXTEND ; + type =INSN_MMIO_READ_ZERO_EXTEND ;break ;case 0xbe :/* MOVSX r16/r32/r64, m8 */
@@ -1660,7 +1660,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xbf :/* MOVSX r32/r64, m16 */ if (!*bytes) *bytes =2 ; - type =MMIO_READ_SIGN_EXTEND ; + type =INSN_MMIO_READ_SIGN_EXTEND ;break ; }break ;
Signature · 1 line
2.39.0
Quoted 21 lines · Jason A. Donenfeld
Both
mmiotrace.handinsn-eval.hdefine variousMMIO_enum constants. Rename the insn ones to have aINSN_prefix, so that the headers can be used from the same source file.Signed-off-by Jason A. Donenfeld <[email protected]>---
This doesn't fix any existing compile error that I'm aware of, but if this makes it into 6.2, it would avoid me having to carry it in a series I'm working on, where the clash does result in a compile error.arch/x86/coco/tdx/tdx.c | 26 +++++++++++++------------- arch/x86/include/asm/insn-eval.h | 18 +++++++++--------- arch/x86/kernel/sev.c | 18 +++++++++--------- arch/x86/lib/insn-eval.c | 20 ++++++++++---------- 4 files changed, 41 insertions(+), 41 deletions(-)arch/x86/coco/tdx/tdx.c +0
-0
arch/x86/coco/tdx/tdx.c static int handle_mmio(struct pt_regs *regs, struct ve_info *ve) · line 350
Quoted 5 lines
arch/x86/coco/tdx/tdx.c +1
-1@@ -347,7 +347,7 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)unsigned long *reg, val, vaddr;char buffer[MAX_INSN_SIZE ];struct insn insn = {}; -enum mmio_type mmio; +enum insn_mmio_type mmio;
It would be good to preserve the reverse fir order in the variable declarations.
Quoted 101 lines
arch/x86/coco/tdx/tdx.c +12
-12int size, extend_size;u8 extend_val =0 ;@@ -362,10 +362,10 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EINVAL ; mmio =insn_decode_mmio (&insn, &size); -if (WARN_ON_ONCE (mmio ==MMIO_DECODE_FAILED )) +if (WARN_ON_ONCE (mmio ==INSN_MMIO_DECODE_FAILED ))return -EINVAL ; -if (mmio !=MMIO_WRITE_IMM && mmio !=MMIO_MOVS ) { +if (mmio !=INSN_MMIO_WRITE_IMM && mmio !=INSN_MMIO_MOVS ) { reg =insn_get_modrm_reg_ptr (&insn, regs);if (!reg)return -EINVAL ;@@ -386,23 +386,23 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)/* Handle writes first */ switch (mmio) { -case MMIO_WRITE : +case INSN_MMIO_WRITE :memcpy (&val, reg, size);if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_WRITE_IMM : +case INSN_MMIO_WRITE_IMM : val = insn.immediate.value;if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_READ : -case MMIO_READ_ZERO_EXTEND : -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ : +case INSN_MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Reads are handled below */ break ; -case MMIO_MOVS : -case MMIO_DECODE_FAILED : +case INSN_MMIO_MOVS : +case INSN_MMIO_DECODE_FAILED :/* * MMIO was accessed with an instruction that could not be * decoded or handled properly. It was likely not using io.h @@ -419,15 +419,15 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EIO ;switch (mmio) { -case MMIO_READ : +case INSN_MMIO_READ :/* Zero-extend for 32-bit operation */ extend_size = size ==4 ?sizeof (*reg) :0 ;break ; -case MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_ZERO_EXTEND :/* Zero extend based on operand size */ extend_size = insn.opnd_bytes;break ; -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Sign extend based on operand size */ extend_size = insn.opnd_bytes;if (size ==1 && val &BIT (7 ))arch/x86/include/asm/insn-eval.h +9
-9@@ -32,16 +32,16 @@ int insn_fetch_from_user_inatomic(struct pt_regs *regs,bool insn_decode_from_regs (struct insn *insn,struct pt_regs *regs,unsigned char buf[MAX_INSN_SIZE ],int buf_size); -enum mmio_type { -MMIO_DECODE_FAILED , -MMIO_WRITE , -MMIO_WRITE_IMM , -MMIO_READ , -MMIO_READ_ZERO_EXTEND , -MMIO_READ_SIGN_EXTEND , -MMIO_MOVS , +enum insn_mmio_type { +INSN_MMIO_DECODE_FAILED , +INSN_MMIO_WRITE , +INSN_MMIO_WRITE_IMM , +INSN_MMIO_READ , +INSN_MMIO_READ_ZERO_EXTEND , +INSN_MMIO_READ_SIGN_EXTEND , +INSN_MMIO_MOVS , }; -enum mmio_type insn_decode_mmio (struct insn *insn,int *bytes); +enum insn_mmio_type insn_decode_mmio (struct insn *insn,int *bytes);#endif /* _ASM_X86_INSN_EVAL_H */ arch/x86/kernel/sev.c +0
-0
arch/x86/kernel/sev.c static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) · line 1540
Quoted 5 lines
arch/x86/kernel/sev.c +1
-1@@ -1537,31 +1537,31 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) {struct insn *insn = &ctxt->insn;unsigned int bytes =0 ; -enum mmio_type mmio; +enum insn_mmio_type mmio;
Same here.
Thanks and BR,
Ricardo
Quoted 10 lines · Ricardo Neri
arch/x86/coco/tdx/tdx.c static int handle_mmio(struct pt_regs *regs, struct ve_info *ve) · line 350
Quoted 6 lines
arch/x86/coco/tdx/tdx.c +1
-1@@ -347,7 +347,7 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)unsigned long *reg, val, vaddr;char buffer[MAX_INSN_SIZE ];struct insn insn = {}; -enum mmio_type mmio; +enum insn_mmio_type mmio;It would be good to preserve the reverse fir order in the variable declarations.
Quoted 4 lines
Review static int handle_mmio(struct pt_regs *regs, struct ve_info *ve) · line 351
Quoted 2 lines
(quoted diff) +1
-1- enum mmio_type mmio; + enum insn_mmio_type mmio;Same here.
Maintaining reverse Christmas trees would be in the holiday spirit, after all. I'll send a v2.
Jason
PATCH v2 1/1 x86: lib: Separate instruction decoder MMIO type from MMIO trace
Both mmiotrace.h and insn-eval.h define various MMIO_ enum constants. Rename the insn ones to have a INSN_ prefix, so that the headers can be used from the same source file.
---
This doesn't fix any existing compile error that I'm aware of, but if this makes it into 6.2, it would avoid me having to carry it in a series I'm working on, where the clash does result in a compile error.
Changes v1->v2:
- 'Tis the season! Keep those reverse Christmas trees nicely ornamented.
arch/x86/coco/tdx/tdx.c | 26 +++++++++++++------------- arch/x86/include/asm/insn-eval.h | 18 +++++++++--------- arch/x86/kernel/sev.c | 18 +++++++++--------- arch/x86/lib/insn-eval.c | 20 ++++++++++---------- 4 files changed, 41 insertions(+), 41 deletions(-)
arch/x86/coco/tdx/tdx.c +13 -13
@@ -386,8 +386,8 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve) {unsigned long *reg, val, vaddr;char buffer[MAX_INSN_SIZE ]; +enum insn_mmio_type mmio;struct insn insn = {}; -enum mmio_type mmio;int size, extend_size;u8 extend_val =0 ;
@@ -402,10 +402,10 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EINVAL ; mmio =insn_decode_mmio (&insn, &size); -if (WARN_ON_ONCE (mmio ==MMIO_DECODE_FAILED )) +if (WARN_ON_ONCE (mmio ==INSN_MMIO_DECODE_FAILED ))return -EINVAL ; -if (mmio !=MMIO_WRITE_IMM && mmio !=MMIO_MOVS ) { +if (mmio !=INSN_MMIO_WRITE_IMM && mmio !=INSN_MMIO_MOVS ) { reg =insn_get_modrm_reg_ptr (&insn, regs);if (!reg)return -EINVAL ;
@@ -426,23 +426,23 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)/* Handle writes first */ switch (mmio) { -case MMIO_WRITE : +case INSN_MMIO_WRITE :memcpy (&val, reg, size);if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_WRITE_IMM : +case INSN_MMIO_WRITE_IMM : val = insn.immediate.value;if (!mmio_write (size, ve->gpa, val))return -EIO ;return insn.length; -case MMIO_READ : -case MMIO_READ_ZERO_EXTEND : -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ : +case INSN_MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Reads are handled below */ break ; -case MMIO_MOVS : -case MMIO_DECODE_FAILED : +case INSN_MMIO_MOVS : +case INSN_MMIO_DECODE_FAILED :/* * MMIO was accessed with an instruction that could not be * decoded or handled properly. It was likely not using io.h
@@ -459,15 +459,15 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)return -EIO ;switch (mmio) { -case MMIO_READ : +case INSN_MMIO_READ :/* Zero-extend for 32-bit operation */ extend_size = size ==4 ?sizeof (*reg) :0 ;break ; -case MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_ZERO_EXTEND :/* Zero extend based on operand size */ extend_size = insn.opnd_bytes;break ; -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND :/* Sign extend based on operand size */ extend_size = insn.opnd_bytes;if (size ==1 && val &BIT (7 ))
arch/x86/include/asm/insn-eval.h +9 -9
@@ -32,16 +32,16 @@ int insn_fetch_from_user_inatomic(struct pt_regs *regs,bool insn_decode_from_regs (struct insn *insn,struct pt_regs *regs,unsigned char buf[MAX_INSN_SIZE ],int buf_size); -enum mmio_type { -MMIO_DECODE_FAILED , -MMIO_WRITE , -MMIO_WRITE_IMM , -MMIO_READ , -MMIO_READ_ZERO_EXTEND , -MMIO_READ_SIGN_EXTEND , -MMIO_MOVS , +enum insn_mmio_type { +INSN_MMIO_DECODE_FAILED , +INSN_MMIO_WRITE , +INSN_MMIO_WRITE_IMM , +INSN_MMIO_READ , +INSN_MMIO_READ_ZERO_EXTEND , +INSN_MMIO_READ_SIGN_EXTEND , +INSN_MMIO_MOVS , }; -enum mmio_type insn_decode_mmio (struct insn *insn,int *bytes); +enum insn_mmio_type insn_decode_mmio (struct insn *insn,int *bytes);#endif /* _ASM_X86_INSN_EVAL_H */
arch/x86/kernel/sev.c +9 -9
@@ -1536,32 +1536,32 @@ static enum es_result vc_handle_mmio_movs(struct es_em_ctxt *ctxt,static enum es_result vc_handle_mmio (struct ghcb *ghcb,struct es_em_ctxt *ctxt) {struct insn *insn = &ctxt->insn; +enum insn_mmio_type mmio;unsigned int bytes =0 ; -enum mmio_type mmio;enum es_result ret;u8 sign_byte;long *reg_data; mmio =insn_decode_mmio (insn, &bytes); -if (mmio ==MMIO_DECODE_FAILED ) +if (mmio ==INSN_MMIO_DECODE_FAILED )return ES_DECODE_FAILED ; -if (mmio !=MMIO_WRITE_IMM && mmio !=MMIO_MOVS ) { +if (mmio !=INSN_MMIO_WRITE_IMM && mmio !=INSN_MMIO_MOVS ) { reg_data =insn_get_modrm_reg_ptr (insn, ctxt->regs);if (!reg_data)return ES_DECODE_FAILED ; }switch (mmio) { -case MMIO_WRITE : +case INSN_MMIO_WRITE :memcpy (ghcb->shared_buffer, reg_data, bytes); ret =vc_do_mmio (ghcb, ctxt, bytes, false);break ; -case MMIO_WRITE_IMM : +case INSN_MMIO_WRITE_IMM :memcpy (ghcb->shared_buffer, insn->immediate1.bytes, bytes); ret =vc_do_mmio (ghcb, ctxt, bytes, false);break ; -case MMIO_READ : +case INSN_MMIO_READ : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1572,7 +1572,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_READ_ZERO_EXTEND : +case INSN_MMIO_READ_ZERO_EXTEND : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1581,7 +1581,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memset (reg_data,0 , insn->opnd_bytes);memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_READ_SIGN_EXTEND : +case INSN_MMIO_READ_SIGN_EXTEND : ret =vc_do_mmio (ghcb, ctxt, bytes, true);if (ret)break ;
@@ -1600,7 +1600,7 @@ static enum es_result vc_handle_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)memset (reg_data, sign_byte, insn->opnd_bytes);memcpy (reg_data, ghcb->shared_buffer, bytes);break ; -case MMIO_MOVS : +case INSN_MMIO_MOVS : ret =vc_handle_mmio_movs (ctxt, bytes);break ;default :
arch/x86/lib/insn-eval.c +10 -10
@@ -1595,16 +1595,16 @@ bool insn_decode_from_regs(struct insn *insn, struct pt_regs *regs,* Returns: * * Type of the instruction. Size of the memory operand is stored in -* @bytes. If decode failed, MMIO_DECODE_FAILED returned. +* @bytes. If decode failed, INSN_MMIO_DECODE_FAILED returned. */ -enum mmio_type insn_decode_mmio (struct insn *insn,int *bytes) +enum insn_mmio_type insn_decode_mmio (struct insn *insn,int *bytes) { -enum mmio_type type =MMIO_DECODE_FAILED ; +enum insn_mmio_type type =INSN_MMIO_DECODE_FAILED ; *bytes =0 ;if (insn_get_opcode (insn)) -return MMIO_DECODE_FAILED ; +return INSN_MMIO_DECODE_FAILED ;switch (insn->opcode.bytes[0 ]) {case 0x88 :/* MOV m8,r8 */
@@ -1613,7 +1613,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0x89 :/* MOV m16/m32/m64, r16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_WRITE ; + type =INSN_MMIO_WRITE ;break ;case 0xc6 :/* MOV m8, imm8 */
@@ -1622,7 +1622,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xc7 :/* MOV m16/m32/m64, imm16/imm32/imm64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_WRITE_IMM ; + type =INSN_MMIO_WRITE_IMM ;break ;case 0x8a :/* MOV r8, m8 */
@@ -1631,7 +1631,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0x8b :/* MOV r16/r32/r64, m16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_READ ; + type =INSN_MMIO_READ ;break ;case 0xa4 :/* MOVS m8, m8 */
@@ -1640,7 +1640,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xa5 :/* MOVS m16/m32/m64, m16/m32/m64 */ if (!*bytes) *bytes = insn->opnd_bytes; - type =MMIO_MOVS ; + type =INSN_MMIO_MOVS ;break ;case 0x0f :/* Two-byte instruction */
@@ -1651,7 +1651,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xb7 :/* MOVZX r32/r64, m16 */ if (!*bytes) *bytes =2 ; - type =MMIO_READ_ZERO_EXTEND ; + type =INSN_MMIO_READ_ZERO_EXTEND ;break ;case 0xbe :/* MOVSX r16/r32/r64, m8 */
@@ -1660,7 +1660,7 @@ enum mmio_type insn_decode_mmio(struct insn *insn, int *bytes)case 0xbf :/* MOVSX r32/r64, m16 */ if (!*bytes) *bytes =2 ; - type =MMIO_READ_SIGN_EXTEND ; + type =INSN_MMIO_READ_SIGN_EXTEND ;break ; }break ;
Signature · 1 line
2.39.0
Quoted 5 lines · Jason A. Donenfeld
Both
mmiotrace.handinsn-eval.hdefine variousMMIO_enum constants. Rename the insn ones to have aINSN_prefix, so that the headers can be used from the same source file.Signed-off-by Jason A. Donenfeld <[email protected]>
FWIW: Reviewed-by: Ricardo Neri <[email protected]>
Quoted 8 lines · Ricardo Neri
Quoted 5 lines · Jason A. Donenfeld
Both
mmiotrace.handinsn-eval.hdefine variousMMIO_enum constants. Rename the insn ones to have aINSN_prefix, so that the headers can be used from the same source file.Signed-off-by Jason A. Donenfeld <[email protected]>FWIW: Reviewed-by: Ricardo Neri <[email protected]>
Thanks. Any chance this can get in for 6.2?
Jason
Hello Borislav,
Quoted 7 lines · Jason A. Donenfeld
Quoted 5 lines · Ricardo Neri
Quoted 4 lines · Jason A. Donenfeld
Both
mmiotrace.handinsn-eval.hdefine variousMMIO_enum constants. Rename the insn ones to have aINSN_prefix, so that the headers can be used from the same source file.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jason A. Donenfeld <[email protected]>FWIW: Reviewed-by: Ricardo Neri <[email protected]>
Thanks. Any chance this can get in for 6.2?
Do you think you could queue up this patch for 6.2 as a fix? It has basically no chance of breakage and does fix a real symbol clash.
https://lore.kernel.org/lkml/[email protected]/
Thanks,
Jason
Borislav Petkov
maintainerQuoted 8 lines · Jason A. Donenfeld
Do you think you could queue up this patch for 6.2 as a fix? It has basically no chance of breakage and does fix a real symbol clash.
https://lore.kernel.org/lkml/[email protected]/
This doesn't fix any existing compile error that I'm aware of, but if this makes it into 6.2, it would avoid me having to carry it in a series I'm working on,...
Our general rule for urgent fixes going through tip is that they should qualify to be CC:stable fixes. And this one isn't so I think you should hold on to it and submit it along with the whole series as it is usually done.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 10 lines · Borislav Petkov
Quoted 8 lines · Jason A. Donenfeld
Do you think you could queue up this patch for 6.2 as a fix? It has basically no chance of breakage and does fix a real symbol clash.
https://lore.kernel.org/lkml/[email protected]/
This doesn't fix any existing compile error that I'm aware of, but if this makes it into 6.2, it would avoid me having to carry it in a series I'm working on,...
Quoted 5 lines
Our general rule for urgent fixes going through tip is that they should qualify
to be CC:stable fixes. And this one isn't so I think you should hold on to it
and submit it along with the whole series as it is usually done.
Rest of series is intended to go through random.git tree, so it'd be useful to not have to carry this there -- less pain.
Jason
Borislav Petkov
maintainerQuoted 2 lines · Jason A. Donenfeld
Rest of series is intended to go through random.git tree, so it'd be useful to not have to carry this there -- less pain.
Ping me when the time has come and I'll ack it so that it can go through the random.git tree too. Provided there are no serious conflicts but we'll cross that bridge when we get to it...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteHi Borislav,
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason A. Donenfeld
Rest of series is intended to go through random.git tree, so it'd be useful to not have to carry this there -- less pain.
Ping me when the time has come and I'll ack it so that it can go through the random.git tree too. Provided there are no serious conflicts but we'll cross that bridge when we get to it...
Alright, we'll do that then.
tglx has been reviewing these -- though he's been busy as of late -- but if you're curious, here's the series:
https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/log/?h=vdso
https://lore.kernel.org/lkml/[email protected]/
I wouldn't mind some feedback or acks on any subset of those.
Jason