From nobody Sat Feb 7 06:20:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1603214752; cv=none; d=zohomail.com; s=zohoarc; b=VGuDrY3lK67nqodEwTAR8Db569PJ2m1U9Kotos83ZbBnQ/5HN1KjJnoS6Acs+N4Imxomofd5zFvgYGykMP+E03diDBpDfs5qSACczi6HHWFsLltFJazKroU1ASRo3WY/5m/v/V0zr/qktznl+3FfNMGNu2KsDdCeE02S5Q1tq70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603214752; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Hs3zGfCdZlBKam4T/j2OWFCOhMeEDGMYaVQGrpVc+SE=; b=nJPMgPCVBq+Yatyh0PQ95D9w/0+H8M/7P5Ja9Zv3GUGPgQb+0pbZyhWzkI7pg3zA1NKJ9kNJYK8nL98BxMhN2Qr78nl42eoaQx4dDJRxrA52mQHNvOOBi8hxK+YUfXvrCdU2AtoIg0+RyQJK1p+g5D0eS0cy7hey7WXWi/nXlvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603214752884858.3584994494707; Tue, 20 Oct 2020 10:25:52 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-03_OTFWfMKOEz8SWi9oLjg-1; Tue, 20 Oct 2020 13:25:48 -0400 Received: by mail-wr1-f70.google.com with SMTP id h8so1081507wrt.9 for ; Tue, 20 Oct 2020 10:25:47 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (237.red-88-18-140.staticip.rima-tde.net. [88.18.140.237]) by smtp.gmail.com with ESMTPSA id l6sm2603241wrt.7.2020.10.20.10.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 10:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603214752; 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=Hs3zGfCdZlBKam4T/j2OWFCOhMeEDGMYaVQGrpVc+SE=; b=izc0EieR3vReheszrT8zAV1djTi0lQ/pxVtnmKa+v+p7vgafdL2LNMs4AKK2T3zZ9Blzcu FQfEadNOswyoLdlGRWnCSBJd59gq03NUrGya117wtc3vYoHNoTanWJUkp6FkEBAnkKjJ+J MMhdz4O6q6RHI9ifC97cQe+NaVlAZC8= X-MC-Unique: 03_OTFWfMKOEz8SWi9oLjg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Hs3zGfCdZlBKam4T/j2OWFCOhMeEDGMYaVQGrpVc+SE=; b=oteZbDWNzm2RmivCiy3TDpDXSuAP2UBX7lwhFv7XlwzmpHZmknpNbIEpc060DDy2Ra y1V1LoNr3/t4FzkomQGkxot7TqoKYwNJ0d/qlY6a2e5EsMJvuJ9P/IFPh3BxSM1JwCVe 7fdhidX7ZtRJ6Xk7SEI21cYyR5S6nHvpwkniXMDM50XDxYSpu9Xg3Wi4vKIEq+aJgCGw 8y4G0/7o6+9q1Jb7o/4+jv8NMcf/ScWvO5KHMuUejZWLIqw2qzaUPeEBC5d5YXfy8Fe3 4OTKxsGV+3L4Xl7fE9h4/XMzBB3tX2XwaSxHDDx/3ON1Tf1wpPoKvS8Zf1C+x36yyYFd RUZg== X-Gm-Message-State: AOAM532FM6WV+OXbiLixa5SLX2l178CpYdxcQbQkszNt2SOPr9sIBPU2 W0wBReySkUpOT08a9LTQGtf7MlnQkchRZDEySLNheSNSaU4Jt74/15bT0QvwJoZNLNs2KCjZgPd 9lNIxglFYhwteVA== X-Received: by 2002:adf:e681:: with SMTP id r1mr4520764wrm.181.1603214746949; Tue, 20 Oct 2020 10:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMj4E/AHJERHS9kwzdxk/tKIGBO/AsaNfcJhduQIrcKzhAhfvSBA1rgRSi61/Gk/T68DYdsA== X-Received: by 2002:adf:e681:: with SMTP id r1mr4520753wrm.181.1603214746804; Tue, 20 Oct 2020 10:25:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Kevin Wolf , Alex Williamson , Stefan Hajnoczi , Max Reitz , Fam Zheng , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 15/16] block/nvme: Switch to using the MSIX API Date: Tue, 20 Oct 2020 19:24:27 +0200 Message-Id: <20201020172428.2220726-16-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020172428.2220726-1-philmd@redhat.com> References: <20201020172428.2220726-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) In preparation of using multiple IRQs, switch to using the recently introduced MSIX API. Instead of allocating and assigning IRQ in a single step, we now have to use two distinct calls. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- block/nvme.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 428cda620df..a5518ad5bac 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -691,6 +691,7 @@ static int nvme_init(BlockDriverState *bs, const char *= device, int namespace, Error *local_err =3D NULL; volatile NvmeBar *regs =3D NULL; size_t min_page_size =3D 4096; + unsigned irq_count =3D MSIX_IRQ_COUNT; =20 qemu_co_mutex_init(&s->dma_map_lock); qemu_co_queue_init(&s->dma_flush_queue); @@ -784,8 +785,17 @@ static int nvme_init(BlockDriverState *bs, const char = *device, int namespace, } } =20 - ret =3D qemu_vfio_pci_init_irq(s->vfio, s->irq_notifier, - VFIO_PCI_MSIX_IRQ_INDEX, errp); + ret =3D qemu_vfio_pci_msix_init_irqs(s->vfio, &irq_count, errp); + if (ret) { + if (ret =3D=3D -EOVERFLOW) { + error_append_hint(errp, "%u IRQs requested but only %u availab= le\n", + MSIX_IRQ_COUNT, irq_count); + } + goto out; + } + + ret =3D qemu_vfio_pci_msix_set_irq(s->vfio, MSIX_SHARED_IRQ_IDX, + s->irq_notifier, errp); if (ret) { goto out; } --=20 2.26.2