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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 330E3C433FE for ; Wed, 16 Nov 2022 09:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233648AbiKPJsK (ORCPT ); Wed, 16 Nov 2022 04:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233072AbiKPJsI (ORCPT ); Wed, 16 Nov 2022 04:48:08 -0500 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A8A616E for ; Wed, 16 Nov 2022 01:48:01 -0800 (PST) Received: by mail-yb1-xb32.google.com with SMTP id 205so5823358ybe.7 for ; Wed, 16 Nov 2022 01:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=csie-ntu-edu-tw.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mTORVN+vb4ThEpVx7AxMit72NMXnsKSRAUOh1o/a8os=; b=iu183/XFyyYXhzOM/zCv5oVLc0dNPc63N8nAumxBq/E9DEFMaXcMVFjPQ8RwSk95QN qPwzLXSSx8g02xKSE2HH+0qsqSQCjwfSCzXWlPyjEt/GMuVRrUs4M66m6Cu0X5AQXy4f grx1TUGxOlGHdm36mCX0F436ljRJmlrugQFJE/7SgB9QyklFPlaZwbUq3IlCTAOCpwd/ F26ekdEMZKT7QmX+J3Gkt/LyfFZI6fOtWtkqbWHCQT2Kj2v9bB/AlCunfzrwmdXqAIg4 Mej0KEH0pinOfwJGOzYHS5tFfxdnFPQchC2uhzzBaANzkXA5ZF/2zY6zPgpj5XzyFdX0 cc7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mTORVN+vb4ThEpVx7AxMit72NMXnsKSRAUOh1o/a8os=; b=SJvyG0PV2hAuiHXay0cBbRQ0D5d0maErNGPvo3dlZMtg+VNTZumDk2+LMMmwTVBb25 eGj4mmPKTLhgZ0tOgpW/UMOZTQPIVoMC3Wt/9JLFBkiYsIof43sQlBl9nwMMfbX2xiEJ /G2z1jL8BGRDSHmbhot/Q61RHSB7e7QVc9d/UjqtDIgfURPLqf/4QzWEtCiQr8N7DLJQ UKzSRxxEzl8rMLXjndxNMo907FJTkxmjHqoGpkeOe+ydNayPZwLTN0jyZmyq63Uvkdc4 3RIiIpmrgH7P/PA702Buxtt4fNAUg1aygKjzONl/5WKqJi45gg/C0WyF7VXWxsWFs3xR Ru5w== X-Gm-Message-State: ANoB5pmaOI0Q7rPDRmiKpkW2llom9CaBbGUaDwJu+XS0ofZQYx2Jsrmf +XmVgfVuv1f0RWFWmX4kSBkNQcjQb/l+ThXzzfmQ08k+zzW5OKq8yk3P5hxynmnXtTjsjS4M0SD UQCPd9nsCEBjz8DOaBcNfTG0RjXq//WPccNxvxO4s3uKc4BBMlER0m9qzKGmTR3HDGmkiF/Ek+A XQhDPGBPyV2/JVhsfHOUY4DUcsYEb0TqOHogfZkITE25Q= X-Google-Smtp-Source: AA0mqf5LPJHOIlXR/n5HkFhpXmP9htXFS+/vEYllOxnCYgoAQzNsF/+mL8haFdY/qJv+WVKacahqx8L+Nyvl6l+bD2g= X-Received: by 2002:a25:7757:0:b0:6dd:ff71:f26c with SMTP id s84-20020a257757000000b006ddff71f26cmr20724110ybc.120.1668592081122; Wed, 16 Nov 2022 01:48:01 -0800 (PST) MIME-Version: 1.0 References: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> <86fseppiqt.wl-maz@kernel.org> In-Reply-To: <86fseppiqt.wl-maz@kernel.org> From: =?UTF-8?B?56ug55GL6bqf?= Date: Wed, 16 Nov 2022 17:48:00 +0800 Message-ID: Subject: Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings To: Marc Zyngier Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Gm-Spam: 0 X-Gm-Phishy: 0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 12, 2022 at 12:18 AM Marc Zyngier wrote: > My problem with this comment is that neither va_mask, tag_val, nor > tag_lsb mean anything in this context. All this is purely internal to > kvm_compute_layout(), and is unnecessary here. > > I'd rather you have something along the lines of: > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 60ee3d9f01f8..6d04818a1a5b 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -460,7 +460,7 @@ void kvm_unshare_hyp(void *from, void *to) > * @prot: The protection to be applied to this range > * > * The same virtual address as the kernel virtual address is also used > - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying > + * in Hyp-mode mapping (modulo a random offset) to the same underlying > * physical pages. > */ > int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) > > Whoever is interested in understanding the generation of the offset > can follow kern_hyp_va(). Yes I agree, thanks for the advice. I'll update the patch. Wei-Lin Chang 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 630F4C433FE for ; Wed, 16 Nov 2022 09:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+i6eQpTcDIFbWXfDopK/52OxC70j4aj9tUW3c671f8o=; b=3hO/VuAuqTcv0e UMedNYNBs5MXAssSPfPW+YC7eJr+MyhnhQOBVieDMKWef2aXvD+cWwSLWZf0dp4QyuLj0C5MhSuzg Zc+eGc7GJ7wullKQcDAtYtoUlr7MD0v64G3SeD/kjWA8bM3PTQSUouyAhpO/xsEWSgPYclth6F0px erkjhFf1NBowmvwqxVTAchWJx4zRmfbmnu2BBiHfddIhoKpUs6XdeE5A9LQcpg37Dr6Sa0HDY8k8V VIEoaeAWJ312gqJDXoB3OzsST5lwucxO2mre6f/TqtVXxBWgz5qp5pjtazrFq1zUxnpxxZTghl5HZ BvljIbsSizQ/2aiHrI3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovF1k-001v2b-4C; Wed, 16 Nov 2022 09:48:16 +0000 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovF1f-001uwp-5u for linux-arm-kernel@lists.infradead.org; Wed, 16 Nov 2022 09:48:13 +0000 Received: by mail-yb1-xb2d.google.com with SMTP id z192so20378978yba.0 for ; Wed, 16 Nov 2022 01:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=csie-ntu-edu-tw.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mTORVN+vb4ThEpVx7AxMit72NMXnsKSRAUOh1o/a8os=; b=iu183/XFyyYXhzOM/zCv5oVLc0dNPc63N8nAumxBq/E9DEFMaXcMVFjPQ8RwSk95QN qPwzLXSSx8g02xKSE2HH+0qsqSQCjwfSCzXWlPyjEt/GMuVRrUs4M66m6Cu0X5AQXy4f grx1TUGxOlGHdm36mCX0F436ljRJmlrugQFJE/7SgB9QyklFPlaZwbUq3IlCTAOCpwd/ F26ekdEMZKT7QmX+J3Gkt/LyfFZI6fOtWtkqbWHCQT2Kj2v9bB/AlCunfzrwmdXqAIg4 Mej0KEH0pinOfwJGOzYHS5tFfxdnFPQchC2uhzzBaANzkXA5ZF/2zY6zPgpj5XzyFdX0 cc7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mTORVN+vb4ThEpVx7AxMit72NMXnsKSRAUOh1o/a8os=; b=422XN8hJpc7grzfHviXTQgtyLE36O3nmGzVmDgUE2I+I+8tqTYCH1AnmDl5qygFnCK g5OJcAzJ16H/pOCTVVIV7F6Vqv4J8N+ukX6YMcYMqRorbjEM4F5eVu0t++pVa7Kmmkt7 7goJ5R7nRqUi4pVZPxSrTluFr6ybcobFSO5YUMCwNoFKLbphYWu9a2YM15RiNOF5rXSk 5NBncJpKykUflvU0kKGllpnX3QxI1V6tQrIZ//bfGvjKi5n2tzDWDUWARlHtqHEW2y5a 4OxUCM8cm1hfjbMifhPrQGTZZtFb/f4ZaSrtuqttZx9CM5yx9SrkENnb9Enn4/2GziUP fX5Q== X-Gm-Message-State: ANoB5pnUWthTBHw/hgy8q9WqKppo63d1wHkO2q6b8HlmRkuFi/q7GaZW zS5Ap4CNCesuuKO5dN9O60zRlEN5xUqLSV9CfossULhmbZxJcXHkNhZUooFPIxVl9FvE196UJ1w 86JpVwsD5Pb6C4zpB/9j0cV5jn96xUxpPhyrFZcUuyPtFt1HerXGOEdaAlFAGLZHUuntqJWnG0O 3Dio8ysRkYblNA3ODNg8Cxn/5DVVORHAppkbNCUPK+DAUrO3o3J64OfQ== X-Google-Smtp-Source: AA0mqf5LPJHOIlXR/n5HkFhpXmP9htXFS+/vEYllOxnCYgoAQzNsF/+mL8haFdY/qJv+WVKacahqx8L+Nyvl6l+bD2g= X-Received: by 2002:a25:7757:0:b0:6dd:ff71:f26c with SMTP id s84-20020a257757000000b006ddff71f26cmr20724110ybc.120.1668592081122; Wed, 16 Nov 2022 01:48:01 -0800 (PST) MIME-Version: 1.0 References: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> <86fseppiqt.wl-maz@kernel.org> In-Reply-To: <86fseppiqt.wl-maz@kernel.org> From: =?UTF-8?B?56ug55GL6bqf?= Date: Wed, 16 Nov 2022 17:48:00 +0800 Message-ID: Subject: Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings To: Marc Zyngier Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-Gm-Spam: 0 X-Gm-Phishy: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221116_014811_454713_70B6F194 X-CRM114-Status: GOOD ( 15.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Sat, Nov 12, 2022 at 12:18 AM Marc Zyngier wrote: > My problem with this comment is that neither va_mask, tag_val, nor > tag_lsb mean anything in this context. All this is purely internal to > kvm_compute_layout(), and is unnecessary here. > > I'd rather you have something along the lines of: > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 60ee3d9f01f8..6d04818a1a5b 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -460,7 +460,7 @@ void kvm_unshare_hyp(void *from, void *to) > * @prot: The protection to be applied to this range > * > * The same virtual address as the kernel virtual address is also used > - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying > + * in Hyp-mode mapping (modulo a random offset) to the same underlying > * physical pages. > */ > int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) > > Whoever is interested in understanding the generation of the offset > can follow kern_hyp_va(). Yes I agree, thanks for the advice. I'll update the patch. Wei-Lin Chang _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel