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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1367C77B77 for ; Mon, 17 Apr 2023 02:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbjDQCLz (ORCPT ); Sun, 16 Apr 2023 22:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjDQCLx (ORCPT ); Sun, 16 Apr 2023 22:11:53 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73A418C for ; Sun, 16 Apr 2023 19:11:51 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id b2-20020a17090a6e0200b002470b249e59so13643857pjk.4 for ; Sun, 16 Apr 2023 19:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20221208.gappssmtp.com; s=20221208; t=1681697511; x=1684289511; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=rnlRciSQ8X7WWGZSx9hlRKrfeUfAjen+Pljb/Shq8Sc=; b=oC4D72dU+xIQQLgJ0rL5uWC1ObsbwOLg7HQAJGC0ZN4mEn16fRnH07IOMu/JQcZHVH y7kig+eTtWN4th/cMy+FDkPO/R/DHxM4bC1pRyAsqsot5USVytJI0+sPz4oV7xL+HHnS jlqzgzZY35vEtUr3zN8mFUlbzooT83WYdR7EJuHOiirqehiRdGAN9P/bjPdgJk1bEy6e sJTh1G5QRUFz+psa1A5teBbZ+u5SjW33X7OWvCOZmj4+UCkqQV2je8TpCtfslDySBjNF nAp8+hlqj+NDAmH1pggj2FlIpZybJP/h98QTSZafdhwRrPRTzq+JGuamUvh6DfI6IYaS E5mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681697511; x=1684289511; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rnlRciSQ8X7WWGZSx9hlRKrfeUfAjen+Pljb/Shq8Sc=; b=WZGGUb1N2Yjh34RTDFs7RF30OecMDqMKJnPBbsNQDCazeOkDLvG1m7rJdknBOkiSmT C+IhuSiaw33cm9O0bsnJn0u/ClQ715EEsRGYtNgh7PcSEkftIuvM9YWcgfyGV3AILFAH n6jtB5oEw+5a7qItJZ8a+dKlK0A9BMDYc9V8e32pOtbGhB3IoOE/Wk/0dSnKGabrI4AK GDtyNpD/FW2LNeDsiNaO7azXzpWjGPeDsgltIJAbChuV/9to4aydM9i5aQEL9JnsaoqO SUEoHXjyXJsslotEgfu2vbqMZpaXYZusoIjCEfRghzc+KD0qopdodxxZGysN4SWsgGpH qDNw== X-Gm-Message-State: AAQBX9fBN5ezkDLterAfsMCdE12BDLKptrMstHo+FnjCwNn0dBWzjWCO eHpYUFsT489BOWGNkLznn9qnIQ== X-Google-Smtp-Source: AKy350bdaEVaA1sWVsC9V0FCl4r1X6pxb+q8V0/MS/TJCKBus8mKe7bvfysrPGRxWoo4C11vImaaZg== X-Received: by 2002:a05:6a20:b284:b0:eb:df85:5d7c with SMTP id ei4-20020a056a20b28400b000ebdf855d7cmr12602133pzb.11.1681697511245; Sun, 16 Apr 2023 19:11:51 -0700 (PDT) Received: from [10.16.161.199] (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id d14-20020aa78e4e000000b00639eae8816asm6475158pfr.130.2023.04.16.19.11.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Apr 2023 19:11:50 -0700 (PDT) Message-ID: <9e9acbf6-3486-56d3-c15a-c3d67557c2a9@igel.co.jp> Date: Mon, 17 Apr 2023 11:11:46 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [EXT] [RFC PATCH 0/3] Introduce a PCIe endpoint virtio console Content-Language: en-US To: Frank Li , Lorenzo Pieralisi Cc: =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas , "Michael S. Tsirkin" , Jason Wang , Jon Mason , Randy Dunlap , Ren Zhijie , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "virtualization@lists.linux-foundation.org" References: <20230414123903.896914-1-mie@igel.co.jp> From: Shunsuke Mie In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/04/14 23:39, Frank Li wrote: > >> -----Original Message----- >> From: Shunsuke Mie >> Sent: Friday, April 14, 2023 7:39 AM >> To: Lorenzo Pieralisi >> Cc: Krzysztof Wilczyński ; 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: [EXT] [RFC PATCH 0/3] Introduce a PCIe endpoint virtio console >> >> Caution: EXT Email >> >> 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 >> > [Frank Li] Some basic question, > I see you call register_virtio_device at epf_vcon_setup_vdev, > Why call it as virtio console? I suppose it should be virtiobus directly? I'm sorry I didn't understand your question. What do you mean the virtiobus directly? > > Previous you use virtio-net, why change to virtio-console here? Does it matter? No, it doesn't. Just I'd like to break down the changes into smaller steps to make it easier to review and merge the changes. As a first step, I propose adding a simplest virtio function driver with the extension defined in pci-epf-virtio.{h,c}. > All virtio-XXX should work? Yes, the extension is designed to use any type of virtio device. > > You removed EDMA support this version? I planed the support will be added with epf virtio-net patches. > >> 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.k/ >> ernel.org%2Flinux-pci%2F20230113090350.1103494-1- >> mie%40igel.co.jp%2F&data=05%7C01%7CFrank.Li%40nxp.com%7Cea6513dbf >> 4084b80ced208db3ce54133%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 >> C0%7C638170727558800720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w >> LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C >> %7C%7C&sdata=jYgy%2Bxk84ZXZRVfqm0GCXoRnCTLMrX4zTfV%2Bs5Mmsvo >> %3D&reserved=0 >> - [RFC PATCH v2 0/7] Introduce a vringh accessor for IO memory >> link: >> https://lore.k/ >> ernel.org%2Fvirtualization%2F20230202090934.549556-1- >> mie%40igel.co.jp%2F&data=05%7C01%7CFrank.Li%40nxp.com%7Cea6513dbf >> 4084b80ced208db3ce54133%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 >> C0%7C638170727558800720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w >> LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C >> %7C%7C&sdata=K4El76GSAGtsWkNBXJK5%2Fn7flCN20eEMZpZYTX2WIZ0%3 >> D&reserved=0 >> >> 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 linux-20230406 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 | 554 ++++++++++++++++++ >> .../pci/endpoint/functions/pci-epf-virtio.c | 469 +++++++++++++++ >> .../pci/endpoint/functions/pci-epf-virtio.h | 123 ++++ >> include/uapi/linux/virtio_pci.h | 3 + >> 6 files changed, 1170 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