Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1902941rdh; Tue, 26 Sep 2023 07:02:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETsedQDBHLt6sbzdgwQFNNgIpKYcMZgY81sOj3gwAtegTEZIJYrCU1eUX0odkPNLzkpZWZ X-Received: by 2002:a05:6a20:2a1d:b0:15d:8d70:a4ae with SMTP id e29-20020a056a202a1d00b0015d8d70a4aemr6089565pzh.29.1695736929840; Tue, 26 Sep 2023 07:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695736929; cv=none; d=google.com; s=arc-20160816; b=bWWtzy5TWLp4XJY73TGGDfOrJOEftL5vrwDQCrq5PaYzGy8Wkl+zt4W7YCE2zu8+rK xXu1/wk9CAZHwMkQwOSUiw9LQ2DXPWF3yeNWiinxULqNK6LNziOTnc9WlziCOw1oFfto UJufkPjLe6hGx4kimgvUA0AYDuRgCpqjCI58sFHG0lsYc4NKGCKKSWeEZb4qIHmC0lER HQc3p9N9tDv7Kg/HibsT94mArI1eSWpYda8+ETHc094TR/kLk1grHaYzFdYnfZH3v/S1 JI1tkTzK1WeX6/YNJGSHhZZ7dlbjkhua6k7eOAISqhsfNr8uyfk4DEhOb4xXzzS7+wQu gm+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=XKP3MzLWO9YF43zV3hOBWrQ0vFnkikx+qy/eqoZksLU=; fh=xkYc86CK7JIIK7sbCY2WFx6JZxqXdUo0v9Ia9Tjz4Y8=; b=ExfqUOniCr8Jgv6CH4cNqpNHu1GEpvMAHUZzSrMG6rM2GgfR/7h5sa2XB4g5nmjgXS 4fF+EPOQ4T34lQBRfyDCm4+7fWu82ui7oagBTd8rBt2/pDv0Dg/SxYAH4vlbBLau86pW NHrZa/GnaP1fUffBlsvUCBE2GPogyCqYx25E8EmQQ2l/HPi72tFn0MI9VVJiu2AF6SAv MPvi8NPB5TbskuUlZXHS6TIu+bLqh2ezVvPJ+dCD4pRQvdQ/q8JVcJktPrO8hEnArvUY //KafA9YPH8x1S4UxEoBn2DdiQBoEINjEbwYWI/kQca7f8y5MHXscKAz5oPqmoALnELw U18g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20230601.gappssmtp.com header.s=20230601 header.b=Vblyh2mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v10-20020a63610a000000b0057c7341d562si10688520pgb.70.2023.09.26.07.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:02:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@igel-co-jp.20230601.gappssmtp.com header.s=20230601 header.b=Vblyh2mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 07E01826C61B; Tue, 26 Sep 2023 02:48:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234143AbjIZJsG (ORCPT + 99 others); Tue, 26 Sep 2023 05:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbjIZJsE (ORCPT ); Tue, 26 Sep 2023 05:48:04 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 270C3B3 for ; Tue, 26 Sep 2023 02:47:56 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-690bccb0d8aso6276247b3a.0 for ; Tue, 26 Sep 2023 02:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20230601.gappssmtp.com; s=20230601; t=1695721675; x=1696326475; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XKP3MzLWO9YF43zV3hOBWrQ0vFnkikx+qy/eqoZksLU=; b=Vblyh2mnu7teGYwlha0L1TZCdy2fZ6gOM/cwZSTZofzOG3EjAzb/sVLkH5pckR2eOW 9fQyS2e3NWAyUTU0yr5jYkmX/rCaVOsqi6CzeMsbVi7qs5kJb1oaDT3GqLtJqfmncV3V SSIMHsds2wd4aDN04B1jyBc5tzaxoOAeTXX0rmGBgyYI7MU2z1454tLWBOzajQZgsx1v WLPxcCsAZSkWgwHvSX9GBYtFhiPZ8UqmTqj7Chtx85AV0tf33Ag5GeOuWkpXMvzwhCdk 4K5Ng2ICahY9ki6SMr8GJ+vuSsdFsuytQopNHOGorYr6HksnEMS5tKa/et5B+xgdV+MN RW6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695721675; x=1696326475; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XKP3MzLWO9YF43zV3hOBWrQ0vFnkikx+qy/eqoZksLU=; b=D0/S+rFi4swfydpJy1BfLVkjxzTCgU3Pl0/Aci0VM46u99u2IBtfprtw8GsNU4OwPu LXspDHSckeI8LMGPpLicoSPFMF2T9SfVFsof/pL4Gvtj7tpOf1v1PxciHY46z7/Jai3y 7E8VHZRus4x/WHL660xEyzvekTC2RCH2fLc2KOcXmKNAlUG57l6g0JBa+VqAy9VgBwSr 7ijlynA7tXLg1qlVoEWxBW4OivKqtLIhQbAcRWoiSr+3yJHUS9f3YMTO8kFxTsgeut5T KeVvqDC/CVo2r7tleLC0rRxaGdFc5+d5VEodce+05MJ3t/gKXROnHi5MYtJbQ81TxK/U kWxg== X-Gm-Message-State: AOJu0Yx9krwT8BbXB2QJQc2fYy+HFYyZY/HPhtie0wOZdckbITNE5tLb /FWbcdd3bfq3JKQSyhLM+f7e1g== X-Received: by 2002:a05:6a00:80b:b0:690:d48a:2acc with SMTP id m11-20020a056a00080b00b00690d48a2accmr9641454pfk.29.1695721675490; Tue, 26 Sep 2023 02:47:55 -0700 (PDT) Received: from [10.16.161.199] (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id l22-20020a62be16000000b0068fe9c7b199sm5641837pff.105.2023.09.26.02.47.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Sep 2023 02:47:55 -0700 (PDT) Message-ID: Date: Tue, 26 Sep 2023 18:47:50 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC] Proposal of QEMU PCI Endpoint test environment To: Kishon Vijay Abraham I , Lorenzo Pieralisi , "Michael S. Tsirkin" , vaishnav.a@ti.com Cc: Paolo Bonzini , Marcel Apfelbaum , qemu-devel@nongnu.org, Rob Herring , Bjorn Helgaas , Linux Kernel Mailing List , linux-pci@vger.kernel.org, =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I References: Content-Language: en-US From: Shunsuke Mie In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:48:09 -0700 (PDT) On 2023/09/21 18:11, Kishon Vijay Abraham I wrote: > +Vaishnav > > Hi Shunsuke, > > On 8/18/2023 7:16 PM, Shunsuke Mie wrote: >> Hi all, >> >> We are proposing to add a new test syste to Linux for PCIe Endpoint. >> That >> can be run on QEMU without real hardware. At present, partially we have >> confirmed that pci-epf-test is working, but it is not yet complete. >> However, we would appreciate your comments on the architecture design. >> >> # Background >> The background is as follows. >> >> PCI Endpoint function driver is implemented using the PCIe Endpoint >> framework, but it requires physical boards for testing, and it is >> difficult >> to test sufficiently. In order to find bugs and hardware-dependent >> implementations early, continuous testing is required. Since it is >> difficult to automate tests that require hardware, this RFC proposes a >> virtual environment for testing PCI endpoint function drivers. > > This would be quite useful and thank you for attempting it! I would > like to compare other mechanisms available in-addition to QEMU before > going with the QEMU approach. I got it. I'll make a table to compare some methods that includes greybus to realize this emulation environment. Best, Shunsuke > Though I don't understand this fully, Looking at > https://osseu2023.sched.com/event/1OGk8/emulating-devices-in-linux-using-greybus-subsystem-vaishnav-mohandas-achath-texas-instruments, > Vaishnav seems to solve the same problem using greybus for multiple > type s of devices. > > Vaishnav, we'd wait for your OSS presentation but do you have any > initial thoughts on how greybus could be used to test PCIe endpoint > drivers? > > Thanks, > Kishon > >> >> # Architecture >> The overview of the architecture is as follows. >> >>    Guest 1                        Guest 2 >> +-------------------------+    +----------------------------+ >> | Linux kernel            |    | Linux kernel               | >> |                         |    |                            | >> | PCI EP function driver  |    |                            | >> | (e.g. pci-epf-test)     |    |                            | >> |-------------------------|    | PCI Device Driver          | >> | (2) QEMU EPC Driver     |    | (e.g. pci_endpoint_test)   | >> +-------------------------+    +----------------------------+ >> +-------------------------+    +----------------------------+ >> | QEMU                    |    | QEMU                       | >> |-------------------------|    |----------------------------| >> | (1) QEMU PCI EPC Device *----* (3) QEMU EPF Bridge Device | >> +-------------------------+    +----------------------------+ >> >> At present, it is designed to work guests only on the same host, and >> communication is done through Unix domain sockets. >> >> The three parts shown in the figure were introduced this time. >> >> (1) QEMU PCI Endpoint Controller(EPC) Device >> PCI Endpoint Controller implemented as QEMU PCI device. >> (2) QEMU PCI Endpoint Controller(EPC) Driver >> Linux kernel driver that drives the device (1). It registers a epc >> device >> to linux kernel and handling each operations for the epc device. >> (3) QEMU PCI Endpoint function(EPF) Bridge Device >> QEMU PCI device that cooperates with (1) and performs accesses to pci >> configuration space, BAR and memory space to communicate each guests, >> and >> generates interruptions to the guest 1. >> >> Each projects are: >> (1), (3) https://github.com/ShunsukeMie/qemu/tree/epf-bridge/v1 >> >> files: hw/misc/{qemu-epc.{c,h}, epf-bridge.c} >> (2) https://github.com/ShunsukeMie/linux-virtio-rdma/tree/qemu-epc >> >> files: drivers/pci/controller/pcie-qemu-ep.c >> >> # Protocol >> >> PCI, PCIe has a layer structure that includes Physical, Data Lane and >> Transaction. The communicates between the bridge(3) and controller (1) >> mimic the Transaction. Specifically, a protocol is implemented for >> exchanging fd for communication protocol version check and >> communication, >> in addition to the interaction equivalent to PCIe Transaction Layer >> Packet >> (Read and Write of I/O, Memory, Configuration space and Message). In my >> mind, we need to discuss the communication mor. >> >> We also are planning to post the patch set after the code is >> organized and >> the protocol discussion is matured. >> >> Best regards, >> Shunsuke