Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3569291iog; Tue, 21 Jun 2022 01:10:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZ170Ao/vpdEphdRNh5Foa/0QIhPwOaj5wCHJCShiOh4zsn2JzM85g/i4wOXqleLV+fBhz X-Received: by 2002:a17:90b:1b4d:b0:1ec:c42a:7eb5 with SMTP id nv13-20020a17090b1b4d00b001ecc42a7eb5mr3861254pjb.122.1655799039231; Tue, 21 Jun 2022 01:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655799039; cv=none; d=google.com; s=arc-20160816; b=lfAneYyEQZt/QgUkNIItZ+kTqu1qrrTOng5G7ZUHcHbeg9wK0rrx4W90W0wz/tNY9N 9H4T2veWZeHegkmZ28K9vOJj11f/8iuIQ0kr/qW3j7+xDtm3NSsVfbfU6gNvEVqEzCZm wedr7x8EgQpnW+4ss/y2gnh29h+J+HfXy/f3at6RiNsysuiXsX8RJ1x3+lYU0ZMatlDS WMYiHBZTajOtvGa4AmPIPl7lJW8+3UrxUAIduv9XVrBXVIAmLzslaFepKYDUE7m1HtUw FdwBMUhSPMYH+AM3DICqQFol4rv/974ofndthkiIZPd8SWxZV/YEWKsoV/WzUtjCvO8D bIXA== 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=7mwAOc/80KRKhxWJzYe9k0Z/q0SiROquJuehpTl9E5U=; b=IBhtFHruQxbBoo5sItyI5t+JcfzvUPudWQheUFcYBAuJQFkg3YKUDaqUyZN3UmoJ83 gJgU4fvDQ6CpLLmsjuGYPVinjJwQs/HgE0bs9UpnCFLNLqzhtbKmReWwNDzvyjl3TjbV yRQ+AxK2tk3fq/oZbpt3VnYuoJAPEje4xKO6K/Mepjr5raGM+AnyT9ygQ2ty9uUSotR9 Clxy1Q96vQamz0riXjVmnYF/r2YtI1NnyAzWi93c8sP1l3APhNl98dL7/yaB2WSWxyXb /qTKtxLfZm5+AhKhDe57KqskOR4ignPsD01mhxOYMaCRJ15Q5wLBQfR8TtKVwpmUaEPS BXyg== 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 h9-20020a654689000000b003fca01bf92esi20707502pgr.482.2022.06.21.01.10.26; Tue, 21 Jun 2022 01:10:39 -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 S1347235AbiFUH3H (ORCPT + 99 others); Tue, 21 Jun 2022 03:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347630AbiFUH2j (ORCPT ); Tue, 21 Jun 2022 03:28:39 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E22355B4 for ; Tue, 21 Jun 2022 00:28:36 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LRyhc61h7zSh3j; Tue, 21 Jun 2022 15:25:04 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 21 Jun 2022 15:27:00 +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; Tue, 21 Jun 2022 15:26:58 +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 v6 07/10] Add generic fallback version of copy_mc_to_user() Date: Tue, 21 Jun 2022 07:26:35 +0000 Message-ID: <20220621072638.1273594-8-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220621072638.1273594-1-tongtiangen@huawei.com> References: <20220621072638.1273594-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 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 913e593a3b45..64ba7f723ddf 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