Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp107393rba; Wed, 20 Mar 2024 12:22:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtdF4ZzzcSftVDzFGWgqiKLhkKj+evwG7UEJyLxQOKfDHGdcb5W/O0byXkV+h2tsh6JPl3Qex/wnfr+R9/ctnFMtExRBWkCreAft++Fg== X-Google-Smtp-Source: AGHT+IH9uDz2vt2ftGnfpWpIiY/6lyaCW8qNDYEmPgJ64aOlbUC0Ynrb/hPYwKn/6M8OtuoKX5DH X-Received: by 2002:a17:90a:520c:b0:29c:74a4:72b3 with SMTP id v12-20020a17090a520c00b0029c74a472b3mr16965pjh.8.1710962552288; Wed, 20 Mar 2024 12:22:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710962552; cv=pass; d=google.com; s=arc-20160816; b=SkSEQ9lvY4tJXtkMFGJmFkPEHxsH/p3oszCpOBR4kUprBnJKgExKTg5p25dtOeUkTC AEaSRqrhEQUDPn5H0xFCZ23q+rmebROK0zzeq0MnugA/UKDem5KOSoQhx72kbrOHutQf w1jkKjB4hG6Cz52DcjAWacb+SGzSKWZO6IAwVwsVUb0vE/45Zf/Eb1yePJhgBBXIRrBf G/fcNgJq4eAiQSFZZwDsH3tIOKkbTbh5tqyNJUOYXIKhm3TRfof1HJziB+LdpS4Mk06V BAFjM7oO0j5qItSnvpDP0R3wOp0HGgHlBj6uOqSXC4GMOSPYIOvjpAqktvrEjzXUGu2W +jLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=4sLgrJY1ZHs50/OMosMO/w2/lI0zobbFbhfe2FQeSiw=; fh=50EeFtqDv6m/0jKufSlz6w9KFOoSRzuNO8SiDJTX7J4=; b=V92T+fRTHdZftl06VbqivxAcGCDPvoGO8IPToQUknF4XsqJmZSC+T9Am9glvnj4Q/+ QuCd+ADUE4wyY92maHiODPKKTu5KukdA+WaK1XdGLi0PriikNQGeapU5gutSN/W7exV2 te0xxTbOYDFlpl2y8HghUR4VL/XTUehsab3POBNLOY5Ca/BSuJezwAJY7Len+kU9UAA3 jZ3gKa/YYioma5Pvz4wzQprYwja+pljk7rXhyq0Jtt+BoV23zO9E/78oS9H87EVSAgj3 W/+CFVn7+1lySi0gG2KbJAyl9hIFeLShR7StjHUzvlK/68pIXu+rw/ktEzJxAq62XVNA VZvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nWJh5EdR; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-109337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bv4-20020a17090af18400b0029c6d563bbasi1947581pjb.41.2024.03.20.12.22.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 12:22:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nWJh5EdR; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-109337-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109337-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E3F3CB22933 for ; Wed, 20 Mar 2024 19:22:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82AF18529D; Wed, 20 Mar 2024 19:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="nWJh5EdR" Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 418356AFAE for ; Wed, 20 Mar 2024 19:22:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710962539; cv=none; b=XS/c8VHXaAY4VZx5zt+aJbDXKPdtv2LE2urY0+xWSIbWwleYFARePQK6BdGGNUmW+hIf7HIGiTicrW889qpQ6eXCQETVGRSk1hqSGYkW354qBLS+ORuSfvIfjDrJ0p/PLC0VmpaVaB16Ri41t3j3oym7JKqKZ/oZ4OgA9Wu6Was= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710962539; c=relaxed/simple; bh=bJsr6GmD+N1RSONGR4sqICG/kfmdwzIcSNAniUL48D8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QzAtvlS0tiVrCvX7xBJjuA1LVupZiJJM+nxLc9aZlGZ0aj8V2NtimbYhw8y+sbNkksX+IS7yItx3KFAhwGFxIRQYtMYRoN5XlcF8ZAmNt2ZlqOJxaZiAskxgwVqZnkA0hy0T6TfY+rVo3ZIqKlOs6PMZa2Z8XqW4m8844+umYbU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=nWJh5EdR; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <9ced20e0-dfbd-4337-b5df-223b7baffd9e@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710962535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4sLgrJY1ZHs50/OMosMO/w2/lI0zobbFbhfe2FQeSiw=; b=nWJh5EdR/NoeKbO6ajZVjvEdcrTpbnjzliR8Vg196YIG+UjS7Qjc4OZ7PidoKBChgAHQMo EeJhjVQv30LZq8FySDzflVzZEwmatx5h71eEX4JQkM+vFk5naj9XT9KJhrUJwWrphTiRPk KO7KxKja8+lBqyKn/Nx+A/HTKxw3OSY= Date: Thu, 21 Mar 2024 03:22:05 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] software node: Implement device_get_match_data fwnode callback To: Andy Shevchenko Cc: "Rafael J . Wysocki" , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Vladimir Oltean References: <20240318234222.1278882-1-sui.jingfeng@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Hi, On 2024/3/20 18:39, Andy Shevchenko wrote: > +Cc: Vladimir > > On Tue, Mar 19, 2024 at 07:42:22AM +0800, Sui Jingfeng wrote: >> This makes it possible to support (and/or test) a few drivers that >> originates from DT World on the x86-64 platform. Originally, those >> drivers using the of_device_get_match_data() function to get match >> data. For example, drivers/gpu/drm/bridge/simple-bridge.c and >> drivers/gpu/drm/bridge/display-connector.c. Those drivers works very >> well in the DT world, however, there is no counterpart to >> of_device_get_match_data() when porting them to the x86 platform, >> because x86 CPUs lack DT support. > This is not true. > > First of all, there is counter part that called device_get_match_data(). Are you means that the acpi_fwnode_device_get_match_data() implementation? As the fwnode API framework has three backend: OF, ACPI, and software node. If you are hinting me that the acpi backend has the .device_get_match_data implemented. Then you are right. > Second, there *is* DT support for the _selected_ x86 based platforms. Yeah, you maybe right again here. I guess you means that some special hardware or platform may have a *limited* support? Can you pointed it out for study of learning purpose? To speak precisely, there are some drm display bridges drivers are lack of the DT support on X86. Those display bridges belong to the device drivers catalogs. OK, I will update my commit message at the next version if possible, and try my best to describe the problem precisely. >> By replacing it with device_get_match_data() and creating a software >> graph that mimics the OF graph, everything else works fine, except that >> there isn't an out-of-box replacement for the of_device_get_match_data() >> function. Because the software node backend of the fwnode framework lacks >> an implementation for the device_get_match_data callback. > .device_get_match_data > >> Implement device_get_match_data fwnode callback fwnode callback to fill > .device_get_match_data OK, thanks a lot. >> this gap. Device drivers or platform setup codes are expected to provide >> a "compatible" string property. The value of this string property is used >> to match against the compatible entries in the of_device_id table. Which >> is consistent with the original usage style. > Why do you need to implement the graph in the board file? It can be inside the chip, there is no clear cut.  I means that the graph(including fwnode graph, OF graph or swnode graph) can be used at anywhere. The examples given here may lead you to think it is board specific, but it is not limited to board specific. fwnode graph, OF graph and swnode graph, all of them are implements of the graph. Its common that different hardware vendors bought the some IP and has been integrated it into their SoC. So it can be inside of the chip if you want *code sharing*. Back to the patch itself, we want to keep the three backends aligned as much as possible. Is this reasonable enough? > ... > > Have you seen this discussion? > https://lore.kernel.org/lkml/20230223203713.hcse3mkbq3m6sogb@skbuf/ > I really didn't have seen that thread before this patch is sent, I'm a graphic developer, I'm mainly focus on graphics domain. Previously, I have implemented similar functionality at the drivers layer [1][2]. But as the instances grows, I realized there is a risk to introducing *boilerplate*. So I send this patch. [1][2] can be drop if this patch could be merged. [1] https://patchwork.freedesktop.org/patch/575414/?series=129040&rev=1 [2] https://patchwork.freedesktop.org/patch/575411/?series=129040&rev=1 After a brief skim, I guess we encounter similar problems. Oops! In a nutshell, there is a need to *emulation* on X86 platform, to suit the need of device-driver coding style of DT world. Besides, at the swnode backend layer, we should not call fwnode_property_read_string(), instead, we should usethe property_entry_read_string_array() function. Because the fwnode_property_read_string() is belong to upper layer. While backend implementations should call functions from bottom layer only. -- Best regards, Sui