Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp233840rwb; Wed, 7 Dec 2022 17:14:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Ns1aAkcgLQK/BjW33eGUcKkW9dHMdWrTStsb/RXgDnk5gyQ13TYYyCsKie/462Buq3SIP X-Received: by 2002:a17:90a:9908:b0:213:b6c7:53e1 with SMTP id b8-20020a17090a990800b00213b6c753e1mr109002991pjp.35.1670462061561; Wed, 07 Dec 2022 17:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670462061; cv=none; d=google.com; s=arc-20160816; b=ZS57rYr0mkZcY19aa2KkJrrGguLnqro1n0kufAxoOBFbQ3Vx95RrnRiMQQs0eK6/uX /RmsU/5nM2lugwdWl5uMI6lxF8x56dT65NGibYOyPhkj0/3aOn7OJ2QimLvqfTegawww 9npH1ZB27jVi3s/4pgRqa1hIQbJJI8z75pD5NikmSYKmDz1oYLbiWcBYOR6SzHHwy/uL OJMJ2O1w3SDl59xK/vg24mRNiW3vLMdfFhmPzDMX9O4zPaMv/MG+A0OAaQDBHRUeFF+n c1AKMWO8sKXtiho5YVqdLKdUJkK8vY+lKGs8sn1TXKLGxBPKOf+H6KLTPzJJ+vQEVXSH fXow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=R8bdcc50wn8UsmiJI5n21HPc9V1IZkZNXUkx+5w7LeM=; b=kBMwyomLT1nKyzr1CIqL0Rg+wzEdNtRGOyA/zGjzw5jZCuPn7bihnuAiq1WOYcwOV/ DSFs9+/zCEYqYmWZYGUb2IN90nE6PKS9iGPxcjBdJR/gtWszoQej3T6C5lylS1dHoP+r sXOUV9SGIIrAVmRJ0PvK5b1D5xikepenAInXQjrWXo0VUN+HC8HD78xUPjDZT495jULF RvTDTypYTIoKzijl/Re8ZnpFSHAqHQ3UbWnYEzlWaTM98uTRBV0S0c4bUEdXeUCkX8N7 vZNulk++JxQLIPmE5hQB25pk6yM/YBsy1S3Wmol0cLaPcg+0zRanOC1GugMVMs9Q3eWx ZqUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LtxGLfgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a056a00134e00b005730a1bbac0si22680264pfu.354.2022.12.07.17.14.12; Wed, 07 Dec 2022 17:14:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LtxGLfgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229662AbiLHA1M (ORCPT + 75 others); Wed, 7 Dec 2022 19:27:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiLHA1J (ORCPT ); Wed, 7 Dec 2022 19:27:09 -0500 Received: from out-58.mta0.migadu.com (out-58.mta0.migadu.com [IPv6:2001:41d0:1004:224b::3a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60C68C469 for ; Wed, 7 Dec 2022 16:27:08 -0800 (PST) Date: Thu, 8 Dec 2022 00:27:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1670459226; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R8bdcc50wn8UsmiJI5n21HPc9V1IZkZNXUkx+5w7LeM=; b=LtxGLfgdz34RIqWijaQ+k2KPddTbVRBOnyMr/S2dcqR+op21TvVEcK8B4TysysD2vTkcPF FT17LaFAkwidPdPfNVkviHSMB5dnJRhtZG7UYRSq7lRDazE4GcDoNK0q+TP+8msYlFAq2L TRWNQfMlVL23nt6S/7a2W5rSHEhTt9c= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sean Christopherson Cc: Marc Zyngier , James Morse , Alexandru Elisei , Paolo Bonzini , Shuah Khan , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, kvmarm@lists.linux.dev, Ricardo Koller , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] KVM: arm64: selftests: Align VA space allocator with TTBR0 Message-ID: References: <20221207214809.489070-1-oliver.upton@linux.dev> <20221207214809.489070-4-oliver.upton@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 08, 2022 at 12:18:07AM +0000, Sean Christopherson wrote: [...] > Together, what about? The #ifdef is a bit gross, especially around "hi_start", > but it's less duplicate code. And IMO, having things bundled in the same place > makes it a lot easier for newbies (to arm64 or kernel coding in general) to > understand what's going on and why arm64 is different. I'd rather we not go this route. We really shouldn't make any attempt to de-dupe something that is inherently architecture specific. For example: > + /* > + * All architectures supports splitting the virtual address space into > + * a high and a low half. Populate both halves, except for arm64 which > + * currently uses only TTBR0_EL1 (arbitrary selftests "logic"), i.e. > + * only has a valid low half. > + */ > + sparsebit_num_t nr_va_bits = (1ULL << (vm->va_bits - 1)) >> vm->page_shift; This is still wrong for arm64. When we say the VA space is 48 bits, we really do mean that TTBR0 is able to address a full 48 bits. So this truncates the MSB for the addressing mode. With the code living in the arm64 side of the shop, I can also tailor the comment to directly match the architecture to provide breadcrumbs tying it back to the Arm ARM. -- Thanks, Oliver