From mboxrd@z Thu Jan 1 00:00:00 1970 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.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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=ham 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 7C02EC43461 for ; Thu, 10 Sep 2020 14:37:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30B4120720 for ; Thu, 10 Sep 2020 14:37:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Un/XalcX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PLMSr5mh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30B4120720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OJPVY52dUxvThrgFjLHBXFGFJIaSb895yEiGiUYI2Wo=; b=Un/XalcXYyac6JSqVfiA5wU5A VwBN9hrZUaO0RWPdUC1pLrEuFfMJQPNiuTNrfCgZ5q0NYbY1OU0+9Jf3iDkkBXo0NUnouEoNDFl/q 6xJhoKTqbuKpikgaH79s1Y4e2CAO1mgQNxzEQEN3sFnjqlzrppou+YTW3G4yTpZBpvreNVoZyIt5P Y5dt9/4iKco/0yNOJKM7ACiysxImNyckRabhT8YN9hEE0Im6GhYpGqsZb2GRjBUKOlgeq43A+JA8v vZ0sOEJdU5NhlbLDXIHd0HSUUOz/DP8brTyUT/Ynv3HUkr+KI/c49fLJHednsYCGoIGcbtt8y6NnM CDIDXdYMw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGNfq-0008Mi-AL; Thu, 10 Sep 2020 14:35:42 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGNfT-0008Fl-7G for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 14:35:20 +0000 Received: by mail-ej1-x641.google.com with SMTP id z22so9052162ejl.7 for ; Thu, 10 Sep 2020 07:35:19 -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=KCYaWwcvDjz/OmO+LXtbRJ6LszuyteB8m/JYCI1W1Mk=; b=PLMSr5mhrZi80kquG3UTKc10L5Ed+nu36WWw+z2lZB7jY2NtSZwMDvRpv3TuwllizR 7wpc1iofk2ZoyyDJwpWceFzTiHn90TWZgiZ045Rqz/ctDq5xo9epE09YznVy4EY1BmCs l2St/n4EQLGLl4Irlj/CjiNUTGWsQjI0pEg6F+baJPziJDFYBOwuCCOyMb+xCs9CEFvu 9KFGfkT69xlzT78AdIbRIVXoCrdn7bCNxNeWDPtg/woOLBOGoZLIKsWAlBjbsXvCsg9/ +ESlgsmFyeGx507Da/rJqBOVrFWssFaCbV59079oaLVMMMb6jhwsRiqhXjYp00Drq8eS JdWQ== 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=KCYaWwcvDjz/OmO+LXtbRJ6LszuyteB8m/JYCI1W1Mk=; b=ahqUr+4eR7+pdgj0aMhVSlk/JLl47QCSxJy2mhuPKNCoDDKC6bc+nxyBQeKnYtQR8F ugo8sBDBoPLv4RQWGpU3WBJx3riNOEytgzip8XFZL6lga83W+sb2aOg6R2gd27pLQIsM sYW/sTl5/1lm2aY2xJbE7moyKHZp0BZSs//Btz0JgKbc0ymF42BeDzscDzIM7K5MRflZ d8uz+NOm39gSGrhHCIcJEHScKzSf2tNbL0vlxx5JKLkmPmJWsvXl6o+R7/pWEZW/SPTy kRhS9EBhbtFGAyg6ndlcIXyaYZ+9EEq9UDQXzOuWL37P5i1S34t4szUtlgXRWlY9jGsK YeMQ== X-Gm-Message-State: AOAM532ViDeQQnr4d/6jVLYaxck4hf45W2QQamB2m43obdv3d32zUxcZ LWe4H4k9kF/8TXKPEzeWHIw= X-Google-Smtp-Source: ABdhPJzWHmRORR4s5GPtiMxYzRL7RIeJHACIEt31sw6plEpoQQDbSHFzrwWgxYbTiAiLDLiHODRGHA== X-Received: by 2002:a17:906:e4f:: with SMTP id q15mr9640896eji.155.1599748518392; Thu, 10 Sep 2020 07:35:18 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id ot19sm6825559ejb.121.2020.09.10.07.35.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2020 07:35:17 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id CE39C27C00A2; Thu, 10 Sep 2020 10:35:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 10 Sep 2020 10:35:13 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudehjedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhorhhtvggutfgvtghiphdvucdlgedtmdenucfjughrpefhvffufffkofgjfhgggfes tdekredtredttdenucfhrhhomhepuehoqhhunhcuhfgvnhhguceosghoqhhunhdrfhgvnh hgsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeehvdevteefgfeiudettdef vedvvdelkeejueffffelgeeuhffhjeetkeeiueeuleenucfkphephedvrdduheehrdduud durdejudenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhm pegsohhquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtd eigedqudejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehf ihigmhgvrdhnrghmvg X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 106293280059; Thu, 10 Sep 2020 10:35:13 -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 Subject: [PATCH v3 06/11] hv: hyperv.h: Introduce some hvpfn helper functions Date: Thu, 10 Sep 2020 22:34:50 +0800 Message-Id: <20200910143455.109293-7-boqun.feng@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910143455.109293-1-boqun.feng@gmail.com> References: <20200910143455.109293-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_103519_346979_1ED022BC X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, maz@kernel.org, Wei Liu , Dmitry Torokhov , Stephen Hemminger , arnd@arndb.de, "Martin K. Petersen" , ardb@kernel.org, will@kernel.org, Haiyang Zhang , Jiri Kosina , Boqun Feng , Michael Kelley , Benjamin Tissoires , catalin.marinas@arm.com, Jakub Kicinski , "K. Y. Srinivasan" , "James E.J. Bottomley" , "David S. Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When a guest communicate with the hypervisor, it must use HV_HYP_PAGE to calculate PFN, so introduce a few hvpfn helper functions as the counterpart of the page helper functions. This is the preparation for supporting guest whose PAGE_SIZE is not 4k. Signed-off-by: Boqun Feng --- include/linux/hyperv.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 6f4831212979..00c09d2ff9ad 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1687,4 +1687,9 @@ static inline unsigned long virt_to_hvpfn(void *addr) return paddr >> HV_HYP_PAGE_SHIFT; } +#define NR_HV_HYP_PAGES_IN_PAGE (PAGE_SIZE / HV_HYP_PAGE_SIZE) +#define offset_in_hvpage(ptr) ((unsigned long)(ptr) & ~HV_HYP_PAGE_MASK) +#define HVPFN_UP(x) (((x) + HV_HYP_PAGE_SIZE-1) >> HV_HYP_PAGE_SHIFT) +#define page_to_hvpfn(page) (page_to_pfn(page) * NR_HV_HYP_PAGES_IN_PAGE) + #endif /* _HYPERV_H */ -- 2.28.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel