From nobody Fri Dec 19 15:23:19 2025 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=1688194976; cv=none; d=zohomail.com; s=zohoarc; b=iISYiBGsbYTQ0AHmV3HKbjok2BkP+SFxooF9cMpJ5ENUtE5pm6BpsQVuPsyQfWtjr/AiESufcGdFVR0lKuvLR4HXG+AZ4u44ZX+8wsDITtLsDZk8s7jvcrvXGvm/ZKgZuJoT2/I0SdDAqwRqv2cy2dLaFlJKge8lRKRr3BegWiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194976; 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=Zsb2EYoYtxi+hLo7fouc8vYS/YOxaACOuCfNLuemkEQ=; b=mgMxc9aMG5l8VJF/y0k2dnrsAKeY5ezVWlFlvSRgxTXRMOf2kxdX8DgPBZ0JtYFGxEkUs3LwCUjsdnip/jfovTbySIwHqzHNy5E567UcRJ53lACxlciGN8btlUdh3jTqw7o0l0ebej/yOnx0y9qjq02EMTMX7xvwXdi+qr50v4c= 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 168819497673967.60846540709679; Sat, 1 Jul 2023 00:02:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUcL-0007WC-UW; Sat, 01 Jul 2023 03:02:01 -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 1qFUcL-0007Vf-26 for qemu-devel@nongnu.org; Sat, 01 Jul 2023 03:02:01 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUcJ-0000kR-KE for qemu-devel@nongnu.org; Sat, 01 Jul 2023 03:02:00 -0400 Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-34574014304so12596585ab.2 for ; Sat, 01 Jul 2023 00:01:59 -0700 (PDT) Received: from alarm.. ([157.82.204.253]) by smtp.gmail.com with ESMTPSA id jd4-20020a170903260400b001b1920cffdasm5592452plb.204.2023.07.01.00.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jul 2023 00:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20221208.gappssmtp.com; s=20221208; t=1688194918; x=1690786918; 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=Zsb2EYoYtxi+hLo7fouc8vYS/YOxaACOuCfNLuemkEQ=; b=iZY7kq6aeR/PgC7qI3f7TcEMIxZR2ybdEGv4MOhRUBV0XemoJnimyY3ogg9DfK9VRv GLPSVvh7AwEyvJqx7zZjsa2+298ennzbJoJzfQyKaciCUwMrjiKF4TNcpeRqCbnPyebk m8hTndB49lxkL60HEIUnF0kWgBGe1Y1LLNRyENJx2Yro4w6keU/UBlO5TllwFjhxQmz1 IApSs7Ms/w4kOVQLuKs09wEZmj7pXVZoauk08mFRLUVioUMgz8VCxW//ZW28ouZ0rn1w V02qzQLC67wpkIulB2bWPkX1HsxRFXX4PyQDVRy9DQs4gPTlv5DypC4ZPzY9ZDk8YUgt S4PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194918; x=1690786918; 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=Zsb2EYoYtxi+hLo7fouc8vYS/YOxaACOuCfNLuemkEQ=; b=UixAb9Cmde/rO5+6I7QCOkITRunP5v68tUxLhoW/STwQePu6wQj4hwW+sCa6+k98SI 64CoyOt9NhiPzn1WqXsRrn0biRIySD7f786uDGepZAsxX2AXLUAYNH1lRdQ25zx0yiKU bVEZgdMIthlLQ+b46pss9AZoMcjs0NHL5UqfifITHekO8UaLxowpM/15j56KThQNkiPF WysUd8n6ex0ZoR74ulJW6YYKMOTUoREm5D7jLbkD47uarCpMi2cSR9kzUzUZE73DoUt3 9IpSkYnjxFJZBpXLgvMMI1pohlpkOPVzvPhEUHg/KmFtdNfqjDHHwUEH0iQH2DdO4J9R a7aQ== X-Gm-Message-State: ABy/qLb5dp21sjXw1m7ptQvcgkUqF9VuOKw5OtQpObVyWSGf7MmzCPYQ U+Ur2ue98UGyHglyEUujlrOBC9VC0PJRkkHozN0= X-Google-Smtp-Source: APBJJlFlZ35B0rIZQzKfg3jTelGySVWGLopojw53KLoqCITw5ZsL2UZZX0SuJOz+DVy5uNgawZdFdg== X-Received: by 2002:a05:6e02:5d0:b0:345:b97e:6ba5 with SMTP id l16-20020a056e0205d000b00345b97e6ba5mr4380053ils.4.1688194918067; Sat, 01 Jul 2023 00:01:58 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Ani Sinha , "Michael S . Tsirkin" , Marcel Apfelbaum , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen , Akihiko Odaki Subject: [PATCH 2/4] hw/nvme: Fix ARI next function numbers Date: Sat, 1 Jul 2023 16:01:20 +0900 Message-ID: <20230701070133.24877-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230701070133.24877-1-akihiko.odaki@daynix.com> References: <20230701070133.24877-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::131; envelope-from=akihiko.odaki@daynix.com; helo=mail-il1-x131.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: 1688194978034100002 Content-Type: text/plain; charset="utf-8" The next function numbers are expected to form a linked list ending with 0. Fixes: 44c2c09488 ("hw/nvme: Add support for SR-IOV") Signed-off-by: Akihiko Odaki --- hw/nvme/ctrl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fd917fcda1..12500dc80b 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8088,7 +8088,12 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pc= i_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); + uint16_t nextvfn =3D pci_is_vf(pci_dev) ? + pcie_sriov_vf_number(pci_dev) + 1 : 0; + uint16_t nextfn =3D nextvfn < n->params.sriov_max_vfs ? + NVME_VF_OFFSET + nextvfn * NVME_VF_STRIDE : 0; + + pcie_ari_init(pci_dev, 0x100, nextfn); } =20 /* add one to max_ioqpairs to account for the admin queue pair */ --=20 2.41.0