From patchwork Thu Jun 10 12:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 457852 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp414315jae; Thu, 10 Jun 2021 05:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxshygevtlgbiwMGWZe8TXjMaPwKZtTYcRd5kBFg7krheh6z4TWbdmTlEu6U1Tj6wQFESnE X-Received: by 2002:a17:906:744:: with SMTP id z4mr4273868ejb.347.1623327460283; Thu, 10 Jun 2021 05:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623327460; cv=none; d=google.com; s=arc-20160816; b=fcLKX7p+GI+dnEkJdPkc07VkwTOR0iD+LbvUGURhZUnBhoB9AuQJPJGzo6446HIwml 9En3+r8jSBBIq8MDdxWhbwJ4RLzBtc7lUWJwOj8MLc5TiuqlXUzPtdI4RnPJNVAPKB8E Im6/XRnpS4HmSgDSRhFFefRoiTn77UCuhnOHmhkPvJXsBo+Dz51hZB4WMkdBDaL7Kz6Q hBOWVyS6M+8mWmgJyKtrsDiRbEH12UiTpITAmjP/GCtBOrVdQzVuftKM2D7aVV7WzMY6 rAuTX29+hFrG4ePrfgI0f6M9MAyqqNnmWQZii/9mwVnLnWnZpKxQjRs6joLFtDiOQvzo 59+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wOu3fDG+mFoQYcon/7H3S12nd7R/QAMh1wpiZegcxiw=; b=09irKYsxSb8gxxFFO8GgqfHL4DrTqi4G7SjbVvU3ayiLAAInjFzUSdczGIgWasIvfA Ogdes+UxXkHUfweE66Kgw5Kab2BWpgvq+wZVRoaN/gZbZO1Xdt3aohBovumsLhHRBOul NikMWvY+xAJ53U6UEt6JksDtxkccNJcsZXXzbMlBKBaKGbFK8MwyYymutP1yHMxitRGy 1LM//MND4I2hBm05b/lthXg1H8iKibO+8dYJYUHFD5vsjZOW1x5MPUElFSApSCm31SZl eTYMZFAlaFhWrvqQUW6MgkKa75R+cG+cWCcbpdyPWzlWAuHUOyLL8NPA4yuw/WXQ+P2e +HAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rRdA3EI3; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd11si2076107edb.528.2021.06.10.05.17.40; Thu, 10 Jun 2021 05:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-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=@linaro.org header.s=google header.b=rRdA3EI3; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230265AbhFJMTf (ORCPT + 3 others); Thu, 10 Jun 2021 08:19:35 -0400 Received: from mail-pl1-f180.google.com ([209.85.214.180]:35463 "EHLO mail-pl1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbhFJMTe (ORCPT ); Thu, 10 Jun 2021 08:19:34 -0400 Received: by mail-pl1-f180.google.com with SMTP id x19so917431pln.2 for ; Thu, 10 Jun 2021 05:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wOu3fDG+mFoQYcon/7H3S12nd7R/QAMh1wpiZegcxiw=; b=rRdA3EI31LXvnOC+g6aCM6DuO0S2PmQp7rld4OmfNnfkRQYt5aXM5niEdn4EuLPn4/ CazA3pRWpK7Mp4DFm3IhRJHyhVGPTG+pjfstJyxs2bfcQQ2qKV1Rj8iPUgAek0gWNnqX nAsQVH5Y/FUtRGKLScrhSsA17hbYgMsmDOZH7wwNBlY3asySna88wdc1VPv8gAZ19hAf RDb0R0BFQhonAN31caUKp9BjXMcWGN690vFEXEJMtxiPB95XXatF1V7s6GLVQ2JnqWu5 Bn6hEd6o6kfjTM+/Lpd1pvuCWEfT4KMIF55SQa3/rlJfHTxdB2bTHy6DA1rMV4eHnt4D U6fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wOu3fDG+mFoQYcon/7H3S12nd7R/QAMh1wpiZegcxiw=; b=n3d5lrfS/N3qW8NOyDBjVF4obwD2Pz8Talh2uU6KU5ldljm6jxfy5LQOzJxTKSUh37 FuVahvWhjvLp2PeEB09MRI4S36TmqnIDZIyuY03P8DI9C0f3YJC+l2NSoT56qXGlxKRT nBzWPYTTwDfuQZd9LyomR4eqbfaLoZxBsDTKpRNsyWcr2AKqnRaUpBSdlpdsqEqUQXPt oNtFP2BdBUfgzwqe8PYv4gCFdYOXMv15V70Zoq2VDkzTg6QFEZHsqXSu3d3RgVRxxwSv S1YapZlup1xbh6biMfJZ3I07D7n/u6uu0C7rOucAZPo8eSwVQdixJbNICycL9cwrTChB +cEg== X-Gm-Message-State: AOAM530CYZ42LfhMieiQKOzoROUnlQWVcAjbP9KY0joU0fy4T0/35vd9 7m284wqj14b5UWRu1+4qGsSDfg== X-Received: by 2002:a17:90b:4f44:: with SMTP id pj4mr3029377pjb.97.1623327398442; Thu, 10 Jun 2021 05:16:38 -0700 (PDT) Received: from localhost ([136.185.169.128]) by smtp.gmail.com with ESMTPSA id kb14sm1720723pjb.2.2021.06.10.05.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 05:16:37 -0700 (PDT) From: Viresh Kumar To: Bartosz Golaszewski , Linus Walleij , "Enrico Weigelt, metux IT consult" , Viresh Kumar , "Michael S. Tsirkin" , Jason Wang Cc: Viresh Kumar , Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , stratos-dev@op-lists.linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Hajnoczi , "Stefano Garzarella --cc virtualization @ lists . linux-foundation . org" , virtualization@lists.linux-foundation.org Subject: [PATCH V3 1/3] gpio: Add virtio-gpio driver Date: Thu, 10 Jun 2021 17:46:32 +0530 Message-Id: <10442926ae8a65f716bfc23f32339a6b35e51d5a.1623326176.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: "Enrico Weigelt, metux IT consult" This patch adds a new driver for Virtio based GPIO devices. This allows a guest VM running Linux to access GPIO device provided by the host. It supports all basic operations for now, except interrupts for the GPIO lines. Signed-off-by: "Enrico Weigelt, metux IT consult" Co-developed-by: Viresh Kumar Signed-off-by: Viresh Kumar --- drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-virtio.c | 326 +++++++++++++++++++++++++++++++ include/uapi/linux/virtio_gpio.h | 41 ++++ include/uapi/linux/virtio_ids.h | 1 + 5 files changed, 378 insertions(+) create mode 100644 drivers/gpio/gpio-virtio.c create mode 100644 include/uapi/linux/virtio_gpio.h -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index e3607ec4c2e8..7f12fb65d130 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1633,6 +1633,15 @@ config GPIO_MOCKUP tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in it. +config GPIO_VIRTIO + tristate "VirtIO GPIO support" + depends on VIRTIO + help + Say Y here to enable guest support for virtio-based GPIO controllers. + + These virtual GPIOs can be routed to real GPIOs or attached to + simulators on the host (like QEMU). + endmenu endif diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index c58a90a3c3b1..ace004c80871 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -162,6 +162,7 @@ obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o obj-$(CONFIG_GPIO_UNIPHIER) += gpio-uniphier.o obj-$(CONFIG_GPIO_VF610) += gpio-vf610.o obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o +obj-$(CONFIG_GPIO_VIRTIO) += gpio-virtio.o obj-$(CONFIG_GPIO_VISCONTI) += gpio-visconti.o obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c new file mode 100644 index 000000000000..1ba8ddf4693a --- /dev/null +++ b/drivers/gpio/gpio-virtio.c @@ -0,0 +1,326 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * GPIO driver for virtio-based virtual GPIO controllers + * + * Copyright (C) 2021 metux IT consult + * Enrico Weigelt, metux IT consult + * + * Copyright (C) 2021 Linaro. + * Viresh Kumar + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct virtio_gpio { + struct virtio_device *vdev; + struct mutex lock; + struct gpio_chip gc; + + struct completion completion; + struct virtqueue *command_vq; + struct virtio_gpio_request creq; + struct virtio_gpio_response cres; + + /* This must be kept as the last entry here, hint: gpio_names[0] */ + struct virtio_gpio_config config; +}; + +#define gpio_chip_to_vgpio(chip) container_of(chip, struct virtio_gpio, gc) + +static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, + u8 txdata, u8 *rxdata) +{ + struct virtio_gpio_response *res = &vgpio->cres; + struct virtio_gpio_request *req = &vgpio->creq; + struct scatterlist *sgs[2], req_sg, res_sg; + struct device *dev = &vgpio->vdev->dev; + unsigned long time_left; + unsigned int len; + int ret; + + req->type = cpu_to_le16(type); + req->gpio = cpu_to_le16(gpio); + req->data = txdata; + + sg_init_one(&req_sg, req, sizeof(*req)); + sg_init_one(&res_sg, res, sizeof(*res)); + sgs[0] = &req_sg; + sgs[1] = &res_sg; + + mutex_lock(&vgpio->lock); + ret = virtqueue_add_sgs(vgpio->command_vq, sgs, 1, 1, res, GFP_KERNEL); + if (ret) { + dev_err(dev, "failed to add request to vq\n"); + goto out; + } + + reinit_completion(&vgpio->completion); + virtqueue_kick(vgpio->command_vq); + + time_left = wait_for_completion_timeout(&vgpio->completion, HZ / 10); + if (!time_left) { + dev_err(dev, "virtio GPIO backend timeout\n"); + return -ETIMEDOUT; + } + + WARN_ON(res != virtqueue_get_buf(vgpio->command_vq, &len)); + if (unlikely(res->status != VIRTIO_GPIO_STATUS_OK)) { + dev_err(dev, "virtio GPIO request failed: %d\n", gpio); + return -EINVAL; + } + + if (rxdata) + *rxdata = res->data; + +out: + mutex_unlock(&vgpio->lock); + + return ret; +} + +static int virtio_gpio_request(struct gpio_chip *gc, unsigned int gpio) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + return virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_ACTIVATE, gpio, 0, NULL); +} + +static void virtio_gpio_free(struct gpio_chip *gc, unsigned int gpio) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_DEACTIVATE, gpio, 0, NULL); +} + +static int virtio_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + u8 direction; + int ret; + + ret = virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_GET_DIRECTION, gpio, 0, + &direction); + if (ret) + return ret; + + return direction; +} + +static int virtio_gpio_direction_input(struct gpio_chip *gc, unsigned int gpio) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + return virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_DIRECTION_IN, gpio, 0, + NULL); +} + +static int virtio_gpio_direction_output(struct gpio_chip *gc, unsigned int gpio, + int value) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + return virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_DIRECTION_OUT, gpio, (u8) + value, NULL); +} + +static int virtio_gpio_get(struct gpio_chip *gc, unsigned int gpio) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + u8 value; + int ret; + + ret = virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_GET_VALUE, gpio, 0, &value); + if (ret) + return ret; + + return value; +} + +static void virtio_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) +{ + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_SET_VALUE, gpio, value, NULL); +} + +static void virtio_gpio_command(struct virtqueue *vq) +{ + struct virtio_gpio *vgpio = vq->vdev->priv; + + complete(&vgpio->completion); +} + +static int virtio_gpio_alloc_vqs(struct virtio_device *vdev) +{ + struct virtio_gpio *vgpio = vdev->priv; + const char * const names[] = { "command" }; + vq_callback_t *cbs[] = { + virtio_gpio_command, + }; + struct virtqueue *vqs[1] = {NULL}; + int ret; + + ret = virtio_find_vqs(vdev, 1, vqs, cbs, names, NULL); + if (ret) { + dev_err(&vdev->dev, "failed to allocate vqs: %d\n", ret); + return ret; + } + + vgpio->command_vq = vqs[0]; + + /* Mark the device ready to perform operations from within probe() */ + virtio_device_ready(vgpio->vdev); + return 0; +} + +static void virtio_gpio_free_vqs(struct virtio_device *vdev) +{ + vdev->config->reset(vdev); + vdev->config->del_vqs(vdev); +} + +static const char **parse_gpio_names(struct virtio_device *vdev, + struct virtio_gpio_config *config) +{ + struct device *dev = &vdev->dev; + char *str = config->gpio_names; + const char **names; + int i, len; + + if (!config->gpio_names_size) + return NULL; + + names = devm_kcalloc(dev, config->ngpio, sizeof(names), GFP_KERNEL); + if (!names) + return ERR_PTR(-ENOMEM); + + /* NULL terminate the string instead of checking it */ + config->gpio_names[config->gpio_names_size - 1] = '\0'; + + for (i = 0; i < config->ngpio; i++) { + /* + * We have already marked the last byte with '\0' + * earlier, this shall be enough here. + */ + if (str == config->gpio_names + config->gpio_names_size) { + dev_err(dev, "Invalid gpio_names\n"); + return ERR_PTR(-EINVAL); + } + + len = strlen(str); + if (!len) { + dev_err(dev, "Missing GPIO name: %d\n", i); + return ERR_PTR(-EINVAL); + } + + names[i] = str; + str += len + 1; + } + + return names; +} + +static int virtio_gpio_probe(struct virtio_device *vdev) +{ + struct virtio_gpio_config *config; + struct device *dev = &vdev->dev; + struct virtio_gpio *vgpio; + u32 size; + int ret; + + virtio_cread(vdev, struct virtio_gpio_config, gpio_names_size, &size); + size = cpu_to_le32(size); + + vgpio = devm_kzalloc(dev, sizeof(*vgpio) + size, GFP_KERNEL); + if (!vgpio) + return -ENOMEM; + + config = &vgpio->config; + + /* Read configuration */ + virtio_cread_bytes(vdev, 0, config, sizeof(*config) + size); + + /* NULL terminate the string instead of checking it */ + config->name[sizeof(config->name) - 1] = '\0'; + config->ngpio = cpu_to_le16(config->ngpio); + config->gpio_names_size = cpu_to_le32(config->gpio_names_size); + + if (!config->ngpio) { + dev_err(dev, "Number of GPIOs can't be zero\n"); + return -EINVAL; + } + + vgpio->vdev = vdev; + vgpio->gc.request = virtio_gpio_request; + vgpio->gc.free = virtio_gpio_free; + vgpio->gc.get_direction = virtio_gpio_get_direction; + vgpio->gc.direction_input = virtio_gpio_direction_input; + vgpio->gc.direction_output = virtio_gpio_direction_output; + vgpio->gc.get = virtio_gpio_get; + vgpio->gc.set = virtio_gpio_set; + vgpio->gc.ngpio = config->ngpio; + vgpio->gc.base = -1; /* Allocate base dynamically */ + vgpio->gc.label = config->name[0] ? + config->name : dev_name(dev); + vgpio->gc.parent = dev; + vgpio->gc.owner = THIS_MODULE; + vgpio->gc.can_sleep = true; + vgpio->gc.names = parse_gpio_names(vdev, config); + if (IS_ERR(vgpio->gc.names)) + return PTR_ERR(vgpio->gc.names); + + vdev->priv = vgpio; + mutex_init(&vgpio->lock); + init_completion(&vgpio->completion); + + ret = virtio_gpio_alloc_vqs(vdev); + if (ret) + return ret; + + ret = gpiochip_add(&vgpio->gc); + if (ret) { + virtio_gpio_free_vqs(vdev); + dev_err(dev, "Failed to add virtio-gpio controller\n"); + } + + return ret; +} + +static void virtio_gpio_remove(struct virtio_device *vdev) +{ + struct virtio_gpio *vgpio = vdev->priv; + + gpiochip_remove(&vgpio->gc); + virtio_gpio_free_vqs(vdev); +} + +static const struct virtio_device_id id_table[] = { + { VIRTIO_ID_GPIO, VIRTIO_DEV_ANY_ID }, + {}, +}; +MODULE_DEVICE_TABLE(virtio, id_table); + +static struct virtio_driver virtio_gpio_driver = { + .id_table = id_table, + .probe = virtio_gpio_probe, + .remove = virtio_gpio_remove, + .driver = { + .name = KBUILD_MODNAME, + .owner = THIS_MODULE, + }, +}; +module_virtio_driver(virtio_gpio_driver); + +MODULE_AUTHOR("Enrico Weigelt, metux IT consult "); +MODULE_AUTHOR("Viresh Kumar "); +MODULE_DESCRIPTION("VirtIO GPIO driver"); +MODULE_LICENSE("GPL"); diff --git a/include/uapi/linux/virtio_gpio.h b/include/uapi/linux/virtio_gpio.h new file mode 100644 index 000000000000..e805e33a79cb --- /dev/null +++ b/include/uapi/linux/virtio_gpio.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +#ifndef _LINUX_VIRTIO_GPIO_H +#define _LINUX_VIRTIO_GPIO_H + +#include + +/* Virtio GPIO request types */ +#define VIRTIO_GPIO_REQ_ACTIVATE 0x01 +#define VIRTIO_GPIO_REQ_DEACTIVATE 0x02 +#define VIRTIO_GPIO_REQ_GET_DIRECTION 0x03 +#define VIRTIO_GPIO_REQ_DIRECTION_IN 0x04 +#define VIRTIO_GPIO_REQ_DIRECTION_OUT 0x05 +#define VIRTIO_GPIO_REQ_GET_VALUE 0x06 +#define VIRTIO_GPIO_REQ_SET_VALUE 0x07 + +/* Possible values of the status field */ +#define VIRTIO_GPIO_STATUS_OK 0x0 +#define VIRTIO_GPIO_STATUS_ERR 0x1 + +struct virtio_gpio_config { + char name[32]; + __u16 ngpio; + __u16 padding; + __u32 gpio_names_size; + char gpio_names[0]; +} __packed; + +/* Virtio GPIO Request / Response */ +struct virtio_gpio_request { + __u16 type; + __u16 gpio; + __u8 data; +}; + +struct virtio_gpio_response { + __u8 status; + __u8 data; +}; + +#endif /* _LINUX_VIRTIO_GPIO_H */ diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index b89391dff6c9..0c24e8ae2499 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@ -55,5 +55,6 @@ #define VIRTIO_ID_PMEM 27 /* virtio pmem */ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ #define VIRTIO_ID_I2C_ADAPTER 34 /* virtio i2c adapter */ +#define VIRTIO_ID_GPIO 41 /* virtio GPIO */ #endif /* _LINUX_VIRTIO_IDS_H */ From patchwork Thu Jun 10 12:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 457851 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp413867jae; Thu, 10 Jun 2021 05:17:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxypLvGdApxhvweDGbNwRevon4cvhBY0WHWKt8G34zCJibcff8vrY1FMRkjjy3G2PI8X6sU X-Received: by 2002:a17:906:2dcb:: with SMTP id h11mr4235179eji.52.1623327428129; Thu, 10 Jun 2021 05:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623327428; cv=none; d=google.com; s=arc-20160816; b=euyhCwad/Y9FQf68rWG9CtWff/7k5+hBA8kwbnw8iiZAcaS7xlOFBmY1kmBnLq013F /cIsmc4kqyRr/+47Vry6fS2h0wdAJRzVYKwu9l288xq+hocycIncIFOJ62MHa1fb5OIw ctnqkuTQ3vDGlue7M8NexIP6nJt6IBt7MBPk0qQeArR7Xu/WssY1E8T7ms+JLMy/KvvB h0QnCRQc1Scf//q0Fj30pGKq51EhAo5PTBHUA8I/F/7Ytqp/1+noQMssi7B65vpRjOEb H/Mf+bnveb+jkt3x+RJMrclCyhtf0xIMThAWBk2JfdGel5PBdE/VJQM7x8rtviFFBnwl MHJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HKPV4/PpM8bmb6cNa0KbqAwbhxSpJpOWE2S52sDtLkQ=; b=JM5CG63RRDlWHkZMieDyFWCHjMH4NTffXQ52AgH83rEimB2uoxGJhV2gt965X/qk7y 5fPUIRvjlCwPfZuYh6U9a2XhLKsmhlFjZ3t5d3gw6q8KVGmqG49y56UXV5Le6QPoYQGZ Ec4pryvvB9m82+NZ1Y8wUyWGrRldbvB+2cOfcbmo/PsLPB2n1oegmnIAWLTiFDJICKYw Uxr/WHxBujLUIiLIB8ilRUJURz8PnIU2flbzJQ8Pydk8foUTVq/YXV4HYOy47u8dUgA8 gemEcI8sMM7CoaufyKXWm9uRhBBb75v5s4ANKG6ToL6R+huml0DvaxupwH6QJGcjdbr3 6z4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGiX81p1; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd11si2076107edb.528.2021.06.10.05.17.07; Thu, 10 Jun 2021 05:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-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=@linaro.org header.s=google header.b=PGiX81p1; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbhFJMSv (ORCPT + 3 others); Thu, 10 Jun 2021 08:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbhFJMSv (ORCPT ); Thu, 10 Jun 2021 08:18:51 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0775CC061574 for ; Thu, 10 Jun 2021 05:16:43 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id m13-20020a17090b068db02901656cc93a75so3628652pjz.3 for ; Thu, 10 Jun 2021 05:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HKPV4/PpM8bmb6cNa0KbqAwbhxSpJpOWE2S52sDtLkQ=; b=PGiX81p1g6M7caFceSQY/X/sErx+nkk6vO4paHZWC72sz/HLqd08oTEfoeq4MgF8Fp pyIiORBEANOJ9JiN3XWtaSq2crV4ZBy4QIeuqQpQgEbxwGtqAnDeXIaWgRtVBy+myaRS 9o1d0ExxzuGdqhY5Ql6Q2u7a0tRD/z6er0712/9vkO4ycs9uddi2L0lDdG2xYXGRTMQx tZIRu1IcaqLBXe4ARbjxr3tnAngQET6q1UzYqdOgpF2GdLQtbs+7xuEAxVMb78EaLs5m xtSrshOsRYLrho4K832laccohFcl15tzojzf4118IjJYPuhMdy0Vg2GhyRYceZ2s1eHm q8+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HKPV4/PpM8bmb6cNa0KbqAwbhxSpJpOWE2S52sDtLkQ=; b=EMNXx5X1ktv2nDkMOuzyqhIAwM2EP0JzH7bSftCX0GmvEcDtfOkyKEJyp31de0yssI D4cbgtg7Sotq1n2Kz8lFxGPSzZ5QAOZnSWFStJIUoUVb+0F7dR5YFaVrol2nWzFe2obY zcL18d82la3/hGvgMJWWvcyccoH0/4b8Gd8UZdkC4S2nqihOv7776b5x/7SuuXCTC5wq n5QL3TjcO3zOeenY/6OGCWN6tPAiji6+tASG4w/TTaYkY1yUDXTHEBYq3AC7VSZMZQua apXGYssfj/K4YZhbLEtEuVU60dAOjjy4sVSbq4FT8Otc8aXTRnJ5YhozETAl3ULS5gBS EWKw== X-Gm-Message-State: AOAM5307euwpPGkmkPyRcCW8BjGLAAj4zNSI9PyM5Pe3g9xs9VBb0eqN OSIjRz8neG4AbT1uDD41GiUCSg== X-Received: by 2002:a17:90a:1b68:: with SMTP id q95mr3135638pjq.116.1623327402518; Thu, 10 Jun 2021 05:16:42 -0700 (PDT) Received: from localhost ([136.185.169.128]) by smtp.gmail.com with ESMTPSA id n69sm2477676pfd.132.2021.06.10.05.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 05:16:42 -0700 (PDT) From: Viresh Kumar To: Bartosz Golaszewski , Linus Walleij , "Enrico Weigelt, metux IT consult" , Viresh Kumar , "Michael S. Tsirkin" , Jason Wang Cc: Viresh Kumar , Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , stratos-dev@op-lists.linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Hajnoczi , "Stefano Garzarella --cc virtualization @ lists . linux-foundation . org" , virtualization@lists.linux-foundation.org Subject: [PATCH V3 2/3] gpio: virtio: Add IRQ support Date: Thu, 10 Jun 2021 17:46:33 +0530 Message-Id: <911941d4bf19f18abdc9700abca9f26b3c04c343.1623326176.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This patch adds IRQ support for the virtio GPIO driver. Note that this uses the irq_bus_lock/unlock() callbacks since the operations over virtio can sleep. Signed-off-by: Viresh Kumar --- drivers/gpio/gpio-virtio.c | 256 ++++++++++++++++++++++++++++++- include/uapi/linux/virtio_gpio.h | 15 ++ 2 files changed, 263 insertions(+), 8 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c index 1ba8ddf4693a..8bc4b1876961 100644 --- a/drivers/gpio/gpio-virtio.c +++ b/drivers/gpio/gpio-virtio.c @@ -20,6 +20,13 @@ #include #include +struct vgpio_line { + u8 irq_type; + bool irq_type_pending; + bool masked; + bool masked_pending; +}; + struct virtio_gpio { struct virtio_device *vdev; struct mutex lock; @@ -30,14 +37,20 @@ struct virtio_gpio { struct virtio_gpio_request creq; struct virtio_gpio_response cres; + struct irq_chip *ic; + struct vgpio_line *lines; + struct virtqueue *interrupt_vq; + struct virtio_gpio_request ireq; + /* This must be kept as the last entry here, hint: gpio_names[0] */ struct virtio_gpio_config config; }; #define gpio_chip_to_vgpio(chip) container_of(chip, struct virtio_gpio, gc) +#define irq_data_to_gpio_chip(d) (d->domain->host_data) -static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, - u8 txdata, u8 *rxdata) +static int virtio_gpio_req_unlocked(struct virtio_gpio *vgpio, u16 type, + u16 gpio, u8 txdata, u8 *rxdata) { struct virtio_gpio_response *res = &vgpio->cres; struct virtio_gpio_request *req = &vgpio->creq; @@ -56,11 +69,10 @@ static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, sgs[0] = &req_sg; sgs[1] = &res_sg; - mutex_lock(&vgpio->lock); ret = virtqueue_add_sgs(vgpio->command_vq, sgs, 1, 1, res, GFP_KERNEL); if (ret) { dev_err(dev, "failed to add request to vq\n"); - goto out; + return ret; } reinit_completion(&vgpio->completion); @@ -81,7 +93,16 @@ static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, if (rxdata) *rxdata = res->data; -out: + return ret; +} + +static int virtio_gpio_req(struct virtio_gpio *vgpio, u16 type, u16 gpio, + u8 txdata, u8 *rxdata) +{ + int ret; + + mutex_lock(&vgpio->lock); + ret = virtio_gpio_req_unlocked(vgpio, type, gpio, txdata, rxdata); mutex_unlock(&vgpio->lock); return ret; @@ -152,6 +173,183 @@ static void virtio_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value) virtio_gpio_req(vgpio, VIRTIO_GPIO_REQ_SET_VALUE, gpio, value, NULL); } +/* Interrupt handling */ +static void vgpio_irq_mask(struct virtio_gpio *vgpio, u16 gpio) +{ + int ret; + + ret = virtio_gpio_req_unlocked(vgpio, VIRTIO_GPIO_REQ_IRQ_MASK, gpio, 0, + NULL); + if (ret) + dev_err(&vgpio->vdev->dev, "failed to mask irq: %d\n", ret); +} + +static void vgpio_irq_unmask(struct virtio_gpio *vgpio, u16 gpio) +{ + int ret; + + ret = virtio_gpio_req_unlocked(vgpio, VIRTIO_GPIO_REQ_IRQ_UNMASK, gpio, + 0, NULL); + if (ret) + dev_err(&vgpio->vdev->dev, "failed to unmask irq: %d\n", ret); +} + +static void vgpio_irq_set_type(struct virtio_gpio *vgpio, u16 gpio, u8 type) +{ + int ret; + + ret = virtio_gpio_req_unlocked(vgpio, VIRTIO_GPIO_REQ_IRQ_TYPE, gpio, + type, NULL); + if (ret) + dev_err(&vgpio->vdev->dev, "failed to set irq type: %d\n", ret); +} + +static void virtio_gpio_irq_mask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_to_gpio_chip(d); + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + struct vgpio_line *line = &vgpio->lines[d->hwirq]; + + line->masked = true; + line->masked_pending = true; +} + +static void virtio_gpio_irq_unmask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_to_gpio_chip(d); + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + struct vgpio_line *line = &vgpio->lines[d->hwirq]; + + line->masked = false; + line->masked_pending = true; +} + +static int virtio_gpio_irq_set_type(struct irq_data *d, unsigned int type) +{ + struct gpio_chip *gc = irq_data_to_gpio_chip(d); + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + struct vgpio_line *line = &vgpio->lines[d->hwirq]; + u8 irq_type; + + switch (type) { + case IRQ_TYPE_NONE: + irq_type = VIRTIO_GPIO_IRQ_TYPE_NONE; + break; + case IRQ_TYPE_EDGE_RISING: + irq_type = VIRTIO_GPIO_IRQ_TYPE_EDGE_RISING; + break; + case IRQ_TYPE_EDGE_FALLING: + irq_type = VIRTIO_GPIO_IRQ_TYPE_EDGE_FALLING; + break; + case IRQ_TYPE_EDGE_BOTH: + irq_type = VIRTIO_GPIO_IRQ_TYPE_EDGE_BOTH; + break; + case IRQ_TYPE_LEVEL_LOW: + irq_type = VIRTIO_GPIO_IRQ_TYPE_LEVEL_LOW; + break; + case IRQ_TYPE_LEVEL_HIGH: + irq_type = VIRTIO_GPIO_IRQ_TYPE_LEVEL_HIGH; + break; + default: + dev_err(&vgpio->vdev->dev, "unsupported irq type: %u\n", type); + return -EINVAL; + } + + line->irq_type = irq_type; + line->irq_type_pending = true; + + return 0; +} + +static void virtio_gpio_irq_bus_lock(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_to_gpio_chip(d); + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + + mutex_lock(&vgpio->lock); +} + +static void virtio_gpio_irq_bus_sync_unlock(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_to_gpio_chip(d); + struct virtio_gpio *vgpio = gpio_chip_to_vgpio(gc); + struct vgpio_line *line = &vgpio->lines[d->hwirq]; + + if (line->irq_type_pending) { + vgpio_irq_set_type(vgpio, d->hwirq, line->irq_type); + line->irq_type_pending = false; + } + + if (line->masked_pending) { + if (line->masked) + vgpio_irq_mask(vgpio, d->hwirq); + else + vgpio_irq_unmask(vgpio, d->hwirq); + line->masked_pending = false; + } + + mutex_unlock(&vgpio->lock); +} + +static void virtio_gpio_interrupt_prepare(struct virtio_gpio *vgpio) +{ + struct scatterlist sg[1]; + + /* Clear request buffer */ + vgpio->ireq.type = 0; + vgpio->ireq.gpio = vgpio->config.ngpio; + + sg_init_one(sg, &vgpio->ireq, sizeof(vgpio->ireq)); + virtqueue_add_inbuf(vgpio->interrupt_vq, sg, 1, vgpio, GFP_KERNEL); + virtqueue_kick(vgpio->interrupt_vq); +} + +static void virtio_gpio_interrupt(struct virtqueue *vq) +{ + struct virtio_gpio *vgpio = vq->vdev->priv; + struct device *dev = &vq->vdev->dev; + unsigned int len; + int irq, gpio, ret; + void *data; + + data = virtqueue_get_buf(vgpio->interrupt_vq, &len); + if (!data || !len) { + dev_warn(dev, "No data received on interrupt\n"); + return; + } + + if (WARN_ON(data != vgpio)) + return; + + if (le16_to_cpu(vgpio->ireq.type) != VIRTIO_GPIO_REQ_IRQ_EVENT) { + dev_warn(dev, "Invalid irq-type: %d\n", vgpio->ireq.type); + goto out; + } + + gpio = le16_to_cpu(vgpio->ireq.gpio); + + if (gpio >= vgpio->config.ngpio) { + dev_warn(dev, "Invalid GPIO number: %d\n", gpio); + goto out; + } + + irq = irq_find_mapping(vgpio->gc.irq.domain, gpio); + if (!irq) { + dev_err(dev, "Failed to find IRQ for gpio: %d\n", gpio); + goto out; + } + + local_irq_disable(); + ret = generic_handle_irq(irq); + local_irq_enable(); + + if (ret) + dev_err(dev, "failed to invoke irq handler\n"); + +out: + virtio_gpio_interrupt_prepare(vgpio); +} + static void virtio_gpio_command(struct virtqueue *vq) { struct virtio_gpio *vgpio = vq->vdev->priv; @@ -162,14 +360,15 @@ static void virtio_gpio_command(struct virtqueue *vq) static int virtio_gpio_alloc_vqs(struct virtio_device *vdev) { struct virtio_gpio *vgpio = vdev->priv; - const char * const names[] = { "command" }; + const char * const names[] = { "command", "interrupt" }; vq_callback_t *cbs[] = { virtio_gpio_command, + virtio_gpio_interrupt, }; - struct virtqueue *vqs[1] = {NULL}; + struct virtqueue *vqs[2] = {NULL}; int ret; - ret = virtio_find_vqs(vdev, 1, vqs, cbs, names, NULL); + ret = virtio_find_vqs(vdev, vgpio->ic ? 2 : 1, vqs, cbs, names, NULL); if (ret) { dev_err(&vdev->dev, "failed to allocate vqs: %d\n", ret); return ret; @@ -177,6 +376,13 @@ static int virtio_gpio_alloc_vqs(struct virtio_device *vdev) vgpio->command_vq = vqs[0]; + if (vgpio->ic) { + vgpio->interrupt_vq = vqs[1]; + + virtio_gpio_interrupt_prepare(vgpio); + virtqueue_enable_cb(vgpio->interrupt_vq); + } + /* Mark the device ready to perform operations from within probe() */ virtio_device_ready(vgpio->vdev); return 0; @@ -278,6 +484,34 @@ static int virtio_gpio_probe(struct virtio_device *vdev) if (IS_ERR(vgpio->gc.names)) return PTR_ERR(vgpio->gc.names); + if (virtio_has_feature(vdev, VIRTIO_GPIO_F_IRQ)) { + vgpio->lines = devm_kcalloc(dev, config->ngpio, + sizeof(*vgpio->lines), GFP_KERNEL); + if (!vgpio->lines) + return -ENOMEM; + + vgpio->ic = devm_kzalloc(dev, sizeof(*vgpio->ic), GFP_KERNEL); + if (!vgpio->ic) + return -ENOMEM; + + vgpio->gc.irq.chip = vgpio->ic; + vgpio->ic->name = vgpio->gc.label; + vgpio->ic->irq_mask = virtio_gpio_irq_mask; + vgpio->ic->irq_unmask = virtio_gpio_irq_unmask; + vgpio->ic->irq_set_type = virtio_gpio_irq_set_type; + + /* These are required to implement irqchip for slow busses */ + vgpio->ic->irq_bus_lock = virtio_gpio_irq_bus_lock; + vgpio->ic->irq_bus_sync_unlock = virtio_gpio_irq_bus_sync_unlock; + + /* The event comes from the outside so no parent handler */ + vgpio->gc.irq.parent_handler = NULL; + vgpio->gc.irq.num_parents = 0; + vgpio->gc.irq.parents = NULL; + vgpio->gc.irq.default_type = IRQ_TYPE_NONE; + vgpio->gc.irq.handler = handle_level_irq; + } + vdev->priv = vgpio; mutex_init(&vgpio->lock); init_completion(&vgpio->completion); @@ -309,7 +543,13 @@ static const struct virtio_device_id id_table[] = { }; MODULE_DEVICE_TABLE(virtio, id_table); +static const unsigned int features[] = { + VIRTIO_GPIO_F_IRQ, +}; + static struct virtio_driver virtio_gpio_driver = { + .feature_table = features, + .feature_table_size = ARRAY_SIZE(features), .id_table = id_table, .probe = virtio_gpio_probe, .remove = virtio_gpio_remove, diff --git a/include/uapi/linux/virtio_gpio.h b/include/uapi/linux/virtio_gpio.h index e805e33a79cb..533d70d77d2c 100644 --- a/include/uapi/linux/virtio_gpio.h +++ b/include/uapi/linux/virtio_gpio.h @@ -5,6 +5,9 @@ #include +/* Virtio GPIO Feature bits */ +#define VIRTIO_GPIO_F_IRQ 0 + /* Virtio GPIO request types */ #define VIRTIO_GPIO_REQ_ACTIVATE 0x01 #define VIRTIO_GPIO_REQ_DEACTIVATE 0x02 @@ -13,6 +16,18 @@ #define VIRTIO_GPIO_REQ_DIRECTION_OUT 0x05 #define VIRTIO_GPIO_REQ_GET_VALUE 0x06 #define VIRTIO_GPIO_REQ_SET_VALUE 0x07 +#define VIRTIO_GPIO_REQ_IRQ_TYPE 0x08 +#define VIRTIO_GPIO_REQ_IRQ_MASK 0x09 +#define VIRTIO_GPIO_REQ_IRQ_UNMASK 0x0a +#define VIRTIO_GPIO_REQ_IRQ_EVENT 0x0b + +/* Virtio GPIO IRQ types */ +#define VIRTIO_GPIO_IRQ_TYPE_NONE 0x00 +#define VIRTIO_GPIO_IRQ_TYPE_EDGE_RISING 0x01 +#define VIRTIO_GPIO_IRQ_TYPE_EDGE_FALLING 0x02 +#define VIRTIO_GPIO_IRQ_TYPE_EDGE_BOTH 0x03 +#define VIRTIO_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04 +#define VIRTIO_GPIO_IRQ_TYPE_LEVEL_LOW 0x08 /* Possible values of the status field */ #define VIRTIO_GPIO_STATUS_OK 0x0 From patchwork Thu Jun 10 12:16:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 457850 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp413880jae; Thu, 10 Jun 2021 05:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqsAoU01+ZoDhgvhYLbdKGwAKypAkL8ftu9QbPWfyFyrrP9sh9rWwWdk7E3X4FFkbWS+wA X-Received: by 2002:a17:906:2dcb:: with SMTP id h11mr4235248eji.52.1623327428923; Thu, 10 Jun 2021 05:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623327428; cv=none; d=google.com; s=arc-20160816; b=hHtFM59EZKO73rxH7hV7V8lyhdew/dsRl1UI02cdgHsrbrqkdqYzFQRnBMAGnUH9Ls 44hrMSPaeKORQRGpj6ysisfZjjAf6Uw/VU0Psx+bwsdnuVcQNGM2zJ/YL2Ew14aO3ja3 FfygRAj1Ijgwylt58wov1zbvyx8U68hzWGXZ2LpsfA/b5vGtd+A8FNX10NtgV0cqomM2 wqsc13t7tWKaIPJQRfAvqhFYk7P/NBi072A31H1nqIc3bsmXpds+3pbtv8hkuM7t3Kbi 675V6S8WUnfWboeA/NQek52zvVGnyEp8ikYaiDMfGi3MCbagQv8rb/1DhaEdZv02SoTM UY+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lbvuyDCKxhS70EpnInJJhlyy/gqDxngGs41BmHdz+PI=; b=Xe2KLQL/BZzzE5UVLI0GHqWeQE0IwvaBsvqvGKtFtYZzAPSMuuj6pE2vKF7c4z9MrC EUpbpj5AFRVLkAjJrObwwW1fNh/1EJUmXsSnqqfwJCkU3xl9Ti9XKwYJiWR34hVTvawz jRTIwPDJc3pQd+9TpavynZTV58LNVrkVW1xr2sIlzPiyYrkwjiHfKFZW0DkDA5pyCrQM NXZmc6/ghWPBMjSXRO1MI1u31xzJEV6QpZGIVC8cbiD4tbyK2h864p5q1N1/NhGWxqEA m5In7vH5QryHy4ReMSX51PYEifT460KVTxRD4BoWf5URzfbgzkymacUlgETCc2In74jr x/WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C1hes3pm; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd11si2076107edb.528.2021.06.10.05.17.08; Thu, 10 Jun 2021 05:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-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=@linaro.org header.s=google header.b=C1hes3pm; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbhFJMSz (ORCPT + 3 others); Thu, 10 Jun 2021 08:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbhFJMSy (ORCPT ); Thu, 10 Jun 2021 08:18:54 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E19C061760 for ; Thu, 10 Jun 2021 05:16:45 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id e20so10493073pgg.0 for ; Thu, 10 Jun 2021 05:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lbvuyDCKxhS70EpnInJJhlyy/gqDxngGs41BmHdz+PI=; b=C1hes3pm8T2S8foeMxlebM5zz+ZikyomC1drFEMW2lVHoDCBKZMTm8kLS8PEkgqbPX zgRaQ9A2/xYzU00RzoM9TCsjsTraPhGuysPXwOMKEBaML7r5v16ofVicxIDDT3XpyhZK BKqrkHa5nu0Lr73FF7QHS9XRBV1PVfVfw7zQFQfYSRsUe7OGO4AYd7w9aIKwOZRUgum9 JnHTj2FPkT7Okc93Di2wQ1a39B88/kWKQ23dUBIow3AEF7ORggIyD5Kh/b1w5SZkcTWq bYMydeOb3Iayi8oufcmI/hfsoPlM8RH0dGcURTwilbbztMAqX5hUNfncpia0xMm1KLGW 6gkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lbvuyDCKxhS70EpnInJJhlyy/gqDxngGs41BmHdz+PI=; b=MBGyohKpXzz1Zv8/pniNh1taimB/9cjUEkPsWLav8sW7dMhhRYENcqCwNJ1OwfEHu2 h8xfAv78oANWhkuSQf5yrmclpLTbhhXhwkExqCNgcqcJvjmAiEnW7vEZPTBUmV4oRmCT zziRXZr9vB/lBRMzzAIHvWPP/wJhrS/QDeT9ZF0CKuRajEYQbM5IUh6MsWyhKacrElRb ePv6CtnyZcV5wIo/39JzY5/XED4x90W0JbACJDCb8f45fGBH8pxDPlktuSrwdsfZRK+0 UCSuMMw/MwxaCC/BqdTd6uBfL9l7agzHONvPtvZILk3UeuroFVcQKL1Wvvy54drOXhX8 0cZw== X-Gm-Message-State: AOAM5305N2mDx0KMHu3JKLB27aeCXF78FzmvZEbHjYZJN2EjG4LrtjdY FqF2ouZruy5/lvekh7rC8O9bFQ== X-Received: by 2002:a62:cd46:0:b029:2ea:299c:d7bd with SMTP id o67-20020a62cd460000b02902ea299cd7bdmr2800256pfg.72.1623327405258; Thu, 10 Jun 2021 05:16:45 -0700 (PDT) Received: from localhost ([136.185.169.128]) by smtp.gmail.com with ESMTPSA id v15sm2338610pfm.216.2021.06.10.05.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 05:16:44 -0700 (PDT) From: Viresh Kumar To: Bartosz Golaszewski , Linus Walleij Cc: Viresh Kumar , Vincent Guittot , Bill Mills , =?utf-8?q?Alex_Benn=C3=A9e?= , Jason Wang , stratos-dev@op-lists.linaro.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Hajnoczi , "Stefano Garzarella --cc virtualization @ lists . linux-foundation . org" Subject: [PATCH V3 3/3] MAINTAINERS: Add entry for Virtio-gpio Date: Thu, 10 Jun 2021 17:46:34 +0530 Message-Id: <7295705e27ad52c87d13d29031660a77372af7d4.1623326176.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This patch adds entry for Virtio-gpio in the MAINTAINERS file. Signed-off-by: Viresh Kumar --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.31.1.272.g89b43f80a514 diff --git a/MAINTAINERS b/MAINTAINERS index 9450e052f1b1..c55f0f0dda10 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19059,6 +19059,13 @@ F: Documentation/filesystems/virtiofs.rst F: fs/fuse/virtio_fs.c F: include/uapi/linux/virtio_fs.h +VIRTIO GPIO DRIVER +M: Enrico Weigelt, metux IT consult +M: Viresh Kumar +S: Maintained +F: drivers/gpio/gpio-virtio.c +F: include/uapi/linux/virtio_gpio.h + VIRTIO GPU DRIVER M: David Airlie M: Gerd Hoffmann