Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1418189lqt; Wed, 20 Mar 2024 03:32:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2tgn9HNBj6HXOzuxth84nt6430goppfWROjxu1fUHozowgARKBnXLdUNdUZy1YiERqJ8+K6Ti+vpMygkPRnLJRQZatdWeYVspHMbXJw== X-Google-Smtp-Source: AGHT+IFMi/Gw9RLXcAsVbXsA+dtw5Ly87vfN626UsnFZvsMvLdSUjfJaDcR5U2kDx7ziWwKwn5yM X-Received: by 2002:ad4:430b:0:b0:691:4d1f:6a65 with SMTP id c11-20020ad4430b000000b006914d1f6a65mr3572881qvs.27.1710930732767; Wed, 20 Mar 2024 03:32:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710930732; cv=pass; d=google.com; s=arc-20160816; b=r3iHe2GOlg5/NDTuYWPGlinJE75Bz4ayRHvfJ+Z1bVOqO3Ob8jbUYTnGDcLFDVIrr/ RScM2CygiXnl/KhO9yXSXweih2Ur+6eyAK6mpcMDuxHZh3WY8SxEKsY2rjgZp6hsAgV/ aQLKnyerBlzdZTXuuegGtAcFsli7yLSJLHUWBFTBdNB+o5lIceWwTc0Mke5eJ7I5o0m5 1l+n1I8W0+vz8FOJobUeLHUnWsPvBUSqy8FBphHG3CeJCr55j1AfzTf36Af8gkLeuPgL mtTl9B9XHgo06A3cDrrqOE7nvdIbagVFNbQwxrVBhYI+rfAph5Hwtq1KWXa/2WB7ncfk ZFNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=NAy5EC39+afjFHDkEQlx0+eqqPhVPwXu63T0KZBTnFs=; fh=G7JxRLuAY0NBTYbETpCYR0Pmy65SV5uiYdZRLRjOZ3s=; b=zMbN6KYdxf9EjhpM/5qaFGAAuoDLOuAi1T9qAfLwz0XCQD/inc0WDsdp+d8rIY+qiO 620WT3xduBibOrKj41igvzk1TJIgLcAr3z5hMUUI1E/AwTg8qIx51jIhWmB5UkomPyCZ kyi4nerAZpJoU4DMgfGM6EEpTXsr6YKhfH2dFrldFFlueItcidvzkDr/2ZG00202tsoP 1ceewGAjlB5KxamjiUw0LjPx4oSlurkAhHshP0VEBf4bsLaDIK1cYg+Wool1KUpJ28k5 zHVutEQMIAgvFsJujq3wPIBajGXNxcwI+xZEy3j530x8URbXtlXk0YPPT82Z597kBeEx 66oQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=JrhzSYQG; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-108779-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108779-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id if6-20020a0562141c4600b0068f58ecb142si12906280qvb.583.2024.03.20.03.32.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 03:32:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108779-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=JrhzSYQG; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-108779-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108779-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D7CD1C22F8A for ; Wed, 20 Mar 2024 10:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D548A41E22; Wed, 20 Mar 2024 10:29:50 +0000 (UTC) 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 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 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-kernel@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