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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 4DC35C00140 for ; Mon, 8 Aug 2022 14:10:34 +0000 (UTC) Received: from localhost ([::1]:50068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oL3Sj-0006Bc-Ac for qemu-devel@archiver.kernel.org; Mon, 08 Aug 2022 10:10:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL3QR-00045I-SN; Mon, 08 Aug 2022 10:08:11 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:46790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL3QP-0005qk-GI; Mon, 08 Aug 2022 10:08:11 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 3B795747644; Mon, 8 Aug 2022 16:08:06 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 000B1746FDE; Mon, 8 Aug 2022 16:08:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id F2B22746E07; Mon, 8 Aug 2022 16:08:05 +0200 (CEST) Date: Mon, 8 Aug 2022 16:08:05 +0200 (CEST) From: BALATON Zoltan To: =?ISO-8859-15?Q?C=E9dric_Le_Goater?= cc: qemu-ppc@nongnu.org, Daniel Henrique Barboza , qemu-devel@nongnu.org, Peter Maydell Subject: Re: [PATCH v3 00/22] ppc: QOM'ify 405 board In-Reply-To: Message-ID: <95f06a5-b7b8-d79-7564-20652ac89e7@eik.bme.hu> References: <20220808102734.133084-1-clg@kaod.org> <65dff991-cf15-75e9-8cb-d55e72ae5560@eik.bme.hu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3866299591-907815730-1659967685=:47322" Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3866299591-907815730-1659967685=:47322 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Mon, 8 Aug 2022, Cédric Le Goater wrote: > On 8/8/22 14:16, BALATON Zoltan wrote: >> On Mon, 8 Aug 2022, Cédric Le Goater wrote: >>> Hello, >>> >>> Here is large series QOM'ifying the PPC405 board. It introduces a new >>> generic machine and SoC models, converts the current device models to >>> QOM and populates the SoC. The process is quite mechanical without too >>> much issues to handle. The noisy part is the initial patch introducing >>> the SoC realize routine. >>> >>> What's left ? >>> >>> * the SDRAM mappings are very baroque and certainly could be simplified. >>>  I think we should QOMify the ppc440 machines before addressing this >>>  part. >> >> The issue with SDRAM controller and the likely reason why its model looks >> so complex is that it can't handle any RAM size because of how the bank >> sizes are encoded in the registers so it only really supports real RAM >> modules which are predefined sizes. Also the firmware discovers RAM by >> looking at SPD data and may only check the slots that the real hardware has >> which may not be the first one. >> Previously I had code to round down the memory size specified on the >> command line to an acceptable size and issue a warning to let the user know >> but this was dropped because of some changes in code elsewhere which now >> allocates memory before the machine could check and ajust it so we can only >> adjust it by wasting some. > > I don't think we should care adjusting the values. the machine init > routine should check that the RAM size is valid or fail. The machine > should also have a sane RAM size value by default. > > See how the aspeed machine deals with similar constraints of its SDRAM > controller in aspeed_machine_init(). If the sdram controller does not > validate the RAM size, aspeed_sdmc_set_ram_size() fails with an error. Even then we need to check if the specified memory matches one of the allowed sized and distribute it to the allowed banks by the soc. This code is more complex than the 405ep has currently and should not be reprated in each board. That's why we have the ppc4xx_memory_banks and sdram_init functions so while it may be possible to simmplify it a bit maybe not much. I've spent quite some time with it so if you change it check that at least sam360ex -m 2G still works. Regards, BALATON Zoltan --3866299591-907815730-1659967685=:47322--