Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1488134pxt; Sat, 7 Aug 2021 12:33:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycq1GUZPkab9715gARnHy6bvJLrsvp+c8fMk+PWGKReCXVI3fiqu5L1biJ0o2R+fGzRWIP X-Received: by 2002:a05:6602:26d2:: with SMTP id g18mr386501ioo.194.1628364826629; Sat, 07 Aug 2021 12:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628364826; cv=none; d=google.com; s=arc-20160816; b=SIn7j9zICnBojAJBTrz2OiC6i9bMypAHIHXn7GXYQtDiF5yxDJgaoZ5VZsKQQ25p2B rfKkaoYbHtkGZzqchFrSZcwDy8NNfvC9nqEYDCiH0z+dskDKRG/YmJHpqb3v6Ed8CNGG CdPRjX9vOshLzCTkH+bW+VzoCys8rGDbIGpFNUEyUAKzK2W2gE5WRcWLUoWiy0zJEKe1 /WehCAUbA1XYwc9dKwPDYB6HDL2f4+afs0HCjroV9lPYogBfGeH0CPP++D2/z3ZlCcWJ Lt2Xu5LAWixUtfFrPh8pdPSz4cdXOdppucw/dNPmITnPlcSJjx+SquyB1YtkXut0qiBm orOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=LYTKSwruQGUvYR+FXWqNhS06X7FlCeEuS2cDTi83h5s=; b=koEaFC6Lq1pYsQi54OIxRbtsDRov+P5B75M/RHv6ajQJ/At4dwu4iu1l0bwfV1hJzL /m/d1+JapwmB44osVO2aka6fxotcUCkiLLwWVeXFpq+N1cyliW9dL/0By5wmBIQGEvft yyJv7sV9tyD9vdYQaF/pbRCJ6/tzTengywwLebq5jXJbuOJa48hjORh9gGUWBTpc431l gEyaFG07AODuETnXCRfdjusBSzZFoFlZ3rV6JpH350qJn9fPBd3aXezfyjSrAhnEP9Dv EeaTxX62k9/wKCnQygq2+lSn9usCc8jfuDP8jgP5eQNFbzFGzqWtCM4NF8HyvmdGMhE6 XNDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si11813583iol.39.2021.08.07.12.33.27; Sat, 07 Aug 2021 12:33:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbhHGTbq (ORCPT + 99 others); Sat, 7 Aug 2021 15:31:46 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:59569 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbhHGTbq (ORCPT ); Sat, 7 Aug 2021 15:31:46 -0400 Received: (Authenticated sender: alex@ghiti.fr) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 2366C200002; Sat, 7 Aug 2021 19:31:24 +0000 (UTC) Subject: Re: [PATCH -fixes 3/3] riscv: Optimize kernel virtual address conversion macro To: Palmer Dabbelt Cc: Paul Walmsley , aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: From: Alex Ghiti Message-ID: <39a1fa85-1885-effe-1670-ec9cf34099f5@ghiti.fr> Date: Sat, 7 Aug 2021 21:31:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 7/08/2021 ? 18:36, Palmer Dabbelt a ?crit?: > On Wed, 21 Jul 2021 00:59:37 PDT (-0700), alex@ghiti.fr wrote: >> The current test in kernel_mapping_va_to_pa only applies when >> CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at >> compile-time in standard kernels that do not require this test. >> >> Signed-off-by: Alexandre Ghiti >> --- >> ?arch/riscv/include/asm/page.h | 2 +- >> ?1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/riscv/include/asm/page.h >> b/arch/riscv/include/asm/page.h >> index b0ca5058e7ae..10dc063868f6 100644 >> --- a/arch/riscv/include/asm/page.h >> +++ b/arch/riscv/include/asm/page.h >> @@ -123,7 +123,7 @@ extern phys_addr_t phys_ram_base; >> ?#define linear_mapping_va_to_pa(x)??? ((unsigned long)(x) - >> kernel_map.va_pa_offset) >> ?#define kernel_mapping_va_to_pa(y) ({??????????????????????? \ >> ???? unsigned long _y = y;??????????????????????????? \ >> -??? (_y < kernel_map.virt_addr + XIP_OFFSET) ???????????????????? \ >> +??? (IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + >> XIP_OFFSET) ???? \ >> ???????? ((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) >> :??????? \ >> ???????? ((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - >> XIP_OFFSET);??? \ >> ???? }) > > IIUC this isn't actually a fix?? The other two are, though, so they're > on fixes. Indeed this is not a fix, this is symmetrical to what I have done in patch 1 so that seemed natural to land in the same patchset. Let me know if you want me to resend it on its own. Thanks, Alex > > Thanks! > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv