From nobody Wed Oct 23 00:27:06 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=1729586312; cv=none; d=zohomail.com; s=zohoarc; b=SOQNr/IbijWmP6Xwax+yepLBWKwWuQ4zzAkz0XOdghVT3hIbG2lB0JQGlXgBw/LvMJOvS31s3xQloeOBGnh8IBzdo9Ftq5hbZk/fft4ynKDFPiwfvgs6Lpink34VG3qN+ayngjsysugCr3RgnGj8Dj+SHnCDdW6uMmd+Ie1ubxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729586312; 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=s2ddjXKYpOMCpQhobDNCoLol3H9ldQZTsQ8bEMFv7Pc=; b=YKqA+AC/wPDYHnsTGhVCMkRMiwufFmEP81+u2j4g4KVGTKXNjQQJp7cH7QU+DB/4BG/yXI2OES/0rzVTpBskt9VpOOmQA1mpEercWtc0afu27nooIdEbwbam3OFSTut6E690DTchR7mhy/j0iAkA12YxLutFFZWmOOcTHC5pcUA= 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 1729586312770112.811603806211; Tue, 22 Oct 2024 01:38:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3AOO-0001i4-4e; Tue, 22 Oct 2024 04:37:28 -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 1t3AOM-0001a1-3r for qemu-devel@nongnu.org; Tue, 22 Oct 2024 04:37:26 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3AOK-0001Vm-Hf for qemu-devel@nongnu.org; Tue, 22 Oct 2024 04:37:25 -0400 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-718119fc061so2106593a34.2 for ; Tue, 22 Oct 2024 01:37:23 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-7eaeabd9c0esm4592104a12.79.2024.10.22.01.37.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2024 01:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1729586242; x=1730191042; 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=s2ddjXKYpOMCpQhobDNCoLol3H9ldQZTsQ8bEMFv7Pc=; b=IEAZjWfqDvLC4KDips9sAT9oLHtbOl/RDKVVg698yVuuU03QD93hIEyR1C/SBFoJ4x C/yqNMxi0gm7VJby8c9D6nT6GAEblYUojdF0HJCOzX/Dz5XCI0wl1WKXQkwXwXWT9t8t krPD0qfFIyvZL9k/z+8hglIlWmVQcUnvsIix/33Amkri+/4YFDs+ED368rZF9DYJKS8f BqIF8nvdGlDbxZ/SI2sdg26+liYOjUVIH3cuy2ZG3AfzmxWObdnqJGZzQwSvMlJjdU9M 6L1nVjYQuTjhGY7J2IF6C0h5NNrmw3K+IwYnyR9ZbhBweOeRgkV3awN5db/ZAFZ0Yu0M vdjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729586242; x=1730191042; 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=s2ddjXKYpOMCpQhobDNCoLol3H9ldQZTsQ8bEMFv7Pc=; b=VaGz/1zvWW+3LRCUxD5Vf/I2jz5dqcJYg8A7E83bhn4JADVZgcEe3UebqxqpEm0x2p MCe1irCylET8od9uTqfe0dCJWTq+1piRYbfCM9PsD6zOXqzma+LdXBXp1mtE62OW9jwz Q0BEWG1EDXM5Y5CpCDKmYPtqvF/MyIQjq1fgf/8FkwrWkJulY+gMM8YUEEZrwfZR0n84 +X0kOgAx78eIueJO7HgD8FoDg1E4oI3hm0Uo6+Hr9hhK9l3ubOT+OITDSYoNhFYRs1dk 53ftNn6rX0GWwtS9JzsSfxMSNmsefyIbAPicAWiWcxcrB7z4Vp2whyXYgvJqu1T0HPdC KnQw== X-Gm-Message-State: AOJu0Yx6oZ0bb/1X3ClpTGLSGOxtytEPpWjlohv2vnF21JasDritLq/z iPoKbGSTM9fKh2e3R02+TY8ONLXtvK+n3gZj4HSmLjUnY1hv7tC+Xw+cSlu92cg= X-Google-Smtp-Source: AGHT+IH35ts0/l0USCjFN6lwgA8BBJiwMJt4kRQTFjbSLwMYFlnC24azPznLSEhbX2QwhEqZTMAIWw== X-Received: by 2002:a05:6870:440e:b0:277:f51d:3ed3 with SMTP id 586e51a60fabf-2892c2def2emr11876088fac.16.1729586242433; Tue, 22 Oct 2024 01:37:22 -0700 (PDT) From: Akihiko Odaki Date: Tue, 22 Oct 2024 17:36:41 +0900 Subject: [PATCH v17 04/14] 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: <20241022-reuse-v17-4-bd7c133237e4@daynix.com> References: <20241022-reuse-v17-0-bd7c133237e4@daynix.com> In-Reply-To: <20241022-reuse-v17-0-bd7c133237e4@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 , Harsh Prateek Bora , Shivaprasad G Bhat 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::32c; envelope-from=akihiko.odaki@daynix.com; helo=mail-ot1-x32c.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: 1729586313974116600 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 | 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 40b2567aa706..f06df757a34b 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 2.47.0