From patchwork Thu Feb 28 11:08:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 159339 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp510527jad; Thu, 28 Feb 2019 03:19:43 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib6sr+ON54g35NCdj8UwNFjkKV904cUtzbXKrnbdlny8AQsZnzBQ0GqZSPNJxnY2u4Fnivl X-Received: by 2002:a25:2005:: with SMTP id g5mr6120428ybg.54.1551352783075; Thu, 28 Feb 2019 03:19:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551352783; cv=none; d=google.com; s=arc-20160816; b=IMdipEzQ4a7YqVMacjqQH0FMRW7C6vvIEcTp/+VKko7esWC6yvXj6oepa1YZLUzsQK RSm51IL38kwxYQM9PbkF1qDOxdvnFYuTgCxncgylwTcw04aROoY7soKONvHIc13keb2t chxg4NhCQaeLja+wMrSiWrJRaPBC5RJkDvs2FrnjyUPLqKN5uYDquBBzZZfsaCrOiNjV msIczRGk570JverMioccEu6iWriDJaFGIpIlpdgfmwwyp+d7Ooe9Ns2gv9kgV9M9JadO IAn5vaxQarLzUycZl3a3+gVtUkK0QDRd+3I2yixunAW/iyWDxwDaI7ep3AjGcbKt9iz3 2gPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=dPU8d1m24X8aOeptyIsV4Y0L5+jKGyTS5Y44vHgV6FM=; b=mbFBJq9xHzrkyMMmjGlnWfImh2kw9GoZ99zuAsMpag5i5dcRp1km1ZuPAh4kYzc9cF tTneAuNmK4movZot+VKzdoFTrCQk8yj6UIYOaBVqfgKc+lNBmXtcbIuFfCK4Nj7tdTF9 JsFV27DjofxV6/uusRD0V53fAlhu1sAyerfIIcWnbSmIyhHMEkUgJF0m6mR7X9eNzddR Eiw0PtOnYPo0tPbR9F/wVwjQi1F+l/RTxOulpO/VzhGWV7f5wTReTgbhTPpsk2VtH1lQ Y3pRGNoyZK9C3PfZypqpScr3smRd6uk2bQ1wTvK8ItPZrRbLK85COEjvo4KezgxOp2Hj ngAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zIkkWUf0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h143si9944932ywa.352.2019.02.28.03.19.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Feb 2019 03:19:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zIkkWUf0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:36290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzJj4-000055-ES for patch@linaro.org; Thu, 28 Feb 2019 06:19:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzJYt-0001LT-CG for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzJYn-0003cy-6K for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:11 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:35248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzJYm-0003GD-Uz for qemu-devel@nongnu.org; Thu, 28 Feb 2019 06:09:05 -0500 Received: by mail-wm1-x344.google.com with SMTP id y15so8528011wma.0 for ; Thu, 28 Feb 2019 03:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=dPU8d1m24X8aOeptyIsV4Y0L5+jKGyTS5Y44vHgV6FM=; b=zIkkWUf0KMb81vqL+rVQjoxFFOGQaQcu998DWbgbdYt1eRJL05uAExDQmNxqp2T6Ec 9UPv4mBEVrMh2ao/ldjIPmetWDACU1qhKOKAMfY0mQpXBft6y85/XduOhlz8yaba1fzg JJaR1Qm/9ZW050pQY705p3roDjxSZ1DRQfH6+trdmfxjdy1g412iPXPwmn/AbIkPiiFP zsgbDs9m8K1kmT5KC8HdD0PsHIEgCAbXkOHidrHyyo9+8dArPRy2tevWLYteyP27vJEa OM+34w5DQd04GB/JQYgtddb5FlgoKJ/BormYVFusy3PEKqxYZjnS5t8djpteTp+llp85 PkOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dPU8d1m24X8aOeptyIsV4Y0L5+jKGyTS5Y44vHgV6FM=; b=MMeltdZPxZ0hdj3OY3TFNAIc9AG/37/EUM4tTcx//rnNULiFxlOv4QNUxIsTnv2bbw GLwlIybqdoneVmcKsrWk+FcYxb1jAeZ3bNF3da4C+HXK2IKag/V9Ikrj7OC4XfiRC9hH ZcCndUhJWe6bFVRqMXg0vGhwmIjERSnu2zsjvNmVBrU5XhxWn6t/IqSRw4qHtTtqXInf AYKNsPoD1t8JOJTYNo4GPMH1o3slF6R0Z4QFcdOrPcnWNKWjhu4I6kOSFEjlgG5q2COo wenqjqLOY3YyXhbKIocBgqvE1Ig+nztgHgf8BA6lQvKfKaSZviK2aeQx8htSGRuF2nbL E4Qw== X-Gm-Message-State: AHQUAuYWGnQetwCqEufw3MxNYERGLUsGzyuLLWEMUarF2VvcXNwJxUji LfWczjqYzqFw7iFqFuABi2ulQSBzjzk= X-Received: by 2002:a7b:c146:: with SMTP id z6mr2409816wmi.145.1551352131888; Thu, 28 Feb 2019 03:08:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c17sm13153241wrs.17.2019.02.28.03.08.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 03:08:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 28 Feb 2019 11:08:21 +0000 Message-Id: <20190228110835.16159-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228110835.16159-1-peter.maydell@linaro.org> References: <20190228110835.16159-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PULL 02/16] hw/arm/armsse: Wire up the MHUs 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and connect the MHUs in the SSE-200. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20190219125808.25174-3-peter.maydell@linaro.org --- include/hw/arm/armsse.h | 3 ++- hw/arm/armsse.c | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h index 7ef871c7dfe..81e082cccf8 100644 --- a/include/hw/arm/armsse.h +++ b/include/hw/arm/armsse.h @@ -95,6 +95,7 @@ #include "hw/misc/iotkit-sysctl.h" #include "hw/misc/iotkit-sysinfo.h" #include "hw/misc/armsse-cpuid.h" +#include "hw/misc/armsse-mhu.h" #include "hw/misc/unimp.h" #include "hw/or-irq.h" #include "hw/core/split-irq.h" @@ -166,7 +167,7 @@ typedef struct ARMSSE { IoTKitSysCtl sysctl; IoTKitSysCtl sysinfo; - UnimplementedDeviceState mhu[2]; + ARMSSEMHU mhu[2]; UnimplementedDeviceState ppu[NUM_PPUS]; UnimplementedDeviceState cachectrl[SSE_MAX_CPUS]; UnimplementedDeviceState cpusecctrl[SSE_MAX_CPUS]; diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 129e7ea7fe0..97e3d5e807e 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -282,9 +282,9 @@ static void armsse_init(Object *obj) sizeof(s->sysinfo), TYPE_IOTKIT_SYSINFO); if (info->has_mhus) { sysbus_init_child_obj(obj, "mhu0", &s->mhu[0], sizeof(s->mhu[0]), - TYPE_UNIMPLEMENTED_DEVICE); + TYPE_ARMSSE_MHU); sysbus_init_child_obj(obj, "mhu1", &s->mhu[1], sizeof(s->mhu[1]), - TYPE_UNIMPLEMENTED_DEVICE); + TYPE_ARMSSE_MHU); } if (info->has_ppus) { for (i = 0; i < info->num_cpus; i++) { @@ -766,22 +766,28 @@ static void armsse_realize(DeviceState *dev, Error **errp) } if (info->has_mhus) { - for (i = 0; i < ARRAY_SIZE(s->mhu); i++) { - char *name; - char *port; + /* + * An SSE-200 with only one CPU should have only one MHU created, + * with the region where the second MHU usually is being RAZ/WI. + * We don't implement that SSE-200 config; if we want to support + * it then this code needs to be enhanced to handle creating the + * RAZ/WI region instead of the second MHU. + */ + assert(info->num_cpus == ARRAY_SIZE(s->mhu)); + + for (i = 0; i < ARRAY_SIZE(s->mhu); i++) { + char *port; + int cpunum; + SysBusDevice *mhu_sbd = SYS_BUS_DEVICE(&s->mhu[i]); - name = g_strdup_printf("MHU%d", i); - qdev_prop_set_string(DEVICE(&s->mhu[i]), "name", name); - qdev_prop_set_uint64(DEVICE(&s->mhu[i]), "size", 0x1000); object_property_set_bool(OBJECT(&s->mhu[i]), true, "realized", &err); - g_free(name); if (err) { error_propagate(errp, err); return; } port = g_strdup_printf("port[%d]", i + 3); - mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mhu[i]), 0); + mr = sysbus_mmio_get_region(mhu_sbd, 0); object_property_set_link(OBJECT(&s->apb_ppc0), OBJECT(mr), port, &err); g_free(port); @@ -789,6 +795,20 @@ static void armsse_realize(DeviceState *dev, Error **errp) error_propagate(errp, err); return; } + + /* + * Each MHU has an irq line for each CPU: + * MHU 0 irq line 0 -> CPU 0 IRQ 6 + * MHU 0 irq line 1 -> CPU 1 IRQ 6 + * MHU 1 irq line 0 -> CPU 0 IRQ 7 + * MHU 1 irq line 1 -> CPU 1 IRQ 7 + */ + for (cpunum = 0; cpunum < info->num_cpus; cpunum++) { + DeviceState *cpudev = DEVICE(&s->armv7m[cpunum]); + + sysbus_connect_irq(mhu_sbd, cpunum, + qdev_get_gpio_in(cpudev, 6 + i)); + } } }