From nobody Wed Feb 11 02:52:59 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5433F147C82 for ; Fri, 5 Jul 2024 10:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720174146; cv=none; b=fU/Su9iNuFj0bGul4A5RscotcGvsAVqug0KGgU9w2mJhv0VzpabOF9L+M18uvzedINY+Xe981N568r8iquy5d7hmtUr8I2uNoT32VqPCQXTURztCCky2bbjsgtNv+sHw1jUSHhSyvkvZqhcLVP5Mx61xGPAd8RzyekLHwShX27A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720174146; c=relaxed/simple; bh=rMLjExNgz/IU1O7Z+G9luUh0k8XaToBZvPbBUK3llI4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hWbNhPxqcmVML/JmcwFFsr6ZCdM8VRDyFD6K6gjCYjYq4qMnmyMlO45g+rfi093H96efScP+pZsoAqrQvo/4QDQ7irWO4a6Z96i/pVPtUjadtwiYEkbVxxGYlYwUH4wealenBrdCXvV/pbYQYUurI1DvrvTMTmgpeKKHO79rNec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gEqF0Wvv; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gEqF0Wvv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720174144; 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=e2G39rZ+nqGSoo1qiWSSlqDlIEz6QAAgqtld8n+Pdxs=; b=gEqF0WvvlmMg/vhnTTJ8SkGjrskUC7xdlZEx15jDaugV+CIKVszEEpk69uwCnx8430XeLf 7xR5RI8TqFWnSw1jh1NRHLgTEF+V8M5m+OO3czdatZbcB+cZlkMBx0TgaMKnk0DlfPKWFm xr1sCvvDeZat4MCJMjaNwc8z+MiAUec= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-MJ6DwY4VNSSRiyRGwO97eA-1; Fri, 05 Jul 2024 06:09:03 -0400 X-MC-Unique: MJ6DwY4VNSSRiyRGwO97eA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3678fd1edf8so1353692f8f.0 for ; Fri, 05 Jul 2024 03:09:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720174141; x=1720778941; 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=e2G39rZ+nqGSoo1qiWSSlqDlIEz6QAAgqtld8n+Pdxs=; b=RqxIsYeyWZctofTAiydtwzfbKJVn59E9Df+wPRM2XOGQo0SVtezmQ3U3no7pKlSYgT eCEsNrMTWKXqpmtSuwO08nHqa7+r50SMEWu3Jtx6WJLmj6k8eelKvlsd716ex2zbC3g2 lJRfqMGxEh36umT7WSgiu5fxSrcuJODeQWFYhGBVzZ37ZW3BXrSStF8KcEvMwGDGWo5M e98+BWQQ+gvWsRpg6Ov10pVg6we/Fi5IjkdNLPvYiruaP3i+eyc5CKgfsMJNtGV7ZZwT /hq5aqOY5+w0mkDHsJi0PUUpkMT210/M6tXiNYahLYpddxp3wndgiCZMpHOA2uTDXATl /fdA== X-Gm-Message-State: AOJu0YyhsoUU8agL46mGDp1fsdbAtGeCCOacp0SOS+s3Cg5jxTIHjcT/ j2BqwTcw2SIazMkUVW+TzBJdWDajS6jJVu/OVPR+3AfomQS1hegzmB914oCI/Vp/jA9nwqM+uR+ gQZI0a7wJPdYTFzE6TixD2Sp+R31+fy4wlA6DHDLbOs8jLiSrlWaLIsdKjf2zqRVoP/1mGJ5dFV X/eArqY5LHN1dXB+2AF/z3A8yL7T8Fz20epiajnPY= X-Received: by 2002:adf:f8d0:0:b0:367:8fe2:7d8b with SMTP id ffacd0b85a97d-3679f76fd93mr3949989f8f.31.1720174141133; Fri, 05 Jul 2024 03:09:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMAgWFq4fXL1Je4jdABy0qUuf3ABlgDmJ2qvyznosNn3i9WEJUQp3T1tA9aMRJHM7r/dA6jg== X-Received: by 2002:adf:f8d0:0:b0:367:8fe2:7d8b with SMTP id ffacd0b85a97d-3679f76fd93mr3949954f8f.31.1720174140593; Fri, 05 Jul 2024 03:09:00 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f0:a185:2de6:83fc:7632:9788]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4264a1d0bd6sm55952075e9.8.2024.07.05.03.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:09:00 -0700 (PDT) Date: Fri, 5 Jul 2024 06:08:55 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Alexander Duyck , Xuan Zhuo , Andrew Morton , David Hildenbrand , Jason Wang , Eugenio =?utf-8?B?UMOpcmV6?= , virtualization@lists.linux.dev Subject: [PATCH 1/2] virtio_balloon: add work around for out of spec QEMU Message-ID: <14b1a2a1acfcaf6d519db8c67f6f207d7cdd7c3b.1720173841.git.mst@redhat.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" QEMU implemented the configuration VIRTIO_BALLOON_F_REPORTING && ! VIRTIO_BALLOON_F_FREE_PAGE_HINT incorrectly: it then uses vq3 for reporting, spec says it is always 4. This is masked by a corresponding bug in driver: add a work around as I'm going to try and fix the driver bug. Signed-off-by: Michael S. Tsirkin Acked-by: David Hildenbrand Acked-by: Jason Wang Reported-by: Xuan Zhuo --- drivers/virtio/virtio_balloon.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloo= n.c index 9a61febbd2f7..7dc3fcd56238 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -597,8 +597,23 @@ static int init_vqs(struct virtio_balloon *vb) =20 err =3D virtio_find_vqs(vb->vdev, VIRTIO_BALLOON_VQ_MAX, vqs, callbacks, names, NULL); - if (err) - return err; + if (err) { + /* + * Try to work around QEMU bug which since 2020 confused vq numbers + * when VIRTIO_BALLOON_F_REPORTING but not + * VIRTIO_BALLOON_F_FREE_PAGE_HINT are offered. + */ + if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING) && + !virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { + names[VIRTIO_BALLOON_VQ_FREE_PAGE] =3D "reporting_vq"; + callbacks[VIRTIO_BALLOON_VQ_FREE_PAGE] =3D balloon_ack; + err =3D virtio_find_vqs(vb->vdev, + VIRTIO_BALLOON_VQ_REPORTING, vqs, callbacks, names, NULL); + } + + if (err) + return err; + } =20 vb->inflate_vq =3D vqs[VIRTIO_BALLOON_VQ_INFLATE]; vb->deflate_vq =3D vqs[VIRTIO_BALLOON_VQ_DEFLATE]; --=20 MST From nobody Wed Feb 11 02:52:59 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5282146A8D for ; Fri, 5 Jul 2024 10:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720174155; cv=none; b=iXhhe2P4HGXqBxrMIR2MjEPB4y2/Q8jH4hG8x+LzzuxNpauWHXhs9GVq/X6PiKyoEAqm6MQ0s3OpjytgBx0ul/iWPewH/pGFgwKDKTep+/zzZegoTlC3Z/0DrNF7KXjQU4METSVgE3AWTl/o6bGX5DpaB0XJlG0tUd8WpnOZ2WE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720174155; c=relaxed/simple; bh=hTt1vb2rlKzdwlZrBwUZKYn386WW4/puEcuG/xh7pBc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IwjlZmEgw9DJ7PmAlulraP8T4IKcF5aOKgtOl2t1qb/uptARopPhyGuwKQYkJJfk9CfgShs/ekXcJ+j3hQ5gjCxO3XupV5Ai4MZhnvFkxlzeTK9ua2b3xPC2ZhGev3yZO7+1gNPLYErgd2lCmjbQ9Tfp0IB7U8yg/uNbSMKF2xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BdDZ5HD0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BdDZ5HD0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720174152; 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=Odn3kI68k2nJO/AKzhT19WX3OnWz2Ozg0VobWfUmy3A=; b=BdDZ5HD0iyApu7/ZuXewiaa6jDPczxjRgUAba/STsMigGySzcIc3ZrxA5GDOz84DlB6ss3 CRI72Kbdw34pa7Fpf2IhD0EDg6I0f6jS7cNdD0GnjC60HxZubzjbPLXA9x8ft1rTb6+wqx JZ6WCPFP4t2O/4qyA+TmCPcALAp5E3g= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-644-9YZ48uuBNhS9cqmhCps9Rg-1; Fri, 05 Jul 2024 06:09:11 -0400 X-MC-Unique: 9YZ48uuBNhS9cqmhCps9Rg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-36795e2ce86so800781f8f.0 for ; Fri, 05 Jul 2024 03:09:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720174150; x=1720778950; 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=Odn3kI68k2nJO/AKzhT19WX3OnWz2Ozg0VobWfUmy3A=; b=KOelZhHUswlkyafAkax3VVRM3QhdSA73JY7HfrHgxydNyacH1DcqZ9xx+01P23/aHR Po3p/BMwrw89QVSKibfdDvzCzXPPEtRjNYxqrxpbTFK8KSMHXNxP28+/GYU8Mc69qyD1 ZfWIWrxIdYfYzlYOtS89JhJ2lB0mscsHvMRp2KL4OPp8DCP3a1NDILoAv/RpGPbtfm6U bXeLjmdIItlrWGHLoYnnCjuTqiArmDWaCAlcaWHayih2szGML6tJwUn1elekN6lVSIMA Lz+oxDFdH7KT55X1SO7ZGvzpy6g9K1b9Wn/11P6nW+rK/HuCdNbmNYY4LfkSDfCRBMBD IhnA== X-Gm-Message-State: AOJu0YwjV4XGqtRRpyOqFV9YZO3GLAhetxHZXwtZ/+ifUywWzIPIhGlD vadk72aT2y7wbWcJox4a84C/B5V+Y9f5qmWC9jNC1WBUW6c4ZzndJVcv9AWtDvOmonhOFfAiPGz WJzl0xLsc1UD8q2kFjTTNEzi41IoXQ35kunArfTplWT3IxauVx4sEnxUbLfr9yl9FZe12t+w8Gp PDjcpT77mu5eC3/bhBAwWYvV2Tpglruo///IaVctM= X-Received: by 2002:a05:6000:18d1:b0:366:f001:78d5 with SMTP id ffacd0b85a97d-3679dd15831mr2701335f8f.13.1720174149811; Fri, 05 Jul 2024 03:09:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4wwtYRyztkbCukZKtbADwQgiOS0R3XAJxhjPsgDTBQMKf8FQrtcOZyu+TAhVhA0306KQefg== X-Received: by 2002:a05:6000:18d1:b0:366:f001:78d5 with SMTP id ffacd0b85a97d-3679dd15831mr2701283f8f.13.1720174149018; Fri, 05 Jul 2024 03:09:09 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f0:a185:2de6:83fc:7632:9788]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3678eb6593bsm7742101f8f.93.2024.07.05.03.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 03:09:08 -0700 (PDT) Date: Fri, 5 Jul 2024 06:09:01 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: Alexander Duyck , Xuan Zhuo , Andrew Morton , David Hildenbrand , Richard Weinberger , Anton Ivanov , Johannes Berg , Bjorn Andersson , Mathieu Poirier , Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Jason Wang , Eugenio =?utf-8?B?UMOpcmV6?= , linux-um@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org Subject: [PATCH 2/2] virtio: fix vq # when vq skipped Message-ID: <1a5d7456542bcd1df8e397c93c48deacd244add5.1720173841.git.mst@redhat.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" virtio balloon communicates to the core that in some configurations vq #s are non-contiguous by setting name pointer to NULL. Unfortunately, core then turned around and just made them contiguous again. Result is that driver is out of spec. Implement what the API was supposed to do in the 1st place. Compatibility with buggy hypervisors is handled inside virtio-balloon, which is the only driver making use of this facility, so far. Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Reported-by: Xuan Zhuo Reviewed-by: David Hildenbrand --- arch/um/drivers/virtio_uml.c | 4 ++-- drivers/remoteproc/remoteproc_virtio.c | 4 ++-- drivers/s390/virtio/virtio_ccw.c | 4 ++-- drivers/virtio/virtio_mmio.c | 4 ++-- drivers/virtio/virtio_pci_common.c | 8 ++++---- drivers/virtio/virtio_vdpa.c | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c index 77faa2cf3a13..d65346cd340e 100644 --- a/arch/um/drivers/virtio_uml.c +++ b/arch/um/drivers/virtio_uml.c @@ -1019,7 +1019,7 @@ static int vu_find_vqs(struct virtio_device *vdev, un= signed nvqs, struct irq_affinity *desc) { struct virtio_uml_device *vu_dev =3D to_virtio_uml_device(vdev); - int i, queue_idx =3D 0, rc; + int i, rc; struct virtqueue *vq; =20 /* not supported for now */ @@ -1036,7 +1036,7 @@ static int vu_find_vqs(struct virtio_device *vdev, un= signed nvqs, continue; } =20 - vqs[i] =3D vu_setup_vq(vdev, queue_idx++, callbacks[i], names[i], + vqs[i] =3D vu_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false); if (IS_ERR(vqs[i])) { rc =3D PTR_ERR(vqs[i]); diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/re= moteproc_virtio.c index 25b66b113b69..2d17135abb66 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -187,7 +187,7 @@ static int rproc_virtio_find_vqs(struct virtio_device *= vdev, unsigned int nvqs, const bool * ctx, struct irq_affinity *desc) { - int i, ret, queue_idx =3D 0; + int i, ret; =20 for (i =3D 0; i < nvqs; ++i) { if (!names[i]) { @@ -195,7 +195,7 @@ static int rproc_virtio_find_vqs(struct virtio_device *= vdev, unsigned int nvqs, continue; } =20 - vqs[i] =3D rp_find_vq(vdev, queue_idx++, callbacks[i], names[i], + vqs[i] =3D rp_find_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false); if (IS_ERR(vqs[i])) { ret =3D PTR_ERR(vqs[i]); diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_= ccw.c index d6491fc84e8c..64541b3bb8a2 100644 --- a/drivers/s390/virtio/virtio_ccw.c +++ b/drivers/s390/virtio/virtio_ccw.c @@ -696,7 +696,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vd= ev, unsigned nvqs, { struct virtio_ccw_device *vcdev =3D to_vc_device(vdev); dma64_t *indicatorp =3D NULL; - int ret, i, queue_idx =3D 0; + int ret, i; struct ccw1 *ccw; dma32_t indicatorp_dma =3D 0; =20 @@ -710,7 +710,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vd= ev, unsigned nvqs, continue; } =20 - vqs[i] =3D virtio_ccw_setup_vq(vdev, queue_idx++, callbacks[i], + vqs[i] =3D virtio_ccw_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false, ccw); if (IS_ERR(vqs[i])) { diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 173596589c71..a3a66a0b7cb1 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -496,7 +496,7 @@ static int vm_find_vqs(struct virtio_device *vdev, unsi= gned int nvqs, { struct virtio_mmio_device *vm_dev =3D to_virtio_mmio_device(vdev); int irq =3D platform_get_irq(vm_dev->pdev, 0); - int i, err, queue_idx =3D 0; + int i, err; =20 if (irq < 0) return irq; @@ -515,7 +515,7 @@ static int vm_find_vqs(struct virtio_device *vdev, unsi= gned int nvqs, continue; } =20 - vqs[i] =3D vm_setup_vq(vdev, queue_idx++, callbacks[i], names[i], + vqs[i] =3D vm_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false); if (IS_ERR(vqs[i])) { vm_del_vqs(vdev); diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci= _common.c index f6b0b00e4599..eeff060cacec 100644 --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -292,7 +292,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev,= unsigned int nvqs, { struct virtio_pci_device *vp_dev =3D to_vp_device(vdev); u16 msix_vec; - int i, err, nvectors, allocated_vectors, queue_idx =3D 0; + int i, err, nvectors, allocated_vectors; =20 vp_dev->vqs =3D kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL); if (!vp_dev->vqs) @@ -328,7 +328,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev,= unsigned int nvqs, msix_vec =3D allocated_vectors++; else msix_vec =3D VP_MSIX_VQ_VECTOR; - vqs[i] =3D vp_setup_vq(vdev, queue_idx++, callbacks[i], names[i], + vqs[i] =3D vp_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false, msix_vec); if (IS_ERR(vqs[i])) { @@ -365,7 +365,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev,= unsigned int nvqs, const char * const names[], const bool *ctx) { struct virtio_pci_device *vp_dev =3D to_vp_device(vdev); - int i, err, queue_idx =3D 0; + int i, err; =20 vp_dev->vqs =3D kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL); if (!vp_dev->vqs) @@ -383,7 +383,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev,= unsigned int nvqs, vqs[i] =3D NULL; continue; } - vqs[i] =3D vp_setup_vq(vdev, queue_idx++, callbacks[i], names[i], + vqs[i] =3D vp_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false, VIRTIO_MSI_NO_VECTOR); if (IS_ERR(vqs[i])) { diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index e803db0da307..fe91a5d673dc 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -370,7 +370,7 @@ static int virtio_vdpa_find_vqs(struct virtio_device *v= dev, unsigned int nvqs, struct cpumask *masks; struct vdpa_callback cb; bool has_affinity =3D desc && ops->set_vq_affinity; - int i, err, queue_idx =3D 0; + int i, err; =20 if (has_affinity) { masks =3D create_affinity_masks(nvqs, desc ? desc : &default_affd); @@ -384,7 +384,7 @@ static int virtio_vdpa_find_vqs(struct virtio_device *v= dev, unsigned int nvqs, continue; } =20 - vqs[i] =3D virtio_vdpa_setup_vq(vdev, queue_idx++, + vqs[i] =3D virtio_vdpa_setup_vq(vdev, i, callbacks[i], names[i], ctx ? ctx[i] : false); if (IS_ERR(vqs[i])) { --=20 MST