From patchwork Fri Jan 13 14:10:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 641948 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp226518pvb; Fri, 13 Jan 2023 06:15:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXvdlUvWL7cDSnPlARIbidRJik+g7f+Byq08ATI0h8u0zq1CRGCF9Ey/N+pPsRtyBz1PbYhR X-Received: by 2002:a25:ed0e:0:b0:7b0:7586:7ee9 with SMTP id k14-20020a25ed0e000000b007b075867ee9mr31762518ybh.3.1673619305696; Fri, 13 Jan 2023 06:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673619305; cv=none; d=google.com; s=arc-20160816; b=cNPKm8TlmlNKLXD17AQdUlo9NpFtyIhDUe6etWG6R+sAaQh7diTU/TnH38uHFD8jcw JWRJGq8mO2XR7uIyFblCMnXpJabyk29La3Jyz2j/qophwAIklHtpXHmuv8zBt3VphThy L7g/ubCftfJwPlEmKeB4RNLNsSjvdXjm/gyBRBlBWYRArkvc/24AgFfEkQ/bPUVhzD5O 48jDFIW8L5yJG250M+jfpHDAmpguruJyh/OHrR9yuz/ZYcqqY1fZXw2ZSXuv5EeJYL84 bLIyXyIWyDOJow9nUFd64J//GCZUgPiPmc7YuS6k6xVKRfB5QSLw+K3GDFSjGTwh9jQJ RxUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0UjFAgB+hRTqOaCSG06n/BoGBnVJMNwagk4kbsnn0CU=; b=uzsfFA1iuqgxlE8tuQP8SCeGiyZvIxIlaI3gVyqLqYgabsBQbXcFXrd64uTK/aB0RB YPeHuHOcv1GNNrIQr/37gS6W9m4x4lXTYD6CW8ly0+v3X9gRUxFHUeMITR7ug/uel1nl aAFNKn2T4ZtscMFL6RBRopqsrgSQ7FITWPMrLU2qpw4qkVMsN9H4FBcWAF2wQHsjDhf/ o1YWofj9jx5zxnMjiLON+DeK/b9XQA0Xw0iACSviRmFffydQ9J6jvmX/zX+y4U0h4dUG Ue7b3ItHn/+rQEdo9XdKJqyNMg764tsr3mT4C1DFlv5A9ApMhJ++A4fj4KNPCct5umQ8 w1lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ULiYO3fl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTP id i63-20020a672242000000b003c5049075bfsi5005555vsi.639.2023.01.13.06.15.05 for ; Fri, 13 Jan 2023 06:15:05 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ULiYO3fl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGKmS-0000qa-1b; Fri, 13 Jan 2023 09:11:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGKmM-0000pL-Ep for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:34 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGKmI-0003dl-HN for qemu-devel@nongnu.org; Fri, 13 Jan 2023 09:11:31 -0500 Received: by mail-wm1-x332.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so14040999wma.1 for ; Fri, 13 Jan 2023 06:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=0UjFAgB+hRTqOaCSG06n/BoGBnVJMNwagk4kbsnn0CU=; b=ULiYO3fl1uV9msj9tdAMEhO+h4oC2pikmw+C6APLZmhvD0TkPRijyN1slGRQtHKYQ9 nvP1zkZDItRSRzzf8Rg5KfaBMWleDadY8DutT8aObJYFvDwaMGGIemDTclAag6yZPysD dvTPc5OgkirCSW1BV39QnV858eGrkYe85tdb8KTELY4fHQ1sVgrF27lgZuWZU2eWUEup 2QAxCDqOq3qv7qaDEda/rCXotcw/ANHhx8NXUPSq6dt4psPhGlIy0gPENX51S3JvktCa qeueNz3mUN4g9q3Kolysb8h9MOqiowrQwegHojOXvcxV/v7tQ2h6arz2zzeKqqakabfJ uvKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0UjFAgB+hRTqOaCSG06n/BoGBnVJMNwagk4kbsnn0CU=; b=mTIIjJRDCXJdrcNUgEGFfJIDrgzvcRKGf3iZYcejZJ8aCeIzZm7dHad+Sy5KX/0XVS Gp3uMVuQoufHW2eUMvKGaOLmtOtty9zm3f8mLyqpQV1pt3Ro5e/nhMY1dlpxdWjPJAd5 P69H/eR858v8sylucz0fjRVxllavNv2BeDD8cOczV5x1iXcliNFYIcieM/LpXPcKRIrK HGEuBbPP1w49hzjts/EijCOZ4CI0rjdxfQ2MoluS/j0V7NW6hprKIxY+lGpG7fvEUpWm WegI2+uEwxfk2rlz+3QTIDJlZ0chM5LPEK1+Fdy/LMFqi6B1ZBvTnRfJY560TDwTx3Aj izCw== X-Gm-Message-State: AFqh2koK5sCPskMByVWaafKdLYBaJoOUqghUn9juxoHngegMgipKVwMN sRPpxoEiNNm7ovYUQLqnNDszxSQyzb1izscp X-Received: by 2002:a05:600c:3493:b0:3d2:370b:97f4 with SMTP id a19-20020a05600c349300b003d2370b97f4mr63294552wmq.16.1673619088908; Fri, 13 Jan 2023 06:11:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id n36-20020a05600c502400b003da0b75de94sm5334464wmr.8.2023.01.13.06.11.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 06:11:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/38] hw/arm/stm32f405: correctly describe the memory layout Date: Fri, 13 Jan 2023 14:10:49 +0000 Message-Id: <20230113141126.535646-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230113141126.535646-1-peter.maydell@linaro.org> References: <20230113141126.535646-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Felipe Balbi STM32F405 has 128K of SRAM and another 64K of CCM (Core-coupled Memory) at a different base address. Correctly describe the memory layout to give existing FW images a chance to run unmodified. Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Felipe Balbi Message-id: 20221230145733.200496-2-balbi@kernel.org Signed-off-by: Peter Maydell --- include/hw/arm/stm32f405_soc.h | 5 ++++- hw/arm/stm32f405_soc.c | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h index 5bb0c8d5697..249ab5434ec 100644 --- a/include/hw/arm/stm32f405_soc.h +++ b/include/hw/arm/stm32f405_soc.h @@ -46,7 +46,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(STM32F405State, STM32F405_SOC) #define FLASH_BASE_ADDRESS 0x08000000 #define FLASH_SIZE (1024 * 1024) #define SRAM_BASE_ADDRESS 0x20000000 -#define SRAM_SIZE (192 * 1024) +#define SRAM_SIZE (128 * 1024) +#define CCM_BASE_ADDRESS 0x10000000 +#define CCM_SIZE (64 * 1024) struct STM32F405State { /*< private >*/ @@ -65,6 +67,7 @@ struct STM32F405State { STM32F2XXADCState adc[STM_NUM_ADCS]; STM32F2XXSPIState spi[STM_NUM_SPIS]; + MemoryRegion ccm; MemoryRegion sram; MemoryRegion flash; MemoryRegion flash_alias; diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index c07947d9f8b..cef23d7ee41 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -139,6 +139,14 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error **errp) } memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram); + memory_region_init_ram(&s->ccm, NULL, "STM32F405.ccm", CCM_SIZE, + &err); + if (err != NULL) { + error_propagate(errp, err); + return; + } + memory_region_add_subregion(system_memory, CCM_BASE_ADDRESS, &s->ccm); + armv7m = DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 96); qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type);