From nobody Fri Dec 19 15:58:04 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1738243173; cv=none; d=zohomail.com; s=zohoarc; b=VKIbVrEdAdv4Wwj79lMMoxOLOMjcIpT+gDf1c+OuwLgQsXdqY9wh/Uek47jqyAe/X5RG5JGTNB4LEZpN6y5y/CmgpQXyZ6kc/K6dgF32QPvTjeP+wZpn7L34qFIbZJNRsIF57T23zbUqljM7WPXrVeuN1VuIPk8sK83v/m9BPYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738243173; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NLwua+vOM51f4+UaA6AyaKl3pPxM/d7eEICWljZUaKo=; b=ms5WkJV+Tk/rP5X3hawGexuxDfKUIllpCgWJ92R2w4ostrFiAEBtn6Lr/4gk4ftABuJq3ETjLXewedRiqe2PL8yFFhI4oGZWWyAKAno2Md7lVra9MQMyNWljtCtmVoo1qimw5fTSsHElpW688jYy+YCQBLNaHWNbiUlN1NLEVfo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738243173400321.6571320749763; Thu, 30 Jan 2025 05:19:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tdUQM-0001HW-LM; Thu, 30 Jan 2025 08:17:38 -0500 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 1tdUP4-0007SH-9Y for qemu-devel@nongnu.org; Thu, 30 Jan 2025 08:16:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tdUP0-00009M-00 for qemu-devel@nongnu.org; Thu, 30 Jan 2025 08:16:16 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-536-MTTHucExNEunrfq14RmS6g-1; Thu, 30 Jan 2025 08:16:09 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0852A1800361 for ; Thu, 30 Jan 2025 13:16:09 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.95]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 63E1130001BE; Thu, 30 Jan 2025 13:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738242972; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NLwua+vOM51f4+UaA6AyaKl3pPxM/d7eEICWljZUaKo=; b=MXeLqRBCc6msnobRsjPCRykKAVzxqGd6F6Hjq7PP/ETv6J30v95QQdKhxwvnxsiPRClK3h 37O8R2LYB92EIPIHG3Uj/v4asTMxHE6w5XIjtVNF42/acGURt/34y9dttbGE5T6oHhnj8T RhaERekzExsDPVrdyt5rkAFWoh2JdCc= X-MC-Unique: MTTHucExNEunrfq14RmS6g-1 X-Mimecast-MFC-AGG-ID: MTTHucExNEunrfq14RmS6g From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , David Hildenbrand Subject: [PULL 12/20] virtio-mem-pci: Allow setting nvectors, so we can use MSI-X Date: Thu, 30 Jan 2025 14:15:26 +0100 Message-ID: <20250130131535.91297-13-thuth@redhat.com> In-Reply-To: <20250130131535.91297-1-thuth@redhat.com> References: <20250130131535.91297-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.3, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1738243174494019000 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Let's do it similar as virtio-balloon-pci. With this change, we can use virtio-mem-pci on s390x, although plugging will still fail until properly wired up in the machine. No need to worry about transitional/non_transitional devices, because they don't exist for virtio-mem. Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth Message-ID: <20250128185705.1609038-2-david@redhat.com> Signed-off-by: Thomas Huth --- hw/core/machine.c | 1 + hw/virtio/virtio-mem-pci.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 8f396ef803..7b74cde10a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -41,6 +41,7 @@ GlobalProperty hw_compat_9_2[] =3D { { "virtio-balloon-pci", "vectors", "0" }, { "virtio-balloon-pci-transitional", "vectors", "0" }, { "virtio-balloon-pci-non-transitional", "vectors", "0" }, + { "virtio-mem-pci", "vectors", "0" }, }; const size_t hw_compat_9_2_len =3D G_N_ELEMENTS(hw_compat_9_2); =20 diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index 1b4e9a3284..6cc5f0fd3b 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -22,6 +22,10 @@ static void virtio_mem_pci_realize(VirtIOPCIProxy *vpci_= dev, Error **errp) VirtIOMEMPCI *mem_pci =3D VIRTIO_MEM_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&mem_pci->vdev); =20 + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors =3D 2; + } + virtio_pci_force_virtio_1(vpci_dev); qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } @@ -152,6 +156,13 @@ static void virtio_mem_pci_set_requested_size(Object *= obj, Visitor *v, object_property_set(OBJECT(&pci_mem->vdev), name, v, errp); } =20 +static const Property virtio_mem_pci_class_properties[] =3D { + DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags, + VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, true), + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, + DEV_NVECTORS_UNSPECIFIED), +}; + static void virtio_mem_pci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -164,6 +175,7 @@ static void virtio_mem_pci_class_init(ObjectClass *klas= s, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); pcidev_k->revision =3D VIRTIO_PCI_ABI_VERSION; pcidev_k->class_id =3D PCI_CLASS_OTHERS; + device_class_set_props(dc, virtio_mem_pci_class_properties); =20 mdc->get_addr =3D virtio_mem_pci_get_addr; mdc->set_addr =3D virtio_mem_pci_set_addr; --=20 2.48.1