From patchwork Sun Feb 12 08:46:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 55886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1825263wrn; Sun, 12 Feb 2023 01:04:55 -0800 (PST) X-Google-Smtp-Source: AK7set9Po9PLONyYriZjPGrzgcUR1UNM10OfOq5wmIPPriXW9IYWmz03zuIQ0FIklZvdrkZDem+n X-Received: by 2002:a17:902:ec82:b0:196:56ae:ed1d with SMTP id x2-20020a170902ec8200b0019656aeed1dmr20892344plg.69.1676192694637; Sun, 12 Feb 2023 01:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676192694; cv=none; d=google.com; s=arc-20160816; b=ZEEr0WoFLZsUw9iTbZZHLOc/gxjr8WQWPQ1NOR+o6AcAP9tXu+FzfAimMS5X0v7flZ 1u0yjgULQxuf+SjTWcFu6EDAYkSE8+6CE8vcPIvnBXV0nCre8FxOr5jwoIhK9OWfBAy1 f118RsXCEunagNRviuhHfrhQ9ugDIDWlyrBFDnTEavL6QM44TVVLgfKLEASVLsCfJ3oi Tw8RtzPMLXKbYPBY/RH0bUTNLsOB3AwxWEIXf470yUq2JVq5t7nbqFET3cqM+AkhQmTz Ggh2TPA7CEO1UAm+ix9FPGgNjHPlNKVgBnBifSionAxM7QMY9arJjckjyGmHzGLduVIo C5JA== 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 :dkim-signature; bh=meOD1Xr5S72oTR7rAAdHgy+LaR6HnCthwA8xO91nsCc=; b=AdPC/+VFeWQppW9s9En5QhWjZz772E+Q7usCIjn9+QRKNzVnZ1LVPVp8uCi/R0iOGZ Zj0M8Q98UeKn2RGIAJD8H9Kk7MArglZSm/QKIp2vbqmpgb0W9orlMfwMUJp6KtmLzlRV OuwyaKpmXfBGHk0X94NyTHhk/PLN4sTPb/QA3pbC9eb8D6qA42F+IHuPSYl02V+5Xvke 5C23Q6X5kkDU87jM0ZXfSPH/FRpalb9tYJk0NjyrZPVfsKu3LEQX7ArFs7dDxdpCfQCm WyHjytsNXwYruYY6q4SseCS4yEvVo8n09HCc42H7dZLmsqtClAJ7Srz6g82t1+8S9U+f rwHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nwKbB+zM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb13-20020a170903258d00b0019a9ba6651asi397953plb.349.2023.02.12.01.04.42; Sun, 12 Feb 2023 01:04:54 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nwKbB+zM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbjBLIqf (ORCPT + 99 others); Sun, 12 Feb 2023 03:46:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjBLIqd (ORCPT ); Sun, 12 Feb 2023 03:46:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0027710411; Sun, 12 Feb 2023 00:46:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64BFE60C79; Sun, 12 Feb 2023 08:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97661C4339E; Sun, 12 Feb 2023 08:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676191590; bh=wJKO+AO9ehGyCmpU0Nwq3DEZS0c6b1KlppYJ5nGg6XM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nwKbB+zMw9BFAoqSQ1PEav58XX8TubiRD9FWzPHjS+PetN4JGZlDDWLdp5ZaWd3iy B0AZJyl0tvIP813KlE+MlgwL68ykOxAHHUT5yW2h6Oe53GguBeLLCKqoupq6FDTYC5 Qq0k6Jx3xEAABQ+xR1KwgmlXFGkQ7iaE4WRtMGs+ckdYdx+/E0+RAo6IpWSTVnXSPG 5Af2K9uMqW3qP6LNOokN/G2+XC6Nlgfve4Rj0YfRdNcirv8rOcOHGh9Ry2WaALQwRZ DroMXoGsz1rviych9nxkPDi32UHxhA7zKHWb/FrTsxNbv5KkKTWNhr6C/9Jf3toM7B BBeqjvqC40gMQ== From: Mike Rapoport To: Arnd Bergmann Cc: David Airlie , "David S. Miller" , Helge Deller , Matt Turner , Michael Ellerman , x86@kernel.org, dri-devel@lists.freedesktop.org, linux-alpha@vger.kernel.org, linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org, "Mike Rapoport (IBM)" Subject: [PATCH 1/2] char/agp: consolidate {alloc,free}_gatt_pages() Date: Sun, 12 Feb 2023 10:46:10 +0200 Message-Id: <20230212084611.1311177-2-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230212084611.1311177-1-rppt@kernel.org> References: <20230212084611.1311177-1-rppt@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757615430879080395?= X-GMAIL-MSGID: =?utf-8?q?1757615430879080395?= From: "Mike Rapoport (IBM)" There is a copy of alloc_gatt_pages() and free_gatt_pages in several architectures in arch/$ARCH/include/asm/agp.h. All the copies do exactly the same: alias alloc_gatt_pages() to __get_free_pages(GFP_KERNEL) and alias free_gatt_pages() to free_pages(). Define alloc_gatt_pages() and free_gatt_pages() in drivers/char/agp/agp.h and drop per-architecture definitions. Signed-off-by: Mike Rapoport (IBM) --- arch/alpha/include/asm/agp.h | 6 ------ arch/ia64/include/asm/agp.h | 6 ------ arch/parisc/include/asm/agp.h | 6 ------ arch/powerpc/include/asm/agp.h | 6 ------ arch/sparc/include/asm/agp.h | 6 ------ arch/x86/include/asm/agp.h | 6 ------ drivers/char/agp/agp.h | 6 ++++++ 7 files changed, 6 insertions(+), 36 deletions(-) diff --git a/arch/alpha/include/asm/agp.h b/arch/alpha/include/asm/agp.h index 7874f063d000..4197b3bc78ee 100644 --- a/arch/alpha/include/asm/agp.h +++ b/arch/alpha/include/asm/agp.h @@ -10,10 +10,4 @@ #define unmap_page_from_agp(page) do { } while (0) #define flush_agp_cache() mb() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif diff --git a/arch/ia64/include/asm/agp.h b/arch/ia64/include/asm/agp.h index 0261507dc264..f42c7dcb3d79 100644 --- a/arch/ia64/include/asm/agp.h +++ b/arch/ia64/include/asm/agp.h @@ -18,10 +18,4 @@ #define unmap_page_from_agp(page) do { } while (0) #define flush_agp_cache() mb() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif /* _ASM_IA64_AGP_H */ diff --git a/arch/parisc/include/asm/agp.h b/arch/parisc/include/asm/agp.h index 14ae54cfd368..d193a48490e2 100644 --- a/arch/parisc/include/asm/agp.h +++ b/arch/parisc/include/asm/agp.h @@ -12,10 +12,4 @@ #define unmap_page_from_agp(page) do { } while (0) #define flush_agp_cache() mb() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif /* _ASM_PARISC_AGP_H */ diff --git a/arch/powerpc/include/asm/agp.h b/arch/powerpc/include/asm/agp.h index 6b6485c988dd..e86f2ce476c9 100644 --- a/arch/powerpc/include/asm/agp.h +++ b/arch/powerpc/include/asm/agp.h @@ -9,11 +9,5 @@ #define unmap_page_from_agp(page) do {} while (0) #define flush_agp_cache() mb() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_AGP_H */ diff --git a/arch/sparc/include/asm/agp.h b/arch/sparc/include/asm/agp.h index 2d0ff84cee3f..5186924fa673 100644 --- a/arch/sparc/include/asm/agp.h +++ b/arch/sparc/include/asm/agp.h @@ -8,10 +8,4 @@ #define unmap_page_from_agp(page) do { } while (0) #define flush_agp_cache() mb() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif diff --git a/arch/x86/include/asm/agp.h b/arch/x86/include/asm/agp.h index cd7b14322035..c8c111d8fbd7 100644 --- a/arch/x86/include/asm/agp.h +++ b/arch/x86/include/asm/agp.h @@ -23,10 +23,4 @@ */ #define flush_agp_cache() wbinvd() -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - #endif /* _ASM_X86_AGP_H */ diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index bb09d64cd51e..8771dcc9b8e2 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h @@ -236,6 +236,12 @@ void agp3_generic_tlbflush(struct agp_memory *mem); int agp3_generic_configure(void); void agp3_generic_cleanup(void); +/* GATT allocation. Returns/accepts GATT kernel virtual address. */ +#define alloc_gatt_pages(order) \ + ((char *)__get_free_pages(GFP_KERNEL, (order))) +#define free_gatt_pages(table, order) \ + free_pages((unsigned long)(table), (order)) + /* aperture sizes have been standardised since v3 */ #define AGP_GENERIC_SIZES_ENTRIES 11 extern const struct aper_size_info_16 agp3_generic_sizes[];