From nobody Sun Feb 23 12:10:18 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=1740140618; cv=none; d=zohomail.com; s=zohoarc; b=UQ/DzQ0UMZDk7fOeVUsP+dXg9cNYlg4+R5S7Pu3zfp+oLTaHOuCey3bd6PRpIGzIR43SoQbViRtMxKrpcNbwNPA4+4F+ak2UJVh2Q0uLgLQMCziqzgRzfEorAFSTHpluIixCqEanF1TZrMo+YiQkY3+pLA7NI9ywbvmgfG18eMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740140618; h=Content-Type: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=7MQix8FGUYJVo/KUMfZ0aNvVpXePxV+3xwtbN+SCMWk=; b=ZAMPtRiJkZlZHFWsVpCoLruafT7gBW+Zv5fJ965duc4hLkREislmWFmrjPDnw1LLgHFxLGwCf8vCWEehv+TFwCnl4Fl8S3b3qRLRMQLlkyKzv1C9DM5cKiRWk9UhmpJic0xetiNaProEhNso/Rbq3XdVdmrLu9VnfvSjOBFzlSw= 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 1740140618620990.099684446429; Fri, 21 Feb 2025 04:23:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlS3Q-0004Y5-Vq; Fri, 21 Feb 2025 07:22:53 -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 1tlS3O-0004V3-Hn for qemu-devel@nongnu.org; Fri, 21 Feb 2025 07:22:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlS3M-00070Y-UZ for qemu-devel@nongnu.org; Fri, 21 Feb 2025 07:22:50 -0500 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-FLsUqF-YOh2O203JQdHCbA-1; Fri, 21 Feb 2025 07:22:46 -0500 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-38f2f78aee1so940948f8f.0 for ; Fri, 21 Feb 2025 04:22:46 -0800 (PST) Received: from redhat.com ([31.187.78.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f259f7987sm22856411f8f.87.2025.02.21.04.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 04:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740140568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7MQix8FGUYJVo/KUMfZ0aNvVpXePxV+3xwtbN+SCMWk=; b=druYtbjCd6dpn4MzN5V6ALL23t789u46dl+xUwmsap7zsPyMgTRtLjW2dM9Ryn1qgfo4bB m5aQmI+g4qvfC9ylWXjgnWCdSjDvKb/36u0gT26FSYuj17ND4C8HG+bEMrHYLPD1/SeTF+ A6VgzdYCO2FZKhlRq9Mk23HmUwBRVUg= X-MC-Unique: FLsUqF-YOh2O203JQdHCbA-1 X-Mimecast-MFC-AGG-ID: FLsUqF-YOh2O203JQdHCbA_1740140566 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740140565; x=1740745365; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7MQix8FGUYJVo/KUMfZ0aNvVpXePxV+3xwtbN+SCMWk=; b=Aa4ojany2VYTMi5XsVPEt4BNa5pcu42Z+8lnZpv/phl5yonmfMkmT6QVZvLcuH28s7 GCW2tlJ0g2+EhYu2Cq2pX26MeIwARSX9svygx3XVCEQINyaIoM6eSmUp/wTZHJZi8AID dEPUQgu4cALpYPIbpfPpKG3MNhfdS3tM4Jot3swhxssxkmSKQ5A5plhd/bwXisxAwcYT +U2DRAitIKcrRmIqM41FXMDHG42AD9nUXKFrfF91kVgEoqzEQYVqT/PfFv88OwDVg/WL rm32sQJ91AjYBU+Ky7jfnKMzv+9g+f+7xcNOLC9fznkyrFxwcIkv1oXLzbqm++KKm1JV F7zQ== X-Gm-Message-State: AOJu0YzZV7vUm/L50OHffgfvmNWfUEHEcL8JYMccl4lYYOkySjfgi3DB Au+AUIv92LtVl3NFTjBhKMC1OiCWO5IVb2OL3MdvgQ9hDEDAFYehxhaDCWYT9AA0X3STckrFfRm hS9NPDNxFRBov6gd9+a7GGMa6ViCXdOD+XOk57MstSY2KcYrVd3BPQkCKTNw/a1JzQDvrVlRcqs 0zNtxwSg7JkgJApgKHaQB4iAriA1G96Q== X-Gm-Gg: ASbGncte/6iFha3WZSlew4hgEAUxJ4oPcoiMo5V4EFsBRRYBZs7Jh/Sm773hcnXXdX4 KussXvZvMFMfA9L8oh1OYitpH/rD3IWAE9RgdtPWK0f26f2wPje2cWyHLUOUwl7NIZG6C8llQUU hzsYwbPvZT5HUf2yEyuyLe7R+tpOOFbmUhb5lhtzSQrYV1MJig9wg4pQryBMWOaufq0sc1TW/MV 0A8JClbH9WsfXhmHJjxrkUlR9SfdA/bRbrlzETzI91RjqSkHHih7MGnV2+NxoBVBDjH9RGkbg8T 3xvVyg== X-Received: by 2002:a05:6000:4601:b0:38d:e363:494b with SMTP id ffacd0b85a97d-38f614b6e05mr5807387f8f.8.1740140565496; Fri, 21 Feb 2025 04:22:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrAnCXaIYDuswyI624BgoJT7WSDuQgIwmDuFOSOQPkmR5Qq/oSSfJJ031qH7RaRMR3m2YJNw== X-Received: by 2002:a05:6000:4601:b0:38d:e363:494b with SMTP id ffacd0b85a97d-38f614b6e05mr5807357f8f.8.1740140565134; Fri, 21 Feb 2025 04:22:45 -0800 (PST) Date: Fri, 21 Feb 2025 07:22:41 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Akihiko Odaki , Matthew Rosato , Eric Farman , Thomas Huth , Halil Pasic , Christian Borntraeger , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , qemu-s390x@nongnu.org Subject: [PULL 05/41] s390x/pci: Avoid creating zpci for VFs Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.424, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: 1740140619319019100 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki VFs are automatically created by PF, and creating zpci for them will result in unexpected usage of fids. Currently QEMU does not support multifunction for s390x so we don't need zpci for VFs anyway. Signed-off-by: Akihiko Odaki Message-Id: <20250116-reuse-v20-3-7cb370606368@daynix.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/s390x/s390-pci-bus.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index eead269cc2..8c5eb69f7d 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -1080,6 +1080,16 @@ static void s390_pcihost_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, =20 pbdev =3D s390_pci_find_dev_by_target(s, dev->id); if (!pbdev) { + /* + * VFs are automatically created by PF, and creating zpci for = them + * will result in unexpected usage of fids. Currently QEMU doe= s not + * support multifunction for s390x so we don't need zpci for V= Fs + * anyway. + */ + if (pci_is_vf(pdev)) { + return; + } + pbdev =3D s390_pci_device_new(s, dev->id, errp); if (!pbdev) { return; @@ -1167,7 +1177,10 @@ static void s390_pcihost_unplug(HotplugHandler *hotp= lug_dev, DeviceState *dev, int32_t devfn; =20 pbdev =3D s390_pci_find_dev_by_pci(s, PCI_DEVICE(dev)); - g_assert(pbdev); + if (!pbdev) { + g_assert(pci_is_vf(pci_dev)); + return; + } =20 s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED, pbdev->fh, pbdev->fid); @@ -1206,7 +1219,11 @@ static void s390_pcihost_unplug_request(HotplugHandl= er *hotplug_dev, * we've checked the PCI device already (to prevent endless recurs= ion). */ pbdev =3D s390_pci_find_dev_by_pci(s, PCI_DEVICE(dev)); - g_assert(pbdev); + if (!pbdev) { + g_assert(pci_is_vf(PCI_DEVICE(dev))); + return; + } + pbdev->pci_unplug_request_processed =3D true; qdev_unplug(DEVICE(pbdev), errp); } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { --=20 MST