From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508626; cv=none; d=zohomail.com; s=zohoarc; b=kYAZokjey6zITB4CYqFikcS0Zcd8gTJCRlhKhPNPwIDdm8S9oW7tXpVhtfPSc64ydPi6RRYkpHTseTbDv5MtuhY3dGPp/8M5B0PPlznWgl3DtKyuyQ3OewnDq+mYI3nmQozgD/2W1zmaQhlE7sjbbaw+M0jKZZbnOwg8OJEtAGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508626; 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=+Wj9jvYkwctqz/9QIPv8Y88E3joIG5eue0pkA+KNkvE=; b=jLN4DqDT/4jh8X57zh7JGMfmP+W/+DZcM/7OG9RcM2nLzuzqmLFCiNYnmSWUyGkFtryHXd9u8YjWJjOYE+xnOogCnEdG2S6coLcaE8eGl5MaSm53MjpJXBYHkUt6257+7jExDOU9FNIQUCcd6Q/JWwtUFLolWZy0qpYegB+cPvk= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508626243126.82264231456168; Thu, 1 Aug 2024 03:37:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZT9p-0001fS-7T; Thu, 01 Aug 2024 06:35:41 -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 1sZT9n-0001ej-Mu for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZT9m-0001Oj-9n for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:39 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-Vq0s2RrZMf6defh1NbuEnA-1; Thu, 01 Aug 2024 06:35:36 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52f00bde29dso8982687e87.3 for ; Thu, 01 Aug 2024 03:35:36 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad4a188sm880835066b.134.2024.08.01.03.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+Wj9jvYkwctqz/9QIPv8Y88E3joIG5eue0pkA+KNkvE=; b=F1D6HVMIs0Bw6Bj6lOrSV0L8ooQgJ8IXZAwDrBYKdwNqjbd3eqvmTXnsXl2apRYahxABkv dOuVFHlmWEdO+E4Hxz6LXz53pwx4/0ln4DMwpj51O3PR8PhZhZyMIr2BYLnVOj91u2uh9U GobdXawFTidiD6N+5vP6RLB8zfZLgPc= X-MC-Unique: Vq0s2RrZMf6defh1NbuEnA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508534; x=1723113334; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Wj9jvYkwctqz/9QIPv8Y88E3joIG5eue0pkA+KNkvE=; b=ZDbhBSZ/Yx3kpdYQkZ8JZ0Pfzfg546rRe+D/00njTVFs+oYi+xcvwwVMTmw3Y9d03T +/GxK31lcn/LPTez0WiZeriOz5xEm44MfRKHhpjCGCstRZ16hlVVTd1EMx13W8N/mKy6 QGP7e3Q8FQrHZlhRe+KBGSM6uiXaSg46j4QT8x/g9xUE3or5hNLP1T92Zbhcbf+DMZw0 5lQ6hGjvO3PRJkapdCY5K91INj6QZSGzHkgcm95vs+Cyzq4rnMlv4JPxpHYiFYSGAItj GrTTSLZT9E9jzAycjT74BdgeR5bTNYzFstwjfLaZ9WN1ZfiypXghFLAptVq+CLW5yaHp Cg5A== X-Gm-Message-State: AOJu0YwTyCE27Pqeb27HlCBeLL+FpCMiHY3XFnFxR4+sc1zn5+223JWJ BCc4ITWJV/FVLrfhQ0gvcyPNnxG5Oi9PABrehLR6daApwICzIhaL0881ACUZOua+6dqdHod+hLK TJEaoFMVy2tLiHCFFnu35v2p+2n3IMZVraVd+TccxhIc+YhcLdVzrGRXOcNZebiXr/9TOQ1AcTw cHocMxtQnjoau0esDM5KriDOl1jUdO8g== X-Received: by 2002:a2e:9ad6:0:b0:2ef:29cd:3191 with SMTP id 38308e7fff4ca-2f1533999b0mr18871271fa.35.1722508534242; Thu, 01 Aug 2024 03:35:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvxQzX0PQfR0fBq9sA8VK3QO61hJaW0B3vbhwcp+54qgAjq+YdGlBGK4cBBgnOQkksgMmXKA== X-Received: by 2002:a2e:9ad6:0:b0:2ef:29cd:3191 with SMTP id 38308e7fff4ca-2f1533999b0mr18868141fa.35.1722508525365; Thu, 01 Aug 2024 03:35:25 -0700 (PDT) Date: Thu, 1 Aug 2024 06:35:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Laurent Vivier , Amit Shah Subject: [PULL 01/19] virtio-rng: block max-bytes=0 Message-ID: <024d046bf41b5256adec671085bcee767a6da125.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508627482116600 with max-bytes set to 0, quota is 0 and so device does not work. block this to avoid user confusion Message-Id: <73a89a42d82ec8b47358f25119b87063e4a6ea57.1721818306.git.mst@re= dhat.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/virtio/virtio-rng.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index f74efffef7..7cf31da071 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -184,8 +184,9 @@ static void virtio_rng_device_realize(DeviceState *dev,= Error **errp) =20 /* Workaround: Property parsing does not enforce unsigned integers, * So this is a hack to reject such numbers. */ - if (vrng->conf.max_bytes > INT64_MAX) { - error_setg(errp, "'max-bytes' parameter must be non-negative, " + if (vrng->conf.max_bytes =3D=3D 0 || + vrng->conf.max_bytes > INT64_MAX) { + error_setg(errp, "'max-bytes' parameter must be positive, " "and less than 2^63"); return; } --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508659; cv=none; d=zohomail.com; s=zohoarc; b=VdfwhB3hs8+rGb24X1MWGTvyRpP+TrbanF4IvVY/T5/TN6gHwfuL/8edowadMAm8DL0tIVI/il0inlvb4gotG3m/ZvECMegKFnjbvnbmK81MPu5/uAHJMNynIVpe2jJ7/nHMNOlq2jtW9OJcylcPZUWBvgs9m7ypD0WoCzlTjmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508659; h=Content-Type: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=KZgChYS2EG1AkwtZ9ETv9vrNAjIozgjlnHtqpWXnDf8=; b=F3xuwGm99G97NogP+Mu+YiHSIRzK4Judi79E0zcS/F+s6eQ8/uq8462SHH/LpYSKYmXamlK0LPYzlXBOMQ1pdT6dTcDQN44uFxvfubzFOldkWUb7UJLlOH+PhhejT4CXpLbciRZbhgyhnZeH5FpQ4RzDpm+PINmHsVm4PHvgA0o= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508659636537.103007720315; Thu, 1 Aug 2024 03:37:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZT9y-0002Cx-HC; Thu, 01 Aug 2024 06:35:50 -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 1sZT9v-00025v-8u for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZT9t-0001VE-H6 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:47 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-xG6tBF_dPwymtTgK6VLRrA-1; Thu, 01 Aug 2024 06:35:43 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52f00bde210so7587398e87.1 for ; Thu, 01 Aug 2024 03:35:43 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac65783621sm10105717a12.89.2024.08.01.03.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KZgChYS2EG1AkwtZ9ETv9vrNAjIozgjlnHtqpWXnDf8=; b=As56rv7Gwj8o2pW2JsqDxaxyvr5skwHWpofUD1qAXSxPA6gYugkZhMToGcpNUTG5dWEEdN nEi/AQjWzCSrexREvtHVqDu1REGq12tHis7x2WTjsnkApcZcG49W2dt6+ekBN1BKDyzvTb v+ZS5aoYdi8VC8WGYQK4XQckSHnpJLA= X-MC-Unique: xG6tBF_dPwymtTgK6VLRrA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508541; x=1723113341; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KZgChYS2EG1AkwtZ9ETv9vrNAjIozgjlnHtqpWXnDf8=; b=Oo7F5w0pDe9bfwAPOvg7sDJDNfslXgCLycOspGVm+giS6iGO30pRfewJmhURpajOlh nBPxh0byEGSDUOIGU2RA+AINh6/91EbiMJCncVhqYrEBIAAg8/RxpiCmu1c+APWmlzun hTaYcggGGLU0/jM2E5c/URfs0o0md5SEdjvoukJV3g+lKouCc6SBWz/LBgdZVEkv6Z1m +6KDbPWIfOLMFRJBrqRkYGK3/c4kTIcuT5vA1EuqIBWL2/GfmKeipCqkH4XbPM9DDISr VNSGz6+5ubseZ6OiUME9iOTvoJ7dP2/9w2Q5sKALSKrc0IXl+0RLVEbUEmErYyMA8KqS mBIQ== X-Gm-Message-State: AOJu0Ywnf93xqmokI5PCBCn5iWMi51PPnhXS8GPMfb63ALm9DVsrMC8J AZox+yQJZf4+r43/Y6UuyeFi49HRTglckv3jiJ/5yxv7yG3x8GFSmmHxU0aTbVk6EAJmMCxdu/r jXQPYXecRG8rXMuxho7/Tf1iCJh/DNJHNFQZIwlCkgXSbclCfWPtM6UDiGFtCta5/Pw3J22suB/ 7aflhGA4abgm2phlPbTJddjCQfuUWS8Q== X-Received: by 2002:a05:6512:1c9:b0:52c:d905:9645 with SMTP id 2adb3069b0e04-530b61b1939mr1309701e87.13.1722508541296; Thu, 01 Aug 2024 03:35:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE48tr90YUYBu4ys1STKcxPdicKbn+GBwJwau630qyTfzaNLYg/jZ5l1LKdEnl+3qg0ss3Wqg== X-Received: by 2002:a05:6512:1c9:b0:52c:d905:9645 with SMTP id 2adb3069b0e04-530b61b1939mr1309656e87.13.1722508540409; Thu, 01 Aug 2024 03:35:40 -0700 (PDT) Date: Thu, 1 Aug 2024 06:35:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Thomas Huth , Michael Tokarev , David Hildenbrand , Markus Armbruster Subject: [PULL 02/19] Revert "docs: Document composable SR-IOV device" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508661590116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit d6f40c95b35bd380340b698e4306704fe22a5d68. Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 1 - docs/system/index.rst | 1 - docs/system/sriov.rst | 36 ------------------------------------ 3 files changed, 38 deletions(-) delete mode 100644 docs/system/sriov.rst diff --git a/MAINTAINERS b/MAINTAINERS index 72b3c67360..e34c2bd4cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2011,7 +2011,6 @@ F: hw/pci-bridge/* F: qapi/pci.json F: docs/pci* F: docs/specs/*pci* -F: docs/system/sriov.rst =20 PCIE DOE M: Huai-Cheng Kuo diff --git a/docs/system/index.rst b/docs/system/index.rst index 718e9d3c56..c21065e519 100644 --- a/docs/system/index.rst +++ b/docs/system/index.rst @@ -39,4 +39,3 @@ or Hypervisor.Framework. multi-process confidential-guest-support vm-templating - sriov diff --git a/docs/system/sriov.rst b/docs/system/sriov.rst deleted file mode 100644 index a851a66a4b..0000000000 --- a/docs/system/sriov.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0-or-later - -Compsable SR-IOV device -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -SR-IOV (Single Root I/O Virtualization) is an optional extended capability= of a -PCI Express device. It allows a single physical function (PF) to appear as -multiple virtual functions (VFs) for the main purpose of eliminating softw= are -overhead in I/O from virtual machines. - -There are devices with predefined SR-IOV configurations, but it is also po= ssible -to compose an SR-IOV device yourself. Composing an SR-IOV device is curren= tly -only supported by virtio-net-pci. - -Users can configure an SR-IOV-capable virtio-net device by adding -virtio-net-pci functions to a bus. Below is a command line example: - -.. code-block:: shell - - -netdev user,id=3Dn -netdev user,id=3Do - -netdev user,id=3Dp -netdev user,id=3Dq - -device pcie-root-port,id=3Db - -device virtio-net-pci,bus=3Db,addr=3D0x0.0x3,netdev=3Dq,sriov-pf=3Df - -device virtio-net-pci,bus=3Db,addr=3D0x0.0x2,netdev=3Dp,sriov-pf=3Df - -device virtio-net-pci,bus=3Db,addr=3D0x0.0x1,netdev=3Do,sriov-pf=3Df - -device virtio-net-pci,bus=3Db,addr=3D0x0.0x0,netdev=3Dn,id=3Df - -The VFs specify the paired PF with ``sriov-pf`` property. The PF must be -added after all VFs. It is the user's responsibility to ensure that VFs ha= ve -function numbers larger than one of the PF, and that the function numbers -have a consistent stride. - -You may also need to perform additional steps to activate the SR-IOV featu= re on -your guest. For Linux, refer to [1]_. - -.. [1] https://docs.kernel.org/PCI/pci-iov-howto.html --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508638; cv=none; d=zohomail.com; s=zohoarc; b=U4VpEKnfalsx6130eihRfnVNEq9Py2sYNDkp/GZygIOFwbdNuy1OqkRt3S5XGlaIpFGBg7Tp5hNf3VRr41Z87F3boXsvvfgmusTqNhbOtkg2K9jgnCbYs572qiHxzWuktld2cY/Y9eb1JBWlmfovdyGMq2EzUmbZ403vO+/yHDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508638; h=Content-Type: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=Kgmm3IotKTqf6PLczhlGHew1zzskcB2o2OnEpQJZu0M=; b=BFseT2x+7BPCQz5PMHBJ5qLGEJCLiNGXiq2j22nwQJ92vJII7OcCL8IPFUtVkoruycrOUkm8/Ui5Pc3nciLlYNYYdYTtHUzqSrHo44rwpe2e4Q3wNHeejF0c4Ry9ztviNSPlprwVXFVSyjb1iwwUz+desuuu+2o9UuKQzAvNl8Q= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17225086388851020.9955036721594; Thu, 1 Aug 2024 03:37:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTA6-0002PJ-6R; Thu, 01 Aug 2024 06:35:58 -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 1sZTA4-0002Nb-Cc for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTA3-0001Vt-0k for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:35:56 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-V46F0ZBIO5a16yBWn_yIjw-1; Thu, 01 Aug 2024 06:35:53 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7bcaa94892so579678566b.0 for ; Thu, 01 Aug 2024 03:35:52 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab4d27csm880999366b.46.2024.08.01.03.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Kgmm3IotKTqf6PLczhlGHew1zzskcB2o2OnEpQJZu0M=; b=H43ZAeF58TweFZO8XSTjkm93wWB9rZ11WKrB1OBxPSkPcLH4BgYJmtEY+6Jdnf31WzrLnR Svi3BnNmCI6RPNcgxTr0wpl0HHvoWUKuhHbpJYxyc2C/odzCZcny1WpynPmegTWhXGUt6l ob4+UFFxExbFoUH3WDCvSDcQY1XxozQ= X-MC-Unique: V46F0ZBIO5a16yBWn_yIjw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508551; x=1723113351; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Kgmm3IotKTqf6PLczhlGHew1zzskcB2o2OnEpQJZu0M=; b=qACyhGJnGHrtauNr0FW0SlyNOvN2umkA7PNzCzy2Z+1xR+iF2K5N7EQVF+8TxuNi4G KegDtTzFOXAdFc/QYu7eMaQaCFrl0mzqwoH1JdIz/qnieX+vRXyOj98KeCIa5e/qcjim Ar6gHXnr8iPQRmXmc/UAH8R4Fky9A2fj+kj2Iygws4o5brgoHgiFuY8O/mqj/WUhzjRW N+5GAL1GTC05r7R+lH5OdzKe9M1DdCZDsTJ1YR+PjavJlzd5PSXyfuYxx+HX1CoJ47rh lpvZnWVpuAxljhgONEA/wjX7LdCWDGCjiYB4t/dCn1Rs3KGqT6XMqLHVMMhBdHep8R7h ovFQ== X-Gm-Message-State: AOJu0Yyiw0Vymnw4lzF8gLTIWV+y33d5Dy1klsNUxLhQ2zTW+bXcVkQh ozOARIquujMflb5DwFF3tnGWfAQ1HYyzS8PMKV3gvI3uFxcU7VoN6IJdo4KZQyfVgUY+s6vUUej 9OMsgyn+FPQn3J/rLqM6HO3l+7sZdcenPl8WB3aQapH9uox++euTOd2AugiZSRUEXHNZofudqAJ 2Jy7BVneTXsUWMkILixk1VRCX9vNl1AQ== X-Received: by 2002:a17:906:c10c:b0:a77:c583:4f78 with SMTP id a640c23a62f3a-a7daf50bc67mr125783166b.39.1722508551455; Thu, 01 Aug 2024 03:35:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErFd6dsamrHS13ZBXmsYaXFQ0DqR1nu4qSX+9Sxk8NmCJGQaUtAXo7wsmWvYYeVfKkuxGf+w== X-Received: by 2002:a17:906:c10c:b0:a77:c583:4f78 with SMTP id a640c23a62f3a-a7daf50bc67mr125780166b.39.1722508550616; Thu, 01 Aug 2024 03:35:50 -0700 (PDT) Date: Thu, 1 Aug 2024 06:35:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 03/19] Revert "virtio-net: Implement SR-IOV VF" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508639749116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit c2d6db6a1f39780b24538440091893f9fbe060a7. Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-net-pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c index dba4987d6e..e03543a70a 100644 --- a/hw/virtio/virtio-net-pci.c +++ b/hw/virtio/virtio-net-pci.c @@ -75,7 +75,6 @@ static void virtio_net_pci_class_init(ObjectClass *klass,= void *data) k->device_id =3D PCI_DEVICE_ID_VIRTIO_NET; k->revision =3D VIRTIO_PCI_ABI_VERSION; k->class_id =3D PCI_CLASS_NETWORK_ETHERNET; - k->sriov_vf_user_creatable =3D true; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); device_class_set_props(dc, virtio_net_properties); vpciklass->realize =3D virtio_net_pci_realize; --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508636; cv=none; d=zohomail.com; s=zohoarc; b=OIEooCtrOmJIVoyMejXvOlKx869HwyyaTGvg1/jkO33+jKLh4ZwgZn3E9CDsxbiGDTbLN2rT/9bu2M1Sm3XJhTiZy7ePKQqhqkMEx7G2ePSmfsS9Qqcm7q0LE3BjCksFAx/LvBolWjc9yGgnnu8yqjiuPP6TllVV9UoAKUPGoko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508636; h=Content-Type: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=mFbHQq6SisPQs7stJ6AXdD+sXFUtuivITCao3XMdKA4=; b=OQlQY7klwzjbJzOu6wTDP9Zwp2c/fD//ojfbMcIXkyAlySDE1sVgHQH8+THZ2W2owN5UAqRVV2vvxS9PMltj+CAshupDYf8A5iTn3x/1fmAw4c3CwLg5VI/Mg/gbNQLGM5dDVcmLhH19Me+lFnu9UMQuUWon3Ux85xwbuFWQeDI= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508636461223.3972273841017; Thu, 1 Aug 2024 03:37:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAE-0002fq-6i; Thu, 01 Aug 2024 06:36: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 1sZTAC-0002ZS-1g for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAA-0001WS-Ec for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:03 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626-4fG3yTihOnOg9p37FjoZcA-1; Thu, 01 Aug 2024 06:36:00 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a7aaef3fdafso281792766b.1 for ; Thu, 01 Aug 2024 03:36:00 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acada27ddsm873539966b.184.2024.08.01.03.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mFbHQq6SisPQs7stJ6AXdD+sXFUtuivITCao3XMdKA4=; b=BnmEwp0OASg8PsYZEV+DgsPJd55kQTMcLc/xg95K7s03RoqBI3szrLN090eeVHlRCyE8el pfCpV/7ZKBoIo7hF2URDVlNCY9NUXbXnjq1eQyuRBsm+gPn8AqR81jhEEuFwhUFSXEabZa rD+Fe5968ccYEy4FlC8wWI+h/9+PPGE= X-MC-Unique: 4fG3yTihOnOg9p37FjoZcA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508559; x=1723113359; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mFbHQq6SisPQs7stJ6AXdD+sXFUtuivITCao3XMdKA4=; b=dsgPHkvNwd1ZW5xGqsHMch326eN92HXcZJQwaWo8nE48d1qDjQPJObl4TOpuu9Fxw8 BTz67PuXQFblzHRwU8+HRCRaOQkmCUABKIU+9mrcYfUcgtNCG0paNFihhV91GjgYLCuj Nnk3WQBCUSO7BTWsFhyJBCexecBsFvrF3iJTBISS1gD01Z06c8EHmPHy2e9ItIMb0kd0 wTbogzRuEYWdKGFYgcGqCfS8eu8FEYeEnttSz7CheUBu84vxFTMsWlZO+PVF1Amt+b+6 XNxgXRAVu9UMLiG6OnE4Q4Jcx5YwvGgiTKrOet9VsG/LTw4GXPcNl/cTFuV99SOy5YGf EXZw== X-Gm-Message-State: AOJu0YwdsUdA0KDFeIH5eU7sguOEFfpsCet0XR5k1rFcKalMNFgu1Tuy jufi5VX/d8P1L0+laWtJHMW0D0I2GPaEE6Mw3F0NtmV8v2BCayMOGOLBEnjmrhr3RX+oInPHcBK PU7JE/GWh133v9/4MmHOdtDM2lnUDRjY4yUdAYkc5t/EQotumFDLT2E2HVnS0NPeg/vZWB0j8Jk kNruTX9c7uP9kRUEtmeIpqqs2CELxc+g== X-Received: by 2002:a17:907:9485:b0:a7a:a33e:47bf with SMTP id a640c23a62f3a-a7dbcc28485mr78359566b.18.1722508559102; Thu, 01 Aug 2024 03:35:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmq2/HSG6iZdmchZo95arLespmapTu+/31xMC2P0Iou3ASi6AAY7f5dM2fN23DAAFiJ+Fphg== X-Received: by 2002:a17:907:9485:b0:a7a:a33e:47bf with SMTP id a640c23a62f3a-a7dbcc28485mr78357666b.18.1722508558307; Thu, 01 Aug 2024 03:35:58 -0700 (PDT) Date: Thu, 1 Aug 2024 06:35:50 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 04/19] Revert "virtio-pci: Implement SR-IOV PF" Message-ID: <67f5b279fc72e43ccdee20a1a1e54cb51e24f06a.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508637483116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 3f868ffb0bae0c4feafabe34a371cded57fe3806. Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-pci.h | 1 - hw/virtio/virtio-pci.c | 20 +++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h index 34539f2f67..9e67ba38c7 100644 --- a/include/hw/virtio/virtio-pci.h +++ b/include/hw/virtio/virtio-pci.h @@ -152,7 +152,6 @@ struct VirtIOPCIProxy { uint32_t modern_io_bar_idx; uint32_t modern_mem_bar_idx; int config_cap; - uint16_t last_pcie_cap_offset; uint32_t flags; bool disable_modern; bool ignore_backend_features; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 0c8fcc5627..9534730bba 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1955,7 +1955,6 @@ static void virtio_pci_device_plugged(DeviceState *d,= Error **errp) uint8_t *config; uint32_t size; VirtIODevice *vdev =3D virtio_bus_get_device(bus); - int16_t res; =20 /* * Virtio capabilities present without @@ -2101,14 +2100,6 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) pci_register_bar(&proxy->pci_dev, proxy->legacy_io_bar_idx, PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar); } - - res =3D pcie_sriov_pf_init_from_user_created_vfs(&proxy->pci_dev, - proxy->last_pcie_cap_of= fset, - errp); - if (res > 0) { - proxy->last_pcie_cap_offset +=3D res; - virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV); - } } =20 static void virtio_pci_device_unplugged(DeviceState *d) @@ -2196,7 +2187,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) =20 if (pcie_port && pci_is_express(pci_dev)) { int pos; - proxy->last_pcie_cap_offset =3D PCI_CONFIG_SPACE_SIZE; + uint16_t last_pcie_cap_offset =3D PCI_CONFIG_SPACE_SIZE; =20 pos =3D pcie_endpoint_cap_init(pci_dev, 0); assert(pos > 0); @@ -2216,9 +2207,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) pci_set_word(pci_dev->config + pos + PCI_PM_PMC, 0x3); =20 if (proxy->flags & VIRTIO_PCI_FLAG_AER) { - pcie_aer_init(pci_dev, PCI_ERR_VER, proxy->last_pcie_cap_offse= t, + pcie_aer_init(pci_dev, PCI_ERR_VER, last_pcie_cap_offset, PCI_ERR_SIZEOF, NULL); - proxy->last_pcie_cap_offset +=3D PCI_ERR_SIZEOF; + last_pcie_cap_offset +=3D PCI_ERR_SIZEOF; } =20 if (proxy->flags & VIRTIO_PCI_FLAG_INIT_DEVERR) { @@ -2243,9 +2234,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Er= ror **errp) } =20 if (proxy->flags & VIRTIO_PCI_FLAG_ATS) { - pcie_ats_init(pci_dev, proxy->last_pcie_cap_offset, + pcie_ats_init(pci_dev, last_pcie_cap_offset, proxy->flags & VIRTIO_PCI_FLAG_ATS_PAGE_ALIGNED); - proxy->last_pcie_cap_offset +=3D PCI_EXT_CAP_ATS_SIZEOF; + last_pcie_cap_offset +=3D PCI_EXT_CAP_ATS_SIZEOF; } =20 if (proxy->flags & VIRTIO_PCI_FLAG_INIT_FLR) { @@ -2272,7 +2263,6 @@ static void virtio_pci_exit(PCIDevice *pci_dev) bool pcie_port =3D pci_bus_is_express(pci_get_bus(pci_dev)) && !pci_bus_is_root(pci_get_bus(pci_dev)); =20 - pcie_sriov_pf_exit(&proxy->pci_dev); msix_uninit_exclusive_bar(pci_dev); if (proxy->flags & VIRTIO_PCI_FLAG_AER && pcie_port && pci_is_express(pci_dev)) { --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508616; cv=none; d=zohomail.com; s=zohoarc; b=VTrOwGiopFwTvWx0Ud8as4kGZiSMt00ytCknGur6PDXULIo07jn6rKfVtmLO+yXZpPE0lM1A7BOxx34Rw2DrWh77ymbKi2WofpBUQWcnALQp5b/9OndPMJcuEj0TKELeEyZ7q1sFgNVUQuPU0txktwaPIdgbJOcF37A90+yusrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508616; h=Content-Type: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=ugSEKs2cZK1SSCVwSLS6qJ+0laBmwuBRQ+6Ul2jMCzQ=; b=fyeeimZmHeO4tQTS76hOj4j2d5+Qhp7nUg/zE5UO455bvt2zp0bPgOXWFfWuhwvRD9HEItSpEMe710s5Xj2jNz9iBYQgx3HU3CH19xK97bLvYp84ToQFxVusWvTr1nezLzuAsKlkbD6SFHmB1BLigr4ZHTqUf6Brl7Sv7trVurs= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508616855714.2655997726945; Thu, 1 Aug 2024 03:36:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAL-00032M-54; Thu, 01 Aug 2024 06:36:13 -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 1sZTAJ-00031K-A2 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAG-0001Zd-T8 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:11 -0400 Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-255-hPb5S-zyMtisu7lJ6xsk1A-1; Thu, 01 Aug 2024 06:36:06 -0400 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-52f02f1773fso7684133e87.3 for ; Thu, 01 Aug 2024 03:36:06 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab2310fsm874820566b.42.2024.08.01.03.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ugSEKs2cZK1SSCVwSLS6qJ+0laBmwuBRQ+6Ul2jMCzQ=; b=E1hgMvhVMRGOllT7b3Ef5VzMPsqqxtiYPgh+1u2r/wMVb20Kj+atXT3O4TA9kbNXYF0nwl slLcw/6twmGbdCGVVI+giQKdMQ1qOIy3aZiDh+5HXmagL2nSQob1z3ci1jGaVVBFACP6JW D+Dm+OAo1eEyfaJo2/KZ0hrx0mlYp0w= X-MC-Unique: hPb5S-zyMtisu7lJ6xsk1A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508564; x=1723113364; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ugSEKs2cZK1SSCVwSLS6qJ+0laBmwuBRQ+6Ul2jMCzQ=; b=b//EZ/nxGb1XkOVYzRNINIHVrB3CTNnQ/Sk2RLZG8VLdAtdODfQYulCvpdM2j9OQ0m xKoWV1y/Zz4BK2Igb+kKRzMGTyzemRg35tzfbgsOGTAS7YnkmlDIxtSXscHUHclksW8Y KnUijsAMQfjZG3MYf1hexTewZK/KcUM+qkxXvuf/W4j9nYA7444+jU6tFV7fU97oJTjC X3MHEn4ddF6HTJ/rIGEoFF0xbLSj/4+WTOZiln4GF6Nu0MPOywaz4hGXV1/fgD8zCcYf TxSg7vBwAttJHnBnC21sitYy4CQwoh6N7gnXZyO3Xp0MC2h56DAg7arp/3MRL4V13jlN jiTA== X-Gm-Message-State: AOJu0YzGTcCEg5w/nIR1WJ8cgo8JUlnPnpF7DricbLrBK8fbz8XJ4cx/ NkebssllUv9jWhHqbqyCJmFGU+ghc53Y+DGPwclIJ8pC41TsQwd6oUzH4DLi6sXkgCz5vlvQfQy YElBbjk3idgOsTEmAcX5FLaea1eecO0+kzT+f4tMgVNL++8Db9D/NnE6OVpxAOSxydqnS7vNe5I Wt/crV+vq7H+9Em7rSq2vtUU3F8Tnasw== X-Received: by 2002:a05:6512:250c:b0:52e:9be7:91aa with SMTP id 2adb3069b0e04-530b619a948mr1469839e87.10.1722508564232; Thu, 01 Aug 2024 03:36:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEr8eH5cOvva/QTn6roOFD6lTShcXME0/GcpKx97I1M7UUZmzOzgludeyL6aJmdRCLw6B+OaQ== X-Received: by 2002:a05:6512:250c:b0:52e:9be7:91aa with SMTP id 2adb3069b0e04-530b619a948mr1469773e87.10.1722508563280; Thu, 01 Aug 2024 03:36:03 -0700 (PDT) Date: Thu, 1 Aug 2024 06:35:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 05/19] Revert "pcie_sriov: Allow user to create SR-IOV device" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508617417116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 122173a5830f7757f8a94a3b1559582f312e140b. Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci_device.h | 6 +- include/hw/pci/pcie_sriov.h | 18 --- hw/pci/pci.c | 62 +++----- hw/pci/pcie_sriov.c | 290 ++++++++---------------------------- 4 files changed, 83 insertions(+), 293 deletions(-) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index e7e41cb939..1ff3ce94e2 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -38,8 +38,6 @@ struct PCIDeviceClass { uint16_t subsystem_id; /* only for header type =3D 0 */ =20 const char *romfile; /* rom bar */ - - bool sriov_vf_user_creatable; }; =20 enum PCIReqIDType { @@ -169,8 +167,6 @@ struct PCIDevice { /* ID of standby device in net_failover pair */ char *failover_pair_id; uint32_t acpi_index; - - char *sriov_pf; }; =20 static inline int pci_intx(PCIDevice *pci_dev) @@ -203,7 +199,7 @@ static inline int pci_is_express_downstream_port(const = PCIDevice *d) =20 static inline int pci_is_vf(const PCIDevice *d) { - return d->sriov_pf || d->exp.sriov_vf.pf !=3D NULL; + return d->exp.sriov_vf.pf !=3D NULL; } =20 static inline uint32_t pci_config_size(const PCIDevice *d) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index f75b8f22ee..c5d2d318d3 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -18,7 +18,6 @@ typedef struct PCIESriovPF { 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 */ - bool vf_user_created; /* If VFs are created by user */ } PCIESriovPF; =20 typedef struct PCIESriovVF { @@ -41,23 +40,6 @@ void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int regio= n_num, void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, MemoryRegion *memory); =20 -/** - * pcie_sriov_pf_init_from_user_created_vfs() - Initialize PF with user-cr= eated - * VFs. - * @dev: A PCIe device being realized. - * @offset: The offset of the SR-IOV capability. - * @errp: pointer to Error*, to store an error if it happens. - * - * Return: The size of added capability. 0 if the user did not create VFs. - * -1 if failed. - */ -int16_t pcie_sriov_pf_init_from_user_created_vfs(PCIDevice *dev, - uint16_t offset, - Error **errp); - -bool pcie_sriov_register_device(PCIDevice *dev, Error **errp); -void pcie_sriov_unregister_device(PCIDevice *dev); - /* * Default (minimal) page size support values * as required by the SR/IOV standard: diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 8ad5d7e2d8..cf2794879d 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -85,7 +85,6 @@ static Property pci_props[] =3D { QEMU_PCIE_ERR_UNC_MASK_BITNR, true), DEFINE_PROP_BIT("x-pcie-ari-nextfn-1", PCIDevice, cap_present, QEMU_PCIE_ARI_NEXTFN_1_BITNR, false), - DEFINE_PROP_STRING("sriov-pf", PCIDevice, sriov_pf), DEFINE_PROP_END_OF_LIST() }; =20 @@ -960,8 +959,13 @@ static void pci_init_multifunction(PCIBus *bus, PCIDev= ice *dev, Error **errp) dev->config[PCI_HEADER_TYPE] |=3D PCI_HEADER_TYPE_MULTI_FUNCTION; } =20 - /* SR/IOV is not handled here. */ - if (pci_is_vf(dev)) { + /* + * With SR/IOV and ARI, a device at function 0 need not be a multifunc= tion + * device, as it may just be a VF that ended up with function 0 in + * the legacy PCI interpretation. Avoid failing in such cases: + */ + if (pci_is_vf(dev) && + dev->exp.sriov_vf.pf->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { return; } =20 @@ -994,8 +998,7 @@ static void pci_init_multifunction(PCIBus *bus, PCIDevi= ce *dev, Error **errp) } /* function 0 indicates single function, so function > 0 must be NULL = */ for (func =3D 1; func < PCI_FUNC_MAX; ++func) { - PCIDevice *device =3D bus->devices[PCI_DEVFN(slot, func)]; - if (device && !pci_is_vf(device)) { + if (bus->devices[PCI_DEVFN(slot, func)]) { error_setg(errp, "PCI: %x.0 indicates single function, " "but %x.%x is already populated.", slot, slot, func); @@ -1280,7 +1283,6 @@ static void pci_qdev_unrealize(DeviceState *dev) =20 pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); - pcie_sriov_unregister_device(pci_dev); =20 if (pc->exit) { pc->exit(pci_dev); @@ -1312,6 +1314,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_= num, pcibus_t size =3D memory_region_size(memory); uint8_t hdr_type; =20 + assert(!pci_is_vf(pci_dev)); /* VFs must use pcie_sriov_vf_register_ba= r */ assert(region_num >=3D 0); assert(region_num < PCI_NUM_REGIONS); assert(is_power_of_2(size)); @@ -1322,6 +1325,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_= num, assert(hdr_type !=3D PCI_HEADER_TYPE_BRIDGE || region_num < 2); =20 r =3D &pci_dev->io_regions[region_num]; + r->addr =3D PCI_BAR_UNMAPPED; r->size =3D size; r->type =3D type; r->memory =3D memory; @@ -1329,35 +1333,22 @@ void pci_register_bar(PCIDevice *pci_dev, int regio= n_num, ? pci_get_bus(pci_dev)->address_space_io : pci_get_bus(pci_dev)->address_space_mem; =20 - if (pci_is_vf(pci_dev)) { - PCIDevice *pf =3D pci_dev->exp.sriov_vf.pf; - assert(!pf || type =3D=3D pf->exp.sriov_pf.vf_bar_type[region_num]= ); + wmask =3D ~(size - 1); + if (region_num =3D=3D PCI_ROM_SLOT) { + /* ROM enable bit is writable */ + wmask |=3D PCI_ROM_ADDRESS_ENABLE; + } =20 - r->addr =3D pci_bar_address(pci_dev, region_num, r->type, r->size); - if (r->addr !=3D PCI_BAR_UNMAPPED) { - memory_region_add_subregion_overlap(r->address_space, - r->addr, r->memory, 1); - } + addr =3D pci_bar(pci_dev, region_num); + pci_set_long(pci_dev->config + addr, type); + + if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) && + r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) { + pci_set_quad(pci_dev->wmask + addr, wmask); + pci_set_quad(pci_dev->cmask + addr, ~0ULL); } else { - r->addr =3D PCI_BAR_UNMAPPED; - - wmask =3D ~(size - 1); - if (region_num =3D=3D PCI_ROM_SLOT) { - /* ROM enable bit is writable */ - wmask |=3D PCI_ROM_ADDRESS_ENABLE; - } - - addr =3D pci_bar(pci_dev, region_num); - pci_set_long(pci_dev->config + addr, type); - - if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) && - r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) { - pci_set_quad(pci_dev->wmask + addr, wmask); - pci_set_quad(pci_dev->cmask + addr, ~0ULL); - } else { - pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff); - pci_set_long(pci_dev->cmask + addr, 0xffffffff); - } + pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff); + pci_set_long(pci_dev->cmask + addr, 0xffffffff); } } =20 @@ -2118,11 +2109,6 @@ static void pci_qdev_realize(DeviceState *qdev, Erro= r **errp) } } =20 - if (!pcie_sriov_register_device(pci_dev, errp)) { - pci_qdev_unrealize(DEVICE(pci_dev)); - return; - } - /* * A PCIe Downstream Port that do not have ARI Forwarding enabled must * associate only Device 0 with the device attached to the bus diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 0fc9f810b9..15a4aac1f4 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -20,8 +20,6 @@ #include "qapi/error.h" #include "trace.h" =20 -static GHashTable *pfs; - static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) { for (uint16_t i =3D 0; i < total_vfs; i++) { @@ -33,49 +31,14 @@ static void unparent_vfs(PCIDevice *dev, uint16_t total= _vfs) dev->exp.sriov_pf.vf =3D NULL; } =20 -static void clear_ctrl_vfe(PCIDevice *dev) -{ - uint8_t *ctrl =3D dev->config + dev->exp.sriov_cap + PCI_SRIOV_CTRL; - pci_set_word(ctrl, pci_get_word(ctrl) & ~PCI_SRIOV_CTRL_VFE); -} - -static void register_vfs(PCIDevice *dev) -{ - uint16_t num_vfs; - uint16_t i; - uint16_t sriov_cap =3D dev->exp.sriov_cap; - - 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)) { - clear_ctrl_vfe(dev); - return; - } - - 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); - } -} - -static void unregister_vfs(PCIDevice *dev) -{ - uint16_t i; - uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; - - trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - 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); - } -} - -static bool pcie_sriov_pf_init_common(PCIDevice *dev, uint16_t offset, - uint16_t vf_dev_id, uint16_t init_vf= s, - uint16_t total_vfs, uint16_t vf_offs= et, - uint16_t vf_stride, Error **errp) +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, + 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 @@ -137,28 +100,6 @@ static bool pcie_sriov_pf_init_common(PCIDevice *dev, = uint16_t offset, =20 qdev_prop_set_bit(&dev->qdev, "multifunction", true); =20 - return true; -} - -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, - Error **errp) -{ - BusState *bus =3D qdev_get_parent_bus(&dev->qdev); - int32_t devfn =3D dev->devfn + vf_offset; - - if (pfs && g_hash_table_contains(pfs, dev->qdev.id)) { - error_setg(errp, "attaching user-created SR-IOV VF unsupported"); - return false; - } - - if (!pcie_sriov_pf_init_common(dev, offset, vf_dev_id, init_vfs, - total_vfs, vf_offset, vf_stride, errp))= { - return false; - } - dev->exp.sriov_pf.vf =3D g_new(PCIDevice *, total_vfs); =20 for (uint16_t i =3D 0; i < total_vfs; i++) { @@ -188,24 +129,7 @@ void pcie_sriov_pf_exit(PCIDevice *dev) { uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; =20 - if (dev->exp.sriov_pf.vf_user_created) { - uint16_t ven_id =3D pci_get_word(dev->config + PCI_VENDOR_ID); - uint16_t total_vfs =3D pci_get_word(dev->config + PCI_SRIOV_TOTAL_= VF); - uint16_t vf_dev_id =3D pci_get_word(dev->config + PCI_SRIOV_VF_DID= ); - - unregister_vfs(dev); - - for (uint16_t i =3D 0; i < total_vfs; i++) { - PCIDevice *vf =3D dev->exp.sriov_pf.vf[i]; - - vf->exp.sriov_vf.pf =3D NULL; - - pci_config_set_vendor_id(vf->config, ven_id); - pci_config_set_device_id(vf->config, vf_dev_id); - } - } else { - unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)); - } + unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)); } =20 void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, @@ -238,172 +162,74 @@ void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int r= egion_num, void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, MemoryRegion *memory) { + PCIIORegion *r; + PCIBus *bus =3D pci_get_bus(dev); uint8_t type; + pcibus_t size =3D memory_region_size(memory); =20 - assert(dev->exp.sriov_vf.pf); + assert(pci_is_vf(dev)); /* PFs must use pci_register_bar */ + assert(region_num >=3D 0); + assert(region_num < PCI_NUM_REGIONS); type =3D dev->exp.sriov_vf.pf->exp.sriov_pf.vf_bar_type[region_num]; =20 - return pci_register_bar(dev, region_num, type, memory); + if (!is_power_of_2(size)) { + error_report("%s: PCI region size must be a power" + " of two - type=3D0x%x, size=3D0x%"FMT_PCIBUS, + __func__, type, size); + exit(1); + } + + r =3D &dev->io_regions[region_num]; + r->memory =3D memory; + r->address_space =3D + type & PCI_BASE_ADDRESS_SPACE_IO + ? bus->address_space_io + : bus->address_space_mem; + r->size =3D size; + r->type =3D type; + + r->addr =3D pci_bar_address(dev, region_num, r->type, r->size); + if (r->addr !=3D PCI_BAR_UNMAPPED) { + memory_region_add_subregion_overlap(r->address_space, + r->addr, r->memory, 1); + } } =20 -static gint compare_vf_devfns(gconstpointer a, gconstpointer b) +static void clear_ctrl_vfe(PCIDevice *dev) { - return (*(PCIDevice **)a)->devfn - (*(PCIDevice **)b)->devfn; + uint8_t *ctrl =3D dev->config + dev->exp.sriov_cap + PCI_SRIOV_CTRL; + pci_set_word(ctrl, pci_get_word(ctrl) & ~PCI_SRIOV_CTRL_VFE); } =20 -int16_t pcie_sriov_pf_init_from_user_created_vfs(PCIDevice *dev, - uint16_t offset, - Error **errp) +static void register_vfs(PCIDevice *dev) { - GPtrArray *pf; - PCIDevice **vfs; - BusState *bus =3D qdev_get_parent_bus(DEVICE(dev)); - uint16_t ven_id =3D pci_get_word(dev->config + PCI_VENDOR_ID); - uint16_t vf_dev_id; - uint16_t vf_offset; - uint16_t vf_stride; + uint16_t num_vfs; uint16_t i; + uint16_t sriov_cap =3D dev->exp.sriov_cap; =20 - if (!pfs || !dev->qdev.id) { - return 0; + 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)) { + clear_ctrl_vfe(dev); + return; } =20 - pf =3D g_hash_table_lookup(pfs, dev->qdev.id); - if (!pf) { - return 0; + 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); } - - if (pf->len > UINT16_MAX) { - error_setg(errp, "too many VFs"); - return -1; - } - - g_ptr_array_sort(pf, compare_vf_devfns); - vfs =3D (void *)pf->pdata; - - if (vfs[0]->devfn <=3D dev->devfn) { - error_setg(errp, "a VF function number is less than the PF functio= n number"); - return -1; - } - - vf_dev_id =3D pci_get_word(vfs[0]->config + PCI_DEVICE_ID); - vf_offset =3D vfs[0]->devfn - dev->devfn; - vf_stride =3D pf->len < 2 ? 0 : vfs[1]->devfn - vfs[0]->devfn; - - for (i =3D 0; i < pf->len; i++) { - if (bus !=3D qdev_get_parent_bus(&vfs[i]->qdev)) { - error_setg(errp, "SR-IOV VF parent bus mismatches with PF"); - return -1; - } - - if (ven_id !=3D pci_get_word(vfs[i]->config + PCI_VENDOR_ID)) { - error_setg(errp, "SR-IOV VF vendor ID mismatches with PF"); - return -1; - } - - if (vf_dev_id !=3D pci_get_word(vfs[i]->config + PCI_DEVICE_ID)) { - error_setg(errp, "inconsistent SR-IOV VF device IDs"); - return -1; - } - - for (size_t j =3D 0; j < PCI_NUM_REGIONS; j++) { - if (vfs[i]->io_regions[j].size !=3D vfs[0]->io_regions[j].size= || - vfs[i]->io_regions[j].type !=3D vfs[0]->io_regions[j].type= ) { - error_setg(errp, "inconsistent SR-IOV BARs"); - return -1; - } - } - - if (vfs[i]->devfn - vfs[0]->devfn !=3D vf_stride * i) { - error_setg(errp, "inconsistent SR-IOV stride"); - return -1; - } - } - - if (!pcie_sriov_pf_init_common(dev, offset, vf_dev_id, pf->len, - pf->len, vf_offset, vf_stride, errp)) { - return -1; - } - - for (i =3D 0; i < pf->len; i++) { - vfs[i]->exp.sriov_vf.pf =3D dev; - vfs[i]->exp.sriov_vf.vf_number =3D i; - - /* set vid/did according to sr/iov spec - they are not used */ - pci_config_set_vendor_id(vfs[i]->config, 0xffff); - pci_config_set_device_id(vfs[i]->config, 0xffff); - } - - dev->exp.sriov_pf.vf =3D vfs; - dev->exp.sriov_pf.vf_user_created =3D true; - - for (i =3D 0; i < PCI_NUM_REGIONS; i++) { - PCIIORegion *region =3D &vfs[0]->io_regions[i]; - - if (region->size) { - pcie_sriov_pf_init_vf_bar(dev, i, region->type, region->size); - } - } - - return PCI_EXT_CAP_SRIOV_SIZEOF; } =20 -bool pcie_sriov_register_device(PCIDevice *dev, Error **errp) +static void unregister_vfs(PCIDevice *dev) { - if (!dev->exp.sriov_pf.vf && dev->qdev.id && - pfs && g_hash_table_contains(pfs, dev->qdev.id)) { - error_setg(errp, "attaching user-created SR-IOV VF unsupported"); - return false; - } + uint16_t i; + uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; =20 - if (dev->sriov_pf) { - PCIDevice *pci_pf; - GPtrArray *pf; - - if (!PCI_DEVICE_GET_CLASS(dev)->sriov_vf_user_creatable) { - error_setg(errp, "user cannot create SR-IOV VF with this devic= e type"); - return false; - } - - if (!pci_is_express(dev)) { - error_setg(errp, "PCI Express is required for SR-IOV VF"); - return false; - } - - if (!pci_qdev_find_device(dev->sriov_pf, &pci_pf)) { - error_setg(errp, "PCI device specified as SR-IOV PF already ex= ists"); - return false; - } - - if (!pfs) { - pfs =3D g_hash_table_new_full(g_str_hash, g_str_equal, g_free,= NULL); - } - - pf =3D g_hash_table_lookup(pfs, dev->sriov_pf); - if (!pf) { - pf =3D g_ptr_array_new(); - g_hash_table_insert(pfs, g_strdup(dev->sriov_pf), pf); - } - - g_ptr_array_add(pf, dev); - } - - return true; -} - -void pcie_sriov_unregister_device(PCIDevice *dev) -{ - if (dev->sriov_pf && pfs) { - GPtrArray *pf =3D g_hash_table_lookup(pfs, dev->sriov_pf); - - if (pf) { - g_ptr_array_remove_fast(pf, dev); - - if (!pf->len) { - g_hash_table_remove(pfs, dev->sriov_pf); - g_ptr_array_free(pf, FALSE); - } - } + trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), + 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); } } =20 @@ -490,7 +316,7 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint1= 6_t opt_sup_pgsize) =20 uint16_t pcie_sriov_vf_number(PCIDevice *dev) { - assert(dev->exp.sriov_vf.pf); + assert(pci_is_vf(dev)); return dev->exp.sriov_vf.vf_number; } =20 --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508651; cv=none; d=zohomail.com; s=zohoarc; b=lKgrT/kVH1mee2Om43slp2ag+48vNdb1E9YbeNPrC25dJBo8gf/o3/Pk4+ww/spACQdZDy+jmcL5iFs+Oz3HCcmiIfu/6yrXsYjnkLXfhiJsDF1oNmSUBVAqQmdDCxSfw/aIJr06Zhtr89oRbNfYbpj+FwoxvjBXgmsWgXjkO8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508651; h=Content-Type: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=5yE0T538LAywgJeaqQWByKrae3CNG6FSWZ0iMKoVa98=; b=aN9Na3tvNkn4Hyjm8/ftK+Hgt21BisqzvWHcmsibZEyBs1EbWkKFv7cp+IfutCeH1YyNtqTgYzk1cNFW0lSN6+RM4UkWmKNb+GFo58aoEkd2RIEjsjxqDn8PyI78HRK1x5edJKdfxnM1ZV/EHuyMTjHNM396wMaN8CbRZ4S8B4c= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508651693261.1807215364945; Thu, 1 Aug 2024 03:37:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAO-0003FS-AT; Thu, 01 Aug 2024 06:36:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAM-00038t-NN for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAL-0001at-B3 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:14 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-eZHGvQOdM-y7S-Wzf0wvsw-1; Thu, 01 Aug 2024 06:36:11 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52f0258b020so7474807e87.0 for ; Thu, 01 Aug 2024 03:36:11 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63b59ca1sm10032032a12.52.2024.08.01.03.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5yE0T538LAywgJeaqQWByKrae3CNG6FSWZ0iMKoVa98=; b=i7HhaFRtYQHeDL/87qB/pMzcjA5AlROYSkMJBI9Pq5J2MKH69fpsVaj5ihBs3pzGMZlldu uebgSVqwWcCILkTA4Up06KrATXZbo+2mwGt1ELnqr4COnOPzXuIHW3wS1k5OV5coGZixXr +GM1XTMTWcBgluo6Kt1Z09mf28CLw7E= X-MC-Unique: eZHGvQOdM-y7S-Wzf0wvsw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508569; x=1723113369; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5yE0T538LAywgJeaqQWByKrae3CNG6FSWZ0iMKoVa98=; b=FcOn4AbIpfhXwLnugJOTLhrp2JxOo2BTtNeKERRGTK0xQKjDMQv4a1NdLED6AnePt3 q4yhMwUhiMWSaT4qEkF1lRRWP6ZzQ2gBuscFciZYUfQL9peVKJUJvg8AlYCyyvWnoxia FBQGjBLDiiPa+Aeowdhq52Qtw9qpyprQo2Wo9cqJRjGz2Sgliik8GHk5J9QQOOQlLOz7 ZBUs0fZqSQZuJJxNXfyOKxqyjR9qrgT6s7jdGyGNfybRYvzrpk/AY9eCLHel4A6bV0BM gnVhU407qGndILhj+mu0gWt3Uj6EdWXr8FH0G8Dk2y/LAQqZgmA3awgs8U0DLYMG7TmX hZNg== X-Gm-Message-State: AOJu0YwURkvwbKf9CfMmB/QKFoWccvdumprC2d4exHQnGqUKud8Q8xQV QQglXibaOG2qYRGtaAC9MHLgTwBqzF1L1q2Ypzf+UsVTZRGwyM1f48nwjnmjsHqzXMTq56Yx0vu m8PmkM4HCb8UN6teQT6QJzERXD6zjBIB83l+J/Kd/wQz3PmQHDUJna/hhKEJhPlMHQPaGYScpSD AreVryZxaKnSNakREuCszV4G7Rk9dzyg== X-Received: by 2002:ac2:5bdb:0:b0:52f:2ea:499f with SMTP id 2adb3069b0e04-530b61b6fe6mr1076261e87.24.1722508569227; Thu, 01 Aug 2024 03:36:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpL/fqjx6iYHpOBD/jhIyORDYu3W5yanEx6LCg0v9tuYX7eWAkL90fVACaDn97UN05LQLQwQ== X-Received: by 2002:ac2:5bdb:0:b0:52f:2ea:499f with SMTP id 2adb3069b0e04-530b61b6fe6mr1076240e87.24.1722508568442; Thu, 01 Aug 2024 03:36:08 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 06/19] Revert "pcie_sriov: Check PCI Express for SR-IOV PF" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508653547116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 47cc753e50076c25334091783738be9f716253b1. Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 15a4aac1f4..6c79658b4c 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -42,11 +42,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, uint8_t *cfg =3D dev->config + offset; uint8_t *wmask; =20 - if (!pci_is_express(dev)) { - error_setg(errp, "PCI Express is required for SR-IOV PF"); - return false; - } - if (pci_is_vf(dev)) { error_setg(errp, "a device cannot be both an SR-IOV PF and a VF"); return false; --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508621; cv=none; d=zohomail.com; s=zohoarc; b=NIc9lX6+w5gw34bHxcgVcGH3cl1hePZKKFXxPhIEjrA+C0M/ZNuytITBdgTroKJt2AvkTVeqIDTElYEBVtoLmfhSRk3cPnGnVygv8nmiKBYfaFrTpCDexvxJbGKH2SftuJy1qKB094PeCh7VUReemgDErDXM/pBXCuGNW0pPLbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508621; h=Content-Type: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=UM/pcylz8F2ywrL5YzbgYZuad5efRC8/J6GmKcjAKuQ=; b=DfXxPIVDoBxodKCIljlJtTR6rJOgVu1pZDe7h3kpsIA7l5VC2d5Da88X0FsykIVrPRjkp9BhXDxxDk8vQhmnHkiNd9Vdm9BFTG3S5q3SFchgLBHkwhaY2pMrNltOAtblIGZPVb1kZe5FVrbQ7VQz82RMEFQAwPxPkB0VZn37ujg= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508620707121.05540370352378; Thu, 1 Aug 2024 03:37:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAT-0003aJ-Sc; Thu, 01 Aug 2024 06:36:21 -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 1sZTAT-0003Xj-9I for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAR-0001bR-Sc for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:21 -0400 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-370-hPEz-PkLMm6mJUTQcIJaAA-1; Thu, 01 Aug 2024 06:36:18 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52efcb739adso1230455e87.2 for ; Thu, 01 Aug 2024 03:36:17 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5b64c074f9fsm1682515a12.97.2024.08.01.03.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UM/pcylz8F2ywrL5YzbgYZuad5efRC8/J6GmKcjAKuQ=; b=M6ISxgPIEbQEXNGs76gAzHPIAf7dCYTuylHtN5EZRKBLQz7SkNDwBKOhsjdhWdaj1lHide //QJCb7DPpSZXc6M4nfSK+8ne20fjev/rxY4QGtDGHr/VEhOjGXfyGsXc6plejQa2FJTB3 /78DxMQHRyEkeFHlEHPBoBJJC9NUDhM= X-MC-Unique: hPEz-PkLMm6mJUTQcIJaAA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508576; x=1723113376; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UM/pcylz8F2ywrL5YzbgYZuad5efRC8/J6GmKcjAKuQ=; b=CbVe+gD/T3zzo9rCi8Kb1kC9M6aEFuVOHXfSIhON7lJ8IuY83vzzPWBLO5OkOyCgcD JEoyPtCT19jfUx3aS2C7jDGL3F9VfACt963iLbiWZVJaoueacrsSmc9GVAPM0LwQXYls Um//DXs/u6uTJE+G5sgFgddMsFCQKkrvO+5CPPkdoZsYw+ig5DV6JB0Cfn0RYBDfuLkL eG7EC1xofiP70K3YkXlYk68WFBwwwp3mEQlJeKdQtwBbJt+8pAop2Yum8h7kgUbEbHAq MPL6iLpWVVGjQOKTSPRo0JbdfCSgCow5bdUdsl9NexvhJiuXLArIVr6w1PLdXhYhOOEg 7m0g== X-Gm-Message-State: AOJu0YzZis1NwEhQnztWfQlDKd7HDRS3qRyhtob0aWSvlgR/QUxF55q+ LUtkXx2tTxv78hwJSI+GiinyJtoYAzi8d62rnZDM9ZgxrI8Bk4gBxubj/QIKVeWwTpF5dUE8cGi QWxZrZozujovn79JOT/jHUvWBYgKs1Y2ikIqxakSm9rM+8l0Hy6D/OY6ICVa5+mbB1Vec/67ABy 6uWh8x8U65tJrw4qTXy9uSaIs9FhSlLQ== X-Received: by 2002:a05:6512:3f08:b0:52e:9c0a:3514 with SMTP id 2adb3069b0e04-530b61ebfb2mr1277828e87.44.1722508576207; Thu, 01 Aug 2024 03:36:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGh0PrB7EfhlOroEgFXg5fSnOn/bthGEE7TXKNUV/XEolw7G182/qfdPkLYKaDHgFO6jK0CmA== X-Received: by 2002:a05:6512:3f08:b0:52e:9c0a:3514 with SMTP id 2adb3069b0e04-530b61ebfb2mr1277799e87.44.1722508575332; Thu, 01 Aug 2024 03:36:15 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 07/19] Revert "pcie_sriov: Ensure PF and VF are mutually exclusive" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508621384116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 78f9d7fd1989311040beff54979bcb2a1ba0aff2. Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 6c79658b4c..56523ab4e8 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -42,11 +42,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, uint8_t *cfg =3D dev->config + offset; uint8_t *wmask; =20 - if (pci_is_vf(dev)) { - error_setg(errp, "a device cannot be both an SR-IOV PF and a VF"); - return false; - } - 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; --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508622; cv=none; d=zohomail.com; s=zohoarc; b=IU/LiwLjozifLtOskd7SsIsPyS63R0omLwUPgk7o0W4r0t7943hIDRMpYXBwkkZ5eXrZ3bJtIwk9qFcZoybmStJkIvEvmW5v0tmvnlGPevLignKjkxsvGmNz9xpwCT3E8hJnJWgB+CHqKi1hBvy/j+Yghq2gyMaiEJr0fSZ89pY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508622; h=Content-Type: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=SekfldKxDjaLjrGHvZ8eOZLUMSLhZFBP5+JICVV9W20=; b=hmxnnvPH3gLkFMPLa+2DxOxj2kwCwomIJQsQlWoYNnacYZN9aN01ncdRIVUeIU+0gsoWdOuZ/+Mzh0ry+dvIWNlv71k1tzCIc/ibga7vrSfp9HppDYR3sltxBkx9+u8eXGiIAUBoH2PEWCowkdiDfBXrx9GSUS1BS7hKskY6u5o= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508622655272.2866245168989; Thu, 1 Aug 2024 03:37:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAs-0005Rk-En; Thu, 01 Aug 2024 06:36:46 -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 1sZTAb-0004WX-Iv for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAa-0001d8-6H for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:29 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-JxFfJVbpNByxLfGXjsk_Ug-1; Thu, 01 Aug 2024 06:36:25 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52f00bde210so7588295e87.1 for ; Thu, 01 Aug 2024 03:36:25 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad91eeesm889918366b.178.2024.08.01.03.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SekfldKxDjaLjrGHvZ8eOZLUMSLhZFBP5+JICVV9W20=; b=YhFqISWD+n/sVFWoNThlA9FirooqN/egm4YMVbi3jpaH0+1GhcW2lv2lXs+u50uv3Vly8z wQd21dFH0Xo4DOGKNAO3taVivI3lcqjmZsFaneRcUAvMSBgCbrxjhiL/n8VAYeJ96FfWz2 baepXWl2+gkN4DdKt562Bco175XLj54= X-MC-Unique: JxFfJVbpNByxLfGXjsk_Ug-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508583; x=1723113383; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SekfldKxDjaLjrGHvZ8eOZLUMSLhZFBP5+JICVV9W20=; b=XYTJ07RYEZxWI7/5kH+vnxPvYnu2sFMBd3FtOsv7vQt3L6y6iNhDUo9lLCfDvyRTBZ hfHbulrp0dh4N+nVkxs4KqMk55C+Fsl2vWpUkL+E7GZFTiB/MSrRV4xdMEj+VLdQg1F+ nuSoJQWZRoQCBpXA4Y+C6xaHFf+BivGJGhSYDi+1ZNVye7p7KgfveuO7S8H/tliXJNnC 8tJ9Die4o51JDEciX5dFCijZArm2f7fnscqtH9YTq92lrekNpWvrGdn/fayILyrVT2qo d4F6n7WXZ2QaamsI8W6ODDVwdod04saPq66H1S9uruTke7ActZq7okn9LJspaeiBSmjO HVSQ== X-Gm-Message-State: AOJu0Yzxh926ud1cjfd825TsbdBeagCLemNPnhVFIeROczuF2aMSiJT9 60GI9HdUfTdEMwl5Mztf+aasp1e6BV6HMRiOlKbhftmg0xOxanNVnRtvIOIIBDRVwGZGSJJ0rwo MMmzWta+dtQdKlrEA+MemYcZjq9va3zaKwjuDJX3vCgq1uqdvmixx2oNFLn6L1IVPCqQQpvQZXX +uPsJnB3qSkMBfRevPJ3AwOXw5oMjIYw== X-Received: by 2002:ac2:51ab:0:b0:52f:c10d:21f0 with SMTP id 2adb3069b0e04-530b61f68b3mr1168349e87.54.1722508583183; Thu, 01 Aug 2024 03:36:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwHUbeue8zsMszWxUzuuSQXlDjohDBz66f1DdkpVHCr5/zuYq5qBcZ5ZXPH4wvfoYR8iwtxA== X-Received: by 2002:ac2:51ab:0:b0:52f:c10d:21f0 with SMTP id 2adb3069b0e04-530b61f68b3mr1168303e87.54.1722508582280; Thu, 01 Aug 2024 03:36:22 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 08/19] Revert "hw/pci: Fix SR-IOV VF number calculation" Message-ID: <558452512f068bfb3584a5a8b15530b0c53074c7.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508623525116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit ca6dd3aef8a103138c99788bcba8195d4905ddc5. Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index cf2794879d..4c7be52951 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1437,11 +1437,7 @@ static pcibus_t pci_config_get_bar_addr(PCIDevice *d= , int reg, pci_get_word(pf->config + sriov_cap + PCI_SRIOV_VF_OFFSET); uint16_t vf_stride =3D pci_get_word(pf->config + sriov_cap + PCI_SRIOV_VF_STRIDE); - uint32_t vf_num =3D d->devfn - (pf->devfn + vf_offset); - - if (vf_num) { - vf_num /=3D vf_stride; - } + uint32_t vf_num =3D (d->devfn - (pf->devfn + vf_offset)) / vf_stri= de; =20 if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { new_addr =3D pci_get_quad(pf->config + bar); --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508680; cv=none; d=zohomail.com; s=zohoarc; b=AzIykIMr4fqTWPDp2DZKAUTFsgR75ehg4mo/JeJehLdEMVBtzneIuRo9b+kp1C0ED0VttEVugGogfMq3xXiT3JfWJVAlyHujD0wqrNCXrk7zsVROTimifgIikrYbVxqAgRtonWO/GI3J9xXF0DO1O/YsQ5p5K1gvqiRo14rTeTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508680; h=Content-Type: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=YZJrjrbWqX6EKULFw0AJWSDhkMqAw8uHUBrOGrGavqw=; b=c+hlfcoIVNDdsJ3VaJfVkMX+cRJuZlfVJbQZJZ7Iwq0eyPpYhC/6Z2ENrxPQdD3gE86vgEyZlBo9tZLmzQ5hjgHCyhVub0kkcNX32zVqtS5atLCFMrpdATFMrTD3pu4Zblb65slpZFEg8i4qCIRNVe3Fo+ycpRYabJa8OAsZhfA= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508680592640.3691315530989; Thu, 1 Aug 2024 03:38:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAt-0005u2-TW; Thu, 01 Aug 2024 06:36:47 -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 1sZTAi-0004zi-6i for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAg-0001fi-Ov for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:35 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-241-QL1dfpkCM4CPBHoWNfx-aQ-1; Thu, 01 Aug 2024 06:36:30 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a77f0eca75bso627675566b.1 for ; Thu, 01 Aug 2024 03:36:30 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab23094sm880206366b.5.2024.08.01.03.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YZJrjrbWqX6EKULFw0AJWSDhkMqAw8uHUBrOGrGavqw=; b=OiVEX86bOPZ2cb3Av66pDFUXqKGNk0oP4aEt6GRS/S6K8u0ahsnhiwxer+UUZWcZcZPTeW c76gDTpe9OdE+RFk4J6Y6yXxFLiJhZos96dBL/8H9TM0o2TRfCS3FKlY4TyzAZWqWYl16e 8O8H/iU0H7YfVVsO31MP6qKVbknhjRE= X-MC-Unique: QL1dfpkCM4CPBHoWNfx-aQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508588; x=1723113388; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YZJrjrbWqX6EKULFw0AJWSDhkMqAw8uHUBrOGrGavqw=; b=VQQxMBJJfBUPz9zTSnNYHn9kmfXw00MRIfCsa5vvVFoMcUXu6CzcKKxrU6163W40o5 ns9QigBQ9A9/3dIOnBQu4cD6nB1ccn17GkGeyb16ush1ROqCHtqLLMC1hI/sD4CHSgn6 pt2Jn8264dct3LbXOGJgK2uOxyiKkWfO3b7XqLfVAcN5pNjsc7uY1Ybzj9Zb7XKJhiN0 6KOxpTUprKL2Khj8/7OzstDrgq/eTC8ft95l38e68Pm3jsZOPXxZO+GYIqveOxO6BfnJ O4KI9kXejSStTyVWTS1MS27QF15DXS0Gy9xFKL9WSknysuv8tFO7GIMF4lDXn57kFGED 82ug== X-Gm-Message-State: AOJu0YyIvFxCJzBfhclsriyrlXiAe4trPNpT24fNdC5MGEqOZskgk62+ IGKK9l4fX3HKFgTMtY9p9N4lmCAk3DUHwb6HB7FaOCQBS0ZyB3mhlbW21xpOx+QfPTK3goO2aUS c4LGQO0wCg/VcM3WRpZFrxjMCJpxJ33cE+WUsUDaEi8WgsmotQnlx58By7RDvV1pdvmpeKbnMYt TP+muvDcHdaVx++yQwNmn0NVV8dzqW2Q== X-Received: by 2002:a17:906:dc8b:b0:a6f:5150:b807 with SMTP id a640c23a62f3a-a7daf50c41cmr193577266b.35.1722508588276; Thu, 01 Aug 2024 03:36:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFd18rHx+j/26V/QAfEH2YP3UUT1TYMFZURiIRIYE5oZa0GlT6OjfOWdJboo0fN+s5BfCZE3g== X-Received: by 2002:a17:906:dc8b:b0:a6f:5150:b807 with SMTP id a640c23a62f3a-a7daf50c41cmr193573966b.35.1722508587674; Thu, 01 Aug 2024 03:36:27 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:22 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 09/19] Revert "pcie_sriov: Register VFs after migration" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508681670116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 107a64b9a360cf5ca046852bc03334f7a9f22aef. Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_sriov.h | 2 -- hw/pci/pci.c | 7 ------- hw/pci/pcie_sriov.c | 7 ------- 3 files changed, 16 deletions(-) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index c5d2d318d3..5148c5b77d 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -57,8 +57,6 @@ 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 4c7be52951..5c0050e178 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -733,17 +733,10 @@ 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 56523ab4e8..fae6acea4a 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -252,13 +252,6 @@ 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508720; cv=none; d=zohomail.com; s=zohoarc; b=AXP3Kn1XirmxRMkabUg+x/w6yyitmppY/chVbI+AQgunQP5jbhYBw3BCREIdhcHX6sHL34RhuauI8NKTpG4/AM+ojHYyoguBj/0xcdHu0YAFh9fFuRHEjm+2wrbD8aV+Fg3p5rlCUF5jS3FMLM9LSvl4VpsaiTSRm5d+aUhybAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508720; h=Content-Type: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=G4QMeU0+8DoiMY9SQEvoe2ryIifTYQOkCLesk2LGT2U=; b=NAtxtYPx5jhWxY63r9nlNqn9zwHnI/LpUqDfvvGjDa+YkQAhicvXfXptQvtKXXXf2ucMO86nzRmiRLw8emLC0K8BXC7YDVtN6Jc/RUnxRklCW2XJmy8hyddIatS8/NhKDRalskbDgUhL8ArhhUc7E4Te4xaH6eXfznswsNqwJq8= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508720951339.6188941568047; Thu, 1 Aug 2024 03:38:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAt-0005vj-Uq; Thu, 01 Aug 2024 06:36:47 -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 1sZTAj-00054j-Fu for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAh-0001fq-LV for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:37 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-Np6eLwWZPnijI1cgGKu1tQ-1; Thu, 01 Aug 2024 06:36:34 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5a3fa8b9151so5988073a12.2 for ; Thu, 01 Aug 2024 03:36:33 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590d81sm10069517a12.23.2024.08.01.03.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G4QMeU0+8DoiMY9SQEvoe2ryIifTYQOkCLesk2LGT2U=; b=REwsM0ZkBNLqFF6vrCbGkBUOEoVKdETTKABkM5lt3MwBZLbNn7fSbp/LB+/I48Brnli9HY YGuwD/yhw1rM+Vr0wT7WsJFkC8Z4Yy4JV/IJdDduVCpyxsyxkJ71Z+L/QJm6tDhBKYecM+ Nk+fyuEZraUMP9Ln7q5a7RP9D0ySFic= X-MC-Unique: Np6eLwWZPnijI1cgGKu1tQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508592; x=1723113392; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G4QMeU0+8DoiMY9SQEvoe2ryIifTYQOkCLesk2LGT2U=; b=hIGAmGV03Ig+TmTsrDqbCrccdGpKKCfJd9TVsHfxdYVpexHhNJ2GGiNFzQXL7HLylf DTnkYtQssj4+BOKz7FPN1utidCJSt5Qe2FBwZhjLMizYpGKVEywlpZ892XLJbqEuu5sh kZkAGXGRSSSqAnuYuWRbZ8UojsOZJG5zo9KZPPCQmxBTX0MhlhVi88e3zRNrOyPwUUWg nupbbbrUpzGrKScajEmA6BDntd8K48cp8JeZ+5WMQ8jIRN44KveM2HwvQJ8fHftczeD3 MrSH5QOHVs4F5nPZjymskv824qRKpiPCKMP/pvqJ1TF1+Nico+4xgeRkm3BKw2DPzOS0 Oifg== X-Gm-Message-State: AOJu0YzdUEgNdr5h7ybzcujpKI/5MTThA1iqFMf1vCWjDFzMNP//jIwo KU0nk7JLpESgbvIlqmdpa0H2hTop2i0iorN1n1tHiXnaBoqR94K+vVzi7Ks0qR1VSwrXWkHPboR bkLPdvjeSe703a/bhTdURJLf1xjG3jVxFvhkBy0djO6L69HR+1+kA9qZhUkEsWPKIeJ0HoxbTjv tk6iNlHSMIt1LpVNGcS0hexvwlQmFnVA== X-Received: by 2002:aa7:c142:0:b0:5a1:eb48:2b9a with SMTP id 4fb4d7f45d1cf-5b7003d7926mr1320393a12.25.1722508592515; Thu, 01 Aug 2024 03:36:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0KIqZ+Fu+Sgh15KrbEP6wF8b4nDwpPxLL90QvxVwzoE6lZaUaUjdMowqYjpd/ZjQVUhyM3w== X-Received: by 2002:aa7:c142:0:b0:5a1:eb48:2b9a with SMTP id 4fb4d7f45d1cf-5b7003d7926mr1320358a12.25.1722508591757; Thu, 01 Aug 2024 03:36:31 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 10/19] Revert "pcie_sriov: Remove num_vfs from PCIESriovPF" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508721826116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit cbd9e5120bac3e292eee77b7a2e3692f235a1a26. Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_sriov.h | 1 + hw/pci/pcie_sriov.c | 28 ++++++++-------------------- hw/pci/trace-events | 2 +- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 5148c5b77d..70649236c1 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -16,6 +16,7 @@ #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 fae6acea4a..9bd7f8acc3 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -57,6 +57,7 @@ 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); @@ -185,12 +186,6 @@ void pcie_sriov_vf_register_bar(PCIDevice *dev, int re= gion_num, } } =20 -static void clear_ctrl_vfe(PCIDevice *dev) -{ - uint8_t *ctrl =3D dev->config + dev->exp.sriov_cap + PCI_SRIOV_CTRL; - pci_set_word(ctrl, pci_get_word(ctrl) & ~PCI_SRIOV_CTRL_VFE); -} - static void register_vfs(PCIDevice *dev) { uint16_t num_vfs; @@ -200,7 +195,6 @@ static void register_vfs(PCIDevice *dev) 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)) { - clear_ctrl_vfe(dev); return; } =20 @@ -209,18 +203,20 @@ static void register_vfs(PCIDevice *dev) 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; } =20 static void unregister_vfs(PCIDevice *dev) { + uint16_t num_vfs =3D dev->exp.sriov_pf.num_vfs; uint16_t i; - uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; =20 trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); - for (i =3D 0; i < pci_get_word(cfg + PCI_SRIOV_TOTAL_VF); i++) { + PCI_FUNC(dev->devfn), num_vfs); + for (i =3D 0; i < num_vfs; i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } + dev->exp.sriov_pf.num_vfs =3D 0; } =20 void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, @@ -246,9 +242,6 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t a= ddress, } else { unregister_vfs(dev); } - } else if (range_covers_byte(off, len, PCI_SRIOV_NUM_VF)) { - clear_ctrl_vfe(dev); - unregister_vfs(dev); } } =20 @@ -311,7 +304,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 < pcie_sriov_num_vfs(dev)) { + if (n < dev->exp.sriov_pf.num_vfs) { return dev->exp.sriov_pf.vf[n]; } return NULL; @@ -319,10 +312,5 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, = int n) =20 uint16_t pcie_sriov_num_vfs(PCIDevice *dev) { - 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; + return dev->exp.sriov_pf.num_vfs; } diff --git a/hw/pci/trace-events b/hw/pci/trace-events index e98f575a9d..19643aa8c6 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) "%s %02x:%x= : Unregistering vf devs" +sriov_unregister_vfs(const char *name, int slot, int function, int num_vfs= ) "%s %02x:%x: Unregistering %d 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508661; cv=none; d=zohomail.com; s=zohoarc; b=M2V6V3McW3+Fp1wqdg5CqlPsjT7sPGa3gbDvQ1gieR/gNiC9+Jqo2+3rcCRSFN0wo6qOGnf2YOpgAxHYwwDY+OTnq9TsBn8Jj77xHbTyQl1cHriQLJiwg/CadFercpqgjVHOpPqZaokfxGMYAXHqfDX7OF8Rgc8PPTrHUcaksDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508661; h=Content-Type: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=KkHPmgwBXR83hmpRdf4peeHnWvvgF2d+14hJg8f9R0s=; b=LGOwYZAjAShcIe3HByxm78vTbxE+l3DEU2WhmzMrIm6zpB6T9pSFE0mzFAndMnyPZlwo26bSbEqOD4mL6mKfZnNz7HxCZ9rITO8CXMyzwxK82TJZh8QtRKIBymzw9Vnj+yUxMSRO/LqjPlgJrOdeI2Bmi3F9t/dPpo7mGOt8lPg= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508661949494.97661662533494; Thu, 1 Aug 2024 03:37:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAt-0005t7-Tv; Thu, 01 Aug 2024 06:36:47 -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 1sZTAo-0005OS-W4 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAn-0001gm-FU for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:42 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-vaI-UWSDPui6dbeXtDNhaw-1; Thu, 01 Aug 2024 06:36:39 -0400 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a766a51b0dso7447873a12.1 for ; Thu, 01 Aug 2024 03:36:39 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac631b0395sm10040635a12.20.2024.08.01.03.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KkHPmgwBXR83hmpRdf4peeHnWvvgF2d+14hJg8f9R0s=; b=ENlFUZIgB2Ul6hJiorlV6Yf6elhD3bg5ED7g0zg2DSo69xGg3MFtjL0+OW26Cgfh/CtjLW 4L75i+muotGn3yS7/I1KwDkC7fpxT3Ioizv8vECoA2yW8yc4WG7zbDcl8nsFfdX5KtAskv msUkAvNGbESFjD7eyv9ZtrVo/zPx8II= X-MC-Unique: vaI-UWSDPui6dbeXtDNhaw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508598; x=1723113398; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KkHPmgwBXR83hmpRdf4peeHnWvvgF2d+14hJg8f9R0s=; b=BLS1dqvT6lPpxoBlhmZz+NLlxFWAXYXYv/9HrP+Gp72Gj/H7mVekZ+kbwPKLZiulcE 3AhjIoAnzoa87BrTlP43u/WMg4XH9dvr6EcOiYxImp6PYJRt1EV66DqrzBpv7JSKAiTq b01AOx2dWFXwS8rURU33lpkC8iNjZEwW7PEyqa8VqC6+dHaSWaybIcmgLW0W+K/oBGSx XFe5X0BNAyE6L6sJ+jcZLS6wBR+5LuRw9YR7iPtzqbCHqahoQb7/EeIrDonmMjCxD7Ug PXv7jfDbuw7Z/+1Hb2pUpeeK3G/NKZHbosLcFWVGHJMX6THyaYSqDxF1AfrSoJScUPGd nM1w== X-Gm-Message-State: AOJu0YxvKIe+KbdePWgD+wuwrW1B9/U9dVE1U3TVRynR1hdlM/XVtHrc +jZiJT1CEHf+ob+qt78czBSzbVF2w0IeM8cJVZZM2ekJMh8N4zKvgN71yx2U4OXtnwRQCqIvzYd jf4IWjP3IJY4SeTcvkB5fG78A7UZq0dyVg2pfZzkkDFhdkQ4kbbEB/hLtskHRzgnX80PMUT+AT6 darpjZ2hXPtH96/j3/4CFEOLo3zDq3Cw== X-Received: by 2002:a05:6402:104f:b0:59e:9e8b:f6d with SMTP id 4fb4d7f45d1cf-5b6fe52dd9bmr1150665a12.2.1722508598047; Thu, 01 Aug 2024 03:36:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ/rrLhrx5z69phBz3eiWDIy8ROdi9xooEqTrEgeLYfXIio6t1PQ4cqydl8Y7/H4U7Vu0kMQ== X-Received: by 2002:a05:6402:104f:b0:59e:9e8b:f6d with SMTP id 4fb4d7f45d1cf-5b6fe52dd9bmr1150645a12.2.1722508597317; Thu, 01 Aug 2024 03:36:37 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:31 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 11/19] Revert "pcie_sriov: Release VFs failed to realize" Message-ID: <9bab08da4e932e9c95919951792ae09d0a59f726.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508663578116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 1a9bf009012e590cb166a4a9bae4bc18fb084d76. Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 9bd7f8acc3..faadb0d2ea 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -99,8 +99,6 @@ 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508641; cv=none; d=zohomail.com; s=zohoarc; b=L9yjon0f3SzN9gk2BhfoWJb3TJmi2gShuQiFTKenQRU6WovIbmfclIh3hm3yjBZQFldXDBvYcXQh0kol19Hs4th5tMTpgdjPdgPLP6nl65mnkEWHv8uTKTSJlV+RWGLDmJUim0EDrI/YxkqAb05tXnMTI1lxcD8s2AvI1xw/xQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508641; h=Content-Type: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=hRCx2gCZ+ZzoKrIRZlzKc05euagciJr8hV1RAZGu1aM=; b=iSu3QTamb6U+KYOX28rw1K1OwhEaX+bVHAV4G5g695R8oKu9QagG0uzNpgdS6KNblNSaPff6xjH8zSne1kACa90P1KSllRzSKskhbh27HQUUcQbMu3BJRwpr0YbawAHcSg0gfXBAhpwTsXQaf2TFMqQaQy0ZAhT83NuvtaYr/Wo= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508641673878.6472152401846; Thu, 1 Aug 2024 03:37:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTAy-0006jt-RC; Thu, 01 Aug 2024 06:36:52 -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 1sZTAx-0006YQ-IU for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAv-0001in-Ju for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:51 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-620-5u6Esno8MTOM267ap-nOUw-1; Thu, 01 Aug 2024 06:36:45 -0400 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a16fae2ba7so3876925a12.1 for ; Thu, 01 Aug 2024 03:36:44 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac6578356csm10130110a12.87.2024.08.01.03.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hRCx2gCZ+ZzoKrIRZlzKc05euagciJr8hV1RAZGu1aM=; b=KMeACFgztfcRN6zxqeXJIADU5qUGg7xhyszdvvzrO68evAERaacEa6ZKpYo9hE4zYznBnG retsMog3cFp2qrsVbm5TCDCzXlZT6ULw1S5vtIuChGbNNv1xZbvmiLWkpYshnhFtm51SfU /7gdYJUrucSaqEQLKJzQjvIXAyY8QUc= X-MC-Unique: 5u6Esno8MTOM267ap-nOUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508603; x=1723113403; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hRCx2gCZ+ZzoKrIRZlzKc05euagciJr8hV1RAZGu1aM=; b=whGjvNEP5NtwLj7uxPure01FCK66eH0BdNn2r76qNzOLrSkb4xdh7qW7aSYGgzza/k CA4Vx8yBxavcdqOlJsbUghzQUVcAeYr3kdFmKAz+fptWTbCtfIuwUucZNKzlBT2I+bbE pC/SWrfUrzpwWlH/N8vkJAvua5//MNdQIvk2AXYbPjM7gLX9KPuZp9lbzS09lBTCtywQ ZTAN4IVoUoAtB6GIWDyt8qYHQsb7yqeC4C/Zwco76qiuMyaQ493Y116BNuFRytdtbRzF 2toKfW9qk0rhYvoIzME33CVe8M93WXwJ0MgT/BOrkL6+e+abkLR85tyvhBPpEGhPzGN1 2Qsg== X-Gm-Message-State: AOJu0Yz5NhlJSMUP60jimoCQZ8FMJVr+tBQKnYpAqHMAICKH1v8amjZs RgRKiOpAM/ifUsa2+3/MbeKUSI9UawjnNkNNbFwJ9UVZGptSut+8zoG9q3qR8GK+V049NYWnCOc ZO7TCykjIK/jELB32jxqOg05KXGwdKdV+cFG/BZbkIZh2JmqnvB8sYc4ekD1CGahlaJc6rnIq1Z 1PDarsbo0B4z8YoSRtSNxsUQi3BHzKdA== X-Received: by 2002:aa7:c391:0:b0:5a2:c1b1:4b9 with SMTP id 4fb4d7f45d1cf-5b701279a87mr1188389a12.35.1722508603068; Thu, 01 Aug 2024 03:36:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9++EKZI5TYsnSbZ001Ilx+sA0qJkX72C8/8C8Z02bJ4Yu48d1cG50ftoemOsQ+YOTwei4dw== X-Received: by 2002:aa7:c391:0:b0:5a2:c1b1:4b9 with SMTP id 4fb4d7f45d1cf-5b701279a87mr1188363a12.35.1722508602388; Thu, 01 Aug 2024 03:36:42 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 12/19] Revert "pcie_sriov: Reuse SR-IOV VF device instances" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508643524116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 139610ae67f6ecf92127bb7bf53ac6265b459ec8. Signed-off-by: Michael S. Tsirkin --- 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, 62 insertions(+), 56 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 14a869eeaa..fe04b4fafd 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -680,4 +680,9 @@ 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 1ff3ce94e2..f38fb31119 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -212,21 +212,6 @@ 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 70649236c1..aa704e8f9d 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -18,6 +18,7 @@ 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 5c0050e178..b532888e8f 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->qdev.realized) { + if (!d->enabled) { pci_device_reset(d); } } diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index faadb0d2ea..f0bde0d3fc 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -20,16 +20,9 @@ #include "qapi/error.h" #include "trace.h" =20 -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; -} +static PCIDevice *register_vf(PCIDevice *pf, int devfn, + const char *name, uint16_t vf_num); +static void unregister_vfs(PCIDevice *dev); =20 bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, const char *vfname, uint16_t vf_dev_id, @@ -37,8 +30,6 @@ 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 @@ -58,6 +49,7 @@ 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); @@ -91,34 +83,14 @@ 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) { - uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; - - unparent_vfs(dev, pci_get_word(cfg + PCI_SRIOV_TOTAL_VF)); + unregister_vfs(dev); + g_free((char *)dev->exp.sriov_pf.vfname); + dev->exp.sriov_pf.vfname =3D NULL; } =20 void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, @@ -184,11 +156,38 @@ 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); @@ -196,10 +195,18 @@ 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++) { - pci_set_enabled(dev->exp.sriov_pf.vf[i], true); + 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; } dev->exp.sriov_pf.num_vfs =3D num_vfs; } @@ -212,8 +219,12 @@ 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++) { - pci_set_enabled(dev->exp.sriov_pf.vf[i], false); + 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; dev->exp.sriov_pf.num_vfs =3D 0; } =20 @@ -235,10 +246,14 @@ 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 (val & PCI_SRIOV_CTRL_VFE) { - register_vfs(dev); + if (dev->exp.sriov_pf.num_vfs) { + if (!(val & PCI_SRIOV_CTRL_VFE)) { + unregister_vfs(dev); + } } else { - unregister_vfs(dev); + if (val & PCI_SRIOV_CTRL_VFE) { + register_vfs(dev); + } } } } --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508638; cv=none; d=zohomail.com; s=zohoarc; b=aD1emhc0r3S6VhfVfs1QWNHGphw8VWP8Z09nYdmiOSQxr/FZ2KIOArapZMiQT5h1Y3p6Ll5WPu1xrH9T1NpmiYAm80RMhraLWzw7pxB0PxowkS/W84dT6emmjICdEV0Frrutt204pf5Hn+ewhJn1+TtDOoT9J1E01qJE+OyDlPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508638; h=Content-Type: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=n9nPduN4HntJk65ImfCAHcmgUilYqHVhP2ou2W3VzIM=; b=C+AnFOaV60bSldlWSe87ep/rewzVOB1UyYioGzGG+U6jcw5Ckx71YbMshKNYRlRYUaJ1hDnACetOjNUHHQbDunmaoQk4jgxXjV7nIqI1QHPj65U/DSOIuzQ8PV5bmrADYfV79epUWlRI/W7rbPH5KBfeJ7S9hoia/sOHsaQgd+A= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508638655299.4571053978308; Thu, 1 Aug 2024 03:37:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBE-00007X-BH; Thu, 01 Aug 2024 06:37:10 -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 1sZTB3-0007ds-7Q for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTAy-0001j6-5N for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:55 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401-0A3HblJMMi-c85rdcLG2Yg-1; Thu, 01 Aug 2024 06:36:50 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5af95f7d65bso4834308a12.3 for ; Thu, 01 Aug 2024 03:36:50 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac65783621sm10107893a12.89.2024.08.01.03.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n9nPduN4HntJk65ImfCAHcmgUilYqHVhP2ou2W3VzIM=; b=i9WuGSZrlaAiTgkcpVZrHCv2eZuZRQn6KG6r6yu4dQeexzpwvpp1MpIlQpQwGjqqhJwFA4 fYs0Gvff6GtYhtp231+1HJFtiO9HKSVlZchrwqFeY8hm8iGmCkwHQCPBa09OaMUfFoF3jp OFZEPDdLuVtsAMa1I78yHi/E76cz+cg= X-MC-Unique: 0A3HblJMMi-c85rdcLG2Yg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508609; x=1723113409; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=n9nPduN4HntJk65ImfCAHcmgUilYqHVhP2ou2W3VzIM=; b=mflfpY/QKR+kfO734L6HPmOPC3Sx9wm1YOeZITdP3N0FfHIYQAzOCo2/DBzQCQ9pfk rJDMMx82VjcWPHRucOi2sqjITzSbSD08+s92vQKCwJYb4/R3GgVT/BEYGeMN9Pxi2VEX H9n6MGJqkBqm2LeXiNphQPus0RegAxD9xsULSJ7nPhSFr2oY6FT/pyjUMIDdBxBO2XzF kSadXD3QS0P2VQL+Kr+aNZC2Ljnr0KvjZujmGhXqyMMXOpHVUjrWlyLA0N7lwGZE8bdI cgv0TNUydyZOcXvoLiRcysIXk1UOqHABORbd3Qzi6LMCZz2QwGEpobFtYzBEskFgoiyx 95WQ== X-Gm-Message-State: AOJu0Yx04q5llyoQ8cISURAneyOuHtsCHVQZA05cg01ZD7xx/uHezy4n 8GFKF29eJ2H1/SuaB88PCuBmSJ7UvkNJ2wd27WExLREwShia/RzTpfVG+xEozMQsqaKcRqJYblf 4eQS8zwpVkJzNlrmav9aMT78XQnlym6XlyCvoVTvLTQ+KCHvsCFzA78wRpBjzK2yIhdDNPT50fy mEsXyGS+RFBoLysHfcad90hBEFNplJuQ== X-Received: by 2002:a05:6402:7c8:b0:5a3:b866:eae0 with SMTP id 4fb4d7f45d1cf-5b700b99e95mr1249131a12.32.1722508608732; Thu, 01 Aug 2024 03:36:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMbTARhiIyBpbWxXZgxeMVo/HhSZC1ys6S0y7QvAfYVsVWe2TsvHr3PHrK5lVW6bmm6ym8sQ== X-Received: by 2002:a05:6402:7c8:b0:5a3:b866:eae0 with SMTP id 4fb4d7f45d1cf-5b700b99e95mr1249098a12.32.1722508608071; Thu, 01 Aug 2024 03:36:48 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum , Akihiko Odaki , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Jesper Devantier , qemu-block@nongnu.org Subject: [PULL 13/19] Revert "pcie_sriov: Ensure VF function number does not overflow" Message-ID: <19c45c00dc6a52f80f27dabbd28de1b770c16a89.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508639946116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 77718701157f6ca77ea7a57b536fa0a22f676082. Signed-off-by: Michael S. Tsirkin --- 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, 18 insertions(+), 51 deletions(-) diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt index ab2142807f..a47aad0bfa 100644 --- a/docs/pcie_sriov.txt +++ b/docs/pcie_sriov.txt @@ -52,11 +52,9 @@ setting up a BAR for a VF. ... =20 /* Add and initialize the SR/IOV capability */ - if (!pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", - vf_devid, initial_vfs, total_vfs, - fun_offset, stride, errp)) { - return; - } + pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", + vf_devid, initial_vfs, total_vfs, + fun_offset, stride); =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 aa704e8f9d..450cbef6c2 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -27,11 +27,10 @@ typedef struct PCIESriovVF { uint16_t vf_number; /* Logical VF number of this function */ } PCIESriovVF; =20 -bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +void 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, - Error **errp); + uint16_t vf_offset, uint16_t vf_stride); 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 b6ca2f1b8a..b92bba402e 100644 --- a/hw/net/igb.c +++ b/hw/net/igb.c @@ -446,16 +446,9 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error = **errp) =20 pcie_ari_init(pci_dev, 0x150); =20 - 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; - } + 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); =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 e86ea2e7ce..c6d4f61a47 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8271,8 +8271,7 @@ out: return pow2ceil(bar_size); } =20 -static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offs= et, - Error **errp) +static void nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offs= et) { uint16_t vf_dev_id =3D n->params.use_intel_id ? PCI_DEVICE_ID_INTEL_NVME : PCI_DEVICE_ID_REDHAT_N= VME; @@ -8281,17 +8280,12 @@ static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice = *pci_dev, uint16_t offset, le16_to_cpu(cap->vifrsm), NULL, NULL); =20 - 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; - } + 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); =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) @@ -8416,12 +8410,6 @@ 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); @@ -8451,6 +8439,10 @@ 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 f0bde0d3fc..499becd527 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -24,27 +24,14 @@ static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, uint16_t vf_num); static void unregister_vfs(PCIDevice *dev); =20 -bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, +void 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, - Error **errp) + uint16_t vf_offset, uint16_t vf_stride) { 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; @@ -82,8 +69,6 @@ bool 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508668; cv=none; d=zohomail.com; s=zohoarc; b=hBc62j3Uu9S076t4A+N5Nqe7rkpj9FWNYhyYyFvCZ6E7xrcXbpuhh0BLbeN1LeblWt8xeW8kTV3t70cY5k9OafbI+fH++sCx3HwDcglmS5eEUGlMG1CNaAI2X/DZCdBZmdMyZL09yebklD+1VKliobTOEzecJGxHPX681h1y1rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508668; h=Content-Type: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=jqJ2fB0CQSR8If0y+CDtptnZsaPIw8Y6Eo12ycGDsKk=; b=LeuwTHcc0R1BIOwCQuZf8i0Qa49yWsealcLyG++s0KJR9+ygzo3eBgORWu+HSFQfKfc7RPv6Vy2brhGkwJKajqKmObOlXJpQTt3EwxrD7+JpEDyHqLgGVHOjY019lS1aqlGXnMzaEfk8HrQ5zMU+MUQ5ihZKxhVoMF/ULcIktpM= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508668494745.9009425517471; Thu, 1 Aug 2024 03:37:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBJ-0000sq-BW; Thu, 01 Aug 2024 06:37:13 -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 1sZTB5-0007zu-3r for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTB3-0001k5-MX for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:36:58 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-C5mLd4NQNZWs59WViagp3Q-1; Thu, 01 Aug 2024 06:36:55 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a7d6a72ad99so366082666b.2 for ; Thu, 01 Aug 2024 03:36:55 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab23639sm882511766b.9.2024.08.01.03.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jqJ2fB0CQSR8If0y+CDtptnZsaPIw8Y6Eo12ycGDsKk=; b=R5yVvBQnnuvzoEgtQ+ITvQjz31VfYWED+vWivX6r/q4BWtU+4TzQR9wEd6vSAZGkJjDO9H S9bFWvnVe2mz3/s+nA3QzVkqwIWDXGBwjt/SVz0PQImTGQgpjOCbdeUVhn1oPMVz5rRWNp WMNtTK0cGHB+SRsUQjozoMBXPdBpbXA= X-MC-Unique: C5mLd4NQNZWs59WViagp3Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508614; x=1723113414; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jqJ2fB0CQSR8If0y+CDtptnZsaPIw8Y6Eo12ycGDsKk=; b=TgayZhe3YqXa+40yGhcR45eC5xoLNGREIhzj/vLe8FBTL+ylMqIa+AJ+3jB7mcnmdQ 063ejFXzCWApC68WakJdPSf3EzxYwcoJGIoA6jpTMbgrSKCq7iGVy69boRqAIwk7ZfgM 2TOIxSlZf5NWmUQD+O0htnuir07p4/J/iWO0Jjvg/Yv7Cx3+uOk8skxRhKZSV6k0o8dy qFoUbBr8WPpMk0Kpt1ffJTbCO82eNb5YxWw/jtWsa65ZoDwCCM+L6mZZJzlEZclHfQQy wPTaAuBeqE2vWzUWA3bk3/KRAQ95RxiP5MD6hKlzDhw5Q05VNK0sRl0Ykmf6Ktq7k1yW xcJQ== X-Gm-Message-State: AOJu0YwjAHlPXHHxas/O5OBqX0WTUbfMm0MCBSPi9Wq6dcImgmDKwrdP hCKgEME/JHQPJdwhlZOFyND1XFyQlOOAvA84waP0WkQJxV5CaoM/OTf/RjiRnDTcyN9OrbDUgiz BT+u/KMwXmugcswZgHMt46bagFlBMSLbpD/WPO2lVGg2K93ZJhmBpEyHFukMwcik8jgiGB7ctqL z++IOOtZ/EWyCR5SWCGZ37I8LuJ2VTwg== X-Received: by 2002:a17:906:f58b:b0:a77:dd1c:6276 with SMTP id a640c23a62f3a-a7daf2d6ba5mr165355066b.7.1722508614509; Thu, 01 Aug 2024 03:36:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsFCYUTvIayA1LXb+HSqUWTG6GPj5F8M58mPmv3WulQW0ncxPRXZQVTPASZKtZv/S0CyYlyA== X-Received: by 2002:a17:906:f58b:b0:a77:dd1c:6276 with SMTP id a640c23a62f3a-a7daf2d6ba5mr165348266b.7.1722508613314; Thu, 01 Aug 2024 03:36:53 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 14/19] Revert "pcie_sriov: Do not manually unrealize" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.126, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508669618116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit c613ad25125bf3016aa8f81ce170f5ac91d2379f. Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie_sriov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 499becd527..e9b23221d7 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -204,7 +204,11 @@ 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508666; cv=none; d=zohomail.com; s=zohoarc; b=fRees/q3G1fnd33YLkC6NF25LxX0RIfrejtvVfzD3Khq1hr9/eD57HCCGyUhpIo8/mtRfkh0T+u9XKXd4piA6YCdq2HFlNimCJK78wIl17WNx0mq47zE79Yty7RIwrzQziRbN5cwukviEL8OKHvqkJ+n8lCW963vuxslp04P68M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508666; h=Content-Type: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=IHtvaqv/X1Y471mdHo9KCdjIxuFijXCK1FtuQT+o6C0=; b=fPVux86dn7pev/q1V2M7AJMv6pFmdSR99AmCbDMfp/6c1GYkUXy1GnZzMDQr38JIObfIex9QezQluWmqruUgcr4avYx7VstiTg6LOFoEAR10Ez4v2htvvxxOWPpKSBTnBA2ADDoJo/jg/AxDUq2bcRzwjWQHkqRUfKmhhqLaFSQ= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508666497692.961104905393; Thu, 1 Aug 2024 03:37:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBI-0000o5-W8; Thu, 01 Aug 2024 06:37:13 -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 1sZTBC-00009g-2S for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBB-0001nB-Ld for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:05 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-338-N5xjlR5BOViSHNBleo9NsA-1; Thu, 01 Aug 2024 06:37:02 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a7a8281dba5so545392266b.3 for ; Thu, 01 Aug 2024 03:37:02 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad90e34sm879705166b.164.2024.08.01.03.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IHtvaqv/X1Y471mdHo9KCdjIxuFijXCK1FtuQT+o6C0=; b=L8/eHWbCJ5mqQhIOyRiASxxEyj43tdITu0v5WQ3YIODLbSZrCyTLO7a+uxtq1xSrJr/XQV 6ycDsbXIp/5HKjTc8xGNa96bz2JL9qX8ziqf3xf2Ifowp0SsuCHTkgzRij4SBPoMRkUqLn pmG4aXuxSOjl+cZ6XNBgqWDis/87ufY= X-MC-Unique: N5xjlR5BOViSHNBleo9NsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508620; x=1723113420; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IHtvaqv/X1Y471mdHo9KCdjIxuFijXCK1FtuQT+o6C0=; b=VZfHq+peg2lHFcJFgp+P2Duoaw1qg06vsNyjiEt4BSt63ewB8hr68ahnNJqnuXUfx3 G9fxuhd/RwbcHtJ83L5nQMkWsOY/e/7jotZILmCFzdi9usSfSheTYAtFd35cfAy+Duf9 Ntk1x7wirhsIT0UuJhLg3qxx+Mw+C8YVyioIwmuG/n5+YXDpJlKXFNx8rzzANPcW/VfX 1DiGoeRPApPIU9sS3UGkP1u8iiQRZPydSfsSaKH5XjWvq0FihhnwcRtCgyeBpc+O0bj1 BtxaEwoPd6PzGYeX40/WesbdxDOYqYm3BQuVDUG+g1BzwrJFC1w2wlAmMBFiaZVx9qmJ wUWQ== X-Gm-Message-State: AOJu0YyiG2jD1xa3bsO7Ps66syh8sht+wlazjqdj2hMONT4IoHOiQoJT 5T6G4/wqfGuW/cFsJ2wdBrfbIRpSeUA/pxEvf05oaeUvdjTMZR3ii6/Mv05ytswxFpPcqEJsp9+ iQ32zNYaRHbeFQerKtwJWeAxST8AnkHQqeEkb5yWqh+NCmyFNr57IoHl2VyETXtZETkkpeXZs+I Kkiwqgp+OupfCC1O35efWFuEHsm/dnBQ== X-Received: by 2002:a17:906:f59f:b0:a7a:c083:8578 with SMTP id a640c23a62f3a-a7daf64e2afmr137518966b.52.1722508620061; Thu, 01 Aug 2024 03:37:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLWYoxcoR/JlQ2J4wfZ1biCfluxafhXlJFfCLYs6sbnB/lLllzG1P2auEUunJ/XBUhfsUTiw== X-Received: by 2002:a17:906:f59f:b0:a7a:c083:8578 with SMTP id a640c23a62f3a-a7daf64e2afmr137515466b.52.1722508619188; Thu, 01 Aug 2024 03:36:59 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PULL 15/19] Revert "hw/ppc/spapr_pci: Do not reject VFs created after a PF" Message-ID: <47279e8afa84cb28e84e3ac4392487b94a494fa9.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com 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 @redhat.com) X-ZM-MESSAGEID: 1722508667720116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 26f86093ec989cb73ad03e8a234f5dc321e1e267. Signed-off-by: Michael S. Tsirkin --- hw/ppc/spapr_pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index ed4454bbf7..f63182a03c 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1573,9 +1573,7 @@ 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 && - !pci_is_vf(pdev) && - bus->devices[PCI_DEVFN(slotnr, 0)] && + if (plugged_dev->hotplugged && 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508696; cv=none; d=zohomail.com; s=zohoarc; b=VT1m9e+xXOKbkzIwhwJ5QGtmXDCwgXSxEf1liykjJpS9ONRtW02lnzL3EmVsENHbsPRsq5AYRkFm490vBRcElmPeWPyK7kwBQMWYifEs4oHdXdQLqSmNaOJAkrwRv/D7PSUushldlwb8zDQyUBh8/H9AMO06fvTpfHAo9omijGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508696; h=Content-Type: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=KzoSSfxzFy/AltDiDJD12Ne8GvrHuuX1y7PZ7HvTffU=; b=YcNtqiwwS787Tp23Yz2tChB4vXuKaq/gP3GTmPYN+Tu+tS2mKGKtJgz059b9Js0jl8mT79/A5NTXc2MdKga8YVbtso82+HIvhsF/cxllD33lhINKnxTvkArBFSPf2YV2rtLbS1DlMdUpUiTQpi3WsBYPsDf2wRq59Utgw3nUtFI= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508696520103.74575676608731; Thu, 1 Aug 2024 03:38:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBM-0001SP-5d; Thu, 01 Aug 2024 06:37:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBI-0000hA-1l for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBG-0001p8-M5 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:11 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-AfM-eZEmNdajaST8dzTY-A-1; Thu, 01 Aug 2024 06:37:09 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5a54b18f730so5761749a12.1 for ; Thu, 01 Aug 2024 03:37:08 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590d81sm10070150a12.23.2024.08.01.03.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KzoSSfxzFy/AltDiDJD12Ne8GvrHuuX1y7PZ7HvTffU=; b=YrCksgqwa1Sv+P4rVk2yUuKc4ZvPd4Ko52ja3JR1cJna+8RSsxp2vIy3piP/pY1C6llzXh N5sixdAwZ3HkBk3EDI+aCzyvL71osfurXIhr2M7w/RplGY/1ZLAOX2gZdtdBNxXT/wGeFp 434pbsaN1q9tUxXNepPjFuiEUxpS7KA= X-MC-Unique: AfM-eZEmNdajaST8dzTY-A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508627; x=1723113427; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KzoSSfxzFy/AltDiDJD12Ne8GvrHuuX1y7PZ7HvTffU=; b=INtT9NmQSJRIEYIYFqGvarxUJVRd32Kn+itPm3ghUcR9FEzrymTTLjdzQ71A9xXXo7 hy1qiX6tWTyNjpD8a0ZB2YmfVbNMk4SC5Id6oMEogtLILoQU1jTYsHp0BA/Z0tHZEwRC H3OrtLHoBTb6NbfU/8DJSQc1g9jsb/qkgyy2S8snC2x0dGzWCPhyJMLcHuuISAOu+T9w Z2NRUyiACJ0z60s4hnx+W+8PfiV+uz2i/5Fy+Vt5dGsCnu05CjpX+e7MZWg9pKn8UXrC c2rvRVXkBaMYi1bP1ljizJNP4fYB17Rgprb5tJzK8EybYgnK/4IgzJ/tVaY4CT22+Fo/ 5fFQ== X-Gm-Message-State: AOJu0YwVxDOdpw65/mYk/vkyQYQCaj67bZHtij32e3JEk6Ikn6QqmU/X hhKyJaYePDgnAq4zxuzNOPtAQ5g74MRuiplnEBt93xwt6/RTGm3JiM4XJdUsJUSCTbpg0HxlZpV CYHXNxOkQDM+X7/w0dmy48V9b181gIAI7Fz+pJRdTmdzmdywYI1zZZEmF1RkRxJpU5whoMe5hqa /9zoru/QHdDf045pC3NhIynafYP9erXg== X-Received: by 2002:a50:ed18:0:b0:5b6:d0f1:2947 with SMTP id 4fb4d7f45d1cf-5b700aa032fmr1239339a12.34.1722508627198; Thu, 01 Aug 2024 03:37:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIvThHvMtW5sJoSerW+OyivBrC7gPTnkY8H/LEcq9gqSmskBYGETWwhDA3yY/wwQgACj85yw== X-Received: by 2002:a50:ed18:0:b0:5b6:d0f1:2947 with SMTP id 4fb4d7f45d1cf-5b700aa032fmr1239307a12.34.1722508626463; Thu, 01 Aug 2024 03:37:06 -0700 (PDT) Date: Thu, 1 Aug 2024 06:36:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , qemu-ppc@nongnu.org Subject: [PULL 16/19] Revert "hw/ppc/spapr_pci: Do not create DT for disabled PCI device" Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508697756116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 723c5b4628d047e43825a046c6ee517b82b88117. Signed-off-by: Michael S. Tsirkin --- hw/ppc/spapr_pci.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f63182a03c..7cf9904c35 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1296,10 +1296,6 @@ 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 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508686; cv=none; d=zohomail.com; s=zohoarc; b=NgpmuWQiA3zs1Vn7lyGKIqQJx2V6Xe3DVx1cCm80NXgDdinF/Y+JrNbdKKTWtR96+Gu0NgTvxY3F1F31Q5RUpJ9PZAwnQ0MAhtBgCkQynz1Uq1RzvBin30yE6sIFWT06NHcFRYoIKz2BoFxCMnt/K5CE6FyveF27dSz+LdSaklc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508686; h=Content-Type: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=oq1o9SvpX+0hrvIlhCMEJnYTzkg9hgopt6NINCt9TXs=; b=lVIC28bM/YxQLeMERVYTvMlGQc0Mtbanowx3hSS7FUjWYBe739JLHjLcyaYjRCsAIhnDHaMlPT968doNMQ7HS07yJumrJwF+AmXZ9GQkVVcLcozw2P5A1ff1hkUOOlA+lvRUBjZ/8CokG+NuzGdS4cJ31N3+uk3oRfHqkSD7gSA= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508686461323.69200875634044; Thu, 1 Aug 2024 03:38:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBP-00024O-9f; Thu, 01 Aug 2024 06:37:19 -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 1sZTBN-0001n7-QL for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBM-0001pS-0G for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:17 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-EXenFmNCNnaI4tE3D15uDA-1; Thu, 01 Aug 2024 06:37:14 -0400 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a429a572daso5611354a12.1 for ; Thu, 01 Aug 2024 03:37:13 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acad90251sm897244466b.143.2024.08.01.03.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oq1o9SvpX+0hrvIlhCMEJnYTzkg9hgopt6NINCt9TXs=; b=UwJSKwtADfAHSNjNj+LbXe9wBfTYymAcBTjkRYZvrSE6dc55H6U2ZqdQZZhoAcKVCQwVB3 2o2roAsnDPHaIHmKVa0KDuZob+3aiCqcKmXYxLnj8ndWItFAocrWgkQsqbamMFwDkp6Vbg F4mh3S4PPHI13xufzWE0SD2Or9cTdXg= X-MC-Unique: EXenFmNCNnaI4tE3D15uDA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508632; x=1723113432; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oq1o9SvpX+0hrvIlhCMEJnYTzkg9hgopt6NINCt9TXs=; b=U3u+Izy5u90iP7/zpJ/b8mkEbAOgvIrlNeyAaU1/fQVcw0vqFgVtqfqjctO0YsfdEt x7Mk5nqDYNTVW9UOsmRPjwgizFucBFO0tECogoxpR8dKH2Gm0A8Ry1q1Zmgls0+pwRoS jlrIXoVxRvKFav8qB2vyRidtJ6vQ1i8/nRksA4fZxT8e7uQDI7lqEKM2iN/P3f/FADpo Yq3PM+mFMMmXEjPfc6+vB3tQOG7N1odNq3v1NvEIXf7DNmsAHOH5fKHYTUPJYCt1B1Au 3b965cZepxjacG0mdf/8aL6y/r55ep9PuOJq2AOXeqNE9Ex6v1E9IgEDvjqAMJAs2kpm khhw== X-Gm-Message-State: AOJu0Yy4ZPvcJAuwgnlfV9APDkgOSSzTT8Ss7U438SjeVRm+bXzHpgwr r9q7CVP+AFvVET+ikmrgtnRPcA2b0ve1dZnozs11HmFeRHRvNOCOFRF1uGFzR1CdV/4HrJdJdYt a/3TTyWiZgU0opI/vJOns9NpMJoQ+7k44KmaOpKdtnffWMN2/KYICufQ7rlOV5sOeBfvv6NioPK avtBVnc0v2S+uwvubqbfO3eSRH6OiQfQ== X-Received: by 2002:a17:907:d93:b0:a77:e1fb:7dec with SMTP id a640c23a62f3a-a7daf4c373bmr143244266b.17.1722508632300; Thu, 01 Aug 2024 03:37:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHid+7aVanMVJcJKYW83ebd5losGd1kZ1LNm+BUBdm1h6AzczAuS6u+FMLvZ+R+hbBePm9yRQ== X-Received: by 2002:a17:907:d93:b0:a77:e1fb:7dec with SMTP id a640c23a62f3a-a7daf4c373bmr143241166b.17.1722508631535; Thu, 01 Aug 2024 03:37:11 -0700 (PDT) Date: Thu, 1 Aug 2024 06:37:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 17/19] Revert "hw/pci: Rename has_power to enabled" Message-ID: <93829009a685687e2fb48158cb5df18c4eb49d07.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508687708116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 6a31b219a5338564f3978251c79f96f689e037da. Signed-off-by: Michael S. Tsirkin --- 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, 11 insertions(+), 16 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index fe04b4fafd..eb26cac810 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -678,11 +678,6 @@ static inline void pci_irq_pulse(PCIDevice *pci_dev) } =20 MSIMessage pci_get_msi_message(PCIDevice *dev, int vector); -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); -} +void pci_set_power(PCIDevice *pci_dev, bool state); =20 #endif diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index f38fb31119..15694f2489 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 enabled; + bool has_power; =20 /* PCI config space */ uint8_t *config; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b532888e8f..fab86d0567 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->enabled) { + if (!d->has_power) { 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->enabled); + & PCI_COMMAND_MASTER) && d->has_power); } =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_enabled(PCIDevice *d, bool state) +void pci_set_power(PCIDevice *d, bool state) { - if (d->enabled =3D=3D state) { + if (d->has_power =3D=3D state) { return; } =20 - d->enabled =3D state; + d->has_power =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->enabled); - if (!d->enabled) { + & PCI_COMMAND_MASTER) && d->has_power); + if (!d->has_power) { pci_device_reset(d); } } diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index 0d82727cc9..dfe6fe6184 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->enabled || is_pci_dev_ejected(pci_dev)) { + !pci_dev->has_power || 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->enabled || is_pci_dev_ejected(pci_dev)) { + !pci_dev->has_power || is_pci_dev_ejected(pci_dev)) { return ~0x0; } =20 --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508651; cv=none; d=zohomail.com; s=zohoarc; b=WabTIZmPISbP0mj/A2USaGxxNlOkfmwI4G3wuOtvubXEiuKD7nBYYFveaDIOQLjfpjwMV3wgm3VYUNbi2TnaS+4iljEGWJ/enxjM6a3yZ+SvvvjWBGgFkLIuC/OEt3wFXUmkBDTfChpxnIeqbVAuplQEasfXHjwkWYs7u+qnWak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508651; h=Content-Type: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=kOlVB7WwJCX9drLmyP0GySNt0EHrEKT86ZQ33vsIJ0g=; b=TRk+42J2u9BED17h43pTVbKHS9GUKufHtBzhO86UtHsT4OgICWOFVqhj/zc7hRj5iCAMOBkUmQ3S4QOP/5uHW8KTDDH1iXAU8cJCii8ZAL2CUncT4mIcLbCE/HgyI7D0kTdCw6yrw9BhemTT8vCG0DkpzMUox6KykN36kSyWE3s= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172250865171286.57046631996877; Thu, 1 Aug 2024 03:37:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBW-00030z-DC; Thu, 01 Aug 2024 06:37:26 -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 1sZTBT-0002tp-VU for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBS-0001qd-6y for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:23 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-v5c0E_hyMQutuZxE4jXHAg-1; Thu, 01 Aug 2024 06:37:20 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5a2ceb035f9so2660664a12.0 for ; Thu, 01 Aug 2024 03:37:20 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63b59cb0sm10049005a12.45.2024.08.01.03.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kOlVB7WwJCX9drLmyP0GySNt0EHrEKT86ZQ33vsIJ0g=; b=E1igy8ugbHygX4jz0tA5aLHhscy/hlNLE/aIAVIC9ATFwdjbPV7VwY2oxZH3SJN6LHHZcr GamgIsY0i5NVfcV7+kLPLacAUg9t689vb877ziHjrP1+IT2N7b1/yDUMxdTl49wtTuASv+ kOSHm6K7xtjtsR7gVOcUMErnysAVT8o= X-MC-Unique: v5c0E_hyMQutuZxE4jXHAg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508638; x=1723113438; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kOlVB7WwJCX9drLmyP0GySNt0EHrEKT86ZQ33vsIJ0g=; b=Oxs4vGXGOLiG4O9ovYz4W+BF77ESZSn8iRqHMu6nJnMnAm/4Uybtr8rLvEAjslw4ab vqfTNhtDBy33DQsgssL04cW74EyvdNecd8FKOJPFNjZsC81P/nUJF7XZGAu7xGMTZAaW E57pv38GtHs+/ucP+yeGjQIUuO3zmkxAAzfojx8nTAoj5idctg4Xbz6QFTRsTmlXlxkK oX6WW+3Up/NU5yFIfOVcxCNVQ2yroUiSMBlj0YgD+5CFub9X3iPi77ia5Qgr5fRFPAeO yehReZ6HH5/tqIrOhvqW0MN2/f1WKfC2X1ZbrEmTd6QvByYQokIuHw2YlB7HmyhJ4S0u fWUA== X-Gm-Message-State: AOJu0YzD7+CmTVuPTDHtvKIzSOVXX0tKc12d98MH1t+D3qHTkDSyp5Gn KRnpeZ8RT7m2Vu6jrg6drj7SClDw3myVJImiV3iQDYLIKMsWyMzkaXc6JTofuuA+Tadd6Ix0tUI VODhkkAxsWCL8RZXl2NJ22K/92Y97nvP1WMWrUO0yodMT/T+uaPiWU3LMlmWWBW4XlPdnNPtwTB 1rpKgcfrz0FTDD217we5iPDsyOPQCtww== X-Received: by 2002:a05:6402:5253:b0:57d:455:d395 with SMTP id 4fb4d7f45d1cf-5b77c28ed64mr760776a12.7.1722508638469; Thu, 01 Aug 2024 03:37:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZtd/mEIqzI1B9QmqIuimkJW+I1NHLRLfmldGQsR4vOaGJA4TqYolkGo9fXOdbmiDQIGGZbA== X-Received: by 2002:a05:6402:5253:b0:57d:455:d395 with SMTP id 4fb4d7f45d1cf-5b77c28ed64mr760733a12.7.1722508637828; Thu, 01 Aug 2024 03:37:17 -0700 (PDT) Date: Thu, 1 Aug 2024 06:37:12 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-stable@nongnu.org, Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 18/19] hw/i386/amd_iommu: Don't leak memory in amdvi_update_iotlb() Message-ID: <9a45b0761628cc59267b3283a85d15294464ac31.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508653566116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Peter Maydell In amdvi_update_iotlb() we will only put a new entry in the hash table if to_cache.perm is not IOMMU_NONE. However we allocate the memory for the new AMDVIIOTLBEntry and for the hash table key regardless. This means that in the IOMMU_NONE case we will leak the memory we alloacted. Move the allocations into the if() to the point where we know we're going to add the item to the hash table. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2452 Signed-off-by: Peter Maydell Message-Id: <20240731170019.3590563-1-peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 6d4fde72f9..87643d2891 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -357,12 +357,12 @@ static void amdvi_update_iotlb(AMDVIState *s, uint16_= t devid, uint64_t gpa, IOMMUTLBEntry to_cache, uint16_t domid) { - AMDVIIOTLBEntry *entry =3D g_new(AMDVIIOTLBEntry, 1); - uint64_t *key =3D g_new(uint64_t, 1); - uint64_t gfn =3D gpa >> AMDVI_PAGE_SHIFT_4K; - /* don't cache erroneous translations */ if (to_cache.perm !=3D IOMMU_NONE) { + AMDVIIOTLBEntry *entry =3D g_new(AMDVIIOTLBEntry, 1); + uint64_t *key =3D g_new(uint64_t, 1); + uint64_t gfn =3D gpa >> AMDVI_PAGE_SHIFT_4K; + trace_amdvi_cache_update(domid, PCI_BUS_NUM(devid), PCI_SLOT(devid= ), PCI_FUNC(devid), gpa, to_cache.translated_addr); =20 --=20 MST From nobody Sun Nov 24 13:49:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722508723; cv=none; d=zohomail.com; s=zohoarc; b=XozlHI9AcF47PigwKYlxHVIbucUa5MkMMMcFlywiQihGNL5+vN+2rgn3OLR4Mr+qFP18DvZoljEfAd/ALPnC/cT+aI62RWkgNhoUxHsO2hSHlpaieGhKSU2K5EDPW9e4uNNTu0EYf2HVsMtvVzsieHrudjDmr13yFkzKmipzcB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722508723; h=Content-Type: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=DU7KGa++gwwIicNjWXeVcClxHOVzOhaCuJuqsj2Fe7w=; b=lZMMKD81iTfx0LIert8ZO3ohI7C9Qp1mQbrvY5qLhh5ErW2enrl4ODDgGNNkTsUP8tHvENpa2qrctxG07z+lUYQ6Zpfr7JpUxwUpiq86pOTCIQxks7GWNOG8ji1fHtaQQAyrCmRPWCbaRFqfx/+VzafRsr57x235jaTROoqNPGc= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722508723306145.67125982808238; Thu, 1 Aug 2024 03:38:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZTBj-0004KP-MG; Thu, 01 Aug 2024 06:37:39 -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 1sZTBa-0003V7-V8 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZTBX-0001rU-Rp for qemu-devel@nongnu.org; Thu, 01 Aug 2024 06:37:30 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-Rx_PeyNjP9qwG9AlXwhU_g-1; Thu, 01 Aug 2024 06:37:26 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7aa5885be3so605015866b.0 for ; Thu, 01 Aug 2024 03:37:25 -0700 (PDT) Received: from redhat.com ([2.55.44.248]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab231f2sm876174866b.7.2024.08.01.03.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 03:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722508647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DU7KGa++gwwIicNjWXeVcClxHOVzOhaCuJuqsj2Fe7w=; b=KDz2JVjwlr+8bTymPzToQoNzqico5ub2PtdV7HnIg88erGmIcA8q8mUcDs41sCQU3wiFFn q5H0ArZR+GIebH+Rvu5jwFDa6n9MPTyKNYHcgbKqS88NxCIj+GIeVHKfknwUMwL7AUJnwt 81X0g59ftBIY2WDKQowrEUZOcd8UrbI= X-MC-Unique: Rx_PeyNjP9qwG9AlXwhU_g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722508644; x=1723113444; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DU7KGa++gwwIicNjWXeVcClxHOVzOhaCuJuqsj2Fe7w=; b=viQBc/hNRqvvAOxLxA+bXb6cvwW7N2qeFaQk5kAT1K6V46WXw88oD+WEnDMeEa8E0W TvnwqkasjmqjcXoqWACbBS0ktoz4H94/cSwodPKVzpN+Z7EDMB51RcrThPLEUVsqdiDU Qs3ICM10zHp17ujGPjANVLTZZxOunqUlpL7UCy68AIBRWrzLqV2ZElDfXuvMj2swocKV JqvtY3nq5XfqYrCANB6SrGHo4oBOgQiXKV8BF7oclyUyvD4/iijthbbZJ+FQDNOGW2em HMPGiQKUylPiEenoc6Dh98UrS6E9/Km11YUl2SPS8ABjQJp5DRf6cB3hqVEqRBHg4RYs 5Lwg== X-Gm-Message-State: AOJu0Yx7aj5PjVUlkWRioPAWps07Uv/F7cgywDb6avOLSYlEbBw+WnPF FikjSD0TJXm3aI+9hMM5nVpBBHcDVD4dj/LvIo3Hzuhfitkp77rsgfI+06NMn4hzTFJyjmdIFIg 2jbCT0IWl0eoSarlLMSCVcJ0eNQ+r6U0oJoHucBZ5FXcskoLrd/ctnVl8Qq8nNwb9jUivOwDRI1 81FhBIzZni2ICzyGw30p6fl6Ny4WQLXQ== X-Received: by 2002:a17:906:caea:b0:a7d:a25b:31be with SMTP id a640c23a62f3a-a7daf51ccd8mr155638266b.39.1722508644608; Thu, 01 Aug 2024 03:37:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHm9R6o8hktFQi7D+CHwbuIk0rKKqyF/OtdLHMoscFAYnHfDKTsnT2hEUwJ6C6nK5RVj8s2Cg== X-Received: by 2002:a17:906:caea:b0:a7d:a25b:31be with SMTP id a640c23a62f3a-a7daf51ccd8mr155634466b.39.1722508643923; Thu, 01 Aug 2024 03:37:23 -0700 (PDT) Date: Thu, 1 Aug 2024 06:37:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , yeeli , Jason Wang , Yi Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 19/19] intel_iommu: Fix for IQA reg read dropped DW field Message-ID: <515457757ff8540c524ff39ea1d9564b251c6532.1722508478.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.131, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1722508723921116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: yeeli If VT-D hardware supports scalable mode, Linux will set the IQA DW field (bit11). In qemu, the vtd_mem_write and vtd_update_iq_dw set DW field well. However, vtd_mem_read the DW field wrong because "& VTD_IQA_QS" dropped the value of DW. Replace "&VTD_IQA_QS" with "& (VTD_IQA_QS | VTD_IQA_DW_MASK)" could save the DW field. Test patch as below: config the "x-scalable-mode" option: "-device intel-iommu,caching-mode=3Don,x-scalable-mode=3Don,aw-bits=3D48" After Linux OS boot, check the IQA_REG DW Field by usage 1 or 2: 1. IOMMU_DEBUGFS: Before fix: cat /sys/kernel/debug/iommu/intel/iommu_regset |grep IQA IQA 0x90 0x00000001001da001 After fix: cat /sys/kernel/debug/iommu/intel/iommu_regset |grep IQA IQA 0x90 0x00000001001da801 Check DW field(bit11) is 1. 2. devmem2 read the IQA_REG (offset 0x90): Before fix: devmem2 0xfed90090 /dev/mem opened. Memory mapped at address 0x7f72c795b000. Value at address 0xFED90090 (0x7f72c795b090): 0x1DA001 After fix: devmem2 0xfed90090 /dev/mem opened. Memory mapped at address 0x7fc95281c000. Value at address 0xFED90090 (0x7fc95281c090): 0x1DA801 Check DW field(bit11) is 1. Signed-off-by: yeeli Message-Id: <20240725031858.1529902-1-seven.yi.lee@gmail.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 9a768f0b44..16d2885fcc 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2947,7 +2947,9 @@ static uint64_t vtd_mem_read(void *opaque, hwaddr add= r, unsigned size) =20 /* Invalidation Queue Address Register, 64-bit */ case DMAR_IQA_REG: - val =3D s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS); + val =3D s->iq | + (vtd_get_quad(s, DMAR_IQA_REG) & + (VTD_IQA_QS | VTD_IQA_DW_MASK)); if (size =3D=3D 4) { val =3D val & ((1ULL << 32) - 1); } --=20 MST