From patchwork Thu Apr 1 12:12: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: 413608 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp507095jai; Thu, 1 Apr 2021 05:24:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzljI0aHNxns1N8HFu5d2IM2TXsHDiX6R9zVCu7CWkl6My4C4O6NH9f1Z5slVZostUqxywe X-Received: by 2002:aca:4acd:: with SMTP id x196mr5533836oia.34.1617279885433; Thu, 01 Apr 2021 05:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617279885; cv=none; d=google.com; s=arc-20160816; b=VnR7+gFzMTB1jkHOl6syR7dTGXcYk4OD+bUxDzcJ8sJNoDRezzZfYC1d2p+bA7OBGL lmpEp7kc4J4vRNFFzQs5/u2n5cC3ExgHccHUBkD8UyqmyroJB+hRYpn6bcECtft/f4Wr IOh1kGEJlpF3JtKn/0y0GLjzWNXi2nDITWLI5nnEUcZJ9lQwpwfM84dX5KlDn5PsQlcQ vZKuSjkebqEJK6OAvnL2X98T9xXjHjEq4RLnyGK9Vv6A5XfGTOBKa/0aRWnrBzAygHcS nccRWnF02Mu84a6pFV19q2AxgZcyp2dUHhdLpfoe9o8m5pooiAJklzjslM9Ajwgtl7Z3 1mtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ucPW6AwDArigoJGiD4YxTX7iziwkWQWTh6uKDGyTHHk=; b=fZuaQEuQEy2LFiVnwxGCJdH/+v92nDQ3KsyM0dUQGCyRra8Nqz5LQuDme4g04Asa45 d/yUwFt0bY0ZFv4MV6SZr64aWtzs56gAFfncE5sWFVzQwdvWW4BOFpEl8Kdym6Rch+Xo Wg1zmyxJxl1n2BmSa5EiuFvMe0zWkqobYf4WvH8FClYX5lxIV/F5O5iCNqsizivuE1wB eez2ZwgVzXBczYWWYJHZxVWLIlDHgKWEot+84IKUkV8pj4MLdz+5385KcP70gDmxNPqX u25oIDw2YTAvXaBrbXiN0J00ULtPxVVGmttk520qfLaGq5AYA6hEjtRFHy52t+V3VIeA Z2Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="u/dd/lf1"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 70si4608844oth.55.2021.04.01.05.24.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Apr 2021 05:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="u/dd/lf1"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRwNQ-0006Fr-RA for patch@linaro.org; Thu, 01 Apr 2021 08:24:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRwCQ-0000c9-Cv for qemu-devel@nongnu.org; Thu, 01 Apr 2021 08:13:22 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:50950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRwCN-0004UX-LW for qemu-devel@nongnu.org; Thu, 01 Apr 2021 08:13:22 -0400 Received: by mail-pj1-x102c.google.com with SMTP id gb6so1070882pjb.0 for ; Thu, 01 Apr 2021 05:13:19 -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=ucPW6AwDArigoJGiD4YxTX7iziwkWQWTh6uKDGyTHHk=; b=u/dd/lf1oi99LYDvoCC7OKugmOXECYCn5xUYtlxUW5yqpbnI0kEnqSFRE5zmqoR/FC ac6oMTGJMWF9eFJ1vv/ge7ETwHrZnWGAUsRs8DpN2O6UlhU82utMZDi+GhKsKOgSTiQi JXEDf/wbYtLx/gh99zbr/v2DwWcO2kFuI1+G9jgbYm1ubU4I+JpxR4sMXIKbZHwjiFvP phOZuUcwPjQz+Elp6fHc2EHYJ1/2zwizmDL2rYrySP3SjgG6ioIOVP0rETN8OHhZ54+q f1qteeT1VVwMHNapt0VFIUWFTPjvErDSh6xZQavDE1W4kgW31kPs8z3QcePtN3AUoGb/ OY1g== 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=ucPW6AwDArigoJGiD4YxTX7iziwkWQWTh6uKDGyTHHk=; b=R0nf3TiskKpHEsBFiTu1JCVN+mLmhoUwol69beGDv8h6Bifyhhq7FRxRv1O4QLDfMw FVqSCbf7l5I5E+D9yrc0b44Z1rHe1+9lQguJr8eEbUx9yMY8V3P02UFEr6CoO+YWjeWK XDmJbIkv8bIliuG1qvQdusHRC/jDrnxy33L9GyS9WJwB+UN85mRMHpvIgqA0UERAz7/9 taNi2qropm6JE3JeB5anlm5Sn9bv5wTEZkuDirtOPbrISrodOSo86CjIDfjYPxqXhsj/ 4u0ozggjqR0p6XZGT9IoTPslL7Y9d52F2R8SQ5qVStXhgJVFKiC72sd0p6VoHHqE4HAo e7zg== X-Gm-Message-State: AOAM531quSTejpWJzI/v4w+suaQbbsnOay5I3gmfTmdiu5Wp90Zj3lWo lyn+lAzbliYunJql8HoAGP83ZBF7YpJ/pg== X-Received: by 2002:a17:90a:ff91:: with SMTP id hf17mr8954713pjb.34.1617279198360; Thu, 01 Apr 2021 05:13:18 -0700 (PDT) Received: from localhost ([136.185.154.93]) by smtp.gmail.com with ESMTPSA id ha8sm5311443pjb.6.2021.04.01.05.13.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Apr 2021 05:13:17 -0700 (PDT) From: Viresh Kumar To: qemu-devel@nongnu.org, Viresh Kumar Subject: [PATCH V2 5/6] docs: add a man page for vhost-user-i2c Date: Thu, 1 Apr 2021 17:42:34 +0530 Message-Id: <276f8f8825fc5eb084710b8265b9ee9097e0aa69.1617278395.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=viresh.kumar@linaro.org; helo=mail-pj1-x102c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , Jie Deng , Bill Mills , Arnd Bergmann , Mike Holmes , =?utf-8?q?Alex_Benn=C3=A9e?= , stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Basic usage and example invocation. Signed-off-by: Viresh Kumar --- docs/tools/index.rst | 1 + docs/tools/vhost-user-i2c.rst | 75 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 docs/tools/vhost-user-i2c.rst -- 2.25.0.rc1.19.g042ed3e048af diff --git a/docs/tools/index.rst b/docs/tools/index.rst index 3a5829c17a54..af2519406ddf 100644 --- a/docs/tools/index.rst +++ b/docs/tools/index.rst @@ -17,3 +17,4 @@ QEMU Tools Guide qemu-trace-stap virtfs-proxy-helper virtiofsd + vhost-user-i2c diff --git a/docs/tools/vhost-user-i2c.rst b/docs/tools/vhost-user-i2c.rst new file mode 100644 index 000000000000..1f05c6473ad7 --- /dev/null +++ b/docs/tools/vhost-user-i2c.rst @@ -0,0 +1,75 @@ +QEMU vhost-user-i2c - I2C emulation backend +=========================================== + +Synopsis +-------- + +**vhost-user-i2c** [*OPTIONS*] + +Description +----------- + +This program is a vhost-user backend that emulates a VirtIO I2C bus. +This program takes the layout of the i2c bus and its devices on the host +OS and then talks to them via the /dev/i2c-X interface when a request +comes from the guest OS for an I2C or SMBUS device. + +This program is designed to work with QEMU's ``-device +vhost-user-i2c-pci`` but should work with any virtual machine monitor +(VMM) that supports vhost-user. See the Examples section below. + +Options +------- + +.. program:: vhost-user-i2c + +.. option:: -h, --help + + Print help. + +.. option:: -v, --verbose + + Increase verbosity of output + +.. option:: -s, --socket-path=PATH + + Listen on vhost-user UNIX domain socket at PATH. Incompatible with --fd. + +.. option:: -f, --fd=FDNUM + + Accept connections from vhost-user UNIX domain socket file descriptor FDNUM. + The file descriptor must already be listening for connections. + Incompatible with --socket-path. + +.. option:: -l, --device-list=I2C-DEVICES + + I2c device list at the host OS in the format: + :[:],[:[:]] + + Example: --device-list "2:1c:20,3:10:2c" + + Here, + bus (decimal): adatper bus number. e.g. 2 for /dev/i2c-2, 3 for /dev/i2c-3. + client_addr (hex): address for client device. e.g. 0x1C, 0x20, 0x10, 0x2C. + +Examples +-------- + +The daemon should be started first: + +:: + + host# vhost-user-i2c --socket-path=vi2c.sock --device-list 0:20 + +The QEMU invocation needs to create a chardev socket the device can +use to communicate as well as share the guests memory over a memfd. + +:: + + host# qemu-system \ + -chardev socket,path=vi2c.sock,id=vi2c \ + -device vhost-user-i2c-pci,chardev=vi2c,id=i2c \ + -m 4096 \ + -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \ + -numa node,memdev=mem \ + ...