Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2404121lqp; Sun, 24 Mar 2024 18:06:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVF0k94eqqn9VILgDj4qeFyH5Mcw/u5TVu2s02A9Vo2hhHOWHxUHowJsl+yM3JjdNZQ130k4wLLh5pFj+PB2j3JKjBishdRHH0ipQ4Tiw== X-Google-Smtp-Source: AGHT+IEC+F+F3/Sy8jh+Ze7jZuTAauIXWE28nkyDR16ouHVSW3dqbqG3Qpk83PqxY6F1vKMtAIWh X-Received: by 2002:a05:622a:110:b0:42e:b063:a35f with SMTP id u16-20020a05622a011000b0042eb063a35fmr6930445qtw.8.1711328773583; Sun, 24 Mar 2024 18:06:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328773; cv=pass; d=google.com; s=arc-20160816; b=cSfs6AH92Kuajip8gp4ekU/jszBF8j0sYfcyknfW0J9PbZYgqCfn47ZXRe/GKzeHsx Z3aBBRJG8YsDSutNJOlH+gni3T+YpvI3zH8Vf0EX5PfnKKxoXEgkh/oIRghE2h6bslpY sa8VrBbkWgLwCMFQPumDRF1+NOmAKgrmA/8qf1vAJAwZwFsm5TMgtM4sjF/iZIaOUXDw rKYkM4ncusc1yzIFc6C3W6oSFpb7cYtTizFg3/Q5ujiQ5aFZn8ZfxTp7AKRE0z7iBeKS u9EUkZuk4C8PAdjO/7627tskPRjQWe3UxjEqE19Y0lFkmU5pthTxRN4K4WtYe+1BFO+w SOcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nIU6IHQj8vqdqkpMIXA4uyknwYsjHbbNe7m0Bz8O+i8=; fh=W0T+01sUHHl95Bhr0Et0rxxLYz1s/KDMW/1Ed04H4wE=; b=SWTfclopAyan3PwmulUa7vpZkhuGnSTHfE1mCei0bk2Zw4KOHACctJk37cQ89JqscV tf9vPS7myR+Dp1XBQe31MyUQAchn0MhSAmexTCiP923nKkieK7Y7KACsM7IJoLS6MqHS HQWPwfHODQHDpn4Pngsk+kbC73zwCzv8ROW6ldK1BIUG4VxywLcAiDuSVz7faUC/JOHa nGjGRZVOuHhcxFbvfpuEwP0V3VyQuaonq9NYevl7xf9ROETSkqToR0NRDpZnV50NnX70 AIaoSTCC/3B+YCTX1H/hqCf8I/8DQFxSYs9WwS44vpFlxHwwFWNRwvsvq8YTELrdQFCf tSnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LahJczCn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb6-20020a05622a1b0600b004314468d737si3503321qtb.537.2024.03.24.18.06.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:06:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LahJczCn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113570-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 527281C24C20 for ; Mon, 25 Mar 2024 01:06:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90ED813E8A5; Sun, 24 Mar 2024 22:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LahJczCn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2C7013E885; Sun, 24 Mar 2024 22:46:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320373; cv=none; b=KKLPJg1bmFVK5gLyq7RK7RscettLKcJ3qVlPDFcNFbZ01215Ipjxhfcf7Q/pV2DxJZKeM7+FZptMe5tfB9BnfOWWQQK45XBrIy2xZxOJAA0So0/bvDCm+mkQ5tE9voLBC3DdeF2JKipn7cjPnDUS28VleSeWLy68a6x6tr7bN6I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320373; c=relaxed/simple; bh=mHp4t9LUu90DYcXmHQKech3ILVMtwNGotIo/LrGB108=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LlC8LaSuGd/cbySj/rKof4R1bbBG8JDyLYcYDG8P40uwZv67yTzDDtDFezLiSuFYwXYLzs3zAyM3IlQGQkA1lHG3UN8q0/HUEjxZA3NTM31nvcQau0JaXiEyjgZ/z9TPXtMF5dh52fSX+1xRMoEw1o0gvgrYngIfVYrMtakKRiY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LahJczCn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D05EC433C7; Sun, 24 Mar 2024 22:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320373; bh=mHp4t9LUu90DYcXmHQKech3ILVMtwNGotIo/LrGB108=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LahJczCn4MqSJp/bo15Hl61AoQxzCo29yMAyNsAE5Enm9gkyzt1ENtWA4aPETlauD rDejeslpr1WxYyk9/8v7IHSjcYx6qQFCccVXUYk0T2q5VuWNlW18PFSxHurObHKz85 dyfZwPrMP5i9r2EqpGes0ltzvGpe7oz2tNgW36Hg9HfB3Go5vIh5jRBRMAlTarjIvs AKYFAiSR3tbhBaXofZiEA5sOGJLu4u5kTjus6He0Y9ojVnCFRfhUzmlOgpjy9a09nx 78H8fIs56dLwwSaHTLrQixb4lULC+fK63kLvLfT+r25Ye/a3JS4e1pXl4LeoF6TofC xmGOISyLrfcDw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jonah Palmer , Dragos Tatulea , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , "Michael S . Tsirkin" , Lei Yang , Sasha Levin Subject: [PATCH 6.8 679/715] vdpa/mlx5: Allow CVQ size changes Date: Sun, 24 Mar 2024 18:34:18 -0400 Message-ID: <20240324223455.1342824-680-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jonah Palmer [ Upstream commit 749a4016839270163efc36ecddddd01de491a16b ] The MLX driver was not updating its control virtqueue size at set_vq_num and instead always initialized to MLX5_CVQ_MAX_ENT (16) at setup_cvq_vring. Qemu would try to set the size to 64 by default, however, because the CVQ size always was initialized to 16, an error would be thrown when sending >16 control messages (as used-ring entry 17 is initialized to 0). For example, starting a guest with x-svq=on and then executing the following command would produce the error below: # for i in {1..20}; do ifconfig eth0 hw ether XX:xx:XX:xx:XX:XX; done qemu-system-x86_64: Insufficient written data (0) [ 435.331223] virtio_net virtio0: Failed to set mac address by vq command. SIOCSIFHWADDR: Invalid argument Acked-by: Dragos Tatulea Acked-by: Eugenio PĂ©rez Signed-off-by: Jonah Palmer Message-Id: <20240216142502.78095-1-jonah.palmer@oracle.com> Signed-off-by: Michael S. Tsirkin Tested-by: Lei Yang Fixes: 5262912ef3cf ("vdpa/mlx5: Add support for control VQ and MAC setting") Signed-off-by: Sasha Levin --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 778821bab7d93..ecfc16151d619 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -151,8 +151,6 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; -#define MLX5_CVQ_MAX_ENT 16 - #define MLX5_LOG_VIO_FLAG(_feature) \ do { \ if (features & BIT_ULL(_feature)) \ @@ -2276,9 +2274,16 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num) struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); struct mlx5_vdpa_virtqueue *mvq; - if (!is_index_valid(mvdev, idx) || is_ctrl_vq_idx(mvdev, idx)) + if (!is_index_valid(mvdev, idx)) return; + if (is_ctrl_vq_idx(mvdev, idx)) { + struct mlx5_control_vq *cvq = &mvdev->cvq; + + cvq->vring.vring.num = num; + return; + } + mvq = &ndev->vqs[idx]; mvq->num_ent = num; } @@ -2963,7 +2968,7 @@ static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) u16 idx = cvq->vring.last_avail_idx; err = vringh_init_iotlb(&cvq->vring, mvdev->actual_features, - MLX5_CVQ_MAX_ENT, false, + cvq->vring.vring.num, false, (struct vring_desc *)(uintptr_t)cvq->desc_addr, (struct vring_avail *)(uintptr_t)cvq->driver_addr, (struct vring_used *)(uintptr_t)cvq->device_addr); -- 2.43.0