Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3630802imu; Tue, 18 Dec 2018 01:20:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/WTqzDzA5LCngmpsCvupMG3Coi5fSfgX40sgZ2axA74wQEn7d6J9N+nZ7YPwEkDnE5XXrcd X-Received: by 2002:a62:b24a:: with SMTP id x71mr16361424pfe.148.1545124848857; Tue, 18 Dec 2018 01:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545124848; cv=none; d=google.com; s=arc-20160816; b=yP8DCHwQJSY7UC566F1E9JahDzH1jW5J5TeGFEd541udAv/AmmKRtrC5WqWYEXDRLd q3i3bz4SnEj+EvLn3mQdKlPFSCGBYWToseDo0x8y+l2wT5Y2clMvdphiXtVBus/yVf1Y vglS8C6gJlUM1G0lyPhfN0zp7e3pPCsRpfOTzy7jvF6Xnpld1niFYXTXQJtFPVFBBS9z EMCCj90cArz003gt3+WUmsYZ7AVBIfYRdsBQb2fhe6GpFAxgvqQ8iOHWvu600Se5sN+D DA0yKmYC+T6t3ko54lctUfbuTIxd/WVt97oaER4w/AX+2H6nU3yBg/dKyHOdhbX5DMfO 4bgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=NKxRLLk6eH8ou+qV6xOo5PJxVKF8XHlmS9oAhb/W+vE=; b=Codi7p0DZsG8/8VL6kS+Pla7RCjdF7Pxrhcbv4VesZY2zUVgAQ/VF5Vq+JJsTllqZW mrDdDixG8nvHDUV82oPaqFIcOAFalewGWWyy1l+8SNIyNEDx7fMOHUph3X/F/lpz2Tij v6Z7c32H+4VzrTzP5gMRZnRu2IohTAgz3YaKRzDotvVBdrIDC7qABZPtNm5LYnRxB72N kIoVMWaGNfccFAnVbrV8wOqlZg7G97P/4AfXkmrvhvY4gJBhuQ9zv+ukzDaLzUEfolkU v+Vs9tOFwAXt75yxyty3HwaMrhRvXp/k/BVSmVt0X4W3BSu75deisH4AJBOlS3rG9I21 4PTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si13249673plb.234.2018.12.18.01.20.33; Tue, 18 Dec 2018 01:20:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbeLRJSu (ORCPT + 99 others); Tue, 18 Dec 2018 04:18:50 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:20540 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbeLRJSu (ORCPT ); Tue, 18 Dec 2018 04:18:50 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43Jss26Nmvz9v0SD; Tue, 18 Dec 2018 10:18:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id ALbEpgF_pcDi; Tue, 18 Dec 2018 10:18:46 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43Jss25nfLz9v0S9; Tue, 18 Dec 2018 10:18:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CCB0E8B830; Tue, 18 Dec 2018 10:18:47 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id JfPe3BidGXQ6; Tue, 18 Dec 2018 10:18:47 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 71A918B754; Tue, 18 Dec 2018 10:18:47 +0100 (CET) Subject: Re: [PATCH v1 03/13] powerpc/mm/32s: rework mmu_mapin_ram() To: =?UTF-8?Q?Jonathan_Neusch=c3=a4fer?= Cc: linuxppc-dev@lists.ozlabs.org, Paul Mackerras , linux-kernel@vger.kernel.org References: <8835330baa77d88e0267b0b1215b78c991e6d17a.1543517818.git.christophe.leroy@c-s.fr> <20181203215558.GK15324@latitude> <84624899-bbda-9f08-2527-151fddbd1b01@c-s.fr> <20181217012837.GT15324@latitude> <18ba3a7c-ebfa-66aa-e231-b56985d0e89a@c-s.fr> <20181218030538.GA24278@latitude> From: Christophe Leroy Message-ID: <9a39d910-2a05-3ce7-c949-296db2d458b9@c-s.fr> Date: Tue, 18 Dec 2018 09:18:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20181218030538.GA24278@latitude> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/18/2018 03:05 AM, Jonathan Neusch?fer wrote: > On Mon, Dec 17, 2018 at 10:29:18AM +0100, Christophe Leroy wrote: >>> With patches 1-3: >>> [ 0.000000] setbat(0, c0000000, 00000000, 01000000, 311) >>> [ 0.000000] setbat(2, c1000000, 01000000, 00800000, 311) >>> [ 0.000000] setbat(4, d0000000, 10000000, 02000000, 791) >> >> What we see is that BAT0 is not used in the origin. I have always wondered >> the reason, maybe there is something odd behind and BAT0 shall no ne used. >> >> Could you try and modify find_free_bat() so that it starts at b = 1 instead >> of b = 0 ? > > In this case, setbat is called with index 2, 3, and 4, but the Wii still > doesn't boot. > >>> According to arch/powerpc/include/asm/book3s/32/hash.h, >>> - 0x591 = _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | _PAGE_PRESENT >>> - 0x311 = _PAGE_EXEC | _PAGE_ACCESSED | _PAGE_COHERENT | _PAGE_PRESENT >>> - 0x791 = _PAGE_RW | _PAGE_EXEC | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | _PAGE_PRESENT >>> >> >> Yes, patch 1 added _PAGE_EXEC which explains this 0x200. >> Do you confirm it still works well with only patch 1 ? > > Patch 1 alone boots to userspace. > Ok, thanks for testing. The only difference I see then are the flags. Everything else is seems identical. I know you tried already, but would you mind trying once more with the following change ? diff --git b/arch/powerpc/mm/ppc_mmu_32.c a/arch/powerpc/mm/ppc_mmu_32.c index 61c10ee00ba2..628fba266663 100644 --- b/arch/powerpc/mm/ppc_mmu_32.c +++ a/arch/powerpc/mm/ppc_mmu_32.c @@ -119,7 +119,7 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top) if (size < 128 << 10) break; - setbat(idx, PAGE_OFFSET + base, base, size, PAGE_KERNEL_TEXT); + setbat(idx, PAGE_OFFSET + base, base, size, PAGE_KERNEL_X); base += size; } I think we may have some code trying to modify the kernel text without using code patching functions. Thanks, Christophe > > Jonathan >