From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 References: <4bb66b16dc261acf9d40517c8b7961a52212086b.1626418779.git.viresh.kumar@linaro.org> <20210716111916-mutt-send-email-mst@kernel.org> In-Reply-To: <20210716111916-mutt-send-email-mst@kernel.org> From: Viresh Kumar Date: Fri, 16 Jul 2021 21:11:41 +0530 Message-ID: Subject: Re: [PATCH V5 1/2] virtio-gpio: Add the device specification Content-Type: text/plain; charset="UTF-8" To: "Michael S. Tsirkin" Cc: Jason Wang , Cornelia Huck , Linus Walleij , Bartosz Golaszewski , Vincent Guittot , Arnd Bergmann , Jean-Philippe Brucker , Bill Mills , =?UTF-8?B?QWxleCBCZW5uw6ll?= , "Enrico Weigelt, metux IT consult" , virtio-dev@lists.oasis-open.org, Geert Uytterhoeven List-ID: On Fri, 16 Jul 2021 at 20:52, Michael S. Tsirkin wrote: > On Fri, Jul 16, 2021 at 01:09:18PM +0530, Viresh Kumar wrote: > > +\begin{lstlisting} > > +struct virtio_gpio_config { > > + u8 name[32]; > > + le16 ngpio; > > + le16 names_offset; > > + le32 names_size; > > + > > + /* at offset defined by names_offset field */ > > + u8 gpio_names[]; > > +}; > > +\end{lstlisting} > > + > > +\item[\field{gpio_names}] field is optional for a device to implement. If this > > + field isn't implemented by the device, then the device must set the > > + \field{names_size} field to zero. If this field is implemented by the > > + device, then it must contain a stream of \field{ngpio} zero-terminated > > + strings, where each string represents the name of a GPIO line, present in > > + increasing order of the GPIO line numbers. The GPIO line names must > > + be unique within a GPIO Device and must not be empty string. > > + > > +\end{description} > > There's a problem with this approach: config space size is > actually pretty limited since it might be in the IO space > when using PCI. That is turn is recommended not to exceed 256 bytes. Hmm, interesting. This block of data, for gpio names, can be really large as well, lets say if we have 256 GPIOs with each requiring 10 bytes for name, its over 2KB. Yeah, that can't go with the config structure then. > Is it important to have the names accessible before driver > is fully initialized? Not really. > If not I would just create a VQ and use that to retrieve this data. For example in Linux we need this information before the GPIO device is registered with the framework and we can fetch data over virtio there. > Note: the competing virtio-gpio proposal on list shares the issue. Right. Thanks Michael for your feedback. -- viresh