From nobody Tue Oct 28 01:50:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516104029770482.2871692970855; Tue, 16 Jan 2018 04:00:29 -0800 (PST) Received: from localhost ([::1]:59273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebPum-0004dW-QT for importer@patchew.org; Tue, 16 Jan 2018 07:00:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebPm4-0005jv-Ig for qemu-devel@nongnu.org; Tue, 16 Jan 2018 06:51:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebPly-0000I5-RJ for qemu-devel@nongnu.org; Tue, 16 Jan 2018 06:51:28 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:39281) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebPly-0000Hl-KC for qemu-devel@nongnu.org; Tue, 16 Jan 2018 06:51:22 -0500 Received: by mail-lf0-x242.google.com with SMTP id m8so17072400lfc.6 for ; Tue, 16 Jan 2018 03:51:22 -0800 (PST) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id 62sm374598ljj.12.2018.01.16.03.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 03:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YtoiBiTr+8RG087KbQn7nWMQ1daOEEI8H0bTMmGFnvk=; b=jrsMAqgrTnuSBgFLAssMfLJ/VJWvPsfpqcnVNJ2zkhLNNcPC5rKl5Zw+BFW6zwKtJ5 sRuso/wnhH5FsKyOdacReuCO6pmSefjFoZQGwSYtZ6FNhLmkguZFO/6qbTrmknPB7Nru wJMhPfpn/19rTGj/8fX6accxE9WV9fbPckxPDX22Sugjq+DRbQB9oP1YB9EUHJdMdabY huAr9yyW0g8X3q6Hmeb1ZTkmaVNMs/eZYzH5yn0O0wruP5FOK5TeApr+FMPJpwVHV4dC 8nwLpQIOXsdpu/DYPfnrs2r4p1NvINTo20dV6dgsY+ESIdl+NjGd5MZ9Qa2S7U7vIXRI LR7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YtoiBiTr+8RG087KbQn7nWMQ1daOEEI8H0bTMmGFnvk=; b=HqE5WYocH60IrH3Si7aIeVfFx7Sv/FSTl9lTViihtvuIwMgZtkntm1BEuRwzwC7Nqy 24r1bZGVoQGkkPQuQ407XRTQjzSqT1KnDZKFBlUOJ3c5QBfeiDPfdVvQ+z/C3yPG7vJ8 J0J0VexsJv4vRmAYfxaKJDrbLhdsssAmyIjYX3Q/+Bixn8ndLZ1dTYABajntWEcSrX3I x33rq6uUxTM2UlGcAIm1JE7YQF3pOCwYmCC5lHhGJ+5bg88OBgmAFa6TW/iLxNq1Jg3J oR18axj/ykH37YjDy1COuxdpLGY5675SKJVOpFQT9HbM17beBgXjAHk7cM14ZcIpcphl 2rEA== X-Gm-Message-State: AKGB3mIys3/yTUjDh2JOYNPrHwVXMgvLbCT8Lh/i5cl9NW4Gxr67HpW6 +9UYZyLtSSp/wkCJYrLHEJcgXg== X-Google-Smtp-Source: ACJfBosa1k4qWKigWZUIdWKs5oAev486yceaIoQHA9ZIBayuiX+J6P3BtTdwP8WOPbSpe59mtCqTfA== X-Received: by 10.46.70.2 with SMTP id t2mr23589058lja.140.1516103481080; Tue, 16 Jan 2018 03:51:21 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 16 Jan 2018 12:51:06 +0100 Message-Id: <1516103467-7983-8-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516103467-7983-1-git-send-email-edgar.iglesias@gmail.com> References: <1516103467-7983-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PULL v1 7/8] xlnx-zynqmp-pmu: Connect the IPI device to the PMU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sai.pavan.boddu@xilinx.com, edgar.iglesias@xilinx.com, alistai@xilinx.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Signed-off-by: Alistair Francis Reviewed-by: Edgar E. Iglesias Signed-off-by: Edgar E. Iglesias --- hw/microblaze/xlnx-zynqmp-pmu.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pm= u.c index 828eeed..14b8ed4 100644 --- a/hw/microblaze/xlnx-zynqmp-pmu.c +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -24,6 +24,7 @@ #include "cpu.h" #include "boot.h" =20 +#include "hw/intc/xlnx-zynqmp-ipi.h" #include "hw/intc/xlnx-pmu-iomod-intc.h" =20 /* Define the PMU device */ @@ -38,6 +39,15 @@ =20 #define XLNX_ZYNQMP_PMU_INTC_ADDR 0xFFD40000 =20 +#define XLNX_ZYNQMP_PMU_NUM_IPIS 4 + +static const uint64_t ipi_addr[XLNX_ZYNQMP_PMU_NUM_IPIS] =3D { + 0xFF340000, 0xFF350000, 0xFF360000, 0xFF370000, +}; +static const uint64_t ipi_irq[XLNX_ZYNQMP_PMU_NUM_IPIS] =3D { + 19, 20, 21, 22, +}; + typedef struct XlnxZynqMPPMUSoCState { /*< private >*/ DeviceState parent_obj; @@ -136,6 +146,9 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *pmu_rom =3D g_new(MemoryRegion, 1); MemoryRegion *pmu_ram =3D g_new(MemoryRegion, 1); + XlnxZynqMPIPI *ipi[XLNX_ZYNQMP_PMU_NUM_IPIS]; + qemu_irq irq[32]; + int i; =20 /* Create the ROM */ memory_region_init_rom(pmu_rom, NULL, "xlnx-zynqmp-pmu.rom", @@ -155,6 +168,24 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) &error_abort); object_property_set_bool(OBJECT(pmu), true, "realized", &error_fatal); =20 + for (i =3D 0; i < 32; i++) { + irq[i] =3D qdev_get_gpio_in(DEVICE(&pmu->intc), i); + } + + /* Create and connect the IPI device */ + for (i =3D 0; i < XLNX_ZYNQMP_PMU_NUM_IPIS; i++) { + ipi[i] =3D g_new0(XlnxZynqMPIPI, 1); + object_initialize(ipi[i], sizeof(XlnxZynqMPIPI), TYPE_XLNX_ZYNQMP_= IPI); + qdev_set_parent_bus(DEVICE(ipi[i]), sysbus_get_default()); + } + + for (i =3D 0; i < XLNX_ZYNQMP_PMU_NUM_IPIS; i++) { + object_property_set_bool(OBJECT(ipi[i]), true, "realized", + &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(ipi[i]), 0, ipi_addr[i]); + sysbus_connect_irq(SYS_BUS_DEVICE(ipi[i]), 0, irq[ipi_irq[i]]); + } + /* Load the kernel */ microblaze_load_kernel(&pmu->cpu, XLNX_ZYNQMP_PMU_RAM_ADDR, machine->ram_size, --=20 2.7.4