From patchwork Wed Sep 4 17:13:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D30F1398 for ; Wed, 4 Sep 2019 17:15:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2340F21726 for ; Wed, 4 Sep 2019 17:15:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F5QoSQQn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2340F21726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YsC-0003Ee-Ak for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48325) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqQ-0001IP-4J for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqP-0006yc-4O for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:22 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqO-0006yF-U7; Wed, 04 Sep 2019 13:13:21 -0400 Received: by mail-wm1-x342.google.com with SMTP id r195so4717309wme.2; Wed, 04 Sep 2019 10:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=voiG7DWCSdFTStaEL19HrjsIseLBzBfq9/zOs+pAh+4=; b=F5QoSQQn9lWthvpWyrS2ePfhHwzA6EJHxfekKenJN0c18EnLqz3KAhcG3ZIBCf4E/q xE1skhSM/IMpFgWWUFs6xfJEiucb/V7b6gjmdxWvq7iTPq/XHo5HY40sx0s31zf3m/oh 02Bb2Sj29VaQ288BVZ75cPJewS39PX3o2fSqNUE1ZVDDaJAnoDBKnQ5gtWJlDGI/x5GX DcaVwU+lRM2nnrDj/re8zdzLBXfgY46FkrqxRAXTZwbQwmvDRhnQk0GIrs4aUHd6Jp7Y PIBPD2F+nKER7Esxkn58oJH6ALphmkjExJ417wAsJrf66NJyaMpVmmbUypjpIh6kprfc Lywg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=voiG7DWCSdFTStaEL19HrjsIseLBzBfq9/zOs+pAh+4=; b=OvS4Kxx+Q1skfZ+WPy+a1/ee1TAOxQ2pIV2aREpA0qepmha6SQ0ui5SltW6WorgeXe xcBbAeVgtOgVmEzsZJys9RT8l23SsQTHhltJ6l1WYgtd8I0kGkX2Kml+ww+jjPXri5Kc aiFlWYs8RvSXJQ3zhCg/kaOxBAVCXJDVeqiZtblmBhRSYq14GeXBQUOcGCosZOtkOsaB DXkYHcj85jT8v6IQi2D+GcS+X3+99B9hPbUKSSKxCX0/rlEyqrtITyW1DfxqzMe5mitl XE0rj9nC3PSYRFrbDoW9CaQpDRrbVQLTYiOZowljGfEsWZ4t+RV1dVHo34qrOdsJiA1B uDCg== X-Gm-Message-State: APjAAAVTtczqZHj/5bpqqUJ51VZ4Vd+FpELB9sCIbrHIZDKl67Q4BwcR 59OQOiJp9yInwJ0vgAzDC10= X-Google-Smtp-Source: APXvYqzBwRWU4J7GwgmLjJBorifDNzYqwpTh/zahtmZ1lnkaaK3FcvFf1OQKRni6r+6xIZqi+Nl43A== X-Received: by 2002:a1c:7f86:: with SMTP id a128mr5520752wmd.104.1567617199881; Wed, 04 Sep 2019 10:13:19 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:02 +0200 Message-Id: <20190904171315.8354-2-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 01/14] hw/arm/raspi: Use the IEC binary prefix definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" IEC binary prefixes ease code review: the unit is explicit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Reviewed-by: Esteban Bosse --- hw/arm/raspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 74c062d05e..615d755879 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -230,7 +230,7 @@ static void raspi2_machine_init(MachineClass *mc) mc->max_cpus = BCM283X_NCPUS; mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; - mc->default_ram_size = 1024 * 1024 * 1024; + mc->default_ram_size = 1 * GiB; mc->ignore_memory_transaction_failures = true; }; DEFINE_MACHINE("raspi2", raspi2_machine_init) @@ -252,7 +252,7 @@ static void raspi3_machine_init(MachineClass *mc) mc->max_cpus = BCM283X_NCPUS; mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; - mc->default_ram_size = 1024 * 1024 * 1024; + mc->default_ram_size = 1 * GiB; } DEFINE_MACHINE("raspi3", raspi3_machine_init) #endif From patchwork Wed Sep 4 17:13:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131115 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BEA8112C for ; Wed, 4 Sep 2019 17:15:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 125B621726 for ; Wed, 4 Sep 2019 17:15:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nV2g+n9z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 125B621726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YsD-0003GY-RV for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:15:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48345) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqR-0001Ia-J8 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqQ-0006zE-Kk for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:23 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:33135) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqQ-0006yr-Ec; Wed, 04 Sep 2019 13:13:22 -0400 Received: by mail-wr1-x443.google.com with SMTP id u16so22125904wrr.0; Wed, 04 Sep 2019 10:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Re5SoK9LBlh1OETVvBHDiEijPJqBMr7rX5bmU56TmLo=; b=nV2g+n9zeC4s2DMuvnV4wNpvw/73bDuCwOGe3RG8IZx8f1Z9tIpvnucKfqSRJJzxnT gHOsRpczq2RmGpFD0ec7ngCYP8D5AiTTT4wBmqtRXXMKZMIogd7+VU01gh2Pw/OTsGhQ 9UPaPgktdOqKDBoR13CvLjphtTt20pnr5n32HCRlA6LmxCdJVZVDfuFKwANvd6GAhFRa i+L7WUECBtVf0AH4yzcSleXyaMmbC/Fwfyt3BZSyasTeV/PxQybWeY3ZyHVEJu90puL4 eobNLU7ZmwTQFWy+Rj5FtXMPmOg1OJtOC0yQlESBxBsDGRYYitGBKBTBkh4IopM++k11 2jcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Re5SoK9LBlh1OETVvBHDiEijPJqBMr7rX5bmU56TmLo=; b=AxafNZINv6RQeqzGn9+ZmF2xrSoCp3f+nHn+iXDkEsdHtZwoaLUEvgFQi20p8E8aQx TjVMtfaUnBkPsxgiqPmYMSomWZkS9i3gL0pZqE9LYp6gjmOpWUTEOfbz5croh1yrBtVH U/efyCGRHt35MacRYiYpN+oFOqC9jk8ZpkavRK+t3mFf/9RT+S5ay+karBYx3n5d1mux n2moncBE+Xx20i2LMRCoFt8h9woomMimbd4z3SYNAUbNAiGXY1/AvuRF1r1smDjCLWUp 026uAB+MGIaaV/9AFjbOaNBDCEd2ifnluyTn3faZdBEUQgAFxy0m25qa925N64rlKQnz gq8g== X-Gm-Message-State: APjAAAVkOTLpOCJPw5qX66w/GQbz2nDhd19S7v1k4zmidm2UZh+PSvUC yR8FsfWFZpuj22cQuRFke7k= X-Google-Smtp-Source: APXvYqxqFsgbbB5cSLHO8aHW+LjhxGc8JcZOj/pdM62vUI87Od70LG3yV1cjZD725KRr2aAR7AbFsQ== X-Received: by 2002:adf:ff8a:: with SMTP id j10mr1475139wrr.334.1567617201524; Wed, 04 Sep 2019 10:13:21 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:03 +0200 Message-Id: <20190904171315.8354-3-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH 02/14] hw/misc/bcm2835_property: Add FIXME comment for uninitialized memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We are returning unintialized memory, this is probably unsafe. Reported-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/bcm2835_property.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index d86d510572..399f0d9dd5 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -57,6 +57,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) case 0x00010001: /* Get board model */ qemu_log_mask(LOG_UNIMP, "bcm2835_property: %x get board model NYI\n", tag); + /* FIXME returning uninitialized memory */ resplen = 4; break; case 0x00010002: /* Get board revision */ @@ -70,6 +71,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) case 0x00010004: /* Get board serial */ qemu_log_mask(LOG_UNIMP, "bcm2835_property: %x get board serial NYI\n", tag); + /* FIXME returning uninitialized memory */ resplen = 8; break; case 0x00010005: /* Get ARM memory */ From patchwork Wed Sep 4 17:13:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131127 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42A9115E9 for ; Wed, 4 Sep 2019 17:20:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1960821726 for ; Wed, 4 Sep 2019 17:20:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KlOwBBa3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1960821726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YxF-0007G5-NE for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:20:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48379) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqT-0001JZ-Hj for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqS-00070K-GE for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:25 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35713) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqS-0006zr-9F; Wed, 04 Sep 2019 13:13:24 -0400 Received: by mail-wr1-x442.google.com with SMTP id g7so22152408wrx.2; Wed, 04 Sep 2019 10:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1lvnZRDBY+QqCszElvqzfXUD36KMQAFLJctTSYyNnFw=; b=KlOwBBa3KvDzeE+NmXwIAS0i/EzRwkIeqV1tPmVMLEkp6M+CsD4POgqa0w1//AkBni ILUQOnqULXbfmkxVvQx72WeOAnKZfa8bJeVwc1S/P7hL3NrvrZMw2AvRnAK7c3dCSOjK jFnY4elPjAq3xiUrVdA0s85uoGU/V3pgl8mujkNhcZ7ec0NLX+fVOthI91yZCYYbdBg+ h9HUHJb5vLlPWm3DN2ERtAueQ/7tNVAsInUWuC29gTim2kGPpmgvgNh8uOIcgUfLe6XV SlAxUytVnmUA76m3cVjcKbd/M2rqYMGbnftWTl+NXxrNSLeuueAsX0iO77obYfquTi4h aqDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1lvnZRDBY+QqCszElvqzfXUD36KMQAFLJctTSYyNnFw=; b=cWZwUtIg1wN8VVX8Kidz46S5jUhpsldiciQOg2vVE9Sc9TD7HQvUsmvhjKZjV9sHQB Swx+ISGSt/pFUDFgnRjBTrmiteGBXszNuxnkdGjayacX+fx1VLEbm0fott9QFNezFcna Y6paHa+WqCuDGQmLWdblIb4QujsMzWRuTmrvT8lKxBkhkKbNSC8Ihjnp3+JNUNeZvm0L tfhFOTVZ+L/68U60pWa7g6BltAnzzqa+AfywbO7XFa9LqsYM8meYhL43JrROncJlygTK mecu1FzW3oOa4F19SnRDpg2iPcOKwzMJF4qzvPu7Kw6RAGeP9x4pszaTnOLaVQwd7Bit Ol4g== X-Gm-Message-State: APjAAAVfj0WlpFS8aQMSd/Bu6nBXIj71Qq6hT20ec59FHTbZGE+bhHXd ajR1E0ocYQkblHywyhEsXGc= X-Google-Smtp-Source: APXvYqzThQn47wJCegsxynyHpCYZJmgM6G5mxlXjZV51xLk8Uj3Kl4rUmS5bDoM6m/QmmzJdz/fXwg== X-Received: by 2002:adf:f48e:: with SMTP id l14mr32580480wro.234.1567617203331; Wed, 04 Sep 2019 10:13:23 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:04 +0200 Message-Id: <20190904171315.8354-4-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [RFC PATCH 03/14] hw/misc/bcm2835_property: Handle the 'domain state' property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The kernel is happy with this change, so we don't need to do anything more sophisticated. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: EstebanB --- hw/misc/bcm2835_property.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 399f0d9dd5..d8eb28f267 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -127,6 +127,14 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) resplen = 8; break; + case 0x00030030: /* Get domain state */ + qemu_log_mask(LOG_UNIMP, + "bcm2835_property: 0x%08x get domain state NYI\n", + tag); + /* FIXME returning uninitialized memory */ + resplen = 8; + break; + case 0x00038002: /* Set clock rate */ case 0x00038004: /* Set max clock rate */ case 0x00038007: /* Set min clock rate */ From patchwork Wed Sep 4 17:13:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131131 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA9B815E9 for ; Wed, 4 Sep 2019 17:21:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 816E221726 for ; Wed, 4 Sep 2019 17:21:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qi9aqFqQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 816E221726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yxv-0007hS-Tv for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:21:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48403) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqW-0001NQ-16 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqU-000717-60 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:27 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37492) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqT-00070i-V9; Wed, 04 Sep 2019 13:13:26 -0400 Received: by mail-wm1-x32e.google.com with SMTP id r195so4717584wme.2; Wed, 04 Sep 2019 10:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6rorF+6pSO7+RuiUxEvvJ3ZwjSNHy/kVt8m9gQNTqTU=; b=Qi9aqFqQZ7k44awhU7HIqhTWjc7w+4Ic5LcYatzsadA0Crt8pUjdLBq29i7atvJRJg cfOwTk2Kle1xmkGePh3jdc72UXmGhToHojGP2jHJk05DiQhOhF1686p8O8tcMhUhzu74 TUdONdXIj1E5VugwCSxxe+V+9Ubsg1zki8aeiht90THlBnKcKRZFggIXEm9ruM9ll+dW VogKfpo76oFw/qTJnCyY6Mm7CJhpGdJjgyLqfW01QiDR+gF5G9H5gxXxel5qMGLDuvld 1vOJUrN3ZCopwIi7w0a2CZh4uq/SR8RVMvgt4DSBBiNcdqNgJ53kqOI3VXhxwb3v9NmJ MbiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6rorF+6pSO7+RuiUxEvvJ3ZwjSNHy/kVt8m9gQNTqTU=; b=pwSdlgKAJuSuOIUlojxA2CjTOY/3Rp1PgALeaOiz5cc8jI3XXdIn8V9dgG7oQkj5mA cnfgLzdIoATx0jX3ps2SsVHbMdCPdoQTGNkC8uc+iAA4rqQDHHB+3+mbcKaQ2CdCxk0z uwBp2e7tmT7qng6nzW0TYHuzivf+56l0UgKnKvg+598aj9U2AnVeinzMpPU0biW6fZ7o ypgdW/sqErhofM6YDpA9yJB5DQxemDkMAvKxitBj0LwrQbe8IuSAQ7Cljk+KF/BCRPv+ jGtRdJXnH1xfvDGT8CrNiqn1juEYP3tcLWe6D/N6SHRbDjqmj8N+ydEgLn/a3Zb3A9zr W/hg== X-Gm-Message-State: APjAAAVnBWup+rCAMEOzmqmwlxEiVjVR2G9vBIVd2rk4/FRHLWj+CvBM zFKs+abkU6OJ5u2jIHheeMw= X-Google-Smtp-Source: APXvYqxSolMghHBuvwWf7ZiLU3NMG6tMvnJ4BkpULmGAvUnEJICp5OeDgRnmvbAhdh2qMR4DJhLgSg== X-Received: by 2002:a1c:a8d8:: with SMTP id r207mr5225450wme.135.1567617204984; Wed, 04 Sep 2019 10:13:24 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:05 +0200 Message-Id: <20190904171315.8354-5-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e Subject: [Qemu-devel] [PATCH 04/14] hw/arm/bcm2835_peripherals: Improve logging X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Various logging improvements as once: - Use 0x prefix for hex numbers - Display value written during write accesses - Move some logs from GUEST_ERROR to UNIMP Signed-off-by: Philippe Mathieu-Daudé --- v2: Use PRIx64 format (pm215) --- hw/char/bcm2835_aux.c | 5 +++-- hw/dma/bcm2835_dma.c | 8 ++++---- hw/intc/bcm2836_control.c | 7 ++++--- hw/misc/bcm2835_mbox.c | 7 ++++--- hw/misc/bcm2835_property.c | 16 ++++++++++------ 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index 3f855196e3..a6fc1bf152 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -162,8 +162,9 @@ static void bcm2835_aux_write(void *opaque, hwaddr offset, uint64_t value, switch (offset) { case AUX_ENABLES: if (value != 1) { - qemu_log_mask(LOG_UNIMP, "%s: unsupported attempt to enable SPI " - "or disable UART\n", __func__); + qemu_log_mask(LOG_UNIMP, "%s: unsupported attempt to enable SPI" + " or disable UART: 0x%"PRIx64"\n", + __func__, value); } break; diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c index 192bd377a0..6acc2b644e 100644 --- a/hw/dma/bcm2835_dma.c +++ b/hw/dma/bcm2835_dma.c @@ -180,7 +180,7 @@ static uint64_t bcm2835_dma_read(BCM2835DMAState *s, hwaddr offset, res = ch->debug; break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset); break; } @@ -228,7 +228,7 @@ static void bcm2835_dma_write(BCM2835DMAState *s, hwaddr offset, ch->debug = value; break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset); break; } @@ -247,7 +247,7 @@ static uint64_t bcm2835_dma0_read(void *opaque, hwaddr offset, unsigned size) case BCM2708_DMA_ENABLE: return s->enable; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset); return 0; } @@ -274,7 +274,7 @@ static void bcm2835_dma0_write(void *opaque, hwaddr offset, uint64_t value, s->enable = (value & 0xffff); break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset 0x%"HWADDR_PRIx"\n", __func__, offset); } } diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c index 04229b8a17..61f884ff9e 100644 --- a/hw/intc/bcm2836_control.c +++ b/hw/intc/bcm2836_control.c @@ -264,7 +264,7 @@ static uint64_t bcm2836_control_read(void *opaque, hwaddr offset, unsigned size) } else if (offset >= REG_MBOX0_RDCLR && offset < REG_LIMIT) { return s->mailboxes[(offset - REG_MBOX0_RDCLR) >> 2]; } else { - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx"\n", __func__, offset); return 0; } @@ -293,8 +293,9 @@ static void bcm2836_control_write(void *opaque, hwaddr offset, } else if (offset >= REG_MBOX0_RDCLR && offset < REG_LIMIT) { s->mailboxes[(offset - REG_MBOX0_RDCLR) >> 2] &= ~val; } else { - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", - __func__, offset); + qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx + " value 0x%"PRIx64"\n", + __func__, offset, val); return; } diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index 79bad11631..7690b9afaf 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -176,7 +176,7 @@ static uint64_t bcm2835_mbox_read(void *opaque, hwaddr offset, unsigned size) break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", + qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx"\n", __func__, offset); return 0; } @@ -228,8 +228,9 @@ static void bcm2835_mbox_write(void *opaque, hwaddr offset, break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad offset %"HWADDR_PRIx"\n", - __func__, offset); + qemu_log_mask(LOG_UNIMP, "%s: Unsupported offset 0x%"HWADDR_PRIx + " value 0x%"PRIx64"\n", + __func__, offset, value); return; } diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index d8eb28f267..ab66d3572e 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -56,7 +56,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) break; case 0x00010001: /* Get board model */ qemu_log_mask(LOG_UNIMP, - "bcm2835_property: %x get board model NYI\n", tag); + "bcm2835_property: 0x%08x get board model NYI\n", + tag); /* FIXME returning uninitialized memory */ resplen = 4; break; @@ -70,7 +71,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) break; case 0x00010004: /* Get board serial */ qemu_log_mask(LOG_UNIMP, - "bcm2835_property: %x get board serial NYI\n", tag); + "bcm2835_property: 0x%08x get board serial NYI\n", + tag); /* FIXME returning uninitialized memory */ resplen = 8; break; @@ -106,7 +108,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) case 0x00038001: /* Set clock state */ qemu_log_mask(LOG_UNIMP, - "bcm2835_property: %x set clock state NYI\n", tag); + "bcm2835_property: 0x%08x set clock state NYI\n", + tag); resplen = 8; break; @@ -139,7 +142,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) case 0x00038004: /* Set max clock rate */ case 0x00038007: /* Set min clock rate */ qemu_log_mask(LOG_UNIMP, - "bcm2835_property: %x set clock rates NYI\n", tag); + "bcm2835_property: 0x%08x set clock rate NYI\n", + tag); resplen = 8; break; @@ -284,8 +288,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) break; default: - qemu_log_mask(LOG_GUEST_ERROR, - "bcm2835_property: unhandled tag %08x\n", tag); + qemu_log_mask(LOG_UNIMP, + "bcm2835_property: unhandled tag 0x%08x\n", tag); break; } From patchwork Wed Sep 4 17:13:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131141 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C52CD14E5 for ; Wed, 4 Sep 2019 17:24:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9B8F42087E for ; Wed, 4 Sep 2019 17:24:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nwKwH1ef" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B8F42087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z0h-0002b1-7C for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:23:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48417) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqX-0001PF-Gc for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqW-00071w-0s for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:29 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:38761) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqV-00071Y-Pi; Wed, 04 Sep 2019 13:13:27 -0400 Received: by mail-wm1-x344.google.com with SMTP id o184so4695504wme.3; Wed, 04 Sep 2019 10:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ELAbj/wA1Xj60eRjG4YFXEUkK6OU0pIolX6z3Dq1NCw=; b=nwKwH1efKkXbYgo8Eru3f23GBHkTNejzA+XTuYBSjrKYDl9b2zMugd8Eu7+5Wt/QwK DZNRmD6mvrTIevcuoVfqlPJn9Mf56eG5dkDt/GhI2oMdzr88nhlMg/58vgE0sfPNz1EY 25btbWkoWUF+sUPGqm98pUqIYqJGqjWINZMf1e5sLR5DZWpYDHfryYwuzcodZh79KinP E6sXHoDghvXQzS25O4QMEYnk1WRiOph+DMOcomxoxx9rlSFdauCCOhDw5EmJGQpzBtMw PSElOzQXTpTeWHqfFaANauJwneyEfCR5Qk4xytpAZANO80UAuxbltLIg72ejsdqr3pFH SdDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ELAbj/wA1Xj60eRjG4YFXEUkK6OU0pIolX6z3Dq1NCw=; b=kKLM6ctoQ4a61KhMjYYyYsz82V6NwMEy16rJ3WnNq3M6l9Y0aVzLrDF/7TZBdB0B5B OEJeeSVRekKSeFKo3u90dCwumVzi7dz6sSUk9/i/4urknUw1SHRxZowdbn3VlyD16EdS IitOyc35rm7uWfZ20UGF0UMEavbUE4QULDiRFsf3HsQ9g5Pz39/J+IfZOBBQJ7IY8Y1g GBNWpnDS0nzN8JLEXAxOU53snDcv5LtejyjXQRLigR7bXjJEieZhmIrWsi4sEiNZhAwa cVb4GcSwSKrd5QluSXA54STK3mj0EdGBVKvakTLYuy3cvKxnor7XvgyCGXSzbm1ss51z ckWw== X-Gm-Message-State: APjAAAXygmmqiMlTYnNdbquhgMJEQy7aPvc9Vs5W5o7JptBCs3WzAS3+ icQUkqKcy7xTY7t1vI7bNzM= X-Google-Smtp-Source: APXvYqx691vttX6XS0mJd5gNajfoQTff1JFfR4mzVdzCMpp9ghKtvOufxI/5T54ASFdhFw/VJdQzlQ== X-Received: by 2002:a05:600c:12:: with SMTP id g18mr5461628wmc.95.1567617206828; Wed, 04 Sep 2019 10:13:26 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:06 +0200 Message-Id: <20190904171315.8354-6-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH 05/14] hw/arm/bcm2835_peripherals: Name various address spaces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Various address spaces from the BCM2835 are reported as 'anonymous' in memory tree: (qemu) info mtree address-space: anonymous 0000000000000000-000000000000008f (prio 0, i/o): bcm2835-mbox 0000000000000010-000000000000001f (prio 0, i/o): bcm2835-fb 0000000000000080-000000000000008f (prio 0, i/o): bcm2835-property address-space: anonymous 0000000000000000-00000000ffffffff (prio 0, i/o): bcm2835-gpu 0000000000000000-000000003fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 0000000040000000-000000007fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 000000007e000000-000000007effffff (prio 1, i/o): alias bcm2835-peripherals @bcm2835-peripherals 0000000000000000-0000000000ffffff 0000000080000000-00000000bfffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 00000000c0000000-00000000ffffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff [...] Since the address_space_init() function takes a 'name' argument, set it to correctly describe each address space: (qemu) info mtree address-space: bcm2835-mbox-memory 0000000000000000-000000000000008f (prio 0, i/o): bcm2835-mbox 0000000000000010-000000000000001f (prio 0, i/o): bcm2835-fb 0000000000000080-000000000000008f (prio 0, i/o): bcm2835-property address-space: bcm2835-fb-memory 0000000000000000-00000000ffffffff (prio 0, i/o): bcm2835-gpu 0000000000000000-000000003fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 0000000040000000-000000007fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 000000007e000000-000000007effffff (prio 1, i/o): alias bcm2835-peripherals @bcm2835-peripherals 0000000000000000-0000000000ffffff 0000000080000000-00000000bfffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 00000000c0000000-00000000ffffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff address-space: bcm2835-property-memory 0000000000000000-00000000ffffffff (prio 0, i/o): bcm2835-gpu 0000000000000000-000000003fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 0000000040000000-000000007fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 000000007e000000-000000007effffff (prio 1, i/o): alias bcm2835-peripherals @bcm2835-peripherals 0000000000000000-0000000000ffffff 0000000080000000-00000000bfffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 00000000c0000000-00000000ffffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff address-space: bcm2835-dma-memory 0000000000000000-00000000ffffffff (prio 0, i/o): bcm2835-gpu 0000000000000000-000000003fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 0000000040000000-000000007fffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 000000007e000000-000000007effffff (prio 1, i/o): alias bcm2835-peripherals @bcm2835-peripherals 0000000000000000-0000000000ffffff 0000000080000000-00000000bfffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff 00000000c0000000-00000000ffffffff (prio 0, i/o): alias bcm2835-gpu-ram-alias[*] @ram 0000000000000000-000000003fffffff Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse --- hw/display/bcm2835_fb.c | 2 +- hw/dma/bcm2835_dma.c | 2 +- hw/misc/bcm2835_mbox.c | 2 +- hw/misc/bcm2835_property.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index 8f856878cd..85aaa54330 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -425,7 +425,7 @@ static void bcm2835_fb_realize(DeviceState *dev, Error **errp) s->initial_config.base = s->vcram_base + BCM2835_FB_OFFSET; s->dma_mr = MEMORY_REGION(obj); - address_space_init(&s->dma_as, s->dma_mr, NULL); + address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_FB "-memory"); bcm2835_fb_reset(dev); diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c index 6acc2b644e..1e458d7fba 100644 --- a/hw/dma/bcm2835_dma.c +++ b/hw/dma/bcm2835_dma.c @@ -383,7 +383,7 @@ static void bcm2835_dma_realize(DeviceState *dev, Error **errp) } s->dma_mr = MEMORY_REGION(obj); - address_space_init(&s->dma_as, s->dma_mr, NULL); + address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_DMA "-memory"); bcm2835_dma_reset(dev); } diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index 7690b9afaf..77285624c9 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -311,7 +311,7 @@ static void bcm2835_mbox_realize(DeviceState *dev, Error **errp) } s->mbox_mr = MEMORY_REGION(obj); - address_space_init(&s->mbox_as, s->mbox_mr, NULL); + address_space_init(&s->mbox_as, s->mbox_mr, TYPE_BCM2835_MBOX "-memory"); bcm2835_mbox_reset(dev); } diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index ab66d3572e..3dff5a7157 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -417,7 +417,7 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp) } s->dma_mr = MEMORY_REGION(obj); - address_space_init(&s->dma_as, s->dma_mr, NULL); + address_space_init(&s->dma_as, s->dma_mr, TYPE_BCM2835_PROPERTY "-memory"); /* TODO: connect to MAC address of USB NIC device, once we emulate it */ qemu_macaddr_default_if_unset(&s->macaddr); From patchwork Wed Sep 4 17:13:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131129 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9C0F14E5 for ; Wed, 4 Sep 2019 17:21:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9FDEA21726 for ; Wed, 4 Sep 2019 17:21:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VJrJq6GT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FDEA21726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yxn-0007cI-Lt for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:21:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5YqY-0001RE-TA for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqX-00072i-MZ for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:30 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqX-00072B-FN; Wed, 04 Sep 2019 13:13:29 -0400 Received: by mail-wr1-x441.google.com with SMTP id l16so3792997wrv.12; Wed, 04 Sep 2019 10:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1eynEPflF1e1UUeOg/DcqC+CT8yj8xk66WHwIPsvafI=; b=VJrJq6GTewwRk9jGNCp+yxTdikKnPNc1rf1niLHL8r3agvwLJbtqOXuZHEN6JUdGvY inluAryNWD/heqaXwr02jlJxeM2NFNObbscUYHi4yGvoR4Q3SbWvsf3wDkZFOqZ9y2ny um8aOTfAw2y8epiFPxlIF6q98xgYxQ4sDR/7ffw+TvVP/x6zeVbxjUbJCjk44RAfyua2 ve5DZUyHeGMwJwzNPic2AK3hCH+EeZ3m+YEgKRhF32bDGYTaRyxB4XEGz+a6STmuq41/ 6+q/ypSYV1KXeZNiDNjOBm3InswiSOKxSgiLBcp+aAWRWrNn5YJsgPUAXhPMLFpqb0BQ zIxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1eynEPflF1e1UUeOg/DcqC+CT8yj8xk66WHwIPsvafI=; b=So6CpoFraA6ty3usiZw7/AMio7ZXCM9a2eeQBJlu1dZh8exC0JMxItoSELJZw/7zX4 qtlFoW8xcsOfzyMjxLpdS4kPZpQc9NIlzEIPR7TDNGAK6ouamqfZW8Z+G86FGCHNLmbJ NAA2cGuu0G/JXL14ODw6o+qHXuLej0XKDqSIsVwp8tKWwmPVG0I8ZBPRZsxu9OLaAiUe uarOOwplSIyUNNsul3JtIx5U7sJ29eNuYJpMS/jGvrexx6bxIaJeu6mnVF/eh7kirshc Xk0vwBUm5yROpfdNm7Bf/NBsH9ERu4qRgMK25Z83K2UdxMUtAwoWuWauqREVj+8m24Xx K9Bg== X-Gm-Message-State: APjAAAUlAstgfvOp785WN4/Otk1WQAbaWL8wEBgVt53wgN4XaKPGjSt/ NnPfI22eEdsHuW5xaoJekoM= X-Google-Smtp-Source: APXvYqweDvge05OfkFn6VpTh3kWu8MIrRmDSBzbKOdRwEqMAl8rDBQu/7YQHq4LNVVg/7ak/mwygsw== X-Received: by 2002:a05:6000:12:: with SMTP id h18mr14702283wrx.156.1567617208542; Wed, 04 Sep 2019 10:13:28 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:07 +0200 Message-Id: <20190904171315.8354-7-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH 06/14] hw/arm/bcm2835: Rename some definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The UART1 is part of the AUX peripheral, the PCM_CLOCK (yet unimplemented) is part of the CPRMAN. Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse --- hw/arm/bcm2835_peripherals.c | 4 ++-- include/hw/arm/raspi_platform.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 8984e2e91f..270357b5a8 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -175,7 +175,7 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) return; } - memory_region_add_subregion(&s->peri_mr, UART1_OFFSET, + memory_region_add_subregion(&s->peri_mr, AUX_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->aux), 0)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->aux), 0, qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ, @@ -268,7 +268,7 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) return; } - memory_region_add_subregion(&s->peri_mr, EMMC_OFFSET, + memory_region_add_subregion(&s->peri_mr, EMMC1_OFFSET, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->sdhci), 0)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->sdhci), 0, qdev_get_gpio_in_named(DEVICE(&s->ic), BCM2835_IC_GPU_IRQ, diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 10083d33df..6f7db85bab 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -39,7 +39,7 @@ * Doorbells & Mailboxes */ #define PM_OFFSET 0x100000 /* Power Management, Reset controller * and Watchdog registers */ -#define PCM_CLOCK_OFFSET 0x101098 +#define CPRMAN_OFFSET 0x101000 /* Clock Management */ #define RNG_OFFSET 0x104000 #define GPIO_OFFSET 0x200000 #define UART0_OFFSET 0x201000 @@ -47,11 +47,11 @@ #define I2S_OFFSET 0x203000 #define SPI0_OFFSET 0x204000 #define BSC0_OFFSET 0x205000 /* BSC0 I2C/TWI */ -#define UART1_OFFSET 0x215000 -#define EMMC_OFFSET 0x300000 +#define AUX_OFFSET 0x215000 /* AUX: UART1/SPI1/SPI2 */ +#define EMMC1_OFFSET 0x300000 #define SMI_OFFSET 0x600000 #define BSC1_OFFSET 0x804000 /* BSC1 I2C/TWI */ -#define USB_OFFSET 0x980000 /* DTC_OTG USB controller */ +#define USB_OTG_OFFSET 0x980000 /* DTC_OTG USB controller */ #define DMA15_OFFSET 0xE05000 /* DMA controller, channel 15 */ /* GPU interrupts */ From patchwork Wed Sep 4 17:13:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 052A516B1 for ; Wed, 4 Sep 2019 17:16:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D009621883 for ; Wed, 4 Sep 2019 17:16:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oCxCS6Fq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D009621883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Ytg-0004YU-Mr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48466) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqb-0001VI-IK for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5YqZ-00074U-NI for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:33 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35715) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5YqZ-00072y-Dn; Wed, 04 Sep 2019 13:13:31 -0400 Received: by mail-wm1-x341.google.com with SMTP id n10so4720856wmj.0; Wed, 04 Sep 2019 10:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sXtrRzxkxK0K9P/W8U2rNzxCRQ7eLCmvy8NMXNF7RAI=; b=oCxCS6FqPq4T8AYwoAt2MaY29fD70wrSp6iwdIILqHVKo05XTx0jvov5dfkV5U6zKq xIHo9u51OtaQYk4130N0jB6ERc1znoUjxZU4zPPfxvNzSvq+QQaIV8HC6sBn+XXvaTC1 BB86b5kPIQw20kWxm3FWczGXwyiKHAE14B1BMx8kT0yn/BUlc4VfGXSuxaile0+Cm79G ulZRkuNzwrPiX+KeYSnuHS5K6vMPoOcW87sCkUgO4vZEj4/ibmDV+lqSC5r6YnAZBAku peTBF1ilUtAdqpANqBMTWlNpBAFuZApJ5TN11glga1O9QavtLQL9y0m2ydDvPkbTe1o/ BRXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sXtrRzxkxK0K9P/W8U2rNzxCRQ7eLCmvy8NMXNF7RAI=; b=DSF5ls/rurAbFWYF1vG0WeP0AtAwpL/XQIhLSU5xTCvdacS9Z4f9vems1aRL9WN70K /SVtSXC/uUjx8uY5bxVIHCtrCVvk5oPRNN18cxTPZ4fWo2MR0h96enaMW12CATPpNqsQ 0Fh4foFEQTLjfaAnTMxPE12x2qqTKozJuvS2N7d53mUiCIrKWu38RM+jYB50I5+ZPre3 J50Q9/U7LGGsW/EYFo36ba4gIOiiCXRq4a0uhFb5CMcDJS30ODOy01Vc2FbmuZuMzu/R bqWCAqLhb/ti5BOV+fgyMWWueeWJT+dM5dE7s2LBUnIrfO7RDgFNLZELnGWOAAMR13nP Hrcw== X-Gm-Message-State: APjAAAX5IlOKEuH7kldkGLTBOlN4I1PbJbMsd0iwpK0NMcTnpZY0bJH8 4ZCi5LM7n4Zsi+sYasUU6vU= X-Google-Smtp-Source: APXvYqwfAn1HRpGuxoX/TaMe08SL/VCYcXYjH+vAs2akeCzqUB1DKZ68NQ2oc+blpGNZtZ7nR+70PA== X-Received: by 2002:a1c:f103:: with SMTP id p3mr5113430wmh.18.1567617210393; Wed, 04 Sep 2019 10:13:30 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:08 +0200 Message-Id: <20190904171315.8354-8-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PATCH 07/14] hw/arm/bcm2835: Add various unimplemented peripherals X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Base addresses and sizes taken from the "BCM2835 ARM Peripherals" datasheet from February 06 2012: https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf Reviewed-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse --- hw/arm/bcm2835_peripherals.c | 30 ++++++++++++++++++++++++++++ include/hw/arm/bcm2835_peripherals.h | 14 +++++++++++++ include/hw/arm/raspi_platform.h | 8 ++++++++ 3 files changed, 52 insertions(+) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 270357b5a8..be6270b8ef 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -22,6 +22,20 @@ /* Capabilities for SD controller: no DMA, high-speed, default clocks etc. */ #define BCM2835_SDHC_CAPAREG 0x52134b4 +static void create_unimp(BCM2835PeripheralState *ps, + UnimplementedDeviceState *uds, + const char *name, hwaddr ofs, hwaddr size) +{ + sysbus_init_child_obj(OBJECT(ps), name, uds, + sizeof(UnimplementedDeviceState), + TYPE_UNIMPLEMENTED_DEVICE); + qdev_prop_set_string(DEVICE(uds), "name", name); + qdev_prop_set_uint64(DEVICE(uds), "size", size); + object_property_set_bool(OBJECT(uds), true, "realized", &error_fatal); + memory_region_add_subregion(&ps->peri_mr, ofs, + sysbus_mmio_get_region(SYS_BUS_DEVICE(uds), 0)); +} + static void bcm2835_peripherals_init(Object *obj) { BCM2835PeripheralState *s = BCM2835_PERIPHERALS(obj); @@ -322,6 +336,22 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) error_propagate(errp, err); return; } + + create_unimp(s, &s->pm, "bcm2835-pm", PM_OFFSET, 0x1000); + create_unimp(s, &s->cprman, "bcm2835-cprman", CPRMAN_OFFSET, 0x1000); + create_unimp(s, &s->a2w, "bcm2835-a2w", 0x102000, 0x1000); + create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100); + create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100); + create_unimp(s, &s->spi0, "bcm2835-spi0", SPI0_OFFSET, 0x20); + create_unimp(s, &s->bscsl, "bcm2835-spis", BSC_SL_OFFSET, 0x100); + create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20); + create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20); + create_unimp(s, &s->i2c[2], "bcm2835-i2c2", BSC2_OFFSET, 0x20); + create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80); + create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000); + create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000); + create_unimp(s, &s->dwc2, "dwc-usb2", USB_OTG_OFFSET, 0x100); + create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100); } static void bcm2835_peripherals_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h index 6b17f6a382..44a182b399 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -23,6 +23,7 @@ #include "hw/sd/sdhci.h" #include "hw/sd/bcm2835_sdhost.h" #include "hw/gpio/bcm2835_gpio.h" +#include "hw/misc/unimp.h" #define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals" #define BCM2835_PERIPHERALS(obj) \ @@ -37,6 +38,9 @@ typedef struct BCM2835PeripheralState { MemoryRegion ram_alias[4]; qemu_irq irq, fiq; + UnimplementedDeviceState pm; + UnimplementedDeviceState cprman; + UnimplementedDeviceState a2w; PL011State uart0; BCM2835AuxState aux; BCM2835FBState fb; @@ -48,6 +52,16 @@ typedef struct BCM2835PeripheralState { SDHCIState sdhci; BCM2835SDHostState sdhost; BCM2835GpioState gpio; + UnimplementedDeviceState i2s; + UnimplementedDeviceState spi0; + UnimplementedDeviceState i2c[3]; + UnimplementedDeviceState otp; + UnimplementedDeviceState dbus; + UnimplementedDeviceState ave0; + UnimplementedDeviceState bscsl; + UnimplementedDeviceState smi; + UnimplementedDeviceState dwc2; + UnimplementedDeviceState sdramc; } BCM2835PeripheralState; #endif /* BCM2835_PERIPHERALS_H */ diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 6f7db85bab..069edab526 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -40,6 +40,7 @@ #define PM_OFFSET 0x100000 /* Power Management, Reset controller * and Watchdog registers */ #define CPRMAN_OFFSET 0x101000 /* Clock Management */ +#define AVS_OFFSET 0x103000 /* Audio Video Standard */ #define RNG_OFFSET 0x104000 #define GPIO_OFFSET 0x200000 #define UART0_OFFSET 0x201000 @@ -47,11 +48,18 @@ #define I2S_OFFSET 0x203000 #define SPI0_OFFSET 0x204000 #define BSC0_OFFSET 0x205000 /* BSC0 I2C/TWI */ +#define OTP_OFFSET 0x20f000 +#define AVSP_OFFSET 0x130000 +#define BSC_SL_OFFSET 0x214000 /* SPI slave */ #define AUX_OFFSET 0x215000 /* AUX: UART1/SPI1/SPI2 */ #define EMMC1_OFFSET 0x300000 #define SMI_OFFSET 0x600000 #define BSC1_OFFSET 0x804000 /* BSC1 I2C/TWI */ +#define BSC2_OFFSET 0x805000 /* BSC2 I2C/TWI */ +#define DBUS_OFFSET 0x900000 +#define AVE0_OFFSET 0x910000 #define USB_OTG_OFFSET 0x980000 /* DTC_OTG USB controller */ +#define SDRAMC_OFFSET 0xe00000 #define DMA15_OFFSET 0xE05000 /* DMA controller, channel 15 */ /* GPU interrupts */ From patchwork Wed Sep 4 17:13:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131133 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6305814E5 for ; Wed, 4 Sep 2019 17:21:54 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 399B821726 for ; Wed, 4 Sep 2019 17:21:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lhUAS8ek" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 399B821726 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yye-000061-IH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:21:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48480) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqc-0001YD-Hj for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqb-00075V-25 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:34 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqa-000751-S2; Wed, 04 Sep 2019 13:13:32 -0400 Received: by mail-wm1-x342.google.com with SMTP id r195so4717954wme.2; Wed, 04 Sep 2019 10:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rh2gl72em/tjXVFRsaWM/1jTRmVaVLHat+KG0haXObM=; b=lhUAS8ekgrhb2YBCg6uJiK0BpLMJlzFP5Y4tplYbjP7LLo9u1IeBqnnbOlq4R0akTe 4HI/fFR2/wX3bfd+7Asbrtf3w5CnTDhsE1pd1VD0DqXvHlTTB2NeIp87ByEgqW3MpT0X jsXMlfF0Yi3eDrqF4K4+fERR+lqPUsXr8r2RSKQoadaeVFICqGEEL+5XhyhBgGTdUZf2 YUQBNU22/67yTP12ZII2BaR0Cofh0+kLTBWu7Y5mQbt41ihGyEwyfxXn9icn1MfI0juX Ynh9iVpD/exBwF12nBFMUXTL0Xg/Ps48/uES7Zk7HG0owdWMZ0rHuXPbmsGXQugyw2vO sufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rh2gl72em/tjXVFRsaWM/1jTRmVaVLHat+KG0haXObM=; b=mkSUnQDP/HqCoc5cSEpGXY8hPhUI2okOVEteIs+M1UkK+kdmwnfLf4ijVB4xW6+KDW zjhIdeDsjm4uccmIo48gj/JViFIb5A8jRCNaDAAvQVnC6JCd1NNIpe281SYjBDV2V1R2 jUHidJ58kqs9q0KdLOf6cXkySTE6t0NMBnyaZvOfGlwIzjtgdFAlRGqtZdbvYErfbBzW H2iF7Co/EuTmBydHPRiq1xSWSporaHPJzjglaKtQWK6j36spMV9gQJapygSVLx8W/3DR U9Q907Puja608u/Xy29eJvbWKpMXOAWI21YGYw5tium7zSt4J5onReIHD7nYHkrHPgr8 0mpg== X-Gm-Message-State: APjAAAW3MKjIKDsbSCrjbmMkDD20+6KqqdTEsWYDFKGs7jhUbEghMzO7 wnurGF/V1OcHRgVtHOa6A5A= X-Google-Smtp-Source: APXvYqz4fkbLPQxYcZXgFFK4U7kI2lCstCrBXaq1TWOm3de6s15rtHEGSg5OSpbVcasgfxg9YW3E5A== X-Received: by 2002:a1c:ca0b:: with SMTP id a11mr4788910wmg.87.1567617211973; Wed, 04 Sep 2019 10:13:31 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:09 +0200 Message-Id: <20190904171315.8354-9-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 08/14] hw/arm/bcm2836: Make the SoC code modular X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This file creates the BCM2836/BCM2837 blocks. The biggest differences with the BCM2838 we are going to add, are the base addresses of the interrupt controller and the peripherals. Add these addresses in the BCM283XInfo structure to make this block more modular. Remove the MCORE_OFFSET offset as it is not useful and rather confusing. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse --- hw/arm/bcm2836.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 493a913f89..019e67b906 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -16,15 +16,11 @@ #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" -/* Peripheral base address seen by the CPU */ -#define BCM2836_PERI_BASE 0x3F000000 - -/* "QA7" (Pi2) interrupt controller and mailboxes etc. */ -#define BCM2836_CONTROL_BASE 0x40000000 - struct BCM283XInfo { const char *name; const char *cpu_type; + hwaddr peri_base; /* Peripheral base address seen by the CPU */ + hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ int clusterid; }; @@ -32,12 +28,16 @@ static const BCM283XInfo bcm283x_socs[] = { { .name = TYPE_BCM2836, .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"), + .peri_base = 0x3f000000, + .ctrl_base = 0x40000000, .clusterid = 0xf, }, #ifdef TARGET_AARCH64 { .name = TYPE_BCM2837, .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"), + .peri_base = 0x3f000000, + .ctrl_base = 0x40000000, .clusterid = 0x0, }, #endif @@ -104,7 +104,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) } sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, - BCM2836_PERI_BASE, 1); + info->peri_base, 1); /* bcm2836 interrupt controller (and mailboxes, etc.) */ object_property_set_bool(OBJECT(&s->control), true, "realized", &err); @@ -113,7 +113,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, BCM2836_CONTROL_BASE); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, info->ctrl_base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-irq", 0)); @@ -126,7 +126,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) /* set periphbase/CBAR value for CPU-local registers */ object_property_set_int(OBJECT(&s->cpus[n]), - BCM2836_PERI_BASE + MCORE_OFFSET, + info->peri_base, "reset-cbar", &err); if (err) { error_propagate(errp, err); From patchwork Wed Sep 4 17:13:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D13114E5 for ; Wed, 4 Sep 2019 17:24:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 33C2D2087E for ; Wed, 4 Sep 2019 17:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BjvILWiF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33C2D2087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z1U-0003fT-H5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:24:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48513) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqe-0001bJ-Im for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqc-00076a-Rd for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:36 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36702) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqc-00075x-KI; Wed, 04 Sep 2019 13:13:34 -0400 Received: by mail-wm1-x343.google.com with SMTP id p13so4718393wmh.1; Wed, 04 Sep 2019 10:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4gzUK0T14zOkKkQ8x5EXERw/Gf3VD/73/5zTDUcL1hE=; b=BjvILWiF4qLG6ydc7sXZV+b4ENFYfebY0bn/ATMruaE57xjZHcEy1doK+ktwFAzi4y OY3krr0DIOH8ohQnKj9WJ4OFFYu7QeXYP0Z+kRhCbY1JiUs16kd40YcfM8EFvhnLgXti EJKq9UMhxKEIs1phJyIRTsoqdfjiDwMLk/4ky+L59GmsGof3ZHLf7pawxmGwbjDF25a+ g1cL52h5CLnVz1p5DYMn49SEhVD1w5upXEFYhQgfVkUt3psHeTKj+nA2jH5FDTce7Nq+ zeq3pj+0z55kYnTyQBTQxFId6xYWRtVKVYrGqxXnopVkvYG/glSUwdwmhmwKO4vUWYeV S00A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4gzUK0T14zOkKkQ8x5EXERw/Gf3VD/73/5zTDUcL1hE=; b=du1T94+elOrqeVpkZllyL43EqtoMg98qm9+QPnSPsrCrMBs+pKDzuYF0EYpVCRwuEv V2ODIl1xiYHFFxW3gdhAQaw6QX93DC84DSuL4wtbm7OvdpEDwOX9wA0Sseu6++63ZSJj B2FJkdj2SvCdYGvtc8MSqm2tnv5tEymKzzxTscw+vBFYtdsrHE83BjUQ+0VMSXxBCdyM Etz4Rtl14eMYP0C1tGwx4IlmLcWBauAtNzJsQgvoTZcdCwcXCggDKwVpuTgdj+EsjqXZ ct5PQ91uCdDjJ9WECdIK1nGJW+r25SNH3oaWFwuSHA2AB4YJ8xNRJ4k2VXBalI4L21iL BEUg== X-Gm-Message-State: APjAAAUiorXQ1vBdJmOWvom8iTKEUrEqGOK+K0Bmach9QjCErw5nHQle 4/Gpdw4O+32esopjR+6Dy3w= X-Google-Smtp-Source: APXvYqxfU9TXdwhXvhUG78+dsMWEZ1MePNFEJRIKUMXfhMSHDpuurfJddriMoTQ7T1jEA/FEEzgHzw== X-Received: by 2002:a1c:6c11:: with SMTP id h17mr5120240wmc.128.1567617213584; Wed, 04 Sep 2019 10:13:33 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:10 +0200 Message-Id: <20190904171315.8354-10-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 09/14] hw/arm/raspi: Make the board code modular X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Our code currently create the raspi2 (based on the BCM2836) and the raspi3 (on the BCM2837). Similarly, the raspi4 is based on the BCM2838. To be able to add the new board, make the current code more modular: - Dynamically fills the 'board-rev' value - Allow DRAM sizes different than 1 GiB Rename the board model name as 'B' since this is the one encoded in the 'board-rev' tag. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 107 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 94 insertions(+), 13 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 615d755879..b4db39661f 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/cutils.h" #include "qapi/error.h" #include "cpu.h" #include "hw/arm/bcm2836.h" @@ -29,8 +30,67 @@ #define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ #define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */ -/* Table of Linux board IDs for different Pi versions */ -static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44}; +enum BoardIdManufacturer { + M_SONY_UK = 0, + M_EMBEST = 2, +}; + +enum BoardIdChip { + C_BCM2835 = 0, + C_BCM2836 = 1, + C_BCM2837 = 2, +}; + +enum BoardIdType { + T_2B = 0x04, + T_3B = 0x08, +}; + +enum BoardIdRevision { + R_1_0 = 0, + R_1_1 = 1, + R_1_2 = 2, + R_1_3 = 3, +}; + +static const char *processor_typename[] = { + [C_BCM2836] = TYPE_BCM2836, + [C_BCM2837] = TYPE_BCM2837, +}; + +typedef struct BoardInfo BoardInfo; + +struct BoardInfo { + /* Table of Linux board IDs for different Pi versions */ + int board_id; + /* + * Board revision codes: + * www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/ + */ + struct { + enum BoardIdType type; + enum BoardIdRevision revision; + enum BoardIdChip chip; + enum BoardIdManufacturer manufacturer; + } board_rev; + uint64_t ram_size_min; + uint64_t ram_size_max; +}; + +static const BoardInfo bcm283x_boards[] = { + [2] = { + .board_id = 0xc43, + .board_rev = { T_2B, R_1_1, C_BCM2836, M_EMBEST }, + .ram_size_min = 1 * GiB, + .ram_size_max = 1 * GiB, + }, + [3] = { + .board_id = 0xc44, + .board_rev = { T_3B, R_1_2, C_BCM2837, M_SONY_UK }, + .ram_size_min = 1 * GiB, + .ram_size_max = 1 * GiB, + }, +}; typedef struct RasPiState { BCM283XState soc; @@ -114,7 +174,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) static struct arm_boot_info binfo; int r; - binfo.board_id = raspi_boardid[version]; + binfo.board_id = bcm283x_boards[version].board_id; binfo.ram_size = ram_size; binfo.nb_cpus = machine->smp.cpus; @@ -146,7 +206,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) * the normal Linux boot process */ if (machine->firmware) { - hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2; + hwaddr firmware_addr = version >= 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2; /* load the firmware image (typically kernel.img) */ r = load_image_targphys(machine->firmware, firmware_addr, ram_size - firmware_addr); @@ -170,16 +230,32 @@ static void raspi_init(MachineState *machine, int version) BlockBackend *blk; BusState *bus; DeviceState *carddev; + char *size_str; + int board_rev; + const char *soc_type; - if (machine->ram_size > 1 * GiB) { + if (machine->ram_size < bcm283x_boards[version].ram_size_min) { + size_str = size_to_str(bcm283x_boards[version].ram_size_min); + error_report("Requested ram size is too small for this machine: " + "minimum is %s", size_str); + g_free(size_str); + exit(1); + } + if (machine->ram_size > bcm283x_boards[version].ram_size_max) { + size_str = size_to_str(bcm283x_boards[version].ram_size_max); error_report("Requested ram size is too large for this machine: " - "maximum is 1GB"); + "maximum is %s", size_str); + g_free(size_str); + exit(1); + } + if (!is_power_of_2(machine->ram_size)) { + error_report("Requested ram size is not a power of 2"); exit(1); } + soc_type = processor_typename[bcm283x_boards[version].board_rev.chip]; object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), - version == 3 ? TYPE_BCM2837 : TYPE_BCM2836, - &error_abort, NULL); + soc_type, &error_abort, NULL); /* Allocate and map RAM */ memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", @@ -192,9 +268,14 @@ static void raspi_init(MachineState *machine, int version) &error_abort); object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-cpus", &error_abort); - int board_rev = version == 3 ? 0xa02082 : 0xa21041; - object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", - &error_abort); + + board_rev = ((63 - clz64(machine->ram_size / MiB)) << 20) + | (bcm283x_boards[version].board_rev.manufacturer << 16) + | (bcm283x_boards[version].board_rev.chip << 12) + | (bcm283x_boards[version].board_rev.type << 4) + | (bcm283x_boards[version].board_rev.revision << 0); + object_property_set_int(OBJECT(&s->soc), board_rev, + "board-rev", &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort); /* Create and plug in the SD cards */ @@ -221,7 +302,7 @@ static void raspi2_init(MachineState *machine) static void raspi2_machine_init(MachineClass *mc) { - mc->desc = "Raspberry Pi 2"; + mc->desc = "Raspberry Pi 2B"; mc->init = raspi2_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; @@ -243,7 +324,7 @@ static void raspi3_init(MachineState *machine) static void raspi3_machine_init(MachineClass *mc) { - mc->desc = "Raspberry Pi 3"; + mc->desc = "Raspberry Pi 3B"; mc->init = raspi3_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; From patchwork Wed Sep 4 17:13:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7214A15E9 for ; Wed, 4 Sep 2019 17:28:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4835E2087E for ; Wed, 4 Sep 2019 17:28:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nXyUKui9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4835E2087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z4j-0007os-O0 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:28:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48537) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqg-0001dr-9I for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqe-00077a-Fj for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:38 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37481) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqe-000771-8P; Wed, 04 Sep 2019 13:13:36 -0400 Received: by mail-wr1-x444.google.com with SMTP id z11so22107793wrt.4; Wed, 04 Sep 2019 10:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rnPX/CkCbP5cUR+Jpf6ypoo9OA8ST+okjOPSeePlPKk=; b=nXyUKui9x9H0GwOqTGL8jqK3/3LURKyF4b8QwEoQ3mLJlf8zfaY6DrGlj8LXlCuRNH 4WYb1TX1NdW8pmcdvovw0iqDM7rwYcBQ+GlF3FDmpp/6WtzlINcIeozhrwL12QoeHnPn +Oxc+UubrO3NCVe8Q+lW1XMBwExJQUs5mpb+2i/PK4sibcQdzR6mUfb4HicRFhIA4QJY CQoVU1Jf4CwdZqiV8bi6hjCYGmhhrfopLkVK1mQSYIqoMIQqgNn1pGCbEC1dhHEJtuEP cEUVkwj7UwWUWozKCQo9Hr8r/hsRRwG9cuppjladKzq4upUaio3bzLRbki2ffwTxEg0Q RGVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=rnPX/CkCbP5cUR+Jpf6ypoo9OA8ST+okjOPSeePlPKk=; b=E57i7jaExaQ7BuB3/XXCUHft8IO5kGRK0Ahw++v5wRdu3B3nj2y1p6arH7snemgzNE YkV6GGqT7OpADo4v+8gpO0wfcaxaiMJGub/xTJcIuyZIPdDGZL5INYHwEB5LDJynUSq1 8DOgjnDyb3YKHmLlT/SO/bUPzgeIvGNfrRtgdswXrrtEH0XdKarsy63l+VOelg17IAxx m1sAKgnAsJ+I1hkLXHXuu/yxUBVKjF2uJhsJG5eev15cwEp0tqyIEuK+UHtnVrv3053I HZx6NAvQVcJavv3FcEPH8dmcSY+wSD/cUFP5vYhiq7q2mGmPbVVDcmASh2rhQvYZXyzL pbIA== X-Gm-Message-State: APjAAAWvbZxV2X8wApOIpMU+fItwUTNN94vdMKOfk6RsyIdXUe6W1III Q25dE2YbYPqMNe12VSpCaoA= X-Google-Smtp-Source: APXvYqwEi9l8a4GqD7gjT74ZnVq526YzVZkty7zA4ZxrLeR16ajKB9ENuB6xeSweJ4v4fz1ppxVgDg== X-Received: by 2002:a5d:460e:: with SMTP id t14mr51954710wrq.171.1567617215265; Wed, 04 Sep 2019 10:13:35 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:11 +0200 Message-Id: <20190904171315.8354-11-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH 10/14] hw/arm/raspi: Define various blocks base addresses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The Raspberry firmware is closed-source. While running it, it accesses various I/O registers. Logging these accesses as UNIMP (unimplemented) help to understand what the firmware is doing (ideally we want it able to boot a Linux kernel). Document various blocks we might use later. Adresses and names based on: https://github.com/hermanhermitage/videocoreiv/wiki/MMIO-Register-map Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/raspi_platform.h | 49 +++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index 069edab526..c6f4985522 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -25,42 +25,73 @@ #ifndef HW_ARM_RASPI_PLATFORM_H #define HW_ARM_RASPI_PLATFORM_H -#define MCORE_OFFSET 0x0000 /* Fake frame buffer device - * (the multicore sync block) */ -#define IC0_OFFSET 0x2000 +#define MSYNC_OFFSET 0x0000 /* Multicore Sync Block */ +#define CCPT_OFFSET 0x1000 /* Compact Camera Port 2 TX */ +#define INTE_OFFSET 0x2000 /* VC Interrupt controller */ #define ST_OFFSET 0x3000 /* System Timer */ +#define TXP_OFFSET 0x4000 +#define JPEG_OFFSET 0x5000 #define MPHI_OFFSET 0x6000 /* Message-based Parallel Host Intf. */ #define DMA_OFFSET 0x7000 /* DMA controller, channels 0-14 */ -#define ARM_OFFSET 0xB000 /* BCM2708 ARM control block */ +#define ARBA_OFFSET 0x9000 +#define BRDG_OFFSET 0xa000 +#define ARM_OFFSET 0xB000 /* ARM control block */ #define ARMCTRL_OFFSET (ARM_OFFSET + 0x000) #define ARMCTRL_IC_OFFSET (ARM_OFFSET + 0x200) /* Interrupt controller */ -#define ARMCTRL_TIMER0_1_OFFSET (ARM_OFFSET + 0x400) /* Timer 0 and 1 */ +#define ARMCTRL_TIMER0_1_OFFSET (ARM_OFFSET + 0x400) /* Timer 0 and 1 (SP804) */ #define ARMCTRL_0_SBM_OFFSET (ARM_OFFSET + 0x800) /* User 0 (ARM) Semaphores * Doorbells & Mailboxes */ #define PM_OFFSET 0x100000 /* Power Management, Reset controller * and Watchdog registers */ #define CPRMAN_OFFSET 0x101000 /* Clock Management */ +#define A2W_OFFSET 0x102000 #define AVS_OFFSET 0x103000 /* Audio Video Standard */ #define RNG_OFFSET 0x104000 #define GPIO_OFFSET 0x200000 -#define UART0_OFFSET 0x201000 -#define MMCI0_OFFSET 0x202000 -#define I2S_OFFSET 0x203000 -#define SPI0_OFFSET 0x204000 +#define UART0_OFFSET 0x201000 /* PL011 */ +#define MMCI0_OFFSET 0x202000 /* Legacy MMC */ +#define I2S_OFFSET 0x203000 /* PCM */ +#define SPI0_OFFSET 0x204000 /* SPI master */ #define BSC0_OFFSET 0x205000 /* BSC0 I2C/TWI */ +#define PIXV0_OFFSET 0x206000 +#define PIXV1_OFFSET 0x207000 +#define DPI_OFFSET 0x208000 +#define DSI0_OFFSET 0x209000 /* Display Serial Interface */ +#define PWM_OFFSET 0x20c000 +#define PERM_OFFSET 0x20d000 +#define TEC_OFFSET 0x20e000 #define OTP_OFFSET 0x20f000 +#define SLIM_OFFSET 0x100000 /* SLIMbus */ +#define CPG_OFFSET 0x110000 #define AVSP_OFFSET 0x130000 #define BSC_SL_OFFSET 0x214000 /* SPI slave */ +#define THERMAL_OFFSET 0x212000 #define AUX_OFFSET 0x215000 /* AUX: UART1/SPI1/SPI2 */ #define EMMC1_OFFSET 0x300000 +#define EMMC2_OFFSET 0x340000 +#define HVS_OFFSET 0x400000 #define SMI_OFFSET 0x600000 +#define DSI1_OFFSET 0x700000 +#define UCAM_OFFSET 0x800000 +#define CMI_OFFSET 0x802000 #define BSC1_OFFSET 0x804000 /* BSC1 I2C/TWI */ #define BSC2_OFFSET 0x805000 /* BSC2 I2C/TWI */ +#define VECA_OFFSET 0x806000 +#define PIXV2_OFFSET 0x807000 +#define HDMI_OFFSET 0x808000 +#define HDCP_OFFSET 0x809000 +#define ARBR0_OFFSET 0x80a000 #define DBUS_OFFSET 0x900000 #define AVE0_OFFSET 0x910000 #define USB_OTG_OFFSET 0x980000 /* DTC_OTG USB controller */ +#define V3D_OFFSET 0xc00000 #define SDRAMC_OFFSET 0xe00000 +#define L2CC_OFFSET 0xe01000 /* Level 2 Cache controller */ +#define L1CC_OFFSET 0xe02000 /* Level 1 Cache controller */ +#define ARBR1_OFFSET 0xe04000 #define DMA15_OFFSET 0xE05000 /* DMA controller, channel 15 */ +#define DCRC_OFFSET 0xe07000 +#define AXIP_OFFSET 0xe08000 /* GPU interrupts */ #define INTERRUPT_TIMER0 0 From patchwork Wed Sep 4 17:13:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AC7414E5 for ; Wed, 4 Sep 2019 17:28:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 025C521883 for ; Wed, 4 Sep 2019 17:28:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tf+OuKsy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 025C521883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z4h-0007mC-9z for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:28:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48568) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqi-0001gu-MK for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqg-00078Z-6o for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:40 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqf-00078D-Ue; Wed, 04 Sep 2019 13:13:38 -0400 Received: by mail-wm1-x342.google.com with SMTP id k2so4122546wmj.4; Wed, 04 Sep 2019 10:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NE6SSY/l1bK6cwQa5Wl0c6DT5cjmpSFoKjbT7RMOdm4=; b=tf+OuKsye8v2L5UnAN3fHr9YkveMzJ6mLlvXQ2pCwp4wh14jbwJ0jf9Hk/JpTEcQb+ L6KiTFqhg/HS82Jf6wQqK2pDKhAsXFb48k85HubQWf/WIG2qRwH03piaU/BpUQHBD0nj l+6RjDP59uAqrgZlOvT95F0Vs30c8FVWGD8HOOM0bIgB/7ByGnHnSFwxX3F+u/mtnDyd +zIJWaR4AKQ34bksY0xVEMFt4Z51UuvBonpS2BQGre1oAmZvd9+LSiv6AFGy5M8LZOVt biuP2QufVrfB3Z8jMwG28EAiSTTo4bzCEHoKr4mqZ3IGF4jR5OjWYyJwckNnb4PqIwUX BzqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NE6SSY/l1bK6cwQa5Wl0c6DT5cjmpSFoKjbT7RMOdm4=; b=n56k98BerMwwtwuH2nOoq/NO/PjKqvZt8ra2hHVbCmO4U6rOb9Ev6RSBYRzsPLycIg l3eFiEVOUtBZh4HZ+sfM++zBA9d6reHm+BmJpaGLFYBbjGtfuriKUMph3OVmECe0nuiV ShCNGtznzapKNxhpAXVFoHZGydlvQF2n8s/Ax5l/IzPRKEMw8Kv4ny/iGBdZnRAfePU2 uB065oPSSOt2g8CEc6t74xUWollxeRWvjGAnpql9hJtx8K6ygPC5COkmqOfY/j0ReReg nzske1Fw+4hXS0em/Nb0B3Z098VKhMC2+n5YcnQJeFR83JOGreQspdif2m1YjFPuILJn ZcTw== X-Gm-Message-State: APjAAAWoIjLpSoA0lFfPU7yU8Wf3J+fjJOw42+lIhUUixTGztwYIsgAw whqUIqegfldXNydrveKyNLU= X-Google-Smtp-Source: APXvYqwFSYsbttIU/tjb8ffAIt6AAQPx79wbQz0OpkDyMItRt/JcBjQCC2gXebQVlqQVyD9ZkP2Kzw== X-Received: by 2002:a1c:a003:: with SMTP id j3mr5284778wme.42.1567617216983; Wed, 04 Sep 2019 10:13:36 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:12 +0200 Message-Id: <20190904171315.8354-12-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 11/14] hw/arm/bcm2835_peripherals: Map various BCM2838 blocks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The BCM2838 provides more peripherals. Add them as 'unimplemented' so we can track when/how firmware and kernel access them. Based on various sources: * U-boot: https://github.com/raspberrypi/firmware/tree/next/boot - arch/arm/dts/bcm283x.dtsi - arch/arm/dts/bcm2838.dtsi - arch/arm/dts/bcm2838-rpi-4-b.dts * Arnd Bergmann analysis: https://www.cnx-software.com/2019/06/24/raspberry-pi-4-features-broadcom-bcm2711-processor-up-to-4gb-ram/#comment-563948 * Linux: https://patchwork.kernel.org/patch/11053097/ - arch/arm/boot/dts/bcm283x.dtsi - arch/arm/boot/dts/bcm283x-rpi-usb-peripheral.dtsi - arch/arm/boot/dts/bcm2711.dtsi - arch/arm/boot/dts/bcm2711-rpi-4-b.dts Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse --- TODO: At least use proper pl011[2] and pl011[3] --- hw/arm/bcm2835_peripherals.c | 23 +++++++++++++++++++---- include/hw/arm/bcm2835_peripherals.h | 8 ++++++-- include/hw/arm/raspi_platform.h | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index be6270b8ef..72287d5921 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -342,15 +342,30 @@ static void bcm2835_peripherals_realize(DeviceState *dev, Error **errp) create_unimp(s, &s->a2w, "bcm2835-a2w", 0x102000, 0x1000); create_unimp(s, &s->i2s, "bcm2835-i2s", I2S_OFFSET, 0x100); create_unimp(s, &s->smi, "bcm2835-smi", SMI_OFFSET, 0x100); - create_unimp(s, &s->spi0, "bcm2835-spi0", SPI0_OFFSET, 0x20); + create_unimp(s, &s->uartu[2], "!pl011[2]", UART2_OFFSET, 0x100); + create_unimp(s, &s->uartu[3], "!pl011[3]", UART3_OFFSET, 0x100); + create_unimp(s, &s->uartu[4], "!pl011[4]", UART4_OFFSET, 0x100); + create_unimp(s, &s->uartu[5], "!pl011[5]", UART5_OFFSET, 0x100); + create_unimp(s, &s->spi[0], "bcm2835-spi[0]", SPI0_OFFSET, 0x20); + create_unimp(s, &s->spi[3], "bcm2835-spi[3]", SPI3_OFFSET, 0x20); + create_unimp(s, &s->spi[4], "bcm2835-spi[4]", SPI4_OFFSET, 0x20); + create_unimp(s, &s->spi[5], "bcm2835-spi[5]", SPI5_OFFSET, 0x20); + create_unimp(s, &s->spi[6], "bcm2835-spi[6]", SPI6_OFFSET, 0x20); create_unimp(s, &s->bscsl, "bcm2835-spis", BSC_SL_OFFSET, 0x100); - create_unimp(s, &s->i2c[0], "bcm2835-i2c0", BSC0_OFFSET, 0x20); - create_unimp(s, &s->i2c[1], "bcm2835-i2c1", BSC1_OFFSET, 0x20); - create_unimp(s, &s->i2c[2], "bcm2835-i2c2", BSC2_OFFSET, 0x20); + create_unimp(s, &s->i2c[0], "bcm2835-i2c[0]", BSC0_OFFSET, 0x20); + create_unimp(s, &s->i2c[1], "bcm2835-i2c[1]", BSC1_OFFSET, 0x20); + create_unimp(s, &s->i2c[2], "bcm2835-i2c[2]", BSC2_OFFSET, 0x20); + create_unimp(s, &s->i2c[3], "bcm2835-i2c[3]", BSC3_OFFSET, 0x20); + create_unimp(s, &s->i2c[4], "bcm2835-i2c[4]", BSC4_OFFSET, 0x20); + create_unimp(s, &s->i2c[5], "bcm2835-i2c[5]", BSC5_OFFSET, 0x20); + create_unimp(s, &s->i2c[6], "bcm2835-i2c[6]", BSC6_OFFSET, 0x20); create_unimp(s, &s->otp, "bcm2835-otp", OTP_OFFSET, 0x80); create_unimp(s, &s->dbus, "bcm2835-dbus", DBUS_OFFSET, 0x8000); create_unimp(s, &s->ave0, "bcm2835-ave0", AVE0_OFFSET, 0x8000); create_unimp(s, &s->dwc2, "dwc-usb2", USB_OTG_OFFSET, 0x100); + create_unimp(s, &s->xhci, "bcm2838-xhci", USB_XHCI_OFFSET, 0x100000); + create_unimp(s, &s->argon, "bcm2838-argon", ARGON_OFFSET, 4 * 0x10000); + create_unimp(s, &s->v3d, "bcm2835-v3d", V3D_OFFSET, 0x10000); create_unimp(s, &s->sdramc, "bcm2835-sdramc", SDRAMC_OFFSET, 0x100); } diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h index 44a182b399..2e5f243b39 100644 --- a/include/hw/arm/bcm2835_peripherals.h +++ b/include/hw/arm/bcm2835_peripherals.h @@ -42,6 +42,7 @@ typedef struct BCM2835PeripheralState { UnimplementedDeviceState cprman; UnimplementedDeviceState a2w; PL011State uart0; + UnimplementedDeviceState uartu[6]; BCM2835AuxState aux; BCM2835FBState fb; BCM2835DMAState dma; @@ -53,14 +54,17 @@ typedef struct BCM2835PeripheralState { BCM2835SDHostState sdhost; BCM2835GpioState gpio; UnimplementedDeviceState i2s; - UnimplementedDeviceState spi0; - UnimplementedDeviceState i2c[3]; + UnimplementedDeviceState spi[7]; + UnimplementedDeviceState i2c[7]; UnimplementedDeviceState otp; UnimplementedDeviceState dbus; UnimplementedDeviceState ave0; UnimplementedDeviceState bscsl; UnimplementedDeviceState smi; UnimplementedDeviceState dwc2; + UnimplementedDeviceState xhci; + UnimplementedDeviceState argon; + UnimplementedDeviceState v3d; UnimplementedDeviceState sdramc; } BCM2835PeripheralState; diff --git a/include/hw/arm/raspi_platform.h b/include/hw/arm/raspi_platform.h index c6f4985522..0ea547669f 100644 --- a/include/hw/arm/raspi_platform.h +++ b/include/hw/arm/raspi_platform.h @@ -49,10 +49,22 @@ #define RNG_OFFSET 0x104000 #define GPIO_OFFSET 0x200000 #define UART0_OFFSET 0x201000 /* PL011 */ +#define UART2_OFFSET 0x201400 /* PL011 */ +#define UART3_OFFSET 0x201600 /* PL011 */ +#define UART4_OFFSET 0x201800 /* PL011 */ +#define UART5_OFFSET 0x201a00 /* PL011 */ #define MMCI0_OFFSET 0x202000 /* Legacy MMC */ #define I2S_OFFSET 0x203000 /* PCM */ #define SPI0_OFFSET 0x204000 /* SPI master */ +#define SPI3_OFFSET 0x204600 +#define SPI4_OFFSET 0x204800 +#define SPI5_OFFSET 0x204a00 +#define SPI6_OFFSET 0x204c00 #define BSC0_OFFSET 0x205000 /* BSC0 I2C/TWI */ +#define BSC3_OFFSET 0x205600 +#define BSC4_OFFSET 0x205800 +#define BSC5_OFFSET 0x205a00 +#define BSC6_OFFSET 0x205c00 #define PIXV0_OFFSET 0x206000 #define PIXV1_OFFSET 0x207000 #define DPI_OFFSET 0x208000 @@ -84,6 +96,8 @@ #define DBUS_OFFSET 0x900000 #define AVE0_OFFSET 0x910000 #define USB_OTG_OFFSET 0x980000 /* DTC_OTG USB controller */ +#define USB_XHCI_OFFSET 0x9c0000 /* generic-xhci controller */ +#define ARGON_OFFSET 0xb00000 #define V3D_OFFSET 0xc00000 #define SDRAMC_OFFSET 0xe00000 #define L2CC_OFFSET 0xe01000 /* Level 2 Cache controller */ From patchwork Wed Sep 4 17:13:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B6BF1399 for ; Wed, 4 Sep 2019 17:31:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 721FD2087E for ; Wed, 4 Sep 2019 17:31:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nwAHdrV/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 721FD2087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z8L-0002wX-Cn for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48597) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yql-0001jJ-4v for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqi-00079o-Gw for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:42 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37646) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqi-00079F-61; Wed, 04 Sep 2019 13:13:40 -0400 Received: by mail-wm1-x343.google.com with SMTP id r195so4718355wme.2; Wed, 04 Sep 2019 10:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ykU8gHuJpolHJspGCXGN29S68B/lyOH0ZSECMmtfWFc=; b=nwAHdrV/F312+N2AYbJx6mKzV27iers+camiq0oFZq6n1KozJ0fJanVtuGG9z4OBcV KcR/IZI5QcRUTDBGpR0ismGy1gPDFidpNqFvlLFyytxpDBN9MN6t20RfZ0k4yqeEmALE S1WJzlcRsPddON2EjlvO+YOLjsoB3Py27ok8CqYJ2mYJzXG0oSzveTHEamoTlfjRQ+24 GC4J7DbIudF4F7FpFo0/8+csN6uOTUQuEhD0Hdy3myG0VAM21fm/iMCpNEFlZxarylY9 bFT7SzqNdJv6USHZWWawIjCbfW72d4VcuT7CxaP+f0pa/+m6idqMuoBluSU4vswRJr37 iOzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ykU8gHuJpolHJspGCXGN29S68B/lyOH0ZSECMmtfWFc=; b=SPBR01v9AzQTqbbkyWPHbkOh66OXXZ+tpr/Z3ZTAvD9YF5pIHvuWCLZ60aVcUqsQJj wkZ+G34MQdYa5FUMUqCnmLs+G5zOH8Gj3wn0LjFaLKq+SltUq4/b7E0esALNcNql6bMw k/43DSpJv55z6GpMEt3/ibDZ3jd/BqK1HcrWlSQchpfKQzbknw+Q7eQFyN451QPCtK9S 5zfYgnIi5TmCkb0FT6hbNumoyu877SuGKu+RRtZPareg1M5f9gyHAWZyovDk0Ika5XZ7 pMDog/nY5ZUiXOhUgwhqN7OOwhp9UBK5WVXcNO0MkiZ9eTdN0SrZ9fm1plrdV0S6dsuf IUsw== X-Gm-Message-State: APjAAAXhwo12l29Xw9pfV4eatzyuV08HZs+GejLxAiiMaSZOC2XX8L8T 1n6JIELekhhPHL59zCOY0sQ= X-Google-Smtp-Source: APXvYqz2YZDBItjO+3mfovnvKCHf5ru/BZACfoT6KRQKNbNg1WcF3u4wgMfDz8uRkX2MtTpc0t7KBA== X-Received: by 2002:a1c:b745:: with SMTP id h66mr5243020wmf.70.1567617219090; Wed, 04 Sep 2019 10:13:39 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:13 +0200 Message-Id: <20190904171315.8354-13-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [RFC PATCH 12/14] hw/arm/bcm2836: Add the BCM2838 which uses a GICv2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The BCM2838 is improvement of the BCM2837: - Cortex-A72 instead of the A53 - peripheral block and local soc controller are mapped differently, - GICv2 - PCIe block - exhanced MMU to address over 4GiB of SDRAM See https://www.raspberrypi.org/forums/viewtopic.php?t=244479&start=25 and https://patchwork.kernel.org/patch/11053097/ This patch starts mapping the GICv2 but interrupt lines are NOT wired (yet). This is enough to start running the Ubuntu kernel8.img from [1]. Extract the kernel with: $ mkdir bootpart $ guestfish \ --ro \ -a ubuntu-18.04.3-preinstalled-server-arm64+raspi4.img \ -m /dev/sda1 Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. > ls / COPYING.linux LICENCE.broadcom System.map armstub8-gic.bin bcm2710-rpi-3-b-plus.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb bcm2837-rpi-3-b-plus.dtb bcm2837-rpi-3-b.dtb cmdline.txt config.txt fixup4.dat fixup4cd.dat fixup4db.dat fixup4x.dat kernel8.img overlays start4.elf start4cd.elf start4db.elf start4x.elf > copy-out / bootpart/ > q Then some progress can be noticed running: $ qemu-system-aarch64 -d unimp,guest_errors,int,in_asm \ -M raspi4 \ -kernel bootpart/kernel8.img \ -dtb bootpart/bcm2711-rpi-4-b.dtb \ -initrd bootpart/boot/initrd.img \ -append \ "earlycon=pl011,0xfe201000 console=ttyAMA0 console=tty1 loglevel=8" Not very interesting, but it runs until configuring the GIC. (remove 'in_asm' if too verbose). TODO: - wire IRQs to the GIC :) - map the SPI bootrom from [3] (boot sequence: [4]) - per [2] we could try booting without using the GIC, adding "enable_gic=0" in config.txt. this variable is parsed by the firmware: $ fgrep -r enable_gic bootpart Binary file bootpart/start4x.elf matches Binary file bootpart/start4.elf matches Binary file bootpart/start4db.elf matches Binary file bootpart/start4cd.elf matches bootpart/config.txt:enable_gic=1 the stub [5] doesn't seem to check a register for it. maybe it falls back to kernel7l? - decompile start4.elf to check how 'enable_gic' is used using vc4 toolchain from [6] [1] https://github.com/TheRemote/Ubuntu-Server-raspi4-unofficial/releases [2] https://jamesachambers.com/raspberry-pi-ubuntu-server-18-04-2-installation-guide/ [3] https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md [4] https://raspberrypi.stackexchange.com/questions/10442/what-is-the-boot-sequence [5] https://github.com/raspberrypi/tools/commit/7f4a937e1bacbc111a22552169bc890b4bb26a94#diff-8c41083e9fa0c98f1c3015e11b897444 [6] https://github.com/christinaa/rpi-open-firmware Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/bcm2836.c | 75 ++++++++++++++++++++++++++++++++++++++++ include/hw/arm/bcm2836.h | 3 ++ 2 files changed, 78 insertions(+) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 019e67b906..d89d7cd71d 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -21,6 +21,7 @@ struct BCM283XInfo { const char *cpu_type; hwaddr peri_base; /* Peripheral base address seen by the CPU */ hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ + hwaddr gic_base; int clusterid; }; @@ -40,9 +41,25 @@ static const BCM283XInfo bcm283x_socs[] = { .ctrl_base = 0x40000000, .clusterid = 0x0, }, + { + .name = TYPE_BCM2838, + .cpu_type = ARM_CPU_TYPE_NAME("cortex-a72"), + .peri_base = 0xfe000000, + .ctrl_base = 0xff800000, + .gic_base = 0x40000, + }, #endif }; +#define GIC_NUM_IRQS 256 + +#define GIC_BASE_OFS 0x0000 +#define GIC_DIST_OFS 0x1000 +#define GIC_CPU_OFS 0x2000 +#define GIC_VIFACE_THIS_OFS 0x4000 +#define GIC_VIFACE_OTHER_OFS(cpu) (0x5000 + (cpu) * 0x200) +#define GIC_VCPU_OFS 0x6000 + static void bcm2836_init(Object *obj) { BCM283XState *s = BCM283X(obj); @@ -55,6 +72,11 @@ static void bcm2836_init(Object *obj) info->cpu_type, &error_abort, NULL); } + if (info->gic_base) { + sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), + TYPE_ARM_GIC); + } + sysbus_init_child_obj(obj, "control", &s->control, sizeof(s->control), TYPE_BCM2836_CONTROL); @@ -115,6 +137,59 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, info->ctrl_base); + /* bcm2838 GICv2 */ + if (info->gic_base) { + object_property_set_uint(OBJECT(&s->gic), 2, "revision", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_uint(OBJECT(&s->gic), + BCM283X_NCPUS, "num-cpu", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_uint(OBJECT(&s->gic), + 32 + GIC_NUM_IRQS, "num-irq", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->gic), + true, "has-virtualization-extensions", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->gic), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0, + info->ctrl_base + info->gic_base + GIC_DIST_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, + info->ctrl_base + info->gic_base + GIC_CPU_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 2, + info->ctrl_base + info->gic_base + GIC_VIFACE_THIS_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 3, + info->ctrl_base + info->gic_base + GIC_VCPU_OFS); + + for (n = 0; n < BCM283X_NCPUS; n++) { + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 4 + n, + info->ctrl_base + info->gic_base + + GIC_VIFACE_OTHER_OFS(n)); + } + + /* TODO wire IRQs!!! */ + } + sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-irq", 0)); sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 97187f72be..31c8fb90bd 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -13,6 +13,7 @@ #include "hw/arm/bcm2835_peripherals.h" #include "hw/intc/bcm2836_control.h" +#include "hw/intc/arm_gic.h" #include "target/arm/cpu.h" #define TYPE_BCM283X "bcm283x" @@ -26,6 +27,7 @@ */ #define TYPE_BCM2836 "bcm2836" #define TYPE_BCM2837 "bcm2837" +#define TYPE_BCM2838 "bcm2838" typedef struct BCM283XState { /*< private >*/ @@ -36,6 +38,7 @@ typedef struct BCM283XState { uint32_t enabled_cpus; ARMCPU cpus[BCM283X_NCPUS]; + GICState gic; BCM2836ControlState control; BCM2835PeripheralState peripherals; } BCM283XState; From patchwork Wed Sep 4 17:13:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46F7715E9 for ; Wed, 4 Sep 2019 17:24:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1CC502087E for ; Wed, 4 Sep 2019 17:24:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pDrdlb2r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CC502087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z1B-0003Dz-NM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:24:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48608) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yql-0001jg-SE for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yqk-0007AW-Jw for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:43 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yqj-0007A1-MG; Wed, 04 Sep 2019 13:13:41 -0400 Received: by mail-wm1-x344.google.com with SMTP id k1so4154652wmi.1; Wed, 04 Sep 2019 10:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fquUmVkncxEMfeAsRc3/6BsqyJ3/ccTKHRFzefWvbc4=; b=pDrdlb2rH6HXIVh5RptUMn3al7DtlWvRcvKpBaPq53spQUKpEKQ8tu2amFuF36KcB1 m0xhE9u/BWG35kTr/duYfN+6ZpnvRO3m8IqMnljYOymenAdTX22gVSG3Y5HVn4hx+wuN 4TY4rPvOUVTYpQV5MliBprE8tdGbsVkF67cHWQ6/dPredUf+NkOePIQ1iGd6dGT0e4lD IlRtNNsbGvFz9SAxxV/YyURoh7b0iNsTslvE5mVaAkOxu5TUGJxHSVLFTSvvS4W+ta/M WF74ijiw1jQpfVBvvERdwQZ7WKDth9Sf5SbO3O63n0PgA8mHsGBUEZR78lpgPnRCADw0 1Lig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fquUmVkncxEMfeAsRc3/6BsqyJ3/ccTKHRFzefWvbc4=; b=DdaWThf8lTQCei+iygxqZAK+wqD+WHjl+5xdahGNFuSBCHB6Jfnyn2HVliB5s7GPAR EEZLXQmbJvftXYKkm7Uu0x9GJPPEeJ4XYjG7Dcy+N6KyKQ+xUWnJ5LuNAxMSmjeVMBA8 87um/BbMVmgNNknJLfIb6AIabNRmGoYBQqJYl9IcGCl00h8atg3567GJuf5656vFBroK msFmro1JJfw0oBxesYz0DqgfPG/WDiNv/r6wBSb/TPOXkFjrp7tpm2vlAGCqBEYcRZA1 xchYn01mUR5ro8BnZpwwQTmsyivBKkBe365EVESQjEOHnjFAamPMkpA8yYXED7t6OVJh NVkQ== X-Gm-Message-State: APjAAAU9N8u+YqbMXv5ceFAR3Rb+/uGFx3VDLWc76z2Qs68O7m0SorAF hyIiJiQ1kGuh157sXqkaDsQ= X-Google-Smtp-Source: APXvYqwU6MyaKzsoxz9MLfPE23lpSKADVPHZtTUJSSKe27uUWigfDMQ8nQcAcb3dE6u8zcLk6l3bug== X-Received: by 2002:a7b:cb93:: with SMTP id m19mr224180wmi.157.1567617220721; Wed, 04 Sep 2019 10:13:40 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:14 +0200 Message-Id: <20190904171315.8354-14-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [RFC PATCH 13/14] hw/arm/bcm2838: Map the PCIe memory space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The BCM2711 has a BCM54213 Gigabit Ethernet block mapped in the PCIe range. Signed-off-by: Philippe Mathieu-Daudé --- FIXME: create the bcm54213-geth in raspi.c? --- hw/arm/bcm2836.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index d89d7cd71d..39190a108f 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -15,6 +15,7 @@ #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" +#include "hw/misc/unimp.h" struct BCM283XInfo { const char *name; @@ -60,6 +61,8 @@ static const BCM283XInfo bcm283x_socs[] = { #define GIC_VIFACE_OTHER_OFS(cpu) (0x5000 + (cpu) * 0x200) #define GIC_VCPU_OFS 0x6000 +#define PCIE_BASE 0x7d500000 + static void bcm2836_init(Object *obj) { BCM283XState *s = BCM283X(obj); @@ -238,6 +241,13 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) qdev_connect_gpio_out(DEVICE(&s->cpus[n]), GTIMER_SEC, qdev_get_gpio_in_named(DEVICE(&s->control), "cntpsirq", n)); } + + /* bcm2838 kludge to easily create PCIe */ + if (info->gic_base) { + create_unimplemented_device("bcm2838-pcie", PCIE_BASE, 0x100000); + create_unimplemented_device("bcm54213-geth", + PCIE_BASE + 0x80000, 0x10000); + } } static Property bcm2836_props[] = { From patchwork Wed Sep 4 17:13:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11131145 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAF3D14E5 for ; Wed, 4 Sep 2019 17:24:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B22092087E for ; Wed, 4 Sep 2019 17:24:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dGyo3sSR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B22092087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Z1F-0003Ij-9A for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 Sep 2019 13:24:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48631) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5Yqo-0001lf-0N for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5Yql-0007BO-Rz for qemu-devel@nongnu.org; Wed, 04 Sep 2019 13:13:45 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54461) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5Yql-0007Am-EV; Wed, 04 Sep 2019 13:13:43 -0400 Received: by mail-wm1-x344.google.com with SMTP id k2so4122799wmj.4; Wed, 04 Sep 2019 10:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S7qhLshgv8PC8yoBGkMqEzXE2knLg4gMrxiA4d+K3Q4=; b=dGyo3sSR6uVtDir2QlRv6W4C/7BKr7vf0E/P/R5Hn4SRjQZ1GWlLhy9QRhIhMzIUZB izQwPHqe+gcqBElAT5hxOlkorLat4II+sM5Gh0Vgcu2WUwky+JK1gDzDXCLmRPi7leeA zcynqY2BObh8zN1IKSa7NxVtUknIf81gMd2K9qwTB8IQUjBNsYE23LWiK4NDIsTDYBVB IoIr2Ws3dF5KsI2S3Une0Go/ZPahwWsg1yq42Ynr3NqqVntsbWc4qyHNCmGhxZIurVDi z9q2sDDDyRy74iMnvVV9x5N7kZdQ+S/5nD8LnbzewYdgV0yKxp9Gmu1MHr3+unbqx6op 38hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=S7qhLshgv8PC8yoBGkMqEzXE2knLg4gMrxiA4d+K3Q4=; b=bvDCGagMDdahgpiONJdAS5PT7BwwNXDY8xi/tQNkGg10nMZvyCINMNjgrL+MUJO7Sj OEt2+RQ+7TN6YErPKphl9ZnzmiG8Y8ActoSeMIbi+0KiaRcCvHXtsfxq/66rmlNd3CV2 RqTP+IFxj6NTzPDOz3ySp9W1hNRd1AGgZbvx3nuvBuH9ZrvPgUEHuQkGUKHHbGQxgNjj Ec9jUFPuMNZJl5mh6f1vgZMmNil9v5V2hpviDv1cyFo6Ry4YvZNgszyXp+h9FTtv1mAG WfiJRhQlsgxJHTLzUBMlVVwvDDDyh4xT0mRr+U7b6ejDfwF3e2V383JgIFvekqFDzs9J mqOQ== X-Gm-Message-State: APjAAAWxNRhWS5JdMmJft1707mIHtkc9xslysXTAGv/2qSaxXQhsyiG9 UrlUqAUpsfQt7TZMN8Xlfi4= X-Google-Smtp-Source: APXvYqwb+qEXd9UBIbhWFdBp7a2PntQMMVxI+YBAKS6LSrEv/iCIhobmuvObBkPJ5JNlXx4E0J5IRg== X-Received: by 2002:a1c:4b11:: with SMTP id y17mr5254736wma.2.1567617222530; Wed, 04 Sep 2019 10:13:42 -0700 (PDT) Received: from x1w.redhat.com ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id p19sm2339512wmg.31.2019.09.04.10.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 10:13:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Peter Maydell , Esteban Bosse , Andrew Baumann , qemu-devel@nongnu.org, Pekka Enberg , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= Date: Wed, 4 Sep 2019 19:13:15 +0200 Message-Id: <20190904171315.8354-15-f4bug@amsat.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904171315.8354-1-f4bug@amsat.org> References: <20190904171315.8354-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [RFC PATCH 14/14] hw/arm/raspi: Add the Raspberry Pi 4B board X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Clement Deschamps , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The Raspberry Pi 4 uses a BCM2711 SoC (based on a BCM2838). The SoC can handle up to 8GiB of SDRAM, but we limit it to 4GiB (no 8GiB models in the market yet). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Esteban Bosse Reviewed-by: Esteban Bosse --- hw/arm/raspi.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index b4db39661f..59ee2f82b4 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -39,11 +39,13 @@ enum BoardIdChip { C_BCM2835 = 0, C_BCM2836 = 1, C_BCM2837 = 2, + C_BCM2711 = 3, }; enum BoardIdType { T_2B = 0x04, T_3B = 0x08, + T_4B = 0x11, }; enum BoardIdRevision { @@ -56,6 +58,7 @@ enum BoardIdRevision { static const char *processor_typename[] = { [C_BCM2836] = TYPE_BCM2836, [C_BCM2837] = TYPE_BCM2837, + [C_BCM2711] = TYPE_BCM2838, }; typedef struct BoardInfo BoardInfo; @@ -90,6 +93,12 @@ static const BoardInfo bcm283x_boards[] = { .ram_size_min = 1 * GiB, .ram_size_max = 1 * GiB, }, + [4] = { + .board_id = 0xc42, + .board_rev = { T_4B, R_1_1, C_BCM2711, M_SONY_UK }, + .ram_size_min = 1 * GiB, + .ram_size_max = 4 * GiB, + }, }; typedef struct RasPiState { @@ -336,4 +345,24 @@ static void raspi3_machine_init(MachineClass *mc) mc->default_ram_size = 1 * GiB; } DEFINE_MACHINE("raspi3", raspi3_machine_init) -#endif + +static void raspi4_init(MachineState *machine) +{ + raspi_init(machine, 4); +} + +static void raspi4_machine_init(MachineClass *mc) +{ + mc->desc = "Raspberry Pi 4B"; + mc->init = raspi4_init; + mc->block_default_type = IF_SD; + mc->no_parallel = 1; + mc->no_floppy = 1; + mc->no_cdrom = 1; + mc->max_cpus = BCM283X_NCPUS; + mc->min_cpus = BCM283X_NCPUS; + mc->default_cpus = BCM283X_NCPUS; + mc->default_ram_size = 1 * GiB; +} +DEFINE_MACHINE("raspi4", raspi4_machine_init) +#endif /* TARGET_AARCH64 */