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

Jan Beulich posted 1 patch 9 months, 2 weeks ago
Failed in applying to current master (apply log)
[PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
Posted by Jan Beulich 9 months, 2 weeks ago
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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -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. */
Re: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
Posted by Stefano Stabellini 9 months, 2 weeks ago
On Thu, 27 Jul 2023, Jan Beulich wrote:
> 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.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -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. */
>
Ping: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
Posted by Jan Beulich 9 months, 1 week ago
On 27.07.2023 20:41, Stefano Stabellini wrote:
> On Thu, 27 Jul 2023, Jan Beulich wrote:
>> 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.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Paul - any chance of an ack?

Thanks, Jan
Re: Ping: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
Posted by Durrant, Paul 9 months, 1 week ago
On 03/08/2023 12:46, Jan Beulich wrote:
> On 27.07.2023 20:41, Stefano Stabellini wrote:
>> On Thu, 27 Jul 2023, Jan Beulich wrote:
>>> 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.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> Paul - any chance of an ack?
> 

Sure.

Reviewed-by: Paul Durrant <paul@xen.org>
Re: [PATCH] x86/HVM: drop dead assignments from hvmemul_rep_{movs,stos}()
Posted by Andrew Cooper 9 months, 2 weeks ago
On 27/07/2023 4:25 pm, Jan Beulich wrote:
> 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.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>