Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2440367ioo; Sat, 28 May 2022 13:46:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkrxcRtX8/3pYiMloiwAEDc0rF26K/dMxvkzsAkc2OyL90kO5rdo5FC+61kcaoxZ9G0egb X-Received: by 2002:a17:90b:1e44:b0:1e0:b640:776f with SMTP id pi4-20020a17090b1e4400b001e0b640776fmr14901876pjb.169.1653770813572; Sat, 28 May 2022 13:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770813; cv=none; d=google.com; s=arc-20160816; b=D9i+03uvjTOGEZRIhl+xiFtLUUL0h5lyq6ZpTz4ySFqaGCNaxY0tUlPXEyEOmAldV1 6+b5Oh8veVZgB1aU/IqQk146DBot2C5M1jFTaWfFtVgosnSApGeLMtcIhwpjanygOoL2 gZ1o5+ztSN6Zz6QV5ffaosqOQH1iOI12bOnMbmXoquobkiBO4+1cbUyZ/9z+Oz2CInZb oD1vFsf69DDFIid7I2WTwX3jY5E1+mv7GWQ5fLVZBTslortJX6nybXLgEzVmP2F9+/Ht nGFCB+81G16svV7kRbD7/qB9k9uPoysJ8RHD5ARbxL1MoSJDbcayYRSZqDptiPnVdPFQ n2Wg== 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=h81Kjr8/xFhkyePvy6o2YMjLqNYTt2XAPX+AtTyRWpo=; b=mUsgQam+SC6t4dXaC+7VLogQhdc4oeJWxfl4JvnIa1jTsB5MQYrAnZFjUUijBewbcQ viz7o/QqU2dEeR5ykdljYK1NiBqhU8ZWfwDw7E3QTppv4YJdTLpOdbBFcTdRQjtOQFyf Bfu+jALcMqaAU3dVzF6LHMRL8ZFlEackzlLsfIBIF+cegPeTCHkHz+lCTtAcubmjV7jR qIycEhTyI4yZ+B27MuZGLVc9vldKEWDxboHgtyc11LDEWl7h5Txnb/54Zar7sfDD4ueQ jQ4NG4J95OzrFMMOPj68tYc6fnWteH1pHA9kXJWRK30O+vIKXXxjwgo2hJbD6i/+Ot5K 7Yig== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ji10-20020a170903324a00b001635dd9f240si4979817plb.24.2022.05.28.13.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:46:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 09CBF1C7EED; Sat, 28 May 2022 12:47:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355443AbiE1G3y (ORCPT + 99 others); Sat, 28 May 2022 02:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355637AbiE1G3i (ORCPT ); Sat, 28 May 2022 02:29:38 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE0013152C for ; Fri, 27 May 2022 23:29:35 -0700 (PDT) Received: from kwepemi500003.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L9BZP2g1YzjWx4; Sat, 28 May 2022 14:28:29 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi500003.china.huawei.com (7.221.188.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 28 May 2022 14:29:33 +0800 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.2375.24; Sat, 28 May 2022 14:29:31 +0800 From: Tong Tiangen To: Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Robin Murphy , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , , "H . Peter Anvin" CC: , , , , Kefeng Wang , Xie XiuQi , Guohanjun , Tong Tiangen Subject: [PATCH -next v5 5/8] Add generic fallback version of copy_mc_to_user() Date: Sat, 28 May 2022 06:50:53 +0000 Message-ID: <20220528065056.1034168-6-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220528065056.1034168-1-tongtiangen@huawei.com> References: <20220528065056.1034168-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=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 9b82b38ff867..58dbe8e2e318 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -358,6 +358,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 35f222aa66bf..b7b1aca5d6cd 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -512,6 +512,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 5a328cf02b75..07e9faeb14b5 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -174,6 +174,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