From nobody Sun Nov 24 05:44:27 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=1726199217; cv=none; d=zohomail.com; s=zohoarc; b=mOjgDAlkZ4/chzn17ckqY4UTTkcqALqP6dCFDvLLbOJGWgTm4yD1hQ841+krVeuZnZotfIl245R4NDiPAiTo386xcnX465IhcRv2KqTkscowk7MnDqndgROpFhwQRH4lU+p8GE2rj0KqgBluY0+g0ksNqOU2gMCVWZJ0uAQsR80= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726199217; 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=FgOxw6et8+pj5F2p1F6QQep3GannhEQmn82AQXkbvpE=; b=Wf2IYos9CkRGKSfBU7lRZyyiBxE58VioD4ucLhkWhSWc2t5g74j+cwERVgKoXdqlb3VozN6DvRcYGPpbojldpmhEQUUokYIrqzO4T0H5KZBc/UUR2WHTqh4fT2b9MPWxM++7CBZo8UNKb5sMPOrXxG5qUgj5ungoagHFJkPmQtM= 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 1726199217813439.8294469203878; Thu, 12 Sep 2024 20:46:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soxFD-0004Z1-7s; Thu, 12 Sep 2024 23:45:15 -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 1soxFC-0004Vn-BQ for qemu-devel@nongnu.org; Thu, 12 Sep 2024 23:45:14 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1soxFA-0008FU-KC for qemu-devel@nongnu.org; Thu, 12 Sep 2024 23:45:14 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2059112f0a7so3765585ad.3 for ; Thu, 12 Sep 2024 20:45:12 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-2076afe9a83sm20401465ad.217.2024.09.12.20.45.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Sep 2024 20:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1726199111; x=1726803911; 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=FgOxw6et8+pj5F2p1F6QQep3GannhEQmn82AQXkbvpE=; b=drPuds6t4G6qjD+kFV1Ix6djApEvKDh8s/16ObHjJw83y73ey4Wb8lIrrU52r/omBl gjDQppSIsANxCRSEfa0ZoaM085U1Q5n/CWBFyzv4Ujta32SQ6XN3jGDxSh2oMnILctJY XOda0oMkJ4uaKSCg5CV872KCpANvtCdvocz5bzVCkYfTZeMmnBXOE1FYpao/kAsOd8oA HmtcTnF6DMSYc+se1iTlv0fdRVWnR2ygUbJz0T51m9rJ7G8BHhG3XA7Nnjk2WARXLohE t/8ZijQwAS+8cvxKEscn7ydWEPv3HjemDS8Dpu8Ys0seiOC8KwFaZltXDu5A2MqYHo7I nqYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726199111; x=1726803911; 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=FgOxw6et8+pj5F2p1F6QQep3GannhEQmn82AQXkbvpE=; b=JLw3ni/IB6URmUkQELINY7+oLBpZaZN1Zqemf0QWWipfOYOH5Q6MpHF+YK8w2M+CuM g7Pi0Gq5NJNtBHOihLxyNEOI3YjA45cKSUgihVx7YE07MjwlUkNjIkGdHqv2pvq1oYOm 35DLYbEJGsrLxcqFg6ON58PdTnrNItfr3BRFcnRU1zmdwJpJDKkzpN12hNZlaV7bGwcX a/hxlYiJZmalj7F4Xt/I/gUzQ+aCHCTlBmzc0S6q15iBl0ssn4n8xEUCvZei6wY96rNQ USM34feUfXTR85sW5tsvlInhBN3/9G63ewd7El92MVQWqHPMMPrtbU5UN8ps7zBLbaom O1mA== X-Gm-Message-State: AOJu0YwCWZk6telOHF/yQ/Ct2tYT5uVYwIMu1wzQpGa/3Jk9PPVc8I8o 1lzOg6phAsmBvvQPAUZPoj+BAUwl93dI1Dyf6w5jO+xIklTGrlu3AfVRlkCzlVM= X-Google-Smtp-Source: AGHT+IECMOqMzkhyw7zOjDUJJapN09wVaeNCGst9cBYdEBU8bjlfEGsR5+Dlj6qfaz5sp7jHmZ8FIg== X-Received: by 2002:a17:903:444c:b0:206:8c18:a538 with SMTP id d9443c01a7336-20782a69a99mr18064105ad.32.1726199110659; Thu, 12 Sep 2024 20:45:10 -0700 (PDT) From: Akihiko Odaki Date: Fri, 13 Sep 2024 12:44:34 +0900 Subject: [PATCH v16 06/13] s390x/pci: Check for multifunction after device realization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240913-reuse-v16-6-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::634; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x634.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=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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1726199219692116600 The SR-IOV PFs set the multifunction bit during device realization so check them after that. There is no functional change because we explicitly ignore the multifunction bit for SR-IOV devices. Signed-off-by: Akihiko Odaki --- hw/s390x/s390-pci-bus.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index eab9a4f97830..e645192562ae 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -971,21 +971,7 @@ static void s390_pcihost_pre_plug(HotplugHandler *hotp= lug_dev, DeviceState *dev, "this device"); } =20 - if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { - PCIDevice *pdev =3D PCI_DEVICE(dev); - - /* - * Multifunction is not supported due to the lack of CLP. However, - * do not check for multifunction capability for SR-IOV devices be= cause - * SR-IOV devices automatically add the multifunction capability w= hether - * the user intends to use the functions other than the PF. - */ - if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION && - !pdev->exp.sriov_cap) { - error_setg(errp, "multifunction not supported in s390"); - return; - } - } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { + if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { S390PCIBusDevice *pbdev =3D S390_PCI_DEVICE(dev); =20 if (!s390_pci_alloc_idx(s, pbdev)) { @@ -1076,6 +1062,18 @@ static void s390_pcihost_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { pdev =3D PCI_DEVICE(dev); =20 + /* + * Multifunction is not supported due to the lack of CLP. However, + * do not check for multifunction capability for SR-IOV devices be= cause + * SR-IOV devices automatically add the multifunction capability w= hether + * the user intends to use the functions other than the PF. + */ + if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION && + !pdev->exp.sriov_cap) { + error_setg(errp, "multifunction not supported in s390"); + return; + } + if (!dev->id) { /* In the case the PCI device does not define an id */ /* we generate one based on the PCI address */ --=20 2.46.0