From nobody Sat Feb 7 06:55:26 2026 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1615225290; cv=none; d=zohomail.com; s=zohoarc; b=lvhzZQlZX1GV+rFsgIn0hgKxNytiHqxubvlqShVk34rON+rJ0DkdfRmc9153XT7Sqro3UhGfMjUfBDNZFMZQVEBQ2y5AjKRjQx/Ntdp5eI8MfU1vo759EM6TCOUkFRiZZ32MSdfF8l8EWZ8MZJ1pyzaljiVnW7Bf6boJgvQNKDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615225290; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ocFxpM3Id831muBIJ5hzrnRVlMKiDWzMHDQfp86Zrhc=; b=XAzRzc1IPTADL46ohtg+NShJa8PKgzjPFREpICWDHbIqEbdv9tW6gXcOOqP/gD+CosassiE8pdIW1JXUKvnu8VkTK+FF5vuWNDthOE45eTNoc7unXRstJ+n7AeWTlBldMuJig5hPs4+FV9undAAYpdsw+N0bO5D/KhdrtiTE68w= 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; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615225290002416.8971283540409; Mon, 8 Mar 2021 09:41:30 -0800 (PST) Received: from localhost ([::1]:35412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJJsk-0007IM-OZ for importer@patchew.org; Mon, 08 Mar 2021 12:41:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJJkW-0006Sw-NP for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:32:57 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:33601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJJkU-00071b-2i for qemu-devel@nongnu.org; Mon, 08 Mar 2021 12:32:56 -0500 Received: by mail-wm1-x329.google.com with SMTP id w203-20020a1c49d40000b029010c706d0642so8298727wma.0 for ; Mon, 08 Mar 2021 09:32:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id i10sm18628217wrs.11.2021.03.08.09.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 09:32:51 -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=ocFxpM3Id831muBIJ5hzrnRVlMKiDWzMHDQfp86Zrhc=; b=Imom97tjZkVR8PYA/qnHxkv/ZoiI6RUMb4Cb3K688HaEqEzhswQNwGI34YIAjm3T4q epfPYvEGJLV6sOqyGpFT9BfMEilzuqJ5ckj5h3fPvNGKMOlWfvTDK31nN4BdKf34KCCO rV/nr/uC2bDpouhcmlBtPiOZ/hatuhlYHOcIYpSI9/JuTanJaUJHPzkafYCvhMPs38Nd oGTTVpeXPcY5xoWJpy62l3uNAhd1IMPJq6E9i6uVSpwEeoHZpB2itJk6VtrP7pF8zrqM xnKdFfnV2X0/3gtLmDx8g53mynvaeAvvsqVrTl4p0guC4Ey+C26FqTrxZbKH/g8VOENg RZPQ== 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=ocFxpM3Id831muBIJ5hzrnRVlMKiDWzMHDQfp86Zrhc=; b=NZ/q/x6jHSM9a3ldyULlSYtsg4n6XiclJ2oqAjSKlCL4f7Zsz/f3XiQ9cRnSwORSRE Msrd5GP5Kg3tncqSw7kKd/TiVxZ/V7xMMVEWNLO9BIuOPTkRq604ix3kql2vfU0A87q1 ZxT6brFT/gjdkcPv/ISu2g0q4o9EuD/km7r7EgBi8mY2gyNXP3JFr2XioBkSjwJ1KrJ9 3tQZPmCjnMN7NLGJr4Z5Lwiei9+zIS5axlG+2Tg/Dq2IRDv59+m8J/ndp7NC3ngH5ExJ 5kjl7pjLfFTRVC4rYlQDFaBwCwYOMZQy1NRCW/lMAkTmnZoM+T5t3f+IbDo5zrNEYWGb sv/Q== X-Gm-Message-State: AOAM533XDEjL2SIORS/fNB96sTYN224oLnm54BTetnV0S3oymT+OR1G5 HtIGHCDH++hlzakV4Fz1zSRlViGlc8QFhQ== X-Google-Smtp-Source: ABdhPJwEf1eq86uN2OfEFA2vwjpoUHOYmHDapwzhUZhLT5MGih/tP91xts9271zgI7aZP28adoXhxw== X-Received: by 2002:a1c:bd55:: with SMTP id n82mr16623485wmf.3.1615224771938; Mon, 08 Mar 2021 09:32:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/54] hw/misc/iotkit-secctl.c: Implement SSE-300 PID register values Date: Mon, 8 Mar 2021 17:31:57 +0000 Message-Id: <20210308173244.20710-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210308173244.20710-1-peter.maydell@linaro.org> References: <20210308173244.20710-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com 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.23 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" X-ZohoMail-DKIM: pass (identity @linaro.org) The versions of the Secure Access Configuration Register Block and Non-secure Access Configuration Register Block in the SSE-300 are the same as those in the SSE-200, but the CIDR/PIDR ID register values are different. Plumb through the sse-version property and use it to select the correct ID register values. Signed-off-by: Peter Maydell Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20210219144617.4782-8-peter.maydell@linaro.org --- include/hw/misc/iotkit-secctl.h | 2 ++ hw/arm/armsse.c | 2 ++ hw/misc/iotkit-secctl.c | 50 +++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/include/hw/misc/iotkit-secctl.h b/include/hw/misc/iotkit-secct= l.h index 227d44abe49..79a36283201 100644 --- a/include/hw/misc/iotkit-secctl.h +++ b/include/hw/misc/iotkit-secctl.h @@ -120,6 +120,8 @@ struct IoTKitSecCtl { IoTKitSecCtlPPC apb[IOTS_NUM_APB_PPC]; IoTKitSecCtlPPC apbexp[IOTS_NUM_APB_EXP_PPC]; IoTKitSecCtlPPC ahbexp[IOTS_NUM_APB_EXP_PPC]; + + uint32_t sse_version; }; =20 #endif diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index f509f59d4a8..9632c287351 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -654,6 +654,8 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) } =20 /* Security controller */ + object_property_set_int(OBJECT(&s->secctl), "sse-version", + info->sse_version, &error_abort); if (!sysbus_realize(SYS_BUS_DEVICE(&s->secctl), errp)) { return; } diff --git a/hw/misc/iotkit-secctl.c b/hw/misc/iotkit-secctl.c index 9fdb82056a8..7b41cfa8fc5 100644 --- a/hw/misc/iotkit-secctl.c +++ b/hw/misc/iotkit-secctl.c @@ -19,6 +19,8 @@ #include "hw/registerfields.h" #include "hw/irq.h" #include "hw/misc/iotkit-secctl.h" +#include "hw/arm/armsse-version.h" +#include "hw/qdev-properties.h" =20 /* Registers in the secure privilege control block */ REG32(SECRESPCFG, 0x10) @@ -95,6 +97,19 @@ static const uint8_t iotkit_secctl_ns_idregs[] =3D { 0x0d, 0xf0, 0x05, 0xb1, }; =20 +static const uint8_t iotkit_secctl_s_sse300_idregs[] =3D { + 0x04, 0x00, 0x00, 0x00, + 0x52, 0xb8, 0x2b, 0x00, + 0x0d, 0xf0, 0x05, 0xb1, +}; + +static const uint8_t iotkit_secctl_ns_sse300_idregs[] =3D { + 0x04, 0x00, 0x00, 0x00, + 0x53, 0xb8, 0x2b, 0x00, + 0x0d, 0xf0, 0x05, 0xb1, +}; + + /* The register sets for the various PPCs (AHB internal, APB internal, * AHB expansion, APB expansion) are all set up so that they are * in 16-aligned blocks so offsets 0xN0, 0xN4, 0xN8, 0xNC are PPCs @@ -213,7 +228,14 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, = hwaddr addr, case A_CID1: case A_CID2: case A_CID3: - r =3D iotkit_secctl_s_idregs[(offset - A_PID4) / 4]; + switch (s->sse_version) { + case ARMSSE_SSE300: + r =3D iotkit_secctl_s_sse300_idregs[(offset - A_PID4) / 4]; + break; + default: + r =3D iotkit_secctl_s_idregs[(offset - A_PID4) / 4]; + break; + } break; case A_SECPPCINTCLR: case A_SECMSCINTCLR: @@ -473,7 +495,14 @@ static MemTxResult iotkit_secctl_ns_read(void *opaque,= hwaddr addr, case A_CID1: case A_CID2: case A_CID3: - r =3D iotkit_secctl_ns_idregs[(offset - A_PID4) / 4]; + switch (s->sse_version) { + case ARMSSE_SSE300: + r =3D iotkit_secctl_ns_sse300_idregs[(offset - A_PID4) / 4]; + break; + default: + r =3D iotkit_secctl_ns_idregs[(offset - A_PID4) / 4]; + break; + } break; default: qemu_log_mask(LOG_GUEST_ERROR, @@ -710,6 +739,16 @@ static void iotkit_secctl_init(Object *obj) sysbus_init_mmio(sbd, &s->ns_regs); } =20 +static void iotkit_secctl_realize(DeviceState *dev, Error **errp) +{ + IoTKitSecCtl *s =3D IOTKIT_SECCTL(dev); + + if (!armsse_version_valid(s->sse_version)) { + error_setg(errp, "invalid sse-version value %d", s->sse_version); + return; + } +} + static const VMStateDescription iotkit_secctl_ppc_vmstate =3D { .name =3D "iotkit-secctl-ppc", .version_id =3D 1, @@ -775,12 +814,19 @@ static const VMStateDescription iotkit_secctl_vmstate= =3D { }, }; =20 +static Property iotkit_secctl_props[] =3D { + DEFINE_PROP_UINT32("sse-version", IoTKitSecCtl, sse_version, 0), + DEFINE_PROP_END_OF_LIST() +}; + static void iotkit_secctl_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->vmsd =3D &iotkit_secctl_vmstate; dc->reset =3D iotkit_secctl_reset; + dc->realize =3D iotkit_secctl_realize; + device_class_set_props(dc, iotkit_secctl_props); } =20 static const TypeInfo iotkit_secctl_info =3D { --=20 2.20.1