From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350163; cv=none; d=zohomail.com; s=zohoarc; b=NgCMNBcXUDGVgDB7CkW1j/3uyRSkW7aotp5KzZTBHuqsmwK9cP55+QWT509llSuWZ72V2k4xNYHcuKzXk8uRaJ5juCYLcoC4K07G0EuWKSfhvp7J7QvFznEAvEVPz90KSyVErNXkzNE4NTzzkkXNoc2SWWkc13G3B2croG6G3hA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350163; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aGFz00sOMUVuWd2OQ1tTLKSKBb3ZvhqhnSttbL2LqJc=; b=NjrfOMFmDEzD8NJ/KDRHX9zcZCOThWJUxzo+CZa4m4WNpNc0Ab8atFZxOy6cg9cIDQtYA6cTqMl3P7QOXQ2ANnPSUWNTeEFDD6vpLGQfFSsdkfpr1PeCY04uCknHIDkcF6G+fOfs/lz5nzYuh22YMa3la6eKnntZM/wLcWLrF0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350163131844.3363304137386; Fri, 14 Jun 2024 00:29:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1LO-00039w-LB; Fri, 14 Jun 2024 03:27:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LN-00039f-GD for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LL-0000jp-T8 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:29 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-07hMO7kWOwSXBowTwymhZA-1; Fri, 14 Jun 2024 03:27:21 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C02AA19560B8; Fri, 14 Jun 2024 07:27:19 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C08FE300021A; Fri, 14 Jun 2024 07:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aGFz00sOMUVuWd2OQ1tTLKSKBb3ZvhqhnSttbL2LqJc=; b=DyldFP4qTJ8KLm5fxnYGmm1MFvEN4R6d5Dgl8WAVu6IQ54qLkaLjVYRLSk/fkhIW0IRibQ N6/qSkZS4DdG2VJLNy3Nd87QM83IlXgMSNMjmzVJUJ0UIlvr+6LYrCUlYjlbenQ+JSYEOf hOe8O5d3ybQcq5Bgn+vwkD8sbHSogy8= X-MC-Unique: 07hMO7kWOwSXBowTwymhZA-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PULL 01/19] aspeed/smc: Reintroduce "dram-base" property for AST2700 Date: Fri, 14 Jun 2024 09:26:02 +0200 Message-ID: <20240614072620.1262053-2-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350164353100002 The Aspeed SMC device model use to have a 'sdram_base' property. It was removed by commit d177892d4a48 ("aspeed/smc: Remove unused "sdram-base" property") because previous changes simplified the DMA transaction model to use an offset in RAM and not the physical address. The AST2700 SoC has larger address space (64-bit) and a new register DMA DRAM Side Address High Part (0x7C) is introduced to deal with the high bits of the DMA address. To be able to compute the offset of the DMA transaction, as done on the other SoCs, we will need to know where the DRAM is mapped in the address space. Re-introduce a "dram-base" property to hold this value. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Jamin Lin Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index 8e1dda556b91..8791cc0ecb11 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -76,6 +76,7 @@ struct AspeedSMCState { AddressSpace flash_as; MemoryRegion *dram_mr; AddressSpace dram_as; + uint64_t dram_base; =20 AspeedSMCFlash flashes[ASPEED_SMC_CS_MAX]; =20 diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 6e1a84c19713..7075bc9d61b0 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -1220,6 +1220,7 @@ static const VMStateDescription vmstate_aspeed_smc = =3D { =20 static Property aspeed_smc_properties[] =3D { DEFINE_PROP_BOOL("inject-failure", AspeedSMCState, inject_failure, fal= se), + DEFINE_PROP_UINT64("dram-base", AspeedSMCState, dram_base, 0), DEFINE_PROP_LINK("dram", AspeedSMCState, dram_mr, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350100; cv=none; d=zohomail.com; s=zohoarc; b=lfpVSewhTsFNWQA1vUF7okwYyjkiNBwNdKXqAHkOXXw55bhfU+HW0I6Yj3VvGzeGkW1kb0Xn3d3pF49RHp4zmJUj3PHuSoBz5Rq+4VYGKywIa3Ar4lBIh4ZzZ6T25OH1ubndwhO4uMY0HyTHDSUklzhp1dJlpfjkGcyJSZqK3oQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JxbWMx16HGQpOdBAfmbUiIqd5HPEH8JtjB2wrwjzgZ0=; b=jsnD4MtadBRjHRHBAm5LwfYo7uuRPDj27haWZYIwcHpCKKOd6wXtpuYippng6fuW1RZKfwJwyomvvSCJkuSWCq874kpuHoQ54aOjOwAyhT9dht+c6/PYAqqd+ChqFFRWSa6oycJkvQyRduFEM1JmHzif+hyzAhvZKal7g9Bkbc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350100209373.6138490694932; Fri, 14 Jun 2024 00:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1LS-0003CB-Nb; Fri, 14 Jun 2024 03:27:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LR-0003BX-J6 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LQ-0000kK-5I for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:33 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-wf7NeazrNFa9fm1fJeajkQ-1; Fri, 14 Jun 2024 03:27:24 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3B57D19560B5; Fri, 14 Jun 2024 07:27:23 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5A93E3000219; Fri, 14 Jun 2024 07:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JxbWMx16HGQpOdBAfmbUiIqd5HPEH8JtjB2wrwjzgZ0=; b=dyx0vdV4ewi8WSUr5jBKdYACp6skmuwqN0tEQc2IelrSUgbGzbFlNP/BX3Bjrc6p2l4lg3 4naIIpsDbHI5XsBQa/pOGFKSFgGceOfxaUlgdmsvkLwLGYVEAOaGxd501fCXp9bqF9bK6v r5ZOjZVlu9ouAuvXFGZhW8iIuKf60+k= X-MC-Unique: wf7NeazrNFa9fm1fJeajkQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 02/19] aspeed/wdt: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:03 +0200 Message-ID: <20240614072620.1262053-3-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350102232100003 From: Jamin Lin AST2700 wdt controller is similiar to AST2600's wdt, but the AST2700 has 8 watchdogs, and they each have 0x80 of registers. Introduce ast2700 object class and increase the number of regs(offset) of ast2700 model. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/watchdog/wdt_aspeed.h | 3 ++- hw/watchdog/wdt_aspeed.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_asp= eed.h index e90ef86651e8..830b0a79368a 100644 --- a/include/hw/watchdog/wdt_aspeed.h +++ b/include/hw/watchdog/wdt_aspeed.h @@ -19,9 +19,10 @@ OBJECT_DECLARE_TYPE(AspeedWDTState, AspeedWDTClass, ASPE= ED_WDT) #define TYPE_ASPEED_2400_WDT TYPE_ASPEED_WDT "-ast2400" #define TYPE_ASPEED_2500_WDT TYPE_ASPEED_WDT "-ast2500" #define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600" +#define TYPE_ASPEED_2700_WDT TYPE_ASPEED_WDT "-ast2700" #define TYPE_ASPEED_1030_WDT TYPE_ASPEED_WDT "-ast1030" =20 -#define ASPEED_WDT_REGS_MAX (0x30 / 4) +#define ASPEED_WDT_REGS_MAX (0x80 / 4) =20 struct AspeedWDTState { /*< private >*/ diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index d70b656f8e75..75685c56470d 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -422,12 +422,36 @@ static const TypeInfo aspeed_1030_wdt_info =3D { .class_init =3D aspeed_1030_wdt_class_init, }; =20 +static void aspeed_2700_wdt_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedWDTClass *awc =3D ASPEED_WDT_CLASS(klass); + + dc->desc =3D "ASPEED 2700 Watchdog Controller"; + awc->iosize =3D 0x80; + awc->ext_pulse_width_mask =3D 0xfffff; /* TODO */ + awc->reset_ctrl_reg =3D AST2600_SCU_RESET_CONTROL1; + awc->reset_pulse =3D aspeed_2500_wdt_reset_pulse; + awc->wdt_reload =3D aspeed_wdt_reload_1mhz; + awc->sanitize_ctrl =3D aspeed_2600_sanitize_ctrl; + awc->default_status =3D 0x014FB180; + awc->default_reload_value =3D 0x014FB180; +} + +static const TypeInfo aspeed_2700_wdt_info =3D { + .name =3D TYPE_ASPEED_2700_WDT, + .parent =3D TYPE_ASPEED_WDT, + .instance_size =3D sizeof(AspeedWDTState), + .class_init =3D aspeed_2700_wdt_class_init, +}; + static void wdt_aspeed_register_types(void) { type_register_static(&aspeed_wdt_info); type_register_static(&aspeed_2400_wdt_info); type_register_static(&aspeed_2500_wdt_info); type_register_static(&aspeed_2600_wdt_info); + type_register_static(&aspeed_2700_wdt_info); type_register_static(&aspeed_1030_wdt_info); } =20 --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350197; cv=none; d=zohomail.com; s=zohoarc; b=YqGektCD0ett8+Guv6PqABDDPpMJ4SXgQn+H2bco3lHUql4JUugjbpC9joThCaKTdd58hcL4nmI36E/1BxkZUHK3Hy5021E1jkABJyAOhA8Sl7ICQMv2N+eqUYzPoB6qC23z2gdxE/wqpDt05E9iA6u2RQRW94OPWXVN0pkDQUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350197; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AYWGjfqdWTHN73mpwY5Vg/n4nswDcBeE67iGIGD6bgk=; b=i3h/00NZKWKnxD8VjNal/Kn8VuH57ybzk/Jt2jvDxzQcm79uQqeA2ldcs1Jlpyb3FsrHmL15qIL+gFvMnLMBkzhs2F/xeRo0Lf336tJ0zbUO5ub2evT0MeKpa0e1bufphurbyq1v/j5zZHQHje07pIGqURSm4xlF92EfCHBsLa4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350197677693.3458639017878; Fri, 14 Jun 2024 00:29:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1La-0003ET-DI; Fri, 14 Jun 2024 03:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LY-0003Dp-O8 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LW-0000ke-Um for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:40 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-bFlG5q9YMfGOxBAEzY7hWA-1; Fri, 14 Jun 2024 03:27:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AAA9019560AB; Fri, 14 Jun 2024 07:27:30 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 815DB300021A; Fri, 14 Jun 2024 07:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AYWGjfqdWTHN73mpwY5Vg/n4nswDcBeE67iGIGD6bgk=; b=gHSmv0/VsOk2lrBKD9ekG+SLki0YPWNHb1J2ry/um6xSkmKEaG08+T2014MK4jWVROCp2E Uf4YJ9lBE6L8F/MIiHuXW1wQI7wuTFCbJwPLC77BcDKnm+vstFNFQIFUWdJHyPcgYsoMyn LJXNxduzBYq3ugmyVMXeB9uRI5R2yBQ= X-MC-Unique: bFlG5q9YMfGOxBAEzY7hWA-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 03/19] aspeed/sli: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:04 +0200 Message-ID: <20240614072620.1262053-4-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350198524100008 From: Jamin Lin AST2700 SLI engine is designed to accelerate the throughput between cross-die connections. It have CPU_SLI at CPU die and IO_SLI at IO die. Introduce dummy AST2700 SLI and SLIIO models. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/misc/aspeed_sli.h | 27 ++++++ hw/misc/aspeed_sli.c | 177 +++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 3 +- hw/misc/trace-events | 7 ++ 4 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 include/hw/misc/aspeed_sli.h create mode 100644 hw/misc/aspeed_sli.c diff --git a/include/hw/misc/aspeed_sli.h b/include/hw/misc/aspeed_sli.h new file mode 100644 index 000000000000..23f346ab934b --- /dev/null +++ b/include/hw/misc/aspeed_sli.h @@ -0,0 +1,27 @@ +/* + * ASPEED SLI Controller + * + * Copyright (C) 2024 ASPEED Technology Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef ASPEED_SLI_H +#define ASPEED_SLI_H + +#include "hw/sysbus.h" + +#define TYPE_ASPEED_SLI "aspeed.sli" +#define TYPE_ASPEED_2700_SLI TYPE_ASPEED_SLI "-ast2700" +#define TYPE_ASPEED_2700_SLIIO TYPE_ASPEED_SLI "io" "-ast2700" +OBJECT_DECLARE_SIMPLE_TYPE(AspeedSLIState, ASPEED_SLI) + +#define ASPEED_SLI_NR_REGS (0x500 >> 2) + +struct AspeedSLIState { + SysBusDevice parent; + MemoryRegion iomem; + + uint32_t regs[ASPEED_SLI_NR_REGS]; +}; + +#endif /* ASPEED_SLI_H */ diff --git a/hw/misc/aspeed_sli.c b/hw/misc/aspeed_sli.c new file mode 100644 index 000000000000..fe720ead5094 --- /dev/null +++ b/hw/misc/aspeed_sli.c @@ -0,0 +1,177 @@ +/* + * ASPEED SLI Controller + * + * Copyright (C) 2024 ASPEED Technology Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qemu/error-report.h" +#include "hw/qdev-properties.h" +#include "hw/misc/aspeed_sli.h" +#include "qapi/error.h" +#include "migration/vmstate.h" +#include "trace.h" + +#define SLI_REGION_SIZE 0x500 +#define TO_REG(addr) ((addr) >> 2) + +static uint64_t aspeed_sli_read(void *opaque, hwaddr addr, unsigned int si= ze) +{ + AspeedSLIState *s =3D ASPEED_SLI(opaque); + int reg =3D TO_REG(addr); + + if (reg >=3D ARRAY_SIZE(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx "= \n", + __func__, addr); + return 0; + } + + trace_aspeed_sli_read(addr, size, s->regs[reg]); + return s->regs[reg]; +} + +static void aspeed_sli_write(void *opaque, hwaddr addr, uint64_t data, + unsigned int size) +{ + AspeedSLIState *s =3D ASPEED_SLI(opaque); + int reg =3D TO_REG(addr); + + if (reg >=3D ARRAY_SIZE(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx = "\n", + __func__, addr); + return; + } + + trace_aspeed_sli_write(addr, size, data); + s->regs[reg] =3D data; +} + +static uint64_t aspeed_sliio_read(void *opaque, hwaddr addr, unsigned int = size) +{ + AspeedSLIState *s =3D ASPEED_SLI(opaque); + int reg =3D TO_REG(addr); + + if (reg >=3D ARRAY_SIZE(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx "= \n", + __func__, addr); + return 0; + } + + trace_aspeed_sliio_read(addr, size, s->regs[reg]); + return s->regs[reg]; +} + +static void aspeed_sliio_write(void *opaque, hwaddr addr, uint64_t data, + unsigned int size) +{ + AspeedSLIState *s =3D ASPEED_SLI(opaque); + int reg =3D TO_REG(addr); + + if (reg >=3D ARRAY_SIZE(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx = "\n", + __func__, addr); + return; + } + + trace_aspeed_sliio_write(addr, size, data); + s->regs[reg] =3D data; +} + +static const MemoryRegionOps aspeed_sli_ops =3D { + .read =3D aspeed_sli_read, + .write =3D aspeed_sli_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, + }, +}; + +static const MemoryRegionOps aspeed_sliio_ops =3D { + .read =3D aspeed_sliio_read, + .write =3D aspeed_sliio_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, + }, +}; + +static void aspeed_sli_realize(DeviceState *dev, Error **errp) +{ + AspeedSLIState *s =3D ASPEED_SLI(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + + memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sli_ops, s, + TYPE_ASPEED_SLI, SLI_REGION_SIZE); + sysbus_init_mmio(sbd, &s->iomem); +} + +static void aspeed_sliio_realize(DeviceState *dev, Error **errp) +{ + AspeedSLIState *s =3D ASPEED_SLI(dev); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + + memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sliio_ops, s, + TYPE_ASPEED_SLI, SLI_REGION_SIZE); + sysbus_init_mmio(sbd, &s->iomem); +} + +static void aspeed_sli_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->desc =3D "Aspeed SLI Controller"; + dc->realize =3D aspeed_sli_realize; +} + +static const TypeInfo aspeed_sli_info =3D { + .name =3D TYPE_ASPEED_SLI, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(AspeedSLIState), + .class_init =3D aspeed_sli_class_init, + .abstract =3D true, +}; + +static void aspeed_2700_sli_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->desc =3D "AST2700 SLI Controller"; +} + +static void aspeed_2700_sliio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->desc =3D "AST2700 I/O SLI Controller"; + dc->realize =3D aspeed_sliio_realize; +} + +static const TypeInfo aspeed_2700_sli_info =3D { + .name =3D TYPE_ASPEED_2700_SLI, + .parent =3D TYPE_ASPEED_SLI, + .class_init =3D aspeed_2700_sli_class_init, +}; + +static const TypeInfo aspeed_2700_sliio_info =3D { + .name =3D TYPE_ASPEED_2700_SLIIO, + .parent =3D TYPE_ASPEED_SLI, + .class_init =3D aspeed_2700_sliio_class_init, +}; + +static void aspeed_sli_register_types(void) +{ + type_register_static(&aspeed_sli_info); + type_register_static(&aspeed_2700_sli_info); + type_register_static(&aspeed_2700_sliio_info); +} + +type_init(aspeed_sli_register_types); diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 86596a388812..2ca8717be286 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -136,7 +136,8 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_sbc.c', 'aspeed_sdmc.c', 'aspeed_xdma.c', - 'aspeed_peci.c')) + 'aspeed_peci.c', + 'aspeed_sli.c')) =20 system_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-sysreg.c')) system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_rng.c')) diff --git a/hw/misc/trace-events b/hw/misc/trace-events index 5d241cb40aab..e13b64822110 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -351,3 +351,10 @@ djmemc_write(int reg, uint64_t value, unsigned int siz= e) "reg=3D0x%x value=3D0x%"PRI # iosb.c iosb_read(int reg, uint64_t value, unsigned int size) "reg=3D0x%x value=3D= 0x%"PRIx64" size=3D%u" iosb_write(int reg, uint64_t value, unsigned int size) "reg=3D0x%x value= =3D0x%"PRIx64" size=3D%u" + +# aspeed_sli.c +aspeed_sli_write(uint64_t offset, unsigned int size, uint32_t data) "To 0x= %" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sli_read(uint64_t offset, unsigned int size, uint32_t data) "To 0x%= " PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sliio_write(uint64_t offset, unsigned int size, uint32_t data) "To = 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_sliio_read(uint64_t offset, unsigned int size, uint32_t data) "To 0= x%" PRIx64 " of size %u: 0x%" PRIx32 + --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350216; cv=none; d=zohomail.com; s=zohoarc; b=n1U5Gx7MA5fz00i2xEsRqRP6UxwjbnI4HxWqsivCHr4w4hg7WAR9OR3n7Uxz3ID4d6n2GtczULLVip2DkCAHo3Gk4hxz9wjIRiFprTEcQHURTyR69MgbPNozy+3e5kBKG31uvfOm1sODdPwqRdSByiuTyCnFk+QFVodklc5O9us= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350216; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7J6U16qrXeLb/asNfTGBlt6h0s0DAuaM230HKBqvUWQ=; b=jptk4dPtHDXhv0MQW4Ab2wgoqLf1QfDtacSvqBoViLmcQpMa3gUXDIkfCS7Pj4kLj/x9fOXDqHGVkw1i+5lLbm3guft7wUUsH6ImNVep1VYxWCPor7cBAWfDbti2K71+v1nPHnU0qciLiQXNWWbPTZ7Io4NBeF3Y+FY6W6GuCoU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350216338596.7344566395334; Fri, 14 Jun 2024 00:30:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1LX-0003DS-NC; Fri, 14 Jun 2024 03:27:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LW-0003Cf-7G for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1LU-0000ka-Qn for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:38 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-cYX1J6iCP3eRQgpTECFXXg-1; Fri, 14 Jun 2024 03:27:34 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0FFD219560B0; Fri, 14 Jun 2024 07:27:33 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F103B3000219; Fri, 14 Jun 2024 07:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7J6U16qrXeLb/asNfTGBlt6h0s0DAuaM230HKBqvUWQ=; b=ZshNH0QAA/Z9xntcSD2rpqk5NotTWJ38FtWMHS8ZUx514wK+hu467Cu2SngDWYOgtyGykM wz314usfIK25w6+GBu60wSBpy1a+JdYIrxU3vKdHKrIBfz1WW7++oVPQ0yK1v/ml/MT2uH UsWhdsZ2ACDNSv7a/+ABxPL+3NC9FKc= X-MC-Unique: cYX1J6iCP3eRQgpTECFXXg-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 04/19] aspeed/sdmc: remove redundant macros Date: Fri, 14 Jun 2024 09:26:05 +0200 Message-ID: <20240614072620.1262053-5-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350216849100003 From: Jamin Lin These macros are no longer used for ASPEED SOCs, so removes them. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/misc/aspeed_sdmc.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 64cd1a81dcd2..74279bbe8ee7 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -76,10 +76,6 @@ #define ASPEED_SDMC_VGA_32MB 0x2 #define ASPEED_SDMC_VGA_64MB 0x3 #define ASPEED_SDMC_DRAM_SIZE(x) (x & 0x3) -#define ASPEED_SDMC_DRAM_64MB 0x0 -#define ASPEED_SDMC_DRAM_128MB 0x1 -#define ASPEED_SDMC_DRAM_256MB 0x2 -#define ASPEED_SDMC_DRAM_512MB 0x3 =20 #define ASPEED_SDMC_READONLY_MASK \ (ASPEED_SDMC_RESERVED | ASPEED_SDMC_VGA_COMPAT | \ @@ -100,17 +96,6 @@ #define ASPEED_SDMC_CACHE_ENABLE (1 << 10) /* differs from AST2400 = */ #define ASPEED_SDMC_DRAM_TYPE (1 << 4) /* differs from AST2400 = */ =20 -/* DRAM size definitions differs */ -#define ASPEED_SDMC_AST2500_128MB 0x0 -#define ASPEED_SDMC_AST2500_256MB 0x1 -#define ASPEED_SDMC_AST2500_512MB 0x2 -#define ASPEED_SDMC_AST2500_1024MB 0x3 - -#define ASPEED_SDMC_AST2600_256MB 0x0 -#define ASPEED_SDMC_AST2600_512MB 0x1 -#define ASPEED_SDMC_AST2600_1024MB 0x2 -#define ASPEED_SDMC_AST2600_2048MB 0x3 - #define ASPEED_SDMC_AST2500_READONLY_MASK \ (ASPEED_SDMC_HW_VERSION(0xf) | ASPEED_SDMC_CACHE_INITIAL_DONE | \ ASPEED_SDMC_AST2500_RESERVED | ASPEED_SDMC_VGA_COMPAT | \ --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350191; cv=none; d=zohomail.com; s=zohoarc; b=lAO2wrj1pyDO6x3VkELwzu/+h0cl2hLF9S14X6C8ZniGLMAihYVzKwLDjEk5wZ7h1ZYqW9xSweSnWpwOTb9FPufC194vMTuZ36h0ikYaZ+2w2eNunu5r6nOchff3ZebAqgJwpcqwFnSS2j6r8+3AcSUKhJExrkbF5T4D0z5Cldw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350191; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GG/7nIx9q8EFSXqOPcSvBh4zIHq/fXW6byZ08I1yz/Y=; b=K8hy9XeF3Nd+/AE23kdwfJ0IE7S0KhhpC5/GZboVmsI2duvMnriLEDZS0WYiFWNMBzvDZk0+2M9PiahFUWk6LBOddd3HLXzM5GqSA0b0ZfVus9wdEmk8sfmFeiTiFImUaMvsMDf7wAjNnqbZDodq2VrLuYkQJ7QEvSXoqzMk3a8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350191395645.8542594461875; Fri, 14 Jun 2024 00:29:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Li-0003IA-0f; Fri, 14 Jun 2024 03:27:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lg-0003HN-IO for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Le-0000ll-VR for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:48 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-LzW7ZURgPWeI16W83EmJXg-1; Fri, 14 Jun 2024 03:27:37 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 146D5195609D; Fri, 14 Jun 2024 07:27:36 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37FC73000219; Fri, 14 Jun 2024 07:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GG/7nIx9q8EFSXqOPcSvBh4zIHq/fXW6byZ08I1yz/Y=; b=bqiVRdbBrTuD5pMDHwBQ0FE0BBRBOgKRgEFFdc8iryCu7ISVGQ5Q3v+XYmoGmaR9Q9ytNQ NiN/nP+H3V8C7mdSMnCzzOHAGeUgzbKvxxHGGayu3XCt+BNYG4Th/NIP5nFA25vamf3AXe Zm9R5H6ayq4VzIFC79P8O0OIlI1vi+4= X-MC-Unique: LzW7ZURgPWeI16W83EmJXg-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 05/19] aspeed/sdmc: fix coding style Date: Fri, 14 Jun 2024 09:26:06 +0200 Message-ID: <20240614072620.1262053-6-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350192452100002 From: Jamin Lin Fix coding style issues from checkpatch.pl Test command: scripts/checkpatch.pl --no-tree -f hw/misc/aspeed_sdmc.c Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/misc/aspeed_sdmc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 74279bbe8ee7..873d67c592d8 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -296,7 +296,8 @@ static void aspeed_2400_sdmc_write(AspeedSDMCState *s, = uint32_t reg, uint32_t data) { if (reg =3D=3D R_PROT) { - s->regs[reg] =3D (data =3D=3D PROT_KEY_UNLOCK) ? PROT_UNLOCKED : P= ROT_SOFTLOCKED; + s->regs[reg] =3D + (data =3D=3D PROT_KEY_UNLOCK) ? PROT_UNLOCKED : PROT_SOFTLOCKE= D; return; } =20 @@ -354,7 +355,8 @@ static void aspeed_2500_sdmc_write(AspeedSDMCState *s, = uint32_t reg, uint32_t data) { if (reg =3D=3D R_PROT) { - s->regs[reg] =3D (data =3D=3D PROT_KEY_UNLOCK) ? PROT_UNLOCKED : P= ROT_SOFTLOCKED; + s->regs[reg] =3D + (data =3D=3D PROT_KEY_UNLOCK) ? PROT_UNLOCKED : PROT_SOFTLOCKE= D; return; } =20 @@ -434,8 +436,9 @@ static void aspeed_2600_sdmc_write(AspeedSDMCState *s, = uint32_t reg, } =20 if (s->regs[R_PROT] =3D=3D PROT_HARDLOCKED) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: SDMC is locked until system re= set!\n", - __func__); + qemu_log_mask(LOG_GUEST_ERROR, + "%s: SDMC is locked until system reset!\n", + __func__); return; } =20 --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350101; cv=none; d=zohomail.com; s=zohoarc; b=Rgw5dEc66U31pwyzoX2wwKzc5s1ybYAbp5DHEnhrr6RnLdf3i3yejL+jd19m2jQTjses6IumRZl3vjanhPWzJTQdyqzBzr+y37Afdh7EvTKli78kkHoIoiCjWSx9ydD+6e7sp/QNFMG+OIpFR/Ev5pcXPesx6Q6vSY3jTfhXGh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350101; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DVauzJlq/HXfFCqWNRACgoXKiJL7bsNX476B58kQzdU=; b=d45pP+5BtJPmxl0aJr56p0Ln17GWz/mQjmshzA0Vq/0cCkXwwfSaHdEJQTp6oXszYDN5s3qNILFUDewrJPDL/yogf85iV5TqcvQvM0Von+BCISPuVmwXC705++GDqaYDK/OxI46062UzcoAbp13NyX9s9EPPZorF1bMJJWldysY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350100992234.37858921134682; Fri, 14 Jun 2024 00:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Le-0003FV-Fk; Fri, 14 Jun 2024 03:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lc-0003FD-FT for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1La-0000lH-DY for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:44 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-155-i85xMG2PNrWzX6Mzy20GOg-1; Fri, 14 Jun 2024 03:27:39 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2673F1956083; Fri, 14 Jun 2024 07:27:38 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7488B3000219; Fri, 14 Jun 2024 07:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DVauzJlq/HXfFCqWNRACgoXKiJL7bsNX476B58kQzdU=; b=J0G86ugJfmUl/oLu9/5Nefk2HRKt6WGYVJ7O9wz1QkeQE2QgE/rCRcEPj72R1k/YVm9IhD 5plKMjtey+gCyeuPeW8yIRPgGZpjF6RO6bFuWQGJVb8iJK1k7hkCLNCIAtlySMaXeRzPf4 N6JymGOhwAK5l/nGiIqMw7AumPyA8RY= X-MC-Unique: i85xMG2PNrWzX6Mzy20GOg-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 06/19] aspeed/sdmc: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:07 +0200 Message-ID: <20240614072620.1262053-7-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350102267100010 From: Jamin Lin The SDRAM memory controller(DRAMC) controls the access to external DDR4 and DDR5 SDRAM and power up to DDR4 and DDR5 PHY. The DRAM memory controller of AST2700 is not backward compatible to previous chips such AST2600, AST2500 and AST2400. Max memory is now 8GiB on the AST2700. Introduce new aspeed_2700_sdmc and class with read/write operation and reset handlers. Define DRAMC necessary protected registers and unprotected registers for AST2700 and increase the register set to 0x1000. Add unlocked property to change controller protected status. Incrementing the version of vmstate to 2. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/misc/aspeed_sdmc.h | 5 +- hw/misc/aspeed_sdmc.c | 194 +++++++++++++++++++++++++++++++++- 2 files changed, 195 insertions(+), 4 deletions(-) diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h index ec2d59a14f57..61c979583ae1 100644 --- a/include/hw/misc/aspeed_sdmc.h +++ b/include/hw/misc/aspeed_sdmc.h @@ -17,6 +17,7 @@ OBJECT_DECLARE_TYPE(AspeedSDMCState, AspeedSDMCClass, ASP= EED_SDMC) #define TYPE_ASPEED_2400_SDMC TYPE_ASPEED_SDMC "-ast2400" #define TYPE_ASPEED_2500_SDMC TYPE_ASPEED_SDMC "-ast2500" #define TYPE_ASPEED_2600_SDMC TYPE_ASPEED_SDMC "-ast2600" +#define TYPE_ASPEED_2700_SDMC TYPE_ASPEED_SDMC "-ast2700" =20 /* * SDMC has 174 documented registers. In addition the u-boot device tree @@ -29,7 +30,7 @@ OBJECT_DECLARE_TYPE(AspeedSDMCState, AspeedSDMCClass, ASP= EED_SDMC) * time, and the other is in the DDR-PHY IP which is used during DDR-PHY * training. */ -#define ASPEED_SDMC_NR_REGS (0x500 >> 2) +#define ASPEED_SDMC_NR_REGS (0x1000 >> 2) =20 struct AspeedSDMCState { /*< private >*/ @@ -41,6 +42,7 @@ struct AspeedSDMCState { uint32_t regs[ASPEED_SDMC_NR_REGS]; uint64_t ram_size; uint64_t max_ram_size; + bool unlocked; }; =20 =20 @@ -51,6 +53,7 @@ struct AspeedSDMCClass { const uint64_t *valid_ram_sizes; uint32_t (*compute_conf)(AspeedSDMCState *s, uint32_t data); void (*write)(AspeedSDMCState *s, uint32_t reg, uint32_t data); + bool is_bus64bit; }; =20 #endif /* ASPEED_SDMC_H */ diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index 873d67c592d8..93e2e29ead87 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -27,6 +27,7 @@ #define PROT_SOFTLOCKED 0x00 =20 #define PROT_KEY_UNLOCK 0xFC600309 +#define PROT_2700_KEY_UNLOCK 0x1688A8A8 #define PROT_KEY_HARDLOCK 0xDEADDEAD /* AST2600 */ =20 /* Configuration Register */ @@ -54,6 +55,46 @@ #define R_DRAM_TIME (0x8c / 4) #define R_ECC_ERR_INJECT (0xb4 / 4) =20 +/* AST2700 Register */ +#define R_2700_PROT (0x00 / 4) +#define R_INT_STATUS (0x04 / 4) +#define R_INT_CLEAR (0x08 / 4) +#define R_INT_MASK (0x0c / 4) +#define R_MAIN_CONF (0x10 / 4) +#define R_MAIN_CONTROL (0x14 / 4) +#define R_MAIN_STATUS (0x18 / 4) +#define R_ERR_STATUS (0x1c / 4) +#define R_ECC_FAIL_STATUS (0x78 / 4) +#define R_ECC_FAIL_ADDR (0x7c / 4) +#define R_ECC_TESTING_CONTROL (0x80 / 4) +#define R_PROT_REGION_LOCK_STATUS (0x94 / 4) +#define R_TEST_FAIL_ADDR (0xd4 / 4) +#define R_TEST_FAIL_D0 (0xd8 / 4) +#define R_TEST_FAIL_D1 (0xdc / 4) +#define R_TEST_FAIL_D2 (0xe0 / 4) +#define R_TEST_FAIL_D3 (0xe4 / 4) +#define R_DBG_STATUS (0xf4 / 4) +#define R_PHY_INTERFACE_STATUS (0xf8 / 4) +#define R_GRAPHIC_MEM_BASE_ADDR (0x10c / 4) +#define R_PORT0_INTERFACE_MONITOR0 (0x240 / 4) +#define R_PORT0_INTERFACE_MONITOR1 (0x244 / 4) +#define R_PORT0_INTERFACE_MONITOR2 (0x248 / 4) +#define R_PORT1_INTERFACE_MONITOR0 (0x2c0 / 4) +#define R_PORT1_INTERFACE_MONITOR1 (0x2c4 / 4) +#define R_PORT1_INTERFACE_MONITOR2 (0x2c8 / 4) +#define R_PORT2_INTERFACE_MONITOR0 (0x340 / 4) +#define R_PORT2_INTERFACE_MONITOR1 (0x344 / 4) +#define R_PORT2_INTERFACE_MONITOR2 (0x348 / 4) +#define R_PORT3_INTERFACE_MONITOR0 (0x3c0 / 4) +#define R_PORT3_INTERFACE_MONITOR1 (0x3c4 / 4) +#define R_PORT3_INTERFACE_MONITOR2 (0x3c8 / 4) +#define R_PORT4_INTERFACE_MONITOR0 (0x440 / 4) +#define R_PORT4_INTERFACE_MONITOR1 (0x444 / 4) +#define R_PORT4_INTERFACE_MONITOR2 (0x448 / 4) +#define R_PORT5_INTERFACE_MONITOR0 (0x4c0 / 4) +#define R_PORT5_INTERFACE_MONITOR1 (0x4c4 / 4) +#define R_PORT5_INTERFACE_MONITOR2 (0x4c8 / 4) + /* * Configuration register Ox4 (for Aspeed AST2400 SOC) * @@ -101,6 +142,19 @@ ASPEED_SDMC_AST2500_RESERVED | ASPEED_SDMC_VGA_COMPAT | \ ASPEED_SDMC_VGA_APERTURE(ASPEED_SDMC_VGA_64MB)) =20 +/* + * Main Configuration register Ox10 (for Aspeed AST2700 SOC and higher) + * + */ +#define ASPEED_SDMC_AST2700_RESERVED 0xFFFF2082 /* 31:16, 13, 7, 1 = */ +#define ASPEED_SDMC_AST2700_DATA_SCRAMBLE (1 << 8) +#define ASPEED_SDMC_AST2700_ECC_ENABLE (1 << 6) +#define ASPEED_SDMC_AST2700_PAGE_MATCHING_ENABLE (1 << 5) +#define ASPEED_SDMC_AST2700_DRAM_SIZE(x) ((x & 0x7) << 2) + +#define ASPEED_SDMC_AST2700_READONLY_MASK \ + (ASPEED_SDMC_AST2700_RESERVED) + static uint64_t aspeed_sdmc_read(void *opaque, hwaddr addr, unsigned size) { AspeedSDMCState *s =3D ASPEED_SDMC(opaque); @@ -216,7 +270,7 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error= **errp) AspeedSDMCState *s =3D ASPEED_SDMC(dev); AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); =20 - assert(asc->max_ram_size < 4 * GiB); /* 32-bit address bus */ + assert(asc->max_ram_size < 4 * GiB || asc->is_bus64bit); s->max_ram_size =3D asc->max_ram_size; =20 memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sdmc_ops, s, @@ -226,8 +280,8 @@ static void aspeed_sdmc_realize(DeviceState *dev, Error= **errp) =20 static const VMStateDescription vmstate_aspeed_sdmc =3D { .name =3D "aspeed.sdmc", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (const VMStateField[]) { VMSTATE_UINT32_ARRAY(regs, AspeedSDMCState, ASPEED_SDMC_NR_REGS), VMSTATE_END_OF_LIST() @@ -236,6 +290,7 @@ static const VMStateDescription vmstate_aspeed_sdmc =3D= { =20 static Property aspeed_sdmc_properties[] =3D { DEFINE_PROP_UINT64("max-ram-size", AspeedSDMCState, max_ram_size, 0), + DEFINE_PROP_BOOL("unlocked", AspeedSDMCState, unlocked, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -500,12 +555,145 @@ static const TypeInfo aspeed_2600_sdmc_info =3D { .class_init =3D aspeed_2600_sdmc_class_init, }; =20 +static void aspeed_2700_sdmc_reset(DeviceState *dev) +{ + AspeedSDMCState *s =3D ASPEED_SDMC(dev); + AspeedSDMCClass *asc =3D ASPEED_SDMC_GET_CLASS(s); + + memset(s->regs, 0, sizeof(s->regs)); + + /* Set ram size bit and defaults values */ + s->regs[R_MAIN_CONF] =3D asc->compute_conf(s, 0); + + if (s->unlocked) { + s->regs[R_2700_PROT] =3D PROT_UNLOCKED; + } +} + +static uint32_t aspeed_2700_sdmc_compute_conf(AspeedSDMCState *s, uint32_t= data) +{ + uint32_t fixed_conf =3D ASPEED_SDMC_AST2700_PAGE_MATCHING_ENABLE | + ASPEED_SDMC_AST2700_DRAM_SIZE(aspeed_sdmc_get_ram_bits(s)); + + /* Make sure readonly bits are kept */ + data &=3D ~ASPEED_SDMC_AST2700_READONLY_MASK; + + return data | fixed_conf; +} + +static void aspeed_2700_sdmc_write(AspeedSDMCState *s, uint32_t reg, + uint32_t data) +{ + /* Unprotected registers */ + switch (reg) { + case R_INT_STATUS: + case R_INT_CLEAR: + case R_INT_MASK: + case R_MAIN_STATUS: + case R_ERR_STATUS: + case R_ECC_FAIL_STATUS: + case R_ECC_FAIL_ADDR: + case R_PROT_REGION_LOCK_STATUS: + case R_TEST_FAIL_ADDR: + case R_TEST_FAIL_D0: + case R_TEST_FAIL_D1: + case R_TEST_FAIL_D2: + case R_TEST_FAIL_D3: + case R_DBG_STATUS: + case R_PHY_INTERFACE_STATUS: + case R_GRAPHIC_MEM_BASE_ADDR: + case R_PORT0_INTERFACE_MONITOR0: + case R_PORT0_INTERFACE_MONITOR1: + case R_PORT0_INTERFACE_MONITOR2: + case R_PORT1_INTERFACE_MONITOR0: + case R_PORT1_INTERFACE_MONITOR1: + case R_PORT1_INTERFACE_MONITOR2: + case R_PORT2_INTERFACE_MONITOR0: + case R_PORT2_INTERFACE_MONITOR1: + case R_PORT2_INTERFACE_MONITOR2: + case R_PORT3_INTERFACE_MONITOR0: + case R_PORT3_INTERFACE_MONITOR1: + case R_PORT3_INTERFACE_MONITOR2: + case R_PORT4_INTERFACE_MONITOR0: + case R_PORT4_INTERFACE_MONITOR1: + case R_PORT4_INTERFACE_MONITOR2: + case R_PORT5_INTERFACE_MONITOR0: + case R_PORT5_INTERFACE_MONITOR1: + case R_PORT5_INTERFACE_MONITOR2: + s->regs[reg] =3D data; + return; + } + + if (s->regs[R_2700_PROT] =3D=3D PROT_HARDLOCKED) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: SDMC is locked until system reset!\n", + __func__); + return; + } + + if (reg !=3D R_2700_PROT && s->regs[R_2700_PROT] =3D=3D PROT_SOFTLOCKE= D) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: SDMC is locked! (write to MCR%02x blocked)\n", + __func__, reg * 4); + return; + } + + switch (reg) { + case R_2700_PROT: + if (data =3D=3D PROT_2700_KEY_UNLOCK) { + data =3D PROT_UNLOCKED; + } else if (data =3D=3D PROT_KEY_HARDLOCK) { + data =3D PROT_HARDLOCKED; + } else { + data =3D PROT_SOFTLOCKED; + } + break; + case R_MAIN_CONF: + data =3D aspeed_2700_sdmc_compute_conf(s, data); + break; + case R_MAIN_STATUS: + /* Will never return 'busy'. */ + data &=3D ~PHY_BUSY_STATE; + break; + default: + break; + } + + s->regs[reg] =3D data; +} + +static const uint64_t + aspeed_2700_ram_sizes[] =3D { 256 * MiB, 512 * MiB, 1024 * MiB, + 2048 * MiB, 4096 * MiB, 8192 * MiB, 0}; + +static void aspeed_2700_sdmc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSDMCClass *asc =3D ASPEED_SDMC_CLASS(klass); + + dc->desc =3D "ASPEED 2700 SDRAM Memory Controller"; + dc->reset =3D aspeed_2700_sdmc_reset; + + asc->is_bus64bit =3D true; + asc->max_ram_size =3D 8 * GiB; + asc->compute_conf =3D aspeed_2700_sdmc_compute_conf; + asc->write =3D aspeed_2700_sdmc_write; + asc->valid_ram_sizes =3D aspeed_2700_ram_sizes; +} + +static const TypeInfo aspeed_2700_sdmc_info =3D { + .name =3D TYPE_ASPEED_2700_SDMC, + .parent =3D TYPE_ASPEED_SDMC, + .class_init =3D aspeed_2700_sdmc_class_init, +}; + static void aspeed_sdmc_register_types(void) { type_register_static(&aspeed_sdmc_info); type_register_static(&aspeed_2400_sdmc_info); type_register_static(&aspeed_2500_sdmc_info); type_register_static(&aspeed_2600_sdmc_info); + type_register_static(&aspeed_2700_sdmc_info); } =20 type_init(aspeed_sdmc_register_types); --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350223; cv=none; d=zohomail.com; s=zohoarc; b=Uxu2sjto4O5f9nbThDHJjM3nIvO/ba9PM/ZpPvbuAgYh9a8QN7LpjBjIIGlqYlsmbDNkNz53oHUgZy8Bg9TxGaYShBu2Si5LX8C17ZT6TZzrxSs4PWom/AyDxFKijYl8qmznuy26NeTRAoFuLYJm/3dE4V7mCqmRz7T62JLsxxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350223; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eCZmP/J2Zbdu/LNH+1MhtiH0c8YE8hp82fj5KAC5fXQ=; b=LGLlufppcvxhlmKLcsFZIie0dcXInLPCt1empfAVsM4rtJQwsysGMK73QX0BIqo7WtzEw6Mvn8GnZKbmkO+g4EVw7KRuSW7a9Jr5wGrIrG2xwkCgI+dIJC2aDf1HinO+vkYPCsxerFFL7gUGcosF4jvY01IrbJRqqfXdtHl3JwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350223140762.9393934152989; Fri, 14 Jun 2024 00:30:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Lh-0003Hl-27; Fri, 14 Jun 2024 03:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lf-0003Fy-4w for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Ld-0000lZ-ID for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:46 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-247-9GCs9DixPx-MjyB_Cn-aDA-1; Fri, 14 Jun 2024 03:27:41 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 80D55195608B; Fri, 14 Jun 2024 07:27:40 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 83C663000219; Fri, 14 Jun 2024 07:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eCZmP/J2Zbdu/LNH+1MhtiH0c8YE8hp82fj5KAC5fXQ=; b=emEiQ2T7OBv4roWAqYLRG05eIbwNwmdPwwEXOSP5UUSvswcOZ2IwpgdnJZOkJorrUn6Qzh GkcNSq/7ggbJo0wxTCrXjU8MNuM/eHMugOA842vQtubF3JlZA0MJVUiFQeBeUxyLcb3ar1 UO3KUNWSrBTmu5h4wAzPtWCjsGOORO8= X-MC-Unique: 9GCs9DixPx-MjyB_Cn-aDA-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 07/19] aspeed/smc: correct device description Date: Fri, 14 Jun 2024 09:26:08 +0200 Message-ID: <20240614072620.1262053-8-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350224569100005 From: Jamin Lin Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/ssi/aspeed_smc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 7075bc9d61b0..fe1cd96b803a 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -1449,7 +1449,7 @@ static void aspeed_2500_fmc_class_init(ObjectClass *k= lass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); =20 - dc->desc =3D "Aspeed 2600 FMC Controller"; + dc->desc =3D "Aspeed 2500 FMC Controller"; asc->r_conf =3D R_CONF; asc->r_ce_ctrl =3D R_CE_CTRL; asc->r_ctrl0 =3D R_CTRL0; @@ -1487,7 +1487,7 @@ static void aspeed_2500_spi1_class_init(ObjectClass *= klass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); =20 - dc->desc =3D "Aspeed 2600 SPI1 Controller"; + dc->desc =3D "Aspeed 2500 SPI1 Controller"; asc->r_conf =3D R_CONF; asc->r_ce_ctrl =3D R_CE_CTRL; asc->r_ctrl0 =3D R_CTRL0; @@ -1522,7 +1522,7 @@ static void aspeed_2500_spi2_class_init(ObjectClass *= klass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); =20 - dc->desc =3D "Aspeed 2600 SPI2 Controller"; + dc->desc =3D "Aspeed 2500 SPI2 Controller"; asc->r_conf =3D R_CONF; asc->r_ce_ctrl =3D R_CE_CTRL; asc->r_ctrl0 =3D R_CTRL0; --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350100; cv=none; d=zohomail.com; s=zohoarc; b=fTKN8ZxEwmUt4ZF+Vu2w/KD8Yr5c/r8eso+Rb/YoLJCWzE+IHpZcPjnu+tACyRfAt++XXWGUCBNLfuvRW0WYw/3i/FzJFlSaLYKapUeVtj2FnybShwdK3aiAhBfp0zd5NGkjNlXtHqp0ygBeAypMDJzwiFYDbvmJkMlIlw1P4SY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XP/iTr/BVBIoYxsQ+3kqlBLFtRaXOsgv0fgawDKkxnQ=; b=cKUCZPikBRUdYobKL83bPspJqX23RBzMrusEarnT1jUcUhQ+NQrlrr6O4bQe03jMzSr4IopBICOar2dG5RKZ2ZT+6Iu4RgpiQQ1xMPd7SSTGDn8UD14CpvYJBhYQZ+d3HxDy8dYIq2BO2LyH0CQVgdGNXTYaiZG4yXJOPWtKZ/I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350100912840.8851797116718; Fri, 14 Jun 2024 00:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Ll-0003KC-SD; Fri, 14 Jun 2024 03:27:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lk-0003JF-RV for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Li-0000mV-Vl for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:52 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-2Rry6W_pNuSvUUD65gRb2Q-1; Fri, 14 Jun 2024 03:27:43 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B65B41956094; Fri, 14 Jun 2024 07:27:42 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BE9743000219; Fri, 14 Jun 2024 07:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XP/iTr/BVBIoYxsQ+3kqlBLFtRaXOsgv0fgawDKkxnQ=; b=Qy20UWxXqc4u/sjj9x/Jf9HkP84bqYdzDgrkQn/LdnkSY0zfqFf2+TA3AN/aNUX0zW2jEX sxTz+3CQVCaptRCWtz/oIM9GlQuVaFdG+uD6xqNBNBYWszphMnmkJoG1fhY1CrD2I86mZu tAoxLyzA3mkMUe0x00qQ4f/cMIiAuzk= X-MC-Unique: 2Rry6W_pNuSvUUD65gRb2Q-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 08/19] aspeed/smc: support dma start length and 1 byte length unit Date: Fri, 14 Jun 2024 09:26:09 +0200 Message-ID: <20240614072620.1262053-9-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350102267100011 From: Jamin Lin DMA length is from 1 byte to 32MB for AST2600 and AST10x0 and DMA length is from 4 bytes to 32MB for AST2500. In other words, if "R_DMA_LEN" is 0, it should move at least 1 byte data for AST2600 and AST10x0 and 4 bytes data for AST2500. To support all ASPEED SOCs, adds dma_start_length parameter to store the start length, add helper routines function to compute the dma length and update DMA_LENGTH mask to "1FFFFFF" to support dma 1 byte length unit for AST2600 and AST1030. Currently, only supports dma length 4 bytes aligned. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 43 ++++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index 8791cc0ecb11..d305ce2e2fea 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -107,6 +107,7 @@ struct AspeedSMCClass { uint32_t features; hwaddr dma_flash_mask; hwaddr dma_dram_mask; + uint32_t dma_start_length; uint32_t nregs; uint32_t (*segment_to_reg)(const AspeedSMCState *s, const AspeedSegments *seg); diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index fe1cd96b803a..0b8488a113db 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -178,13 +178,17 @@ * DMA flash addresses should be 4 bytes aligned and the valid address * range is 0x20000000 - 0x2FFFFFFF. * - * DMA length is from 4 bytes to 32MB + * DMA length is from 4 bytes to 32MB (AST2500) * 0: 4 bytes - * 0x7FFFFF: 32M bytes + * 0x1FFFFFC: 32M bytes + * + * DMA length is from 1 byte to 32MB (AST2600, AST10x0) + * 0: 1 byte + * 0x1FFFFFF: 32M bytes */ #define DMA_DRAM_ADDR(asc, val) ((val) & (asc)->dma_dram_mask) #define DMA_FLASH_ADDR(asc, val) ((val) & (asc)->dma_flash_mask) -#define DMA_LENGTH(val) ((val) & 0x01FFFFFC) +#define DMA_LENGTH(val) ((val) & 0x01FFFFFF) =20 /* Flash opcodes. */ #define SPI_OP_READ 0x03 /* Read data bytes (low frequency) */ @@ -843,6 +847,13 @@ static bool aspeed_smc_inject_read_failure(AspeedSMCSt= ate *s) } } =20 +static uint32_t aspeed_smc_dma_len(AspeedSMCState *s) +{ + AspeedSMCClass *asc =3D ASPEED_SMC_GET_CLASS(s); + + return QEMU_ALIGN_UP(s->regs[R_DMA_LEN] + asc->dma_start_length, 4); +} + /* * Accumulate the result of the reads to provide a checksum that will * be used to validate the read timing settings. @@ -850,6 +861,7 @@ static bool aspeed_smc_inject_read_failure(AspeedSMCSta= te *s) static void aspeed_smc_dma_checksum(AspeedSMCState *s) { MemTxResult result; + uint32_t dma_len; uint32_t data; =20 if (s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE) { @@ -861,7 +873,9 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s) aspeed_smc_dma_calibration(s); } =20 - while (s->regs[R_DMA_LEN]) { + dma_len =3D aspeed_smc_dma_len(s); + + while (dma_len) { data =3D address_space_ldl_le(&s->flash_as, s->regs[R_DMA_FLASH_AD= DR], MEMTXATTRS_UNSPECIFIED, &result); if (result !=3D MEMTX_OK) { @@ -877,7 +891,8 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s) */ s->regs[R_DMA_CHECKSUM] +=3D data; s->regs[R_DMA_FLASH_ADDR] +=3D 4; - s->regs[R_DMA_LEN] -=3D 4; + dma_len -=3D 4; + s->regs[R_DMA_LEN] =3D dma_len; } =20 if (s->inject_failure && aspeed_smc_inject_read_failure(s)) { @@ -889,14 +904,17 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s) static void aspeed_smc_dma_rw(AspeedSMCState *s) { MemTxResult result; + uint32_t dma_len; uint32_t data; =20 + dma_len =3D aspeed_smc_dma_len(s); + trace_aspeed_smc_dma_rw(s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE ? "write" : "read", s->regs[R_DMA_FLASH_ADDR], s->regs[R_DMA_DRAM_ADDR], - s->regs[R_DMA_LEN]); - while (s->regs[R_DMA_LEN]) { + dma_len); + while (dma_len) { if (s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE) { data =3D address_space_ldl_le(&s->dram_as, s->regs[R_DMA_DRAM_= ADDR], MEMTXATTRS_UNSPECIFIED, &result); @@ -937,7 +955,8 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) */ s->regs[R_DMA_FLASH_ADDR] +=3D 4; s->regs[R_DMA_DRAM_ADDR] +=3D 4; - s->regs[R_DMA_LEN] -=3D 4; + dma_len -=3D 4; + s->regs[R_DMA_LEN] =3D dma_len; s->regs[R_DMA_CHECKSUM] +=3D data; } } @@ -1382,6 +1401,7 @@ static void aspeed_2400_fmc_class_init(ObjectClass *k= lass, void *data) asc->features =3D ASPEED_SMC_FEATURE_DMA; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x1FFFFFFC; + asc->dma_start_length =3D 4; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; @@ -1465,6 +1485,7 @@ static void aspeed_2500_fmc_class_init(ObjectClass *k= lass, void *data) asc->features =3D ASPEED_SMC_FEATURE_DMA; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x3FFFFFFC; + asc->dma_start_length =3D 4; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; @@ -1621,6 +1642,7 @@ static void aspeed_2600_fmc_class_init(ObjectClass *k= lass, void *data) ASPEED_SMC_FEATURE_WDT_CONTROL; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x3FFFFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; @@ -1659,6 +1681,7 @@ static void aspeed_2600_spi1_class_init(ObjectClass *= klass, void *data) ASPEED_SMC_FEATURE_DMA_GRANT; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x3FFFFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; @@ -1698,6 +1721,7 @@ static void aspeed_2600_spi2_class_init(ObjectClass *= klass, void *data) ASPEED_SMC_FEATURE_DMA_GRANT; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x3FFFFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; @@ -1779,6 +1803,7 @@ static void aspeed_1030_fmc_class_init(ObjectClass *k= lass, void *data) asc->features =3D ASPEED_SMC_FEATURE_DMA; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x000BFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_1030_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_1030_smc_reg_to_segment; @@ -1816,6 +1841,7 @@ static void aspeed_1030_spi1_class_init(ObjectClass *= klass, void *data) asc->features =3D ASPEED_SMC_FEATURE_DMA; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x000BFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; @@ -1852,6 +1878,7 @@ static void aspeed_1030_spi2_class_init(ObjectClass *= klass, void *data) asc->features =3D ASPEED_SMC_FEATURE_DMA; asc->dma_flash_mask =3D 0x0FFFFFFC; asc->dma_dram_mask =3D 0x000BFFFC; + asc->dma_start_length =3D 1; asc->nregs =3D ASPEED_SMC_R_MAX; asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350209; cv=none; d=zohomail.com; s=zohoarc; b=cdt51tGUiV1W2Pm/wAhRWraBuwYPmnQSKIFRbJoeMQ9ToGlnH1slLyudQwjPZlmVmZr3YSIoL9u+Uv34UD7RInfE/Sajgrmd1vOzATWEfcvlZhsDLlU0/1MGbGBcyJiYtyw0ivFiT4+JRZ2TktxNbJS9TtnuQXclwbPZdE5sK94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350209; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=50UHzxju/vgPYUlhxAkVmjUy9/fEsWgJ8psibIW6p6M=; b=EfYllA4IwzWQ6mruB6s3GLEB2zooel7BwNz13An7ihk55aFBK8Dp7J7wjlnJpc9d0Ly7xDZ+D8R6ZAH9jcjmX8uR5F+DQr2JXoMLiskDQfQpeYMb0pV+//HHQvt59EMYiX4uzGh+h6+jQNkMNWWIQmHmFzdDtiu44uTfeX8jEOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350209703441.2163796780526; Fri, 14 Jun 2024 00:30:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Lr-0003Sj-2i; Fri, 14 Jun 2024 03:27:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lp-0003Rs-PQ for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lo-0000nW-58 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:57 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-QBcrtVykMnKADnF845hlkQ-1; Fri, 14 Jun 2024 03:27:46 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF64319560B9; Fri, 14 Jun 2024 07:27:44 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 210D3300021A; Fri, 14 Jun 2024 07:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350075; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50UHzxju/vgPYUlhxAkVmjUy9/fEsWgJ8psibIW6p6M=; b=UcjQE/d2Q4g8IuCXxxQGmzYwgDHCeZEsrCINNfwTWUjmrda5vla8Ie6aa7aYfU/Abn/tbY Kdu4dM6q/TZhWNWeU+MGg0mjxTH3MH3CBZUmjR0Zn4e3ANson/5I44dISIvsIdjYc7Ed8r Lv8TMWiPVcuo9oKNwG5fQ2gtg9jtiDM= X-MC-Unique: QBcrtVykMnKADnF845hlkQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 09/19] aspeed/smc: support 64 bits dma dram address Date: Fri, 14 Jun 2024 09:26:10 +0200 Message-ID: <20240614072620.1262053-10-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350210585100002 From: Jamin Lin AST2700 support the maximum dram size is 8GiB and has a "DMA DRAM Side Address High Part(0x7C)" register to support 64 bits dma dram address. Add helper routines functions to compute the dma dram address, new features and update trace-event to support 64 bits dram address. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/ssi/aspeed_smc.c | 51 ++++++++++++++++++++++++++++++++++++++------- hw/ssi/trace-events | 2 +- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 0b8488a113db..df0c63469cd7 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -132,6 +132,9 @@ #define FMC_WDT2_CTRL_BOOT_SOURCE BIT(4) /* O: primary 1: alternate= */ #define FMC_WDT2_CTRL_EN BIT(0) =20 +/* DMA DRAM Side Address High Part (AST2700) */ +#define R_DMA_DRAM_ADDR_HIGH (0x7c / 4) + /* DMA Control/Status Register */ #define R_DMA_CTRL (0x80 / 4) #define DMA_CTRL_REQUEST (1 << 31) @@ -187,6 +190,7 @@ * 0x1FFFFFF: 32M bytes */ #define DMA_DRAM_ADDR(asc, val) ((val) & (asc)->dma_dram_mask) +#define DMA_DRAM_ADDR_HIGH(val) ((val) & 0xf) #define DMA_FLASH_ADDR(asc, val) ((val) & (asc)->dma_flash_mask) #define DMA_LENGTH(val) ((val) & 0x01FFFFFF) =20 @@ -207,6 +211,7 @@ static const AspeedSegments aspeed_2500_spi2_segments[]; #define ASPEED_SMC_FEATURE_DMA 0x1 #define ASPEED_SMC_FEATURE_DMA_GRANT 0x2 #define ASPEED_SMC_FEATURE_WDT_CONTROL 0x4 +#define ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH 0x08 =20 static inline bool aspeed_smc_has_dma(const AspeedSMCClass *asc) { @@ -218,6 +223,11 @@ static inline bool aspeed_smc_has_wdt_control(const As= peedSMCClass *asc) return !!(asc->features & ASPEED_SMC_FEATURE_WDT_CONTROL); } =20 +static inline bool aspeed_smc_has_dma64(const AspeedSMCClass *asc) +{ + return !!(asc->features & ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH); +} + #define aspeed_smc_error(fmt, ...) \ qemu_log_mask(LOG_GUEST_ERROR, "%s: " fmt "\n", __func__, ## __VA_ARGS= __) =20 @@ -747,6 +757,8 @@ static uint64_t aspeed_smc_read(void *opaque, hwaddr ad= dr, unsigned int size) (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_CTRL) || (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_FLASH_ADDR) || (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_DRAM_ADDR) || + (aspeed_smc_has_dma(asc) && aspeed_smc_has_dma64(asc) && + addr =3D=3D R_DMA_DRAM_ADDR_HIGH) || (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_LEN) || (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_CHECKSUM) || (addr >=3D R_SEG_ADDR0 && @@ -847,6 +859,12 @@ static bool aspeed_smc_inject_read_failure(AspeedSMCSt= ate *s) } } =20 +static uint64_t aspeed_smc_dma_dram_addr(AspeedSMCState *s) +{ + return s->regs[R_DMA_DRAM_ADDR] | + ((uint64_t) s->regs[R_DMA_DRAM_ADDR_HIGH] << 32); +} + static uint32_t aspeed_smc_dma_len(AspeedSMCState *s) { AspeedSMCClass *asc =3D ASPEED_SMC_GET_CLASS(s); @@ -903,24 +921,34 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s) =20 static void aspeed_smc_dma_rw(AspeedSMCState *s) { + AspeedSMCClass *asc =3D ASPEED_SMC_GET_CLASS(s); + uint64_t dma_dram_offset; + uint64_t dma_dram_addr; MemTxResult result; uint32_t dma_len; uint32_t data; =20 dma_len =3D aspeed_smc_dma_len(s); + dma_dram_addr =3D aspeed_smc_dma_dram_addr(s); + + if (aspeed_smc_has_dma64(asc)) { + dma_dram_offset =3D dma_dram_addr - s->dram_base; + } else { + dma_dram_offset =3D dma_dram_addr; + } =20 trace_aspeed_smc_dma_rw(s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE ? "write" : "read", s->regs[R_DMA_FLASH_ADDR], - s->regs[R_DMA_DRAM_ADDR], + dma_dram_offset, dma_len); while (dma_len) { if (s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE) { - data =3D address_space_ldl_le(&s->dram_as, s->regs[R_DMA_DRAM_= ADDR], + data =3D address_space_ldl_le(&s->dram_as, dma_dram_offset, MEMTXATTRS_UNSPECIFIED, &result); if (result !=3D MEMTX_OK) { - aspeed_smc_error("DRAM read failed @%08x", - s->regs[R_DMA_DRAM_ADDR]); + aspeed_smc_error("DRAM read failed @%" PRIx64, + dma_dram_offset); return; } =20 @@ -940,11 +968,11 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) return; } =20 - address_space_stl_le(&s->dram_as, s->regs[R_DMA_DRAM_ADDR], + address_space_stl_le(&s->dram_as, dma_dram_offset, data, MEMTXATTRS_UNSPECIFIED, &result); if (result !=3D MEMTX_OK) { - aspeed_smc_error("DRAM write failed @%08x", - s->regs[R_DMA_DRAM_ADDR]); + aspeed_smc_error("DRAM write failed @%" PRIx64, + dma_dram_offset); return; } } @@ -953,8 +981,12 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) * When the DMA is on-going, the DMA registers are updated * with the current working addresses and length. */ + dma_dram_offset +=3D 4; + dma_dram_addr +=3D 4; + + s->regs[R_DMA_DRAM_ADDR_HIGH] =3D dma_dram_addr >> 32; + s->regs[R_DMA_DRAM_ADDR] =3D dma_dram_addr & 0xffffffff; s->regs[R_DMA_FLASH_ADDR] +=3D 4; - s->regs[R_DMA_DRAM_ADDR] +=3D 4; dma_len -=3D 4; s->regs[R_DMA_LEN] =3D dma_len; s->regs[R_DMA_CHECKSUM] +=3D data; @@ -1107,6 +1139,9 @@ static void aspeed_smc_write(void *opaque, hwaddr add= r, uint64_t data, } else if (aspeed_smc_has_dma(asc) && addr =3D=3D R_DMA_LEN && aspeed_smc_dma_granted(s)) { s->regs[addr] =3D DMA_LENGTH(value); + } else if (aspeed_smc_has_dma(asc) && aspeed_smc_has_dma64(asc) && + addr =3D=3D R_DMA_DRAM_ADDR_HIGH) { + s->regs[addr] =3D DMA_DRAM_ADDR_HIGH(value); } else { qemu_log_mask(LOG_UNIMP, "%s: not implemented: 0x%" HWADDR_PRIx "\= n", __func__, addr); diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events index 2d5bd2b83d0c..7b5ad6a939e3 100644 --- a/hw/ssi/trace-events +++ b/hw/ssi/trace-events @@ -6,7 +6,7 @@ aspeed_smc_do_snoop(int cs, int index, int dummies, int dat= a) "CS%d index:0x%x d aspeed_smc_flash_write(int cs, uint64_t addr, uint32_t size, uint64_t dat= a, int mode) "CS%d @0x%" PRIx64 " size %u: 0x%" PRIx64" mode:%d" aspeed_smc_read(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx6= 4 " size %u: 0x%" PRIx64 aspeed_smc_dma_checksum(uint32_t addr, uint32_t data) "0x%08x: 0x%08x" -aspeed_smc_dma_rw(const char *dir, uint32_t flash_addr, uint32_t dram_addr= , uint32_t size) "%s flash:@0x%08x dram:@0x%08x size:0x%08x" +aspeed_smc_dma_rw(const char *dir, uint32_t flash_addr, uint64_t dram_addr= , uint32_t size) "%s flash:@0x%08x dram:@0x%" PRIx64 " size:0x%08x" aspeed_smc_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx= 64 " size %u: 0x%" PRIx64 aspeed_smc_flash_select(int cs, const char *prefix) "CS%d %sselect" =20 --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350239; cv=none; d=zohomail.com; s=zohoarc; b=oAvoalvYzD78lgL+skBbNQuPl90115XABIvNSeaUBMkwWmSIq9OAflrzibD8FewjKKgGfgWGSlG6bBxDD9dKIQq+zsXMtjjM1FXSeN0Cyx4wGdwMUiToAkjVAwMN230j/REB3wVKZcDbnrp6On1NB1WN8qckWNQBGf/pBxWhBg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350239; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vp7XFPXMEU1Dwul92dfTaHpOSahTq3QmMtYEQzsSdfk=; b=O4q1u9OjW/oekngWDPqrRijiNNU+2bT4JWxYL394cJjjUL0w7VjVMdzeL5SeNaZEKk++igtm+A0h1ksQ9hO9f0WBBZo9ypRlgWp/WMe+nlEsztmG+neSSTbp2bP6azsaG84sGoU1/ZCo/Nuic/urhhtIieI4EaZvf7V6aBZ6T2I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350239338323.4002341166115; Fri, 14 Jun 2024 00:30:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Ln-0003Nx-9q; Fri, 14 Jun 2024 03:27:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lm-0003Kz-Ag for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lk-0000mi-4h for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:27:54 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-445-FbDwJRtGOXKtxsmsa2hXMQ-1; Fri, 14 Jun 2024 03:27:47 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D3E84195608B; Fri, 14 Jun 2024 07:27:46 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2FF943000222; Fri, 14 Jun 2024 07:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vp7XFPXMEU1Dwul92dfTaHpOSahTq3QmMtYEQzsSdfk=; b=YJOwvJm/09NC8PF2TH4I5f0LxdOAUmi7+gMLMdfooOJBOHQCyq9J8XueEe+A1+CvqVP9Xq zQs3gTI8bW/JqkmslG7wy/Aud4IoXdDgKNvVPMPO+HvstCvUp2vGP+YKDbQTkPIG+NyNfk Y1ns79cX3cBMdlzckra0S86tGkUnxy0= X-MC-Unique: FbDwJRtGOXKtxsmsa2hXMQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 10/19] aspeed/smc: support different memory region ops for SMC flash region Date: Fri, 14 Jun 2024 09:26:11 +0200 Message-ID: <20240614072620.1262053-11-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350240706100002 From: Jamin Lin It set "aspeed_smc_flash_ops" struct which containing read and write callbacks to be used when I/O is performed on the SMC flash region. And it set the valid max_access_size 4 by default for all ASPEED SMC models. However, the valid max_access_size 4 only support 32 bits CPUs. To support all ASPEED SMC model, introduce a new "const MemoryRegionOps *" attribute in AspeedSMCClass and use it in aspeed_smc_flash_realize function. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/ssi/aspeed_smc.h | 1 + hw/ssi/aspeed_smc.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h index d305ce2e2fea..234dca32b017 100644 --- a/include/hw/ssi/aspeed_smc.h +++ b/include/hw/ssi/aspeed_smc.h @@ -115,6 +115,7 @@ struct AspeedSMCClass { AspeedSegments *seg); void (*dma_ctrl)(AspeedSMCState *s, uint32_t value); int (*addr_width)(const AspeedSMCState *s); + const MemoryRegionOps *reg_ops; }; =20 #endif /* ASPEED_SMC_H */ diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index df0c63469cd7..129d06690d36 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -1316,7 +1316,7 @@ static void aspeed_smc_flash_realize(DeviceState *dev= , Error **errp) * Use the default segment value to size the memory region. This * can be changed by FW at runtime. */ - memory_region_init_io(&s->mmio, OBJECT(s), &aspeed_smc_flash_ops, + memory_region_init_io(&s->mmio, OBJECT(s), s->asc->reg_ops, s, name, s->asc->segments[s->cs].size); sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); } @@ -1391,6 +1391,7 @@ static void aspeed_2400_smc_class_init(ObjectClass *k= lass, void *data) asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2400_smc_info =3D { @@ -1441,6 +1442,7 @@ static void aspeed_2400_fmc_class_init(ObjectClass *k= lass, void *data) asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2400_fmc_info =3D { @@ -1480,6 +1482,7 @@ static void aspeed_2400_spi1_class_init(ObjectClass *= klass, void *data) asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; asc->addr_width =3D aspeed_2400_spi1_addr_width; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2400_spi1_info =3D { @@ -1525,6 +1528,7 @@ static void aspeed_2500_fmc_class_init(ObjectClass *k= lass, void *data) asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2500_fmc_info =3D { @@ -1560,6 +1564,7 @@ static void aspeed_2500_spi1_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2500_spi1_info =3D { @@ -1595,6 +1600,7 @@ static void aspeed_2500_spi2_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2500_spi2_info =3D { @@ -1682,6 +1688,7 @@ static void aspeed_2600_fmc_class_init(ObjectClass *k= lass, void *data) asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2600_fmc_info =3D { @@ -1721,6 +1728,7 @@ static void aspeed_2600_spi1_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2600_spi1_info =3D { @@ -1761,6 +1769,7 @@ static void aspeed_2600_spi2_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_2600_spi2_info =3D { @@ -1843,6 +1852,7 @@ static void aspeed_1030_fmc_class_init(ObjectClass *k= lass, void *data) asc->segment_to_reg =3D aspeed_1030_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_1030_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_1030_fmc_info =3D { @@ -1881,6 +1891,7 @@ static void aspeed_1030_spi1_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_1030_spi1_info =3D { @@ -1918,6 +1929,7 @@ static void aspeed_1030_spi2_class_init(ObjectClass *= klass, void *data) asc->segment_to_reg =3D aspeed_2600_smc_segment_to_reg; asc->reg_to_segment =3D aspeed_2600_smc_reg_to_segment; asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_smc_flash_ops; } =20 static const TypeInfo aspeed_1030_spi2_info =3D { --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350112; cv=none; d=zohomail.com; s=zohoarc; b=QHK39ZuAavsaLnuc+Cocw+y9jJqon0HwXvTsPsaU8QjJwSA2Cj23onbnL+DoXsrxlo9RI5zleq0mmVwgroHVLeOEVpI2thpwJmrB3q548PWmjpm4M2BcI3aCR9jv8uyLNAT34m1PszCGtj1jIz3mYMNGFaNm1Wpq1hxlVHHBpkM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350112; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mHYjj6xTVqULwYhf+vn1Jxw3e4hRDsjf++C3P7WZwn0=; b=daI1qlVFuC0hycf+wWX6QdiyziwE46/voiV0/i2AJJhJSszh8VYNamxCmpchTY0+VlzkTca5vAsNNrYe77Z4NfZbmPELfmGfPyl5u7Ptq5znUyIqxVUf1BGRx58gZBbvnnZIIarelmSdo/wOyNgZIJf9gC8JPehB8e9e9IFIiWw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171835011201122.254226345354255; Fri, 14 Jun 2024 00:28:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Lw-0003gU-AX; Fri, 14 Jun 2024 03:28:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lu-0003dU-3H for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lq-0000o2-QK for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:01 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-HLuNhVBhMkeXczyMOLB5bg-1; Fri, 14 Jun 2024 03:27:50 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E43A11956095; Fri, 14 Jun 2024 07:27:48 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3F627300021A; Fri, 14 Jun 2024 07:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mHYjj6xTVqULwYhf+vn1Jxw3e4hRDsjf++C3P7WZwn0=; b=eRDI5fRpV/9uqX9e9lIPET00mqt4CgaNKKgc6OYA3sKCsxupFsIBGBRcHA6Ta56pvOAp9u LE0SAgzKIRBtKCpbS+T6txrgL5XJ8/76vfknRsodHeos1Ddw9kj5deBsrEtRjcixTt6bUf bwRMBM2cZMglYziEin5HP4GZTXivLrA= X-MC-Unique: HLuNhVBhMkeXczyMOLB5bg-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 11/19] aspeed/smc: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:12 +0200 Message-ID: <20240614072620.1262053-12-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350113154100001 From: Jamin Lin AST2700 fmc/spi controller's address decoding unit is 64KB and only bits [31:16] are used for decoding. Introduce seg_to_reg and reg_to_seg handlers for ast2700 fmc/spi controller. In addition, adds ast2700 fmc, spi0, spi1, and spi2 class init handler. AST2700 is a 64 bits quad core CPUs(Cortex-a35). Introduce a new "aspeed_2700_smc_flash_ops" and set its valid "max_access_size" 8 for 64 bits data format access. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/ssi/aspeed_smc.c | 234 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 233 insertions(+), 1 deletion(-) diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c index 129d06690d36..49205ab76d38 100644 --- a/hw/ssi/aspeed_smc.c +++ b/hw/ssi/aspeed_smc.c @@ -185,7 +185,7 @@ * 0: 4 bytes * 0x1FFFFFC: 32M bytes * - * DMA length is from 1 byte to 32MB (AST2600, AST10x0) + * DMA length is from 1 byte to 32MB (AST2600, AST10x0 and AST2700) * 0: 1 byte * 0x1FFFFFF: 32M bytes */ @@ -1938,6 +1938,234 @@ static const TypeInfo aspeed_1030_spi2_info =3D { .class_init =3D aspeed_1030_spi2_class_init, }; =20 +/* + * The FMC Segment Registers of the AST2700 have a 64KB unit. + * Only bits [31:16] are used for decoding. + */ +#define AST2700_SEG_ADDR_MASK 0xffff0000 + +static uint32_t aspeed_2700_smc_segment_to_reg(const AspeedSMCState *s, + const AspeedSegments *seg) +{ + uint32_t reg =3D 0; + + /* Disabled segments have a nil register */ + if (!seg->size) { + return 0; + } + + reg |=3D (seg->addr & AST2700_SEG_ADDR_MASK) >> 16; /* start offset */ + reg |=3D (seg->addr + seg->size - 1) & AST2700_SEG_ADDR_MASK; /* end o= ffset */ + return reg; +} + +static void aspeed_2700_smc_reg_to_segment(const AspeedSMCState *s, + uint32_t reg, AspeedSegments *s= eg) +{ + uint32_t start_offset =3D (reg << 16) & AST2700_SEG_ADDR_MASK; + uint32_t end_offset =3D reg & AST2700_SEG_ADDR_MASK; + AspeedSMCClass *asc =3D ASPEED_SMC_GET_CLASS(s); + + if (reg) { + seg->addr =3D asc->flash_window_base + start_offset; + seg->size =3D end_offset + (64 * KiB) - start_offset; + } else { + seg->addr =3D asc->flash_window_base; + seg->size =3D 0; + } +} + +static const uint32_t aspeed_2700_fmc_resets[ASPEED_SMC_R_MAX] =3D { + [R_CONF] =3D (CONF_FLASH_TYPE_SPI << CONF_FLASH_TYPE0 | + CONF_FLASH_TYPE_SPI << CONF_FLASH_TYPE1), + [R_CE_CTRL] =3D 0x0000aa00, + [R_CTRL0] =3D 0x406b0641, + [R_CTRL1] =3D 0x00000400, + [R_CTRL2] =3D 0x00000400, + [R_CTRL3] =3D 0x00000400, + [R_SEG_ADDR0] =3D 0x08000000, + [R_SEG_ADDR1] =3D 0x10000800, + [R_SEG_ADDR2] =3D 0x00000000, + [R_SEG_ADDR3] =3D 0x00000000, + [R_DUMMY_DATA] =3D 0x00010000, + [R_DMA_DRAM_ADDR_HIGH] =3D 0x00000000, + [R_TIMINGS] =3D 0x007b0000, +}; + +static const MemoryRegionOps aspeed_2700_smc_flash_ops =3D { + .read =3D aspeed_smc_flash_read, + .write =3D aspeed_smc_flash_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + }, +}; + +static const AspeedSegments aspeed_2700_fmc_segments[] =3D { + { 0x0, 128 * MiB }, /* start address is readonly */ + { 128 * MiB, 128 * MiB }, /* default is disabled but needed for -kerne= l */ + { 256 * MiB, 128 * MiB }, /* default is disabled but needed for -kerne= l */ + { 0x0, 0 }, /* disabled */ +}; + +static void aspeed_2700_fmc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); + + dc->desc =3D "Aspeed 2700 FMC Controller"; + asc->r_conf =3D R_CONF; + asc->r_ce_ctrl =3D R_CE_CTRL; + asc->r_ctrl0 =3D R_CTRL0; + asc->r_timings =3D R_TIMINGS; + asc->nregs_timings =3D 3; + asc->conf_enable_w0 =3D CONF_ENABLE_W0; + asc->cs_num_max =3D 3; + asc->segments =3D aspeed_2700_fmc_segments; + asc->segment_addr_mask =3D 0xffffffff; + asc->resets =3D aspeed_2700_fmc_resets; + asc->flash_window_base =3D 0x100000000; + asc->flash_window_size =3D 1 * GiB; + asc->features =3D ASPEED_SMC_FEATURE_DMA | + ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH; + asc->dma_flash_mask =3D 0x2FFFFFFC; + asc->dma_dram_mask =3D 0xFFFFFFFC; + asc->dma_start_length =3D 1; + asc->nregs =3D ASPEED_SMC_R_MAX; + asc->segment_to_reg =3D aspeed_2700_smc_segment_to_reg; + asc->reg_to_segment =3D aspeed_2700_smc_reg_to_segment; + asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_2700_smc_flash_ops; +} + +static const TypeInfo aspeed_2700_fmc_info =3D { + .name =3D "aspeed.fmc-ast2700", + .parent =3D TYPE_ASPEED_SMC, + .class_init =3D aspeed_2700_fmc_class_init, +}; + +static const AspeedSegments aspeed_2700_spi0_segments[] =3D { + { 0x0, 128 * MiB }, /* start address is readonly */ + { 128 * MiB, 128 * MiB }, /* start address is readonly */ + { 0x0, 0 }, /* disabled */ +}; + +static void aspeed_2700_spi0_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); + + dc->desc =3D "Aspeed 2700 SPI0 Controller"; + asc->r_conf =3D R_CONF; + asc->r_ce_ctrl =3D R_CE_CTRL; + asc->r_ctrl0 =3D R_CTRL0; + asc->r_timings =3D R_TIMINGS; + asc->nregs_timings =3D 2; + asc->conf_enable_w0 =3D CONF_ENABLE_W0; + asc->cs_num_max =3D 2; + asc->segments =3D aspeed_2700_spi0_segments; + asc->segment_addr_mask =3D 0xffffffff; + asc->flash_window_base =3D 0x180000000; + asc->flash_window_size =3D 1 * GiB; + asc->features =3D ASPEED_SMC_FEATURE_DMA | + ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH; + asc->dma_flash_mask =3D 0x2FFFFFFC; + asc->dma_dram_mask =3D 0xFFFFFFFC; + asc->dma_start_length =3D 1; + asc->nregs =3D ASPEED_SMC_R_MAX; + asc->segment_to_reg =3D aspeed_2700_smc_segment_to_reg; + asc->reg_to_segment =3D aspeed_2700_smc_reg_to_segment; + asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_2700_smc_flash_ops; +} + +static const TypeInfo aspeed_2700_spi0_info =3D { + .name =3D "aspeed.spi0-ast2700", + .parent =3D TYPE_ASPEED_SMC, + .class_init =3D aspeed_2700_spi0_class_init, +}; + +static const AspeedSegments aspeed_2700_spi1_segments[] =3D { + { 0x0, 128 * MiB }, /* start address is readonly */ + { 0x0, 0 }, /* disabled */ +}; + +static void aspeed_2700_spi1_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); + + dc->desc =3D "Aspeed 2700 SPI1 Controller"; + asc->r_conf =3D R_CONF; + asc->r_ce_ctrl =3D R_CE_CTRL; + asc->r_ctrl0 =3D R_CTRL0; + asc->r_timings =3D R_TIMINGS; + asc->nregs_timings =3D 2; + asc->conf_enable_w0 =3D CONF_ENABLE_W0; + asc->cs_num_max =3D 2; + asc->segments =3D aspeed_2700_spi1_segments; + asc->segment_addr_mask =3D 0xffffffff; + asc->flash_window_base =3D 0x200000000; + asc->flash_window_size =3D 1 * GiB; + asc->features =3D ASPEED_SMC_FEATURE_DMA | + ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH; + asc->dma_flash_mask =3D 0x2FFFFFFC; + asc->dma_dram_mask =3D 0xFFFFFFFC; + asc->dma_start_length =3D 1; + asc->nregs =3D ASPEED_SMC_R_MAX; + asc->segment_to_reg =3D aspeed_2700_smc_segment_to_reg; + asc->reg_to_segment =3D aspeed_2700_smc_reg_to_segment; + asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_2700_smc_flash_ops; +} + +static const TypeInfo aspeed_2700_spi1_info =3D { + .name =3D "aspeed.spi1-ast2700", + .parent =3D TYPE_ASPEED_SMC, + .class_init =3D aspeed_2700_spi1_class_init, +}; + +static const AspeedSegments aspeed_2700_spi2_segments[] =3D { + { 0x0, 128 * MiB }, /* start address is readonly */ + { 0x0, 0 }, /* disabled */ +}; + +static void aspeed_2700_spi2_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSMCClass *asc =3D ASPEED_SMC_CLASS(klass); + + dc->desc =3D "Aspeed 2700 SPI2 Controller"; + asc->r_conf =3D R_CONF; + asc->r_ce_ctrl =3D R_CE_CTRL; + asc->r_ctrl0 =3D R_CTRL0; + asc->r_timings =3D R_TIMINGS; + asc->nregs_timings =3D 2; + asc->conf_enable_w0 =3D CONF_ENABLE_W0; + asc->cs_num_max =3D 2; + asc->segments =3D aspeed_2700_spi2_segments; + asc->segment_addr_mask =3D 0xffffffff; + asc->flash_window_base =3D 0x280000000; + asc->flash_window_size =3D 1 * GiB; + asc->features =3D ASPEED_SMC_FEATURE_DMA | + ASPEED_SMC_FEATURE_DMA_DRAM_ADDR_HIGH; + asc->dma_flash_mask =3D 0x0FFFFFFC; + asc->dma_dram_mask =3D 0xFFFFFFFC; + asc->dma_start_length =3D 1; + asc->nregs =3D ASPEED_SMC_R_MAX; + asc->segment_to_reg =3D aspeed_2700_smc_segment_to_reg; + asc->reg_to_segment =3D aspeed_2700_smc_reg_to_segment; + asc->dma_ctrl =3D aspeed_2600_smc_dma_ctrl; + asc->reg_ops =3D &aspeed_2700_smc_flash_ops; +} + +static const TypeInfo aspeed_2700_spi2_info =3D { + .name =3D "aspeed.spi2-ast2700", + .parent =3D TYPE_ASPEED_SMC, + .class_init =3D aspeed_2700_spi2_class_init, +}; + static void aspeed_smc_register_types(void) { type_register_static(&aspeed_smc_flash_info); @@ -1954,6 +2182,10 @@ static void aspeed_smc_register_types(void) type_register_static(&aspeed_1030_fmc_info); type_register_static(&aspeed_1030_spi1_info); type_register_static(&aspeed_1030_spi2_info); + type_register_static(&aspeed_2700_fmc_info); + type_register_static(&aspeed_2700_spi0_info); + type_register_static(&aspeed_2700_spi1_info); + type_register_static(&aspeed_2700_spi2_info); } =20 type_init(aspeed_smc_register_types) --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350185; cv=none; d=zohomail.com; s=zohoarc; b=F/wlhBC4hbIGnuyvPRPU3W/T5wkvphQIKmI0bLmgomT9t2rOI39HPmibr63CcVZE9T2i1iSKkhoZQpefzmPzBkvHiqJdx5qkyLulzOuYVMbVwJMSW/yQ6iC36TTM6BBLkJILEyesp5X6wMmyrmKH4xykUf5fSN6OfYu0jm0fKSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350185; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VFBy8wTmZ0Z+ivMqaCINY72LkpsM6vY8kBFB+mQtCUc=; b=dxoNj2aYcxqIT2vKulMH3rduRTQkyoXoqYxgLgu/81MaPMZJWjlv9p5IBd16J45ZIoTcTllXh4+6yWKaBNr1+qMvlqABVVeK3OGhz06ryT3j397hdmGNxCEUXDw8tw9n/RAZZqEgkV2JDa+Tvq9NOKGxkxAs6MX4GpzuvIwRCdo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350185618475.30830594025065; Fri, 14 Jun 2024 00:29:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Lt-0003cR-Sv; Fri, 14 Jun 2024 03:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Ls-0003TP-98 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lq-0000nl-0I for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:00 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-477-oSnUkc4_MT6ocJrcVFzfZQ-1; Fri, 14 Jun 2024 03:27:52 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 550A11956096; Fri, 14 Jun 2024 07:27:51 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F3983000225; Fri, 14 Jun 2024 07:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350077; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VFBy8wTmZ0Z+ivMqaCINY72LkpsM6vY8kBFB+mQtCUc=; b=DrWIVTujOniPbL32Q5TnvsatGsJNOdypYszU3Pe3ntIQz6CmdAKAuzPCgvpSuesMqPqKu9 KdJFoKwhH0kkZI8+c/2Oq9JJlYxXBnvLZ18yaLtOhcF548DL2jy3p3LMgHnpSMj5q1zm3U wWKNguIiwcqEH3Ys8AfmoNBj//6zJQs= X-MC-Unique: oSnUkc4_MT6ocJrcVFzfZQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 12/19] aspeed/scu: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:13 +0200 Message-ID: <20240614072620.1262053-13-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350186534100001 From: Jamin Lin AST2700 have two SCU controllers which are SCU and SCUIO. Both SCU and SCUIO registers are not compatible previous SOCs , introduces new registers and adds ast2700 scu, sucio class init handler. The pclk divider selection of SCUIO is defined in SCUIO280[20:18] and the pclk divider selection of SCU is defined in SCU280[25:23]. Both of them are not compatible AST2600 SOCs, adds a get_apb_freq function and trace-event for AST2700 SCU and SCUIO. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/misc/aspeed_scu.h | 47 +++++- hw/misc/aspeed_scu.c | 306 ++++++++++++++++++++++++++++++++++- hw/misc/trace-events | 4 + 3 files changed, 351 insertions(+), 6 deletions(-) diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h index 7cb6018dbc14..58db28db45aa 100644 --- a/include/hw/misc/aspeed_scu.h +++ b/include/hw/misc/aspeed_scu.h @@ -19,10 +19,13 @@ OBJECT_DECLARE_TYPE(AspeedSCUState, AspeedSCUClass, ASP= EED_SCU) #define TYPE_ASPEED_2400_SCU TYPE_ASPEED_SCU "-ast2400" #define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500" #define TYPE_ASPEED_2600_SCU TYPE_ASPEED_SCU "-ast2600" +#define TYPE_ASPEED_2700_SCU TYPE_ASPEED_SCU "-ast2700" +#define TYPE_ASPEED_2700_SCUIO TYPE_ASPEED_SCU "io" "-ast2700" #define TYPE_ASPEED_1030_SCU TYPE_ASPEED_SCU "-ast1030" =20 #define ASPEED_SCU_NR_REGS (0x1A8 >> 2) #define ASPEED_AST2600_SCU_NR_REGS (0xE20 >> 2) +#define ASPEED_AST2700_SCU_NR_REGS (0xE20 >> 2) =20 struct AspeedSCUState { /*< private >*/ @@ -31,7 +34,7 @@ struct AspeedSCUState { /*< public >*/ MemoryRegion iomem; =20 - uint32_t regs[ASPEED_AST2600_SCU_NR_REGS]; + uint32_t regs[ASPEED_AST2700_SCU_NR_REGS]; uint32_t silicon_rev; uint32_t hw_strap1; uint32_t hw_strap2; @@ -48,6 +51,9 @@ struct AspeedSCUState { #define AST2600_A3_SILICON_REV 0x05030303U #define AST1030_A0_SILICON_REV 0x80000000U #define AST1030_A1_SILICON_REV 0x80010000U +#define AST2700_A0_SILICON_REV 0x06000103U +#define AST2720_A0_SILICON_REV 0x06000203U +#define AST2750_A0_SILICON_REV 0x06000003U =20 #define ASPEED_IS_AST2500(si_rev) ((((si_rev) >> 24) & 0xff) =3D=3D 0x= 04) =20 @@ -87,7 +93,8 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); * 1. 2012/12/29 Ryan Chen Create */ =20 -/* SCU08 Clock Selection Register +/* + * SCU08 Clock Selection Register * * 31 Enable Video Engine clock dynamic slow down * 30:28 Video Engine clock slow down setting @@ -109,7 +116,8 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); */ #define SCU_CLK_GET_PCLK_DIV(x) (((x) >> 23) & 0x7) =20 -/* SCU24 H-PLL Parameter Register (for Aspeed AST2400 SOC) +/* + * SCU24 H-PLL Parameter Register (for Aspeed AST2400 SOC) * * 18 H-PLL parameter selection * 0: Select H-PLL by strapping resistors @@ -127,7 +135,8 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); #define SCU_AST2400_H_PLL_BYPASS_EN (0x1 << 17) #define SCU_AST2400_H_PLL_OFF (0x1 << 16) =20 -/* SCU24 H-PLL Parameter Register (for Aspeed AST2500 SOC) +/* + * SCU24 H-PLL Parameter Register (for Aspeed AST2500 SOC) * * 21 Enable H-PLL reset * 20 Enable H-PLL bypass mode @@ -144,7 +153,8 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); #define SCU_H_PLL_BYPASS_EN (0x1 << 20) #define SCU_H_PLL_OFF (0x1 << 19) =20 -/* SCU70 Hardware Strapping Register definition (for Aspeed AST2400 SOC) +/* + * SCU70 Hardware Strapping Register definition (for Aspeed AST2400 SOC) * * 31:29 Software defined strapping registers * 28:27 DRAM size setting (for VGA driver use) @@ -361,4 +371,31 @@ uint32_t aspeed_scu_get_apb_freq(AspeedSCUState *s); */ #define SCU_AST1030_CLK_GET_PCLK_DIV(x) (((x) >> 8) & 0= xf) =20 +/* + * SCU280 Clock Selection 1 Register (for Aspeed AST2700 SCUIO) + * + * 31:29 MHCLK_DIV + * 28 Reserved + * 27:25 RGMIICLK_DIV + * 24 Reserved + * 23:21 RMIICLK_DIV + * 20:18 PCLK_DIV + * 17:14 SDCLK_DIV + * 13 SDCLK_SEL + * 12 UART13CLK_SEL + * 11 UART12CLK_SEL + * 10 UART11CLK_SEL + * 9 UART10CLK_SEL + * 8 UART9CLK_SEL + * 7 UART8CLK_SEL + * 6 UART7CLK_SEL + * 5 UART6CLK_SEL + * 4 UARTDBCLK_SEL + * 3 UART4CLK_SEL + * 2 UART3CLK_SEL + * 1 UART2CLK_SEL + * 0 UART1CLK_SEL + */ +#define SCUIO_AST2700_CLK_GET_PCLK_DIV(x) (((x) >> 18) = & 0x7) + #endif /* ASPEED_SCU_H */ diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index 1ac04b6cb020..eb38ea8e1971 100644 --- a/hw/misc/aspeed_scu.c +++ b/hw/misc/aspeed_scu.c @@ -134,6 +134,48 @@ =20 #define AST2600_CLK TO_REG(0x40) =20 +#define AST2700_SILICON_REV TO_REG(0x00) +#define AST2700_HW_STRAP1 TO_REG(0x10) +#define AST2700_HW_STRAP1_CLR TO_REG(0x14) +#define AST2700_HW_STRAP1_LOCK TO_REG(0x20) +#define AST2700_HW_STRAP1_SEC1 TO_REG(0x24) +#define AST2700_HW_STRAP1_SEC2 TO_REG(0x28) +#define AST2700_HW_STRAP1_SEC3 TO_REG(0x2C) + +#define AST2700_SCU_CLK_SEL_1 TO_REG(0x280) +#define AST2700_SCU_HPLL_PARAM TO_REG(0x300) +#define AST2700_SCU_HPLL_EXT_PARAM TO_REG(0x304) +#define AST2700_SCU_DPLL_PARAM TO_REG(0x308) +#define AST2700_SCU_DPLL_EXT_PARAM TO_REG(0x30c) +#define AST2700_SCU_MPLL_PARAM TO_REG(0x310) +#define AST2700_SCU_MPLL_EXT_PARAM TO_REG(0x314) +#define AST2700_SCU_D1CLK_PARAM TO_REG(0x320) +#define AST2700_SCU_D2CLK_PARAM TO_REG(0x330) +#define AST2700_SCU_CRT1CLK_PARAM TO_REG(0x340) +#define AST2700_SCU_CRT2CLK_PARAM TO_REG(0x350) +#define AST2700_SCU_MPHYCLK_PARAM TO_REG(0x360) +#define AST2700_SCU_FREQ_CNTR TO_REG(0x3b0) +#define AST2700_SCU_CPU_SCRATCH_0 TO_REG(0x780) +#define AST2700_SCU_CPU_SCRATCH_1 TO_REG(0x784) + +#define AST2700_SCUIO_CLK_STOP_CTL_1 TO_REG(0x240) +#define AST2700_SCUIO_CLK_STOP_CLR_1 TO_REG(0x244) +#define AST2700_SCUIO_CLK_STOP_CTL_2 TO_REG(0x260) +#define AST2700_SCUIO_CLK_STOP_CLR_2 TO_REG(0x264) +#define AST2700_SCUIO_CLK_SEL_1 TO_REG(0x280) +#define AST2700_SCUIO_CLK_SEL_2 TO_REG(0x284) +#define AST2700_SCUIO_HPLL_PARAM TO_REG(0x300) +#define AST2700_SCUIO_HPLL_EXT_PARAM TO_REG(0x304) +#define AST2700_SCUIO_APLL_PARAM TO_REG(0x310) +#define AST2700_SCUIO_APLL_EXT_PARAM TO_REG(0x314) +#define AST2700_SCUIO_DPLL_PARAM TO_REG(0x320) +#define AST2700_SCUIO_DPLL_EXT_PARAM TO_REG(0x324) +#define AST2700_SCUIO_DPLL_PARAM_READ TO_REG(0x328) +#define AST2700_SCUIO_DPLL_EXT_PARAM_READ TO_REG(0x32c) +#define AST2700_SCUIO_UARTCLK_GEN TO_REG(0x330) +#define AST2700_SCUIO_HUARTCLK_GEN TO_REG(0x334) +#define AST2700_SCUIO_CLK_DUTY_MEAS_RST TO_REG(0x388) + #define SCU_IO_REGION_SIZE 0x1000 =20 static const uint32_t ast2400_a0_resets[ASPEED_SCU_NR_REGS] =3D { @@ -244,6 +286,25 @@ static uint32_t aspeed_1030_scu_get_apb_freq(AspeedSCU= State *s) / asc->apb_divider; } =20 +static uint32_t aspeed_2700_scu_get_apb_freq(AspeedSCUState *s) +{ + AspeedSCUClass *asc =3D ASPEED_SCU_GET_CLASS(s); + uint32_t hpll =3D asc->calc_hpll(s, s->regs[AST2700_SCU_HPLL_PARAM]); + + return hpll / (SCU_CLK_GET_PCLK_DIV(s->regs[AST2700_SCU_CLK_SEL_1]) + = 1) + / asc->apb_divider; +} + +static uint32_t aspeed_2700_scuio_get_apb_freq(AspeedSCUState *s) +{ + AspeedSCUClass *asc =3D ASPEED_SCU_GET_CLASS(s); + uint32_t hpll =3D asc->calc_hpll(s, s->regs[AST2700_SCUIO_HPLL_PARAM]); + + return hpll / + (SCUIO_AST2700_CLK_GET_PCLK_DIV(s->regs[AST2700_SCUIO_CLK_SEL_1]) = + 1) + / asc->apb_divider; +} + static uint64_t aspeed_scu_read(void *opaque, hwaddr offset, unsigned size) { AspeedSCUState *s =3D ASPEED_SCU(opaque); @@ -258,7 +319,8 @@ static uint64_t aspeed_scu_read(void *opaque, hwaddr of= fset, unsigned size) =20 switch (reg) { case RNG_DATA: - /* On hardware, RNG_DATA works regardless of + /* + * On hardware, RNG_DATA works regardless of * the state of the enable bit in RNG_CTRL */ s->regs[RNG_DATA] =3D aspeed_scu_get_random(); @@ -494,6 +556,9 @@ static uint32_t aspeed_silicon_revs[] =3D { AST2600_A3_SILICON_REV, AST1030_A0_SILICON_REV, AST1030_A1_SILICON_REV, + AST2700_A0_SILICON_REV, + AST2720_A0_SILICON_REV, + AST2750_A0_SILICON_REV, }; =20 bool is_supported_silicon_rev(uint32_t silicon_rev) @@ -783,6 +848,243 @@ static const TypeInfo aspeed_2600_scu_info =3D { .class_init =3D aspeed_2600_scu_class_init, }; =20 +static uint64_t aspeed_ast2700_scu_read(void *opaque, hwaddr offset, + unsigned size) +{ + AspeedSCUState *s =3D ASPEED_SCU(opaque); + int reg =3D TO_REG(offset); + + if (reg >=3D ASPEED_AST2700_SCU_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx "= \n", + __func__, offset); + return 0; + } + + switch (reg) { + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Unhandled read at offset 0x%" HWADDR_PRIx "\n", + __func__, offset); + } + + trace_aspeed_ast2700_scu_read(offset, size, s->regs[reg]); + return s->regs[reg]; +} + +static void aspeed_ast2700_scu_write(void *opaque, hwaddr offset, + uint64_t data64, unsigned size) +{ + AspeedSCUState *s =3D ASPEED_SCU(opaque); + int reg =3D TO_REG(offset); + /* Truncate here so bitwise operations below behave as expected */ + uint32_t data =3D data64; + + if (reg >=3D ASPEED_AST2700_SCU_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx = "\n", + __func__, offset); + return; + } + + trace_aspeed_ast2700_scu_write(offset, size, data); + + switch (reg) { + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Unhandeled write at offset 0x%" HWADDR_PRIx "\n= ", + __func__, offset); + break; + } + + s->regs[reg] =3D data; +} + +static const MemoryRegionOps aspeed_ast2700_scu_ops =3D { + .read =3D aspeed_ast2700_scu_read, + .write =3D aspeed_ast2700_scu_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 8, + .valid.unaligned =3D false, +}; + +static const uint32_t ast2700_a0_resets[ASPEED_AST2700_SCU_NR_REGS] =3D { + [AST2700_SILICON_REV] =3D AST2700_A0_SILICON_REV, + [AST2700_HW_STRAP1] =3D 0x00000800, + [AST2700_HW_STRAP1_CLR] =3D 0xFFF0FFF0, + [AST2700_HW_STRAP1_LOCK] =3D 0x00000FFF, + [AST2700_HW_STRAP1_SEC1] =3D 0x000000FF, + [AST2700_HW_STRAP1_SEC2] =3D 0x00000000, + [AST2700_HW_STRAP1_SEC3] =3D 0x1000408F, + [AST2700_SCU_HPLL_PARAM] =3D 0x0000009f, + [AST2700_SCU_HPLL_EXT_PARAM] =3D 0x8000004f, + [AST2700_SCU_DPLL_PARAM] =3D 0x0080009f, + [AST2700_SCU_DPLL_EXT_PARAM] =3D 0x8000004f, + [AST2700_SCU_MPLL_PARAM] =3D 0x00000040, + [AST2700_SCU_MPLL_EXT_PARAM] =3D 0x80000000, + [AST2700_SCU_D1CLK_PARAM] =3D 0x00050002, + [AST2700_SCU_D2CLK_PARAM] =3D 0x00050002, + [AST2700_SCU_CRT1CLK_PARAM] =3D 0x00050002, + [AST2700_SCU_CRT2CLK_PARAM] =3D 0x00050002, + [AST2700_SCU_MPHYCLK_PARAM] =3D 0x0000004c, + [AST2700_SCU_FREQ_CNTR] =3D 0x000375eb, + [AST2700_SCU_CPU_SCRATCH_0] =3D 0x00000000, + [AST2700_SCU_CPU_SCRATCH_1] =3D 0x00000004, +}; + +static void aspeed_ast2700_scu_reset(DeviceState *dev) +{ + AspeedSCUState *s =3D ASPEED_SCU(dev); + AspeedSCUClass *asc =3D ASPEED_SCU_GET_CLASS(dev); + + memcpy(s->regs, asc->resets, asc->nr_regs * 4); +} + +static void aspeed_2700_scu_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSCUClass *asc =3D ASPEED_SCU_CLASS(klass); + + dc->desc =3D "ASPEED 2700 System Control Unit"; + dc->reset =3D aspeed_ast2700_scu_reset; + asc->resets =3D ast2700_a0_resets; + asc->calc_hpll =3D aspeed_2600_scu_calc_hpll; + asc->get_apb =3D aspeed_2700_scu_get_apb_freq; + asc->apb_divider =3D 4; + asc->nr_regs =3D ASPEED_AST2700_SCU_NR_REGS; + asc->clkin_25Mhz =3D true; + asc->ops =3D &aspeed_ast2700_scu_ops; +} + +static uint64_t aspeed_ast2700_scuio_read(void *opaque, hwaddr offset, + unsigned size) +{ + AspeedSCUState *s =3D ASPEED_SCU(opaque); + int reg =3D TO_REG(offset); + if (reg >=3D ASPEED_AST2700_SCU_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx "= \n", + __func__, offset); + return 0; + } + + switch (reg) { + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Unhandled read at offset 0x%" HWADDR_PRIx "\n", + __func__, offset); + } + + trace_aspeed_ast2700_scuio_read(offset, size, s->regs[reg]); + return s->regs[reg]; +} + +static void aspeed_ast2700_scuio_write(void *opaque, hwaddr offset, + uint64_t data64, unsigned size) +{ + AspeedSCUState *s =3D ASPEED_SCU(opaque); + int reg =3D TO_REG(offset); + /* Truncate here so bitwise operations below behave as expected */ + uint32_t data =3D data64; + bool updated =3D false; + + if (reg >=3D ASPEED_AST2700_SCU_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx = "\n", + __func__, offset); + return; + } + + trace_aspeed_ast2700_scuio_write(offset, size, data); + + switch (reg) { + case AST2700_SCUIO_CLK_STOP_CTL_1: + case AST2700_SCUIO_CLK_STOP_CTL_2: + s->regs[reg] |=3D data; + updated =3D true; + break; + case AST2700_SCUIO_CLK_STOP_CLR_1: + case AST2700_SCUIO_CLK_STOP_CLR_2: + s->regs[reg - 1] ^=3D data; + updated =3D true; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Unhandeled write at offset 0x%" HWADDR_PRIx "\n= ", + __func__, offset); + break; + } + + if (!updated) { + s->regs[reg] =3D data; + } +} + +static const MemoryRegionOps aspeed_ast2700_scuio_ops =3D { + .read =3D aspeed_ast2700_scuio_read, + .write =3D aspeed_ast2700_scuio_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 8, + .valid.unaligned =3D false, +}; + +static const uint32_t ast2700_a0_resets_io[ASPEED_AST2700_SCU_NR_REGS] =3D= { + [AST2700_SILICON_REV] =3D 0x06000003, + [AST2700_HW_STRAP1] =3D 0x00000504, + [AST2700_HW_STRAP1_CLR] =3D 0xFFF0FFF0, + [AST2700_HW_STRAP1_LOCK] =3D 0x00000FFF, + [AST2700_HW_STRAP1_SEC1] =3D 0x000000FF, + [AST2700_HW_STRAP1_SEC2] =3D 0x00000000, + [AST2700_HW_STRAP1_SEC3] =3D 0x1000408F, + [AST2700_SCUIO_CLK_STOP_CTL_1] =3D 0xffff8400, + [AST2700_SCUIO_CLK_STOP_CTL_2] =3D 0x00005f30, + [AST2700_SCUIO_CLK_SEL_1] =3D 0x86900000, + [AST2700_SCUIO_CLK_SEL_2] =3D 0x00400000, + [AST2700_SCUIO_HPLL_PARAM] =3D 0x10000027, + [AST2700_SCUIO_HPLL_EXT_PARAM] =3D 0x80000014, + [AST2700_SCUIO_APLL_PARAM] =3D 0x1000001f, + [AST2700_SCUIO_APLL_EXT_PARAM] =3D 0x8000000f, + [AST2700_SCUIO_DPLL_PARAM] =3D 0x106e42ce, + [AST2700_SCUIO_DPLL_EXT_PARAM] =3D 0x80000167, + [AST2700_SCUIO_DPLL_PARAM_READ] =3D 0x106e42ce, + [AST2700_SCUIO_DPLL_EXT_PARAM_READ] =3D 0x80000167, + [AST2700_SCUIO_UARTCLK_GEN] =3D 0x00014506, + [AST2700_SCUIO_HUARTCLK_GEN] =3D 0x000145c0, + [AST2700_SCUIO_CLK_DUTY_MEAS_RST] =3D 0x0c9100d2, +}; + +static void aspeed_2700_scuio_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedSCUClass *asc =3D ASPEED_SCU_CLASS(klass); + + dc->desc =3D "ASPEED 2700 System Control Unit I/O"; + dc->reset =3D aspeed_ast2700_scu_reset; + asc->resets =3D ast2700_a0_resets_io; + asc->calc_hpll =3D aspeed_2600_scu_calc_hpll; + asc->get_apb =3D aspeed_2700_scuio_get_apb_freq; + asc->apb_divider =3D 2; + asc->nr_regs =3D ASPEED_AST2700_SCU_NR_REGS; + asc->clkin_25Mhz =3D true; + asc->ops =3D &aspeed_ast2700_scuio_ops; +} + +static const TypeInfo aspeed_2700_scu_info =3D { + .name =3D TYPE_ASPEED_2700_SCU, + .parent =3D TYPE_ASPEED_SCU, + .instance_size =3D sizeof(AspeedSCUState), + .class_init =3D aspeed_2700_scu_class_init, +}; + +static const TypeInfo aspeed_2700_scuio_info =3D { + .name =3D TYPE_ASPEED_2700_SCUIO, + .parent =3D TYPE_ASPEED_SCU, + .instance_size =3D sizeof(AspeedSCUState), + .class_init =3D aspeed_2700_scuio_class_init, +}; + static const uint32_t ast1030_a1_resets[ASPEED_AST2600_SCU_NR_REGS] =3D { [AST2600_SYS_RST_CTRL] =3D 0xFFC3FED8, [AST2600_SYS_RST_CTRL2] =3D 0x09FFFFFC, @@ -841,6 +1143,8 @@ static void aspeed_scu_register_types(void) type_register_static(&aspeed_2500_scu_info); type_register_static(&aspeed_2600_scu_info); type_register_static(&aspeed_1030_scu_info); + type_register_static(&aspeed_2700_scu_info); + type_register_static(&aspeed_2700_scuio_info); } =20 type_init(aspeed_scu_register_types); diff --git a/hw/misc/trace-events b/hw/misc/trace-events index e13b64822110..1be0717c0c93 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -93,6 +93,10 @@ slavio_led_mem_readw(uint32_t ret) "Read diagnostic LED = 0x%04x" # aspeed_scu.c aspeed_scu_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" P= RIx64 " of size %u: 0x%" PRIx32 aspeed_scu_read(uint64_t offset, unsigned size, uint32_t data) "To 0x%" PR= Ix64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scu_write(uint64_t offset, unsigned size, uint32_t data) "T= o 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scu_read(uint64_t offset, unsigned size, uint32_t data) "To= 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scuio_write(uint64_t offset, unsigned size, uint32_t data) = "To 0x%" PRIx64 " of size %u: 0x%" PRIx32 +aspeed_ast2700_scuio_read(uint64_t offset, unsigned size, uint32_t data) "= To 0x%" PRIx64 " of size %u: 0x%" PRIx32 =20 # mps2-scc.c mps2_scc_read(uint64_t offset, uint64_t data, unsigned size) "MPS2 SCC rea= d: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u" --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350194; cv=none; d=zohomail.com; s=zohoarc; b=Cg00vCl1jpyidmF6qFW3Yc1BjnuS7O6T9TH18y2seaD6jwfsIbZC3gdiaivmhgZSasgH6fto3PEwFltuz1Bapkp6A0dzoY5Wtqf5/G0ZDNzBiPT/u0lvNrMSp5/ucGXMXjyDUZupvBTOB3rZM3K7K3wshEk7BAfXenrJ514jjOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350194; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=C4WxeaP+pKqJIYONTH+1NjsoAOxO7dt54pJTm092ZcE=; b=WHQoMb4o1KBhMdGY2IcnL1eo0vlHPjGm+CElPqhg3rhiVPnV56I1T27bFkIslxoVVSaqk6Lq8LgsDS8Nh7vqX0VlXWcHLwmQ49mvNWFsvGJBP8TIBjt+hbuHaOjbparui7lnHo+KK2peUyjsIfZNu07Fd3YZwIsY6yWq7enJUoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350194957267.78283527128565; Fri, 14 Jun 2024 00:29:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Ly-0003iZ-D1; Fri, 14 Jun 2024 03:28:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lw-0003h7-RI for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lu-0000ox-JE for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:04 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-644-M6UluzrRPhWq_35YvotSrg-1; Fri, 14 Jun 2024 03:27:54 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4543019560B0; Fri, 14 Jun 2024 07:27:53 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 94B803000219; Fri, 14 Jun 2024 07:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C4WxeaP+pKqJIYONTH+1NjsoAOxO7dt54pJTm092ZcE=; b=auLHj/c8MVTCrhNZB3BAv3+Tw/yojmVAKgBLeC4MrQg4DjLWJ48A/16Eq99FfUEuN1Wk/S n3KzXsvLk2LBoYFwpnmPM+i6ryV1y1JsWzvMr1szWNdPbzroXqA8S20EdMmHNoKW2wL9IP YubsvT/maqX8LfFBGFm5erdFF8Z0ytU= X-MC-Unique: M6UluzrRPhWq_35YvotSrg-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 13/19] aspeed/intc: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:14 +0200 Message-ID: <20240614072620.1262053-14-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350196508100002 From: Jamin Lin AST2700 interrupt controller(INTC) provides hardware interrupt interfaces to interrupt of processors PSP, SSP and TSP. In INTC, each interrupt of INT 128 to INT136 combines 32 interrupts. Introduce a new aspeed_intc class with instance_init and realize handlers. So far, this model only supports GICINT128 to GICINT136. It creates 9 GICINT or-gates to connect 32 interrupts sources from GICINT128 to GICINT136 as IRQ GPIO-OUTPUT pins. Then, this model registers IRQ handler with its IRQ GPIO-INPUT pins which connect to GICINT or-gates. And creates 9 GICINT IRQ GPIO-OUTPUT pins which connect to GIC device with GIC IRQ 128 to 136. If one interrupt source from GICINT128 to GICINT136 set irq, the OR-GATE irq callback function is called and set irq to INTC by OR-GATE GPIO-OUTPUT pins. Then, the INTC irq callback function is called and set irq to GIC by its GICINT IRQ GPIO-OUTPUT pins. Finally, the GIC irq callback function is called and set irq to CPUs and CPUs execute Interrupt Service Routine (ISR). Block diagram of GICINT132: GICINT132 ETH1 +-----------+ +-------->+0 3| ETH2 | 4| +-------->+1 5| ETH3 | 6| +-------->+2 19| INTC = GIC UART0 | 20| +--------------------------+ +-------->+7 21| | | = +--------------+ UART1 | 22| |orgate0 +----> output_pin0+----------->= +GIC128 | +-------->+8 23| | | = | | UART2 | 24| |orgate1 +----> output_pin1+----------->= +GIC129 | +-------->+9 25| | | = | | UART3 | 26| |orgate2 +----> output_pin2+----------->= +GIC130 | +--------->10 27| | | = | | UART5 | 28| |orgate3 +----> output_pin3+----------->= +GIC131 | +-------->+11 29| | | = | | UART6 | +----------->+orgate4 +----> output_pin4+----------->= +GIC132 | +-------->+12 30| | | = | | UART7 | 31| |orgate5 +----> output_pin5+----------->= +GIC133 | +-------->+13 | | | = | | UART8 | OR[0:31] | |orgate6 +----> output_pin6+----------->= +GIC134 | Reviewed-by: C=C3=A9dric Le Goater ---------->14 | | | = | | UART9 | | |orgate7 +----> output_pin7+----------->= +GIC135 | --------->+15 | | | = | | UART10 | | |orgate8 +----> output_pin8+----------->= +GIC136 | --------->+16 | | | = +--------------+ UART11 | | +--------------------------+ +-------->+17 | UART12 | | +--------->18 | | | | | | | +-----------+ Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/intc/aspeed_intc.h | 44 +++++ hw/intc/aspeed_intc.c | 360 ++++++++++++++++++++++++++++++++++ hw/intc/meson.build | 1 + hw/intc/trace-events | 13 ++ 4 files changed, 418 insertions(+) create mode 100644 include/hw/intc/aspeed_intc.h create mode 100644 hw/intc/aspeed_intc.c diff --git a/include/hw/intc/aspeed_intc.h b/include/hw/intc/aspeed_intc.h new file mode 100644 index 000000000000..18cb43476cd7 --- /dev/null +++ b/include/hw/intc/aspeed_intc.h @@ -0,0 +1,44 @@ +/* + * ASPEED INTC Controller + * + * Copyright (C) 2024 ASPEED Technology Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef ASPEED_INTC_H +#define ASPEED_INTC_H + +#include "hw/sysbus.h" +#include "qom/object.h" +#include "hw/or-irq.h" + +#define TYPE_ASPEED_INTC "aspeed.intc" +#define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700" +OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC) + +#define ASPEED_INTC_NR_REGS (0x2000 >> 2) +#define ASPEED_INTC_NR_INTS 9 + +struct AspeedINTCState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + MemoryRegion iomem; + uint32_t regs[ASPEED_INTC_NR_REGS]; + OrIRQState orgates[ASPEED_INTC_NR_INTS]; + qemu_irq output_pins[ASPEED_INTC_NR_INTS]; + + uint32_t enable[ASPEED_INTC_NR_INTS]; + uint32_t mask[ASPEED_INTC_NR_INTS]; + uint32_t pending[ASPEED_INTC_NR_INTS]; +}; + +struct AspeedINTCClass { + SysBusDeviceClass parent_class; + + uint32_t num_lines; + uint32_t num_ints; +}; + +#endif /* ASPEED_INTC_H */ diff --git a/hw/intc/aspeed_intc.c b/hw/intc/aspeed_intc.c new file mode 100644 index 000000000000..e232361791c7 --- /dev/null +++ b/hw/intc/aspeed_intc.c @@ -0,0 +1,360 @@ +/* + * ASPEED INTC Controller + * + * Copyright (C) 2024 ASPEED Technology Inc. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/intc/aspeed_intc.h" +#include "hw/irq.h" +#include "qemu/log.h" +#include "trace.h" +#include "hw/registerfields.h" +#include "qapi/error.h" + +/* INTC Registers */ +REG32(GICINT128_EN, 0x1000) +REG32(GICINT128_STATUS, 0x1004) +REG32(GICINT129_EN, 0x1100) +REG32(GICINT129_STATUS, 0x1104) +REG32(GICINT130_EN, 0x1200) +REG32(GICINT130_STATUS, 0x1204) +REG32(GICINT131_EN, 0x1300) +REG32(GICINT131_STATUS, 0x1304) +REG32(GICINT132_EN, 0x1400) +REG32(GICINT132_STATUS, 0x1404) +REG32(GICINT133_EN, 0x1500) +REG32(GICINT133_STATUS, 0x1504) +REG32(GICINT134_EN, 0x1600) +REG32(GICINT134_STATUS, 0x1604) +REG32(GICINT135_EN, 0x1700) +REG32(GICINT135_STATUS, 0x1704) +REG32(GICINT136_EN, 0x1800) +REG32(GICINT136_STATUS, 0x1804) + +#define GICINT_STATUS_BASE R_GICINT128_STATUS + +static void aspeed_intc_update(AspeedINTCState *s, int irq, int level) +{ + AspeedINTCClass *aic =3D ASPEED_INTC_GET_CLASS(s); + + if (irq >=3D aic->num_ints) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid interrupt number: %d\n= ", + __func__, irq); + return; + } + + trace_aspeed_intc_update_irq(irq, level); + qemu_set_irq(s->output_pins[irq], level); +} + +/* + * The address of GICINT128 to GICINT136 are from 0x1000 to 0x1804. + * Utilize "address & 0x0f00" to get the irq and irq output pin index + * The value of irq should be 0 to num_ints. + * The irq 0 indicates GICINT128, irq 1 indicates GICINT129 and so on. + */ +static void aspeed_intc_set_irq(void *opaque, int irq, int level) +{ + AspeedINTCState *s =3D (AspeedINTCState *)opaque; + AspeedINTCClass *aic =3D ASPEED_INTC_GET_CLASS(s); + uint32_t status_addr =3D GICINT_STATUS_BASE + ((0x100 * irq) >> 2); + uint32_t select =3D 0; + uint32_t enable; + int i; + + if (irq >=3D aic->num_ints) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid interrupt number: %d\n= ", + __func__, irq); + return; + } + + trace_aspeed_intc_set_irq(irq, level); + enable =3D s->enable[irq]; + + if (!level) { + return; + } + + for (i =3D 0; i < aic->num_lines; i++) { + if (s->orgates[irq].levels[i]) { + if (enable & BIT(i)) { + select |=3D BIT(i); + } + } + } + + if (!select) { + return; + } + + trace_aspeed_intc_select(select); + + if (s->mask[irq] || s->regs[status_addr]) { + /* + * a. mask is not 0 means in ISR mode + * sources interrupt routine are executing. + * b. status register value is not 0 means previous + * source interrupt does not be executed, yet. + * + * save source interrupt to pending variable. + */ + s->pending[irq] |=3D select; + trace_aspeed_intc_pending_irq(irq, s->pending[irq]); + } else { + /* + * notify firmware which source interrupt are coming + * by setting status register + */ + s->regs[status_addr] =3D select; + trace_aspeed_intc_trigger_irq(irq, s->regs[status_addr]); + aspeed_intc_update(s, irq, 1); + } +} + +static uint64_t aspeed_intc_read(void *opaque, hwaddr offset, unsigned int= size) +{ + AspeedINTCState *s =3D ASPEED_INTC(opaque); + uint32_t addr =3D offset >> 2; + uint32_t value =3D 0; + + if (addr >=3D ASPEED_INTC_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds read at offset 0x%" HWADDR_PRIx "= \n", + __func__, offset); + return 0; + } + + value =3D s->regs[addr]; + trace_aspeed_intc_read(offset, size, value); + + return value; +} + +static void aspeed_intc_write(void *opaque, hwaddr offset, uint64_t data, + unsigned size) +{ + AspeedINTCState *s =3D ASPEED_INTC(opaque); + AspeedINTCClass *aic =3D ASPEED_INTC_GET_CLASS(s); + uint32_t addr =3D offset >> 2; + uint32_t old_enable; + uint32_t change; + uint32_t irq; + + if (addr >=3D ASPEED_INTC_NR_REGS) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx = "\n", + __func__, offset); + return; + } + + trace_aspeed_intc_write(offset, size, data); + + switch (addr) { + case R_GICINT128_EN: + case R_GICINT129_EN: + case R_GICINT130_EN: + case R_GICINT131_EN: + case R_GICINT132_EN: + case R_GICINT133_EN: + case R_GICINT134_EN: + case R_GICINT135_EN: + case R_GICINT136_EN: + irq =3D (offset & 0x0f00) >> 8; + + if (irq >=3D aic->num_ints) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid interrupt number: = %d\n", + __func__, irq); + return; + } + + /* + * These registers are used for enable sources interrupt and + * mask and unmask source interrupt while executing source ISR. + */ + + /* disable all source interrupt */ + if (!data && !s->enable[irq]) { + s->regs[addr] =3D data; + return; + } + + old_enable =3D s->enable[irq]; + s->enable[irq] |=3D data; + + /* enable new source interrupt */ + if (old_enable !=3D s->enable[irq]) { + trace_aspeed_intc_enable(s->enable[irq]); + s->regs[addr] =3D data; + return; + } + + /* mask and unmask source interrupt */ + change =3D s->regs[addr] ^ data; + if (change & data) { + s->mask[irq] &=3D ~change; + trace_aspeed_intc_unmask(change, s->mask[irq]); + } else { + s->mask[irq] |=3D change; + trace_aspeed_intc_mask(change, s->mask[irq]); + } + s->regs[addr] =3D data; + break; + case R_GICINT128_STATUS: + case R_GICINT129_STATUS: + case R_GICINT130_STATUS: + case R_GICINT131_STATUS: + case R_GICINT132_STATUS: + case R_GICINT133_STATUS: + case R_GICINT134_STATUS: + case R_GICINT135_STATUS: + case R_GICINT136_STATUS: + irq =3D (offset & 0x0f00) >> 8; + + if (irq >=3D aic->num_ints) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid interrupt number: = %d\n", + __func__, irq); + return; + } + + /* clear status */ + s->regs[addr] &=3D ~data; + + /* + * These status registers are used for notify sources ISR are exec= uted. + * If one source ISR is executed, it will clear one bit. + * If it clear all bits, it means to initialize this register stat= us + * rather than sources ISR are executed. + */ + if (data =3D=3D 0xffffffff) { + return; + } + + /* All source ISR execution are done */ + if (!s->regs[addr]) { + trace_aspeed_intc_all_isr_done(irq); + if (s->pending[irq]) { + /* + * handle pending source interrupt + * notify firmware which source interrupt are pending + * by setting status register + */ + s->regs[addr] =3D s->pending[irq]; + s->pending[irq] =3D 0; + trace_aspeed_intc_trigger_irq(irq, s->regs[addr]); + aspeed_intc_update(s, irq, 1); + } else { + /* clear irq */ + trace_aspeed_intc_clear_irq(irq, 0); + aspeed_intc_update(s, irq, 0); + } + } + break; + default: + s->regs[addr] =3D data; + break; + } + + return; +} + +static const MemoryRegionOps aspeed_intc_ops =3D { + .read =3D aspeed_intc_read, + .write =3D aspeed_intc_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + } +}; + +static void aspeed_intc_instance_init(Object *obj) +{ + AspeedINTCState *s =3D ASPEED_INTC(obj); + AspeedINTCClass *aic =3D ASPEED_INTC_GET_CLASS(s); + int i; + + assert(aic->num_ints <=3D ASPEED_INTC_NR_INTS); + for (i =3D 0; i < aic->num_ints; i++) { + object_initialize_child(obj, "intc-orgates[*]", &s->orgates[i], + TYPE_OR_IRQ); + object_property_set_int(OBJECT(&s->orgates[i]), "num-lines", + aic->num_lines, &error_abort); + } +} + +static void aspeed_intc_reset(DeviceState *dev) +{ + AspeedINTCState *s =3D ASPEED_INTC(dev); + + memset(s->regs, 0, sizeof(s->regs)); + memset(s->enable, 0, sizeof(s->enable)); + memset(s->mask, 0, sizeof(s->mask)); + memset(s->pending, 0, sizeof(s->pending)); +} + +static void aspeed_intc_realize(DeviceState *dev, Error **errp) +{ + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + AspeedINTCState *s =3D ASPEED_INTC(dev); + AspeedINTCClass *aic =3D ASPEED_INTC_GET_CLASS(s); + int i; + + memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_intc_ops, s, + TYPE_ASPEED_INTC ".regs", ASPEED_INTC_NR_REGS <<= 2); + + sysbus_init_mmio(sbd, &s->iomem); + qdev_init_gpio_in(dev, aspeed_intc_set_irq, aic->num_ints); + + for (i =3D 0; i < aic->num_ints; i++) { + if (!qdev_realize(DEVICE(&s->orgates[i]), NULL, errp)) { + return; + } + sysbus_init_irq(sbd, &s->output_pins[i]); + } +} + +static void aspeed_intc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->desc =3D "ASPEED INTC Controller"; + dc->realize =3D aspeed_intc_realize; + dc->reset =3D aspeed_intc_reset; + dc->vmsd =3D NULL; +} + +static const TypeInfo aspeed_intc_info =3D { + .name =3D TYPE_ASPEED_INTC, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D aspeed_intc_instance_init, + .instance_size =3D sizeof(AspeedINTCState), + .class_init =3D aspeed_intc_class_init, + .abstract =3D true, +}; + +static void aspeed_2700_intc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + AspeedINTCClass *aic =3D ASPEED_INTC_CLASS(klass); + + dc->desc =3D "ASPEED 2700 INTC Controller"; + aic->num_lines =3D 32; + aic->num_ints =3D 9; +} + +static const TypeInfo aspeed_2700_intc_info =3D { + .name =3D TYPE_ASPEED_2700_INTC, + .parent =3D TYPE_ASPEED_INTC, + .class_init =3D aspeed_2700_intc_class_init, +}; + +static void aspeed_intc_register_types(void) +{ + type_register_static(&aspeed_intc_info); + type_register_static(&aspeed_2700_intc_info); +} + +type_init(aspeed_intc_register_types); diff --git a/hw/intc/meson.build b/hw/intc/meson.build index 0d1b7d0a432c..afd1aa51ee9b 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -14,6 +14,7 @@ system_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: file= s( )) system_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-= a10-pic.c')) system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_vic.c')) +system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_intc.c')) system_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_pic.c')) system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_gic.c', '= exynos4210_combiner.c')) system_ss.add(when: 'CONFIG_GOLDFISH_PIC', if_true: files('goldfish_pic.c'= )) diff --git a/hw/intc/trace-events b/hw/intc/trace-events index b815cea129e2..3dcf14719833 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -79,6 +79,19 @@ aspeed_vic_update_fiq(int flags) "Raising FIQ: %d" aspeed_vic_update_irq(int flags) "Raising IRQ: %d" aspeed_vic_read(uint64_t offset, unsigned size, uint32_t value) "From 0x%"= PRIx64 " of size %u: 0x%" PRIx32 aspeed_vic_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" P= RIx64 " of size %u: 0x%" PRIx32 +# aspeed_intc.c +aspeed_intc_read(uint64_t offset, unsigned size, uint32_t value) "From 0x%= " PRIx64 " of size %u: 0x%" PRIx32 +aspeed_intc_write(uint64_t offset, unsigned size, uint32_t data) "To 0x%" = PRIx64 " of size %u: 0x%" PRIx32 +aspeed_intc_set_irq(int irq, int level) "Set IRQ %d: %d" +aspeed_intc_clear_irq(int irq, int level) "Clear IRQ %d: %d" +aspeed_intc_update_irq(int irq, int level) "Update IRQ: %d: %d" +aspeed_intc_pending_irq(int irq, uint32_t value) "Pending IRQ: %d: 0x%x" +aspeed_intc_trigger_irq(int irq, uint32_t value) "Trigger IRQ: %d: 0x%x" +aspeed_intc_all_isr_done(int irq) "All source ISR execution are done: %d" +aspeed_intc_enable(uint32_t value) "Enable: 0x%x" +aspeed_intc_select(uint32_t value) "Select: 0x%x" +aspeed_intc_mask(uint32_t change, uint32_t value) "Mask: 0x%x: 0x%x" +aspeed_intc_unmask(uint32_t change, uint32_t value) "UnMask: 0x%x: 0x%x" =20 # arm_gic.c gic_enable_irq(int irq) "irq %d enabled" --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350100; cv=none; d=zohomail.com; s=zohoarc; b=hRE3ejVzQxaudGollyk6Vqj14J/Fjm9rHbbLyBCk3m8MK7MeMhcJm27DQBl0k37QlAQhg/o2g5kM0RGY0OaDSHvWJOgD5KlQ73yd5psePK0r/ntUu83+vac/KjE8OpFdfNYFUr/psCfytg0Bxl6YGi2s2vzZXSmwz8VJkaDYaf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350100; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VMA6evDi2FK/FgTIRcwcgQF9cQOzXW/+6+RA8yjh3cI=; b=iRQLyOz89Zkt4qtaEYQVMoD+DvpEqBUR5c9OXUfpb60UYpVqqX6wL4+tSzkODsvtS3cRNfaqM9u342w7Wls524hBcSOR0jcFDi7p+KqNydBgWjUtU72MBkml8N0XvK/726Co4ls9me+jtBM4BCng6VPZhHgwTBvUWVZ7USfDsZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350100670868.8189019485151; Fri, 14 Jun 2024 00:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1Lz-0003ml-DI; Fri, 14 Jun 2024 03:28:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lx-0003ht-Jg for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lu-0000p1-NZ for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:05 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-217-9-TLMMfZNY2pcKSkoMnEyQ-1; Fri, 14 Jun 2024 03:27:56 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5543919560B8; Fri, 14 Jun 2024 07:27:55 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A45EC3000219; Fri, 14 Jun 2024 07:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VMA6evDi2FK/FgTIRcwcgQF9cQOzXW/+6+RA8yjh3cI=; b=hpIAP1n/ARAl9xZODAOuxiTdTwzXDCFxKMgXL/Z215wmNBPIBoog24ifRCFvkX5yl3Q9Fx ygP8LlZt0B8F0vQ4VKH0sUbdP+X9RDemGt3+Q47auWRixtIMXKKFd2wj73HpPgyf9wWfzc r2HhGfcUcfB0DHk1NLCQRvTvMGXHbY4= X-MC-Unique: 9-TLMMfZNY2pcKSkoMnEyQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 14/19] aspeed/soc: Add AST2700 support Date: Fri, 14 Jun 2024 09:26:15 +0200 Message-ID: <20240614072620.1262053-15-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350102289100014 From: Jamin Lin Initial definitions for a simple machine using an AST2700 SOC (Cortex-a35 C= PU). AST2700 SOC and its interrupt controller are too complex to handle in the common Aspeed SoC framework. We introduce a new ast2700 class with instance_init and realize handlers. AST2700 is a 64 bits quad core cpus and support 8 watchdog. Update maximum ASPEED_CPUS_NUM to 4 and ASPEED_WDTS_NUM to 8. In addition, update AspeedSocState to support scuio, sli, sliio and intc. Add TYPE_ASPEED27X0_SOC machine type. The SDMC controller is unlocked at SPL stage. At present, only supports to emulate booting start from u-boot stage. Set SDMC controller unlocked by default. In INTC, each interrupt of INT 128 to INT 136 combines 32 interrupts. It connect GICINT IRQ GPIO-OUTPUT pins to GIC device with irq 128 to 136. And, if a device irq is 128 to 136, its irq GPIO-OUTPUT pin is connected to GICINT or-gates instead of GIC device. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/arm/aspeed_soc.h | 28 +- hw/arm/aspeed_ast27x0.c | 563 ++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 3 files changed, 590 insertions(+), 2 deletions(-) create mode 100644 hw/arm/aspeed_ast27x0.c diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index c60fac900acb..caef0d100ba5 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -15,6 +15,7 @@ #include "hw/cpu/a15mpcore.h" #include "hw/arm/armv7m.h" #include "hw/intc/aspeed_vic.h" +#include "hw/intc/aspeed_intc.h" #include "hw/misc/aspeed_scu.h" #include "hw/adc/aspeed_adc.h" #include "hw/misc/aspeed_sdmc.h" @@ -26,6 +27,7 @@ #include "hw/ssi/aspeed_smc.h" #include "hw/misc/aspeed_hace.h" #include "hw/misc/aspeed_sbc.h" +#include "hw/misc/aspeed_sli.h" #include "hw/watchdog/wdt_aspeed.h" #include "hw/net/ftgmac100.h" #include "target/arm/cpu.h" @@ -38,11 +40,12 @@ #include "hw/misc/aspeed_peci.h" #include "hw/fsi/aspeed_apb2opb.h" #include "hw/char/serial.h" +#include "hw/intc/arm_gicv3.h" =20 #define ASPEED_SPIS_NUM 2 #define ASPEED_EHCIS_NUM 2 -#define ASPEED_WDTS_NUM 4 -#define ASPEED_CPUS_NUM 2 +#define ASPEED_WDTS_NUM 8 +#define ASPEED_CPUS_NUM 4 #define ASPEED_MACS_NUM 4 #define ASPEED_UARTS_NUM 13 #define ASPEED_JTAG_NUM 2 @@ -61,6 +64,7 @@ struct AspeedSoCState { AspeedI2CState i2c; AspeedI3CState i3c; AspeedSCUState scu; + AspeedSCUState scuio; AspeedHACEState hace; AspeedXDMAState xdma; AspeedADCState adc; @@ -68,6 +72,8 @@ struct AspeedSoCState { AspeedSMCState spi[ASPEED_SPIS_NUM]; EHCISysBusState ehci[ASPEED_EHCIS_NUM]; AspeedSBCState sbc; + AspeedSLIState sli; + AspeedSLIState sliio; MemoryRegion secsram; UnimplementedDeviceState sbc_unimplemented; AspeedSDMCState sdmc; @@ -117,6 +123,17 @@ struct Aspeed2600SoCState { #define TYPE_ASPEED2600_SOC "aspeed2600-soc" OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC) =20 +struct Aspeed27x0SoCState { + AspeedSoCState parent; + + ARMCPU cpu[ASPEED_CPUS_NUM]; + AspeedINTCState intc; + GICv3State gic; +}; + +#define TYPE_ASPEED27X0_SOC "aspeed27x0-soc" +OBJECT_DECLARE_SIMPLE_TYPE(Aspeed27x0SoCState, ASPEED27X0_SOC) + struct Aspeed10x0SoCState { AspeedSoCState parent; =20 @@ -168,11 +185,13 @@ enum { ASPEED_DEV_UART13, ASPEED_DEV_VUART, ASPEED_DEV_FMC, + ASPEED_DEV_SPI0, ASPEED_DEV_SPI1, ASPEED_DEV_SPI2, ASPEED_DEV_EHCI1, ASPEED_DEV_EHCI2, ASPEED_DEV_VIC, + ASPEED_DEV_INTC, ASPEED_DEV_SDMC, ASPEED_DEV_SCU, ASPEED_DEV_ADC, @@ -222,6 +241,11 @@ enum { ASPEED_DEV_JTAG1, ASPEED_DEV_FSI1, ASPEED_DEV_FSI2, + ASPEED_DEV_SCUIO, + ASPEED_DEV_SLI, + ASPEED_DEV_SLIIO, + ASPEED_GIC_DIST, + ASPEED_GIC_REDIST, }; =20 qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev); diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c new file mode 100644 index 000000000000..29e75072c4b7 --- /dev/null +++ b/hw/arm/aspeed_ast27x0.c @@ -0,0 +1,563 @@ +/* + * ASPEED SoC 27x0 family + * + * Copyright (C) 2024 ASPEED Technology Inc. + * + * This code is licensed under the GPL version 2 or later. See + * the COPYING file in the top-level directory. + * + * Implementation extracted from the AST2600 and adapted for AST27x0. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/misc/unimp.h" +#include "hw/arm/aspeed_soc.h" +#include "qemu/module.h" +#include "qemu/error-report.h" +#include "hw/i2c/aspeed_i2c.h" +#include "net/net.h" +#include "sysemu/sysemu.h" +#include "hw/intc/arm_gicv3.h" +#include "qapi/qmp/qlist.h" + +static const hwaddr aspeed_soc_ast2700_memmap[] =3D { + [ASPEED_DEV_SPI_BOOT] =3D 0x400000000, + [ASPEED_DEV_SRAM] =3D 0x10000000, + [ASPEED_DEV_SDMC] =3D 0x12C00000, + [ASPEED_DEV_SCU] =3D 0x12C02000, + [ASPEED_DEV_SCUIO] =3D 0x14C02000, + [ASPEED_DEV_UART0] =3D 0X14C33000, + [ASPEED_DEV_UART1] =3D 0X14C33100, + [ASPEED_DEV_UART2] =3D 0X14C33200, + [ASPEED_DEV_UART3] =3D 0X14C33300, + [ASPEED_DEV_UART4] =3D 0X12C1A000, + [ASPEED_DEV_UART5] =3D 0X14C33400, + [ASPEED_DEV_UART6] =3D 0X14C33500, + [ASPEED_DEV_UART7] =3D 0X14C33600, + [ASPEED_DEV_UART8] =3D 0X14C33700, + [ASPEED_DEV_UART9] =3D 0X14C33800, + [ASPEED_DEV_UART10] =3D 0X14C33900, + [ASPEED_DEV_UART11] =3D 0X14C33A00, + [ASPEED_DEV_UART12] =3D 0X14C33B00, + [ASPEED_DEV_WDT] =3D 0x14C37000, + [ASPEED_DEV_VUART] =3D 0X14C30000, + [ASPEED_DEV_FMC] =3D 0x14000000, + [ASPEED_DEV_SPI0] =3D 0x14010000, + [ASPEED_DEV_SPI1] =3D 0x14020000, + [ASPEED_DEV_SPI2] =3D 0x14030000, + [ASPEED_DEV_SDRAM] =3D 0x400000000, + [ASPEED_DEV_MII1] =3D 0x14040000, + [ASPEED_DEV_MII2] =3D 0x14040008, + [ASPEED_DEV_MII3] =3D 0x14040010, + [ASPEED_DEV_ETH1] =3D 0x14050000, + [ASPEED_DEV_ETH2] =3D 0x14060000, + [ASPEED_DEV_ETH3] =3D 0x14070000, + [ASPEED_DEV_EMMC] =3D 0x12090000, + [ASPEED_DEV_INTC] =3D 0x12100000, + [ASPEED_DEV_SLI] =3D 0x12C17000, + [ASPEED_DEV_SLIIO] =3D 0x14C1E000, + [ASPEED_GIC_DIST] =3D 0x12200000, + [ASPEED_GIC_REDIST] =3D 0x12280000, +}; + +#define AST2700_MAX_IRQ 288 + +/* Shared Peripheral Interrupt values below are offset by -32 from datashe= et */ +static const int aspeed_soc_ast2700_irqmap[] =3D { + [ASPEED_DEV_UART0] =3D 132, + [ASPEED_DEV_UART1] =3D 132, + [ASPEED_DEV_UART2] =3D 132, + [ASPEED_DEV_UART3] =3D 132, + [ASPEED_DEV_UART4] =3D 8, + [ASPEED_DEV_UART5] =3D 132, + [ASPEED_DEV_UART6] =3D 132, + [ASPEED_DEV_UART7] =3D 132, + [ASPEED_DEV_UART8] =3D 132, + [ASPEED_DEV_UART9] =3D 132, + [ASPEED_DEV_UART10] =3D 132, + [ASPEED_DEV_UART11] =3D 132, + [ASPEED_DEV_UART12] =3D 132, + [ASPEED_DEV_FMC] =3D 131, + [ASPEED_DEV_SDMC] =3D 0, + [ASPEED_DEV_SCU] =3D 12, + [ASPEED_DEV_ADC] =3D 130, + [ASPEED_DEV_XDMA] =3D 5, + [ASPEED_DEV_EMMC] =3D 15, + [ASPEED_DEV_GPIO] =3D 11, + [ASPEED_DEV_GPIO_1_8V] =3D 130, + [ASPEED_DEV_RTC] =3D 13, + [ASPEED_DEV_TIMER1] =3D 16, + [ASPEED_DEV_TIMER2] =3D 17, + [ASPEED_DEV_TIMER3] =3D 18, + [ASPEED_DEV_TIMER4] =3D 19, + [ASPEED_DEV_TIMER5] =3D 20, + [ASPEED_DEV_TIMER6] =3D 21, + [ASPEED_DEV_TIMER7] =3D 22, + [ASPEED_DEV_TIMER8] =3D 23, + [ASPEED_DEV_WDT] =3D 131, + [ASPEED_DEV_PWM] =3D 131, + [ASPEED_DEV_LPC] =3D 128, + [ASPEED_DEV_IBT] =3D 128, + [ASPEED_DEV_I2C] =3D 130, + [ASPEED_DEV_PECI] =3D 133, + [ASPEED_DEV_ETH1] =3D 132, + [ASPEED_DEV_ETH2] =3D 132, + [ASPEED_DEV_ETH3] =3D 132, + [ASPEED_DEV_HACE] =3D 4, + [ASPEED_DEV_KCS] =3D 128, + [ASPEED_DEV_DP] =3D 28, + [ASPEED_DEV_I3C] =3D 131, +}; + +/* GICINT 128 */ +static const int aspeed_soc_ast2700_gic128_intcmap[] =3D { + [ASPEED_DEV_LPC] =3D 0, + [ASPEED_DEV_IBT] =3D 2, + [ASPEED_DEV_KCS] =3D 4, +}; + +/* GICINT 130 */ +static const int aspeed_soc_ast2700_gic130_intcmap[] =3D { + [ASPEED_DEV_I2C] =3D 0, + [ASPEED_DEV_ADC] =3D 16, + [ASPEED_DEV_GPIO_1_8V] =3D 18, +}; + +/* GICINT 131 */ +static const int aspeed_soc_ast2700_gic131_intcmap[] =3D { + [ASPEED_DEV_I3C] =3D 0, + [ASPEED_DEV_WDT] =3D 16, + [ASPEED_DEV_FMC] =3D 25, + [ASPEED_DEV_PWM] =3D 29, +}; + +/* GICINT 132 */ +static const int aspeed_soc_ast2700_gic132_intcmap[] =3D { + [ASPEED_DEV_ETH1] =3D 0, + [ASPEED_DEV_ETH2] =3D 1, + [ASPEED_DEV_ETH3] =3D 2, + [ASPEED_DEV_UART0] =3D 7, + [ASPEED_DEV_UART1] =3D 8, + [ASPEED_DEV_UART2] =3D 9, + [ASPEED_DEV_UART3] =3D 10, + [ASPEED_DEV_UART5] =3D 11, + [ASPEED_DEV_UART6] =3D 12, + [ASPEED_DEV_UART7] =3D 13, + [ASPEED_DEV_UART8] =3D 14, + [ASPEED_DEV_UART9] =3D 15, + [ASPEED_DEV_UART10] =3D 16, + [ASPEED_DEV_UART11] =3D 17, + [ASPEED_DEV_UART12] =3D 18, +}; + +/* GICINT 133 */ +static const int aspeed_soc_ast2700_gic133_intcmap[] =3D { + [ASPEED_DEV_PECI] =3D 4, +}; + +/* GICINT 128 ~ 136 */ +struct gic_intc_irq_info { + int irq; + const int *ptr; +}; + +static const struct gic_intc_irq_info aspeed_soc_ast2700_gic_intcmap[] =3D= { + {128, aspeed_soc_ast2700_gic128_intcmap}, + {129, NULL}, + {130, aspeed_soc_ast2700_gic130_intcmap}, + {131, aspeed_soc_ast2700_gic131_intcmap}, + {132, aspeed_soc_ast2700_gic132_intcmap}, + {133, aspeed_soc_ast2700_gic133_intcmap}, + {134, NULL}, + {135, NULL}, + {136, NULL}, +}; + +static qemu_irq aspeed_soc_ast2700_get_irq(AspeedSoCState *s, int dev) +{ + Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(s); + AspeedSoCClass *sc =3D ASPEED_SOC_GET_CLASS(s); + int i; + + for (i =3D 0; i < ARRAY_SIZE(aspeed_soc_ast2700_gic_intcmap); i++) { + if (sc->irqmap[dev] =3D=3D aspeed_soc_ast2700_gic_intcmap[i].irq) { + assert(aspeed_soc_ast2700_gic_intcmap[i].ptr); + return qdev_get_gpio_in(DEVICE(&a->intc.orgates[i]), + aspeed_soc_ast2700_gic_intcmap[i].ptr[dev]); + } + } + + return qdev_get_gpio_in(DEVICE(&a->gic), sc->irqmap[dev]); +} + +static void aspeed_soc_ast2700_init(Object *obj) +{ + Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(obj); + AspeedSoCState *s =3D ASPEED_SOC(obj); + AspeedSoCClass *sc =3D ASPEED_SOC_GET_CLASS(s); + int i; + char socname[8]; + char typename[64]; + + if (sscanf(sc->name, "%7s", socname) !=3D 1) { + g_assert_not_reached(); + } + + for (i =3D 0; i < sc->num_cpus; i++) { + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); + } + + object_initialize_child(obj, "gic", &a->gic, gicv3_class_name()); + + object_initialize_child(obj, "scu", &s->scu, TYPE_ASPEED_2700_SCU); + qdev_prop_set_uint32(DEVICE(&s->scu), "silicon-rev", + sc->silicon_rev); + object_property_add_alias(obj, "hw-strap1", OBJECT(&s->scu), + "hw-strap1"); + object_property_add_alias(obj, "hw-strap2", OBJECT(&s->scu), + "hw-strap2"); + object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu), + "hw-prot-key"); + + object_initialize_child(obj, "scuio", &s->scuio, TYPE_ASPEED_2700_SCUI= O); + qdev_prop_set_uint32(DEVICE(&s->scuio), "silicon-rev", + sc->silicon_rev); + + snprintf(typename, sizeof(typename), "aspeed.fmc-%s", socname); + object_initialize_child(obj, "fmc", &s->fmc, typename); + + for (i =3D 0; i < sc->spis_num; i++) { + snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i, socname= ); + object_initialize_child(obj, "spi[*]", &s->spi[i], typename); + } + + snprintf(typename, sizeof(typename), "aspeed.sdmc-%s", socname); + object_initialize_child(obj, "sdmc", &s->sdmc, typename); + object_property_add_alias(obj, "ram-size", OBJECT(&s->sdmc), + "ram-size"); + + for (i =3D 0; i < sc->wdts_num; i++) { + snprintf(typename, sizeof(typename), "aspeed.wdt-%s", socname); + object_initialize_child(obj, "wdt[*]", &s->wdt[i], typename); + } + + for (i =3D 0; i < sc->macs_num; i++) { + object_initialize_child(obj, "ftgmac100[*]", &s->ftgmac100[i], + TYPE_FTGMAC100); + + object_initialize_child(obj, "mii[*]", &s->mii[i], TYPE_ASPEED_MII= ); + } + + for (i =3D 0; i < sc->uarts_num; i++) { + object_initialize_child(obj, "uart[*]", &s->uart[i], TYPE_SERIAL_M= M); + } + + object_initialize_child(obj, "sli", &s->sli, TYPE_ASPEED_2700_SLI); + object_initialize_child(obj, "sliio", &s->sliio, TYPE_ASPEED_2700_SLII= O); + object_initialize_child(obj, "intc", &a->intc, TYPE_ASPEED_2700_INTC); +} + +/* + * ASPEED ast2700 has 0x0 as cluster ID + * + * https://developer.arm.com/documentation/100236/0100/register-descriptio= ns/aarch64-system-registers/multiprocessor-affinity-register--el1 + */ +static uint64_t aspeed_calc_affinity(int cpu) +{ + return (0x0 << ARM_AFF1_SHIFT) | cpu; +} + +static bool aspeed_soc_ast2700_gic_realize(DeviceState *dev, Error **errp) +{ + Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(dev); + AspeedSoCState *s =3D ASPEED_SOC(dev); + AspeedSoCClass *sc =3D ASPEED_SOC_GET_CLASS(s); + SysBusDevice *gicbusdev; + DeviceState *gicdev; + QList *redist_region_count; + int i; + + gicbusdev =3D SYS_BUS_DEVICE(&a->gic); + gicdev =3D DEVICE(&a->gic); + qdev_prop_set_uint32(gicdev, "revision", 3); + qdev_prop_set_uint32(gicdev, "num-cpu", sc->num_cpus); + qdev_prop_set_uint32(gicdev, "num-irq", AST2700_MAX_IRQ); + + redist_region_count =3D qlist_new(); + qlist_append_int(redist_region_count, sc->num_cpus); + qdev_prop_set_array(gicdev, "redist-region-count", redist_region_count= ); + + if (!sysbus_realize(gicbusdev, errp)) { + return false; + } + sysbus_mmio_map(gicbusdev, 0, sc->memmap[ASPEED_GIC_DIST]); + sysbus_mmio_map(gicbusdev, 1, sc->memmap[ASPEED_GIC_REDIST]); + + for (i =3D 0; i < sc->num_cpus; i++) { + DeviceState *cpudev =3D DEVICE(&a->cpu[i]); + int NUM_IRQS =3D 256, ARCH_GIC_MAINT_IRQ =3D 9, VIRTUAL_PMU_IRQ = =3D 7; + int ppibase =3D NUM_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; + + const int timer_irq[] =3D { + [GTIMER_PHYS] =3D 14, + [GTIMER_VIRT] =3D 11, + [GTIMER_HYP] =3D 10, + [GTIMER_SEC] =3D 13, + }; + int j; + + for (j =3D 0; j < ARRAY_SIZE(timer_irq); j++) { + qdev_connect_gpio_out(cpudev, j, + qdev_get_gpio_in(gicdev, ppibase + timer_irq[j])); + } + + qemu_irq irq =3D qdev_get_gpio_in(gicdev, + ppibase + ARCH_GIC_MAINT_IRQ); + qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", + 0, irq); + qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, + qdev_get_gpio_in(gicdev, ppibase + VIRTUAL_PMU_IRQ)); + + sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_= IRQ)); + sysbus_connect_irq(gicbusdev, i + sc->num_cpus, + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); + sysbus_connect_irq(gicbusdev, i + 2 * sc->num_cpus, + qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); + sysbus_connect_irq(gicbusdev, i + 3 * sc->num_cpus, + qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); + } + + return true; +} + +static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp) +{ + int i; + Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(dev); + AspeedSoCState *s =3D ASPEED_SOC(dev); + AspeedSoCClass *sc =3D ASPEED_SOC_GET_CLASS(s); + AspeedINTCClass *ic =3D ASPEED_INTC_GET_CLASS(&a->intc); + g_autofree char *sram_name =3D NULL; + + /* Default boot region (SPI memory or ROMs) */ + memory_region_init(&s->spi_boot_container, OBJECT(s), + "aspeed.spi_boot_container", 0x400000000); + memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT], + &s->spi_boot_container); + + /* CPU */ + for (i =3D 0; i < sc->num_cpus; i++) { + object_property_set_int(OBJECT(&a->cpu[i]), "mp-affinity", + aspeed_calc_affinity(i), &error_abort); + + object_property_set_int(OBJECT(&a->cpu[i]), "cntfrq", 1125000000, + &error_abort); + object_property_set_link(OBJECT(&a->cpu[i]), "memory", + OBJECT(s->memory), &error_abort); + + if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) { + return; + } + } + + /* GIC */ + if (!aspeed_soc_ast2700_gic_realize(dev, errp)) { + return; + } + + /* INTC */ + if (!sysbus_realize(SYS_BUS_DEVICE(&a->intc), errp)) { + return; + } + + aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->intc), 0, + sc->memmap[ASPEED_DEV_INTC]); + + /* GICINT orgates -> INTC -> GIC */ + for (i =3D 0; i < ic->num_ints; i++) { + qdev_connect_gpio_out(DEVICE(&a->intc.orgates[i]), 0, + qdev_get_gpio_in(DEVICE(&a->intc), i)); + sysbus_connect_irq(SYS_BUS_DEVICE(&a->intc), i, + qdev_get_gpio_in(DEVICE(&a->gic), + aspeed_soc_ast2700_gic_intcmap[i].irq)); + } + + /* SRAM */ + sram_name =3D g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_i= ndex); + if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_s= ize, + errp)) { + return; + } + memory_region_add_subregion(s->memory, + sc->memmap[ASPEED_DEV_SRAM], &s->sram); + + /* SCU */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_S= CU]); + + /* SCU1 */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->scuio), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scuio), 0, + sc->memmap[ASPEED_DEV_SCUIO]); + + /* UART */ + if (!aspeed_soc_uart_realize(s, errp)) { + return; + } + + /* FMC, The number of CS is set at the board level */ + object_property_set_int(OBJECT(&s->fmc), "dram-base", + sc->memmap[ASPEED_DEV_SDRAM], + &error_abort); + object_property_set_link(OBJECT(&s->fmc), "dram", OBJECT(s->dram_mr), + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->fmc), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->fmc), 0, sc->memmap[ASPEED_DEV_F= MC]); + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->fmc), 1, + ASPEED_SMC_GET_CLASS(&s->fmc)->flash_window_base); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0, + aspeed_soc_get_irq(s, ASPEED_DEV_FMC)); + + /* Set up an alias on the FMC CE0 region (boot default) */ + MemoryRegion *fmc0_mmio =3D &s->fmc.flashes[0].mmio; + memory_region_init_alias(&s->spi_boot, OBJECT(s), "aspeed.spi_boot", + fmc0_mmio, 0, memory_region_size(fmc0_mmio)); + memory_region_add_subregion(&s->spi_boot_container, 0x0, &s->spi_boot); + + /* SPI */ + for (i =3D 0; i < sc->spis_num; i++) { + object_property_set_link(OBJECT(&s->spi[i]), "dram", + OBJECT(s->dram_mr), &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->spi[i]), 0, + sc->memmap[ASPEED_DEV_SPI0 + i]); + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->spi[i]), 1, + ASPEED_SMC_GET_CLASS(&s->spi[i])->flash_window_bas= e); + } + + /* + * SDMC - SDRAM Memory Controller + * The SDMC controller is unlocked at SPL stage. + * At present, only supports to emulate booting + * start from u-boot stage. Set SDMC controller + * unlocked by default. It is a temporarily solution. + */ + object_property_set_bool(OBJECT(&s->sdmc), "unlocked", true, + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->sdmc), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sdmc), 0, + sc->memmap[ASPEED_DEV_SDMC]); + + /* RAM */ + if (!aspeed_soc_dram_init(s, errp)) { + return; + } + + for (i =3D 0; i < sc->macs_num; i++) { + object_property_set_bool(OBJECT(&s->ftgmac100[i]), "aspeed", true, + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->ftgmac100[i]), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, + sc->memmap[ASPEED_DEV_ETH1 + i]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0, + aspeed_soc_get_irq(s, ASPEED_DEV_ETH1 + i)); + + object_property_set_link(OBJECT(&s->mii[i]), "nic", + OBJECT(&s->ftgmac100[i]), &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->mii[i]), errp)) { + return; + } + + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->mii[i]), 0, + sc->memmap[ASPEED_DEV_MII1 + i]); + } + + /* Watch dog */ + for (i =3D 0; i < sc->wdts_num; i++) { + AspeedWDTClass *awc =3D ASPEED_WDT_GET_CLASS(&s->wdt[i]); + hwaddr wdt_offset =3D sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize; + + object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu= ), + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset); + } + + /* SLI */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->sli), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sli), 0, sc->memmap[ASPEED_DEV_S= LI]); + + if (!sysbus_realize(SYS_BUS_DEVICE(&s->sliio), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sliio), 0, + sc->memmap[ASPEED_DEV_SLIIO]); + + create_unimplemented_device("ast2700.dpmcu", 0x11000000, 0x40000); + create_unimplemented_device("ast2700.iomem0", 0x12000000, 0x01000000); + create_unimplemented_device("ast2700.iomem1", 0x14000000, 0x01000000); + create_unimplemented_device("ast2700.ltpi", 0x30000000, 0x1000000); + create_unimplemented_device("ast2700.io", 0x0, 0x4000000); +} + +static void aspeed_soc_ast2700_class_init(ObjectClass *oc, void *data) +{ + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a35"), + NULL + }; + DeviceClass *dc =3D DEVICE_CLASS(oc); + AspeedSoCClass *sc =3D ASPEED_SOC_CLASS(oc); + + /* Reason: The Aspeed SoC can only be instantiated from a board */ + dc->user_creatable =3D false; + dc->realize =3D aspeed_soc_ast2700_realize; + + sc->name =3D "ast2700-a0"; + sc->valid_cpu_types =3D valid_cpu_types; + sc->silicon_rev =3D AST2700_A0_SILICON_REV; + sc->sram_size =3D 0x20000; + sc->spis_num =3D 3; + sc->wdts_num =3D 8; + sc->macs_num =3D 1; + sc->uarts_num =3D 13; + sc->num_cpus =3D 4; + sc->uarts_base =3D ASPEED_DEV_UART0; + sc->irqmap =3D aspeed_soc_ast2700_irqmap; + sc->memmap =3D aspeed_soc_ast2700_memmap; + sc->get_irq =3D aspeed_soc_ast2700_get_irq; +} + +static const TypeInfo aspeed_soc_ast27x0_types[] =3D { + { + .name =3D TYPE_ASPEED27X0_SOC, + .parent =3D TYPE_ASPEED_SOC, + .instance_size =3D sizeof(Aspeed27x0SoCState), + .abstract =3D true, + }, { + .name =3D "ast2700-a0", + .parent =3D TYPE_ASPEED27X0_SOC, + .instance_init =3D aspeed_soc_ast2700_init, + .class_init =3D aspeed_soc_ast2700_class_init, + }, +}; + +DEFINE_TYPES(aspeed_soc_ast27x0_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index aefde0c69a30..0c07ab522f4c 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -49,6 +49,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( 'aspeed_ast10x0.c', 'aspeed_eeprom.c', 'fby35.c')) +arm_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files('= aspeed_ast27x0.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c')) arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c')) arm_ss.add(when: 'CONFIG_MSF2', if_true: files('msf2-soc.c')) --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350187; cv=none; d=zohomail.com; s=zohoarc; b=OHDZe2VWuY+8ZjCSVI1kUmUskY76auyBZAxz0+yvo2j2Fz+cjB8q1EWhNfARRB+lnVbeMrvlnrEs6OhxXbjRJPaNXyfnjTf2A/j0XRKKvwTQZvy439cEBa+9AtE8TzmKMg7XlfC/dk/gVRKrI+hnjKf9+8ohNgf/VPMUs9kkP2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350187; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DD7IqWfzysHo+dhyuOS1AX1QrIdW6VQkyKxnzc60i1g=; b=G8QfkO4zIh2bPuqQccwuhdybLoceJY6oth08QKrqXhTqZXrOH7sprVm+KZnQvfPZUTVTNEzNJqiQ3HGyCcLWbfMpTZ4Mi/X1DwxNqVQU6hnvfFHoT9PKosvKOnoSneGBR2XAW8PbMfGTia6G159yu34WEvb+if20iRUzJ7F/2NM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171835018745265.68623836846564; Fri, 14 Jun 2024 00:29:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1M5-00046k-N9; Fri, 14 Jun 2024 03:28:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M3-00041p-Fg for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M1-0000qK-MI for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:11 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-mlGD9wMyP6CfWBBRZ3yAtw-1; Fri, 14 Jun 2024 03:27:58 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 80E1B1956094; Fri, 14 Jun 2024 07:27:57 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B46D13000219; Fri, 14 Jun 2024 07:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DD7IqWfzysHo+dhyuOS1AX1QrIdW6VQkyKxnzc60i1g=; b=Tb1nqC0TZnD1X5km8+yK7MHGlGyJe9uwElA4GxiYGQunHmOVwubqJ6mmfJS/Xc1GxWl5vR Vw4MJUqkkVOlmreDvf27qkbOjN1v0YlMQ7uxdrhEVF0HeDRXgpJhJr9iQrxdBN8dqwu5Mw CxOElOt5pSDdYge3WjO+qGMy10ph/zo= X-MC-Unique: mlGD9wMyP6CfWBBRZ3yAtw-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 15/19] aspeed: Add an AST2700 eval board Date: Fri, 14 Jun 2024 09:26:16 +0200 Message-ID: <20240614072620.1262053-16-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350188463100005 From: Jamin Lin AST2700 CPU is ARM Cortex-A35 which is 64 bits. Add TARGET_AARCH64 to build this machine. According to the design of ast2700, it has a bootmcu(riscv-32) which is used for executing SPL. Then, CPUs(cortex-a35) execute u-boot, kernel and rofs. Currently, qemu not support emulate two CPU architectures at the same machine. Therefore, qemu will only support to emulate CPU(cortex-a35) side for ast2700 Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- hw/arm/aspeed.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 93ca87fda266..40dc0e4c76db 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -178,6 +178,12 @@ struct AspeedMachineState { #define AST2600_EVB_HW_STRAP1 0x000000C0 #define AST2600_EVB_HW_STRAP2 0x00000003 =20 +#ifdef TARGET_AARCH64 +/* AST2700 evb hardware value */ +#define AST2700_EVB_HW_STRAP1 0x000000C0 +#define AST2700_EVB_HW_STRAP2 0x00000003 +#endif + /* Tacoma hardware value */ #define TACOMA_BMC_HW_STRAP1 0x00000000 #define TACOMA_BMC_HW_STRAP2 0x00000040 @@ -1588,6 +1594,26 @@ static void aspeed_minibmc_machine_ast1030_evb_class= _init(ObjectClass *oc, aspeed_machine_class_init_cpus_defaults(mc); } =20 +#ifdef TARGET_AARCH64 +static void aspeed_machine_ast2700_evb_class_init(ObjectClass *oc, void *d= ata) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + AspeedMachineClass *amc =3D ASPEED_MACHINE_CLASS(oc); + + mc->desc =3D "Aspeed AST2700 EVB (Cortex-A35)"; + amc->soc_name =3D "ast2700-a0"; + amc->hw_strap1 =3D AST2700_EVB_HW_STRAP1; + amc->hw_strap2 =3D AST2700_EVB_HW_STRAP2; + amc->fmc_model =3D "w25q01jvq"; + amc->spi_model =3D "w25q512jv"; + amc->num_cs =3D 2; + amc->macs_mask =3D ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON; + amc->uart_default =3D ASPEED_DEV_UART12; + mc->default_ram_size =3D 1 * GiB; + aspeed_machine_class_init_cpus_defaults(mc); +} +#endif + static void aspeed_machine_qcom_dc_scm_v1_class_init(ObjectClass *oc, void *data) { @@ -1711,6 +1737,12 @@ static const TypeInfo aspeed_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("ast1030-evb"), .parent =3D TYPE_ASPEED_MACHINE, .class_init =3D aspeed_minibmc_machine_ast1030_evb_class_init, +#ifdef TARGET_AARCH64 + }, { + .name =3D MACHINE_TYPE_NAME("ast2700-evb"), + .parent =3D TYPE_ASPEED_MACHINE, + .class_init =3D aspeed_machine_ast2700_evb_class_init, +#endif }, { .name =3D TYPE_ASPEED_MACHINE, .parent =3D TYPE_MACHINE, --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350196; cv=none; d=zohomail.com; s=zohoarc; b=gBRAOJktT8Q0OEWjCjFT4NM/BdsPqp928hey+LrsCPKHHNBYL6c4jwpL+TB7R8aZD6WZ+TunQTIwG+/4GzR5UIVhr08xE/7eXRJWz6WHDRqv/FbrY99p3cGEQa6vDT5bO/aNFSh7TCHyJLsTknIXcz0O+6xwLE5fsVtImdPIa34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350196; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aoU+Bge2QZ5zBPkFGdidGCwM1XG5mHtF715S1Ovk9Cc=; b=cXtqPmGAB/msXLzYaEPhTkxgLNbXoFpUV8pAe90kANIhu35RGFdafpvPHonZkGlX2voobnEAHJAbeZExP98V6OWOBxWBB9nlY59L+bGIaQ01A1dH7GmVvAVxr7jTz9lg4NwRrPVw0JwP8J2DwT+IVBvQNmMcg5FZf2rRaXWFe+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350196440268.9077338009024; Fri, 14 Jun 2024 00:29:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1M2-0003vL-5n; Fri, 14 Jun 2024 03:28:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M0-0003ph-7D for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Ly-0000pe-IK for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:07 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-262-lJLSe1dgN3OW0u6Tcz_rFw-1; Fri, 14 Jun 2024 03:28:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 16F741954210; Fri, 14 Jun 2024 07:28:01 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C5B9D300021A; Fri, 14 Jun 2024 07:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aoU+Bge2QZ5zBPkFGdidGCwM1XG5mHtF715S1Ovk9Cc=; b=QHL/+HT5gQp4SRh1uSXxX843Zka7GJLL1ewJo9swns9IyzwqfXmCVUOm3zeQtZdNIjuqF6 mwbs2uv0hDRPiR+M5C2AtqgXBXjkwoyUJiIqOxxjv0gGTQoTVFBGeE68Zm5Wcs4ijZoiLC AK6BJHWO+IqjjAp3IcWEYFk3XPveUAo= X-MC-Unique: lJLSe1dgN3OW0u6Tcz_rFw-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 16/19] aspeed/soc: fix incorrect dram size for AST2700 Date: Fri, 14 Jun 2024 09:26:17 +0200 Message-ID: <20240614072620.1262053-17-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350198511100007 From: Jamin Lin AST2700 dram size calculation is not back compatible AST2600. According to the DDR capacity hardware behavior, if users write the data to the address which is beyond the ram size, it would write the data to the "address % ram_size". For example: a. sdram base address "0x4 00000000" b. sdram size 1 GiB The available address range is from "0x4 00000000" to "0x4 3FFFFFFF". If users write 0x12345678 to address "0x5 00000000", the value of DRAM address 0 (base address 0x4 00000000) will be 0x12345678. Add aspeed_soc_ast2700_dram_init to calculate the dram size and add memory I/O whose address range is from "max_ram_size - ram_size" to max_ram= _size and its read/write handler to emulate DDR capacity hardware behavior. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- include/hw/arm/aspeed_soc.h | 2 + hw/arm/aspeed_ast27x0.c | 87 ++++++++++++++++++++++++++++++++++++- 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index caef0d100ba5..849ba37f9524 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -59,6 +59,7 @@ struct AspeedSoCState { MemoryRegion sram; MemoryRegion spi_boot_container; MemoryRegion spi_boot; + AddressSpace dram_as; AspeedRtcState rtc; AspeedTimerCtrlState timerctrl; AspeedI2CState i2c; @@ -129,6 +130,7 @@ struct Aspeed27x0SoCState { ARMCPU cpu[ASPEED_CPUS_NUM]; AspeedINTCState intc; GICv3State gic; + MemoryRegion dram_empty; }; =20 #define TYPE_ASPEED27X0_SOC "aspeed27x0-soc" diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c index 29e75072c4b7..b6876b4862ff 100644 --- a/hw/arm/aspeed_ast27x0.c +++ b/hw/arm/aspeed_ast27x0.c @@ -20,6 +20,7 @@ #include "sysemu/sysemu.h" #include "hw/intc/arm_gicv3.h" #include "qapi/qmp/qlist.h" +#include "qemu/log.h" =20 static const hwaddr aspeed_soc_ast2700_memmap[] =3D { [ASPEED_DEV_SPI_BOOT] =3D 0x400000000, @@ -191,6 +192,90 @@ static qemu_irq aspeed_soc_ast2700_get_irq(AspeedSoCSt= ate *s, int dev) return qdev_get_gpio_in(DEVICE(&a->gic), sc->irqmap[dev]); } =20 +static uint64_t aspeed_ram_capacity_read(void *opaque, hwaddr addr, + unsigned int size) +{ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: DRAM read out of ram size, addr:0x%" PRIx64 "\n", + __func__, addr); + return 0; +} + +static void aspeed_ram_capacity_write(void *opaque, hwaddr addr, uint64_t = data, + unsigned int size) +{ + AspeedSoCState *s =3D ASPEED_SOC(opaque); + ram_addr_t ram_size; + MemTxResult result; + + ram_size =3D object_property_get_uint(OBJECT(&s->sdmc), "ram-size", + &error_abort); + + /* + * Emulate ddr capacity hardware behavior. + * If writes the data to the address which is beyond the ram size, + * it would write the data to the "address % ram_size". + */ + result =3D address_space_write(&s->dram_as, addr % ram_size, + MEMTXATTRS_UNSPECIFIED, &data, 4); + if (result !=3D MEMTX_OK) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: DRAM write failed, addr:0x%" HWADDR_PRIx + ", data :0x%" PRIx64 "\n", + __func__, addr % ram_size, data); + } +} + +static const MemoryRegionOps aspeed_ram_capacity_ops =3D { + .read =3D aspeed_ram_capacity_read, + .write =3D aspeed_ram_capacity_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + }, +}; + +/* + * SDMC should be realized first to get correct RAM size and max size + * values + */ +static bool aspeed_soc_ast2700_dram_init(DeviceState *dev, Error **errp) +{ + ram_addr_t ram_size, max_ram_size; + Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(dev); + AspeedSoCState *s =3D ASPEED_SOC(dev); + AspeedSoCClass *sc =3D ASPEED_SOC_GET_CLASS(s); + + ram_size =3D object_property_get_uint(OBJECT(&s->sdmc), "ram-size", + &error_abort); + max_ram_size =3D object_property_get_uint(OBJECT(&s->sdmc), "max-ram-s= ize", + &error_abort); + + memory_region_init(&s->dram_container, OBJECT(s), "ram-container", + ram_size); + memory_region_add_subregion(&s->dram_container, 0, s->dram_mr); + address_space_init(&s->dram_as, s->dram_mr, "dram"); + + /* + * Add a memory region beyond the RAM region to emulate + * ddr capacity hardware behavior. + */ + if (ram_size < max_ram_size) { + memory_region_init_io(&a->dram_empty, OBJECT(s), + &aspeed_ram_capacity_ops, s, + "ram-empty", max_ram_size - ram_size); + + memory_region_add_subregion(s->memory, + sc->memmap[ASPEED_DEV_SDRAM] + ram_siz= e, + &a->dram_empty); + } + + memory_region_add_subregion(s->memory, + sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container); + return true; +} + static void aspeed_soc_ast2700_init(Object *obj) { Aspeed27x0SoCState *a =3D ASPEED27X0_SOC(obj); @@ -461,7 +546,7 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev= , Error **errp) sc->memmap[ASPEED_DEV_SDMC]); =20 /* RAM */ - if (!aspeed_soc_dram_init(s, errp)) { + if (!aspeed_soc_ast2700_dram_init(dev, errp)) { return; } =20 --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350220; cv=none; d=zohomail.com; s=zohoarc; b=mXtIuIGqKAroabxnYYVW8zdrlQKC0hiUAVaow6dPOSgTrkiihjzQg/21oGdUqytIUpWwazfwCBtyeX2aF1INJCssPuhqMWYi8GAUG85k92SHn/qo2tyPknxbWLQbkHAemWDWsphmooHUGTz5jX41QfPdVo7M8JS4qbqAx/kryBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350220; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mT67xMIBp6ZET7ERJdeOwGv7TN1Z8yNGX5Ar50EezKI=; b=ZC/ZW4E94kRf4qopNsDJxJ83AzIPBYC5r4JFkIc/vXxFKfOievKq5ZG5G4olHb8PGAFvn48cHaA6nLhjGf7IrpvOonWMxg7yyRUuop3n+T6ZOff9P1ESoYEfjH6JYAYYtaKizNNALo5bnIld7e8qm1hc8NUEh8NH7Ldys0R3qIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350220571976.331058140908; Fri, 14 Jun 2024 00:30:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1M3-00040F-2G; Fri, 14 Jun 2024 03:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M1-0003tr-K8 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1Lz-0000pu-Nw for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:09 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-eLg-FX4vO_yyLe-KG9tiPA-1; Fri, 14 Jun 2024 03:28:05 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C0FE1954208; Fri, 14 Jun 2024 07:28:03 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5C7D43000219; Fri, 14 Jun 2024 07:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350087; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mT67xMIBp6ZET7ERJdeOwGv7TN1Z8yNGX5Ar50EezKI=; b=UOvPM3T04w1AMBO7BJE5LvVCAZPMsqKTkRRiCezy7366fGhVgt0jD9i1IcEKPedgwY0cku +mV/aoMdCG88yl/+PaAcobl2y2N4llyuIn7xtc6hUTlk76oM5773t60NERq+M8EUnrVPOC nU+pBk77mRecVppNb6si6hHYH4qj+QI= X-MC-Unique: eLg-FX4vO_yyLe-KG9tiPA-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 17/19] test/avocado/machine_aspeed.py: Add AST2700 test case Date: Fri, 14 Jun 2024 09:26:18 +0200 Message-ID: <20240614072620.1262053-18-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350222605100002 From: Jamin Lin Add a test case to test Aspeed OpenBMC SDK v09.01 on AST2700 board. It loads u-boot-nodtb.bin, u-boot.dtb, tfa and optee-os images to dram first which base address is 0x400000000. Then, boot and launch 4 cpu cores. ``` qemu-system-aarch64 -machine ast2700-evb -device loader,force-raw=3Don,addr=3D0x400000000,file=3Dworkdir/u-boot-= nodtb.bin \ -device loader,force-raw=3Don,addr=3Duboot_dtb_load_addr,file=3Dworkdir= /u-boot.dtb\ -device loader,force-raw=3Don,addr=3D0x430000000,file=3Dworkdir/bl31.bi= n\ -device loader,force-raw=3Don,addr=3D0x430080000,file=3Dworkdir/optee/t= ee-raw.bin\ -device loader,cpu-num=3D0,addr=3D0x430000000 \ -device loader,cpu-num=3D1,addr=3D0x430000000 \ -device loader,cpu-num=3D2,addr=3D0x430000000 \ -device loader,cpu-num=3D3,addr=3D0x430000000 \ -smp 4 \ -drive file=3Dworkdir/image-bmc,format=3Draw,if=3Dmtd ``` A test image is downloaded from the ASPEED Forked OpenBMC GitHub release re= pository : https://github.com/AspeedTech-BMC/openbmc/releases/ Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- tests/avocado/machine_aspeed.py | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed= .py index cec018142453..3a20644fb2ad 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -311,6 +311,17 @@ def do_test_arm_aspeed_sdk_start(self, image): self, 'boot', '## Loading kernel from FIT Image') self.wait_for_console_pattern('Starting kernel ...') =20 + def do_test_aarch64_aspeed_sdk_start(self, image): + self.vm.set_console() + self.vm.add_args('-drive', 'file=3D' + image + ',if=3Dmtd,format= =3Draw') + + self.vm.launch() + + self.wait_for_console_pattern('U-Boot 2023.10') + self.wait_for_console_pattern('## Loading kernel from FIT Image') + self.wait_for_console_pattern('Starting kernel ...') + self.wait_for_console_pattern("systemd[1]: Hostname set to") + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable on G= itLab') =20 def test_arm_ast2500_evb_sdk(self): @@ -375,3 +386,54 @@ def test_arm_ast2600_evb_sdk(self): 'i2c i2c-5: new_device: Instantiated device ds1307 at 0x32'); year =3D time.strftime("%Y") self.ssh_command_output_contains('/sbin/hwclock -f /dev/rtc1', yea= r); + + def test_aarch64_ast2700_evb_sdk_v09_01(self): + """ + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:ast2700-evb + """ + + image_url =3D ('https://github.com/AspeedTech-BMC/openbmc/releases= /' + 'download/v09.01/ast2700-default-obmc.tar.gz') + image_hash =3D 'b1cc0fd73c7650d34c9c8459a243f52a91e9e27144b8608b26= 45ab19461d1e07' + image_path =3D self.fetch_asset(image_url, asset_hash=3Dimage_hash, + algorithm=3D'sha256') + archive.extract(image_path, self.workdir) + + num_cpu =3D 4 + image_dir =3D self.workdir + '/ast2700-default/' + uboot_size =3D os.path.getsize(image_dir + 'u-boot-nodtb.bin') + uboot_dtb_load_addr =3D hex(0x400000000 + uboot_size) + + load_images_list =3D [ + { + 'addr': '0x400000000', + 'file': image_dir + 'u-boot-nodtb.bin' + }, + { + 'addr': str(uboot_dtb_load_addr), + 'file': image_dir + 'u-boot.dtb' + }, + { + 'addr': '0x430000000', + 'file': image_dir + 'bl31.bin' + }, + { + 'addr': '0x430080000', + 'file': image_dir + 'optee/tee-raw.bin' + } + ] + + for load_image in load_images_list: + addr =3D load_image['addr'] + file =3D load_image['file'] + self.vm.add_args('-device', + f'loader,force-raw=3Don,addr=3D{addr},file=3D= {file}') + + for i in range(num_cpu): + self.vm.add_args('-device', + f'loader,addr=3D0x430000000,cpu-num=3D{i}') + + self.vm.add_args('-smp', str(num_cpu)) + self.do_test_aarch64_aspeed_sdk_start(image_dir + 'image-bmc') + --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350177; cv=none; d=zohomail.com; s=zohoarc; b=Eeq+sH1DLyaAPEXXMYMZyXeCXi7sRsg3xmuBE7AMGzSYKSS8fLzGKbsXv1XCc8lUbdQN+bcWkT/owYviLj4ROHNpkbLvB2yrz77mZj5MKpAc6R9r14EnrcmP49tDxpVqKohcFYwYIK+1/sguHkfkxcJYcBuqrNnBDW7kDRhxdIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350177; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+aHLk7nwr1ukJ4voNXZNsv4nvrC5BSxbI4+G89eCwJ4=; b=llT4PECpQFKfrAVD5hXxtx0jdJeDfRb8UAv4YpUg98zAn2SHgbjPgFBePbhfkGBN3YVmpiAJro9i3PGKc5O/C4YMMSsLcDifkKcPsALJq15raSHgHK4pY2KnfbNMqbV0a9rqZLwkUORpdI6ewjq/7tV7ZHRcH0odDQXPrK38Wn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350177305715.5079019131833; Fri, 14 Jun 2024 00:29:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1MB-0004Ji-Fs; Fri, 14 Jun 2024 03:28:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M9-0004Dg-0O for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M7-0000sM-94 for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:16 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-5ulapZ1FNUKx_HNa_MglrQ-1; Fri, 14 Jun 2024 03:28:07 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1BFF919560B8; Fri, 14 Jun 2024 07:28:05 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6E21B3000219; Fri, 14 Jun 2024 07:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+aHLk7nwr1ukJ4voNXZNsv4nvrC5BSxbI4+G89eCwJ4=; b=XvdadcurmScwe3ZoSYcbcviCPMKPMd0J1286IHtZmL4FYBSULxiU37ZUMZPjDXA/mK+QTl jUz3yC1QrViUomslTyz/GwiGPfFIgkmoBXyqOUQNKT4R+HfnpDBmHFKPk1ogyj8VeNt/5p vBe3b375q6P2/TDqLgS9LhIsBjG8rhY= X-MC-Unique: 5ulapZ1FNUKx_HNa_MglrQ-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 18/19] docs:aspeed: Add AST2700 Evaluation board Date: Fri, 14 Jun 2024 09:26:19 +0200 Message-ID: <20240614072620.1262053-19-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350178421100002 From: Jamin Lin Add AST2700 Evaluation board and its boot command. Signed-off-by: Troy Lee Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater --- docs/system/arm/aspeed.rst | 39 ++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst index b2dea54eedad..cd9559e3e291 100644 --- a/docs/system/arm/aspeed.rst +++ b/docs/system/arm/aspeed.rst @@ -1,11 +1,12 @@ -Aspeed family boards (``*-bmc``, ``ast2500-evb``, ``ast2600-evb``) -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Aspeed family boards (``*-bmc``, ``ast2500-evb``, ``ast2600-evb``, ``ast27= 00-evb``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =20 The QEMU Aspeed machines model BMCs of various OpenPOWER systems and Aspeed evaluation boards. They are based on different releases of the Aspeed SoC : the AST2400 integrating an ARM926EJ-S CPU (400MHz), the -AST2500 with an ARM1176JZS CPU (800MHz) and more recently the AST2600 -with dual cores ARM Cortex-A7 CPUs (1.2GHz). +AST2500 with an ARM1176JZS CPU (800MHz), the AST2600 +with dual cores ARM Cortex-A7 CPUs (1.2GHz) and more recently the AST2700 +with quad cores ARM Cortex-A35 64 bits CPUs (1.6GHz) =20 The SoC comes with RAM, Gigabit ethernet, USB, SD/MMC, USB, SPI, I2C, etc. @@ -38,6 +39,10 @@ AST2600 SoC based machines : - ``qcom-dc-scm-v1-bmc`` Qualcomm DC-SCM V1 BMC - ``qcom-firework-bmc`` Qualcomm Firework BMC =20 +AST2700 SoC based machines : + +- ``ast2700-evb`` Aspeed AST2700 Evaluation board (Cortex-A35) + Supported devices ----------------- =20 @@ -66,6 +71,7 @@ Supported devices * eMMC Boot Controller (dummy) * PECI Controller (minimal) * I3C Controller + * Internal Bridge Controller (SLI dummy) =20 =20 Missing devices @@ -95,6 +101,10 @@ or directly from the OpenBMC GitHub release repository : =20 https://github.com/openbmc/openbmc/releases =20 +or directly from the ASPEED Forked OpenBMC GitHub release repository : + + https://github.com/AspeedTech-BMC/openbmc/releases + To boot a kernel directly from a Linux build tree: =20 .. code-block:: bash @@ -164,6 +174,27 @@ under Linux), use : =20 -M ast2500-evb,bmc-console=3Duart3 =20 + +Boot the AST2700 machine from the flash image, use an MTD drive : + +.. code-block:: bash + + IMGDIR=3Dast2700-default + UBOOT_SIZE=3D$(stat --format=3D%s -L ${IMGDIR}/u-boot-nodtb.bin) + + $ qemu-system-aarch64 -M ast2700-evb \ + -device loader,force-raw=3Don,addr=3D0x400000000,file=3D${IMGDIR}/u= -boot-nodtb.bin \ + -device loader,force-raw=3Don,addr=3D$((0x400000000 + ${UBOOT_SIZE}= )),file=3D${IMGDIR}/u-boot.dtb \ + -device loader,force-raw=3Don,addr=3D0x430000000,file=3D${IMGDIR}/b= l31.bin \ + -device loader,force-raw=3Don,addr=3D0x430080000,file=3D${IMGDIR}/o= ptee/tee-raw.bin \ + -device loader,cpu-num=3D0,addr=3D0x430000000 \ + -device loader,cpu-num=3D1,addr=3D0x430000000 \ + -device loader,cpu-num=3D2,addr=3D0x430000000 \ + -device loader,cpu-num=3D3,addr=3D0x430000000 \ + -smp 4 \ + -drive file=3D${IMGDIR}/image-bmc,format=3Draw,if=3Dmtd \ + -nographic + Aspeed minibmc family boards (``ast1030-evb``) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.45.2 From nobody Mon Nov 25 01:53:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1718350102; cv=none; d=zohomail.com; s=zohoarc; b=LSVAfQ6XnA023PY5oCICzOdaFTfx+YX3N6DWKp/QrMAO9rGuw1kuIw39XW7lEj7+5vAAOBw/Fxgqtf1cVGSHrV2IZFIw4Ts5rZsvrRIGrUP1XoH4YfKI8EEE83Wgq4EDTEAPQ2YXolE72/8aNkBJGrXC4dl64KXbVeL2NK0RPk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718350102; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bpcuwxjalIJ0QJAmlthQ2zrRXoFKbmpEf1OqfPzxvQE=; b=EGS6geOfA5qo7I+af3+jA6/ZXf0V739uslbDBAPlYYHX/pZGVH/t8w52sNuS5KtVNUzDW7krl1VVX5av7craWUE+ZGP7g+chkcND+jaguvrq/vdHrkJ7HonaDsjlr8JTYj38B7G05XpNdhPVwUB5OsZqZerKH658W56fvqSH+FU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718350102854157.17803445549146; Fri, 14 Jun 2024 00:28:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI1M9-0004Ea-AI; Fri, 14 Jun 2024 03:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M7-0004Br-Lc for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sI1M6-0000rx-9h for qemu-devel@nongnu.org; Fri, 14 Jun 2024 03:28:15 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-148-QTXTrMYiMAWpI4Wq7KXJzA-1; Fri, 14 Jun 2024 03:28:09 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35ABA195608C; Fri, 14 Jun 2024 07:28:08 +0000 (UTC) Received: from corto.redhat.com (unknown [10.39.192.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7CE653000222; Fri, 14 Jun 2024 07:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718350093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bpcuwxjalIJ0QJAmlthQ2zrRXoFKbmpEf1OqfPzxvQE=; b=HiSVbksPd4Yi+FKdpxdxKIlHPygoGxmlr72W1KIHHVSxzNPrz/xJd4lBzwhqi7TVRcdGs8 w/QjqcALY/bM4a4I5bcT2TG/4tGCZ86yMMorfvS//Y2esdsX5M2Ke4ceQnGL7fPwL2Ik+k a7WbZ15CVRMDGh623+VfCCbbQ4rU818= X-MC-Unique: QTXTrMYiMAWpI4Wq7KXJzA-1 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Jamin Lin , Troy Lee , Steven Lee , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Jeffery Subject: [PULL 19/19] MAINTAINERS: Add reviewers for ASPEED BMCs Date: Fri, 14 Jun 2024 09:26:20 +0200 Message-ID: <20240614072620.1262053-20-clg@redhat.com> In-Reply-To: <20240614072620.1262053-1-clg@redhat.com> References: <20240614072620.1262053-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1718350104205100022 From: Jamin Lin Add ASPEED members "Steven Lee", "Troy Lee" and "Jamin Lin" to be reviewers of ASPEED BMCs. Signed-off-by: Jamin Lin Signed-off-by: Troy Lee Signed-off-by: Steven Lee Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Andrew Jeffery --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 951556224a1b..0f63bcdc7dc7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1158,6 +1158,9 @@ F: docs/system/arm/emcraft-sf2.rst ASPEED BMCs M: C=C3=A9dric Le Goater M: Peter Maydell +R: Steven Lee +R: Troy Lee +R: Jamin Lin R: Andrew Jeffery R: Joel Stanley L: qemu-arm@nongnu.org --=20 2.45.2