From nobody Fri May 17 02:03:40 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 ARC-Seal: i=1; a=rsa-sha256; t=1681392960; cv=none; d=zohomail.com; s=zohoarc; b=VZQS8GiLwIP8J/CTaV7fzZAbJX84osLqqi54r9k6BbNIsYgfWvIbxUu2WRVFBasm5urWweXLW4+Zqlt66YTuSKnX8hhlMeebTDY/dbSd/YqRMiti6dRxCSwL2bM4kq58FqCIZsIWKAGVRA2n9ztsRRU+EmAle0LquIFn5f5L1GU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681392960; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fddc4In/XQfRFQB17O0ghe7YSnR/26YAmE4GlNFqlHU=; b=SnQXo9kg0zGPTQA3H8eoInFPhzeVUlmk9Fbe5fF9CeN263kygFmeF7pAEVBvmLB+msYcyRPPony9CcFyh6Rms5e6uJulwiqmcA2HRdDdbablgBJtCTVpRBoX/5ATKl13Fqo241pr1og7JtqIA71iu7eZKFEWEQKToeGEdKtEfPA= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1681392960025193.95968694158285; Thu, 13 Apr 2023 06:36:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmx6A-0000PC-VG; Thu, 13 Apr 2023 09:34:51 -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 1pmx69-0000OP-4p; Thu, 13 Apr 2023 09:34:49 -0400 Received: from forward103a.mail.yandex.net ([178.154.239.86]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pmx66-0007E1-9r; Thu, 13 Apr 2023 09:34:48 -0400 Received: from mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0f:26a7:0:640:a2d5:0]) by forward103a.mail.yandex.net (Yandex) with ESMTP id 18CDE46D2E; Thu, 13 Apr 2023 16:34:38 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id aYXaEQ3DaqM0-s7DP2ZSK; Thu, 13 Apr 2023 16:34:37 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syntacore.com; s=mail; t=1681392877; bh=fddc4In/XQfRFQB17O0ghe7YSnR/26YAmE4GlNFqlHU=; h=Message-Id:Date:Cc:Subject:To:From; b=xK8k1mbJETLJ+2t/8vRzDr8pIzqGdzl7h9WEEkbGEWOVVzzd+CjfRFDdZltsbTpdm yF++jo+6vmfMMsRVNqozr+9e+h8sKoXWxZyWq8fc/+1+9qUl1DgL9g96iejZ02u1lD Mnb0R9+N2LTYKrq7/9ikVFgcLfpyrsA8GnbAGD68= Authentication-Results: mail-nwsmtp-smtp-production-main-84.vla.yp-c.yandex.net; dkim=pass header.i=@syntacore.com From: Ivan Klokov To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, richard.henderson@linaro.org, anup@brainfault.org, anup.patel@wdc.com, palmer@dabbelt.com, alistair.francis@wdc.com, Ivan Klokov Subject: [PATCH] hw/intc/riscv_aplic: Zero init APLIC internal state Date: Thu, 13 Apr 2023 16:34:32 +0300 Message-Id: <20230413133432.53771-1-ivan.klokov@syntacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=178.154.239.86; envelope-from=ivan.klokov@syntacore.com; helo=forward103a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @syntacore.com) X-ZM-MESSAGEID: 1681392961969100003 Content-Type: text/plain; charset="utf-8" Since g_new is used to initialize the RISCVAPLICState->state structure, in some case we get behavior that is not as expected. This patch changes this to g_new0, which allows to initialize the APLIC in the correct= state. Signed-off-by: Ivan Klokov Reviewed-by: Alistair Francis Reviewed-by: Anup Patel --- hw/intc/riscv_aplic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c index cfd007e629..71591d44bf 100644 --- a/hw/intc/riscv_aplic.c +++ b/hw/intc/riscv_aplic.c @@ -803,7 +803,7 @@ static void riscv_aplic_realize(DeviceState *dev, Error= **errp) =20 aplic->bitfield_words =3D (aplic->num_irqs + 31) >> 5; aplic->sourcecfg =3D g_new0(uint32_t, aplic->num_irqs); - aplic->state =3D g_new(uint32_t, aplic->num_irqs); + aplic->state =3D g_new0(uint32_t, aplic->num_irqs); aplic->target =3D g_new0(uint32_t, aplic->num_irqs); if (!aplic->msimode) { for (i =3D 0; i < aplic->num_irqs; i++) { --=20 2.34.1