From patchwork Mon Oct 9 09:59:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 730974 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1119102wrw; Mon, 9 Oct 2023 03:00:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPp6mo3vUbeCoo7I9WnXPhh0hACgyL/YgLsW8KW8zF6jMc0iamUyhkmPD2WzYFObnspQIY X-Received: by 2002:a05:622a:11c9:b0:418:148e:8306 with SMTP id n9-20020a05622a11c900b00418148e8306mr17782287qtk.20.1696845616036; Mon, 09 Oct 2023 03:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696845616; cv=none; d=google.com; s=arc-20160816; b=nxk0q72uf7U7WFh+358tzWWvDsmeZojcE49IZX2xqjl7xgBKffRUhOdYPosau2jzkz YOxQ1w9I1/xviIGrdqapiJ5kYeF+L2GCVGNXgMlMS/G0bttybNeiAcshulAivQvbyhor GP2mn47dTjtlq5QkpUjh+Eq74G2Isjmb5MNLLb0jI2EEhzsHsMVkOstQE9rxsGYtTgP3 vF3ekw3agYfPL3y66LvFzCsfcNcWyD/CBL9j7jxT3x57E245d/HrxgNcG0Zgmf3BiMIB HQ0RrJAzvbF45JQStXVqVFIIXVWzQqZe1SQrdNqVTmVfWvbdgWqrEOrq3JXVorUjDH23 NENw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=1XLFDaMHZCEg2LGyweqzWt7sDWsIdqiMwYyFkHjOtX4=; fh=7NQEYKY7p2Qv7VKgXGHsrEmWGV8dnXz0R7TrAt0Ng+A=; b=YhlVtFugftmGbiiwfCCOysnKaims4plaZZiN5srEOMvHw5EUpeSiLDXg6YPqD0OBj1 +qupUhU0TuMu+MbPsC++nYT+DK0UCepJEFiq7LaKxZB7H3hQus8yvzq3b8uITYshizcx tVXKnMWKUymst/d2n/WXMRHRJJDdf0KOyZ8shtmFn+j0/0kTVEUwmOhKFITYysHVRIrb h6PUA4UGuoyFI10OMA4hEhUmrPJbP15Sa7xGVe91NGL3dGE0/vfPZfs7pe58JCl1g0af iNtKmfbcCLQGOEk6w3iM5lNtfPcGLlI1jNHMhoh/3g2Q8P5G0xbLPirKXzCK7Lcrrl7k Lkdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t6vZ9usa; 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=pass (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 v14-20020a05622a014e00b004196dab68a4si5920649qtw.656.2023.10.09.03.00.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2023 03:00:16 -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=pass header.i=@linaro.org header.s=google header.b=t6vZ9usa; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qpn3B-0006Un-J3; Mon, 09 Oct 2023 05:59:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qpn39-0006UM-5l for qemu-devel@nongnu.org; Mon, 09 Oct 2023 05:59:44 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpn37-000818-Fs for qemu-devel@nongnu.org; Mon, 09 Oct 2023 05:59:42 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40684f53d11so43277015e9.1 for ; Mon, 09 Oct 2023 02:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696845579; x=1697450379; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1XLFDaMHZCEg2LGyweqzWt7sDWsIdqiMwYyFkHjOtX4=; b=t6vZ9usaakMjR77XECn9ycoUlHn0XWY0J9rs4UOTZnrEptc0ofcBDKVTSLMxshaY8U ZBm0qiqoaCh4tEu+t26nTWPaqnaBj8fXp6ClO6HFXYU/EarXYKCxzP5KKAApASNDlp3m Rf28XVSHjf3GWLIgWixwOorpM+72NAnI1UlKhQSc+bQdYspj31XCG0yCxa0kZNECtoKE wN3qGzqGDDtL0VbUqi09mx7lUYJJHeXu1QWaPvKim1XkegknLnZex3MCzK6sPRKYtRs6 zgt+AXCX31Lc+BQlEix/LG5RHCl14quKE/qWQ15ES7AAMf/zsBSIXtIwS1rE+hrl5dU+ AsGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696845579; x=1697450379; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1XLFDaMHZCEg2LGyweqzWt7sDWsIdqiMwYyFkHjOtX4=; b=hTjtbBqGkmeDVr7/w0uVaO29CdE1+aytt+aPXyx2t3DgoAIJ9dTJXvyo1Co0zHNjbo tmiMtAplqbCIsC7pSSuXriM6U6L/BK/bO8GJtZJabHCfqvuA0ool/BWU+U7Rr52u47I3 Wnx9Fg2z6faCoUcAbKiUc+7Nj7P/eNJTXc6ouCxt7tvdBxQDDtB2J36JK1jXL1vnFt1Y sKQVOgf9AS3OJyxKEkadk50Z3eWw7CJiO7CEvVd+zetg5gROPUvIJYz2xNOm+fbBSrak 91E+YpAHR+OoWt40gmA5hLEsKDx7bRYgs+yCBPvjJUu97SWZixSZyBkc3ovkinEMAt9u QdsQ== X-Gm-Message-State: AOJu0YxwbX6PnMm1EZ4tu/unDd6ph3nFH9VU6E/DEg1rk4KGNgVzBmrP h4HZ9wxdQRSOV63ZQE7IpErNBw== X-Received: by 2002:a5d:440f:0:b0:320:a4e:6b83 with SMTP id z15-20020a5d440f000000b003200a4e6b83mr13384658wrq.31.1696845579277; Mon, 09 Oct 2023 02:59:39 -0700 (PDT) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id d12-20020a5d538c000000b0032769103ae9sm9123739wrv.69.2023.10.09.02.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 02:59:38 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 28FFD1FFBB; Mon, 9 Oct 2023 10:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Erik Schilling , Fam Zheng , Mathieu Poirier , Gerd Hoffmann , Hanna Reitz , Stefan Hajnoczi , =?utf-8?q?Alex_Benn=C3=A9e?= , Kevin Wolf , Eric Blake , "Michael S. Tsirkin" , qemu-block@nongnu.org, Eduardo Habkost , Paolo Bonzini , Mark Cave-Ayland , Viresh Kumar , virtio-fs@redhat.com, "Gonglei (Arei)" , Markus Armbruster , Jason Wang , Raphael Norwitz , =?utf-8?q?Daniel_P=2E_Berran?= =?utf-8?q?g=C3=A9?= Subject: [PATCH v4 0/6] virtio: cleanup vhost-user-generic and reduce c&p Date: Mon, 9 Oct 2023 10:59:31 +0100 Message-Id: <20231009095937.195728-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org A lot of our vhost-user stubs are large chunks of boilerplate that do (mostly) the same thing. This series continues the cleanups by splitting the vhost-user-base and vhost-user-generic implementations. After adding a new vq_size property the rng, gpio and i2c vhost-user devices become simple specialisations of the common base defining the ID, number of queues and potentially the config handling. I've also added Manos' vhost-user-sound while I was at it. Changes ------- I've dropped the F_TRANSPORT work from this series to keep this small and ready to merge. The changes for F_TRANSPORT are a bit more invasive and still need a bit of debugging but I wanted to get this stuff merged now. Alex Bennée (5): virtio: split into vhost-user-base and vhost-user-device hw/virtio: derive vhost-user-rng from vhost-user-base hw/virtio: derive vhost-user-gpio from vhost-user-base hw/virtio: derive vhost-user-i2c from vhost-user-base docs/system: add a basic enumeration of vhost-user devices Manos Pitsidianakis (1): hw/virtio: add vhost-user-snd and virtio-snd-pci devices docs/system/devices/vhost-user-rng.rst | 2 + docs/system/devices/vhost-user.rst | 41 +++ include/hw/virtio/vhost-user-base.h | 49 +++ include/hw/virtio/vhost-user-gpio.h | 23 +- include/hw/virtio/vhost-user-i2c.h | 14 +- include/hw/virtio/vhost-user-rng.h | 11 +- include/hw/virtio/vhost-user-snd.h | 26 ++ hw/virtio/vhost-user-base.c | 348 +++++++++++++++++++++ hw/virtio/vhost-user-device-pci.c | 10 +- hw/virtio/vhost-user-device.c | 335 +------------------- hw/virtio/vhost-user-gpio.c | 407 ++----------------------- hw/virtio/vhost-user-i2c.c | 272 +---------------- hw/virtio/vhost-user-rng.c | 278 ++--------------- hw/virtio/vhost-user-snd-pci.c | 75 +++++ hw/virtio/vhost-user-snd.c | 67 ++++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 25 +- 17 files changed, 705 insertions(+), 1283 deletions(-) create mode 100644 include/hw/virtio/vhost-user-base.h create mode 100644 include/hw/virtio/vhost-user-snd.h create mode 100644 hw/virtio/vhost-user-base.c create mode 100644 hw/virtio/vhost-user-snd-pci.c create mode 100644 hw/virtio/vhost-user-snd.c