From nobody Mon Dec 15 21:24:35 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE0F28464; Sat, 30 Mar 2024 08:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711788732; cv=none; b=M2+NWtn5DVoq8hkJhVJcjSJEYcdYX2bsqWK87dyFSh8LTEYLr8m42zpsN1jVXbslEOdpQJ/EJHP25JPPK7aF6uXhrYYcyKAAyWoIyal0lJRf3NFRKp3+wXSd4FR2G6gQmZHAaBNhMpyY+OiJfIcPFUohMslh83BTQ0thnapwQpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711788732; c=relaxed/simple; bh=vgiLOXN5x389jykiH7i0vlj8Z45dgOo5OQSMR/aLqB4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=sTm+/0iatqPY59r8oI3CDG2UQcNZ2GoF4/dB+5YfOAyvpIwHluw9s3BqmsVu61knAOcm7DYLEB/ID4cyoHd0YzicgoIQSPcSoJFyAbckwUhh3R8X/VBx5GrfC7FS/S9QRHgAeEPNYTyGpoKUqv+KbPpp9c6G/alfTXN/0EqDYuA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=PogBlzdg; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="PogBlzdg" Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 5A3CB20E703D; Sat, 30 Mar 2024 01:52:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5A3CB20E703D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711788728; bh=NAy5EC39+afjFHDkEQlx0+eqqPhVPwXu63T0KZBTnFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PogBlzdgaqxSCjHXwNe2Px9Q0+seW8N611HQw37cQEnt9lVKbEstwCQj8VuX+1tRl Kalwo18hNFEtUhFlVaMQfMTRaH/yXF4RXqIahMk/X/c//vmDIUATOBWShTnSo59YYZ eqLP/WhQ57eQ9rf+cVCS23jVLi47dSkkecHNAiuE= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Cc: longli@microsoft.com, ssengar@microsoft.com Subject: [PATCH v3 2/7] uio_hv_generic: Query the ringbuffer size for device Date: Sat, 30 Mar 2024 01:51:58 -0700 Message-Id: <1711788723-8593-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1711788723-8593-1-git-send-email-ssengar@linux.microsoft.com> References: <1711788723-8593-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Query the ring buffer size from pre defined table per device and use that value for allocating the ring buffer for that device. Keep the size as current default which is 2 MB if the device doesn't have any preferred ring size. Signed-off-by: Saurabh Sengar Reviewed-by: Long Li --- [V2] - Improve commit message. - Added Reviewed-by from Long Li. drivers/uio/uio_hv_generic.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index 20d9762331bd..4bda6b52e49e 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -238,6 +238,7 @@ hv_uio_probe(struct hv_device *dev, struct hv_uio_private_data *pdata; void *ring_buffer; int ret; + size_t ring_size =3D hv_dev_ring_size(channel); =20 /* Communicating with host has to be via shared memory not hypercall */ if (!channel->offermsg.monitor_allocated) { @@ -245,12 +246,14 @@ hv_uio_probe(struct hv_device *dev, return -ENOTSUPP; } =20 + if (!ring_size) + ring_size =3D HV_RING_SIZE * PAGE_SIZE; + pdata =3D devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM; =20 - ret =3D vmbus_alloc_ring(channel, HV_RING_SIZE * PAGE_SIZE, - HV_RING_SIZE * PAGE_SIZE); + ret =3D vmbus_alloc_ring(channel, ring_size, ring_size); if (ret) return ret; =20 --=20 2.34.1