Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp450084rwr; Thu, 27 Apr 2023 03:52:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4IJE9IOzWdUTk3wh2mGfI1P5eCVkGjNePpipoG8Eh4Dm8J2kJy7A3sv/FUXCYJYpK9loa9 X-Received: by 2002:a05:6a00:4a85:b0:63d:2d6a:47be with SMTP id dr5-20020a056a004a8500b0063d2d6a47bemr1547975pfb.2.1682592725779; Thu, 27 Apr 2023 03:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682592725; cv=none; d=google.com; s=arc-20160816; b=cbPuFVYgtANf7YNllCgZgAV2UC1FZ5I+VT6WVOBNLWZmWlvP9fmxzW+mIRO6lc5kji jwoz+p5le3nibe0QODPJzL0vThzEfYuhjxiv1dPnJEZic2T51OKmP6fL0ggNRM+a5w+z FdnTMatcWPfzK7rGFI5ASkFFrT9DhYIsDhfbfICDf34QWMtWq4B9K+qPj5kW8KGuJV6T KLKGPWnAu+Z7R9Av/nxoGEeks+0at/uSvuWHx97851icklf6n8zLFWHm1bYqufkP3zKi 1Pix1GxMDi9npf6oqWQ7iorDXbCSCygZT0Fh/+RJwyYTiRPVMdix2aA1GHvveUM/c0ze IaOw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QPjgq3zlWYQFj7c/g/9N/OxqaeG5Njw/y80poNIzu/A=; b=NuLcHGk55BS8XhoYbvfuJtJELEJ36wQYXSrrF1UhnihtJsaj9/aIm3pIRne5kZbwiy kurRse9q1qAFMqCleR5Jj+/jcPr340J7x5OSC3cbDVOccOizEDcZrBo0Xea6IRuc2nkX jNpADPSBuYc1N2F65prKlHv4uH5c30h8PWrSjYeMQ65jrUSeHlm+HCVFk0+EIl3uPu1L CFcVwnsZs5rSs1a60vs/HkVo2gwZyxV+uyKIOsHgbv/gUlSTu3yMBkTEtjDbCi1NGjH5 +biUhm1Xdr7WCTjVifFnyGYzXK5quKwRJ8CNWN6gGA6eWcIU201Gqy3ESsPSgm++eco/ NQyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20221208.gappssmtp.com header.s=20221208 header.b=MXoqBeEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 194-20020a6218cb000000b0063b64146c13si18813456pfy.254.2023.04.27.03.51.54; Thu, 27 Apr 2023 03:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@igel-co-jp.20221208.gappssmtp.com header.s=20221208 header.b=MXoqBeEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243588AbjD0Kok (ORCPT + 99 others); Thu, 27 Apr 2023 06:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243569AbjD0Koj (ORCPT ); Thu, 27 Apr 2023 06:44:39 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A4E92D79 for ; Thu, 27 Apr 2023 03:44:37 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-63b733fd00bso6528139b3a.0 for ; Thu, 27 Apr 2023 03:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20221208.gappssmtp.com; s=20221208; t=1682592277; x=1685184277; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QPjgq3zlWYQFj7c/g/9N/OxqaeG5Njw/y80poNIzu/A=; b=MXoqBeEes7wZrkLALkHP5t+W1nwEgOd2Hsq+KKGx3YGVx3bZZbzO+3lAUhe13VKgNu ZZobnrBUZH1XrJOgVhERqBCThWEyc5bx/rNJOXZMWIKoUUa+LbSS4sMNvaaH6GSMGBQY wgu9WgHdDiH+VL22wrhyazR7yNxzimoxcDyIv0L+JFcLZdRUbvy8N8ANCNDlnZVrvJon KDpKI9bPWiF6oJkJ+1fb2a8WXGPMJTAZIAL/mZyoEPb8d3wuyihrdnovBnk6C8QBbaTV AlgXZi1l9LJXwifEKUcs9KBgM0mzHDQ30TAAxt5h7Zbpq6YYgAOpLcyN4LFDrAw9ZVMD nQSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682592277; x=1685184277; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QPjgq3zlWYQFj7c/g/9N/OxqaeG5Njw/y80poNIzu/A=; b=FInDbv/97Q6I5XpyKWWKuhKicbzj5INyXKxENxl4YCIfQrluuTE2iUSRyV3Ls/Tjq2 /ae6uqsxF2XufJxjk2Q7bhgKhxZytrRAvRlqDIIifKv7nHgD6EmeVNUkZ21oqrrVeesx lP2UOUBIQp5dvh0k8Z3VZP7G43XgBzvxD3ZAX3VEJV8dQSrQq3qGsDgx0n0ehjDTI0l/ 97f9dvjOE4b+I18+mHuhtqSK/Gu2KVg/TzcGne3cLM8t9GWLngWaI/p9XdBpwO1r0ly0 h5UaPOd70iCDsgAIdBomWAcqt6obDaR/3WtNtBgO6ZPkesU1zj26DyVPBV9bGqJNoTzq Vwfw== X-Gm-Message-State: AC+VfDza92VO9ayq4LCkmXFsf2h7Vo6E0IPoMshP+YJWs1SNDEHPxQaG 5JvTn+NPpdRB8fl0J2VE2t98vQ== X-Received: by 2002:a05:6a20:8402:b0:ef:ef0d:7dd9 with SMTP id c2-20020a056a20840200b000efef0d7dd9mr1174846pzd.51.1682592276646; Thu, 27 Apr 2023 03:44:36 -0700 (PDT) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id b3-20020a631b03000000b0050f93a3586fsm11029042pgb.37.2023.04.27.03.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 03:44:36 -0700 (PDT) From: Shunsuke Mie To: Lorenzo Pieralisi Cc: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Shunsuke Mie , Frank Li , Jon Mason , Randy Dunlap , Ren Zhijie , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [RFC PATCH v2 0/3] Introduce a PCIe endpoint virtio console Date: Thu, 27 Apr 2023 19:44:25 +0900 Message-Id: <20230427104428.862643-1-mie@igel.co.jp> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PCIe endpoint framework provides APIs to implement PCIe endpoint function. This framework allows defining various PCIe endpoint function behaviors in software. This patch extend the framework for virtio pci device. The virtio is defined to communicate guest on virtual machine and host side. Advantage of the virtio is the efficiency of data transfer and the conciseness of implementation device using software. It also be applied to PCIe endpoint function. We designed and implemented a PCIe EP virtio console function driver using the extended PCIe endpoint framework for virtio. It can be communicate host and endpoint over virtio as console. An architecture of the function driver is following: ┌────────────┐ ┌──────────────────────┬────────────┐ │virtio │ │ │virtio │ │console drv │ ├───────────────┐ │console drv │ ├────────────┤ │(virtio console│ ├────────────┤ │ virtio bus │ │ device) │◄────►│ virtio bus │ ├────────────┤ ├---------------┤ └────────────┤ │ │ │ pci ep virtio │ │ │ pci bus │ │ console drv │ │ │ │ pcie ├───────────────┤ │ │ │ ◄─────► │ pci ep Bus │ │ └────────────┘ └───────────────┴───────────────────┘ PCIe Root PCIe Endpoint Introduced driver is `pci ep virtio console drv` in the figure. It works as ep function for PCIe root and virtual virtio console device for PCIe endpoint. Each side of virtio console driver has virtqueue, and introduced driver transfers data on the virtqueue to each other. A data on root tx queue is transfered to endpoint rx queue and vice versa. This patchset is depend follwing patches which are under discussion. - [RFC PATCH 0/3] Deal with alignment restriction on EP side link: https://lore.kernel.org/linux-pci/20230113090350.1103494-1-mie@igel.co.jp/ - [PATCH v3] vringh: IOMEM support link: https://lore.kernel.org/virtualization/CACGkMEumt4p7jU+H+T-b9My0buhdS8a-1GCSnWjnCwMAM=wo1Q@mail.gmail.com/T/#t First of this patchset is introduce a helper function to realize pci virtio function using PCIe endpoint framework. The second one is adding a missing definition for virtio pci header. The last one is for PCIe endpoint virtio console driver. This is tested on next-20230416 and RCar S4 board as PCIe endpoint. Shunsuke Mie (3): PCI: endpoint: introduce a helper to implement pci ep virtio function virtio_pci: add a definition of queue flag in ISR PCI: endpoint: Add EP function driver to provide virtio-console functionality drivers/pci/endpoint/functions/Kconfig | 19 + drivers/pci/endpoint/functions/Makefile | 2 + drivers/pci/endpoint/functions/pci-epf-vcon.c | 596 ++++++++++++++++++ .../pci/endpoint/functions/pci-epf-virtio.c | 458 ++++++++++++++ .../pci/endpoint/functions/pci-epf-virtio.h | 126 ++++ include/uapi/linux/virtio_pci.h | 3 + 6 files changed, 1204 insertions(+) create mode 100644 drivers/pci/endpoint/functions/pci-epf-vcon.c create mode 100644 drivers/pci/endpoint/functions/pci-epf-virtio.c create mode 100644 drivers/pci/endpoint/functions/pci-epf-virtio.h -- 2.25.1