From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84C4C405C6; Wed, 20 Mar 2024 10:29:48 +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=1710930589; cv=none; b=JDUde/ebj0ioqpZx1ryCCkXQNqoKJoyhhBmBwi7sb9vFrNLslOs7KKjuTp/6SB+CxEy8dmCKIU134smMgI1dLkndyhqBPyMa87nGyBdiQW8WyMuw3f273M516Z5j9xKifUC2yaWGhkcf90KjMXSdHBe4S2c8rLOyf8F6Tf3/Ryg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710930589; c=relaxed/simple; bh=vgiLOXN5x389jykiH7i0vlj8Z45dgOo5OQSMR/aLqB4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=i4tBI6TUNtdYI0FmAwcEIrLkzVi2swYmPunV7DTKWPtIClvxh7yQ2f1MT8kLXz+UnpqD60ILyxnsLKWzkogw2q96NzICx9Ug9rgMH1aJ/k3+uaQ3Kc9rtbviMOtAmg6wb42gwh8QZE+DRGndPLRV8K3riCty5DBJnqUb+DpSJKk= 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=JrhzSYQG; 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="JrhzSYQG" Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 27C0B20B74C2; Wed, 20 Mar 2024 03:29:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 27C0B20B74C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710930588; bh=NAy5EC39+afjFHDkEQlx0+eqqPhVPwXu63T0KZBTnFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JrhzSYQGIvS4T2LVORcylH+vsXTSK08cm/5rIV9VPuisMiFak6MIluvKkZxX3CNnC CVlTlr8s43nBlR4qaKfHkjlhPTNvyN5Sn1olKCn4UCYr5zzBROiVTO7PlE3wcES4n8 t9hJKIjMsTKa/dq78ltG1r8zrJ8mzzzrqv8mPtmo= 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 v2 2/7] uio_hv_generic: Query the ringbuffer size for device Date: Wed, 20 Mar 2024 03:29:39 -0700 Message-Id: <1710930584-31180-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710930584-31180-1-git-send-email-ssengar@linux.microsoft.com> References: <1710930584-31180-1-git-send-email-ssengar@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 = hv_dev_ring_size(channel); /* 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; } + if (!ring_size) + ring_size = HV_RING_SIZE * PAGE_SIZE; + pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM; - ret = vmbus_alloc_ring(channel, HV_RING_SIZE * PAGE_SIZE, - HV_RING_SIZE * PAGE_SIZE); + ret = vmbus_alloc_ring(channel, ring_size, ring_size); if (ret) return ret; -- 2.34.1