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 X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A50BCC433DB for ; Mon, 29 Mar 2021 15:22:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DA4961969 for ; Mon, 29 Mar 2021 15:22:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DA4961969 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQtj6-0001Ei-2Y for qemu-devel@archiver.kernel.org; Mon, 29 Mar 2021 11:22:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQtiB-0000Yj-Jo for qemu-devel@nongnu.org; Mon, 29 Mar 2021 11:21:51 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:34397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQti9-0005dC-SS for qemu-devel@nongnu.org; Mon, 29 Mar 2021 11:21:51 -0400 Received: by mail-wm1-x336.google.com with SMTP id n11-20020a05600c4f8bb029010e5cf86347so8675027wmq.1 for ; Mon, 29 Mar 2021 08:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=1TwXN7+AWJEtlFeRZAci481NKtKfPy8PmCFCx5pJvho=; b=yKqF3GzEB21mHXb089VNt2IbtVIEFuZhJuEcdLyzgA/6hTAvCxOVrhlPSFAxsJDmKQ evbNKzuNgKc4FD0MnyV55HiX11jawjRnji+jocc0uWbdv/Rjfc22I3qDUpq92HYt3WKY RAZy20W7qqwFNeg3zwWfKtHPGGpcNkFlH8iZU3s74EG9lsZcKCrZEdXNLkP077+YPy9l xt1ayaDsC3+bwdU2NLYUuQszDqjy9E6Pyquqi6GcZY7dh922lbp/Vzf+d2iCtX5ABPna 4zZfEBcil1hyEGhp5QV8vFI5tiq7wNuEAlErYTWkW4JBuNykgMeYQndk3ZsipRG3exLS EVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=1TwXN7+AWJEtlFeRZAci481NKtKfPy8PmCFCx5pJvho=; b=iVHn+KdE67ZSF3+2gH3geHffmyQJPhlOquLuA0pv2KhgjnTTrs64oUqNpzMwk4MSRt s2eePVGE/GKww+lJHHLOr1AiUAlGn4BP4hS79QcEiv1+v86JK6F/9biXPS3DkBPOqCk2 kSQirnYwDzy6iZmEn1FIiJpkhWxSy0MUMqu4K5NB16TWP+ZMdma81hSgXLG2ZhNGzx0i QymhlPd58yikxo9+FIJZPwq0nxoFe+tB6hGz1NzcnDfdYZYa8VLzQroO1Qr1iG2o2bEQ g/ScQlN0In9Hf3HAa9XyXEJRIfFmsdEGgi9zP0Gbe/f2MYJ+5NgLO0FgqMdC7NzdGtqu hDTw== X-Gm-Message-State: AOAM533stRvhsijZhlQDZ9cLqY60tBWuamWzGFYcszIeThcZUuVJQX8K /QHfT1YcAMb7W/f3HpelWoFJcg== X-Google-Smtp-Source: ABdhPJzP32yvghg6w9fJVABHk5zj/I+cXKSfuZPAridvNs/1OzUKcoDPBb+sf5A+Y0xJnzS6Zd89kg== X-Received: by 2002:a05:600c:608:: with SMTP id o8mr26023974wmm.42.1617031306255; Mon, 29 Mar 2021 08:21:46 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a131sm25990561wmc.48.2021.03.29.08.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 08:21:45 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 973DF1FF7E; Mon, 29 Mar 2021 16:21:44 +0100 (BST) References: <9fbb332cc66aa1df562ac0dd1f54166d68671681.1616570702.git.viresh.kumar@linaro.org> User-agent: mu4e 1.5.11; emacs 28.0.50 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Viresh Kumar Subject: Re: [PATCH 2/5] hw/virtio: add vhost-user-i2c-pci boilerplate Date: Mon, 29 Mar 2021 16:19:13 +0100 In-reply-to: <9fbb332cc66aa1df562ac0dd1f54166d68671681.1616570702.git.viresh.kumar@linaro.org> Message-ID: <87im5ax9x3.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.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 , qemu-devel@nongnu.org, Arnd Bergmann , Mike Holmes , stratos-dev@op-lists.linaro.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Viresh Kumar writes: > This allows is to instantiate a vhost-user-i2c device as part of a PCI > bus. It is mostly boilerplate which looks pretty similar to the > vhost-user-fs-pci device. > > Signed-off-by: Viresh Kumar > --- > hw/virtio/meson.build | 1 + > hw/virtio/vhost-user-i2c-pci.c | 79 ++++++++++++++++++++++++++++++++++ > 2 files changed, 80 insertions(+) > create mode 100644 hw/virtio/vhost-user-i2c-pci.c > > diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build > index 1a0d736a0db5..bc352a600911 100644 > --- a/hw/virtio/meson.build > +++ b/hw/virtio/meson.build > @@ -26,6 +26,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files= ('virtio-rng.c')) > virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.= c')) > virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) > virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-= i2c.c')) > +virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_t= rue: files('vhost-user-i2c-pci.c')) >=20=20 > virtio_pci_ss =3D ss.source_set() > virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsoc= k-pci.c')) > diff --git a/hw/virtio/vhost-user-i2c-pci.c b/hw/virtio/vhost-user-i2c-pc= i.c > new file mode 100644 > index 000000000000..4bcfeafcb632 > --- /dev/null > +++ b/hw/virtio/vhost-user-i2c-pci.c > @@ -0,0 +1,79 @@ > +/* > + * Vhost-user i2c virtio device PCI glue > + * > + * Copyright (c) 2021 Viresh Kumar > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > + > +#include "qemu/osdep.h" > +#include "hw/qdev-properties.h" > +#include "hw/virtio/vhost-user-i2c.h" > +#include "virtio-pci.h" > + > +struct VHostUserI2CPCI { > + VirtIOPCIProxy parent_obj; > + VHostUserI2C vdev; > +}; > + > +typedef struct VHostUserI2CPCI VHostUserI2CPCI; > + > +#define TYPE_VHOST_USER_I2C_PCI "vhost-user-i2c-pci-base" > + > +DECLARE_INSTANCE_CHECKER(VHostUserI2CPCI, VHOST_USER_I2C_PCI, > + TYPE_VHOST_USER_I2C_PCI) > + > +static Property vhost_user_i2c_pci_properties[] =3D { > + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, > + DEV_NVECTORS_UNSPECIFIED), I suspect we can drop the property if there is nothing useful the user can specify here. We can just default to 1 on device realization. Otherwise: Reviewed-by: Alex Benn=C3=A9e --=20 Alex Benn=C3=A9e