Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9542979rwd; Wed, 21 Jun 2023 08:40:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48dJQSFIGA49/OVqR0W9K5zxSO6sJIbjEvLBPsuEIMCI1qA/1NnLcqRnz8OUnUu8lDJjpj X-Received: by 2002:a17:902:d4c1:b0:1b1:9f8a:6c18 with SMTP id o1-20020a170902d4c100b001b19f8a6c18mr17596260plg.25.1687362056537; Wed, 21 Jun 2023 08:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687362056; cv=none; d=google.com; s=arc-20160816; b=ossHU7sEzXjpXR53RzGSa8Rsfp9ZvBbO8a0tTPhvDpu8eRQIz+g8VNHWtFkA87N7ta JDfW+w/9WgLSkn9S9k+oeXWExegp7vdcL2LVRI9O2dtx5MwgYpfHU1teZgacKKQ18gMT TrGiFtLyIyuSGaiZX/dQE79lRTEmJ2tYKz6OyAJxMXps2xmQ5jr0NQR5Fk70LM4vaLaF 2957yHguFmvXNEV+eTG+CquzrrjbZ1XwDzXA8z3qSKvpiwloan/gUR039tY2LOLeKb16 nDt+9twlFdi5fMmvuJcPw17C2Xg1gK0M/QypRgel//uooT7KP0OgS5kqaBvg6NxmYRxh /5+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=PoNgFKUCqD6Sd7L1TM61Th4rm4kVidsfOqt+a3BbiR4=; b=wgPNA56MGyQ7yaezhs3XjWK2N7CeELTexF4VrEx33MaSo4VV2tkZNwfLstYZRXUOso Vb152kg7tGnjGtYJbZgai3DREHRC818mzhPnMm3kbEFEalfI65UODOj71xh6pI7jolkG fGNQsarZhSujPCPYObwR2hfIdGMRow63Og7CvZdLeAChzpLDoCZKgDReXxeivcSgHIDJ FFDuT0n59rvDPOFck0B+LMmK+YRmMZDSR5wCYNC+Q9+3hhUeDFziulR0T5W/m0uoxtsL qoO6jWEuXPhR5Wj67d9i2cT1fkk81VgJ/QYNaSat67L+GwgCgUuponGLJo6kbt6Se40q imww== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020a170902c40a00b001b23b699747si5144406plk.10.2023.06.21.08.40.44; Wed, 21 Jun 2023 08:40:56 -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 S233258AbjFUPWP convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Jun 2023 11:22:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbjFUPVx (ORCPT ); Wed, 21 Jun 2023 11:21:53 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31187268F for ; Wed, 21 Jun 2023 08:20:21 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBzcv-0007yD-MP; Wed, 21 Jun 2023 17:20:09 +0200 Message-ID: <6ef512179a4cc9ce24890e5ed50c6fabd86a18c1.camel@pengutronix.de> Subject: Re: [PATCH v10 03/11] drm/etnaviv: Add dedicated functions to create and destroy platform device From: Lucas Stach To: Sui Jingfeng , Sui Jingfeng <18949883232@163.com>, Russell King , Christian Gmeiner , David Airlie , Daniel Vetter Cc: Bjorn Helgaas , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Philipp Zabel , etnaviv@lists.freedesktop.org Date: Wed, 21 Jun 2023 17:20:04 +0200 In-Reply-To: References: <20230620094716.2231414-1-18949883232@163.com> <20230620094716.2231414-4-18949883232@163.com> <0daa7182d6600a24988d1c81cf8fe3c0c9487f52.camel@pengutronix.de> <1c7596fd-7e63-6719-2574-7d7820687832@loongson.cn> <6d287bbb1733814009dfeb7d48f08cb6f44dc56c.camel@pengutronix.de> <30d80802-2d9d-2816-1a02-240145f6dd3a@loongson.cn> <0f1095ef333da7ea103486a1121ca9038815e57c.camel@pengutronix.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org 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 Am Mittwoch, dem 21.06.2023 um 22:35 +0800 schrieb Sui Jingfeng: > Hi, > > On 2023/6/21 22:00, Lucas Stach wrote: > > Am Mittwoch, dem 21.06.2023 um 21:31 +0800 schrieb Sui Jingfeng: > > > On 2023/6/21 18:23, Lucas Stach wrote: > > > > > While back to the question you ask, I want etnaviv_create_platform_device() to be generic, > > > > > > > > > > can be used by multiple place for multiple purpose. > > > > > > > > > > I have successfully copy this to a another drm driver by simply renaming. > > > > > > > > > > The body of the function itself does not need to change. > > > > But it isn't shared, > > > This can be shared for drm/etnaviv in the future, > > > > > > currently, we just need an opportunity to use this function. > > > > > I'm not convinced, yet. > > > > > I want to create a dummy platform device, > > > > > > let this dummy platform be bound to the single PCI GPU master. > > > > > > > > > etnaviv_create_platform_device("dummy", &dummy_device); > > > > > > > > > 1) To verify the component code path on PCI case. > > > > > My favorite option would be to just always use the component path even > > when the GPU is on a PCI device to keep both paths mostly aligned. One > > could easily image both a 3D and a 2D core being made available though > > the same PCI device. > > Component is for something that is possible not available. (or something > is optional) > > Yes it provided flexibly, but don't forget, it rely on the DT. The component framework itself doesn't rely on DT in any way. By providing a appropriate match function you can make it work with any kind of device. In fact etnaviv supports platform devices instantiated via board code today. They don't need to come from DT. If we could make the PCI stuff work the same way, that would be my preferred option. > > > But for the PCIe device, it always the case that all of the hardware is > available at the same time > > when the device driver(kernel module) is loaded. That isn't the issue solved by the component framework. On the existing SoCs all the hardware is available when the driver is probed. The component framework just makes sure that we only expose the DRM device after all GPU cores that should be managed by a single DRM device instance are probed. One could easily image a PCI device that containing a 2D and a 3D Vivante GPU that should be made available through a single DRM device. In that case you'll also need to use the component framework. > > > > > 2) Possibly for create a device for some other tiny hardware logic > > > come with the platform > > > > > Do you have something in mind here? Until now I assumed that only the > > GPU core is behind the PCI abstraction. Is there something else sharing > > the MMIO space? > > A display controller, HDMI phy, vga encoder etc > > > I have a discrete PCIe GPU card from another vendor, > > It integrated display controller and vivante GPU and unknown VPUs. > > All of theĀ  hardware block mentioned above sharing the MMIO space. > > There are available on the same time when you mount this discrete PCIe > GPU card on the mother board > But they surely should not all be made available through the etnaviv driver. Etnaviv deals with the Vivante GPUs. If you have a PCI device with multiple IP cores behind the shared MMIO space you should have a PCI driver instantiating platform devices so the respective drivers for those IP cores can bind to the platform device. Etnaviv is not that driver. Regards, Lucas > > > > Regards, > > Lucas > > > > > 3) Revival component_compare_dev_name() function. > > > > > > > in this compilation unit this function is specific > > > > to the etnaviv driver and I don't see why we shouldn't have etnaviv > > > > specifics in there if it makes the code of this driver easier to > > > > follow. >