From patchwork Thu Dec 12 13:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kenneth_jia--- via X-Patchwork-Id: 13905239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49AF9E7717F for ; Thu, 12 Dec 2024 14:07:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLjq7-0008DR-FE; Thu, 12 Dec 2024 09:06:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLjIX-0008WD-P2; Thu, 12 Dec 2024 08:32:09 -0500 Received: from ms.asus.com ([103.10.4.142]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLjIV-0008Cn-IF; Thu, 12 Dec 2024 08:32:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=asus.com; i=@asus.com; q=dns/txt; s=asuscom; t=1734010328; x=1765546328; h=from:to:cc:subject:date:message-id:mime-version; bh=+BWRoSgWsOE7X8gxhEeW0GKnSxnR6+ax66jypHGL0EM=; b=kSEIwmPlsA74iIJV6EMf8DtoY9h5NgfN7Axe5t2Nge8i8folPRv+DkN7 gMKv3aXwpXHr8TZT8rbXrVtviwDHWoFvWbKZkLQBXqLWKVr4NxGMEAE1j xZHT+kT+75GOzQHkOmSgAccuA+LV8S8PoauqB8TBPMH2WpksPrubnfSal M=; IronPort-Data: A9a23:I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7stpZZm4m/Tb0I/jaQQLQwUq8hWKkFqTmcHHOgndwxMXST8K3rs462 jClGXCl9uej80= X-Talos-CUID: 9a23:WXESg2DWaC35lN76EwxG5BENOMUqSVnM9WXMc22TVGJTZoTAHA== X-Talos-MUID: 9a23:qgDWzw1sjfJ1021UQiCDgpNB6jUjuq7zBmoAioo/nsiHETVfCzvDhQbse9py Received: from unknown (HELO ACC-EX16-V01.acc.corpnet.asus) ([172.29.34.11]) by ms.asus.com with ESMTP; 12 Dec 2024 21:31:55 +0800 Received: from ACC-EX16-V03.acc.corpnet.asus (172.29.34.13) by ACC-EX16-V01.acc.corpnet.asus (172.29.34.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.43; Thu, 12 Dec 2024 21:31:54 +0800 Received: from ACC-EX16-V03.acc.corpnet.asus ([fe80::3dae:532a:2ef6:9654]) by ACC-EX16-V03.acc.corpnet.asus ([fe80::3dae:532a:2ef6:9654%3]) with mapi id 15.01.2507.043; Thu, 12 Dec 2024 21:31:48 +0800 To: "'qemu-arm@nongnu.org'" CC: =?eucgb2312_cn?b?J0OopmRyaWMgTGUgR29hdGVyJw==?= , =?eucgb2312_cn?b?J1BoaWxpcHBlIE1hdGhpZXUtRGF1ZKimJw==?= , "'Jamin Lin'" , 'Andrew Jeffery' , 'Gavin Shan' , "'open list:All patches CC here'" Subject: [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts Thread-Topic: [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts Thread-Index: AdtMmbwfoRQua2veTYW8MQ+0Vi041Q== Date: Thu, 12 Dec 2024 13:31:48 +0000 Message-ID: <5f9b0c53f1644922ba85522046e92f4c@asus.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [116.235.194.63] x-tm-as-product-ver: SMEX-14.0.0.3223-9.1.2019-28826.004 x-tm-as-result: No-10--14.720100-8.000000 x-tmase-matchedrid: 17iyaxE7EzIfHU5fltg9RrbW4WOZNAUnj5XD/cFEQwaQ+UeH24Dz4Lhu upHpXEmLU2VRnkEujdpjybcuQlsAB7ipA0mFNtPDyGyaQXOvRx4pihtGF1HQYaINgcEzNI9j7AI n5hx14Jqif1w5aAHlEkOBQVcKGV65AyTN38gAq/3vgBmbjAvGcP4HMKRDK5w12YGbrr/jo0ffOn cxfqt6MFxvJFCPsGl/3S/hhdntlxAm0dhXKknEYuKkRrdQOxlEJeVHOyz36PR3+86qkOXr2qF1m 9FYSo2UVs7wr6DPfUIagKanydgPttdASTplK1Vu5PkCeM7tNe3Ed+T1CCeSceHZCF6RvUzMY3Pf SmNBHfKjg0lrtKMWyoAII85gNIZEPRhkRGot+L5w0hoJ16zIu7LMDEFKafMtcHZCeuS/TLNsMSR /KkjaoxLRXl5vgI6AUvWcNoeLMyxYKVgm72vjJg== x-tm-as-user-approved-sender: No x-tm-as-user-blocked-sender: No x-tmase-result: 10--14.720100-8.000000 x-tmase-version: SMEX-14.0.0.3223-9.1.2019-28826.004 x-tm-snts-smtp: F343C16444858CD64C6543F9F7079A6048EF239BBCBDAED2B483D0437155F81A2000:9 MIME-Version: 1.0 Received-SPF: pass client-ip=103.10.4.142; envelope-from=prvs=06952aba3=kenneth_jia@asus.com; helo=ms.asus.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) BAYES_00=-1.9, CHARSET_FARAWAY_HEADER=3.2, DKIMWL_WL_HIGH=-0.496, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 12 Dec 2024 09:05:35 -0500 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: , Reply-to: =?eucgb2312_cn?b?S2VubmV0aCBKaWEovNa8zbarX7uqy7bJz7qjKQ==?= X-Patchwork-Original-From: kenneth_jia--- via From: kenneth_jia--- via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From 24d3badbbb9dcc0d220609a7dd30f8da5002cba7 Mon Sep 17 00:00:00 2001 From: Kenneth Jia Date: Thu, 12 Dec 2024 20:42:04 +0800 Subject: [PATCH] hw/arm/aspeed: fix connect_serial_hds_to_uarts In the loop, we need ignore the index increase when uart == uart_chosen We should increase the index only after we allocate a serial. Signed-off-by: Kenneth Jia --- hw/arm/aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.34.1 diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 556498f2a0..d8cb2d1429 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -364,11 +364,11 @@ static void connect_serial_hds_to_uarts(AspeedMachineState *bmc) int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen : amc->uart_default; aspeed_soc_uart_set_chr(s, uart_chosen, serial_hd(0)); - for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; i++, uart++) { + for (int i = 1, uart = sc->uarts_base; i < sc->uarts_num; uart++) { if (uart == uart_chosen) { continue; } - aspeed_soc_uart_set_chr(s, uart, serial_hd(i)); + aspeed_soc_uart_set_chr(s, uart, serial_hd(i++)); } }