Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1010398rwd; Thu, 8 Jun 2023 10:39:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ51zo6v2/omTEycCDGgteHPrijWnEn4l8pfaeGg9DBgwnUG3eLjUDcIXHef5FkppbXj1g93 X-Received: by 2002:a17:902:8697:b0:1af:aafb:64c8 with SMTP id g23-20020a170902869700b001afaafb64c8mr5044655plo.21.1686245981286; Thu, 08 Jun 2023 10:39:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686245981; cv=none; d=google.com; s=arc-20160816; b=RrrWNYe5Qm6yOcyoOQ/OS1s+lnlN3hZ4BOOzxrY64q1DqoJ9IvhCwUtC1XgO51eTxn O1H+anGoqb9UbhUEpQoiCBHmB8Ui1h+7rBgAofQyQxEoa5pzhEDKgaMnh8pkME6nHB9W OY/7ccUQSjWmb+NkJLTN07rmDZlN9BN62co2KQuCbrTnlxZaeyz5KRC9k9l9JmS/zTxN uUwNppzi3fITlHXMSYi5EljjOfL1XTFzPLpc4TS+KnwQV59E2lVbt4PWldBy4ke04IBR RTrw3iow1DpaCa4kicBTCp+upzLM+EN+HZoDaL+9T8cez7+JpKmT4BLEwPog320YmxYR ewlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=Ew+tEm4xed5RTkLax8nMMXWK/hBebXAyfKsfgknVeho=; b=sQ1oduaZlZLRdNAXSKlt57S4EjBzVDIWl0GRKRRlsQns7NqS0BbUNzAywx4ml5Z/Zp Tcs0G+qQwerCEMzOi5Wu83gdBqoTwzMZYesBLhL5JiBVZLABmFaQLQZxWl8Ua1CxThev Vr2tATQ5XBRwFcDhdMtlFmF1w6Dp+CW0l/qbuIY/925pJqQyUGi6Nc5g1gzkSxrDpE/y YZk4omQmi/gUYv4exr/cOPZMdDMA87+hEZFwqr2QulxKq5Yfp3810wIQXHXDE0qbDSIF 61gm+ELFwftSTZvDp2B3R90Q+1j2nFmTJDDhfxbUfB7BE3PhFizGmrFWkOTKbbo3mtap COuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B4p4zzAL; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jx11-20020a170903138b00b001a6527f6adbsi1349494plb.137.2023.06.08.10.39.16; Thu, 08 Jun 2023 10:39:41 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B4p4zzAL; 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 S232508AbjFHRcr (ORCPT + 99 others); Thu, 8 Jun 2023 13:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbjFHRcq (ORCPT ); Thu, 8 Jun 2023 13:32:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B012B2115 for ; Thu, 8 Jun 2023 10:32:45 -0700 (PDT) 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 4C81B64FCC for ; Thu, 8 Jun 2023 17:32:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82203C433D2; Thu, 8 Jun 2023 17:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686245564; bh=9pSHIKmpleefHxtGguaaooqKIkgzxLhqomz+9DI+SdY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=B4p4zzAL+tFEVx0n54Y5PAT+tyazEj9bP16Ck71X9kbDLAim/wHHwT9/8sKlHqZRv 4kc2feFR284iUQVMZsQh+MuYOkJzapetY0ZDfg+ZLh6FOWBfCzj6zm3f6EaNxoKeNW XU+/KJGJwNu0RVNpjR2eXk815M6etlYXLyK66e5JsSU3XO+j86a/OQkDbVcFSMueCI 1fdQc/vlOzhqNkHP2AtJx+uvmkE1UJ2S5B1zFEsTyRnl0PccI+OGCm8zi3EElk/fl8 qh/uISCNyY6oDi9BSfPk7ZcjOWC11degePdEO5/sPRXv8COv3h8+9syaQJwcByjmI8 qldhWlyTCrdFQ== Date: Thu, 8 Jun 2023 12:32:43 -0500 From: Bjorn Helgaas To: Sui Jingfeng <15330273260@189.cn> Cc: Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Li Yi , linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sui Jingfeng , Philipp Zabel , Bjorn Helgaas Subject: Re: [PATCH v8 6/8] drm/etnaviv: add driver support for the PCI devices Message-ID: <20230608173243.GA1207429@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230607105551.568639-7-15330273260@189.cn> 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,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 On Wed, Jun 07, 2023 at 06:55:49PM +0800, Sui Jingfeng wrote: > From: Sui Jingfeng > > This patch adds PCI driver support on top of what we already have. Take > the GC1000 in LS7A1000/LS2K1000 as the first instance of the PCI device > driver. There is only one GPU core for the GC1000 in the LS7A1000 and > LS2K1000. Therefore, component frameworks can be avoided. > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > +#include "etnaviv_pci_drv.h" > +#endif With trivial stubs for etnaviv_register_pci_driver() and etnaviv_unregister_pci_driver(), I think you could get rid of all these #ifdefs. > +void etnaviv_drm_unbind(struct device *dev, bool component) > { > struct etnaviv_drm_private *priv = etna_private_ptr; > struct drm_device *drm = priv->drm; > @@ -746,6 +750,12 @@ static int __init etnaviv_init(void) > if (ret != 0) > goto unregister_gpu_driver; > > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > + ret = etnaviv_register_pci_driver(); > + if (ret != 0) > + goto unregister_platform_driver; > +#endif > + > /* > * If the DT contains at least one available GPU device, instantiate > * the DRM platform device. > @@ -763,7 +773,7 @@ static int __init etnaviv_init(void) > break; > } > > - return 0; > + return ret; > > unregister_platform_driver: > platform_driver_unregister(&etnaviv_platform_driver); > @@ -778,6 +788,10 @@ static void __exit etnaviv_exit(void) > etnaviv_destroy_platform_device(&etnaviv_platform_device); > platform_driver_unregister(&etnaviv_platform_driver); > platform_driver_unregister(&etnaviv_gpu_driver); > + > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > + etnaviv_unregister_pci_driver(); > +#endif > +static const struct pci_device_id etnaviv_pci_id_lists[] = { > + {PCI_VENDOR_ID_LOONGSON, 0x7a15, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, > + {PCI_VENDOR_ID_LOONGSON, 0x7a05, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, PCI_VDEVICE() Bjorn