From nobody Sun Nov 24 05:26:03 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1726199211; cv=none; d=zohomail.com; s=zohoarc; b=FfBOYBf3UXaPNr56nApTs3CnjoNJZl/KfHnC8bW+Vsjoltu2GAc/v2iKxhd7YUsBKj/QsznldSe72uueLOFksJF1xrtABMMjIBTRN6uKkODDiwvVqMBswB1N79rvzIRfRnm1z8iedN5ITMPerFvp1SZcYK+Xyg1Uq8lNUXTJs9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726199211; h=Content-Type: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=ZYny33Tgh+SOHfd6MwrD3WKa5Gl+M4qnADH3DvKBPFU=; b=MjsOv3VWFa4v8Q1svdO47m72qoAsy6ez18lYSp3yFBWTJh2Bt+UqYc2/ILxMI+JumLtO9RlzwSgcvv+kzPJxSVU+ZmzbJkzHMAXx1QulfOBzcLyLPHjqBPlvOJTZMjtPvkHPfLBCgoK9bmO2XuHGoQ9k75IKcmUFgasFFuLUDcc= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1726199211972731.5946499089217; Thu, 12 Sep 2024 20:46:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soxF6-00047A-ES; Thu, 12 Sep 2024 23:45:08 -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 1soxF1-0003vL-4H for qemu-devel@nongnu.org; Thu, 12 Sep 2024 23:45:04 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soxEz-00083C-DN for qemu-devel@nongnu.org; Thu, 12 Sep 2024 23:45:02 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-718da0821cbso1326158b3a.0 for ; Thu, 12 Sep 2024 20:45:01 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-71908fca6a1sm5289696b3a.26.2024.09.12.20.44.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Sep 2024 20:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1726199100; x=1726803900; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZYny33Tgh+SOHfd6MwrD3WKa5Gl+M4qnADH3DvKBPFU=; b=rptXo4WZA7xFD6WMaDq51/tD5B6XOfrKUxEd6PH9nygGGaYtPISMVl+dmyWcSvIljH Sgy4mh8kmvvw0QXpKy/bnckLEtFH7fvpsQw/haCp40N+HnMFdZ/YzaZfm1DXJI9sqX4q mt2lIYpHUUxXDgZSN7gbrkqhGTTfaiPj2dIXrrTQ2M/pUFerniJ8nP+/gePc441GI/cW I1D2d86SQbPyNHPHv+ljZVjBnjU1sS6r5oX93Z0xjEVYXFnpJAVCZlXcxoGKS63M0hju q3obq2WJRVKHyVkUmpVf8vDT/0Czgt7EWtqyFak2KVEjlfdzs1G5gvjE45sOrua7J7Km I8Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726199100; x=1726803900; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZYny33Tgh+SOHfd6MwrD3WKa5Gl+M4qnADH3DvKBPFU=; b=e1VadmwF22duoi4s2GvILqIKEf8i84qmUaAGWJkweGkC++qYjwimCiHxY+eeRlYOz0 qzS+mRukZL7MNCrkwv/LDZllOvH/jfs5lwct24oUoEMT84+SYrYZoF8Uk3HX6zpypBec P22flniwFZjkup3oPRxLy9FdQSTT7pxXmM9eAB7uuKiZ6UppW+t1KcHMoXRj9+dAJC6B xJ6dQBGJHELHzCbmopA/XxgTY3GV9/BGRM5DYL3Cc0k4ub4W9Kk9sozp7/3+0Hqgq6ej I7Ax06LP9ux+vAj9feaLr3/uFGm8GFealkyGTOZm+tNKm5a2c1nSEeTwW7fCr1gHr3B7 HUjQ== X-Gm-Message-State: AOJu0YwvcHoau0SAOW2UH1PFzPspUV3KKiPYdw6hVNcvRtFOkasrnDCh 7JOhvLx7fyj0UsIkjrAJj2Tx7orfoHaPdicOa7LnsdDcyxcl0IftT1ecsta4JU0= X-Google-Smtp-Source: AGHT+IFy8usctI3p+0+RUWGyNPa8L5NO+K4umzggsXaSh+FUW6qyBNA+8xSAUPV04bRMvZ2Wg0IwLw== X-Received: by 2002:a05:6a00:1783:b0:718:a3c1:60f6 with SMTP id d2e1a72fcca58-719261ecd95mr6610814b3a.18.1726199099803; Thu, 12 Sep 2024 20:44:59 -0700 (PDT) From: Akihiko Odaki Date: Fri, 13 Sep 2024 12:44:32 +0900 Subject: [PATCH v16 04/13] s390x/pci: Avoid creating zpci for VFs MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240913-reuse-v16-4-d016b4b4f616@daynix.com> References: <20240913-reuse-v16-0-d016b4b4f616@daynix.com> In-Reply-To: <20240913-reuse-v16-0-d016b4b4f616@daynix.com> To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Markus Armbruster , Matthew Rosato , Eric Farman Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 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: none client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x432.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1726199213836116600 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 --- hw/s390x/s390-pci-bus.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 3e57d5faca18..1a620f5b2a04 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,9 @@ static void s390_pcihost_unplug(HotplugHandler *hotpl= ug_dev, DeviceState *dev, int32_t devfn; =20 pbdev =3D s390_pci_find_dev_by_pci(s, PCI_DEVICE(dev)); - g_assert(pbdev); + if (!pbdev) { + return; + } =20 s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED, pbdev->fh, pbdev->fid); @@ -1206,7 +1218,10 @@ 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) { + 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 2.46.0