linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v11 1/5] uaccess: add generic fallback version of copy_mc_to_user()
Date: Thu, 8 Feb 2024 13:38:18 +0000	[thread overview]
Message-ID: <20240208133818.000009ea@Huawei.com> (raw)
In-Reply-To: <20240207132204.1720444-2-tongtiangen@huawei.com>

On Wed, 7 Feb 2024 21:22:00 +0800
Tong Tiangen <tongtiangen@huawei.com> wrote:

> x86/powerpc has it's implementation of copy_mc_to_user(), we add generic
> fallback in include/linux/uaccess.h prepare for other architechures to
architectures

(only bother fixing if you end up doing a v12 - hence off list reply!)

> enable CONFIG_ARCH_HAS_COPY_MC.
> 
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/include/asm/uaccess.h | 1 +
>  arch/x86/include/asm/uaccess.h     | 1 +
>  include/linux/uaccess.h            | 9 +++++++++
>  3 files changed, 11 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
> index f1f9890f50d3..4bfd1e6f0702 100644
> --- a/arch/powerpc/include/asm/uaccess.h
> +++ b/arch/powerpc/include/asm/uaccess.h
> @@ -381,6 +381,7 @@ copy_mc_to_user(void __user *to, const void *from, unsigned long n)
>  
>  	return n;
>  }
> +#define copy_mc_to_user copy_mc_to_user
>  #endif
>  
>  extern long __copy_from_user_flushcache(void *dst, const void __user *src,
> diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
> index 5c367c1290c3..fd56282ee9a8 100644
> --- a/arch/x86/include/asm/uaccess.h
> +++ b/arch/x86/include/asm/uaccess.h
> @@ -497,6 +497,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len);
>  
>  unsigned long __must_check
>  copy_mc_to_user(void __user *to, const void *from, unsigned len);
> +#define copy_mc_to_user copy_mc_to_user
>  #endif
>  
>  /*
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index 3064314f4832..550287c92990 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -205,6 +205,15 @@ copy_mc_to_kernel(void *dst, const void *src, size_t cnt)
>  }
>  #endif
>  
> +#ifndef copy_mc_to_user
> +static inline unsigned long __must_check
> +copy_mc_to_user(void *dst, const void *src, size_t cnt)
> +{
> +	check_object_size(src, cnt, true);
> +	return raw_copy_to_user(dst, src, cnt);
> +}
> +#endif
> +
>  static __always_inline void pagefault_disabled_inc(void)
>  {
>  	current->pagefault_disabled++;


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-02-08 13:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 13:21 [PATCH v11 0/5]arm64: add ARCH_HAS_COPY_MC support Tong Tiangen
2024-02-07 13:22 ` [PATCH v11 1/5] uaccess: add generic fallback version of copy_mc_to_user() Tong Tiangen
2024-02-08 13:38   ` Jonathan Cameron [this message]
2024-02-08 13:39     ` Jonathan Cameron
2024-02-07 13:22 ` [PATCH v11 2/5] arm64: add support for ARCH_HAS_COPY_MC Tong Tiangen
2024-02-07 13:22 ` [PATCH v11 3/5] mm/hwpoison: return -EFAULT when copy fail in copy_mc_[user]_highpage() Tong Tiangen
2024-02-07 13:22 ` [PATCH v11 4/5] arm64: support copy_mc_[user]_highpage() Tong Tiangen
2024-02-07 13:22 ` [PATCH v11 5/5] arm64: send SIGBUS to user process for SEA exception Tong Tiangen
2024-02-18  7:05 ` [PATCH v11 0/5]arm64: add ARCH_HAS_COPY_MC support Tong Tiangen
2024-03-27  0:49 ` Tong Tiangen

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=20240208133818.000009ea@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).