Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp3727378rwr; Sun, 7 May 2023 18:50:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6he6SSsyq3MOzJWLlKkcivezSqI38fR30SKsmTlGkrFVb0ztGPwdWimKAGn2btlI+Y+Pak X-Received: by 2002:a05:6a20:3d8f:b0:d9:2cef:949a with SMTP id s15-20020a056a203d8f00b000d92cef949amr11039589pzi.28.1683510621594; Sun, 07 May 2023 18:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683510621; cv=none; d=google.com; s=arc-20160816; b=L4C3vCe2V/yxS1uIuJ6UcQQBffU2Qqm3QBvjzRzx4K1VLXw8LTwP+FwFjY5p+3EZOE BXrNBzx774QAsy5CEWYMjTUD9PXKPAy92RwUaEsMXRDKApHPJnkLhOpqK8AqGDjaCxkj W/F0cJfPuVhoeTO/MAsEgHkBKd8pXFymypx+vuP0ZUymFxUbJ2yNDxpshoKE1hNJdfo3 pDgeHCQNXMCTDlMeZ8OvX0KjGZnATduD138/Hz85C9R8zP8GCOg7Z5Hi8MRokV+ItY8X SRG0zAxkZeWMnrzXZqP2W08AGM1AgDnH9T5S8PnM5AsFFH4yV3PZQVf+g8lcxLRMtj7K LTPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Zq23zzyZVMkdc/EXpTivR7acVXFe/p9y542EhEVDwrI=; b=tnkSSmhE5Uo6SMyu/m1VlUpfJyQfZlYZNup6XeCUdrP1Yq9VzfkaU3EISRLfb+hiA1 MOzdWXPpV9mT2h26nyXXoY+aMuupT/XTju0Ra7QdF0rZpJJLilFpnkIBS67CcvqJ9mj4 yV3j216tEetaq/JqHf+n6bS/xT/Xb0Zde5Wj9ImCkB3Wtz2+7pPxP6gASOEDRwBJG5Cm maoD5xsGPg80Ky2BK2fSDpxVj4nqU8w7suwoZHobwwziU/86dWngG4ebGzyH6AbOILcm 7Dq4I7PVDjP5RD6vI+wRGQgqWRphz0o2PkDOBetBWuiZqS0E/cwQKohn+zuS2rqiKv/k jONA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b19-20020a639313000000b0052cc25bd286si4206664pge.756.2023.05.07.18.50.08; Sun, 07 May 2023 18:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232577AbjEHBpC (ORCPT + 99 others); Sun, 7 May 2023 21:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232542AbjEHBo6 (ORCPT ); Sun, 7 May 2023 21:44:58 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35CF612093 for ; Sun, 7 May 2023 18:44:57 -0700 (PDT) Received: from kwepemm600017.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QF3vr6r9rzsR5p; Mon, 8 May 2023 09:43:04 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 8 May 2023 09:44:53 +0800 From: Tong Tiangen To: Catalin Marinas , Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Robin Murphy , Dave Hansen , Will Deacon , Alexander Viro , , "H . Peter Anvin" CC: , , , Kefeng Wang , Guohanjun , Xie XiuQi , Tong Tiangen Subject: [PATCH -next v9 1/5] uaccess: add generic fallback version of copy_mc_to_user() Date: Mon, 8 May 2023 09:44:32 +0800 Message-ID: <20230508014436.198717-2-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230508014436.198717-1-tongtiangen@huawei.com> References: <20230508014436.198717-1-tongtiangen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 enable CONFIG_ARCH_HAS_COPY_MC. Signed-off-by: Tong Tiangen Acked-by: Michael Ellerman --- 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 a2d255aa9627..1713dff36568 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 457e814712af..37d3c078d768 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -573,6 +573,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len); unsigned long __must_check copy_mc_to_user(void *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++; -- 2.25.1