From nobody Sun Nov 24 12:38:01 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=1724389360; cv=none; d=zohomail.com; s=zohoarc; b=Qa/MA/Je3tOnBThBpewqT98LwRk2m4nI4lOmtiaUcDokJP61W3tqJsAwpwaDg27Xkue9Hv4+PWFBrfzk17NdvdCPSVGi8hpPqjwlCG+Il519IMo1OUg1qUBqbNbIGh/KdRA+zPDV1fUCpeluLj5NNCRZNixO0XiVaoy9c9jihaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724389360; 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=KhvSqXAEdDDWpyZ2TnpIXArJspefwxxfrLfBQ6hR8X0=; b=ez8Whb5vpLFe41O43RBhbuxeve++/OLbEgrR9zFrEKYIzJWloQMiAx7/OPbZjXaMGWqSQgwDVJjejRtWqzcrLN69sdcKLoU7FBsLp0tXnuvkHM0Ab94e/KaflLlSREZ25RtIBxauiZKkWNw8xQIyXuA6JOFNSiDZDCzZTLEKjfs= 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 172438936019161.73396041160834; Thu, 22 Aug 2024 22:02:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1shMQF-00069I-Jz; Fri, 23 Aug 2024 01:01:16 -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 1shMQ7-0005jk-Rj for qemu-devel@nongnu.org; Fri, 23 Aug 2024 01:01:09 -0400 Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1shMQ5-0008OJ-0N for qemu-devel@nongnu.org; Fri, 23 Aug 2024 01:01:07 -0400 Received: by mail-io1-xd2b.google.com with SMTP id ca18e2360f4ac-8278b0ba494so2233839f.3 for ; Thu, 22 Aug 2024 22:01:04 -0700 (PDT) Received: from localhost ([157.82.207.23]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-7cd9acdac47sm2275089a12.39.2024.08.22.22.01.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Aug 2024 22:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1724389264; x=1724994064; 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=KhvSqXAEdDDWpyZ2TnpIXArJspefwxxfrLfBQ6hR8X0=; b=GYEr6lyDGvPcLMWyM7aQPLUvjOgVoqREvuUN7y36IbPL8pIe1ZJu7CDYQsXFH78jwl b1D+crYolyOJbzxqC5EG5NutE0nMb/G9MStoU3eRL2kdfW/0NC8BhLuK0cvlrmGcvfPQ pGVfFnMoiLAX4cP23puWW1a6mRB4EqSJOKEIJHWT8W6lXsQSnOMp1XDDYK7PnQRP9Uyy WR9wGlDM1p37zL0tTGYj/srKC4ziXjWb+BBvroNBCGLeCQgqZPMtmyyMS8Z4J+VTEHhQ rnvhcdpehW+gM/nMBm0T/cpbqwEohrkxHfaCf77lejqGotWniuqCru/qnwJitqhecN16 UTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724389264; x=1724994064; 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=KhvSqXAEdDDWpyZ2TnpIXArJspefwxxfrLfBQ6hR8X0=; b=fRNYDlnW5ys8kxjU+zf7p+JDR0TZPkMSE8YbgEYSrUcbR3f5IJWRRbze7+3WV8TimX zn6ND1iu+az6pEi3bSos/2gKMWt9BIsbrGVRccwD16A/JrEBUWAqvqEf53IWOyJJUPM3 aeVYKcW9REWLKOGBXPCvX8RT0XZ6/ThcYz2/9LSHazYdcTya2UkMbFo9ERvbISsPWSYn iWMgcxtdf4bDzOyG7iD7F28PtPPFDUkw889RaGKUrvb1+HH+H/hZ90rbIdxjHPqGI+bl O2RTm1DAr5bemAKDJckI1ajEvkXwTkGEZWDi2cRR8pHqQKEDe7KbUaDG0dhoJtpsEqjO Q2Cg== X-Gm-Message-State: AOJu0YxRTDYALtnU0diJB3g9Nb7vsjS+KB03OuRUvBESxHx16s9McXM9 Yam03KtrARi/L2FofsdkRGrJGvhlsdIIkU44GCXadN/tzdyW11mydaD2QRO936Y= X-Google-Smtp-Source: AGHT+IH8TOXyjNLBnQeBNzLVOesOgQILP5R4rbuQLnnnNT+aVbju+4awJySzna2gGEx5AGUZln197w== X-Received: by 2002:a05:6e02:2192:b0:398:a2e0:18dc with SMTP id e9e14a558f8ab-39e3c9c0d27mr10637295ab.17.1724389263613; Thu, 22 Aug 2024 22:01:03 -0700 (PDT) From: Akihiko Odaki Date: Fri, 23 Aug 2024 14:00:41 +0900 Subject: [PATCH for-9.2 v15 04/11] 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: <20240823-reuse-v15-4-eddcb960e289@daynix.com> References: <20240823-reuse-v15-0-eddcb960e289@daynix.com> In-Reply-To: <20240823-reuse-v15-0-eddcb960e289@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 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::d2b; envelope-from=akihiko.odaki@daynix.com; helo=mail-io1-xd2b.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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1724389361172116600 The SR-IOV PFs set the multifunction bits during device realization so check them after that. This forbids adding SR-IOV devices to s390x. Signed-off-by: Akihiko Odaki Reviewed-by: C=C3=A9dric Le Goater Tested-by: C=C3=A9dric Le Goater --- hw/s390x/s390-pci-bus.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 3e57d5faca18..00b2c1f6157b 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -971,14 +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); - - if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { - 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)) { @@ -1069,6 +1062,11 @@ 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 + if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { + 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