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 423AAC636CC for ; Tue, 7 Feb 2023 10:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231818AbjBGK4T (ORCPT ); Tue, 7 Feb 2023 05:56:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjBGK4R (ORCPT ); Tue, 7 Feb 2023 05:56:17 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6979744 for ; Tue, 7 Feb 2023 02:56:14 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id y8so15872113vsq.0 for ; Tue, 07 Feb 2023 02:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eh6n76XKXwkWQFKv24FSFfZ2Z3Kdasw4AtrqkamX9UM=; b=3bRuHxRHNfgNh/U9x9Z0OChjKOxnf23Qq1s4ZVRqD79+wZUL3y8dYHCJeVVYw1Gk3b caFgoAj4BGpbB+0rddJneTJyACwZLBM6oQl/WHJeMWQ/6e4Eg9Wgc81z6oRhBaT2LPOk TREvubm1ognsVxQVgdkm3yflazGy+YytqGO/PSuPpzgzteTqkd8nDf/Z0jB0pmYTGx0f Iv2nysL/rN50+2lL8dMnGzsEmOSkxwVYeiihvE65fw4LTPl3C++Mi/tvdJ5cNL0orluK yawkySoBZSGlZgkj5UFYBdkSCKPEAgJHit9yaXBwYo53kzzwmEHg19LBY7Tl9wEFolVa GM/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eh6n76XKXwkWQFKv24FSFfZ2Z3Kdasw4AtrqkamX9UM=; b=4LshWRqwFntm8qplPTrqvrGCJCMl3qYsUu5krCo3NGQXtz/eoPzYK0vuKsPbPQ8VcB +9ohUnHLjl5fWJ5tIQqyp303Mq3L3P+NAFOYkD9HePI5uHur8matGsiZCwaBisQcxrcu oIydE7v7WoR0ntXDIXkmKGgiulY3ZjCKdZTRj/24JExmhiPwQimnxsoW1IEyHrg+O+nf f1pKLOSHJQm0Dq9zQNHuIPKfFBfNT97LIhKsUUnn4iqGKRS17qPCqOIGRcC3NyPVOII4 qv5QFIfbN7wupUOhkBpRKkRSaNotu09RaI0oRV9ijeOHb4idBguDAJc1fEm1WFhhsh1O 31xQ== X-Gm-Message-State: AO0yUKVqih6cF+e+oTghkTHgtrTLLouPyOS9hjK1dubiw+Tou0f/gr8U BDr4fXEoWsVwEGwLeRjTZvhVup92QZtVmsPFyLZN5g== X-Google-Smtp-Source: AK7set/+QocsElN2HAp7zqZEXhXbN49fvEFr+puDDmo2Tj8R93i+EnA3nNuF3VGJjfw7/LYPrLlggfaxFNUmNo4A9B8= X-Received: by 2002:a67:e10e:0:b0:3d3:d797:33c3 with SMTP id d14-20020a67e10e000000b003d3d79733c3mr564644vsl.51.1675767373472; Tue, 07 Feb 2023 02:56:13 -0800 (PST) MIME-Version: 1.0 References: <20230203100418.2981144-1-mie@igel.co.jp> <20230203100418.2981144-5-mie@igel.co.jp> <20230203052114-mutt-send-email-mst@kernel.org> In-Reply-To: From: Shunsuke Mie Date: Tue, 7 Feb 2023 19:56:02 +0900 Message-ID: Subject: Re: [EXT] Re: [RFC PATCH 4/4] PCI: endpoint: function: Add EP function driver to provide virtio net device To: Frank Li Cc: "Michael S. Tsirkin" , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas , Jason Wang , Jon Mason , Ren Zhijie , Takanari Hayama , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "virtualization@lists.linux-foundation.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2023=E5=B9=B42=E6=9C=884=E6=97=A5(=E5=9C=9F) 7:15 Frank Li : > > > > > Caution: EXT Email > > > > On Fri, Feb 03, 2023 at 07:04:18PM +0900, Shunsuke Mie wrote: > > > Add a new endpoint(EP) function driver to provide virtio-net device. = This > > > function not only shows virtio-net device for PCIe host system, but a= lso > > > provides virtio-net device to EP side(local) system. Virtualy those n= etwork > > > devices are connected, so we can use to communicate over IP like a si= mple > > > NIC. > > > > > > Architecture overview is following: > > > > > > to Host | to Endpoint > > > network stack | network stack > > > | | | > > > +-----------+ | +-----------+ +-----------+ > > > |virtio-net | | |virtio-net | |virtio-net | > > > |driver | | |EP function|---|driver | > > > +-----------+ | +-----------+ +-----------+ > > > | | | > > > +-----------+ | +-----------+ > > > |PCIeC | | |PCIeC | > > > |Rootcomplex|-|-|Endpoint | > > > +-----------+ | +-----------+ > > > Host side | Endpoint side > > > > > > This driver uses PCIe EP framework to show virtio-net (pci) device Ho= st > > > side, and generate virtual virtio-net device and register to EP side. > > > A communication date > > > > data? > > > > > is diractly > > > > directly? > > > > > transported between virtqueue level > > > with each other using PCIe embedded DMA controller. > > > > > > by a limitation of the hardware and Linux EP framework, this function > > > follows a virtio legacy specification. > > > > what exactly is the limitation and why does it force legacy? > > > > > This function driver has beed tested on S4 Rcar (r8a779fa-spider) boa= rd but > > > just use the PCIe EP framework and depends on the PCIe EDMA. > > > > > > Signed-off-by: Shunsuke Mie > > > Signed-off-by: Takanari Hayama > > > --- > > > drivers/pci/endpoint/functions/Kconfig | 12 + > > > drivers/pci/endpoint/functions/Makefile | 1 + > > > .../pci/endpoint/functions/pci-epf-vnet-ep.c | 343 ++++++++++ > > It is actually that not related vnet. Just virtio. > I think pci-epf-virtio.c is better. Yes, it have to be. > > > .../pci/endpoint/functions/pci-epf-vnet-rc.c | 635 ++++++++++++++++= ++ > > It is epf driver. rc is quite confused. > Maybe you can combine pci-epf-vnet-ep.c and pci-epf-vnet-rc.c to one file= . I agree. Try to combine them > > > drivers/pci/endpoint/functions/pci-epf-vnet.c | 387 +++++++++++ > > This file setup dma transfer according virtio-ring. > How about pci-epf-virtio-dma.c ? I attempt to rearrange the location of code and filenames. > > > + > > > + epf_vnet_rc_set_config16(vnet, VIRTIO_PCI_ISR, > > VIRTIO_PCI_ISR_QUEUE); > > > + /* > > > + * Initialize the queue notify and selector to outside of the a= ppropriate > > > + * virtqueue index. It is used to detect change with polling. T= here is no > > > + * other ways to detect host side driver updateing those values > > > + */ > > I am try to use gic-its or other msi controller as doorbell. > https://lore.kernel.org/imx/20221125192729.1722913-1-Frank.Li@nxp.com/T/#= u > > but it may need update host side pci virtio driver. Thanks, is it possible to use MSI-X as well? The virtio spec indicates to use legacy irq or MSI-X only. > > > + epf_vnet_rc_set_config16(vnet, VIRTIO_PCI_QUEUE_NOTIFY, > > default_qindex); > > > + epf_vnet_rc_set_config16(vnet, VIRTIO_PCI_QUEUE_SEL, > > default_qindex); > > > + /* This pfn is also set to 0 for the polling as well */ > > > + epf_vnet_rc_set_config16(vnet, VIRTIO_PCI_QUEUE_PFN, 0); > > > + > > -- > > > 2.25.1 > Best, Shunsuke.