Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp787292pxj; Thu, 10 Jun 2021 12:46:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5CU68wFDUN8OyDyXcbS4MqyNOvQ7P5hnXaNGVQGMVBYOxqgLY9LOYRD62pwW1AoTQHES4 X-Received: by 2002:a17:906:8a6c:: with SMTP id hy12mr233499ejc.438.1623354381071; Thu, 10 Jun 2021 12:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623354381; cv=none; d=google.com; s=arc-20160816; b=FLnH5KsA6/A9t3HBoIckcg0+n7jR6THGRdU0VwkLt8cJCHFmIQQbs94NBzxwXUXVC+ D88XfZsSghr8E8cJGJEFhCiD9SwKgHYUpWTac/TAZ/PKzzeiFKOK3R+e5uWiqx9KGk3L vIKU0rzph2yiVNDZHgHcmqMnLRQCDc+qsfHyLd7peS9/ZJPS3pLNLZdjD/wNylCWnfMv ksru9JaGBaqieceWUQUobQKlflDBV3llEl5ZRj6DB6SA3aSUS/Y1M4Vjmn8jnaVwljr8 OBMNXMNcjoXWCFWhCs+k7i44Cn7DxPP20q5tbhmJ3phiZD2iVkNfWThGjMfEGNH4EoOe /UVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QOwpB896loziC1SS5nQwakH64AOTHkfzLCKHxrP+XJY=; b=ezuJZChBbtVnLUlgwFdQLCe2L+R1WX7GavZ+O7gSq1nsGVEG7nMwR9zkIenJXD00eN sqElasQXWN+0ylPOMw6KAFriw1onrf38Ju/fxitJ6eqEz3j7myWAJEW3/Je522W+o7fF /ESJcnqS/JqtKjKzSUCL154udbeHFI7oLz61UrqXhP5zXQqKVmLLeLFim6EkWFonHCoa xzkbdLo/RUpfJudRODbaHW+hKnL7GbF+wSO7n//7f1sEOeetRg0oXxBPngIfQLhxuCsf eyyjSaQEHl3Ch95I6BGj5oT3Uy6zhewKn2SsaruW8TIxuLA8pIFM8bJq6htTZ6WDbPbw 2dBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UtwWwOou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx17si2946639ejb.539.2021.06.10.12.45.55; Thu, 10 Jun 2021 12:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UtwWwOou; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230247AbhFJTo4 (ORCPT + 99 others); Thu, 10 Jun 2021 15:44:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:45798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbhFJToz (ORCPT ); Thu, 10 Jun 2021 15:44:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7A0961414; Thu, 10 Jun 2021 19:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623354178; bh=e1qYqp9Ml4zXeFi4sMYRsxc9z9GOxYqqa+CE28wWI4U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=UtwWwOounqCQDCI2o/53cZnytek08hk2lIx6VXjwSc6qRSpnetjeqNGhQ4NmbEvU1 GkCRcTc3Y45E2a8Dvqy5J3RoNJMbMqPt597XTM7Jgw7RZAFohVLRXHjb691iK1autt /Lbe0GfobQxTqPF2ahUPC+oQ7PvJrocoT6vNfYMHp/adAsqhzqXJ7MN509Q6moDtNU qV3C8Uti77SZZaJDiSZDiihxsDa69eg6/CZw5XGIPXgSi4xfK8uEmKvtLsNJRQAnkx aS5T6Mtwplu/kd6YAYlLwQKFf8IgrC14aEN4PDVRPYlRQIKAlxEiVEeeVOpsNjDa0P wyBVZb8KIpBkA== Received: by mail-wr1-f49.google.com with SMTP id c5so3538812wrq.9; Thu, 10 Jun 2021 12:42:58 -0700 (PDT) X-Gm-Message-State: AOAM531D1dvpY5+mNf2xqIj3xFAm6f28hzc44RYUYkzZoB7WaXJbpUAE xKZOTJcwnD0GCUuJFbqRIME9+oA4Ih9s5OZCjro= X-Received: by 2002:adf:a28c:: with SMTP id s12mr104051wra.105.1623354177356; Thu, 10 Jun 2021 12:42:57 -0700 (PDT) MIME-Version: 1.0 References: <10442926ae8a65f716bfc23f32339a6b35e51d5a.1623326176.git.viresh.kumar@linaro.org> <01000179f6a7715c-cd106846-7770-4088-bb7c-a696bfcbf83e-000000@email.amazonses.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 10 Jun 2021 21:41:01 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Stratos-dev] [PATCH V3 1/3] gpio: Add virtio-gpio driver To: Jean-Philippe Brucker Cc: "Enrico Weigelt, metux IT consult" , Viresh Kumar , Stefan Hajnoczi , "Michael S. Tsirkin" , Viresh Kumar , Linus Walleij , Linux Kernel Mailing List , virtualization@lists.linux-foundation.org, Bartosz Golaszewski , "Stefano Garzarella --cc virtualization @ lists . linux-foundation . org" , "open list:GPIO SUBSYSTEM" , Stratos Mailing List , "Enrico Weigelt, metux IT consult" , Jason Wang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 7:03 PM Jean-Philippe Brucker wrote: > > On Thu, Jun 10, 2021 at 04:00:39PM +0000, Enrico Weigelt, metux IT consult via Stratos-dev wrote: > > On 10.06.21 15:22, Arnd Bergmann wrote: > > > > > Can you give an example of how this would be hooked up to other drivers > > > using those gpios. Can you give an example of how using the "gpio-keys" or > > > "gpio-leds" drivers in combination with virtio-gpio looks like in the DT? > > > > Connecting between self-probing bus'es and DT is generally tricky. IMHO > > we don't have any generic mechanism for that. > > DT does have a generic description of PCI endpoints, which virtio-iommu > relies on to express the relation between IOMMU and endpoint nodes [1]. > I think the problem here is similar: the client node needs a phandle to > the GPIO controller which may use virtio-pci transport? Right, the code to set dev->of_node is fairly simple, the device probe just needs to scan for child nodes. Aside from PCI, similar code exists for USB and MMC/SDIO, which are usually discoverable but sometimes need additional properties. > Note that it mostly works if the device is on the root PCI bus. Behind a > bridge the OS may change the device's bus number as needed, so the BDF > reference in DT is only valid if the software providing the DT description > (VMM or firmware) initializes bus numbers accordingly (and I don't > remember if Linux supports this case well). I think you can mark the host bridge as "probe-only" to prevent the OS (at least Linux) from renumbering the buses. The part I did not find though is assigning dev->of_node in the virtio_device to a child of the PCI device node. Arnd