From patchwork Wed Sep 16 03:48:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 296735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88F87C2D0A7 for ; Wed, 16 Sep 2020 03:50:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 400B8221EF for ; Wed, 16 Sep 2020 03:50:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZYg6DHCJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726128AbgIPDuK (ORCPT ); Tue, 15 Sep 2020 23:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbgIPDsm (ORCPT ); Tue, 15 Sep 2020 23:48:42 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13BA9C06174A; Tue, 15 Sep 2020 20:48:42 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id k25so5135586qtu.4; Tue, 15 Sep 2020 20:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qIFc7LuWq6/SDZOUTHn9GVK3D00/m3BkPHzN5DCgsD4=; b=ZYg6DHCJgiXOqLkRAE0G4EuSglr3059AHlu3tNYRSz5hfrmExqoC+YkbGRNsxSB5TN TOGawGXiVOFeG4uIqoceMSKyB7l9Q/mm0x8odMexr7Cyqu6iHFpdj90PkjxGCMMwmCpm UqhmVs/9a8QrqRXNMXE3On+WdqE1GQahBSqRIvA+OvLSE2C5sQz81NwYcBNoXuSY6QAM qcfopsb6b63hKw2X1BMnF605hRr+nB7TIbeJQUWkqRD24R+zkqAHU9545oCiTkWNhS7j GDnzbRKFkA9VdwKd/ZUNpgRNoyk+0x6xxcKQVey4n7/VbAQAArOju1TWMkx2+b+al829 LdLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qIFc7LuWq6/SDZOUTHn9GVK3D00/m3BkPHzN5DCgsD4=; b=VFeqL0idTWwOkAl4VMV3jqyuNYUEJw5EYZ2OCKbEtaE/Taa8KJYaxHA575qpapSrHj IARoI1gkfqwCdc7A6tb7DjkmH//LLjPVh7UjEIeqvHHNpXI6EzxB/bnXihZUZfVuE0ph 2XQ5/U4tJTDPyKgX0V1VtnSYiJ7YnRueg3C+gJ/XBn4ppvGl3glYxQofJvhGxXCrn1RR kSy9Ek2F2b7UCtvpILqjHTmz2wCQa1Xb8WnSngsFvhjcEF/l9/u4b413ZbDZpT0Qdy+F wYWAxVf67+ZuyonS38VwOwBLkr/A40+j5qQwLTb812E2k/gimHxDitDqdJxyqsvaRCII m85g== X-Gm-Message-State: AOAM530WdXv6U0ZKi6XHtNuwDb+iLzS8aqx1vNO6q4qu24JWi2S58g4H biAbmXRP+/cyLV5Xbzqvm2w= X-Google-Smtp-Source: ABdhPJxAEKBLSYWAASkG0EfOqz16F5fTimww8YjtayjnuN9Q6t9VQbZyyEDYo5e6sr5mn+1hCGte6g== X-Received: by 2002:ac8:44da:: with SMTP id b26mr8615198qto.147.1600228121341; Tue, 15 Sep 2020 20:48:41 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id j1sm18472218qtk.91.2020.09.15.20.48.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2020 20:48:40 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 0F0CD27C0054; Tue, 15 Sep 2020 23:48:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 15 Sep 2020 23:48:40 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrtddugdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvufffkffojghfggfgsedt keertdertddtnecuhfhrohhmpeeuohhquhhnucfhvghnghcuoegsohhquhhnrdhfvghngh esghhmrghilhdrtghomheqnecuggftrfgrthhtvghrnhepkeejkeekudekieevuedufefh udeiheevvddvtddtveffteegvdehueeltdduhfeunecuffhomhgrihhnpehkvghrnhgvlh drohhrghenucfkphephedvrdduheehrdduuddurdejudenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhhthh hpvghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheehhedvqdgsohhquhhn rdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 148333280059; Tue, 15 Sep 2020 23:48:39 -0400 (EDT) From: Boqun Feng To: linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , "David S. Miller" , Jakub Kicinski , "James E.J. Bottomley" , "Martin K. Petersen" , Michael Kelley , will@kernel.org, ardb@kernel.org, arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, Boqun Feng , Jiri Kosina Subject: [PATCH v4 09/11] HID: hyperv: Use VMBUS_RING_SIZE() for ringbuffer sizes Date: Wed, 16 Sep 2020 11:48:15 +0800 Message-Id: <20200916034817.30282-10-boqun.feng@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916034817.30282-1-boqun.feng@gmail.com> References: <20200916034817.30282-1-boqun.feng@gmail.com> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For a Hyper-V vmbus, the size of the ringbuffer has two requirements: 1) it has to take one PAGE_SIZE for the header 2) it has to be PAGE_SIZE aligned so that double-mapping can work VMBUS_RING_SIZE() could calculate a correct ringbuffer size which fulfills both requirements, therefore use it to make sure vmbus work when PAGE_SIZE != HV_HYP_PAGE_SIZE (4K). Note that since the argument for VMBUS_RING_SIZE() is the size of payload (data part), so it will be minus 4k (the size of header when PAGE_SIZE = 4k) than the original value to keep the ringbuffer total size unchanged when PAGE_SIZE = 4k. Signed-off-by: Boqun Feng Cc: Jiri Kosina Cc: Michael Kelley --- Michael and Jiri, I change the code because of a problem I found: https://lore.kernel.org/lkml/20200914084600.GA45838@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net/ , so I drop your Reviewed-by or Acked-by tag. If the update version looks good to you, may I add your tag again? Thanks in advance, and apologies for the inconvenience. Regards, Boqun drivers/hid/hid-hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index 0b6ee1dee625..978ee2aab2d4 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -104,8 +104,8 @@ struct synthhid_input_report { #pragma pack(pop) -#define INPUTVSC_SEND_RING_BUFFER_SIZE (40 * 1024) -#define INPUTVSC_RECV_RING_BUFFER_SIZE (40 * 1024) +#define INPUTVSC_SEND_RING_BUFFER_SIZE VMBUS_RING_SIZE(36 * 1024) +#define INPUTVSC_RECV_RING_BUFFER_SIZE VMBUS_RING_SIZE(36 * 1024) enum pipe_prot_msg_type {