From nobody Fri Dec 19 13:46:20 2025 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9399018E77D for ; Tue, 3 Sep 2024 17:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383722; cv=none; b=qvHuoeVC3/ncpH9yRWKYWcRsXT78Wvyf8i1aS5ZuN52qAL5AwcAO1OrUqNVuvEJOP+NSM0mEJHRAsJ+yTXd41AEmuk2347gsBc+vAUt0Z2D0pAhu5t7GaWi7vquCqVgAHxdziJKD+8JxYhUmVDk9rV/lW90my8E1Dl0HxFC8chE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383722; c=relaxed/simple; bh=UBXaEzD6NsiHqvODjvX31vkv3EiWvvL8bQ23FaxJHds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ip64LEMERYAwRta++gZ1NuHpb4XsMrbSMP9k3H2k4BuEdl/HNVbVBCCbLdDE0Yg+8F2cZeGrCs/DoSm7KRJTwRex/KS3u3LKRmo5aukv/1xBXFRCYCcDZcFAlVyE6X31yGx7i0FYgcsx6cbZljtAmmOk2zVYxSxAvMOp6GTHJI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ivzn69SD; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ivzn69SD" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3df0fc40271so2917663b6e.3 for ; Tue, 03 Sep 2024 10:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725383720; x=1725988520; darn=vger.kernel.org; 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=g3qsiMSfNmjbkX2eCu5p1cSwOlsmlaRHY+Cyc4oyQRM=; b=ivzn69SDJvHLoMKWytubC5Wt21MbJD2h4XwImA2bWxLXVlh/09sCIYh70Tr7xsvC2I cJL05MdLPcpepnDyhvIrZLA2Ybi8K08s8luX/BNgorsMKcpuhOjAXqRygbJ8yHbH8dqC zvKiDe9Ue8ZFFW7P1qkfaDjIwAYTCulVNkUdgd1mJSqHGwIkTxA/DQMnSQTm5UnKGski wJtmL4o2aCESGSZKrJXvh/Kk7ZAgdXVL9LHnBpeUealAkHxH7Dxdia1j8C10piIfARrb WtALm4NREsYmZgC/8w5/x5Gq8QEkzv7GbEKJ18d7iMx/57X2hYaC0cKGv+PRGygC7i47 FxCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725383720; x=1725988520; 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=g3qsiMSfNmjbkX2eCu5p1cSwOlsmlaRHY+Cyc4oyQRM=; b=B2bJt9AjU8nMcOVTFga+hC/vznzzc0Es3tmAlpIA9VBaGyIGXwG1xlm7v2j1Hev1PY 9l73Bw4FHa2YGKtPrNoWFf+FqhwWN4LBUg53UQ4TtjfuqwDQze0Rre0+L//2I66OBFBN 2llfGOiADrNHYhpSk3KbM6pylwEYHTbE47oSTsU2zIG2vk9p3mwvFbu6VghhgIGD+9zA q2GbY8o4NqnlWre9+x2PvGWMdIMwdhM1GUAEpmte+BgCOQzzb3K+hvK/+2EzDTvupVR3 078n9vG4ebGRCBqrYtigGe0ZRXuCUSwJwOhExtm3LgU+oym2Vthcq9xfgUsbTYwb9108 NU3Q== X-Forwarded-Encrypted: i=1; AJvYcCWt6YBrSC9NLqY4R066YRLQ4y404uZgYwUa1k2pestBP+UHN3qIO+zdL9OjezvxCIbPrAQ6zHM9vRMWxN0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4yeChxGSuYMvGx5jNZ/YOs/pNx8hGwEWbrVdrY9JvQzJQUnxP 16sceDymCnPMU92/Up9OGqU6Gsh7sIhd7dOZ+PE+WzVDEIHIDzhR X-Google-Smtp-Source: AGHT+IGV3rZD7KoP/5wlhFh2OPfdnNraXwEmrcwJLNm4tP3Ng+C7cF2gR3/JZeN6QHjpyybEFYbohQ== X-Received: by 2002:a05:6808:2f0f:b0:3df:3bf8:277d with SMTP id 5614622812f47-3df3bf828d7mr11854811b6e.44.1725383719560; Tue, 03 Sep 2024 10:15:19 -0700 (PDT) Received: from pipaware.tx.rr.com ([2603:8080:7400:36da:dff5:4180:2562:4c1e]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3df117a5f91sm2398059b6e.2.2024.09.03.10.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 10:15:19 -0700 (PDT) From: Carlos Bilbao To: dtatulea@nvidia.com, mst@redhat.com, jasowang@redhat.com, shannon.nelson@amd.com, sashal@kernel.org, alvaro.karsz@solid-run.com, christophe.jaillet@wanadoo.fr, steven.sistare@oracle.com Cc: bilbao@vt.edu, xuanzhuo@linux.alibaba.com, johnah.palmer@oracle.com, eperezma@redhat.com, cratiu@nvidia.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, Carlos Bilbao Subject: [PATCH v2 1/2] vdpa/mlx5: Set speed and duplex of vDPA devices to UNKNOWN Date: Tue, 3 Sep 2024 12:15:13 -0500 Message-ID: <20240903171514.201569-2-carlos.bilbao.osdev@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903171514.201569-1-carlos.bilbao.osdev@gmail.com> References: <20240903171514.201569-1-carlos.bilbao.osdev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Bilbao Initialize the speed and duplex fields in virtio_net_config to UNKNOWN. This is needed because mlx5_vdpa vDPA devicess currently do not support the VIRTIO_NET_F_SPEED_DUPLEX feature which reports speed and duplex. Add needed helper cpu_to_mlx5vdpa32() to convert endianness of speed. Signed-off-by: Carlos Bilbao Reviewed-by: Dragos Tatulea --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5= _vnet.c index b56aae3f7be3..5fce6d62af4f 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -173,6 +173,11 @@ static __virtio16 cpu_to_mlx5vdpa16(struct mlx5_vdpa_d= ev *mvdev, u16 val) return __cpu_to_virtio16(mlx5_vdpa_is_little_endian(mvdev), val); } =20 +static __virtio32 cpu_to_mlx5vdpa32(struct mlx5_vdpa_dev *mvdev, u32 val) +{ + return __cpu_to_virtio32(mlx5_vdpa_is_little_endian(mvdev), val); +} + static u16 ctrl_vq_idx(struct mlx5_vdpa_dev *mvdev) { if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) @@ -3433,6 +3438,13 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v= _mdev, const char *name, init_rwsem(&ndev->reslock); config =3D &ndev->config; =20 + /* + * mlx5_vdpa vDPA devices currently don't support reporting or + * setting the speed or duplex. + */ + config->speed =3D cpu_to_mlx5vdpa32(mvdev, SPEED_UNKNOWN); + config->duplex =3D DUPLEX_UNKNOWN; + if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MTU)) { err =3D config_func_mtu(mdev, add_config->net.mtu); if (err) --=20 2.34.1 From nobody Fri Dec 19 13:46:20 2025 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F0B1922C0 for ; Tue, 3 Sep 2024 17:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383726; cv=none; b=NGBGWMvIxLyyc67ZQKxCdqWRmYgzWBRZ9/lsGWtYIsRRqrMgNFxf4w43JLufulunVdVmu3r8i9bRz2oi1sTTZIzBZzGfO2ij+b3zygHGMEzFtHq+6FZQIJrRvwHbMPGzQZ5crOm0GqdGOwSSab2YpU07GGeOA0wf7eBMDRh7KJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383726; c=relaxed/simple; bh=aERogzXtJQn2Or0/3DmemlSZGKmoyU6sPMwDbN3yxas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oZSiXmyR3PvqpQxTpgO54UUB2vNU+yYo3WFVuQ0MLo9+83BLXEb5p+EVxvBrbl7+TX02TBusNMs/irBu8Jmp3uIKXaTtz7joeEs9bQKOVFGPwIeRTNn75OKujoZ8/w8Dt6HduwN1o20UYr7fOz+fgTNUJZD1qqS3QtXG638yqNw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KQWyjlFf; arc=none smtp.client-ip=209.85.161.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KQWyjlFf" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-5dca9cc71b2so3398127eaf.2 for ; Tue, 03 Sep 2024 10:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725383721; x=1725988521; darn=vger.kernel.org; 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=GuvsYRptGrqy3J1GxjNuAynZOsyxO34wvYOEmPK25yo=; b=KQWyjlFf9a82rorHm8Gxq5Cpa7m0Z8+TvcNaixrQ/febT574z+Od6FYbtwqd+FDrMo fwoWRrVFNN5IKtZKluytTSWmiOFColjT1yi9Gg/vYHmEvTz+0Ve3QKg5v95RlctvN4QC ZghIk1hyjSiRtfXMdkVj7y0DY6NPSruUsAleI1F0M3y61ezqyrpHm2LgcTk9OzmuZa59 5dMHmzDl08ox32piWFoCnBkiGz/gKuJ5rpxrZwo3U9WliQZ4MR8LRckIPvnQwc4mBhSZ QWyBi2yBqJPJdN4WJoncCI6d0+EfdhU6hgoWeXBe5Lq1HxEeO5vAhlzT6HWn1UEst+dz kcjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725383721; x=1725988521; 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=GuvsYRptGrqy3J1GxjNuAynZOsyxO34wvYOEmPK25yo=; b=twEEMnKulOOsXjmjVrZdzBRJAdqjWKNv0afmrD30gqMcb3jea2YB7L7Y195UMApi0S ID71BGC7VSImYRRGyAClRuiGPzdK4KR2eVRMkLMjYdv6/x2CbMQl1lOkfIa3FP6bWIJR frcz+FGn17HCJ5unefUwD1E5QitkypWqKMnfKjtWryzuX9PENBXovjprEz1ie/zaLQCB l7tD+tkhSP5sK/+tzp567CaeZm+QWgYq1zZPP8Tec7EDoPeTUsNsp/p0s6w1dvwmzfmc vLURgJY3ISwiyYnwwbqulkEFLaHVKl1mTOKeGibcOeJORLb1H219xq/g+eFgjzW3Hd16 63Dw== X-Forwarded-Encrypted: i=1; AJvYcCUjE9CvTX5//bK7V7+KftYIrurSJ1Z1PJ4pjoFOcx60vMhpykzC9oPglETuh/ojagoUdHc1Pyj9qd27hsQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxaXkDdtWvpUzQWznVjf7rClQIx8k4RwC3fQ8gmYALFx0PbV2+F ETywVkVqqtg+pw4MPdBKwVkc6EupDue4h6I1NIrWSuLEDuV9O4wj X-Google-Smtp-Source: AGHT+IEwNCR1vD+92U640kHqcZuZcA/MDBgrEh5snvTf6Q+p/aBPqfQmAwK5nA9dOhTZpmEBxngtcg== X-Received: by 2002:a05:6808:10cd:b0:3d9:27f5:5251 with SMTP id 5614622812f47-3df05c3187cmr19737830b6e.5.1725383721545; Tue, 03 Sep 2024 10:15:21 -0700 (PDT) Received: from pipaware.tx.rr.com ([2603:8080:7400:36da:dff5:4180:2562:4c1e]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3df117a5f91sm2398059b6e.2.2024.09.03.10.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 10:15:21 -0700 (PDT) From: Carlos Bilbao To: dtatulea@nvidia.com, mst@redhat.com, jasowang@redhat.com, shannon.nelson@amd.com, sashal@kernel.org, alvaro.karsz@solid-run.com, christophe.jaillet@wanadoo.fr, steven.sistare@oracle.com Cc: bilbao@vt.edu, xuanzhuo@linux.alibaba.com, johnah.palmer@oracle.com, eperezma@redhat.com, cratiu@nvidia.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, Carlos Bilbao Subject: [PATCH v2 2/2] vdpa: Remove ioctl VHOST_VDPA_SET_CONFIG per spec compliance Date: Tue, 3 Sep 2024 12:15:14 -0500 Message-ID: <20240903171514.201569-3-carlos.bilbao.osdev@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903171514.201569-1-carlos.bilbao.osdev@gmail.com> References: <20240903171514.201569-1-carlos.bilbao.osdev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Carlos Bilbao Remove invalid ioctl VHOST_VDPA_SET_CONFIG and all its implementations with vdpa_config_ops->set_config(). This is needed per virtio spec requirements; virtio-spec v3.1 Sec 5.1.4 states that "All of the device configuration fields are read-only for the driver." Signed-off-by: Carlos Bilbao --- drivers/vdpa/alibaba/eni_vdpa.c | 17 ----------------- drivers/vdpa/ifcvf/ifcvf_main.c | 10 ---------- drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 ------- drivers/vdpa/pds/vdpa_dev.c | 16 ---------------- drivers/vdpa/solidrun/snet_main.c | 18 ------------------ drivers/vdpa/vdpa.c | 16 ---------------- drivers/vdpa/vdpa_sim/vdpa_sim.c | 16 ---------------- drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 - drivers/vdpa/vdpa_user/vduse_dev.c | 7 ------- drivers/vdpa/virtio_pci/vp_vdpa.c | 14 -------------- drivers/vhost/vdpa.c | 26 -------------------------- drivers/virtio/virtio_vdpa.c | 9 --------- include/linux/vdpa.h | 9 --------- include/uapi/linux/vhost.h | 8 ++++---- 14 files changed, 4 insertions(+), 170 deletions(-) diff --git a/drivers/vdpa/alibaba/eni_vdpa.c b/drivers/vdpa/alibaba/eni_vdp= a.c index cce3d1837104..d8f70b385661 100644 --- a/drivers/vdpa/alibaba/eni_vdpa.c +++ b/drivers/vdpa/alibaba/eni_vdpa.c @@ -383,22 +383,6 @@ static void eni_vdpa_get_config(struct vdpa_device *vd= pa, *p++ =3D ioread8(ioaddr + i); } =20 -static void eni_vdpa_set_config(struct vdpa_device *vdpa, - unsigned int offset, const void *buf, - unsigned int len) -{ - struct eni_vdpa *eni_vdpa =3D vdpa_to_eni(vdpa); - struct virtio_pci_legacy_device *ldev =3D &eni_vdpa->ldev; - void __iomem *ioaddr =3D ldev->ioaddr + - VIRTIO_PCI_CONFIG_OFF(eni_vdpa->vectors) + - offset; - const u8 *p =3D buf; - int i; - - for (i =3D 0; i < len; i++) - iowrite8(*p++, ioaddr + i); -} - static void eni_vdpa_set_config_cb(struct vdpa_device *vdpa, struct vdpa_callback *cb) { @@ -429,7 +413,6 @@ static const struct vdpa_config_ops eni_vdpa_ops =3D { .get_vq_align =3D eni_vdpa_get_vq_align, .get_config_size =3D eni_vdpa_get_config_size, .get_config =3D eni_vdpa_get_config, - .set_config =3D eni_vdpa_set_config, .set_config_cb =3D eni_vdpa_set_config_cb, .get_vq_irq =3D eni_vdpa_get_vq_irq, }; diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_mai= n.c index e98fa8100f3c..7cbac787ad5f 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers/vdpa/ifcvf/ifcvf_main.c @@ -568,15 +568,6 @@ static void ifcvf_vdpa_get_config(struct vdpa_device *= vdpa_dev, ifcvf_read_dev_config(vf, offset, buf, len); } =20 -static void ifcvf_vdpa_set_config(struct vdpa_device *vdpa_dev, - unsigned int offset, const void *buf, - unsigned int len) -{ - struct ifcvf_hw *vf =3D vdpa_to_vf(vdpa_dev); - - ifcvf_write_dev_config(vf, offset, buf, len); -} - static void ifcvf_vdpa_set_config_cb(struct vdpa_device *vdpa_dev, struct vdpa_callback *cb) { @@ -640,7 +631,6 @@ static const struct vdpa_config_ops ifc_vdpa_ops =3D { .get_vq_group =3D ifcvf_vdpa_get_vq_group, .get_config_size =3D ifcvf_vdpa_get_config_size, .get_config =3D ifcvf_vdpa_get_config, - .set_config =3D ifcvf_vdpa_set_config, .set_config_cb =3D ifcvf_vdpa_set_config_cb, .get_vq_notification =3D ifcvf_get_vq_notification, }; diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5= _vnet.c index 5fce6d62af4f..fd0db86ba2cf 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2918,12 +2918,6 @@ static void mlx5_vdpa_get_config(struct vdpa_device = *vdev, unsigned int offset, memcpy(buf, (u8 *)&ndev->config + offset, len); } =20 -static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int of= fset, const void *buf, - unsigned int len) -{ - /* not supported */ -} - static u32 mlx5_vdpa_get_generation(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev =3D to_mvdev(vdev); @@ -3218,7 +3212,6 @@ static const struct vdpa_config_ops mlx5_vdpa_ops =3D= { .reset =3D mlx5_vdpa_reset, .get_config_size =3D mlx5_vdpa_get_config_size, .get_config =3D mlx5_vdpa_get_config, - .set_config =3D mlx5_vdpa_set_config, .get_generation =3D mlx5_vdpa_get_generation, .set_map =3D mlx5_vdpa_set_map, .set_group_asid =3D mlx5_set_group_asid, diff --git a/drivers/vdpa/pds/vdpa_dev.c b/drivers/vdpa/pds/vdpa_dev.c index 25c0fe5ec3d5..553dcd2aa065 100644 --- a/drivers/vdpa/pds/vdpa_dev.c +++ b/drivers/vdpa/pds/vdpa_dev.c @@ -553,21 +553,6 @@ static void pds_vdpa_get_config(struct vdpa_device *vd= pa_dev, memcpy_fromio(buf, device + offset, len); } =20 -static void pds_vdpa_set_config(struct vdpa_device *vdpa_dev, - unsigned int offset, const void *buf, - unsigned int len) -{ - struct pds_vdpa_device *pdsv =3D vdpa_to_pdsv(vdpa_dev); - void __iomem *device; - - if (offset + len > sizeof(struct virtio_net_config)) { - WARN(true, "%s: bad read, offset %d len %d\n", __func__, offset, len); - return; - } - - device =3D pdsv->vdpa_aux->vd_mdev.device; - memcpy_toio(device + offset, buf, len); -} =20 static const struct vdpa_config_ops pds_vdpa_ops =3D { .set_vq_address =3D pds_vdpa_set_vq_address, @@ -595,7 +580,6 @@ static const struct vdpa_config_ops pds_vdpa_ops =3D { .reset =3D pds_vdpa_reset, .get_config_size =3D pds_vdpa_get_config_size, .get_config =3D pds_vdpa_get_config, - .set_config =3D pds_vdpa_set_config, }; static struct virtio_device_id pds_vdpa_id_table[] =3D { {VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID}, diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet= _main.c index 99428a04068d..141740269b6c 100644 --- a/drivers/vdpa/solidrun/snet_main.c +++ b/drivers/vdpa/solidrun/snet_main.c @@ -478,23 +478,6 @@ static void snet_get_config(struct vdpa_device *vdev, = unsigned int offset, *buf_ptr++ =3D ioread8(cfg_ptr + i); } =20 -static void snet_set_config(struct vdpa_device *vdev, unsigned int offset, - const void *buf, unsigned int len) -{ - struct snet *snet =3D vdpa_to_snet(vdev); - void __iomem *cfg_ptr =3D snet->cfg->virtio_cfg + offset; - const u8 *buf_ptr =3D buf; - u32 i; - - /* check for offset error */ - if (offset + len > snet->cfg->cfg_size) - return; - - /* Write into PCI BAR */ - for (i =3D 0; i < len; i++) - iowrite8(*buf_ptr++, cfg_ptr + i); -} - static int snet_suspend(struct vdpa_device *vdev) { struct snet *snet =3D vdpa_to_snet(vdev); @@ -548,7 +531,6 @@ static const struct vdpa_config_ops snet_config_ops =3D= { .get_status =3D snet_get_status, .set_status =3D snet_set_status, .get_config =3D snet_get_config, - .set_config =3D snet_set_config, .suspend =3D snet_suspend, .resume =3D snet_resume, }; diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index a7612e0783b3..a9eac31f3757 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -401,22 +401,6 @@ void vdpa_get_config(struct vdpa_device *vdev, unsigne= d int offset, } EXPORT_SYMBOL_GPL(vdpa_get_config); =20 -/** - * vdpa_set_config - Set one or more device configuration fields. - * @vdev: vdpa device to operate on - * @offset: starting byte offset of the field - * @buf: buffer pointer to read from - * @length: length of the configuration fields in bytes - */ -void vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, - const void *buf, unsigned int length) -{ - down_write(&vdev->cf_lock); - vdev->config->set_config(vdev, offset, buf, length); - up_write(&vdev->cf_lock); -} -EXPORT_SYMBOL_GPL(vdpa_set_config); - static bool mgmtdev_handle_match(const struct vdpa_mgmt_dev *mdev, const char *busname, const char *devname) { diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_= sim.c index 421ab01ef06b..c2e14bcc01f6 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -546,20 +546,6 @@ static void vdpasim_get_config(struct vdpa_device *vdp= a, unsigned int offset, memcpy(buf, vdpasim->config + offset, len); } =20 -static void vdpasim_set_config(struct vdpa_device *vdpa, unsigned int offs= et, - const void *buf, unsigned int len) -{ - struct vdpasim *vdpasim =3D vdpa_to_sim(vdpa); - - if (offset + len > vdpasim->dev_attr.config_size) - return; - - memcpy(vdpasim->config + offset, buf, len); - - if (vdpasim->dev_attr.set_config) - vdpasim->dev_attr.set_config(vdpasim, vdpasim->config); -} - static u32 vdpasim_get_generation(struct vdpa_device *vdpa) { struct vdpasim *vdpasim =3D vdpa_to_sim(vdpa); @@ -754,7 +740,6 @@ static const struct vdpa_config_ops vdpasim_config_ops = =3D { .resume =3D vdpasim_resume, .get_config_size =3D vdpasim_get_config_size, .get_config =3D vdpasim_get_config, - .set_config =3D vdpasim_set_config, .get_generation =3D vdpasim_get_generation, .get_iova_range =3D vdpasim_get_iova_range, .set_group_asid =3D vdpasim_set_group_asid, @@ -792,7 +777,6 @@ static const struct vdpa_config_ops vdpasim_batch_confi= g_ops =3D { .resume =3D vdpasim_resume, .get_config_size =3D vdpasim_get_config_size, .get_config =3D vdpasim_get_config, - .set_config =3D vdpasim_set_config, .get_generation =3D vdpasim_get_generation, .get_iova_range =3D vdpasim_get_iova_range, .set_group_asid =3D vdpasim_set_group_asid, diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_= sim.h index bb137e479763..b48bf954a3bb 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.h +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h @@ -46,7 +46,6 @@ struct vdpasim_dev_attr { =20 void (*work_fn)(struct vdpasim *vdpasim); void (*get_config)(struct vdpasim *vdpasim, void *config); - void (*set_config)(struct vdpasim *vdpasim, const void *config); int (*get_stats)(struct vdpasim *vdpasim, u16 idx, struct sk_buff *msg, struct netlink_ext_ack *extack); diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vd= use_dev.c index df7869537ef1..4fe69cb5b156 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -698,12 +698,6 @@ static void vduse_vdpa_get_config(struct vdpa_device *= vdpa, unsigned int offset, memcpy(buf, dev->config + offset, len); } =20 -static void vduse_vdpa_set_config(struct vdpa_device *vdpa, unsigned int o= ffset, - const void *buf, unsigned int len) -{ - /* Now we only support read-only configuration space */ -} - static int vduse_vdpa_reset(struct vdpa_device *vdpa) { struct vduse_dev *dev =3D vdpa_to_vduse(vdpa); @@ -790,7 +784,6 @@ static const struct vdpa_config_ops vduse_vdpa_config_o= ps =3D { .set_status =3D vduse_vdpa_set_status, .get_config_size =3D vduse_vdpa_get_config_size, .get_config =3D vduse_vdpa_get_config, - .set_config =3D vduse_vdpa_set_config, .get_generation =3D vduse_vdpa_get_generation, .set_vq_affinity =3D vduse_vdpa_set_vq_affinity, .get_vq_affinity =3D vduse_vdpa_get_vq_affinity, diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp= _vdpa.c index 281287fae89f..5e8ff91475e3 100644 --- a/drivers/vdpa/virtio_pci/vp_vdpa.c +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c @@ -400,19 +400,6 @@ static void vp_vdpa_get_config(struct vdpa_device *vdp= a, } while (old !=3D new); } =20 -static void vp_vdpa_set_config(struct vdpa_device *vdpa, - unsigned int offset, const void *buf, - unsigned int len) -{ - struct vp_vdpa *vp_vdpa =3D vdpa_to_vp(vdpa); - struct virtio_pci_modern_device *mdev =3D vp_vdpa_to_mdev(vp_vdpa); - const u8 *p =3D buf; - int i; - - for (i =3D 0; i < len; i++) - vp_iowrite8(*p++, mdev->device + offset + i); -} - static void vp_vdpa_set_config_cb(struct vdpa_device *vdpa, struct vdpa_callback *cb) { @@ -457,7 +444,6 @@ static const struct vdpa_config_ops vp_vdpa_ops =3D { .get_vq_align =3D vp_vdpa_get_vq_align, .get_config_size =3D vp_vdpa_get_config_size, .get_config =3D vp_vdpa_get_config, - .set_config =3D vp_vdpa_set_config, .set_config_cb =3D vp_vdpa_set_config_cb, .get_vq_irq =3D vp_vdpa_get_vq_irq, }; diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index fb590e346e43..c6fcd54f59be 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -350,29 +350,6 @@ static long vhost_vdpa_get_config(struct vhost_vdpa *v, return 0; } =20 -static long vhost_vdpa_set_config(struct vhost_vdpa *v, - struct vhost_vdpa_config __user *c) -{ - struct vdpa_device *vdpa =3D v->vdpa; - struct vhost_vdpa_config config; - unsigned long size =3D offsetof(struct vhost_vdpa_config, buf); - u8 *buf; - - if (copy_from_user(&config, c, size)) - return -EFAULT; - if (vhost_vdpa_config_validate(v, &config)) - return -EINVAL; - - buf =3D vmemdup_user(c->buf, config.len); - if (IS_ERR(buf)) - return PTR_ERR(buf); - - vdpa_set_config(vdpa, config.off, buf, config.len); - - kvfree(buf); - return 0; -} - static bool vhost_vdpa_can_suspend(const struct vhost_vdpa *v) { struct vdpa_device *vdpa =3D v->vdpa; @@ -719,9 +696,6 @@ static long vhost_vdpa_unlocked_ioctl(struct file *file= p, case VHOST_VDPA_GET_CONFIG: r =3D vhost_vdpa_get_config(v, argp); break; - case VHOST_VDPA_SET_CONFIG: - r =3D vhost_vdpa_set_config(v, argp); - break; case VHOST_GET_FEATURES: r =3D vhost_vdpa_get_features(v, argp); break; diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index 06ce6d8c2e00..481ded50c916 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -62,14 +62,6 @@ static void virtio_vdpa_get(struct virtio_device *vdev, = unsigned int offset, vdpa_get_config(vdpa, offset, buf, len); } =20 -static void virtio_vdpa_set(struct virtio_device *vdev, unsigned int offse= t, - const void *buf, unsigned int len) -{ - struct vdpa_device *vdpa =3D vd_get_vdpa(vdev); - - vdpa_set_config(vdpa, offset, buf, len); -} - static u32 virtio_vdpa_generation(struct virtio_device *vdev) { struct vdpa_device *vdpa =3D vd_get_vdpa(vdev); @@ -462,7 +454,6 @@ virtio_vdpa_get_vq_affinity(struct virtio_device *vdev,= int index) =20 static const struct virtio_config_ops virtio_vdpa_config_ops =3D { .get =3D virtio_vdpa_get, - .set =3D virtio_vdpa_set, .generation =3D virtio_vdpa_generation, .get_status =3D virtio_vdpa_get_status, .set_status =3D virtio_vdpa_set_status, diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index 0e652026b776..13e7ce0cea80 100644 --- a/include/linux/vdpa.h +++ b/include/linux/vdpa.h @@ -259,13 +259,6 @@ struct vdpa_map_file { * @buf: buffer used to read to * @len: the length to read from * configuration space - * @set_config: Write to device specific configuration space - * @vdev: vdpa device - * @offset: offset from the beginning of - * configuration space - * @buf: buffer used to write from - * @len: the length to write to - * configuration space * @get_generation: Get device config generation (optional) * @vdev: vdpa device * Returns u32: device generation @@ -378,8 +371,6 @@ struct vdpa_config_ops { size_t (*get_config_size)(struct vdpa_device *vdev); void (*get_config)(struct vdpa_device *vdev, unsigned int offset, void *buf, unsigned int len); - void (*set_config)(struct vdpa_device *vdev, unsigned int offset, - const void *buf, unsigned int len); u32 (*get_generation)(struct vdpa_device *vdev); struct vdpa_iova_range (*get_iova_range)(struct vdpa_device *vdev); int (*set_vq_affinity)(struct vdpa_device *vdev, u16 idx, diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h index f5c48b61ab62..b7977f9ae596 100644 --- a/include/uapi/linux/vhost.h +++ b/include/uapi/linux/vhost.h @@ -157,13 +157,13 @@ */ #define VHOST_VDPA_GET_STATUS _IOR(VHOST_VIRTIO, 0x71, __u8) #define VHOST_VDPA_SET_STATUS _IOW(VHOST_VIRTIO, 0x72, __u8) -/* Get and set the device config. The device config follows the same - * definition of the device config defined in virtio-spec. +/* Get the device config. The device config follows the same + * definition of the device config defined in virtio-spec. According to + * virtio-spec v3.1, all device configuration fields are read-only for the + * driver, and thus we do not have VHOST_VDPA_SET_CONFIG. */ #define VHOST_VDPA_GET_CONFIG _IOR(VHOST_VIRTIO, 0x73, \ struct vhost_vdpa_config) -#define VHOST_VDPA_SET_CONFIG _IOW(VHOST_VIRTIO, 0x74, \ - struct vhost_vdpa_config) /* Enable/disable the ring. */ #define VHOST_VDPA_SET_VRING_ENABLE _IOW(VHOST_VIRTIO, 0x75, \ struct vhost_vring_state) --=20 2.34.1