From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2AF5C2B9F4 for ; Mon, 14 Jun 2021 13:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDE186128A for ; Mon, 14 Jun 2021 13:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233628AbhFNN2G (ORCPT ); Mon, 14 Jun 2021 09:28:06 -0400 Received: from mail-lf1-f47.google.com ([209.85.167.47]:38564 "EHLO mail-lf1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbhFNN2E (ORCPT ); Mon, 14 Jun 2021 09:28:04 -0400 Received: by mail-lf1-f47.google.com with SMTP id r5so21139728lfr.5 for ; Mon, 14 Jun 2021 06:25:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xltRc6v0RYzP2GYCLquSH6jOzZUqizX4njH8fTXxQ8U=; b=BUxPBTkFwZSeaUFSb0ogjPS8sVETik0sAKjL2T3mRTIF/6LU9JTiVFEVPBzNcVasid tKE6xCy0ROIQjV1+EK9I5obP9Vh2jC573aLmG0NXBQ8ZscvC3Rb0BR7+EsqRNESFX9Dl 6ZsEW+JlbtEG7obEeUoJrzwkm5PAuohU1OpBtQBG8pkbpKU66n1Q+ciEDPE2BMF4Kwda u+CIQ6gNLKiJX1lqZyTFwZ3BYQi03NkSxRbhqpDM3Lvdde1nNbA3RzeYu5DkH4gIv7yY JcpX3Sjbap1xDib3abHgKBqkw6fU2LOV8h91Ij0Tn56DSd0JPXwBDFOdV3/Af6OjRhHD EuPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xltRc6v0RYzP2GYCLquSH6jOzZUqizX4njH8fTXxQ8U=; b=DWc1vY8uU28n1Kx2xu2Ra0+GPXDmPcq8tfn6OJNs5jGpYlqs09kAAOkaICQJieu6Hd mvYkrnPd6PckIIYeYtuBRC3Q4447gPSRoSttI2c9xH6X4POFj74LTEkA9wj+RHD2rHbL PcCfrAgn5heXgoS/RNXO96WCRtySJG9BEUJnUt5BxtqRr252TQuUBP7q6fNdzl57Rv5n 8JXlxcieweCHsbw/NPpUP+cXv0LCBSfoXFA5vSSW0nTGTXgDcbNcjD9cfCRXZuBU79Vo xW6/4+o2Olbz+z7Q9UxMSH7+OtZlrWS1HT6Ev5ogYKflkXyjkTpgckJMRAINva6+yGX3 HLHQ== X-Gm-Message-State: AOAM5322TIEGjPufQfUlBAVi3uABA033JvxfduIn8TowQZ8wNLR/HyLH nST/QHZQNMBAOxicq23XcE8vmodais9jwZGqkHv0dQ== X-Google-Smtp-Source: ABdhPJzxu/bbJj/tjk+9kiZjUXBMExtN/SoD6He5VyGix4LZaxl4y/uFjPI1E/gacHMwLVvWATmzF1kDDEcSkKoCPoM= X-Received: by 2002:a05:6512:3483:: with SMTP id v3mr12270789lfr.154.1623677088786; Mon, 14 Jun 2021 06:24:48 -0700 (PDT) MIME-Version: 1.0 References: <10442926ae8a65f716bfc23f32339a6b35e51d5a.1623326176.git.viresh.kumar@linaro.org> <20210614102119.qifm5sj7fpg54iqo@vireshk-i7> <0100017a0a9264cc-57668c56-fdbf-412a-9f82-9bf95f5c653e-000000@email.amazonses.com> In-Reply-To: From: Vincent Guittot Date: Mon, 14 Jun 2021 15:24:37 +0200 Message-ID: Subject: Re: [Stratos-dev] [PATCH V3 1/3] gpio: Add virtio-gpio driver To: Arnd Bergmann Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , 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" , Viresh Kumar , 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 Mon, 14 Jun 2021 at 15:00, Arnd Bergmann wrote: > > On Mon, Jun 14, 2021 at 2:50 PM Vincent Guittot via Stratos-dev > wrote:> > > On Mon, 14 Jun 2021 at 14:33, Arnd Bergmann wrote: > > > On Mon, Jun 14, 2021 at 12:23 PM Viresh Kumar wrote: > > > > > > I think most importantly we need a DT binding to describe what device > > > nodes are supposed to look like underneath a virtio-mmio or > > > virtio-pci device in order for a hypervisor to pass down the > > > information to a guest OS in a generic way. We can probably borrow > > > the USB naming, and replace compatible="usbVID,PID" with > > > compatible="virtioDID", with the device ID in hexadecimal digits, > > > such as "virtio22" for I2C (virtio device ID 34 == 0x22) if we decide > > > to have a sub-node under the device, or we just point dev->of_node > > > of the virtio device to the platform/pci device that is its parent > > > in Linux. > > > > > > Adding the Linux guest code to the virtio layer should be fairly > > > straightforward, and I suppose it could be mostly copied from the > > > corresponding code that added this for mmc in commit 25185f3f31c9 > > > ("mmc: Add SDIO function devicetree subnode parsing") and for USB > > > in commit 69bec7259853 ("USB: core: let USB device know device > > > node") and 1a7e3948cb9f ("USB: add device-tree support for > > > interfaces"). > > > > And something similar is also done with SCMI protocols which are > > defined in a SCMI node. A typical example: > > > > cpu@0 { > > ... > > clocks = <&scmi_dvfs 0>; > > ... > > }; > > > > deviceX: deviceX@YYYYYYY { > > ... > > clocks = <&scmi_clk 0>; > > ... > > }; > > > > scmi: scmi { > > compatible = "arm,scmi-virtio"; > > #address-cells = <1>; > > #size-cells = <0>; > > > > scmi_devpd: protocol@11 { > > reg = <0x11>; > > #power-domain-cells = <1>; > > }; > > > > scmi_clk: protocol@14 { > > reg = <0x14>; > > #clock-cells = <1>; > > }; > > > > scmi_sensors: protocol@15 { > > reg = <0x15>; > > #thermal-sensor-cells = <1>; > > }; > > > > scmi_dvfs: protocol@13 { > > reg = <0x13>; > > #clock-cells = <1>; > > }; > > }; > > But this example seem to be completely different from the ones I mentioned: > The scmi node that you have here looks like it shows up under the root of the > device tree, not below the virtio device that implements the scmi transport. I was thinking of something like below: deviceX: deviceX@YYYYYYY { ... gpio = <&virtio_gpio 0>; ... }; virtio_mmio@a000000 { dma-coherent; interrupts = <0x0 0x10 0x1>; reg = <0x0 0xa000000 0x0 0x200>; compatible = "virtio,mmio"; virtio_gpio: protocol@22 { reg = <0x22>; }; }; > > Arnd