From nobody Sun Nov 24 12:13:56 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=1722762241; cv=none; d=zohomail.com; s=zohoarc; b=buasa5rhRsbRQ0wT7cjki7NeDmIII1NhbSDLrDPPK9LN6dOnP5IOIH1ngissTnHFXb9brPwAUvyGGi+ykirzZcaDisovd7x2jvSw101ikR2BuDX+vwuZ2caImiwfXjp4Zu0Vq2XWWRMLq4FyiyCpjwmkLihDX+MbsdosVOKbwBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762241; 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=8641KY8iAUQPaIzKnmIv+VtshKd/QMdL5rBm/qrvkYc=; b=BVCleQnonhhnWJ/RJGqVdKFc4tZuHDlqymZ8fcRn3ASeEPrfjnvwrVK2GsLKklu49SO+gAyaLxOlkVB67n4cJ8w1h1H6pA946hZ1VFVB1EI9A0x4wqSluKkZ/3PcnMCV1wK86jKABdnJa6SUXYg/w235hbZdzAYnwVQG+ahKeC4= 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 1722762241681709.8861874611307; Sun, 4 Aug 2024 02:04:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX7k-0000N3-6O; Sun, 04 Aug 2024 05:01:56 -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 1saX7i-0000Dm-5K for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:01:54 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX7g-00019V-3a for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:01:53 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-6c5bcb8e8edso7105454a12.2 for ; Sun, 04 Aug 2024 02:01:51 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2cffac2d378sm4673526a91.0.2024.08.04.02.01.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762110; x=1723366910; 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=8641KY8iAUQPaIzKnmIv+VtshKd/QMdL5rBm/qrvkYc=; b=2aTvzBhp/kEYlFA6ieDkilyery97tjX0HXPmr4kgK5r+Bke1TtMvqdjvhvq4gryFUL 82zLSO9hYMBVF6yKPudYVYTd/qmfrTY+ixIgjRSAkhDLlVSCVwpfarRflEfBFQxUhLci uC/iFvHJe6VNKlcWmwSBIzbKzxPP0vmAVh/zyxCqQz8ALOHBBEDQxVNHKrvut73i8BOU k21vKgBTfYd/a9stqxshK0rHPbgOr1HT/QnrjRy94HJ4oTyPGHFIVGI9Z9YYU3yPIB1+ NRgJXlWM17KWggZfIXCWD35aQIYZIYdQFSJDo7IYCmvNHk4zlEnSg5dmeO3lzHlPmB6x c8zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762110; x=1723366910; 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=8641KY8iAUQPaIzKnmIv+VtshKd/QMdL5rBm/qrvkYc=; b=l7g0Bxg0t16hT9pcxycgjzJ3zGLGP3RgHmuGA/sU4tiLCwafuCC4Dec/lETxu8RFuo qRgpDcUNSZoUb5aA4STbKPGoPOr6OnDjffVG61ycDD7i+/1USJKoTeVnri8liaZUDdGd iIOh6kySvopvRorQN4ig3ABHcinygSMq7XXFE4pJSTQwE5+cHHt6cehJRX3hHSrBhv9s bqb9DDbDq0iqEV0RddM1GgEVS7XqJDvZSqOy8mWFMsGw7Q8eeGnJ9jJh7LzI0m0YGPzH FWGwVjvCa8zE1g6TGxxzaOwb2rDa2x8+aeTYFgL7MNeiNQsjgcp8HnnQ5DoCfZ5L4qlW dc7g== X-Gm-Message-State: AOJu0YxXV9raaDfWBuuEx3VOy4v6e+qRpm2KxwuEGI5Py1gHxBfpu1Tg RRebzK1c+w9XUpxUp3Y+BoBAuIdbRnQT4NWQw5WESo1nqPKQPolThLIjE9aDKjA= X-Google-Smtp-Source: AGHT+IEEwt3bDdJgEiYtPuJgOrGZhPEbxGJowbx3IMdFl7ySpsx4lw1pM/BJKHDP8F+Gpv4d1K3XdQ== X-Received: by 2002:a17:90a:51e6:b0:2cf:eaec:d756 with SMTP id 98e67ed59e1d1-2cff94477f3mr10418660a91.12.1722762110589; Sun, 04 Aug 2024 02:01:50 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:37 +0900 Subject: [PATCH for-9.2 v12 01/11] hw/pci: Rename has_power to enabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-1-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::530; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x530.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: 1722762242121116600 The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h | 7 ++++++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c | 14 +++++++------- hw/pci/pci_host.c | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index eb26cac81098..fe04b4fafd04 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -678,6 +678,11 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev) } =20 MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); -void pci_set_power(PCIDevice *pci_dev, bool state); +void pci_set_enabled(PCIDevice *pci_dev, bool state); + +static inline void pci_set_power(PCIDevice *pci_dev, bool state) +{ + pci_set_enabled(pci_dev, state); +} =20 #endif diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index 15694f248948..f38fb3111954 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -57,7 +57,7 @@ typedef struct PCIReqIDCache PCIReqIDCache; struct PCIDevice { DeviceState qdev; bool partially_hotplugged; - bool has_power; + bool enabled; =20 /* PCI config space */ uint8_t *config; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index fab86d056721..b532888e8f6c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1525,7 +1525,7 @@ static void pci_update_mappings(PCIDevice *d) continue; =20 new_addr =3D pci_bar_address(d, i, r->type, r->size); - if (!d->has_power) { + if (!d->enabled) { new_addr =3D PCI_BAR_UNMAPPED; } =20 @@ -1613,7 +1613,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t = addr, uint32_t val_in, int pci_update_irq_disabled(d, was_irq_disabled); memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); + & PCI_COMMAND_MASTER) && d->enabled); } =20 msi_write_config(d, addr, val_in, l); @@ -2884,18 +2884,18 @@ MSIMessage pci_get_msi_message(PCIDevice *dev, int = vector) return msg; } =20 -void pci_set_power(PCIDevice *d, bool state) +void pci_set_enabled(PCIDevice *d, bool state) { - if (d->has_power =3D=3D state) { + if (d->enabled =3D=3D state) { return; } =20 - d->has_power =3D state; + d->enabled =3D state; pci_update_mappings(d); memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) - & PCI_COMMAND_MASTER) && d->has_power); - if (!d->has_power) { + & PCI_COMMAND_MASTER) && d->enabled); + if (!d->enabled) { pci_device_reset(d); } } diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index dfe6fe618401..0d82727cc9dd 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -86,7 +86,7 @@ void pci_host_config_write_common(PCIDevice *pci_dev, uin= t32_t addr, * allowing direct removal of unexposed functions. */ if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) || - !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) { + !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) { return; } =20 @@ -111,7 +111,7 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev= , uint32_t addr, * allowing direct removal of unexposed functions. */ if ((pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev)) || - !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) { + !pci_dev->enabled || is_pci_dev_ejected(pci_dev)) { return ~0x0; } =20 --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762163; cv=none; d=zohomail.com; s=zohoarc; b=lIL6DBViGstFL4Yf9aX98imeHA1wX98mCKfgQpa08ARey0CbZNR0SlJHIlVaK7JAGNUpck1yuzo5dgKvw3B7zP4W7dnVY+abBOMI+ornX55Y6FBxRYR2tJieRO/AfpwwGs6m6HrppwNvGfw4fbSlTJ4FmZVaAeKfXWxZCAFxYu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762163; 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=h49lGewxT9hFA+tlJrf36flRr26IrZVQVpZMqnu2U/A=; b=aici4oO+5NmwgNLVpuIKAMKYc33t7DP4RmyIonGxx7RpiTRlkKU9fw+16j1TZ93wVHGrQ8Hsoppu5Mq0BrWX1QpG8QVuXtldChWFNDeEKTydJ20NQ34UAuvms3KOKgXqEe5j7+w14MtxSfeFhlPmEB5T1ZH/6fCNxAn5XaUkUaI= 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 1722762163051405.74527864225047; Sun, 4 Aug 2024 02:02:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX7n-0000b0-Vy; Sun, 04 Aug 2024 05:02:00 -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 1saX7n-0000XA-2i for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:01:59 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX7l-0001A1-EW for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:01:58 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1fc56fd4de1so33046235ad.0 for ; Sun, 04 Aug 2024 02:01:57 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff58f19f0asm46257095ad.6.2024.08.04.02.01.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762116; x=1723366916; 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=h49lGewxT9hFA+tlJrf36flRr26IrZVQVpZMqnu2U/A=; b=DFGTpe5FkK5NSoLKnyGB3CDrJ8XKRYFODYkfxVgbxw1gyrsgp/qRaLaDr5/Ac14+3N 98bmQBWRIJ3QAvnzDoZFhl0F1sB0AhoHjb6BDRYBPT19Ndv5Dn0kDBCFJtdIOTSzTQ+s cC+zT3sSGWg7c3SDSbA/LjoSCi8l+QV8ZhjRkEfew0glq5UAyhykLxT90inK4H2ekqjG lRU2ubHlZTb0HfZ3CjE2YhBoYxnWjBf7F4gsVb53HW1Bzu6yLtpOQyboUOzkFOjckxUb u/7Ginb/z5Vv3Su2Bcs/xW6LqlzC+nnVgD93N0DjxwfN1Mo0RQ8FgSxbJN+Wxnj+kg4D pJcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762116; x=1723366916; 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=h49lGewxT9hFA+tlJrf36flRr26IrZVQVpZMqnu2U/A=; b=M54M3wvijbe/gTV9Xihkk4B0jWcqcPRCLN40l9jSntqKuws/g9m8lyJRvdfBXggHVc pMggaSIHTCwTWoSpPNnQzsG2NVPsUThTjW9CrpwBOwtCQqJMhzGa/v+5NCfgeBSCaRBE 8wursFERAZ+l0ivZNHR+hJuMVYkjnSUXdPwSC9KUeMHen7iGJySBFWtqyTIHHyGOWd9o AAimPFzgjvTBIs56A6uQT+mSMhq/zcMSlgAqxAeJhd9oQ4AWHbEcXzBoF1sZoW7mbVcE do56hwW+4IttVC6v8OoswW7FUZeRrBoAQrqFrZvOgaatbohQhpslzEH1Et5XWgSZFAZX T5OA== X-Gm-Message-State: AOJu0YxebgPHWbKL0drSizq22aqKGH2KydCWPvmdSo8gmWQa+OmBXWpy eDKH0wtgXXUTsOiASbIG8JbXh3VKQsC4tNECuFBb8N7Q2ds7EDQ69J1rGWb6VT0= X-Google-Smtp-Source: AGHT+IH6hvACC0/67UXXIMR8Dw71AM1UrQVeCxJ8kTmPPYgkbvYXlf0nAAGLQnFgQQc4gqpJWplcZA== X-Received: by 2002:a17:902:c947:b0:1fa:97ec:3a4 with SMTP id d9443c01a7336-1ff57b81828mr150036305ad.8.1722762116065; Sun, 04 Aug 2024 02:01:56 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:38 +0900 Subject: [PATCH for-9.2 v12 02/11] hw/ppc/spapr_pci: Do not create DT for disabled PCI device MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-2-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::62f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62f.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: 1722762164162116600 Disabled means it is a disabled SR-IOV VF or it is powered off, and hidden from the guest. Signed-off-by: Akihiko Odaki --- hw/ppc/spapr_pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 7cf9904c3546..f63182a03c41 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1296,6 +1296,10 @@ static void spapr_dt_pci_device_cb(PCIBus *bus, PCID= evice *pdev, return; } =20 + if (!pdev->enabled) { + return; + } + err =3D spapr_dt_pci_device(p->sphb, pdev, p->fdt, p->offset); if (err < 0) { p->err =3D err; --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762275; cv=none; d=zohomail.com; s=zohoarc; b=GO4w0Sj9UIAXH6UaQMm7KrUYtp6ZXYF5WS0SbUZ7ewPOQNyFxa/vrghepDzBiXdAkGVIKWcBEQBt3C6SV/JjswH0+cD5afP/KvuvpOycsoCciKlX1gic1snmffMqaqcnh1gmlajbrQ58Me8RdyFsRpqO2/PPh27FS6bt2aNzhhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762275; 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=LvYGkO0/34C91V8NXfef8guAibLAhiHYP0GgJQZDQZY=; b=MjwnCVF/im3SI7E1pT28wziqa+CIln1/ZiV1TMM4XaF2FXXc+IPsRMTSbzpDU3MYEmi7Q6qTKhByI5ujE2W2WLk2RNnt4uCi3S/fi1IqsRpHZMEf1SfyAt10nIvSioNtgt/Im+ghtBt28I1zEe28YFbjQdtb1JlH3JOEfEDlaX8= 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 1722762275268743.7292133640797; Sun, 4 Aug 2024 02:04:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX7u-0000r0-J8; Sun, 04 Aug 2024 05:02:06 -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 1saX7t-0000nd-0e for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:05 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX7q-0001AW-8n for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:04 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so5774911a12.3 for ; Sun, 04 Aug 2024 02:02:01 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2cfdc4064cesm8060563a91.12.2024.08.04.02.01.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762121; x=1723366921; 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=LvYGkO0/34C91V8NXfef8guAibLAhiHYP0GgJQZDQZY=; b=se1PRngWzVhYpXsmyJvXcmD1zB/CfAS+yeZv5bDF8lgGMKoXwVXVij4NwY2Eg+JYrr dgekPOQdWX+PlNYldzQb34so0Pj/Zog9GKI21O5ZpW48N0uYBAKm7NKWCwIVctKnuKEJ 4VcIr8kbDo3/6ZxlAnHpUFTfIvHxdD+8WN8gGqm1f8FobjtLypTFwFi3J+BTUJ8iuMKS JrIyeIt9tGNXZaVYbNg6u++Ad8dVaR95p85btL2u5iF0fUBRLA67YWojiorwIcSP/oYp QCu0gewX+VagKwUB7FLP1VNNRl4zwnxGr9CguGNT6x61QUYaMjo+Cp+FU9eaaa8WDzjC 5B9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762121; x=1723366921; 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=LvYGkO0/34C91V8NXfef8guAibLAhiHYP0GgJQZDQZY=; b=HSdnFgRGqT4dzZjVfUh15R7gT43kNWYwyKBneGJtWRf4UsvJzTNrcytJLMYvFtMx4o TDvyIjXlFYSRxvw1NTz5kcB0BRmKJhh0RdB0BvTLosunU9JF0+7Og6GNOAqq8yK7k1yt Hl/cl28IuE7yBt2rfAYj0ltT8V4AOknjBbvUkHdw9O3gGa2TlXiUPejP+6DCerOPf/2S P2dEJCPTTGuF1XfeHBJMSSUZ2jHI/uCA9BZR5l46v0MejHH59oFnU5XVinmgIod8Nxl7 2mDTK/GzKndymSYglNMg6iKPKqiRifCmsSQrqb9GkE/yIsfum5P6O/DSQgvMd2HegvXd pRIA== X-Gm-Message-State: AOJu0YwvN+TXt5yG4wcPc/qnMt2Q4Pz+NFJqaMI7R7g8gFfiDvEINZUI HS5TTXR9E55/mYV25HN6nChT2qvjL3J0sG07NK9mjcdtMv7k7/3JD9d1ZZrTOhg= X-Google-Smtp-Source: AGHT+IEZB+jzw+fwTdgCj9vPKQldLsIQaA22mri47vxU2RsO2iDG8ZA9d16FmgHw2gIY1OmMQ8gm4A== X-Received: by 2002:a17:90b:4c0e:b0:2c9:6ccc:2fbb with SMTP id 98e67ed59e1d1-2cff946945bmr10804829a91.24.1722762120774; Sun, 04 Aug 2024 02:02:00 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:39 +0900 Subject: [PATCH for-9.2 v12 03/11] hw/ppc/spapr_pci: Do not reject VFs created after a PF MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-3-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::532; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x532.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: 1722762276223116600 A PF may automatically create VFs and the PF may be function 0. Signed-off-by: Akihiko Odaki --- hw/ppc/spapr_pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f63182a03c41..ed4454bbf79e 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1573,7 +1573,9 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_h= andler, * hotplug, we do not allow functions to be hotplugged to a * slot that already has function 0 present */ - if (plugged_dev->hotplugged && bus->devices[PCI_DEVFN(slotnr, 0)] && + if (plugged_dev->hotplugged && + !pci_is_vf(pdev) && + bus->devices[PCI_DEVFN(slotnr, 0)] && PCI_FUNC(pdev->devfn) !=3D 0) { error_setg(errp, "PCI: slot %d function 0 already occupied by %s," " additional functions can no longer be exposed to gues= t.", --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762164; cv=none; d=zohomail.com; s=zohoarc; b=AJdGii+LWdgJbI94XGkS59Kezi0LXlagP27dBNRf7LeAgKijxuFYx8fKOXVcRTFUqE7KjlHS+jfMQlsEbF6tlrTMqV9gH2S/C0UtJVwCrLuHKbLRiY61WwL7SGKyhvkWUoCPfVWbNEtiSgd0s+vhmz6TQVsxfrBTaqhep3nJeN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762164; 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=Ja+2Rln8Aybt08irPb0En7wqcDpJy8xF+oHU5uY2BGc=; b=mFjBJlPTN0BhDJa1TTLNU5v14zJ8sxisNjmhRdNzkoiE3RhehCW8+RQ8OviR6b462mZJd5louDxUxTXqTtBkVI0ik2SkYLQdpxh7DBIKT0YaIPoOOqvsLzGvo+OQXzLAzObQkp3rYk0y9X4l0W0N5HIqSlF/6bAdflvV7aPr+VQ= 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 172276216412845.92582735759618; Sun, 4 Aug 2024 02:02:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX7z-00018E-Jg; Sun, 04 Aug 2024 05:02:11 -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 1saX7x-00010H-3y for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:09 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX7u-0001Az-PK for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:08 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1fc65329979so84616255ad.0 for ; Sun, 04 Aug 2024 02:02:06 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff592ad9e4sm45835915ad.283.2024.08.04.02.02.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762125; x=1723366925; 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=Ja+2Rln8Aybt08irPb0En7wqcDpJy8xF+oHU5uY2BGc=; b=mwnVcHv1piEulKNnOb6g8Vif/hR84twR+Qvmx02bXvlSUP+DhRcYwXGAaDZFfRObiz 1i8WLAHsePFQttc14B3lQWr3IgmCERSqVfvB3Uz6YjnzO1pvHz+1wi0oeqp9ZLfUwjFw jdv/CLlZIb4W3svwlc3Ob5Uf+K2NuiWsiQ/rm9HbW114/uSvBjxTQjH2/mlE/08qC0FE 3u8V38UHMneINdc96pAVNn8Tusm72l9NMvp1RKL4Esb6XU4BJUqLOk8Xee4nWpX+WWFY hyMf9Dar4G4Ju14uCdBJOFphn5EcuaDJBFlj6wWMum0wDWvMBz1DMHKLa1KvCkbVs9Rr 1/gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762125; x=1723366925; 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=Ja+2Rln8Aybt08irPb0En7wqcDpJy8xF+oHU5uY2BGc=; b=s5eZJ1oFqbECFrbcqtnHJGsa7KANr9ZTppQelbNosH2nQo1Cu7BjfWkZraSwaCBx48 RvjgeQOCJJjPkFhwZKvG2UVVcVtI56ysDkzaD19x1G7T8nhh1il68/tzSimVj317NttS pIiNcZi+U7xn7hrtynasCZ53TMbMGlc3mhMtnl+T5VImGoJ5NvCcQi61RH+zyhCk+BiJ dKmll4tdC44E8tV7P8Z9OPxfbFXyWXvsnBWIUVken56HMAeybEMxjPNNsvZcuRzm9U82 QEClv0MpGdSAPxcf47iayZBPdBD20sPFP9w7aAmCJmBFOB9CTbYfC/Fc0UUZChEkqZu1 RHlw== X-Gm-Message-State: AOJu0Yxb9u+rnSO+5sXi9sbW+RSmPYwBF5k5u4KoVdveoXKeNZEDu9/4 IWLC0HINepWETTqC9ImmXfWJ9Br6GhQhTtObC5+lkVeH5hQCXPi7W8TSX/EQd3U= X-Google-Smtp-Source: AGHT+IFJ9CgM3hQ8Bm7gybl6ynWwssF8aCIxuoXc5/GUxUQcK9RHFDhWLhY3cLGkMAw/6C0SfvQrGQ== X-Received: by 2002:a17:903:22c6:b0:1fa:b7ea:9f0f with SMTP id d9443c01a7336-1ff5722de89mr121114095ad.7.1722762125408; Sun, 04 Aug 2024 02:02:05 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:40 +0900 Subject: [PATCH for-9.2 v12 04/11] pcie_sriov: Do not manually unrealize MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-4-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::631; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x631.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: 1722762165803116600 A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d713..499becd5273f 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -204,11 +204,7 @@ static void unregister_vfs(PCIDevice *dev) trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i =3D 0; i < num_vfs; i++) { - Error *err =3D NULL; PCIDevice *vf =3D dev->exp.sriov_pf.vf[i]; - if (!object_property_set_bool(OBJECT(vf), "realized", false, &err)= ) { - error_reportf_err(err, "Failed to unplug: "); - } object_unparent(OBJECT(vf)); object_unref(OBJECT(vf)); } --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762166; cv=none; d=zohomail.com; s=zohoarc; b=RrKQ8rT6qvbhkmFKNiGo1N1BFJyl4CGXictbbhLUMuRenX3OIIrxbQVg6qY94COCJKTTZGjBlnFoOslVpMUg8Ie8B7pNonK0Q1FzCrJADLAJ4jVKLxkxsquQ+hr0DXSkO7088F5g8OlxSe6qs+Q3xPwf3Rk5p9Vld0llKpaCF2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762166; 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=jSFqxrJ6ZrVEUioZYkidDSjHzn1N+FgpqRFAmRsnAyg=; b=ETeXgOuTC3ABOb3bc+Un1E0DVDNcXlNxsr4mq2LKBnxO2VVvTPl/0u5z6yWw+CMBSEhaNiCVnaxZekWZu2aupsPKwMXmDkX3Wsw1RDK0sLbcwMb8B2qMBdwdyJ8SgZE2Bkj+FJXmdDcVO4ke9m66pNTkapdj4OjdwtPo7bRRX2o= 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 1722762166215154.59791261994133; Sun, 4 Aug 2024 02:02:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8F-0001LD-8t; Sun, 04 Aug 2024 05:02:27 -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 1saX82-0001HL-AW for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:15 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX7z-0001BW-Pl for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:14 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7106cf5771bso2141149b3a.2 for ; Sun, 04 Aug 2024 02:02:11 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff5927f40dsm45999995ad.229.2024.08.04.02.02.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762130; x=1723366930; 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=jSFqxrJ6ZrVEUioZYkidDSjHzn1N+FgpqRFAmRsnAyg=; b=Joh1+cZWD5/Y6ZCKcKgVAZoNZ8MPUtmcyhgds9nKhjs+x0rcHLxAx9b9s1u744Ge6U fjM5XQQ4sU1jtPFUtSbiForwPUitKv9reuEYonA5pjPCOF8cqk74Ctaj6jOsMALqWjw7 N4NF6odX9rJi1c3eGJsdhjewDpR/S2+eC1UIZC5Z7NTUx5M2PHQu+R+gi3wgYfct1Z8q n0eRFYWPYQIHA+c3JsMgMgREhTfkMM9c29r5bf0sMQBk7vhB6AmlzM5jhd2kRu8i1FKY wakTpxNUJJYFrShXlp0pD69C2kvZjRPDde6y69Us7HUPEMO36JoCuJLL2y2lmAMtUwwr psoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762130; x=1723366930; 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=jSFqxrJ6ZrVEUioZYkidDSjHzn1N+FgpqRFAmRsnAyg=; b=nRbHsCXtyCaeytKLVhfK/yONnco0Q+KrTDnHLqSK83OsYg+fHgqAXYSfi0+C+E/u6m xQ+GLRjAQfUvA/3i7RmKp0/uzBfnUdNdMydPjwAVasvUJ6G4JZt817aG/1p+Wg2FHJSN 9VIwAkdKIeHw1GNGlT+H1ZNen5eurlmdfdXAW5yONVG/p30rGTvIAOcwG8hSg/loZ5ay 07DlnbvzZUIqNT8+wtLfrW8HVKwlx3Jc6UjNH1XbhqfHA1tMEA0BBCUWSjmINHT9vI5e UU6yneLG7H6mnO8onMuJQ7EYtwnFbe30IbLT2dqZBKbGbYr8s3zX3bpP0NQ5/Ml0nqlB ziqg== X-Gm-Message-State: AOJu0YxxwIjoNQ1lKw0SoMXF6OmjTUJZ1yhQAOfQRb+ABX6ItXQB2U4s TdZ6UTWlYrENvcUKMcLKk34Bj99TKK/Z6Q/155K6ZdLbnwxzYDfkGt+yWgvLYAI= X-Google-Smtp-Source: AGHT+IHphh4eLVzK4SItirRvhsRqvgnTYB4YqMgNI56ILLHymB4LMbAZkGU+DEIY0HdI+LJytuNJcQ== X-Received: by 2002:a17:902:db11:b0:1fd:d807:b29e with SMTP id d9443c01a7336-1ff5730a2e8mr94041515ad.35.1722762130284; Sun, 04 Aug 2024 02:02:10 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:41 +0900 Subject: [PATCH for-9.2 v12 05/11] pcie_sriov: Ensure VF function number does not overflow MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-5-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::42c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42c.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: 1722762167835116600 pci_new() aborts when creating a VF with a function number equals to or is greater than PCI_DEVFN_MAX. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8 +++++--- include/hw/pci/pcie_sriov.h | 5 +++-- hw/net/igb.c | 13 ++++++++++--- hw/nvme/ctrl.c | 24 ++++++++++++++++-------- hw/pci/pcie_sriov.c | 19 +++++++++++++++++-- 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt index a47aad0bfab0..ab2142807f79 100644 --- a/docs/pcie_sriov.txt +++ b/docs/pcie_sriov.txt @@ -52,9 +52,11 @@ setting up a BAR for a VF. ... =20 /* Add and initialize the SR/IOV capability */ - pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", - vf_devid, initial_vfs, total_vfs, - fun_offset, stride); + if (!pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", + vf_devid, initial_vfs, total_vfs, + fun_offset, stride, errp)) { + return; + } =20 /* Set up individual VF BARs (parameters as for normal BARs) */ pcie_sriov_pf_init_vf_bar( ... ) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 450cbef6c201..aa704e8f9d9f 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -27,10 +27,11 @@ typedef struct PCIESriovVF { uint16_t vf_number; /* Logical VF number of this function */ } PCIESriovVF; =20 -void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, uint16_t init_vfs, uint16_t total_vfs, - uint16_t vf_offset, uint16_t vf_stride); + uint16_t vf_offset, uint16_t vf_stride, + Error **errp); void pcie_sriov_pf_exit(PCIDevice *dev); =20 /* Set up a VF bar in the SR/IOV bar area */ diff --git a/hw/net/igb.c b/hw/net/igb.c index b92bba402e0d..b6ca2f1b8aee 100644 --- a/hw/net/igb.c +++ b/hw/net/igb.c @@ -446,9 +446,16 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error = **errp) =20 pcie_ari_init(pci_dev, 0x150); =20 - pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, TYPE_IGBVF, - IGB_82576_VF_DEV_ID, IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, - IGB_VF_OFFSET, IGB_VF_STRIDE); + if (!pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, + TYPE_IGBVF, IGB_82576_VF_DEV_ID, + IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, + IGB_VF_OFFSET, IGB_VF_STRIDE, + errp)) { + pcie_cap_exit(pci_dev); + igb_cleanup_msix(s); + msi_uninit(pci_dev); + return; + } =20 pcie_sriov_pf_init_vf_bar(pci_dev, IGBVF_MMIO_BAR_IDX, PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index c6d4f61a47f9..e86ea2e7ce57 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8271,7 +8271,8 @@ out: return pow2ceil(bar_size); } =20 -static void nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offs= et) +static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offs= et, + Error **errp) { uint16_t vf_dev_id =3D n->params.use_intel_id ? PCI_DEVICE_ID_INTEL_NVME : PCI_DEVICE_ID_REDHAT_N= VME; @@ -8280,12 +8281,17 @@ static void nvme_init_sriov(NvmeCtrl *n, PCIDevice = *pci_dev, uint16_t offset) le16_to_cpu(cap->vifrsm), NULL, NULL); =20 - pcie_sriov_pf_init(pci_dev, offset, "nvme", vf_dev_id, - n->params.sriov_max_vfs, n->params.sriov_max_vfs, - NVME_VF_OFFSET, NVME_VF_STRIDE); + if (!pcie_sriov_pf_init(pci_dev, offset, "nvme", vf_dev_id, + n->params.sriov_max_vfs, n->params.sriov_max_v= fs, + NVME_VF_OFFSET, NVME_VF_STRIDE, + errp)) { + return false; + } =20 pcie_sriov_pf_init_vf_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, bar_size); + + return true; } =20 static int nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset) @@ -8410,6 +8416,12 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pc= i_dev, Error **errp) return false; } =20 + if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs && + !nvme_init_sriov(n, pci_dev, 0x120, errp)) { + msix_uninit(pci_dev, &n->bar0, &n->bar0); + return false; + } + nvme_update_msixcap_ts(pci_dev, n->conf_msix_qsize); =20 pcie_cap_deverr_init(pci_dev); @@ -8439,10 +8451,6 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pc= i_dev, Error **errp) nvme_init_pmr(n, pci_dev); } =20 - if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs) { - nvme_init_sriov(n, pci_dev, 0x120); - } - return true; } =20 diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 499becd5273f..f0bde0d3fc79 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -24,14 +24,27 @@ static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, uint16_t vf_num); static void unregister_vfs(PCIDevice *dev); =20 -void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, uint16_t init_vfs, uint16_t total_vfs, - uint16_t vf_offset, uint16_t vf_stride) + uint16_t vf_offset, uint16_t vf_stride, + Error **errp) { uint8_t *cfg =3D dev->config + offset; uint8_t *wmask; =20 + if (total_vfs) { + uint16_t ari_cap =3D pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); + uint16_t first_vf_devfn =3D dev->devfn + vf_offset; + uint16_t last_vf_devfn =3D first_vf_devfn + vf_stride * (total_vfs= - 1); + + if ((!ari_cap && PCI_SLOT(dev->devfn) !=3D PCI_SLOT(last_vf_devfn)= ) || + last_vf_devfn >=3D PCI_DEVFN_MAX) { + error_setg(errp, "VF function number overflows"); + return false; + } + } + pcie_add_capability(dev, PCI_EXT_CAP_ID_SRIOV, 1, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap =3D offset; @@ -69,6 +82,8 @@ void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, pci_set_word(wmask + PCI_SRIOV_SYS_PGSIZE, 0x553); =20 qdev_prop_set_bit(&dev->qdev, "multifunction", true); + + return true; } =20 void pcie_sriov_pf_exit(PCIDevice *dev) --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762211; cv=none; d=zohomail.com; s=zohoarc; b=SziYrRfUEZrlo2T0ZgQvMvkE84zZJr/wqsy+o8bp6OoMHXcwgceYEFiBGgFSErZgVY2mZ5wyvpDJgajdUZ9Hfs1IM7sb9r9SraVaCMkz04tqf0g8fK22+9IrrLVUpSSBPNAXoc6ggmMZz/mHFml6HoOOu1qRt8OCqT3XSXI+FF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762211; 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=652Y8SFJE8RzVcm9zxKWZeyRoZ2qrpQB0WcZowAyd0Q=; b=kLHpqmzboxnxJjZjY2Ve3W2W7ikNW5cvHqwmJjYiYBoBfykmPEv0o7+2CpNnFpOs5h2gkL9lpgYuGvR+Re4nQBhfMC2DYPL8Kywk6DonPIRKYlinzzebDQPGFlwN2ZCsNSsDOpdo1iZIuWv9OCh22p/8IAfdMvyrGMIt61urpTE= 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 1722762211386258.13187678845134; Sun, 4 Aug 2024 02:03:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8L-0001Xm-C7; Sun, 04 Aug 2024 05:02:33 -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 1saX87-0001Jn-NC for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:19 -0400 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX84-0001CM-HA for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:18 -0400 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5d5ed6f51cfso4473214eaf.0 for ; Sun, 04 Aug 2024 02:02:16 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2cffb36eac6sm4672847a91.39.2024.08.04.02.02.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762135; x=1723366935; 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=652Y8SFJE8RzVcm9zxKWZeyRoZ2qrpQB0WcZowAyd0Q=; b=1/+3ifU9B+utmUkX149p8U+silG2BEcDNStqZHGK/3IJA+gmIha4I4BzCUwxto9mlQ j9oNeggsb8L0Z0lZ11KCzLd4IB/pYMuCpHx4YLRQzv++hVAHPsRvrCihWYLIpPzMqVyQ vr8J9w+LHXY3+shxNNXuX4wxCv0MJwdJMJaYKOxG208nEb4raBssdBiQC84qQhHXws09 Ark5DlFqsIafb/nKRKMwjq3U7d1Gbkhecjawe8BI0T/qnobgotEsOFemUi9H1xh5uT07 T+eoamobZbj6MA0QoXT2jcwTUF/y0JeHtT4kW+AC67gvGcNyCxtDiVpWi+SfqzgnzFha OHHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762135; x=1723366935; 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=652Y8SFJE8RzVcm9zxKWZeyRoZ2qrpQB0WcZowAyd0Q=; b=SeurFZ3yj350EGj4BJ+Vd7D0GzA8eUjElBXyrUzEG73ando2eauYW1LneEc1f40ho5 0Yl4ZlVSmD4Jt38JLPsOIcVYb4mSb0/pMiWWD+23d/NYWBIpgfjFPYpZql6oCEcS2XF0 oxhuzDTiJ77i+74xQK/cX0EDMCiTZ9+iKkcxbDFuDu8vuEM+SUXvLHX0AubgJbXNGJMD jNmwMVcMKtVoID5oaAeUa4o2JUhyg1S5joh9Q+zBN1vJWhHe+SDBTO5Z54gtEy5Q0Wbp DPAaXHllGyzzj5nfdcgyo/AUDRF837Kae7BV+sPUxzvLUXw7/+i6mHTtcwjOsr8LgG5G Mf5Q== X-Gm-Message-State: AOJu0YyVfyokWGfAi58PRmQkRxzAA20wI7iF33sXMi0Hs9XpfwoHLO07 BicTHQ5saGr8HRixNMFV0xJssXMa071hgix19XOflV2icdmz5uIId0SipbhV7/A= X-Google-Smtp-Source: AGHT+IHJ4yld91bW0LLKT4TUGcLRhvwXw8TbaTqZ24OFNP/x+1jgwjkqRfEQ3WC4pYvkKOQM1ZNiqA== X-Received: by 2002:a05:6830:6e05:b0:703:63d3:9ef7 with SMTP id 46e09a7af769-709b322e163mr16186794a34.14.1722762135032; Sun, 04 Aug 2024 02:02:15 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:42 +0900 Subject: [PATCH for-9.2 v12 06/11] pcie_sriov: Reuse SR-IOV VF device instances MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-6-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::c30; envelope-from=akihiko.odaki@daynix.com; helo=mail-oo1-xc30.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: 1722762212344116600 Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h | 5 --- include/hw/pci/pci_device.h | 15 +++++++ include/hw/pci/pcie_sriov.h | 1 - hw/pci/pci.c | 2 +- hw/pci/pcie_sriov.c | 95 +++++++++++++++++++----------------------= ---- 5 files changed, 56 insertions(+), 62 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index fe04b4fafd04..14a869eeaa71 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -680,9 +680,4 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev) MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); void pci_set_enabled(PCIDevice *pci_dev, bool state); =20 -static inline void pci_set_power(PCIDevice *pci_dev, bool state) -{ - pci_set_enabled(pci_dev, state); -} - #endif diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index f38fb3111954..1ff3ce94e25b 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -212,6 +212,21 @@ static inline uint16_t pci_get_bdf(PCIDevice *dev) return PCI_BUILD_BDF(pci_bus_num(pci_get_bus(dev)), dev->devfn); } =20 +static inline void pci_set_power(PCIDevice *pci_dev, bool state) +{ + /* + * Don't change the enabled state of VFs when powering on/off the devi= ce. + * + * When powering on, VFs must not be enabled immediately but they must + * wait until the guest configures SR-IOV. + * When powering off, their corresponding PFs will be reset and disable + * VFs. + */ + if (!pci_is_vf(pci_dev)) { + pci_set_enabled(pci_dev, state); + } +} + uint16_t pci_requester_id(PCIDevice *dev); =20 /* DMA access functions */ diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index aa704e8f9d9f..70649236c18a 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -18,7 +18,6 @@ typedef struct PCIESriovPF { uint16_t num_vfs; /* Number of virtual functions created */ uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar = */ - const char *vfname; /* Reference to the device type used for the VFs */ PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */ } PCIESriovPF; =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b532888e8f6c..5c0050e1786a 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2895,7 +2895,7 @@ void pci_set_enabled(PCIDevice *d, bool state) memory_region_set_enabled(&d->bus_master_enable_region, (pci_get_word(d->config + PCI_COMMAND) & PCI_COMMAND_MASTER) && d->enabled); - if (!d->enabled) { + if (d->qdev.realized) { pci_device_reset(d); } } diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index f0bde0d3fc79..faadb0d2ea85 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -20,9 +20,16 @@ #include "qapi/error.h" #include "trace.h" =20 -static PCIDevice *register_vf(PCIDevice *pf, int devfn, - const char *name, uint16_t vf_num); -static void unregister_vfs(PCIDevice *dev); +static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) +{ + for (uint16_t i =3D 0; i < total_vfs; i++) { + PCIDevice *vf =3D dev->exp.sriov_pf.vf[i]; + object_unparent(OBJECT(vf)); + object_unref(OBJECT(vf)); + } + g_free(dev->exp.sriov_pf.vf); + dev->exp.sriov_pf.vf =3D NULL; +} =20 bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, @@ -30,6 +37,8 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, uint16_t vf_offset, uint16_t vf_stride, Error **errp) { + BusState *bus =3D qdev_get_parent_bus(&dev->qdev); + int32_t devfn =3D dev->devfn + vf_offset; uint8_t *cfg =3D dev->config + offset; uint8_t *wmask; =20 @@ -49,7 +58,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap =3D offset; dev->exp.sriov_pf.num_vfs =3D 0; - dev->exp.sriov_pf.vfname =3D g_strdup(vfname); dev->exp.sriov_pf.vf =3D NULL; =20 pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -83,14 +91,34 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, =20 qdev_prop_set_bit(&dev->qdev, "multifunction", true); =20 + dev->exp.sriov_pf.vf =3D g_new(PCIDevice *, total_vfs); + + for (uint16_t i =3D 0; i < total_vfs; i++) { + PCIDevice *vf =3D pci_new(devfn, vfname); + vf->exp.sriov_vf.pf =3D dev; + vf->exp.sriov_vf.vf_number =3D i; + + if (!qdev_realize(&vf->qdev, bus, errp)) { + unparent_vfs(dev, i); + return false; + } + + /* set vid/did according to sr/iov spec - they are not used */ + pci_config_set_vendor_id(vf->config, 0xffff); + pci_config_set_device_id(vf->config, 0xffff); + + dev->exp.sriov_pf.vf[i] =3D vf; + devfn +=3D vf_stride; + } + return true; } =20 void pcie_sriov_pf_exit(PCIDevice *dev) { - unregister_vfs(dev); - g_free((char *)dev->exp.sriov_pf.vfname); - dev->exp.sriov_pf.vfname =3D NULL; + uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; + + unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)); } =20 void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, @@ -156,38 +184,11 @@ void pcie_sriov_vf_register_bar(PCIDevice *dev, int r= egion_num, } } =20 -static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, - uint16_t vf_num) -{ - PCIDevice *dev =3D pci_new(devfn, name); - dev->exp.sriov_vf.pf =3D pf; - dev->exp.sriov_vf.vf_number =3D vf_num; - PCIBus *bus =3D pci_get_bus(pf); - Error *local_err =3D NULL; - - qdev_realize(&dev->qdev, &bus->qbus, &local_err); - if (local_err) { - error_report_err(local_err); - return NULL; - } - - /* set vid/did according to sr/iov spec - they are not used */ - pci_config_set_vendor_id(dev->config, 0xffff); - pci_config_set_device_id(dev->config, 0xffff); - - return dev; -} - static void register_vfs(PCIDevice *dev) { uint16_t num_vfs; uint16_t i; uint16_t sriov_cap =3D dev->exp.sriov_cap; - uint16_t vf_offset =3D - pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_OFFSET); - uint16_t vf_stride =3D - pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_STRIDE); - int32_t devfn =3D dev->devfn + vf_offset; =20 assert(sriov_cap > 0); num_vfs =3D pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); @@ -195,18 +196,10 @@ static void register_vfs(PCIDevice *dev) return; } =20 - dev->exp.sriov_pf.vf =3D g_new(PCIDevice *, num_vfs); - trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i =3D 0; i < num_vfs; i++) { - dev->exp.sriov_pf.vf[i] =3D register_vf(dev, devfn, - dev->exp.sriov_pf.vfname, i); - if (!dev->exp.sriov_pf.vf[i]) { - num_vfs =3D i; - break; - } - devfn +=3D vf_stride; + pci_set_enabled(dev->exp.sriov_pf.vf[i], true); } dev->exp.sriov_pf.num_vfs =3D num_vfs; } @@ -219,12 +212,8 @@ static void unregister_vfs(PCIDevice *dev) trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i =3D 0; i < num_vfs; i++) { - PCIDevice *vf =3D dev->exp.sriov_pf.vf[i]; - object_unparent(OBJECT(vf)); - object_unref(OBJECT(vf)); + pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } - g_free(dev->exp.sriov_pf.vf); - dev->exp.sriov_pf.vf =3D NULL; dev->exp.sriov_pf.num_vfs =3D 0; } =20 @@ -246,14 +235,10 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t= address, PCI_FUNC(dev->devfn), off, val, len); =20 if (range_covers_byte(off, len, PCI_SRIOV_CTRL)) { - if (dev->exp.sriov_pf.num_vfs) { - if (!(val & PCI_SRIOV_CTRL_VFE)) { - unregister_vfs(dev); - } + if (val & PCI_SRIOV_CTRL_VFE) { + register_vfs(dev); } else { - if (val & PCI_SRIOV_CTRL_VFE) { - register_vfs(dev); - } + unregister_vfs(dev); } } } --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762272; cv=none; d=zohomail.com; s=zohoarc; b=j2rWs+gziM+lyGoeIJ922cHDrd3L06gkUQN4cAqcjPkh+OrB1kT8EWc/f9mGYCa07+U4+C6OUfmg9jkWLtCRLBqv2+fzUFzYLYOtcycA+nJeFMD1pdi/HVcC3cTsbnHwT59ZfG4u2rC+5nvGWQ/eAUheRlujeAFvAGtenDkspgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762272; 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=4tfsLBSp5P9Enjc3prc0IqWrh95La08LAkdzlIXsS/A=; b=KmkfeVbn64ZhA2RMx6ms63zFY1rfGoCUlEGyOGB4dPrPtPWOhKjhvXQqynBsXPsVoCSNnb6Q0fY8jXloNDxRNwA/+3JHkbT1Ida+b+U5+YVGeRscsZNG920q5yctFmsAETJwtLonB1XPgqORXHz7fOP0/UzkztOT45ziXtGCZRY= 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 1722762272569568.263930300068; Sun, 4 Aug 2024 02:04:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8M-0001d6-MF; Sun, 04 Aug 2024 05:02:34 -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 1saX8B-0001Ne-BR for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:27 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX89-0001Cg-NG for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:22 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-7ab34117cc2so6270833a12.0 for ; Sun, 04 Aug 2024 02:02:20 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2cfca2a8330sm4525031a91.0.2024.08.04.02.02.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762140; x=1723366940; 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=4tfsLBSp5P9Enjc3prc0IqWrh95La08LAkdzlIXsS/A=; b=SIdCVoD4T0C3Z3WnwPWzxzTokka/VMmqMXCcjPq623o5Vzk8dRzzSYwkjmRfz5QZGe IsY4K+FFGwEpTbgDcDsibHdGR9B3n5VjDzNiZRwn65D3YY7F+LrFOSbiWqJkPnbm71W9 8fR813/mGyjFUmfzJ8j/iZENq0AFmW4WWTBnas4SQlxdM7npkwkD6tlUUdtc1RHDXdMQ z1QWRIsQjsmNvylgFz5K5sOGKi9kvFL5r27bc/jsTgP4OzK9syRSCj2462MSZwM+sWqh e9J3SkGIbJI3nKFCBdNiYmg6K4U8G7QgtyvZY1xwCUxvUvS6Ekn5TCbLDaFOSCmDhz9j D1uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762140; x=1723366940; 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=4tfsLBSp5P9Enjc3prc0IqWrh95La08LAkdzlIXsS/A=; b=mX8KOiUvwFFUapgxEaPcbf7JLWwvzgKFBu5kWzppMiZITpcivYyEJXs7behLkN9WRe jQj6TscsiOO1SdFNDJeQ2z+/WkqG6ZzkBg0Ot6KqLALlROsF3IlYdKUZ8VbE19Z0Etu/ niymtP/vPLz3C6MB/3vRuK3+8QicCQEdYLT+pkVheK/tzClTSd1zJX0ZkP7Q7kdJ4pll GdHi2k93IuPmIQuhbp/eKi+xokjks0MMBgmV8hpVZ3RzyB0T+gN7Tk0z5xTJoYdGI59j d5gDf/gzZdjSisQ4W/P9Um8wDAo2EzwsctIa6stTErGM7gzLZfqZFPfgGMn58QVVAUpq Xokw== X-Gm-Message-State: AOJu0Yw2RoHQ7gl6YHeSkH8FLwudjqpH2ITdwzICXPgOd5zW//9RuGEj 8BeQL9lrG2LRELAO3/R96EwV0msQh02T2L5/YStuckQyEnRjbPWSBHd5ssc3iJM= X-Google-Smtp-Source: AGHT+IG27Fp4WR8hpKUwyCNT3d2754w+qcOovL4tQ6FOiPucwI8PpeN/WObFFL9a+eRY5eZoTm6zIw== X-Received: by 2002:a17:90a:db12:b0:2c9:65df:f871 with SMTP id 98e67ed59e1d1-2cff9430e17mr9434670a91.15.1722762139908; Sun, 04 Aug 2024 02:02:19 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:43 +0900 Subject: [PATCH for-9.2 v12 07/11] pcie_sriov: Release VFs failed to realize MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-7-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::52f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52f.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: 1722762274453116600 Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization = (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index faadb0d2ea85..9bd7f8acc3f4 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -99,6 +99,8 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, vf->exp.sriov_vf.vf_number =3D i; =20 if (!qdev_realize(&vf->qdev, bus, errp)) { + object_unparent(OBJECT(vf)); + object_unref(vf); unparent_vfs(dev, i); return false; } --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762244; cv=none; d=zohomail.com; s=zohoarc; b=j/k32tg4jn80q/MmfHXWbiC9fEvzBYTFs0oPWRFhO/mC0Vc0kSRSa4Ws/Uw3R4uQO2jJzMx0YQ14WEavmgT1c5g5x0s1gUSeFgmGvbJXFPuXNLfwfSW4/d0UM5lQScibMBJR+UHeXS3eck0336sidl1c1Kms0a/gWMvMJfkE3aQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762244; 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=kAQHWcA1moNmn1CRikPYEp0/XnxLUG4mHd1R0B97aos=; b=L5LKOWN8nq5sX8N+IXNMdNE8WSFjN3YNmFBfj8UXyOI86ix+mNYS0/ckOpdwnO7RveiBRIfp+Mo9tiMXvQdzDF0z+IAmjzYgyVpBnqrbfv3jVSIhpIVbZJXwJGyRR+5KQ7mXmLucOnijh3gpzm3uc8+RVaRiqbWQ9pHC/rarACU= 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 17227622442218.007827956060964; Sun, 4 Aug 2024 02:04:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8N-0001gS-Iz; Sun, 04 Aug 2024 05:02:35 -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 1saX8H-0001Vc-BE for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:32 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX8F-0001DM-9o for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:29 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fc56fd4de1so33047335ad.0 for ; Sun, 04 Aug 2024 02:02:26 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff5917cc1csm46046375ad.216.2024.08.04.02.02.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762145; x=1723366945; 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=kAQHWcA1moNmn1CRikPYEp0/XnxLUG4mHd1R0B97aos=; b=gVFL8bd+qvoTZtXfTM/WnjnoxXhvV3KjjRJH8dGyW3mzLFZHIY7ZbO/z255ZGVjbcI nousOlTsWhAPmPKwj8UHguF80BVvsUYz9R6Ar7Gl9QAtgE69o4IDXGq4wZA7/nJIleUs lAzpz3ToPkU9mS0u28hxLZSlrg0Yvlm2qd0Inbb+KXWP/yBgpbNR4z1wEnoDgT07mfIT zMhtGVsO2o1/tIGTQGeNw8cdSuVeGtSQ2cPiPER/Kpk64+ZThCoOrKDDhGiOyxV5gm6m ZdAbj5L1T1ek+fY6XWoVFN0EprwNLgfaDDu1OlCE5OlXKbhug4+Mlcj3krsaPtGCb3+9 QsGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762145; x=1723366945; 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=kAQHWcA1moNmn1CRikPYEp0/XnxLUG4mHd1R0B97aos=; b=LkNL6h4B04xQSiY4WxK+WsSejxFeBYv5qfIm8Qq9KQ2VxL67UQUHwwN4r1aKUMSIxu TVozrYeZUmTZ8wyax9vc6RhrKjRY5Weil3dKLkUxJtwS48DjMMz1Kq5iYbA40v225kfu Y28nMZWMmhMpAsmUa0/VCepAXeCRysRvaH+EEPBU4mQbQLqe/bmJJlK45k8Sqmkio/6l k49Axp8wu96aPhUHM32wFFrMBlJbe52OoBWfbVFXCPEuiygXpXluegyeFHx0BOD3+3CJ RnKh6QgE9lenKU9TpyFL6QTaiC9X2LmKXFR0pf8kjIjdmyMlal2B2jQmXY2LjxuwwnYL kBDg== X-Gm-Message-State: AOJu0YxBPkeBZEfUmf8+US/bfLvo3Ds7Am0+vu3yxInkum23HzZofU5T Wo9e8v7zjwmg+DgrSz5xuobZ5ezOUgLOvCDz1BjMXhCP0UyNslLeF36dqmWwP8M= X-Google-Smtp-Source: AGHT+IEuV4wreVjXaXXpWZw2H+Wy3L6LbWN1YQcEPdt1Iahlvuur1oMpBs2RXB8U4Q7f9ER/6h5Bbw== X-Received: by 2002:a17:902:f641:b0:1fb:7654:4a40 with SMTP id d9443c01a7336-1ff57bc159bmr144944205ad.14.1722762145531; Sun, 04 Aug 2024 02:02:25 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:44 +0900 Subject: [PATCH for-9.2 v12 08/11] pcie_sriov: Remove num_vfs from PCIESriovPF MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-8-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::62a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62a.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: 1722762246355116600 num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 38 +++++++++++++++++++++++++++----------- hw/pci/trace-events | 2 +- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 70649236c18a..5148c5b77dd1 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -16,7 +16,6 @@ #include "hw/pci/pci.h" =20 typedef struct PCIESriovPF { - uint16_t num_vfs; /* Number of virtual functions created */ uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar = */ PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */ } PCIESriovPF; diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 9bd7f8acc3f4..91b6ed46959d 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -57,7 +57,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, pcie_add_capability(dev, PCI_EXT_CAP_ID_SRIOV, 1, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap =3D offset; - dev->exp.sriov_pf.num_vfs =3D 0; dev->exp.sriov_pf.vf =3D NULL; =20 pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -194,29 +193,28 @@ static void register_vfs(PCIDevice *dev) =20 assert(sriov_cap > 0); num_vfs =3D pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); - if (num_vfs > pci_get_word(dev->config + sriov_cap + PCI_SRIOV_TOTAL_V= F)) { - return; - } =20 trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i =3D 0; i < num_vfs; i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], true); } - dev->exp.sriov_pf.num_vfs =3D num_vfs; + + pci_set_word(dev->wmask + sriov_cap + PCI_SRIOV_NUM_VF, 0); } =20 static void unregister_vfs(PCIDevice *dev) { - uint16_t num_vfs =3D dev->exp.sriov_pf.num_vfs; + uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; uint16_t i; =20 trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn), num_vfs); - for (i =3D 0; i < num_vfs; i++) { + PCI_FUNC(dev->devfn)); + for (i =3D 0; i < pci_get_word(cfg + PCI_SRIOV_TOTAL_VF); i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } - dev->exp.sriov_pf.num_vfs =3D 0; + + pci_set_word(dev->wmask + dev->exp.sriov_cap + PCI_SRIOV_NUM_VF, 0xfff= f); } =20 void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, @@ -242,6 +240,17 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t = address, } else { unregister_vfs(dev); } + } else if (range_covers_byte(off, len, PCI_SRIOV_NUM_VF)) { + uint8_t *cfg =3D dev->config + sriov_cap; + uint8_t *wmask =3D dev->wmask + sriov_cap; + uint16_t num_vfs =3D pci_get_word(cfg + PCI_SRIOV_NUM_VF); + uint16_t val =3D PCI_SRIOV_CTRL_MSE | PCI_SRIOV_CTRL_ARI; + + if (num_vfs <=3D pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)) { + val |=3D PCI_SRIOV_CTRL_VFE; + } + + pci_set_word(wmask + PCI_SRIOV_CTRL, val); } } =20 @@ -258,6 +267,8 @@ void pcie_sriov_pf_reset(PCIDevice *dev) unregister_vfs(dev); =20 pci_set_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF, 0); + pci_set_word(dev->wmask + sriov_cap + PCI_SRIOV_CTRL, + PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE | PCI_SRIOV_CTRL_= ARI); =20 /* * Default is to use 4K pages, software can modify it @@ -304,7 +315,7 @@ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev) PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n) { assert(!pci_is_vf(dev)); - if (n < dev->exp.sriov_pf.num_vfs) { + if (n < pcie_sriov_num_vfs(dev)) { return dev->exp.sriov_pf.vf[n]; } return NULL; @@ -312,5 +323,10 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, = int n) =20 uint16_t pcie_sriov_num_vfs(PCIDevice *dev) { - return dev->exp.sriov_pf.num_vfs; + uint16_t sriov_cap =3D dev->exp.sriov_cap; + uint8_t *cfg =3D dev->config + sriov_cap; + + return sriov_cap && + (pci_get_word(cfg + PCI_SRIOV_CTRL) & PCI_SRIOV_CTRL_VFE) ? + pci_get_word(cfg + PCI_SRIOV_NUM_VF) : 0; } diff --git a/hw/pci/trace-events b/hw/pci/trace-events index 19643aa8c6b0..e98f575a9d19 100644 --- a/hw/pci/trace-events +++ b/hw/pci/trace-events @@ -14,7 +14,7 @@ msix_write_config(char *name, bool enabled, bool masked) = "dev %s enabled %d mask =20 # hw/pci/pcie_sriov.c sriov_register_vfs(const char *name, int slot, int function, int num_vfs) = "%s %02x:%x: creating %d vf devs" -sriov_unregister_vfs(const char *name, int slot, int function, int num_vfs= ) "%s %02x:%x: Unregistering %d vf devs" +sriov_unregister_vfs(const char *name, int slot, int function) "%s %02x:%x= : Unregistering vf devs" sriov_config_write(const char *name, int slot, int fun, uint32_t offset, u= int32_t val, uint32_t len) "%s %02x:%x: sriov offset 0x%x val 0x%x len %d" =20 # pcie.c --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762268; cv=none; d=zohomail.com; s=zohoarc; b=NXb1IcGOaEI3sbuaxuituuioY46u6HQTyApfjZ4QWUzsrEcDViL8d96iivryyaAlVzBVM+DetU9hvN9aP3IIrvAqNxwEysLDOHDEg3j8azN3+Ui4LsOjvB+1tGi+4Se+YIuAc7U+vM+ss4I1jJEvUpspgZc90KRiwOuZj9AXd8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762268; 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=To+Ctud3IiVbBDGeLTlPr7QPErynCEwbUoWpPwlxWjU=; b=KBsPCJoC1Nuk7hNuz/9grow5R10gw/fTs9oLV/R8G/194nv8OZJUisAjGCRHTwzjhbC183WGgYKVzAhE9cHQCNNEMGWQ1KaN67iLyy9dhqnlhIrhfA8Vf6cOHVaXCwqeECZGNHnYzAEKK+IdTwZ0LsEDeVCmwYmW1LdqZSIXhWA= 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 1722762268810813.4799026942727; Sun, 4 Aug 2024 02:04:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8O-0001ja-90; Sun, 04 Aug 2024 05:02:36 -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 1saX8L-0001Z2-KS for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:33 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX8K-0001Dr-2w for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:33 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-7b93883666dso296913a12.1 for ; Sun, 04 Aug 2024 02:02:31 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2cffb36a1c2sm4657896a91.44.2024.08.04.02.02.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762151; x=1723366951; 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=To+Ctud3IiVbBDGeLTlPr7QPErynCEwbUoWpPwlxWjU=; b=X/gVaYwQ+f86hpMTG+AP9cnpkkAPi/ctnXVLzupMB7cqOMICI8ji2hcZoJK1vmiME6 UUNHweuOJjUfCxZpdvYLlS5m17FjvKslAoYAS9bZ8lMWTu41FBMNregzhNa+gN2c657s 8LWtX4ceZ5VRDvwibvswiAtA9xb2tcL139BaZIUePbHdeeDLbxO6xr0FyDoy9rg4tvpA BtRN7B/5i0wCdjxd4G0qDfktnPYPdZnIbdGdYc9XmbPwLO6wutiadng7A3FUMeLydIaB uGY4IwxMPQ8GEd33ak+yEpP9FRoyeexAeiSNAtkKPTh3a1BhveM8dF4TOrw9TbuGykNQ mMmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762151; x=1723366951; 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=To+Ctud3IiVbBDGeLTlPr7QPErynCEwbUoWpPwlxWjU=; b=e8ma9JbpF0vOxjUEEPS9/K+7KzYc9FEmg8B9UX6+QZnauDLFDODV6p83+gUEf0sd5h npnP++tFwtThSkyZWadVH4QXbAy8SByg2o7QM1k8+wlgh1HT4GdhvZ+oO2KJbRzzMqZP UsRgwLIS83om3HSOFZ+Q7vgATJZ9DdO42L8W5x+ljJjz2tR49TSWSI17vi66yo6VrEmn pkCYeq2d5YfWSiDpSg67zMgV2TBpfiO2OUMDeqMTOnKypuv5FOKBnH33zsE6VOsMHVCh WRsScVmI/4pdoXcp1L5n20TumINY134VLkNtSgpUHjnsmYSNpkldNQseRDg3F+/XrfdU eK/g== X-Gm-Message-State: AOJu0YyexKo7o4WmxbLyp4GCjfwPbpwaf1KodSpiaKpbehdRiv8kPcma 3+RxkmNPr5P/uah1j1wR72ABOXtGGzIVtnpk9pnsS8lbAkd9Vd+7SlVH+XlDm2A= X-Google-Smtp-Source: AGHT+IGdk6jbGflR3bABmp+vzCoLrgxkt9H8nToJGshM9tg/Xr5rIyr/JKBFis37r1YqtgcrsdbUpQ== X-Received: by 2002:a17:90b:314a:b0:2c9:a831:3b7d with SMTP id 98e67ed59e1d1-2cff0b261abmr15563122a91.18.1722762150869; Sun, 04 Aug 2024 02:02:30 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:45 +0900 Subject: [PATCH for-9.2 v12 09/11] pcie_sriov: Register VFs after migration MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-9-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::52a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52a.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: 1722762270210116600 pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 2 ++ hw/pci/pci.c | 7 +++++++ hw/pci/pcie_sriov.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 5148c5b77dd1..c5d2d318d330 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -57,6 +57,8 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_= t opt_sup_pgsize); void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, uint32_t val, int len); =20 +void pcie_sriov_pf_post_load(PCIDevice *dev); + /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev); =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 5c0050e1786a..4c7be5295110 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -733,10 +733,17 @@ static bool migrate_is_not_pcie(void *opaque, int ver= sion_id) return !pci_is_express((PCIDevice *)opaque); } =20 +static int pci_post_load(void *opaque, int version_id) +{ + pcie_sriov_pf_post_load(opaque); + return 0; +} + const VMStateDescription vmstate_pci_device =3D { .name =3D "PCIDevice", .version_id =3D 2, .minimum_version_id =3D 1, + .post_load =3D pci_post_load, .fields =3D (const VMStateField[]) { VMSTATE_INT32_POSITIVE_LE(version_id, PCIDevice), VMSTATE_BUFFER_UNSAFE_INFO_TEST(config, PCIDevice, diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 91b6ed46959d..663c1d0cab00 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -254,6 +254,13 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t = address, } } =20 +void pcie_sriov_pf_post_load(PCIDevice *dev) +{ + if (dev->exp.sriov_cap) { + register_vfs(dev); + } +} + =20 /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev) --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762228; cv=none; d=zohomail.com; s=zohoarc; b=hXjs2G9klF7Hyqis7C5VXpV3+B+8FAi6iM2ZzjT64H8nXx5kJd7Q4lXH8R7HFoy1eUWuSwiZP+Nm5HlBmw5JXGhsI/FxDbS5X9E1McBo6/MVODsIpHYuxCGmqbIewBrsm18yHd4+XyRIbsPJyYG4AYT+ed/Aiauu5ahM7KDpbtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762228; 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=lBXEbnUwG06ejAJ51POyij7f50iVZK6QzSm218/g7Co=; b=ndX2+taXqSxSyf5VB9HczNEbNtZPW8fCgqrzOO1nNrV/AKukpcgVIYhbvY4Tl+IN5w8dcM2gnC54mVOMsfWbyG1sF7UlR10b9OlpMFChISnXKBAIUbSxJCcN0ESH7XHk2/cO9QtlIWtmDUBL72bsFAYt7knNFP1y8utnsqZN3G4= 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 1722762228294746.5454499524154; Sun, 4 Aug 2024 02:03:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8b-0002Zx-UC; Sun, 04 Aug 2024 05:02:49 -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 1saX8R-0001zf-IC for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:39 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX8P-0001Ft-Kr for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:39 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fee6435a34so65208015ad.0 for ; Sun, 04 Aug 2024 02:02:37 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff58a66284sm46368645ad.0.2024.08.04.02.02.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762156; x=1723366956; 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=lBXEbnUwG06ejAJ51POyij7f50iVZK6QzSm218/g7Co=; b=t8f2mpWXW8yrg3KdZJGiyga49hvias67h1kyDRFldgoUQ+2zXUAz4rpqUI8bO8v5ru du1cFKZE32bX3FBXMuULQ7qdYg5d9bn8tyqwLqAJeub0yBWHg1m0r7ScP2L7Cs0QTr5q PwUS+CtYk4s8wyQa8c6t4dgbqZY14LDUaaDFRVV3gDc59wCGfpwvWH01oYD44x+sy7dE RivFwMHkTuCvdKm5foAfeDQwbggt7EjMaV92EAYNe9li0cwAo7Gh8uqzX6OLoekbfI1G XrHUsesX254RpZA/bfAUQV9+zoK2SESy/XGvF215yag2FasImG3fu+COaf6jifcYtWhm mObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762156; x=1723366956; 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=lBXEbnUwG06ejAJ51POyij7f50iVZK6QzSm218/g7Co=; b=OL4uswztepdpiEZ0c9u+ey9dx8gd13bx//tSrgbxNoDsWeboN/Gb1//pKIeMqb2se1 fykBruCGkcGSXDxBiUMCVOE/T7QWfGTxCICdW10Cl4R1O18AIibZehMyBF5w8E0qO4sm zJxujPGowsewsC5oKwcHgX7h9diwASfu9aHj4ljhiQeWpb/BxpQqPev5EH+wI2b/TkTD gT4wJKAuSLxEEGd9LTTaUoVDU853vDmCH4NJ8IM40prX+jM/oRKTkFhVEbYA+v92qsqj s2y6+nhT0WgocSFN41SbbPSD8ZNrQNO0iYZXBFsO8ZvxpYMtGsXZeDeje0YsQFhixlgG Ghfw== X-Gm-Message-State: AOJu0YxEyGz56XrDHk34ez6r8kZNECauY0KaLJH/C/78Yz6zwl6hH2q+ TE7aMW8ThGNy0xD6yMpkhh5eMO6V50oDj0hCYxHtTL2Jc0hO3bBGihCpnbkf3rQ= X-Google-Smtp-Source: AGHT+IFJ2PyAu9L5/NkGbbvw/Oz5G8udPmsa6IYWcs4pUTRK6uP4ymvnSY8MXZl8fL0UgQgEBHipjw== X-Received: by 2002:a17:902:dacd:b0:1fd:6d6d:68e4 with SMTP id d9443c01a7336-1ff5749594cmr87968635ad.57.1722762156184; Sun, 04 Aug 2024 02:02:36 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:46 +0900 Subject: [PATCH for-9.2 v12 10/11] hw/pci: Use -1 as the default value for rombar MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-10-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::62a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62a.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: 1722762230146116600 vfio_pci_size_rom() distinguishes whether rombar is explicitly set to 1 by checking dev->opts, bypassing the QOM property infrastructure. Use -1 as the default value for rombar to tell if the user explicitly set it to 1. The property is also converted from unsigned to signed. -1 is signed so it is safe to give it a new meaning. The values in [2 ^ 31, 2 ^ 32) become invalid, but nobody should have typed these values by chance. Suggested-by: Markus Armbruster Signed-off-by: Akihiko Odaki Reviewed-by: Markus Armbruster --- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c | 2 +- hw/vfio/pci.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index 1ff3ce94e25b..8fa845beee5e 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -148,7 +148,7 @@ struct PCIDevice { uint32_t romsize; bool has_rom; MemoryRegion rom; - uint32_t rom_bar; + int32_t rom_bar; =20 /* INTx routing notifier */ PCIINTxRoutingNotifier intx_routing_notifier; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 4c7be5295110..d2eaf0c51dde 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -71,7 +71,7 @@ static Property pci_props[] =3D { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, UINT32_MAX), - DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), + DEFINE_PROP_INT32("rombar", PCIDevice, rom_bar, -1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 2407720c3530..dc53837eac73 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1012,7 +1012,6 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) { uint32_t orig, size =3D cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK); off_t offset =3D vdev->config_offset + PCI_ROM_ADDRESS; - DeviceState *dev =3D DEVICE(vdev); char *name; int fd =3D vdev->vbasedev.fd; =20 @@ -1046,12 +1045,12 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) } =20 if (vfio_opt_rom_in_denylist(vdev)) { - if (dev->opts && qdict_haskey(dev->opts, "rombar")) { + if (vdev->pdev.rom_bar > 0) { warn_report("Device at %s is known to cause system instability" " issues during option rom execution", vdev->vbasedev.name); error_printf("Proceeding anyway since user specified" - " non zero value for rombar\n"); + " positive value for rombar\n"); } else { warn_report("Rom loading for device at %s has been disabled" " due to system instability issues", --=20 2.45.2 From nobody Sun Nov 24 12:13:56 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=1722762271; cv=none; d=zohomail.com; s=zohoarc; b=DgtWWiS2BYbU2fiA9Ej469aShrZCsCYzdyJzMkJD4293O2vpdN+Z8WXhfCBNSwt73GCSbjc8UhjljFo0OlEWHz/vE67UkMmVcmU+kBgLdbAMIlOCLjmqBXRmRIOH97BmF3L26qmLj25s8Kh+/WWzf9Lqj+nToI7+4w43NL/89cY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722762271; 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=0RYDgLdr7HQ010CTBqvRUSBgNA/oE/wNQ3ZQWiob4V0=; b=DqK2Xb1g77DJf0ZqmO7upFcmq1OTis/t+MZ9P5iQkpg3iGQQpbbebaIz2WhvrQWr66dppTdkPaVvivM0jWCPVQ+t3WYp6duiHUwlbcLjHRhTm3gx/4n6+JMPFnFP429k/OHKopwtxMnGI28gWe3aoLw05j8HhH28SXiILuIyWsQ= 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 1722762271974131.25009256557348; Sun, 4 Aug 2024 02:04:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1saX8d-00032y-Sc; Sun, 04 Aug 2024 05:02:53 -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 1saX8X-0002TZ-0j for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:45 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1saX8V-0001GU-9Y for qemu-devel@nongnu.org; Sun, 04 Aug 2024 05:02:44 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1ff1cd07f56so73426725ad.2 for ; Sun, 04 Aug 2024 02:02:41 -0700 (PDT) Received: from localhost ([157.82.202.230]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1ff5928f518sm45979585ad.234.2024.08.04.02.02.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 04 Aug 2024 02:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1722762161; x=1723366961; 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=0RYDgLdr7HQ010CTBqvRUSBgNA/oE/wNQ3ZQWiob4V0=; b=IEe2YGLZj9Jwt0yq3+i2rGq2XDB3cpwLBf1UojUjehWxFkwhM+mZufc/QHfkkV8q38 fOsg9dsE4oJh/u7Z6n3Oq/P+LaKkP0k3ZrfSSWbFFSdh44HhHtJjqZl2fkcq9/tmxOQt r3qGgqhWZO/j9CSGp0nqecPuv0kvoia8BqvEJWrO77Odcvbsm3zAyICr657HZRM8+5Ig mxOnK/NepoffbvjgzLnulbtRa+vvlAlsD+z+hrqAoOd4nlFWdX4gxRmSuLDvUOozW25n QqNFBzdZYuZnh1p0ZJPFXT8MczgLcqGLGbV79NCNfz5JgIW2osk/Z4V4KiHkTaMdEwOz IJIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722762161; x=1723366961; 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=0RYDgLdr7HQ010CTBqvRUSBgNA/oE/wNQ3ZQWiob4V0=; b=nfeDD+9mGwENuWsPTjFFhEFZEVFhODBaadlAdMRiRePwoeNXAHWDRcP/tZ8FI7atNb G8TOLw6ZAFEkwLsqr8Wc/PR/vyZ8uRoFJK5QkyveQtGurzgVbwMFBQida/IIm/yHOxpx n+Oz3aWdPIj8ueHLZP/yOYZCDpGva8Ga7P1yeWDdLBKUWHcA2JO0z49y0MEILuHTkgl1 USNa3gHv7rSKhI4n1sWlOYufqsXQizsmFXE+gRe+lRy6LyoJCqjIvwMGsK+bcjzGKsYd z26rd2EN/Y7GaghupbR4fo3ttzfgeKod6sU8goWHf/9Rww1kq7dxBvoCGe+HQ7tvVdF2 BNYw== X-Gm-Message-State: AOJu0YzzxA8ako9D+EROSGivJ70+RlsaXrrrf8plZPF+0ANnOGq3kJOP HHUfhaELxlKLJdmFq2Ln6xgu21vMoir9+FEDJciw2IVK584WsRN9xQP6ssnCL/0= X-Google-Smtp-Source: AGHT+IEGs28GgpgVkfAxo4hHfuFgbz/jAGMJv5YQ0s77KSiTsTfjwX2Wwdqka3+VfAxTRjDMo6DPAQ== X-Received: by 2002:a17:902:ce8c:b0:1fd:a0e9:910 with SMTP id d9443c01a7336-1ff574a6ff9mr105256825ad.62.1722762160991; Sun, 04 Aug 2024 02:02:40 -0700 (PDT) From: Akihiko Odaki Date: Sun, 04 Aug 2024 18:01:47 +0900 Subject: [PATCH for-9.2 v12 11/11] hw/qdev: Remove opts member MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240804-reuse-v12-11-d3930c4111b2@daynix.com> References: <20240804-reuse-v12-0-d3930c4111b2@daynix.com> In-Reply-To: <20240804-reuse-v12-0-d3930c4111b2@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::636; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x636.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: 1722762272241116600 It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster --- include/hw/qdev-core.h | 4 ---- hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 77bfcbdf732a..a3757e6769f8 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -237,10 +237,6 @@ struct DeviceState { * @pending_deleted_expires_ms: optional timeout for deletion events */ int64_t pending_deleted_expires_ms; - /** - * @opts: QDict of options for the device - */ - QDict *opts; /** * @hotplugged: was device added after PHASE_MACHINE_READY? */ diff --git a/hw/core/qdev.c b/hw/core/qdev.c index f3a996f57dee..2fc84699d432 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -706,7 +706,6 @@ static void device_finalize(Object *obj) dev->canonical_path =3D NULL; } =20 - qobject_unref(dev->opts); g_free(dev->id); } =20 diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 6af6ef7d667f..3551989d5153 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -624,6 +624,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *op= ts, char *id; DeviceState *dev =3D NULL; BusState *bus =3D NULL; + QDict *properties; =20 driver =3D qdict_get_try_str(opts, "driver"); if (!driver) { @@ -705,13 +706,14 @@ DeviceState *qdev_device_add_from_qdict(const QDict *= opts, } =20 /* set properties */ - dev->opts =3D qdict_clone_shallow(opts); - qdict_del(dev->opts, "driver"); - qdict_del(dev->opts, "bus"); - qdict_del(dev->opts, "id"); + properties =3D qdict_clone_shallow(opts); + qdict_del(properties, "driver"); + qdict_del(properties, "bus"); + qdict_del(properties, "id"); =20 - object_set_properties_from_keyval(&dev->parent_obj, dev->opts, from_js= on, + object_set_properties_from_keyval(&dev->parent_obj, properties, from_j= son, errp); + qobject_unref(properties); if (*errp) { goto err_del_dev; } --=20 2.45.2