Specify UTF-8 character encoding for GPIO names strings.
Fixes: https://github.com/oasis-tcs/virtio-spec/issues/115 Suggested-by: Stefan Hajnoczi stefanha@redhat.com Signed-off-by: Viresh Kumar viresh.kumar@linaro.org --- virtio-gpio.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/virtio-gpio.tex b/virtio-gpio.tex index 5da16d920aa3..0b0689cceb08 100644 --- a/virtio-gpio.tex +++ b/virtio-gpio.tex @@ -119,7 +119,8 @@ \subsubsection{requestq Operation: Get Line Names}\label{sec:Device Types / GPIO order of the GPIO line numbers. The names of the GPIO lines are optional and may be present only for a subset of GPIO lines. If missing, then a zero-byte must be present for the GPIO line. If present, the name string must be zero-terminated -and the name must be unique within a GPIO Device. +and the name must be unique within a GPIO Device. The names of the GPIO lines +are encoded in UTF-8.
These names of the GPIO lines should be most meaningful producer names for the system, such as name indicating the usage. For example "MMC-CD", "Red LED Vdd"
On Wed, Aug 18, 2021 at 1:31 PM Viresh Kumar viresh.kumar@linaro.org wrote:
diff --git a/virtio-gpio.tex b/virtio-gpio.tex index 5da16d920aa3..0b0689cceb08 100644 --- a/virtio-gpio.tex +++ b/virtio-gpio.tex @@ -119,7 +119,8 @@ \subsubsection{requestq Operation: Get Line Names}\label{sec:Device Types / GPIO order of the GPIO line numbers. The names of the GPIO lines are optional and may be present only for a subset of GPIO lines. If missing, then a zero-byte must be present for the GPIO line. If present, the name string must be zero-terminated -and the name must be unique within a GPIO Device. +and the name must be unique within a GPIO Device. The names of the GPIO lines +are encoded in UTF-8.
I would prefer mandating this to be 7-bit ASCII, since Linux uses the string as a file name in the (deprecated) sysfs interface, and the more unusual symbols may be hard to type on the command line.
There is also a question about UTF-8 normalization of those strings: should the guest assume that the names within a device just have different binary representations, or also that they represent unique strings when there are multiple equivalent or compatible sequences?
Arnd
On Wed, Aug 18, 2021 at 02:02:19PM +0200, Arnd Bergmann wrote:
On Wed, Aug 18, 2021 at 1:31 PM Viresh Kumar viresh.kumar@linaro.org wrote:
diff --git a/virtio-gpio.tex b/virtio-gpio.tex index 5da16d920aa3..0b0689cceb08 100644 --- a/virtio-gpio.tex +++ b/virtio-gpio.tex @@ -119,7 +119,8 @@ \subsubsection{requestq Operation: Get Line Names}\label{sec:Device Types / GPIO order of the GPIO line numbers. The names of the GPIO lines are optional and may be present only for a subset of GPIO lines. If missing, then a zero-byte must be present for the GPIO line. If present, the name string must be zero-terminated -and the name must be unique within a GPIO Device. +and the name must be unique within a GPIO Device. The names of the GPIO lines +are encoded in UTF-8.
I would prefer mandating this to be 7-bit ASCII, since Linux uses the string as a file name in the (deprecated) sysfs interface, and the more unusual symbols may be hard to type on the command line.
There is also a question about UTF-8 normalization of those strings: should the guest assume that the names within a device just have different binary representations, or also that they represent unique strings when there are multiple equivalent or compatible sequences?
I'm fine with either one. If there are technical limitations that make ASCII a safer choice then that's fine.
virtio-blk uses ASCII while virtio-serial and virtiofs use UTF-8 for strings.
Stefan
stratos-dev@op-lists.linaro.org