From patchwork Wed Jun 14 02:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng <15330273260@189.cn> X-Patchwork-Id: 10739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp959654vqr; Tue, 13 Jun 2023 19:49:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Mq79cgS/WbT2G7L7dn9tHhcPMB+lLFVxzpV2WKjvHFWOFzQap+YtyfydHJyVAkitTFgN2 X-Received: by 2002:a17:907:7d88:b0:977:d53e:4055 with SMTP id oz8-20020a1709077d8800b00977d53e4055mr15976355ejc.58.1686710958640; Tue, 13 Jun 2023 19:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686710958; cv=none; d=google.com; s=arc-20160816; b=Mmwxh2Tyv8GA4rvyKgjTINSUm6btP+PIz+MHRqSpCnVT9tavGXSUD5R4w/bBNfPAq9 VDpiHutx56cH3bECiDhywH7lcT2a6AkKzs3amiMTKhknIzE7DftfaIr3UHG43IA0y1q8 m7wEIMxlISMDPM3EtAMx/zOUVTcOtvc/4oL8IIYRIExL2wjU9dlhQTqUxLvfp0CEZ6Jd Q5t5r17+We+cy8c78aRUxpVDel+evDKkV2fvg8Hf85Y3gDYsO20AltSwlMroYC7o8aYD 4ZCZGeHC/ukQ6QLWaUOw9qd+6JGiRdXMwH1knPwjHCGVxM8cSf+aSwle/7bvWzlMxr9Z Z0oQ== 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 :message-id:date:subject:cc:to:from:sender:hmm_source_type :hmm_attache_num:hmm_source_ip; bh=atneZG3pd9nbwXwDbMJIBsUZuIZKMmOJhpyK4Wvkxlo=; b=i+C7zN5RZD0wWOIhmtX+IGRwA55dcMsBRGL9zUCaoXxXSKgTn/pz6a0GyFHThh+s95 egIgIOWHr1hDBr+wgnj1KiFYx7MVDiYr6UtZ/mBzcmvxZz2j9z4QxyddWiqM2fMtiEuT dvt8H4XCItdwipf1Zh1t9HS5BksHQ9xQyLtr6xKug1IU/z4rzJ1TLv/+pvT8YG4PKnJm lYV+cBILb2W/+nN18dA+TCwQSe0GQyIdUAkyIelkn20sNCv+JGtM0/77PIM5rGNaCoBq q0fnqxOgqKWUY2O+FcZlftoZAiP9sKDIxzeuoLFdzN5964bSrzCBKAHKHjY5VEi8Tbgg dDBg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a170906339400b00973757c4c14si7272364eja.331.2023.06.13.19.48.54; Tue, 13 Jun 2023 19:49:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240845AbjFNCrx (ORCPT + 99 others); Tue, 13 Jun 2023 22:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjFNCrv (ORCPT ); Tue, 13 Jun 2023 22:47:51 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 90203CE for ; Tue, 13 Jun 2023 19:47:49 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.31:39796.1729481184 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.31]) by 189.cn (HERMES) with SMTP id E29CF102A0E; Wed, 14 Jun 2023 10:47:47 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-xp9j7 with ESMTP id 6099419671c44547a002a15f58495bae for l.stach@pengutronix.de; Wed, 14 Jun 2023 10:47:48 CST X-Transaction-ID: 6099419671c44547a002a15f58495bae X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Lucas Stach , Christian Gmeiner , Daniel Vetter , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, loongson-kernel@lists.loongnix.cn, Sui Jingfeng Subject: [PATCH v9 0/9] drm/etnaviv: Add pci device driver support Date: Wed, 14 Jun 2023 10:47:36 +0800 Message-Id: <20230614024745.865129-1-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,SPF_HELO_PASS,SPF_PASS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768644630522495441?= X-GMAIL-MSGID: =?utf-8?q?1768644630522495441?= From: Sui Jingfeng There is a Vivante GC1000 (v5037) in LS2K1000 and LS7A1000, this GPU is a PCI device, and it has 2D and 3D cores in the same core. This series is trying to add PCI device driver support to etnaviv. v6: * Fix build issue on system without CONFIG_PCI enabled v7: * Add a separate patch for the platform driver rearrangement (Bjorn) * Switch to runtime check if the GPU is dma coherent or not (Lucas) * Add ETNAVIV_PARAM_GPU_COHERENT to allow userspace to query (Lucas) * Remove etnaviv_gpu.no_clk member (Lucas) * Various Typos and coding style fixed (Bjorn) v8: * Fix typos and remove unnecessary header included (Bjorn). * Add a dedicated function to create the virtual master platform device. v9: * Use PCI_VDEVICE() macro (Bjorn) * Add trivial stubs for trivial stubs for the PCI driver (Bjorn) * Remove a redundant dev_err() usage (Bjorn) * Clean up etnaviv_pdev_probe() also. Sui Jingfeng (9): drm/etnaviv: Add a dedicated function to register an irq handler drm/etnaviv: Add a dedicated function to get various clocks drm/etnaviv: Add dedicated functions to create and destroy platform device drm/etnaviv: Add helpers for private data construction and destruction drm/etnaviv: Allow bypass component framework drm/etnaviv: Add driver support for the PCI devices drm/etnaviv: Add support for the dma coherent device drm/etnaviv: Add a dedicated function to create the virtual master drm/etnaviv: Clean up etnaviv_pdev_probe() function drivers/gpu/drm/etnaviv/Kconfig | 10 + drivers/gpu/drm/etnaviv/Makefile | 2 + drivers/gpu/drm/etnaviv/etnaviv_drv.c | 315 ++++++++++++++------ drivers/gpu/drm/etnaviv/etnaviv_drv.h | 10 + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 22 +- drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 7 +- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 166 +++++++---- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 9 + drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c | 75 +++++ drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h | 18 ++ include/uapi/drm/etnaviv_drm.h | 1 + 11 files changed, 476 insertions(+), 159 deletions(-) create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.c create mode 100644 drivers/gpu/drm/etnaviv/etnaviv_pci_drv.h