All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>
Subject: Re: [PATCH 08/14] Arm/guestcopy: deviate copy_guest() uses just like their x86 counterparts
Date: Mon, 21 Sep 2026 13:46:22 +0200	[thread overview]
Message-ID: <c3494c6086c6b49131e488ac5083cf9e@bugseng.com> (raw)
In-Reply-To: <a581e503-f1cc-4ae9-80ee-6b32653e8084@suse.com>

On 2026-09-02 08:33, Jan Beulich wrote:
> Like x86/HVM's __hvm_copy(), Arm's copy_guest() is used for both 
> to-guest
> and from-guest copying. Naturally in the latter case the hypervisor 
> buffer
> needs writing to, hence the function parameter cannot be 
> pointer-to-const.
> 
> No functional change intended.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

See comment below, but I can do as a follow-up if you'd like.

> ---
> Of course for both the pre-existing x86 deviation and the new Arm one 
> it
> might be more robust if the deviation was also limited to the 
> respective
> source file. Can this be expressed together with the needed regex?

Yes, e.g.

-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(file(^xen/arch/arm/...$)&&text(^.*copy_guest.*COPY_to_guest 
doesn't modify.*$)))"}

not compile-tested, so YMMV.

> 
> --- a/automation/eclair_analysis/ECLAIR/deviations.ecl
> +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
> @@ -433,6 +433,12 @@ Fixing this violation would require to i
>  
> -config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
>  -doc_end
> 
> +-doc_begin="Function copy_guest() in xen/arch/arm/guestcopy.c is a 
> double-use
> +function, where the parameter needs to not be const because it can be 
> set for
> +write or not"
> +-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(text(^.*copy_guest.*COPY_to_guest 
> doesn't modify.*$)))"}
> +-doc_end
> +
>  -doc_begin="Function __hvm_copy in xen/arch/x86/hvm/hvm.c is a 
> double-use
>  function, where the parameter needs to not be const because it can be 
> set for
>  write or not"
> --- a/xen/arch/arm/guestcopy.c
> +++ b/xen/arch/arm/guestcopy.c
> @@ -109,14 +109,16 @@ static unsigned long copy_guest(void *bu
> 
>  unsigned long raw_copy_to_guest(void *to, const void *from, unsigned 
> int len)
>  {
> -    return copy_guest((void *)from, (vaddr_t)to, len,
> -                      GVA_INFO(current), COPY_to_guest | COPY_linear);
> +    return copy_guest((void *)from, /* COPY_to_guest doesn't modify */
> +                      (vaddr_t)to, len, GVA_INFO(current),
> +                      COPY_to_guest | COPY_linear);
>  }
> 
>  unsigned long raw_copy_to_guest_flush_dcache(void *to, const void 
> *from,
>                                               unsigned int len)
>  {
> -    return copy_guest((void *)from, (vaddr_t)to, len, 
> GVA_INFO(current),
> +    return copy_guest((void *)from, /* COPY_to_guest doesn't modify */
> +                      (vaddr_t)to, len, GVA_INFO(current),
>                        COPY_to_guest | COPY_flush_dcache | 
> COPY_linear);
>  }

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


  parent reply	other threads:[~2026-09-21 11:46 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  6:28 [PATCH 00/14] address half the remaining Misra rule 11.8 violations Jan Beulich
2026-09-02  6:30 ` [PATCH 01/14] lib: obey to Misra rule 11.8 where possible Jan Beulich
2026-09-22  1:24   ` Volodymyr Babchuk
2026-09-02  6:30 ` [PATCH 02/14] x86/bitops: don't cast away volatile-ness Jan Beulich
2026-09-02 11:29   ` Andrew Cooper
2026-09-02  6:31 ` [PATCH 03/14] x86: have cmpxchg16b() obey to Misra rule 11.8 Jan Beulich
2026-10-05 14:09   ` Andrew Cooper
2026-09-02  6:31 ` [PATCH 04/14] x86/boot: don't cast away const-ness Jan Beulich
2026-09-07  8:02   ` Roger Pau Monné
2026-09-02  6:32 ` [PATCH 05/14] x86/altcall: hide casting away of const Jan Beulich
2026-09-07  7:54   ` Roger Pau Monné
2026-09-02  6:32 ` [PATCH 06/14] Arm/alternative: " Jan Beulich
2026-09-02 11:47   ` Orzel, Michal
2026-09-02 12:35     ` Jan Beulich
2026-09-02  6:33 ` [PATCH 07/14] Arm64/GICv3: have gicv3_its_find_quirk() not cast away const-ness Jan Beulich
2026-09-02 11:22   ` Orzel, Michal
2026-09-02  6:33 ` [PATCH 08/14] Arm/guestcopy: deviate copy_guest() uses just like their x86 counterparts Jan Beulich
2026-09-07  6:37   ` Orzel, Michal
2026-09-21 11:46   ` Nicola Vetrini [this message]
2026-09-21 12:15     ` Jan Beulich
2026-09-02  6:34 ` [PATCH 09/14] ACPI: address a Misra rule 11.8 violation in Arm code Jan Beulich
2026-09-22  1:38   ` Volodymyr Babchuk
2026-09-22  6:47     ` Jan Beulich
2026-09-22 10:57       ` Volodymyr Babchuk
2026-09-22 11:16         ` Jan Beulich
2026-09-22 21:18           ` Volodymyr Babchuk
2026-10-06 15:53             ` Jan Beulich
2026-09-02  6:34 ` [PATCH 10/14] ELF/notes: use pointer-to-const by default in ELFNOTE_...() Jan Beulich
2026-09-22  1:45   ` Volodymyr Babchuk
2026-09-22  6:36     ` Jan Beulich
2026-09-22 11:01       ` Volodymyr Babchuk
2026-09-22 11:18         ` Jan Beulich
2026-09-02  6:35 ` [PATCH 11/14] crypto/vmac: don't cast away const-ness in aes_key_setup() Jan Beulich
2026-09-22  1:47   ` Volodymyr Babchuk
2026-09-02  6:35 ` [PATCH 12/14] gnttab: don't cast away constness Jan Beulich
2026-10-05 16:59   ` Roger Pau Monné
2026-10-06  5:59     ` Jan Beulich
2026-10-06  6:28       ` Jan Beulich
2026-09-02  6:36 ` [PATCH 13/14] passthrough/PCI: rework (s,b,d,f) init of struct pci_dev Jan Beulich
2026-09-02 12:44   ` Roger Pau Monné
2026-09-02 12:53     ` Jan Beulich
2026-09-02 15:07       ` Roger Pau Monné
2026-09-03  6:05         ` Jan Beulich
2026-09-02  6:37 ` [PATCH 14/14] xhci-dbc: don't cast away const-ness in xhci_find_dbc() Jan Beulich
2026-09-02  9:56   ` Marek Marczykowski-Górecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3494c6086c6b49131e488ac5083cf9e@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=volodymyr_babchuk@epam.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.