From patchwork Thu Jan 18 18:38:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 863093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gcGnwR0H"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zMtPV6c9Sz9s7M for ; Fri, 19 Jan 2018 05:52:46 +1100 (AEDT) Received: from localhost ([::1]:47632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecFIr-0007IR-2Q for incoming@patchwork.ozlabs.org; Thu, 18 Jan 2018 13:52:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecF9F-0007y8-2C for qemu-devel@nongnu.org; Thu, 18 Jan 2018 13:42:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecF9C-0003Gj-6t for qemu-devel@nongnu.org; Thu, 18 Jan 2018 13:42:49 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:40036) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecF9C-0003GN-0p; Thu, 18 Jan 2018 13:42:46 -0500 Received: by mail-pf0-x243.google.com with SMTP id i66so15312936pfd.7; Thu, 18 Jan 2018 10:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ziPNeaNVZJqh7F/X7tlD2WjijnRpnQIxmXMcOPgStBE=; b=gcGnwR0HhCU7rQaKfByhOYiEg3mNhDY8Xn6AVdkMt9n7XXT1diBJ0dwB3QDosf4N+E k5hNUUF8mAy6/o3070FOdIVNgnG9/v/XPrOryCbkR6u+DLNZ/bcwOZZjZj4BiIhBFN3Z OUv9a3HdvIjGEGiQNNd4pvd4V7R5JiNbUX7Uu2mi+gJJY4JcGiNYduspBIeYjSOvoIwe r8qxHkphLYntA9RhIKGlrxEfNfwFaQehAhKc6odzYc1jc3clgEk7A1j+ZDl0FSiaWml7 f1EF8cPcxH4rTViSDQZHPlMgw9Olb0eOyc1ZROI7qT7UXuojdOZTUZpBXAK+yMuibbo+ JQnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ziPNeaNVZJqh7F/X7tlD2WjijnRpnQIxmXMcOPgStBE=; b=ExOfjcP8fTEh1Kis7t1r6BYmvqYGyV6dt1eHYei421QCS4oop/YO24+PlTobXreRDl boA+Aa9KXRCtGCmxhywb69PT2R8LI5n7qQEs49yqytNYXswtljQPu8iLaqgwUtKiqdNU xyNdtVuClqPP5n+3wKFtPRoQtMDTtw5VkcBo/aZtKD/oEujX+lQXXSwNSthP1IHWsf8v oxGvWQamFAZkaJXXGw4WkTJcKPI4xgVs+xlvjVjFBj2AVcYUzXM9ozfAD2+sILTdkKYZ 1Cm0nVBB4IdkzJA6cBl09xXH3tQzKF2oc3Q+gcXEyI9brX2T+20PAHEoxklzcej07IqQ Cxew== X-Gm-Message-State: AKwxytdkmWqzH2cxRDpOocR4KkO2pwHuVDGibGOU7MVmulKwtw+c3Hj8 pQlVFd/VLOFq2icd48BN0BTxNPHKjv0= X-Google-Smtp-Source: ACJfBovQYcZ7q8xdPNIzjaldKTZXM7UqktqgABXAsnon9wmtzsAGi8PXiuyFdptzVmsnlHBZHkq3DQ== X-Received: by 10.99.152.84 with SMTP id l20mr18423580pgo.382.1516300964825; Thu, 18 Jan 2018 10:42:44 -0800 (PST) Received: from localhost ([149.199.62.254]) by smtp.gmail.com with ESMTPSA id m12sm12686533pga.68.2018.01.18.10.42.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 10:42:43 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org, edgar.iglesias@xilinx.com, edgar.iglesias@gmail.com Date: Thu, 18 Jan 2018 10:38:18 -0800 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v6 8/9] 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: alistair23@gmail.com, qemu-arm@nongnu.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- V4: - Move the IPI to the machine instead of the SoC 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-pmu.c index 7312bfe23e..999a5657cf 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" +#include "hw/intc/xlnx-zynqmp-ipi.h" #include "hw/intc/xlnx-pmu-iomod-intc.h" /* Define the PMU device */ @@ -38,6 +39,15 @@ #define XLNX_ZYNQMP_PMU_INTC_ADDR 0xFFD40000 +#define XLNX_ZYNQMP_PMU_NUM_IPIS 4 + +static const uint64_t ipi_addr[XLNX_ZYNQMP_PMU_NUM_IPIS] = { + 0xFF340000, 0xFF350000, 0xFF360000, 0xFF370000, +}; +static const uint64_t ipi_irq[XLNX_ZYNQMP_PMU_NUM_IPIS] = { + 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 = get_system_memory(); MemoryRegion *pmu_rom = g_new(MemoryRegion, 1); MemoryRegion *pmu_ram = g_new(MemoryRegion, 1); + XlnxZynqMPIPI *ipi[XLNX_ZYNQMP_PMU_NUM_IPIS]; + qemu_irq irq[32]; + int i; /* 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); + for (i = 0; i < 32; i++) { + irq[i] = qdev_get_gpio_in(DEVICE(&pmu->intc), i); + } + + /* Create and connect the IPI device */ + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IPIS; i++) { + ipi[i] = 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 = 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,