From patchwork Thu Aug 1 10:35:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 160A0C3DA4A for ; Thu, 1 Aug 2024 10:37:05 +0000 (UTC) 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 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= 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 X-MC-Unique: Vq0s2RrZMf6defh1NbuEnA-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52f00bde29dso8982687e87.3 for ; Thu, 01 Aug 2024 03:35:36 -0700 (PDT) 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) 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) 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-Dau?= =?utf-8?q?d=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-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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@redhat.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé --- 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) /* 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 == 0 || + vrng->conf.max_bytes > INT64_MAX) { + error_setg(errp, "'max-bytes' parameter must be positive, " "and less than 2^63"); return; } From patchwork Thu Aug 1 10:35:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33537C3DA64 for ; Thu, 1 Aug 2024 10:37:39 +0000 (UTC) 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 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= 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 X-MC-Unique: xG6tBF_dPwymtTgK6VLRrA-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-52f00bde210so7587398e87.1 for ; Thu, 01 Aug 2024 03:35:43 -0700 (PDT) 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) 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) 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-Dau?= =?utf-8?q?d=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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 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 -======================= - -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 software -overhead in I/O from virtual machines. - -There are devices with predefined SR-IOV configurations, but it is also possible -to compose an SR-IOV device yourself. Composing an SR-IOV device is currently -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=n -netdev user,id=o - -netdev user,id=p -netdev user,id=q - -device pcie-root-port,id=b - -device virtio-net-pci,bus=b,addr=0x0.0x3,netdev=q,sriov-pf=f - -device virtio-net-pci,bus=b,addr=0x0.0x2,netdev=p,sriov-pf=f - -device virtio-net-pci,bus=b,addr=0x0.0x1,netdev=o,sriov-pf=f - -device virtio-net-pci,bus=b,addr=0x0.0x0,netdev=n,id=f - -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 have -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 feature on -your guest. For Linux, refer to [1]_. - -.. [1] https://docs.kernel.org/PCI/pci-iov-howto.html From patchwork Thu Aug 1 10:35:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A83CC52D6D for ; Thu, 1 Aug 2024 10:37:18 +0000 (UTC) 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 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= 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 X-MC-Unique: V46F0ZBIO5a16yBWn_yIjw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7bcaa94892so579678566b.0 for ; Thu, 01 Aug 2024 03:35:52 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = PCI_DEVICE_ID_VIRTIO_NET; k->revision = VIRTIO_PCI_ABI_VERSION; k->class_id = PCI_CLASS_NETWORK_ETHERNET; - k->sriov_vf_user_creatable = true; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); device_class_set_props(dc, virtio_net_properties); vpciklass->realize = virtio_net_pci_realize; From patchwork Thu Aug 1 10:35:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DE5EC3DA64 for ; Thu, 1 Aug 2024 10:37:16 +0000 (UTC) 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 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= 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 X-MC-Unique: 4fG3yTihOnOg9p37FjoZcA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a7aaef3fdafso281792766b.1 for ; Thu, 01 Aug 2024 03:36:00 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = virtio_bus_get_device(bus); - int16_t res; /* * 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 = pcie_sriov_pf_init_from_user_created_vfs(&proxy->pci_dev, - proxy->last_pcie_cap_offset, - errp); - if (res > 0) { - proxy->last_pcie_cap_offset += res; - virtio_add_feature(&vdev->host_features, VIRTIO_F_SR_IOV); - } } static void virtio_pci_device_unplugged(DeviceState *d) @@ -2196,7 +2187,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) if (pcie_port && pci_is_express(pci_dev)) { int pos; - proxy->last_pcie_cap_offset = PCI_CONFIG_SPACE_SIZE; + uint16_t last_pcie_cap_offset = PCI_CONFIG_SPACE_SIZE; pos = pcie_endpoint_cap_init(pci_dev, 0); assert(pos > 0); @@ -2216,9 +2207,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) pci_set_word(pci_dev->config + pos + PCI_PM_PMC, 0x3); if (proxy->flags & VIRTIO_PCI_FLAG_AER) { - pcie_aer_init(pci_dev, PCI_ERR_VER, proxy->last_pcie_cap_offset, + pcie_aer_init(pci_dev, PCI_ERR_VER, last_pcie_cap_offset, PCI_ERR_SIZEOF, NULL); - proxy->last_pcie_cap_offset += PCI_ERR_SIZEOF; + last_pcie_cap_offset += PCI_ERR_SIZEOF; } if (proxy->flags & VIRTIO_PCI_FLAG_INIT_DEVERR) { @@ -2243,9 +2234,9 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) } 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 += PCI_EXT_CAP_ATS_SIZEOF; + last_pcie_cap_offset += PCI_EXT_CAP_ATS_SIZEOF; } if (proxy->flags & VIRTIO_PCI_FLAG_INIT_FLR) { @@ -2272,7 +2263,6 @@ static void virtio_pci_exit(PCIDevice *pci_dev) bool pcie_port = pci_bus_is_express(pci_get_bus(pci_dev)) && !pci_bus_is_root(pci_get_bus(pci_dev)); - 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)) { From patchwork Thu Aug 1 10:35:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64266C3DA64 for ; Thu, 1 Aug 2024 10:36:56 +0000 (UTC) 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 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= 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 X-MC-Unique: hPb5S-zyMtisu7lJ6xsk1A-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-52f02f1773fso7684133e87.3 for ; Thu, 01 Aug 2024 03:36:06 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = 0 */ const char *romfile; /* rom bar */ - - bool sriov_vf_user_creatable; }; 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; }; static inline int pci_intx(PCIDevice *pci_dev) @@ -203,7 +199,7 @@ static inline int pci_is_express_downstream_port(const PCIDevice *d) static inline int pci_is_vf(const PCIDevice *d) { - return d->sriov_pf || d->exp.sriov_vf.pf != NULL; + return d->exp.sriov_vf.pf != NULL; } 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; typedef struct PCIESriovVF { @@ -41,23 +40,6 @@ void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, MemoryRegion *memory); -/** - * pcie_sriov_pf_init_from_user_created_vfs() - Initialize PF with user-created - * 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[] = { 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() }; @@ -960,8 +959,13 @@ static void pci_init_multifunction(PCIBus *bus, PCIDevice *dev, Error **errp) dev->config[PCI_HEADER_TYPE] |= PCI_HEADER_TYPE_MULTI_FUNCTION; } - /* 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 multifunction + * 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; } @@ -994,8 +998,7 @@ static void pci_init_multifunction(PCIBus *bus, PCIDevice *dev, Error **errp) } /* function 0 indicates single function, so function > 0 must be NULL */ for (func = 1; func < PCI_FUNC_MAX; ++func) { - PCIDevice *device = 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) pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); - pcie_sriov_unregister_device(pci_dev); if (pc->exit) { pc->exit(pci_dev); @@ -1312,6 +1314,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, pcibus_t size = memory_region_size(memory); uint8_t hdr_type; + assert(!pci_is_vf(pci_dev)); /* VFs must use pcie_sriov_vf_register_bar */ assert(region_num >= 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 != PCI_HEADER_TYPE_BRIDGE || region_num < 2); r = &pci_dev->io_regions[region_num]; + r->addr = PCI_BAR_UNMAPPED; r->size = size; r->type = type; r->memory = memory; @@ -1329,35 +1333,22 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, ? pci_get_bus(pci_dev)->address_space_io : pci_get_bus(pci_dev)->address_space_mem; - if (pci_is_vf(pci_dev)) { - PCIDevice *pf = pci_dev->exp.sriov_vf.pf; - assert(!pf || type == pf->exp.sriov_pf.vf_bar_type[region_num]); + wmask = ~(size - 1); + if (region_num == PCI_ROM_SLOT) { + /* ROM enable bit is writable */ + wmask |= PCI_ROM_ADDRESS_ENABLE; + } - r->addr = pci_bar_address(pci_dev, region_num, r->type, r->size); - if (r->addr != PCI_BAR_UNMAPPED) { - memory_region_add_subregion_overlap(r->address_space, - r->addr, r->memory, 1); - } + addr = 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 = PCI_BAR_UNMAPPED; - - wmask = ~(size - 1); - if (region_num == PCI_ROM_SLOT) { - /* ROM enable bit is writable */ - wmask |= PCI_ROM_ADDRESS_ENABLE; - } - - addr = 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); } } @@ -2118,11 +2109,6 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) } } - 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" -static GHashTable *pfs; - static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) { for (uint16_t i = 0; i < total_vfs; i++) { @@ -33,49 +31,14 @@ static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) dev->exp.sriov_pf.vf = NULL; } -static void clear_ctrl_vfe(PCIDevice *dev) -{ - uint8_t *ctrl = 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 = dev->exp.sriov_cap; - - assert(sriov_cap > 0); - num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); - if (num_vfs > pci_get_word(dev->config + sriov_cap + PCI_SRIOV_TOTAL_VF)) { - clear_ctrl_vfe(dev); - return; - } - - trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn), num_vfs); - for (i = 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 = dev->config + dev->exp.sriov_cap; - - trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); - for (i = 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_vfs, - uint16_t total_vfs, uint16_t vf_offset, - 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 = qdev_get_parent_bus(&dev->qdev); + int32_t devfn = dev->devfn + vf_offset; uint8_t *cfg = dev->config + offset; uint8_t *wmask; @@ -137,28 +100,6 @@ static bool pcie_sriov_pf_init_common(PCIDevice *dev, uint16_t offset, qdev_prop_set_bit(&dev->qdev, "multifunction", true); - 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 = qdev_get_parent_bus(&dev->qdev); - int32_t devfn = 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 = g_new(PCIDevice *, total_vfs); for (uint16_t i = 0; i < total_vfs; i++) { @@ -188,24 +129,7 @@ void pcie_sriov_pf_exit(PCIDevice *dev) { uint8_t *cfg = dev->config + dev->exp.sriov_cap; - if (dev->exp.sriov_pf.vf_user_created) { - uint16_t ven_id = pci_get_word(dev->config + PCI_VENDOR_ID); - uint16_t total_vfs = pci_get_word(dev->config + PCI_SRIOV_TOTAL_VF); - uint16_t vf_dev_id = pci_get_word(dev->config + PCI_SRIOV_VF_DID); - - unregister_vfs(dev); - - for (uint16_t i = 0; i < total_vfs; i++) { - PCIDevice *vf = dev->exp.sriov_pf.vf[i]; - - vf->exp.sriov_vf.pf = 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)); } 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 region_num, void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, MemoryRegion *memory) { + PCIIORegion *r; + PCIBus *bus = pci_get_bus(dev); uint8_t type; + pcibus_t size = memory_region_size(memory); - assert(dev->exp.sriov_vf.pf); + assert(pci_is_vf(dev)); /* PFs must use pci_register_bar */ + assert(region_num >= 0); + assert(region_num < PCI_NUM_REGIONS); type = dev->exp.sriov_vf.pf->exp.sriov_pf.vf_bar_type[region_num]; - 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=0x%x, size=0x%"FMT_PCIBUS, + __func__, type, size); + exit(1); + } + + r = &dev->io_regions[region_num]; + r->memory = memory; + r->address_space = + type & PCI_BASE_ADDRESS_SPACE_IO + ? bus->address_space_io + : bus->address_space_mem; + r->size = size; + r->type = type; + + r->addr = pci_bar_address(dev, region_num, r->type, r->size); + if (r->addr != PCI_BAR_UNMAPPED) { + memory_region_add_subregion_overlap(r->address_space, + r->addr, r->memory, 1); + } } -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 = dev->config + dev->exp.sriov_cap + PCI_SRIOV_CTRL; + pci_set_word(ctrl, pci_get_word(ctrl) & ~PCI_SRIOV_CTRL_VFE); } -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 = qdev_get_parent_bus(DEVICE(dev)); - uint16_t ven_id = 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 = dev->exp.sriov_cap; - if (!pfs || !dev->qdev.id) { - return 0; + assert(sriov_cap > 0); + num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); + if (num_vfs > pci_get_word(dev->config + sriov_cap + PCI_SRIOV_TOTAL_VF)) { + clear_ctrl_vfe(dev); + return; } - pf = 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 = 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 = (void *)pf->pdata; - - if (vfs[0]->devfn <= dev->devfn) { - error_setg(errp, "a VF function number is less than the PF function number"); - return -1; - } - - vf_dev_id = pci_get_word(vfs[0]->config + PCI_DEVICE_ID); - vf_offset = vfs[0]->devfn - dev->devfn; - vf_stride = pf->len < 2 ? 0 : vfs[1]->devfn - vfs[0]->devfn; - - for (i = 0; i < pf->len; i++) { - if (bus != qdev_get_parent_bus(&vfs[i]->qdev)) { - error_setg(errp, "SR-IOV VF parent bus mismatches with PF"); - return -1; - } - - if (ven_id != 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 != pci_get_word(vfs[i]->config + PCI_DEVICE_ID)) { - error_setg(errp, "inconsistent SR-IOV VF device IDs"); - return -1; - } - - for (size_t j = 0; j < PCI_NUM_REGIONS; j++) { - if (vfs[i]->io_regions[j].size != vfs[0]->io_regions[j].size || - vfs[i]->io_regions[j].type != vfs[0]->io_regions[j].type) { - error_setg(errp, "inconsistent SR-IOV BARs"); - return -1; - } - } - - if (vfs[i]->devfn - vfs[0]->devfn != 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 = 0; i < pf->len; i++) { - vfs[i]->exp.sriov_vf.pf = dev; - vfs[i]->exp.sriov_vf.vf_number = 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 = vfs; - dev->exp.sriov_pf.vf_user_created = true; - - for (i = 0; i < PCI_NUM_REGIONS; i++) { - PCIIORegion *region = &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; } -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 = dev->config + dev->exp.sriov_cap; - 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 device 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 exists"); - return false; - } - - if (!pfs) { - pfs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - } - - pf = g_hash_table_lookup(pfs, dev->sriov_pf); - if (!pf) { - pf = 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 = 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 = 0; i < pci_get_word(cfg + PCI_SRIOV_TOTAL_VF); i++) { + pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } } @@ -490,7 +316,7 @@ void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t opt_sup_pgsize) 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; } From patchwork Thu Aug 1 10:36:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CFACC3DA64 for ; Thu, 1 Aug 2024 10:37:31 +0000 (UTC) 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 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= 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 X-MC-Unique: eZHGvQOdM-y7S-Wzf0wvsw-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52f0258b020so7474807e87.0 for ; Thu, 01 Aug 2024 03:36:11 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = dev->config + offset; uint8_t *wmask; - 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; From patchwork Thu Aug 1 10:36:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76328C3DA64 for ; Thu, 1 Aug 2024 10:37:00 +0000 (UTC) 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 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= 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 X-MC-Unique: hPEz-PkLMm6mJUTQcIJaAA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-52efcb739adso1230455e87.2 for ; Thu, 01 Aug 2024 03:36:17 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = dev->config + offset; uint8_t *wmask; - 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 = pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); uint16_t first_vf_devfn = dev->devfn + vf_offset; From patchwork Thu Aug 1 10:36:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A860C3DA4A for ; Thu, 1 Aug 2024 10:37:02 +0000 (UTC) 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 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= 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 X-MC-Unique: JxFfJVbpNByxLfGXjsk_Ug-1 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-52f00bde210so7588295e87.1 for ; Thu, 01 Aug 2024 03:36:25 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = pci_get_word(pf->config + sriov_cap + PCI_SRIOV_VF_STRIDE); - uint32_t vf_num = d->devfn - (pf->devfn + vf_offset); - - if (vf_num) { - vf_num /= vf_stride; - } + uint32_t vf_num = (d->devfn - (pf->devfn + vf_offset)) / vf_stride; if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { new_addr = pci_get_quad(pf->config + bar); From patchwork Thu Aug 1 10:36:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F4FEC3DA4A for ; Thu, 1 Aug 2024 10:38:00 +0000 (UTC) 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 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= 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 X-MC-Unique: QL1dfpkCM4CPBHoWNfx-aQ-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a77f0eca75bso627675566b.1 for ; Thu, 01 Aug 2024 03:36:30 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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); -void pcie_sriov_pf_post_load(PCIDevice *dev); - /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev); 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 version_id) return !pci_is_express((PCIDevice *)opaque); } -static int pci_post_load(void *opaque, int version_id) -{ - pcie_sriov_pf_post_load(opaque); - return 0; -} - const VMStateDescription vmstate_pci_device = { .name = "PCIDevice", .version_id = 2, .minimum_version_id = 1, - .post_load = pci_post_load, .fields = (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, } } -void pcie_sriov_pf_post_load(PCIDevice *dev) -{ - if (dev->exp.sriov_cap) { - register_vfs(dev); - } -} - /* Reset SR/IOV */ void pcie_sriov_pf_reset(PCIDevice *dev) From patchwork Thu Aug 1 10:36:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6F183C3DA64 for ; Thu, 1 Aug 2024 10:38:40 +0000 (UTC) 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 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= 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 X-MC-Unique: Np6eLwWZPnijI1cgGKu1tQ-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5a3fa8b9151so5988073a12.2 for ; Thu, 01 Aug 2024 03:36:33 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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" 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 = offset; + dev->exp.sriov_pf.num_vfs = 0; dev->exp.sriov_pf.vf = NULL; pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -185,12 +186,6 @@ void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, } } -static void clear_ctrl_vfe(PCIDevice *dev) -{ - uint8_t *ctrl = 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 = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); if (num_vfs > pci_get_word(dev->config + sriov_cap + PCI_SRIOV_TOTAL_VF)) { - clear_ctrl_vfe(dev); return; } @@ -209,18 +203,20 @@ static void register_vfs(PCIDevice *dev) for (i = 0; i < num_vfs; i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], true); } + dev->exp.sriov_pf.num_vfs = num_vfs; } static void unregister_vfs(PCIDevice *dev) { + uint16_t num_vfs = dev->exp.sriov_pf.num_vfs; uint16_t i; - uint8_t *cfg = dev->config + dev->exp.sriov_cap; trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); - for (i = 0; i < pci_get_word(cfg + PCI_SRIOV_TOTAL_VF); i++) { + PCI_FUNC(dev->devfn), num_vfs); + for (i = 0; i < num_vfs; i++) { pci_set_enabled(dev->exp.sriov_pf.vf[i], false); } + dev->exp.sriov_pf.num_vfs = 0; } void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, @@ -246,9 +242,6 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, } else { unregister_vfs(dev); } - } else if (range_covers_byte(off, len, PCI_SRIOV_NUM_VF)) { - clear_ctrl_vfe(dev); - unregister_vfs(dev); } } @@ -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) uint16_t pcie_sriov_num_vfs(PCIDevice *dev) { - uint16_t sriov_cap = dev->exp.sriov_cap; - uint8_t *cfg = 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 # 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, uint32_t val, uint32_t len) "%s %02x:%x: sriov offset 0x%x val 0x%x len %d" # pcie.c From patchwork Thu Aug 1 10:36:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF80EC3DA64 for ; Thu, 1 Aug 2024 10:37:41 +0000 (UTC) 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 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= 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 X-MC-Unique: vaI-UWSDPui6dbeXtDNhaw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a766a51b0dso7447873a12.1 for ; Thu, 01 Aug 2024 03:36:39 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = i; if (!qdev_realize(&vf->qdev, bus, errp)) { - object_unparent(OBJECT(vf)); - object_unref(vf); unparent_vfs(dev, i); return false; } From patchwork Thu Aug 1 10:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C8C1C52D6F for ; Thu, 1 Aug 2024 10:37:21 +0000 (UTC) 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 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= 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 X-MC-Unique: 5u6Esno8MTOM267ap-nOUw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a16fae2ba7so3876925a12.1 for ; Thu, 01 Aug 2024 03:36:44 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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); +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); } -static inline void pci_set_power(PCIDevice *pci_dev, bool state) -{ - /* - * Don't change the enabled state of VFs when powering on/off the device. - * - * 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); /* 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; 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" -static void unparent_vfs(PCIDevice *dev, uint16_t total_vfs) -{ - for (uint16_t i = 0; i < total_vfs; i++) { - PCIDevice *vf = 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 = NULL; -} +static PCIDevice *register_vf(PCIDevice *pf, int devfn, + const char *name, uint16_t vf_num); +static void unregister_vfs(PCIDevice *dev); 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 = qdev_get_parent_bus(&dev->qdev); - int32_t devfn = dev->devfn + vf_offset; uint8_t *cfg = dev->config + offset; uint8_t *wmask; @@ -58,6 +49,7 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, offset, PCI_EXT_CAP_SRIOV_SIZEOF); dev->exp.sriov_cap = offset; dev->exp.sriov_pf.num_vfs = 0; + dev->exp.sriov_pf.vfname = g_strdup(vfname); dev->exp.sriov_pf.vf = NULL; pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); @@ -91,34 +83,14 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, qdev_prop_set_bit(&dev->qdev, "multifunction", true); - dev->exp.sriov_pf.vf = g_new(PCIDevice *, total_vfs); - - for (uint16_t i = 0; i < total_vfs; i++) { - PCIDevice *vf = pci_new(devfn, vfname); - vf->exp.sriov_vf.pf = dev; - vf->exp.sriov_vf.vf_number = 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] = vf; - devfn += vf_stride; - } - return true; } void pcie_sriov_pf_exit(PCIDevice *dev) { - uint8_t *cfg = 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 = NULL; } 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 region_num, } } +static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, + uint16_t vf_num) +{ + PCIDevice *dev = pci_new(devfn, name); + dev->exp.sriov_vf.pf = pf; + dev->exp.sriov_vf.vf_number = vf_num; + PCIBus *bus = pci_get_bus(pf); + Error *local_err = 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 = dev->exp.sriov_cap; + uint16_t vf_offset = + pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_OFFSET); + uint16_t vf_stride = + pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_STRIDE); + int32_t devfn = dev->devfn + vf_offset; assert(sriov_cap > 0); num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); @@ -196,10 +195,18 @@ static void register_vfs(PCIDevice *dev) return; } + dev->exp.sriov_pf.vf = g_new(PCIDevice *, num_vfs); + trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i = 0; i < num_vfs; i++) { - pci_set_enabled(dev->exp.sriov_pf.vf[i], true); + dev->exp.sriov_pf.vf[i] = register_vf(dev, devfn, + dev->exp.sriov_pf.vfname, i); + if (!dev->exp.sriov_pf.vf[i]) { + num_vfs = i; + break; + } + devfn += vf_stride; } dev->exp.sriov_pf.num_vfs = 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 = 0; i < num_vfs; i++) { - pci_set_enabled(dev->exp.sriov_pf.vf[i], false); + PCIDevice *vf = 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 = NULL; dev->exp.sriov_pf.num_vfs = 0; } @@ -235,10 +246,14 @@ void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, PCI_FUNC(dev->devfn), off, val, len); 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); + } } } } From patchwork Thu Aug 1 10:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67F28C3DA7F for ; Thu, 1 Aug 2024 10:37:18 +0000 (UTC) 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 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= 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 X-MC-Unique: 0A3HblJMMi-c85rdcLG2Yg-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5af95f7d65bso4834308a12.3 for ; Thu, 01 Aug 2024 03:36:50 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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. ... /* 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); /* 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; -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); /* 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) pcie_ari_init(pci_dev, 0x150); - 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); 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); } -static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset, - Error **errp) +static void nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset) { uint16_t vf_dev_id = n->params.use_intel_id ? PCI_DEVICE_ID_INTEL_NVME : PCI_DEVICE_ID_REDHAT_NVME; @@ -8281,17 +8280,12 @@ static bool nvme_init_sriov(NvmeCtrl *n, PCIDevice *pci_dev, uint16_t offset, le16_to_cpu(cap->vifrsm), NULL, NULL); - if (!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, - 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); pcie_sriov_pf_init_vf_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, bar_size); - - return true; } static int nvme_add_pm_capability(PCIDevice *pci_dev, uint8_t offset) @@ -8416,12 +8410,6 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) return false; } - 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); pcie_cap_deverr_init(pci_dev); @@ -8451,6 +8439,10 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) nvme_init_pmr(n, pci_dev); } + if (!pci_is_vf(pci_dev) && n->params.sriov_max_vfs) { + nvme_init_sriov(n, pci_dev, 0x120); + } + return true; } 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); -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 = dev->config + offset; uint8_t *wmask; - if (total_vfs) { - uint16_t ari_cap = pcie_find_capability(dev, PCI_EXT_CAP_ID_ARI); - uint16_t first_vf_devfn = dev->devfn + vf_offset; - uint16_t last_vf_devfn = first_vf_devfn + vf_stride * (total_vfs - 1); - - if ((!ari_cap && PCI_SLOT(dev->devfn) != PCI_SLOT(last_vf_devfn)) || - last_vf_devfn >= 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 = offset; @@ -82,8 +69,6 @@ bool pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, pci_set_word(wmask + PCI_SRIOV_SYS_PGSIZE, 0x553); qdev_prop_set_bit(&dev->qdev, "multifunction", true); - - return true; } void pcie_sriov_pf_exit(PCIDevice *dev) From patchwork Thu Aug 1 10:36:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CD6DC3DA64 for ; Thu, 1 Aug 2024 10:37:48 +0000 (UTC) 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 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= 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 X-MC-Unique: C5mLd4NQNZWs59WViagp3Q-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a7d6a72ad99so366082666b.2 for ; Thu, 01 Aug 2024 03:36:55 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = 0; i < num_vfs; i++) { + Error *err = NULL; PCIDevice *vf = 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)); } From patchwork Thu Aug 1 10:36:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6352BC3DA4A for ; Thu, 1 Aug 2024 10:37:46 +0000 (UTC) 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 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= 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 X-MC-Unique: N5xjlR5BOViSHNBleo9NsA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a7a8281dba5so545392266b.3 for ; Thu, 01 Aug 2024 03:37:02 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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_handler, * 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) != 0) { error_setg(errp, "PCI: slot %d function 0 already occupied by %s," " additional functions can no longer be exposed to guest.", From patchwork Thu Aug 1 10:36:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21B46C3DA64 for ; Thu, 1 Aug 2024 10:38:16 +0000 (UTC) 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 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= 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 X-MC-Unique: AfM-eZEmNdajaST8dzTY-A-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5a54b18f730so5761749a12.1 for ; Thu, 01 Aug 2024 03:37:08 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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, PCIDevice *pdev, return; } - if (!pdev->enabled) { - return; - } - err = spapr_dt_pci_device(p->sphb, pdev, p->fdt, p->offset); if (err < 0) { p->err = err; From patchwork Thu Aug 1 10:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 353B3C3DA4A for ; Thu, 1 Aug 2024 10:38:06 +0000 (UTC) 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 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= 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 X-MC-Unique: EXenFmNCNnaI4tE3D15uDA-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5a429a572daso5611354a12.1 for ; Thu, 01 Aug 2024 03:37:13 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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) } 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); #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; /* 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; new_addr = pci_bar_address(d, i, r->type, r->size); - if (!d->enabled) { + if (!d->has_power) { new_addr = PCI_BAR_UNMAPPED; } @@ -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); } msi_write_config(d, addr, val_in, l); @@ -2884,18 +2884,18 @@ MSIMessage pci_get_msi_message(PCIDevice *dev, int vector) return msg; } -void pci_set_enabled(PCIDevice *d, bool state) +void pci_set_power(PCIDevice *d, bool state) { - if (d->enabled == state) { + if (d->has_power == state) { return; } - d->enabled = state; + d->has_power = 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, 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; } @@ -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; } From patchwork Thu Aug 1 10:37:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79D9CC3DA7F for ; Thu, 1 Aug 2024 10:37:31 +0000 (UTC) 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 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= 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 X-MC-Unique: v5c0E_hyMQutuZxE4jXHAg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5a2ceb035f9so2660664a12.0 for ; Thu, 01 Aug 2024 03:37:20 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 = g_new(AMDVIIOTLBEntry, 1); - uint64_t *key = g_new(uint64_t, 1); - uint64_t gfn = gpa >> AMDVI_PAGE_SHIFT_4K; - /* don't cache erroneous translations */ if (to_cache.perm != IOMMU_NONE) { + AMDVIIOTLBEntry *entry = g_new(AMDVIIOTLBEntry, 1); + uint64_t *key = g_new(uint64_t, 1); + uint64_t gfn = 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); From patchwork Thu Aug 1 10:37:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13750166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DCE5C3DA64 for ; Thu, 1 Aug 2024 10:38:43 +0000 (UTC) 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 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= 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 X-MC-Unique: Rx_PeyNjP9qwG9AlXwhU_g-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a7aa5885be3so605015866b.0 for ; Thu, 01 Aug 2024 03:37:25 -0700 (PDT) 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) 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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=on,x-scalable-mode=on,aw-bits=48" 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 addr, unsigned size) /* Invalidation Queue Address Register, 64-bit */ case DMAR_IQA_REG: - val = s->iq | (vtd_get_quad(s, DMAR_IQA_REG) & VTD_IQA_QS); + val = s->iq | + (vtd_get_quad(s, DMAR_IQA_REG) & + (VTD_IQA_QS | VTD_IQA_DW_MASK)); if (size == 4) { val = val & ((1ULL << 32) - 1); }