Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5480957rwd; Mon, 5 Jun 2023 04:28:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dYo4VAUNKBnXNYcSILhJ0rMnLVkUNpXX6TSq8YJqb2tNQ6kVp/OGHvaT2XtLcU4/vL5iU X-Received: by 2002:a05:6a20:42a3:b0:114:6669:21f8 with SMTP id o35-20020a056a2042a300b00114666921f8mr2443386pzj.35.1685964511943; Mon, 05 Jun 2023 04:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685964511; cv=none; d=google.com; s=arc-20160816; b=opa1ihgvIq4aRkET46pi8fUiPeoTxz2ns/MLb7wK8iIAge2o6FioZDDdmNLom6/hU9 7FdWu3yb2Dv5VJ5KW5RH6H3zx8ixZCchBvrTerSZ7f2sUggta/vuApRLpJJtkgacD9Gd GXg4w6Un9UDmC4yL25/pkWz0g9g3sd8f+Vr1Dfjy4mm/DBFWQEc+uaqUkTqoa05j9Vz6 8Q+2GRUuUtOzCvfrWsWhxMf23U74ZI7c7DjWiN9pP2dt2Wct3HkNF2LsVv9BXtfNDIK7 9xFRjOzyTQ+khas/MsnpEjftJW2Kbg50BVyVo8K3pgYlYJQWrlkQdnqFzx6ZA0wscfcK H40g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kbCiwyqVxBGMkLGPRwYBBYz8NZcSuztWZwPhXZOo2A4=; b=yWv/Fgq/sqdFSe37w6BKCSnbfeqa7lEzxtRE9bgcyb5/4xQcdRgtnUqVZz5MC9A7yp j7EYfYCWzUgdVYbwYZxLdlfDUGoXWp+ZV5I37tBtbgYa3yA3hkBqNzyscgA4b2YqyzW0 ek4rTOGdUZYEu3K0JLv53rk6aN6+iDO50dyIQFP68gqpZjvZCRmRD0hIeyAkpeyy0SaJ QKTOUkIBMrEv+sZyex+2o6nPCemMoQtg7THkLDtojEgWq0eYa+lICEYu/C2mNVI5TauH eUdLQpxn6z6KmklTtEibJqCFemjSoqOGH1M7zyo7vEaRuK+78w1kUArCp+6ZeLrpqZfV phFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CapcsfTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a626d02000000b0064d3fa7ebfdsi5207337pfc.201.2023.06.05.04.28.18; Mon, 05 Jun 2023 04:28:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CapcsfTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230237AbjFELHf (ORCPT + 99 others); Mon, 5 Jun 2023 07:07:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbjFELHa (ORCPT ); Mon, 5 Jun 2023 07:07:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA28EC for ; Mon, 5 Jun 2023 04:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685963210; 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; bh=kbCiwyqVxBGMkLGPRwYBBYz8NZcSuztWZwPhXZOo2A4=; b=CapcsfTV1dRtKD+kXAeqZ4iqyP1hwUCKplvxldtUSz6nJS04kqWLSz2kfC44lbZLC/T7Z+ R9JGeJ1z6NHzmVcfExBjQhAXDu8NU/4nbe64tg9SOrokVITCsz5pTJ/qUdf15SLbTbSglg O1NAZnROlrBTgULLJ/2EbFLPC5+TdC4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-150-cRgvrWu7OeifbeU3BPNvIA-1; Mon, 05 Jun 2023 07:06:49 -0400 X-MC-Unique: cRgvrWu7OeifbeU3BPNvIA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3f739a73ba4so4665925e9.3 for ; Mon, 05 Jun 2023 04:06:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685963207; x=1688555207; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kbCiwyqVxBGMkLGPRwYBBYz8NZcSuztWZwPhXZOo2A4=; b=NI7cCr6mHSWJhJAqpOHcRbH+fqxDBTFgQCkv9MlaUkhanR7ot6ZaCtwUMb4JA9zmua dsyL08K5CxCsFNf3M3dUCvi5B3owUD8rZoPwP3/6Ft/nF5plNxT2BqW+H5F1CECWiwCJ 5yS2p8oK0p66Noze6omwFWwdo38c6F5MBwCe+JAddGaPntphk5KB1bqEe1hfAza4RDnj VKq2EqJtNH16qwr7w4NXb84itZaEuUrlHJStuKm+UAVyB+32XsG/ZSrXy89rsAKoDoZK UIy2MG+EuFlgB6WeEItPJ3GFjk/lFEnj6pmrSiSLNy4uEKuO4eFDoLdIDdX23i7bZtDu s5Uw== X-Gm-Message-State: AC+VfDxHPtTlEVT5gYHuN4hQ4F7M/xJuPhXab8DaxnxfP7rS+Mq7U/JS +4ramMmkWCSTESPchr6cH68xeQyuP3HjhBhYvh9ZzQ3yFqld22W0GyeeCUexR/SQt8mA5HZ8zN+ T+h7VRUzN55oQ2OUV8j3BCV6DMes8YeNT X-Received: by 2002:a05:600c:2318:b0:3f5:fb97:eafe with SMTP id 24-20020a05600c231800b003f5fb97eafemr6359802wmo.30.1685963207565; Mon, 05 Jun 2023 04:06:47 -0700 (PDT) X-Received: by 2002:a05:600c:2318:b0:3f5:fb97:eafe with SMTP id 24-20020a05600c231800b003f5fb97eafemr6359787wmo.30.1685963207240; Mon, 05 Jun 2023 04:06:47 -0700 (PDT) Received: from step1.redhat.com ([5.77.94.106]) by smtp.gmail.com with ESMTPSA id s5-20020a5d4245000000b0030903d44dbcsm9407323wrr.33.2023.06.05.04.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 04:06:46 -0700 (PDT) From: Stefano Garzarella To: virtualization@lists.linux-foundation.org Cc: netdev@vger.kernel.org, Jason Wang , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Tiwei Bie , kvm@vger.kernel.org, "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Subject: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature Date: Mon, 5 Jun 2023 13:06:44 +0200 Message-Id: <20230605110644.151211-1-sgarzare@redhat.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vhost-vdpa IOCTLs (eg. VHOST_GET_VRING_BASE, VHOST_SET_VRING_BASE) don't support packed virtqueue well yet, so let's filter the VIRTIO_F_RING_PACKED feature for now in vhost_vdpa_get_features(). This way, even if the device supports it, we don't risk it being negotiated, then the VMM is unable to set the vring state properly. Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") Cc: stable@vger.kernel.org Signed-off-by: Stefano Garzarella --- Notes: This patch should be applied before the "[PATCH v2 0/3] vhost_vdpa: better PACKED support" series [1] and backported in stable branches. We can revert it when we are sure that everything is working with packed virtqueues. Thanks, Stefano [1] https://lore.kernel.org/virtualization/20230424225031.18947-1-shannon.nelson@amd.com/ drivers/vhost/vdpa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 8c1aefc865f0..ac2152135b23 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -397,6 +397,12 @@ static long vhost_vdpa_get_features(struct vhost_vdpa *v, u64 __user *featurep) features = ops->get_device_features(vdpa); + /* + * IOCTLs (eg. VHOST_GET_VRING_BASE, VHOST_SET_VRING_BASE) don't support + * packed virtqueue well yet, so let's filter the feature for now. + */ + features &= ~BIT_ULL(VIRTIO_F_RING_PACKED); + if (copy_to_user(featurep, &features, sizeof(features))) return -EFAULT; base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7 -- 2.40.1