Skip to contentSkip to conversation

x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()

PATCH In review Jan Beulich 4 participants 5 messages Jul 27, 2023 – Aug 3, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()

In the latter case the variable altogether is then unused and hence gets dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly introduced both assignments in 57a57465daaf ("x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"), likely as a result of some re-work on the patch.

xen/arch/x86/hvm/emulate.c +1 -3
@@ -1861,7 +1861,6 @@ static int cf_check hvmemul_rep_movs(
             return rc;
     }
 
-    bytes = PAGE_SIZE - (daddr & ~PAGE_MASK);
     if ( hvio->mmio_access.write_access &&
          (hvio->mmio_gla == (daddr & PAGE_MASK)) &&
          /* See comment above. */
@@ -1988,7 +1987,7 @@ static int cf_check hvmemul_rep_stos(
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
     struct vcpu *curr = current;
     struct hvm_vcpu_io *hvio = &curr->arch.hvm.hvm_io;
-    unsigned long addr, bytes;
+    unsigned long addr;
     paddr_t gpa;
     p2m_type_t p2mt;
     bool_t df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
@@ -1998,7 +1997,6 @@ static int cf_check hvmemul_rep_stos(
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    bytes = PAGE_SIZE - (addr & ~PAGE_MASK);
     if ( hvio->mmio_access.write_access &&
          (hvio->mmio_gla == (addr & PAGE_MASK)) &&
          /* See respective comment in MOVS processing. */
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

In the latter case the variable altogether is then unused and hence gets dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly introduced both assignments in 57a57465daaf ("x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"), likely as a result of some re-work on the patch.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 7 lines · Jan Beulich

In the latter case the variable altogether is then unused and hence gets dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly introduced both assignments in 57a57465daaf ("x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"), likely as a result of some re-work on the patch.

Quoted 28 lines
xen/arch/x86/hvm/emulate.c +1 -3
@@ -1861,7 +1861,6 @@ static int cf_check hvmemul_rep_movs(
             return rc;
     }
 
-    bytes = PAGE_SIZE - (daddr & ~PAGE_MASK);
     if ( hvio->mmio_access.write_access &&
          (hvio->mmio_gla == (daddr & PAGE_MASK)) &&
          /* See comment above. */
@@ -1988,7 +1987,7 @@ static int cf_check hvmemul_rep_stos(
         container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
     struct vcpu *curr = current;
     struct hvm_vcpu_io *hvio = &curr->arch.hvm.hvm_io;
-    unsigned long addr, bytes;
+    unsigned long addr;
     paddr_t gpa;
     p2m_type_t p2mt;
     bool_t df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
@@ -1998,7 +1997,6 @@ static int cf_check hvmemul_rep_stos(
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    bytes = PAGE_SIZE - (addr & ~PAGE_MASK);
     if ( hvio->mmio_access.write_access &&
          (hvio->mmio_gla == (addr & PAGE_MASK)) &&
          /* See respective comment in MOVS processing. */
#3 lore raw

Ping: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()

Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Jan Beulich

In the latter case the variable altogether is then unused and hence gets dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly introduced both assignments in 57a57465daaf ("x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"), likely as a result of some re-work on the patch.

Paul - any chance of an ack?

Thanks, Jan

Reviewed-by Paul Durrant
#4 lore raw

Re: Ping: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()

Quoted 8 lines · Jan Beulich
Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Jan Beulich

In the latter case the variable altogether is then unused and hence gets dropped, eliminating a Misra Rule 5.3 violation. I'm afraid I mistakenly introduced both assignments in 57a57465daaf ("x86/HVM: use available linear->phys translations in REP MOVS/STOS handling"), likely as a result of some re-work on the patch.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Paul - any chance of an ack?

Sure.