From nobody Mon Sep 15 19:51:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 812C4C63797 for ; Wed, 11 Jan 2023 06:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235992AbjAKG3s (ORCPT ); Wed, 11 Jan 2023 01:29:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235634AbjAKG3W (ORCPT ); Wed, 11 Jan 2023 01:29:22 -0500 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 B0B53631E for ; Tue, 10 Jan 2023 22:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673418514; 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: in-reply-to:in-reply-to:references:references; bh=5+4wcK32yTG8RIPffsWit0AM8U7mssDeI6INzJz2GeQ=; b=JnM9I9pgJVzW+jG3yMgt8Gi21WUsINU0uZb9nhc3o8sS78kxwP/OcyZ65q16XtITK994fa S+QmvdzO4I4j+B4uAmQIW7WawyvmYgxJbc7BVs6fsAmT2ByKdqamnztpuj9cxKPUaF6bSn DMVSZuzGY83HhUtYzFBqhDaKgpa3DP8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-_n38zNkSN4y1z_p4rB0FMQ-1; Wed, 11 Jan 2023 01:28:31 -0500 X-MC-Unique: _n38zNkSN4y1z_p4rB0FMQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B89D2A59557; Wed, 11 Jan 2023 06:28:31 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-175.pek2.redhat.com [10.72.13.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E61B4078903; Wed, 11 Jan 2023 06:28:27 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: elic@nvidia.com, gdawar@amd.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, tanuj.kamde@amd.com Subject: [PATCH 4/5] vdpa: set dma mask for vDPA device Date: Wed, 11 Jan 2023 14:28:08 +0800 Message-Id: <20230111062809.25020-5-jasowang@redhat.com> In-Reply-To: <20230111062809.25020-1-jasowang@redhat.com> References: <20230111062809.25020-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Setting DMA mask for vDPA device in case that there are virtqueue that is not backed by DMA so the vDPA device could be advertised as the DMA device that is used by DMA API for software emulated virtqueues. Signed-off-by: Jason Wang Reviewed-by: Eli Cohen Tested-by: --- drivers/vdpa/vdpa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c index 8ef7aa1365cc..6821b2850bbb 100644 --- a/drivers/vdpa/vdpa.c +++ b/drivers/vdpa/vdpa.c @@ -39,6 +39,11 @@ static int vdpa_dev_probe(struct device *d) u32 max_num, min_num =3D 1; int ret =3D 0; =20 + d->dma_mask =3D &d->coherent_dma_mask; + ret =3D dma_set_mask_and_coherent(d, DMA_BIT_MASK(64)); + if (ret) + return ret; + max_num =3D ops->get_vq_num_max(vdev); if (ops->get_vq_num_min) min_num =3D ops->get_vq_num_min(vdev); --=20 2.25.1