Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp330478rdb; Sat, 17 Feb 2024 10:05:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXA9IXB5Pokheg5P9RK1V97UZA9V5K0NKt/9IJNy3VwPWTicgFBA3EUqstjq2TSyqI0buhJiJmB58rN+bZ3Ev2Kh/NR5jY6o32w/GoydQ== X-Google-Smtp-Source: AGHT+IErJF1IJLVUYyT9GEAAvaaqprGLcsrowi/4GsNoKN0tMVTRoefkDK8LTBnbDzSkOkrmHcMD X-Received: by 2002:a17:903:98c:b0:1db:c1a1:9bc8 with SMTP id mb12-20020a170903098c00b001dbc1a19bc8mr3571711plb.64.1708193105853; Sat, 17 Feb 2024 10:05:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708193105; cv=pass; d=google.com; s=arc-20160816; b=uRnk+CSpVArnZ1aWANFA8mpu7kdBKPJt+Fh6jML1AIuaGz8eo9PqP1XAbD9Yh2IjjA z3UFTq8NTzLfw91Enh3m/qvBQnzojHAMFRNicvepKrNmKvvbyitr1qTuMPWptFVP6GEW vVa87OSs9+0r8IO7VQpDKwxodAFMVpkIktYGuGBnkrSEVPf2POWVp2pLXU9/uYfx8er9 SMpj5VGidY33BxtKbE4DwcqmzC3z4Ob5kuBIzAake2cd7u4F/kU0R94I5r7DARiTWBkf 8QtPBmo4/Zqub7pG/h6rLW+RlZzLrlrWsNT8kXmMayprTdOO34ecWPE2m981/0JhydVP 5Bqw== 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=f7wzYQnISkQFMWedckuhXxywKeM0U3MrfpoPt6WGRmk=; fh=/g2YaKiPj+3FPE7qve5VOLtb1iRxoth7NZi+8r+O0Q0=; b=SovZVdxv7ongVs3J4FLXoOoruKQWhsd4XYU3dG4BrfhxSsLVRufi1eJMq5DgqfnpEi Sio/ROXEpBTyUMvxCI9tyz7487vV8F/MWOgDGyj7ICSIHZjFX7uIiXn0vVy9WaD31QHM nAIpH33+BIZLCOL0ZD9QiHSIgpBJiXLfIvvOlLzCFQpsG/U1MH5NGWd2iRMrxV4JO1oe tIghoQXBYm8IxPkxOcCeT950TwQl2aE4pqzzCsC2Ksn/aWaiPxR2gNxPoiTtQ2pdrLat QVrwcUWJQzzViqikVK3dbUxxp3AsJ26ltNE6PDM+sXN0ryOazgxyBQOIXT32EGNYypPI v+AQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=EU2LoIpZ; 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-69992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69992-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 sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f15-20020a170902ce8f00b001dbcf6678b0si885293plg.258.2024.02.17.10.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 10:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=EU2LoIpZ; 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-69992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69992-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A3647B21875 for ; Sat, 17 Feb 2024 18:04:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAC387E112; Sat, 17 Feb 2024 18:04:35 +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="EU2LoIpZ" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAA2C7E0E7; Sat, 17 Feb 2024 18:04:33 +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=1708193075; cv=none; b=QX2X5ORDhx4tfZpPg18RIpTIo8sDt273sj85cG9PmFq7EVVSSA0/oK+f3uAWR6EH5GeXhZMbYUWANTV/HuHV4HwaG0mCxyR+MdYueidnddEipuqpLM2WICnfnJV6R1iU3MKfkVTn63B/RGEYxr25zPpsw09zbKHHm9svS3JTXVI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708193075; c=relaxed/simple; bh=z1X7X1YCv6aHaCd20LNe+sdLH/lgI1gAQ3Ruj1baOqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=nY6TN7hPU6DfSaLevCmDFGLhzTAT1wz9VCL+YOKHSyYC9FKR23d9qQyC4eKFD2cAfTbWOncmkG4W+nBIDew59JQS2H4d9zVQJTon2xayGU6WcQrHRa77zBVw822eaLf4qX/yKihE/CU3yNUwlInNs6iNWK54Aex8Oo+De6cO/Ik= 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=EU2LoIpZ; 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 8591E207FD2E; Sat, 17 Feb 2024 10:04:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8591E207FD2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1708193067; bh=f7wzYQnISkQFMWedckuhXxywKeM0U3MrfpoPt6WGRmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EU2LoIpZxgjvME+yjDjLlalSytwEGhoALQOKLplBtV8MaMA8cWR0212JqWr2Viy/H G+AwxfzKEorD1cA49iSP2G8JVJ0WH3Q5jXGl4ZwSbjXwcMaYTFXGExeii3PpVIsbyJ 6HIVe1o7EAJ5NCSVmIuIBX1GmcrmXQkCErrKx9DM= From: Saurabh Sengar To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, gregkh@linuxfoundation.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ssengar@microsoft.com Subject: [PATCH 2/6] uio_hv_generic: Query the ringbuffer size for device Date: Sat, 17 Feb 2024 10:03:36 -0800 Message-Id: <1708193020-14740-3-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708193020-14740-1-git-send-email-ssengar@linux.microsoft.com> References: <1708193020-14740-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. Keep the size as is if the device doesn't have any preferred ring size. Signed-off-by: Saurabh Sengar --- 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