From patchwork Thu Apr 11 02:51:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xuan Zhuo X-Patchwork-Id: 13625346 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (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 30C4E13B2AC for ; Thu, 11 Apr 2024 02:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712803895; cv=none; b=OmPA90Niv7ZLVV7/FHILmtoGtZG08HPCoAEQuwjpRefyoXgx8MBeDB2pXZ4/w36LwNpU6p+j7sJ68Qe+/a4ZCjh6o9K6naduG4/odCV9v4qa0dpf/Da8uuVZan3ZGIGTuMEXiO058K50814w/5vG3qvgvZFf8u2NeKcotsn3G0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712803895; c=relaxed/simple; bh=X2ww7mo1EYAKEUJYJPCsYfRdkjPJyGq5e6PMda/4UgE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ImsAUI2O6cd8CZmTutRHPblVjCNDkLYFHk+rluOAKveTg1KehTEut8/TqE+HSy8fl7Yt0rTdp6DVOBAiCuNa6ke0/1+Hh0kcLi1T7YBMfqoL9ixB65YBNIPBiIQOgVr2Ub353tOKxHwmbS4VzTaL2OW5VWlATGggnCjlpooPQ1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=UEikXO6N; arc=none smtp.client-ip=115.124.30.110 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="UEikXO6N" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712803890; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=TVKXEqi6RpM2JHJlXMJGr9y1zwACVOZXZquRsz2lu3M=; b=UEikXO6N9L4zkvpWWEUcGW+3YnRnUOtRRU+1M+gPs0xl+aDhcMGxuZ8LRqGUBeHcHqdIA/4Nv4cWORndflyshLQ1W01Rrdaj212dgIeAnhC7H8QN/Himqk9d13zqBmin98gjPlahh/8NgzAyuIke4OadwVHg8AbJlu19jVj/UQU= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0W4JWvKl_1712803889; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0W4JWvKl_1712803889) by smtp.aliyun-inc.com; Thu, 11 Apr 2024 10:51:29 +0800 From: Xuan Zhuo To: virtualization@lists.linux.dev Cc: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH vhost 2/6] virtio_ring: enable premapped mode whatever use_dma_api Date: Thu, 11 Apr 2024 10:51:23 +0800 Message-Id: <20240411025127.51945-3-xuanzhuo@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20240411025127.51945-1-xuanzhuo@linux.alibaba.com> References: <20240411025127.51945-1-xuanzhuo@linux.alibaba.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Git-Hash: aa9dfb80fb4a Now, we have virtio DMA APIs, the driver can be the premapped mode whatever the virtio core uses dma api or not. So remove the limit of checking use_dma_api from virtqueue_set_dma_premapped(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1b9fb680cff3..72c438c5f7d7 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -2730,7 +2730,7 @@ EXPORT_SYMBOL_GPL(virtqueue_resize); * * Returns zero or a negative error. * 0: success. - * -EINVAL: vring does not use the dma api, so we can not enable premapped mode. + * -EINVAL: NOT called immediately. */ int virtqueue_set_dma_premapped(struct virtqueue *_vq) { @@ -2746,11 +2746,6 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq) return -EINVAL; } - if (!vq->use_dma_api) { - END_USE(vq); - return -EINVAL; - } - vq->premapped = true; vq->do_unmap = false;