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=-10.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 75DE9C07E95 for ; Tue, 13 Jul 2021 09:26:07 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DFD360FED for ; Tue, 13 Jul 2021 09:26:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DFD360FED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kontron.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 759B7831CA; Tue, 13 Jul 2021 11:26:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kontron.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=mysnt.onmicrosoft.com header.i=@mysnt.onmicrosoft.com header.b="Cld+WLF4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 226BB831CA; Tue, 13 Jul 2021 11:26:02 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on071f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::71f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 86FC783148 for ; Tue, 13 Jul 2021 11:25:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kontron.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=frieder.schrempf@kontron.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcY85lurGyLpYtwC7PBEZXevVCvX0r6SQ/iFtLdNWuA1PzVChFwXAsLqHcg1xuWwZEYWyiTo3wdt5FnVVFsc0488h25aGs6pLVluKrAPEHaZ1wK7t03g+zPWzVGmvrB0tcSVtn9kvk+WFeHtCFdC8udx72QHP1rV6VCbnzIMmHm8wWRxYyyo+WQv8bDoh7P9tnpBVosCuwksOyokDQE89rNa+i+noUXs+L2W0/zOoXT4RDrGs7opx4CvNvJnAFVmD6EknXllEf0icPETY1e9rPGtwS6Wn/CuovvuNctZLmupENn3AjpvdS8YaSGgQLTJ73kLUag5kGYaTJvQ4ekDAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MgJMeTWZ2X6tc4uHUNX3LJmPYw6d7ONqdpEXCpm3Yg=; b=kSu6vKMl/Cwz719iN/Rnd94rRf86rstE8yaM/Zt8U//HqKRyG9p99r2Ajj4HqNd8g/uAjlFYHBK4iGNccWOhi6vMCaR7ZFWK4BckGnZgC0zknqTTgo0JYKC2gWv0aXC0mEAia4Ssjt/que9kzck1C/MWqdd193bXRzE9Uil9fEeXBMLLz7FD9mhx+N5KPWonroX7XpKCr+/fSyTghU/SeYGRPFIMGV7cWCxDKQR7xQu6BMI8O+XVah2f30B3d+8GPitKq6/mzusTql/2F8i0dNW5qBqUU40ltHOkdS400BUxBV38f6iQqMw1kUAtU+zKiGXAq3JARbno8rgLzQrERA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kontron.de; dmarc=pass action=none header.from=kontron.de; dkim=pass header.d=kontron.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mysnt.onmicrosoft.com; s=selector2-mysnt-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MgJMeTWZ2X6tc4uHUNX3LJmPYw6d7ONqdpEXCpm3Yg=; b=Cld+WLF4BwQun4PQhx+KCk12bCY6fpGbIrFVbbDFEMxbUPD118uDqP18r0GoFZ6fJ1ZXupplKzBlo6z6ZbaDJVuaG7B0t+UIXmmdSM5nyWXin0JrbwyjbgJuddk9BwItqXrCgSHWHT6sNKERa+mV6/Nosq80B1c34rIgqV9b8b4= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=kontron.de; Received: from AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:157::14) by AM0PR10MB2818.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:124::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Tue, 13 Jul 2021 09:25:53 +0000 Received: from AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM ([fe80::1133:8761:6cc9:9703]) by AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM ([fe80::1133:8761:6cc9:9703%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 09:25:53 +0000 Subject: Re: [PATCH 4/6] imx8m: Restrict usable memory to space below 4G boundary To: Marek Vasut , "Peng Fan (OSS)" , Frieder Schrempf , Fabio Estevam , Peng Fan , Simon Glass , Ye Li , sbabic@denx.de Cc: "NXP i.MX U-Boot Team" , u-boot@lists.denx.de References: <20210607120534.183091-1-frieder@fris.de> <20210607120534.183091-5-frieder@fris.de> <624a336a-5daf-2623-27d2-2e15b3808ca1@denx.de> <80a57ee9-f932-70db-c37e-80c764f8a6ff@oss.nxp.com> <4e76a268-4345-02a9-e285-272476b91258@denx.de> From: Frieder Schrempf Message-ID: <08fe19f6-099d-1658-754d-0b306a7ebb33@kontron.de> Date: Tue, 13 Jul 2021 11:25:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <4e76a268-4345-02a9-e285-272476b91258@denx.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM0PR01CA0150.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::19) To AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:157::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.10.32] (89.244.190.198) by AM0PR01CA0150.eurprd01.prod.exchangelabs.com (2603:10a6:208:aa::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 13 Jul 2021 09:25:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 934caab6-5929-491e-dc91-08d945e035e1 X-MS-TrafficTypeDiagnostic: AM0PR10MB2818: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Y4muoLGng1CUnLGnL3Mo+DzOMoZgD9zOxB7xmGz+N+/XvNVgeF+Tc+Q7Q8uN0omGq9lZ/Wm+xNFqYvt4r24sop7Dnuey0w+xEIi5YnkXMBvmv2rt0X68vVVouyUXI59gSvGVCgojJdH7HsSuLAUJ9PeKa+ZTny2g1D/rW/4co326yKF6t/9fB1LTbRPFC5KpqRuM4Gjq9fhZt4gm6j7UO6H/9qtO5G7mt0WLOpqLjemCD0NGeoNrUd8JHIqDLSkQ1Pdl2UXAE1sA3bQCNUd3d4Ji3PQcOaH1XeEj03Rxaqx0JPUFSR8hv//0FseshOytU+GCku5lgWlePTL9lb2kdc4M5q3dHdLZRAfbBYMh1/L3pBzREFCOSpIHjC7pzyMWzVEF9wcCRJe33CgW+Ncr23sy8G55GHWZwqoGWAgFPSruowSNYRkC+DG8IVMZ7TJdXhzvklsPWtUDw8K/K4ENVhGnTai6zz0FtnJX7Pcp5ajWcDwF3jDn/INPtOf4xutrenRnNWuh7q8spcLpYdmRXh6gT/b2WyYNwYGh9+edCvH9lD8Ncad5/JJjhQuVXfaBqCWMJAueSgvT+A0mZdt212qcxQCOtg4ufM4JvavR/P6cA7lhL0GFjZ09xh33NN2vorl76uLZEN5kqA9/o8tKomqY4jePQ9PGc77fge7IwCvv7uJakc34y3SOmvgdnTHMcfmP2FUdcDwy+JE5itOLreL48XvFy7A+CVtdHpWDA4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(136003)(346002)(396003)(366004)(38100700002)(8936002)(31696002)(66556008)(83380400001)(186003)(2906002)(36756003)(956004)(2616005)(66476007)(53546011)(5660300002)(66946007)(4326008)(26005)(7416002)(44832011)(110136005)(478600001)(16576012)(86362001)(31686004)(8676002)(6486002)(316002)(32563001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?T2FsMHJ6QXJBdGV5OGxSalNDS0EyNmJ1OGlmT3JRaG5WZUJINWJaM08wVWhR?= =?ut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RIcVdmQzhFZnI5?= =?utf-8?B?b0hCMWsxaXVGRlZ6dDE3eVVaNWF3dGlqMXJPaEZLa3hmNUsrd3VtY2lqTUIv?= =?utf-8?B?UVBjN3c5ajhteHQ5L3NYSlVIblcvbXpIRlRXV2dHOG1XVG1SbFdEVWFhb2Fy?= =?utf-8?B?TkZyZVVvakswQytIZVBhbU1ZYXBpREdUMnpvdC9RM0NDdlZROG80cWkzbGxo?= =?utf-8?B?RUgyblBhL3A3WmthK1FyQVphMm1DTmFLaUhjTUpoeWFtVVdQeFlsbXpUTGxa?= =?utf-8?B?WG5jcEF3M1JMaXZJYXl4N1dNVSszSVNtcGN5LzNvdkpCa1FOVnJFSkZpemYv?= =?utf-8?B?T2QyanZpSjB0eXB1bWRpaWlNQ01peW9NZkRZQVMwZmY2UUZVZ1ZCK0YxR0Fk?= =?utf-8?B?UFU0cVhkSllRdGNFcWkyWjUzYisyVnMxQndNbzRjRENDaEdmckdScmNDQXk1?= =?utf-8?B?eVRkU3BVQjBxM0J1OS9OYno3eU5oaisvSHFEWTJrOWY5VlBCNi9GWllmY2hI?= =?utf-8?B?UWFYKyt2TWUxS1ZtazQzeEJhZElpL2c1WlhXQWZFRlZLRVpaMS9KWEVCdnJh?= =?utf-8?B?T1RmK3Z6NmlWYm5KRlljc3dlbEgwWUgvejBmekJDWEJwV1BpSEdQVEx0Y29l?= =?utf-8?B?c3FuR2xiV1hLMUJ2bithTGtpc04vazVLd0Q0ZFBKVStPYXJOOXZNSTdSMnN2?= =?utf-8?B?bm5YZ2s3djQ2VE5zdURDT2srZ2dCMkU3MUpEUU9peVg4eVhWYmNrb2dBMUNU?= =?utf-8?B?S3FUV01BOGY3TU9neXdXRkRVdVdxR2hBT2t5dHRONmNMMk1KYTZyVVhGMksy?= =?utf-8?Q?tVNejg27T9T6KhFIegz0Me7cWy0paMFfJyyGzxC?= X-OriginatorOrg: kontron.de X-MS-Exchange-CrossTenant-Network-Message-Id: 934caab6-5929-491e-dc91-08d945e035e1 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 09:25:53.0010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8c9d3c97-3fd9-41c8-a2b1-646f3942daf1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xkWTzNrCT5SA54V1nRJUis7KkudaVyQGj+wiU1rZpaCH5OX05LJy4gHoOSHGfBzihR1is6pRFneL4F9yuO7foY6gkCTP/Ow4+ra3Y+dRAOc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2818 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 15.06.21 02:41, Marek Vasut wrote: > On 6/15/21 2:28 AM, Peng Fan (OSS) wrote: >> >> >> On 2021/6/7 20:38, Marek Vasut wrote: >>> On 6/7/21 2:05 PM, Frieder Schrempf wrote: >>>> From: Frieder Schrempf >>>> >>>> Some IPs have their accessible address space restricted by the >>>> interconnect. Let's make sure U-Boot only ever uses the space below >>>> the 4G address boundary (which is 3GiB big), even when the effective >>>> available memory is bigger. >>>> >>>> We implement board_get_usable_ram_top() for all i.MX8M SoCs, as the >>>> whole family is affected by this. >>> >>> Shouldn't only those specific IP drivers handle buffers in the 64bit space somehow ? E.g. using a bounce buffer ? >> >> That could cause extra mem copy. > > If you want to avoid the extra memcopy, then make sure the buffers are not allocated above 4 GiB boundary. Then the bounce buffer does no copy. > > This board_get_usable_ram_top() is just a temporary workaround for platforms with broken drivers which are not fixed yet, so please fix the drivers instead. > >> Bounce buffer would be good for systems >> that take U-Boot as UEFI firmware, because U-Boot would be located at >> high end, but in the middle just top of 4GB. > > The bounce buffer is a necessity for IPs which cannot address more than the 4 GiB of memory. In fact, it would be even better to handle DT dma-ranges, but that is the next step. > >> I not object this patch, but it also be good if bounce buffer be added >> for improvement. >> >> Reviewed-by: Peng Fan > > I do object to this, since it increases the proliferation of this broken board_get_usable_ram_top() workaround instead of fixing the drivers properly. I generally agree with Marek's objections and if anyone comes up with a proper fix this will be highly appreciated. For now I just dropped this patch from my v2 patchset, but Stefano has already pulled it into u-boot-imx. I guess it's up to him to decide if this intermediate fix should be merged or not.