From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E769D2E542E; Tue, 8 Jul 2025 16:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751993870; cv=none; b=h38DJc6qNyFtm68pn5i2bER9FzaCxizBqMo0zihP8/IXgw5PhoaYfK1yus1kclv8/DSdzCn4zG9nuhuKfwCmRwcSLjqnH5zLETWtZ3nMYusHihciRsvfu3f960FR2sUTrHSQYRCOMon6njp8F0Nwbd/IMkNLkTmeo3e1rX6fwec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751993870; c=relaxed/simple; bh=+HZyJfTSJQ4TG4ezhWmY7HJIyaVSjGnNB4SJhqJYKtg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W2yUO73Ni6NQIYhmn5+lG3fbe5FRqAkApXMPwBE9BJPccDzSVSfOlA4Kd8yuGS4seQD5KLH9mFO7fZusDsSN4FN3nv6IHYPUkgjP32ctfz2uFEIHJnf7r/rE/Q425rBppmU42F6/HTJIEbO16ylSVYh5XBq9uPNmyaT0T1GGF9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bxicwzMu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="bxicwzMu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D5A9C4CEED; Tue, 8 Jul 2025 16:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751993869; bh=+HZyJfTSJQ4TG4ezhWmY7HJIyaVSjGnNB4SJhqJYKtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bxicwzMu8vm0RizooAGcpxdbkX9kuemKECTG9+Ki2MeCwgp2kENso39J52gJF676M ppoCJJHxnLCXpv4H1kcAbOJ19EZFRA8qvFLBrj/bpOcBoKPZK4btEN0Patf9lS4kJH D3ep9w8i9x5FrRrzTe50qVJwO8zgEx8WVE2a1kU4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Saurabh Sengar , Long Li , Sasha Levin Subject: [PATCH 5.15 047/160] uio_hv_generic: Query the ringbuffer size for device Date: Tue, 8 Jul 2025 18:21:24 +0200 Message-ID: <20250708162232.841070482@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250708162231.503362020@linuxfoundation.org> References: <20250708162231.503362020@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Saurabh Sengar [ Upstream commit e566ed5b64177a0c07b677568f623ed31d23406d ] 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 Link: https://lore.kernel.org/r/1711788723-8593-3-git-send-email-ssengar@linux.microsoft.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 0315fef2aff9 ("uio_hv_generic: Align ring size to system page") Signed-off-by: Sasha Levin --- 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 9daa1afbf9dbf..db8a450b5a19b 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -249,6 +249,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) { @@ -256,12 +257,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.39.5