From nobody Sun May 12 21:20:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1688523923; cv=none; d=zohomail.com; s=zohoarc; b=LCeWT0gIKqEFiCh2kdCujyMjnb55L5lqAymAKKLIXTiujeJ5L/+OC7ARXyz3TH2QaN92caBHmv163mypT/rTB6M5x1xxdKoloeK8xw5+vEQ4/taYERvAmm95iDKiyAeEPXUfZ8W8uyjr2SmwJCt3VrhXAhNmb2548Us/cs0I31k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688523923; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=s02o4ecEeuNUThWPP1l7HSPv9qpDPaUhEuBGwN7hbWw=; b=GxdK1LIYGZMHWGZPTIBdgYYuNOswse9FLYsIQKH5kv6ZQejK3h3q1KtGbG6JvukBCvS311bIyhnSmuUa5+7LHrenn/t8pe2/zhUKD1lpqPDq/+oul3Ovg2as3cPwBx4Vy/d72FutD/TMBDPTFPnd8VlCaN7+X+VM1H+IQo70yNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688523922984506.86101753673324; Tue, 4 Jul 2023 19:25:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGsC3-0007na-9a; Tue, 04 Jul 2023 22:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGsC2-0007nK-9H for qemu-devel@nongnu.org; Tue, 04 Jul 2023 22:24:34 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGsC0-0002Ev-N0 for qemu-devel@nongnu.org; Tue, 04 Jul 2023 22:24:34 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1b8ad9eede0so3679005ad.1 for ; Tue, 04 Jul 2023 19:24:32 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id u10-20020a17090282ca00b001b8062c1db3sm15235365plz.82.2023.07.04.19.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 19:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1688523871; x=1691115871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s02o4ecEeuNUThWPP1l7HSPv9qpDPaUhEuBGwN7hbWw=; b=h899825H4tjfhJ6ZDVX4QzrxY4OeRdOL7h3EjxA+p+WrTeQclZYHFpt7AwmhgbHw5S t6Dnv7modvRxqbcjaovZl8KuFOxObD213g0CrGrtaUUmmlc7VUL0RE2vbbvTiKWrGn2c ieBcWj/kCWV/y8xR+LpDQ0G4liLxTNN20snXtIP5me5sCvbw+7/4SLhtz53WQL+2tD2h paQ7AkdzmUpJ7xIAzYHXh/yH7TAUCBDeprLaeO0RYGx9SlLB6LZJHUDvhHDjGdDeYwNi 6ow7Xdy1LVSCqraPtzxc8chAJu8Z7EIYed2p3l4oxo4BoA3TWzUqylGe9bz/2VI9+COf /9Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688523871; x=1691115871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s02o4ecEeuNUThWPP1l7HSPv9qpDPaUhEuBGwN7hbWw=; b=ETJrchjW7xvEUfBrdRaVNW+PTsU93lZts/bimgN8TjQJLZVfUyoG1xhGcWOyjjEdW7 hi/sXHLHv5yS28Xo51kY1bpq4C7a33wlB2PkHzx7QAinDu6q3hkcaEotx9okE7H1JE3O 7DS4g/o7yrzO68mkJCMtSeV9yE/qlRuqoWi/+AFVc4qbhO4TA+/ATDss+30CZEf2YzmU k7g8G1Pcm1HwnFByyfMImpbJgTvrf6pWFCRcnsdAd4dRwzYzEGL/yx0fm3tKdQI91VXA LmsuiDO2TElaYEhgw3rDjd2c/SActgw6SYOmnNqDQJllgYjP8iWHVp1nPTZgl1Gvrqms 6C6Q== X-Gm-Message-State: ABy/qLbHt010xjVjuifSUogIoKZ9NheHQxr98CSU2aju6CwRfFAQNq3i vlXhivH3/7yX8fCSdW42iCCEA9VAA2x0bkCwxwE= X-Google-Smtp-Source: APBJJlE7QnVky7e7YxCezitVjsJwaiBLp+YyYqb0t/DSnyitE8z2/DZVRIQYVhmFyIwKsm0hPQDg+w== X-Received: by 2002:a17:902:e84a:b0:1b8:33d4:77f8 with SMTP id t10-20020a170902e84a00b001b833d477f8mr19125081plg.23.1688523871141; Tue, 04 Jul 2023 19:24:31 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Igor Mammedov , Ani Sinha , "Michael S . Tsirkin" , Marcel Apfelbaum , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Akihiko Odaki Subject: [PATCH v5 1/2] pcie: Use common ARI next function number Date: Wed, 5 Jul 2023 11:24:19 +0900 Message-ID: <20230705022421.13115-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705022421.13115-1-akihiko.odaki@daynix.com> References: <20230705022421.13115-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::636; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1688523925428100009 Content-Type: text/plain; charset="utf-8" Currently the only implementers of ARI is SR-IOV devices, and they behave similar. Share the ARI next function number. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 4 ++-- include/hw/pci/pcie.h | 2 +- hw/net/igb.c | 2 +- hw/net/igbvf.c | 2 +- hw/nvme/ctrl.c | 2 +- hw/pci/pcie.c | 4 +++- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt index 7eff7f2703..a47aad0bfa 100644 --- a/docs/pcie_sriov.txt +++ b/docs/pcie_sriov.txt @@ -48,7 +48,7 @@ setting up a BAR for a VF. ... int ret =3D pcie_endpoint_cap_init(d, 0x70); ... - pcie_ari_init(d, 0x100, 1); + pcie_ari_init(d, 0x100); ... =20 /* Add and initialize the SR/IOV capability */ @@ -78,7 +78,7 @@ setting up a BAR for a VF. ... int ret =3D pcie_endpoint_cap_init(d, 0x60); ... - pcie_ari_init(d, 0x100, 1); + pcie_ari_init(d, 0x100); ... memory_region_init(mr, ... ) pcie_sriov_vf_register_bar(d, bar_nr, mr); diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index 3cc2b15957..bf7dc5d685 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -134,7 +134,7 @@ void pcie_sync_bridge_lnk(PCIDevice *dev); void pcie_acs_init(PCIDevice *dev, uint16_t offset); void pcie_acs_reset(PCIDevice *dev); =20 -void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn); +void pcie_ari_init(PCIDevice *dev, uint16_t offset); void pcie_dev_ser_num_init(PCIDevice *dev, uint16_t offset, uint64_t ser_n= um); void pcie_ats_init(PCIDevice *dev, uint16_t offset, bool aligned); =20 diff --git a/hw/net/igb.c b/hw/net/igb.c index 1c989d7677..8ff832acfc 100644 --- a/hw/net/igb.c +++ b/hw/net/igb.c @@ -431,7 +431,7 @@ static void igb_pci_realize(PCIDevice *pci_dev, Error *= *errp) hw_error("Failed to initialize AER capability"); } =20 - pcie_ari_init(pci_dev, 0x150, 1); + pcie_ari_init(pci_dev, 0x150); =20 pcie_sriov_pf_init(pci_dev, IGB_CAP_SRIOV_OFFSET, TYPE_IGBVF, IGB_82576_VF_DEV_ID, IGB_MAX_VF_FUNCTIONS, IGB_MAX_VF_FUNCTIONS, diff --git a/hw/net/igbvf.c b/hw/net/igbvf.c index 284ea61184..d55e1e8a6a 100644 --- a/hw/net/igbvf.c +++ b/hw/net/igbvf.c @@ -270,7 +270,7 @@ static void igbvf_pci_realize(PCIDevice *dev, Error **e= rrp) hw_error("Failed to initialize AER capability"); } =20 - pcie_ari_init(dev, 0x150, 1); + pcie_ari_init(dev, 0x150); } =20 static void igbvf_pci_uninit(PCIDevice *dev) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fd917fcda1..8b7168a266 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8088,7 +8088,7 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci= _dev, Error **errp) pcie_endpoint_cap_init(pci_dev, 0x80); pcie_cap_flr_init(pci_dev); if (n->params.sriov_max_vfs) { - pcie_ari_init(pci_dev, 0x100, 1); + pcie_ari_init(pci_dev, 0x100); } =20 /* add one to max_ioqpairs to account for the admin queue pair */ diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index b8c24cf45f..9a3f6430e8 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1028,8 +1028,10 @@ void pcie_sync_bridge_lnk(PCIDevice *bridge_dev) */ =20 /* ARI */ -void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn) +void pcie_ari_init(PCIDevice *dev, uint16_t offset) { + uint16_t nextfn =3D 1; + pcie_add_capability(dev, PCI_EXT_CAP_ID_ARI, PCI_ARI_VER, offset, PCI_ARI_SIZEOF); pci_set_long(dev->config + offset + PCI_ARI_CAP, (nextfn & 0xff) << 8); --=20 2.41.0 From nobody Sun May 12 21:20:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1688523922; cv=none; d=zohomail.com; s=zohoarc; b=KJjIGrIwDiWH7m9VVaV37hf5T58YO/LXkx0lLindTexI6VaUHv+b+DU1rB0rNHCts4RPnEh/ow8ozCb8o+uowb2BlfNUDSx1vyzwQFRT/Uohk0y9fJH4PfTeAglrTFCS6JI0/FTUnp81TeMiODzd45cxnbGtJOwmURDbW1CUvM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688523922; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject; bh=47Yq+XAduorsz2KmhQ+w+8/Qtk7q4JrgCgNfGVyADpw=; b=Flm1x6H3Z5KoNO3gdWh4wwBiWEaYVehT/tQ2Uh1N5ehpsV5Eb5URY0seadVOrcB4nIeYqaKVpEzipBarSIzrOtEtySue31rfhD+s40MHLT7MqogPD8CqAjsXbXhvCMRaLDGnhzhDL80hQldrMz18+GA/H1WjOlYs7BfeFXZR0vs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688523922859539.4343394480145; Tue, 4 Jul 2023 19:25:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGsC6-0007oj-Bk; Tue, 04 Jul 2023 22:24:38 -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 1qGsC4-0007oD-WB for qemu-devel@nongnu.org; Tue, 04 Jul 2023 22:24:37 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGsC3-0002FT-I0 for qemu-devel@nongnu.org; Tue, 04 Jul 2023 22:24:36 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1b0156a1c49so5116835fac.0 for ; Tue, 04 Jul 2023 19:24:35 -0700 (PDT) Received: from alarm.flets-east.jp ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with ESMTPSA id u10-20020a17090282ca00b001b8062c1db3sm15235365plz.82.2023.07.04.19.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 19:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1688523874; x=1691115874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=47Yq+XAduorsz2KmhQ+w+8/Qtk7q4JrgCgNfGVyADpw=; b=NBRCBJW0Gh6zLqEa3BDOwnb6BsaYXSKzzhvhVsW/zXejmNYZRHTyQ5aBkOtVoD+MV2 teaRrDqVjZ9SAxs5wwhUqdeFTTJ18krVsyMo3TYMij1dzl7EZyl3Jc2AyBcu/ncixXgH 0GXLebfctE5euLO+eoLNP97QOOgSkwOVj7/ybbn5FSKqF1rRpGpTBIsEMCpy5ZgR/TaN LZOB+4TlMK91d95P6ecd9eNyVY+xwoWB01EiQrckU+byXk2xpaUH6XD9X7aK+6pWlOxJ npytgkek1GHxDXVjM2Ffin12e4aFCombyNZWhWXaHlWkIAZkZUVaOEdTMz1PEM7o1OOS pu8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688523874; x=1691115874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=47Yq+XAduorsz2KmhQ+w+8/Qtk7q4JrgCgNfGVyADpw=; b=kAHieDzp9TQR5Ubi/ked5OR6Gkc/WkLJ8EkQchES8ya+JA33FZdxV3PpsLscMYa8rA cfrzcRtkvjaLvXwl9otBHBs2unY31lBiUQNQDDMAvM9Ko3m7YNPtXTA2fc43R8DIR9Vx PczSPIGTMWKelEt7vrGCu02E4UISebudYqd2HwaaYt0+N9zt14BlHlmGIThSoMwsrYXk ZW5t8DZDSKZKu4FvaBQUTCuqphKfc1+/bc5dLWVEwgAGPeO3ufTeyoe544sjBeiO3Zem XAe+HBCJFIZvStYk+leu5rYWTb8s72T5KLJy5WcgPQLVwvLtVF7vvu670s0BGJNzNWnB DQHg== X-Gm-Message-State: ABy/qLaeoDG73Nj2wUILXsAzbnGwmNDIuAwp2MLPTrRAg1pGoxe4bNHt zinxjxNuAxxo22lIQYKw7l0tvXVgpHC3+Jpifkw= X-Google-Smtp-Source: APBJJlHd/EcOVs4PMVpLY5v1w6kuQQsE7LdWj5VXUs1tsIfWuga5PDVAAec8OEuNdGP7H2SBmTvOvA== X-Received: by 2002:a05:6870:e746:b0:1b3:ec6b:b264 with SMTP id t6-20020a056870e74600b001b3ec6bb264mr335871oak.5.1688523873982; Tue, 04 Jul 2023 19:24:33 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Igor Mammedov , Ani Sinha , "Michael S . Tsirkin" , Marcel Apfelbaum , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Akihiko Odaki Subject: [PATCH v5 2/2] pcie: Specify 0 for ARI next function numbers Date: Wed, 5 Jul 2023 11:24:20 +0900 Message-ID: <20230705022421.13115-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230705022421.13115-1-akihiko.odaki@daynix.com> References: <20230705022421.13115-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2001:4860:4864:20::2e; envelope-from=akihiko.odaki@daynix.com; helo=mail-oa1-x2e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20221208.gappssmtp.com) X-ZM-MESSAGEID: 1688523923865100007 Content-Type: text/plain; charset="utf-8" The current implementers of ARI are all SR-IOV devices. The ARI next function number field is undefined for VF according to PCI Express Base Specification Revision 5.0 Version 1.0 section 9.3.7.7. The PF should end the linked list formed with the field by specifying 0 according to section 7.8.7.2. For migration, the field will keep having 1 as its value on the old virt models. Fixes: 2503461691 ("pcie: Add some SR/IOV API documentation in docs/pcie_sr= iov.txt") Fixes: 44c2c09488 ("hw/nvme: Add support for SR-IOV") Fixes: 3a977deebe ("Intrdocue igb device emulation") Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h | 2 ++ hw/core/machine.c | 1 + hw/pci/pci.c | 2 ++ hw/pci/pcie.c | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index e6d0574a29..9c5b5eb206 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -209,6 +209,8 @@ enum { QEMU_PCIE_CAP_CXL =3D (1 << QEMU_PCIE_CXL_BITNR), #define QEMU_PCIE_ERR_UNC_MASK_BITNR 11 QEMU_PCIE_ERR_UNC_MASK =3D (1 << QEMU_PCIE_ERR_UNC_MASK_BITNR), +#define QEMU_PCIE_ARI_NEXTFN_1_BITNR 12 + QEMU_PCIE_ARI_NEXTFN_1 =3D (1 << QEMU_PCIE_ARI_NEXTFN_1_BITNR), }; =20 typedef struct PCIINTxRoute { diff --git a/hw/core/machine.c b/hw/core/machine.c index 46f8f9a2b0..f0d35c6401 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -41,6 +41,7 @@ =20 GlobalProperty hw_compat_8_0[] =3D { { "migration", "multifd-flush-after-each-section", "on"}, + { TYPE_PCI_DEVICE, "x-pcie-ari-nextfn-1", "on" }, }; const size_t hw_compat_8_0_len =3D G_N_ELEMENTS(hw_compat_8_0); =20 diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e2eb4c3b4a..45a9bc0da8 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -82,6 +82,8 @@ static Property pci_props[] =3D { DEFINE_PROP_UINT32("acpi-index", PCIDevice, acpi_index, 0), DEFINE_PROP_BIT("x-pcie-err-unc-mask", PCIDevice, cap_present, 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_END_OF_LIST() }; =20 diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 9a3f6430e8..cf09e03a10 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1030,7 +1030,7 @@ void pcie_sync_bridge_lnk(PCIDevice *bridge_dev) /* ARI */ void pcie_ari_init(PCIDevice *dev, uint16_t offset) { - uint16_t nextfn =3D 1; + uint16_t nextfn =3D dev->cap_present & QEMU_PCIE_ARI_NEXTFN_1 ? 1 : 0; =20 pcie_add_capability(dev, PCI_EXT_CAP_ID_ARI, PCI_ARI_VER, offset, PCI_ARI_SIZEOF); --=20 2.41.0