From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576265; cv=none; d=zohomail.com; s=zohoarc; b=Fb0EiUpBV/mIEDybeLI8I0+ZGL6IrFn9DXt1BNyt5peMalQ1j1lGUCW6cKLQwpqHpHqtoZiwzDPxeM2/wrwb+6yp+a6QQ1Y0DfGGiNBOEdqY0VkrO80xzBZs3NU8yrJ6ew1G7eIDONqmcKkCJA9pXx8Oni3vVukVf2Wxumpnvnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576265; 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=p0bFkZNomX7Q5MaA4fGopx5oG80cnusqXxawnRuyq4M=; b=Mb0PskNeqg4ObKbnGdwa31mtXva516/kOKxEr5D42aEnhk6SY1xmknyvsak+N+9Tzv1kR6gYHvsrcXjog53WfXcgCx6W4TuApBBKgV8AJ83OmSk4vUvNICmL/mx6RAqyl0XVsHVqf1ZcN7hfuc0FV6SP1+2lBMkgZ5thmWpDUO8= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576265245117.56442926500586; Fri, 7 Jan 2022 09:24:25 -0800 (PST) Received: from localhost ([::1]:43530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5syV-0007pE-IG for importer@patchew.org; Fri, 07 Jan 2022 12:24:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw0-000542-Ud for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:49 -0500 Received: from [2a00:1450:4864:20::429] (port=34326 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5svy-0007s3-Mi for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:48 -0500 Received: by mail-wr1-x429.google.com with SMTP id h10so2184778wrb.1 for ; Fri, 07 Jan 2022 09:21:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:45 -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=p0bFkZNomX7Q5MaA4fGopx5oG80cnusqXxawnRuyq4M=; b=XHJtFzZlA1DAaYgvG0kPPrbNAFhNldhOJ8N2flQgdyHuIjVOgzrhL+x4QSaGHpyBAY oNdBehRWxhRxSRog3StFLiolx5QjJiL8w7aXPjnP5QTLE22n6BEnvY2p5KDk8s2WixzG CXRfKltqXou13gmVsP1J5AszTnoz9g/HeZ6H+Mpc/PRVEXwWbaOKPmSVGQZiC/rp/QRf JFz0CsBNomp95904+YCwrsRxgGuLUltO8Ru4ToDOWiP/a3A15Dl2gOYfDJmBDZqysCTg ZbJnqepZr7BnAA0EB128FIOTS12XspdDTEBDleFy2POKwANGdX7o/TqfTykIthsqJOcs zUBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p0bFkZNomX7Q5MaA4fGopx5oG80cnusqXxawnRuyq4M=; b=PAq74QeIbvE/gMVjXKRbqhVFETH2Q30Z24kmv8qCUcCBMxZ+FX0GjtmKGN+AGdnfl7 JkD3qQTpvqDkSzpRk00SPi4YRQ0AE5QZ0Bo8gjVBA89p5QAGJHTdgN3PxzS5470f2HgE 95zaWjmlBboA7J+cLL3t02QIiujTIlKAypDmLn7iqGYZvA8RaDpbLU9LUsKXCGyZvwoP 6bUEenOpIBYPcmLaQWXGg3dYZVZfL9IHUvvpt9ZLaizcScLykZ25sExv8iJSC9wp2kIx 0c7zexXdsbguAGWsMGDkcgWQ0CrRCcYAD6NiRwLXhfBG7U8jZbm7CFia2xbWZx6w2OrE QQOQ== X-Gm-Message-State: AOAM5316Iw2fammDAHAEdn0hNDZsVppQoLpbMXCksRwQenkjyGWoIfvx c454ezM5zDdAtszjZuwW7DD5vPqvBNlFpw== X-Google-Smtp-Source: ABdhPJzQkjbVT7X57KmZ6ErnuGWpN267ss0LcaSElFvtqQ0etKKu/jqzACWoibYU1yrVXeUg97YgaQ== X-Received: by 2002:a05:6000:1684:: with SMTP id y4mr53409025wrd.26.1641576105421; Fri, 07 Jan 2022 09:21:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/19] Add dummy Aspeed AST2600 Display Port MCU (DPMCU) Date: Fri, 7 Jan 2022 17:21:24 +0000 Message-Id: <20220107172142.2651911-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::429 (failed) 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::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576266620100002 From: Troy Lee AST2600 Display Port MCU introduces 0x18000000~0x1803FFFF as it's memory and io address. If guest machine try to access DPMCU memory, it will cause a fatal error. Signed-off-by: Troy Lee Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Message-id: 20211210083034.726610-1-troy_lee@aspeedtech.com Signed-off-by: Peter Maydell --- include/hw/arm/aspeed_soc.h | 2 ++ hw/arm/aspeed_ast2600.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 8139358549d..18fb7eed461 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -139,6 +139,8 @@ enum { ASPEED_DEV_EMMC, ASPEED_DEV_KCS, ASPEED_DEV_HACE, + ASPEED_DEV_DPMCU, + ASPEED_DEV_DP, }; =20 #endif /* ASPEED_SOC_H */ diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 0384357a951..e33483fb5dd 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -19,9 +19,11 @@ #include "sysemu/sysemu.h" =20 #define ASPEED_SOC_IOMEM_SIZE 0x00200000 +#define ASPEED_SOC_DPMCU_SIZE 0x00040000 =20 static const hwaddr aspeed_soc_ast2600_memmap[] =3D { [ASPEED_DEV_SRAM] =3D 0x10000000, + [ASPEED_DEV_DPMCU] =3D 0x18000000, /* 0x16000000 0x17FFFFFF : AHB BUS do LPC Bus bridge */ [ASPEED_DEV_IOMEM] =3D 0x1E600000, [ASPEED_DEV_PWM] =3D 0x1E610000, @@ -44,6 +46,7 @@ static const hwaddr aspeed_soc_ast2600_memmap[] =3D { [ASPEED_DEV_SCU] =3D 0x1E6E2000, [ASPEED_DEV_XDMA] =3D 0x1E6E7000, [ASPEED_DEV_ADC] =3D 0x1E6E9000, + [ASPEED_DEV_DP] =3D 0x1E6EB000, [ASPEED_DEV_VIDEO] =3D 0x1E700000, [ASPEED_DEV_SDHCI] =3D 0x1E740000, [ASPEED_DEV_EMMC] =3D 0x1E750000, @@ -104,6 +107,7 @@ static const int aspeed_soc_ast2600_irqmap[] =3D { [ASPEED_DEV_ETH3] =3D 32, [ASPEED_DEV_ETH4] =3D 33, [ASPEED_DEV_KCS] =3D 138, /* 138 -> 142 */ + [ASPEED_DEV_DP] =3D 62, }; =20 static qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int ctrl) @@ -298,6 +302,10 @@ static void aspeed_soc_ast2600_realize(DeviceState *de= v, Error **errp) memory_region_add_subregion(get_system_memory(), sc->memmap[ASPEED_DEV_SRAM], &s->sram); =20 + /* DPMCU */ + create_unimplemented_device("aspeed.dpmcu", sc->memmap[ASPEED_DEV_DPMC= U], + ASPEED_SOC_DPMCU_SIZE); + /* SCU */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { return; --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576265; cv=none; d=zohomail.com; s=zohoarc; b=UwXpbkmOh/U86fqIajyz3eIB1gwtDBbHPJSQuoP0JxlR5KnCKkj/6TTEiqc7zCTndKsFP0+EiBq+XUxHe4OS/qVovmhXzxt7pGBM7IkG/7zBnnOd0sK/3Bfq413dKzxwXVZQpQOM8kROn63qUog9m/IgAeHrhGrWeuGPzx/Zemo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576265; h=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=tgkzP59zZKWcqPqvUogulF/C72GjNGTYYxCx3zJL2W0=; b=Y64L8YxB4+0Kr0AH60gyyyosxVTmvHbk9mFagLAKiVJkkX2HAABvQpn/aMGmenTBx5+PzBG/67IbJTRi+yoxo4yMBHbnUqBESujf9+0xka+6mLQUEg//lwlvgdyuagpbovehcnsm2BOT7PLCuTrmEKZ7nXlWONjTnJ4EoOyP5KQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576265652628.6702817284803; Fri, 7 Jan 2022 09:24:25 -0800 (PST) Received: from localhost ([::1]:43570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5syV-0007qJ-PJ for importer@patchew.org; Fri, 07 Jan 2022 12:24:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw1-00054W-NQ for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:49 -0500 Received: from [2a00:1450:4864:20::434] (port=40685 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5svz-0007sD-6l for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:49 -0500 Received: by mail-wr1-x434.google.com with SMTP id l10so12334365wrh.7 for ; Fri, 07 Jan 2022 09:21:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:45 -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=tgkzP59zZKWcqPqvUogulF/C72GjNGTYYxCx3zJL2W0=; b=Cqh04E0XAWpZ8NT8XhD/+5TeTqnYTDolHnnMqtlda59eUXRwUudlwjH1WxQhU/vOK1 yQOcUhX25KklBrVdZ3s8IhyxrOaAOBa01QE1Pb1mW9b0ek7SRSbJMphUbcEdOolvMbRW ur9PKvF/qK2PmB86uW/VqfPkljsAxVoahKvHf2c0jSt559ogRsxDB+Q9EHyupnYmONVu vYXVCiRJ0zMfpQwvV48KkvtB9ZM6q5Avcp5vVjQAhAXU8RJGtUrHVoriioh5He0YOmwE BgQ2FlMybLN5pUVLAjTZ2Bxg5OB5TX9H1vEpb1JDLddm6asOMgy+ZUqM8W8HXg5Z0p9d Z/qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tgkzP59zZKWcqPqvUogulF/C72GjNGTYYxCx3zJL2W0=; b=jXIP+3DD6SSOa22vi0mU9hxim2Us8V6BrTJCmqh6qfqDIIPrQKrlrOI9CCGhxhw2CS TJ/TLYMPuTa3C4cYE8rSuHZQEOYrb4jvC9c9e7iWmQLi2T0Gjl7oqcfuR1tiYGONIbnH nhsgbvdvczAzdbobnHy/Vvs7nsIfZUQ8Iz4UtjJz4XTH28aKtmeAjnNy2hXoUhafXYp6 ggb6wYUYO0t/1Gpg9130+SzRqrWMxYtFhmPGu2w5EZR6NH7y0Yjf9MG4YIwpPhhmplH5 wps9nWW3en+xVpX8sswCnFlou7SJCyXgefUMOrxY0qEqFk0af1+n/IlUY51SFHB88VvO ICYg== X-Gm-Message-State: AOAM532jJS7AOO2eEoPDSsN+kvN7JASbL8RtvzbCNC1jL2xp+W+K20FC yGZr0IhAtNUGukJ9T/B9GtKOf2fsMbitWw== X-Google-Smtp-Source: ABdhPJyhBVychQnxhj4YWBCrO+Z0k4rfRMEKEfGDM4wlsy32H9r1QrngIAvMFBinnKVGGWmKRB8Ccg== X-Received: by 2002:a5d:64ad:: with SMTP id m13mr56224636wrp.714.1641576105954; Fri, 07 Jan 2022 09:21:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/19] target/arm: Add missing FEAT_TLBIOS instructions Date: Fri, 7 Jan 2022 17:21:25 +0000 Message-Id: <20220107172142.2651911-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) 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::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576268019100005 Content-Type: text/plain; charset="utf-8" From: Idan Horowitz Some of the instructions added by the FEAT_TLBIOS extension were forgotten when the extension was originally added to QEMU. Fixes: 7113d618505b ("target/arm: Add support for FEAT_TLBIOS") Signed-off-by: Idan Horowitz Reviewed-by: Richard Henderson Message-id: 20211231103928.1455657-1-idan.horowitz@gmail.com Signed-off-by: Peter Maydell --- target/arm/helper.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index db837d53bd9..cfca0f5ba6d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6964,18 +6964,42 @@ static const ARMCPRegInfo tlbios_reginfo[] =3D { .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 0, .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, .writefn =3D tlbi_aa64_vmalle1is_write }, + { .name =3D "TLBI_VAE1OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 1, + .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae1is_write }, { .name =3D "TLBI_ASIDE1OS", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 2, .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, .writefn =3D tlbi_aa64_vmalle1is_write }, + { .name =3D "TLBI_VAAE1OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 3, + .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae1is_write }, + { .name =3D "TLBI_VALE1OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 5, + .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae1is_write }, + { .name =3D "TLBI_VAALE1OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 0, .crn =3D 8, .crm =3D 1, .opc2 =3D 7, + .access =3D PL1_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae1is_write }, { .name =3D "TLBI_ALLE2OS", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 1, .opc1 =3D 4, .crn =3D 8, .crm =3D 1, .opc2 =3D 0, .access =3D PL2_W, .type =3D ARM_CP_NO_RAW, .writefn =3D tlbi_aa64_alle2is_write }, + { .name =3D "TLBI_VAE2OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 4, .crn =3D 8, .crm =3D 1, .opc2 =3D 1, + .access =3D PL2_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae2is_write }, { .name =3D "TLBI_ALLE1OS", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 1, .opc1 =3D 4, .crn =3D 8, .crm =3D 1, .opc2 =3D 4, .access =3D PL2_W, .type =3D ARM_CP_NO_RAW, .writefn =3D tlbi_aa64_alle1is_write }, + { .name =3D "TLBI_VALE2OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 4, .crn =3D 8, .crm =3D 1, .opc2 =3D 5, + .access =3D PL2_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae2is_write }, { .name =3D "TLBI_VMALLS12E1OS", .state =3D ARM_CP_STATE_AA64, .opc0 =3D 1, .opc1 =3D 4, .crn =3D 8, .crm =3D 1, .opc2 =3D 6, .access =3D PL2_W, .type =3D ARM_CP_NO_RAW, @@ -6996,6 +7020,14 @@ static const ARMCPRegInfo tlbios_reginfo[] =3D { .opc0 =3D 1, .opc1 =3D 6, .crn =3D 8, .crm =3D 1, .opc2 =3D 0, .access =3D PL3_W, .type =3D ARM_CP_NO_RAW, .writefn =3D tlbi_aa64_alle3is_write }, + { .name =3D "TLBI_VAE3OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 6, .crn =3D 8, .crm =3D 1, .opc2 =3D 1, + .access =3D PL3_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae3is_write }, + { .name =3D "TLBI_VALE3OS", .state =3D ARM_CP_STATE_AA64, + .opc0 =3D 1, .opc1 =3D 6, .crn =3D 8, .crm =3D 1, .opc2 =3D 5, + .access =3D PL3_W, .type =3D ARM_CP_NO_RAW, + .writefn =3D tlbi_aa64_vae3is_write }, REGINFO_SENTINEL }; =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576723; cv=none; d=zohomail.com; s=zohoarc; b=IgicjAbAMgx08WnelqOnI/HzmVYyCKZlpg/G7PpVY4O7yyGdISalQenbPRF7JW8uN6fkR2R0UMIAqCEgSAen0u1mtVdQz3IHIZZx1L/+t8uE2MeOzAPuIvE4DXwzTYf4Z1/birgUZBXfZUEdcLQ0ZIsZiwauavjVx4C261n9jOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576723; 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=3lysZ/JZGCb/W/vOgl/A8X+COK6e6bD0XOz6b5zqsvo=; b=n8leQNie3eiU2uRfoTSbs8/9pPu2S7DHQhUxSg8mowh3XD793MbhjtJ3oihhaGglx3pnAXLPuT19wUE+Xxli+mT3C1rHmrFnCPpCcUYTMV9C4F8KRjktc14/9eujqd+uKiqM6+jLf82vYIqgigQyJgOrYtyP3lC3llJQX8RKykM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576723733870.1975570792775; Fri, 7 Jan 2022 09:32:03 -0800 (PST) Received: from localhost ([::1]:60764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t5u-00039Y-NZ for importer@patchew.org; Fri, 07 Jan 2022 12:32:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw2-000554-4I for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: from [2a00:1450:4864:20::332] (port=46630 helo=mail-wm1-x332.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw0-0007sN-LB for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:49 -0500 Received: by mail-wm1-x332.google.com with SMTP id d187-20020a1c1dc4000000b003474b4b7ebcso2628878wmd.5 for ; Fri, 07 Jan 2022 09:21:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:46 -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=3lysZ/JZGCb/W/vOgl/A8X+COK6e6bD0XOz6b5zqsvo=; b=BNGaJOMmOPpu4gfzJDediJ0AqsvJbC1LzNZr2rPZAUE+UyHBnJj35eqHOnxu2rFcGD fww27ar51yS7PO5I5TwRn0v9sScuvZOdsvMXwK4KVkstmUoOsZQFDpw9TrrNWSNLS7pN OQAKv65KqkGe/bp2k/azraXvwqek8GIUcN7YHL/ayjJnsN9UULitl4sAPBx1PAYEbbt/ tnUdLiSJWWJ48jOdA6LtVxPH189VVnDkDRIfKzvecgh3Lon9idnGycbsM8+TwvrqpTBG C7PPEGRle0hpfpl/olIbktigUMFWQJ3oQwoQlde+g+uZVZxb9b1ild+Boz9YToDi7NAU UMng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3lysZ/JZGCb/W/vOgl/A8X+COK6e6bD0XOz6b5zqsvo=; b=SWBg/J8CQrvPqyjnPK6cKkTYEIZtrTkaQmxOBublZTxnGWDqS8e1yGzPn8Wf/oJfRl 031CYTqN6A5OMR9dGhUEDYQQIU0lDuKE0iAcLTRsumOmwK5TZvgOuhYdPdRtPR2JFm5j HzQdCDWkCz0JjIJe6Jd1Q36CW4xYnLZ17VlYfIUt/i1xzL7JRbkhIzWntJe8LJ60SxIw p6VwC7Zm5I+niavAICc/xgvlXg79mwwabhsgPPfOyBS4rZtlhtxcq8p+rcSMW7IDrkHk 5/C+AqHOgCr/9whR0CThU5rs+MOo1xnz3L6vJWglqJ8oTCrgYXj5sDRT4TYRs7J1XNeZ IC2A== X-Gm-Message-State: AOAM533Mt1pME0fcsEDtKl1s3cQ8c1GIEfNPCRpa3s+1xI4h8Buh6oFP 4+DP0sy8n1qsNrwJOTssSCSVMz0iTlSlAg== X-Google-Smtp-Source: ABdhPJx2TVSMYEgLM6aFX/JWLy9FyScJzEDX1hilai8NeoU+rMm+soZHfQYXEUawWLU7oKyeGddSzw== X-Received: by 2002:a7b:c0ce:: with SMTP id s14mr11971621wmh.135.1641576106493; Fri, 07 Jan 2022 09:21:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/19] hw/intc/arm_gicv3_its: Correct off-by-one bounds check on rdbase Date: Fri, 7 Jan 2022 17:21:26 +0000 Message-Id: <20220107172142.2651911-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::332 (failed) 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::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576725330100002 The checks in the ITS on the rdbase values in guest commands are off-by-one: they permit the guest to pass us a value equal to s->gicv3->num_cpu, but the valid values are 0...num_cpu-1. This meant the guest could cause us to index off the end of the s->gicv3->cpu[] array when calling gicv3_redist_process_lpi(), and we would probably crash. (This is not a security bug, because this code is only usable with emulation, not with KVM.) Cc: qemu-stable@nongnu.org Fixes: 17fb5e36aabd4b ("hw/intc: GICv3 redistributor ITS processing") Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index b99e63d58f7..677b96dfe23 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -311,7 +311,7 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t = value, uint32_t offset, */ rdbase =3D (cte & GITS_CTE_RDBASE_PROCNUM_MASK) >> 1U; =20 - if (rdbase > s->gicv3->num_cpu) { + if (rdbase >=3D s->gicv3->num_cpu) { return result; } =20 @@ -505,7 +505,7 @@ static bool process_mapc(GICv3ITSState *s, uint32_t off= set) =20 valid =3D (value & CMD_FIELD_VALID_MASK); =20 - if ((icid > s->ct.maxids.max_collids) || (rdbase > s->gicv3->num_cpu))= { + if ((icid > s->ct.maxids.max_collids) || (rdbase >=3D s->gicv3->num_cp= u)) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPC: invalid collection table attributes " "icid %d rdbase %" PRIu64 "\n", icid, rdbase); --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576534; cv=none; d=zohomail.com; s=zohoarc; b=ihwWh0K7Dacv3C21BObqAmj357iBulTe2RuiY2aCqaCAFkgvvcHrXLin6bu2RQkqmp2GnTNv3N+6ez6lqHiGi5g2pncjXzIkIHIYqZpP2OLnNVvJp/uoUd7sJQv0bPYc3nv4sOS518qlxR1t8unFk1Ib9sb6bTlf+6XMA8/OVE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576534; 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=wDpp9ELZiyenRroxX962eMlUrvjG30f0+zj0G+7rsMA=; b=P4h50EV/HS5maLHZyLQG/WvXRnzZBJvqI85nsmIbYTFt8PfNffa7Uy+TzjbInDwk8RG2OMvjlKhRMuuqk3ykVINBjGufTsC0POFDbkjc4mE0XcvmOq/EMNExqUfzNG2RTlsyXsZZUlXcdZ9fQSEXluo+yoYAD6GdRINgMUmKmzQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576534519583.8183849423098; Fri, 7 Jan 2022 09:28:54 -0800 (PST) Received: from localhost ([::1]:52254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t2r-0005gz-HD for importer@patchew.org; Fri, 07 Jan 2022 12:28:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw2-00055A-G1 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: from [2a00:1450:4864:20::436] (port=42843 helo=mail-wr1-x436.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw0-0007sX-Lf for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: by mail-wr1-x436.google.com with SMTP id w20so12321876wra.9 for ; Fri, 07 Jan 2022 09:21:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:46 -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=wDpp9ELZiyenRroxX962eMlUrvjG30f0+zj0G+7rsMA=; b=SNSPQDuNBEXbGgePZeGhTHa3aN7Jzoit1x1QLF36WzSwGo6BxWmOorZSN42iRjTm2g BFVjB51FnlpQpy7rJjLkrtVaeWzdLjMoeQjSEBqvxbvLFeLZjua2Ulj3Uf47afUrnzQ/ QNhsi9rZHROgqXFXDyAoinVL4ReGEVZwRpzLR5CxOIGg+g8GLV4+z1bxtEsT0sR2tWnx 4xild3WGc67osP/S72iLKcSEM9Hstz4O8pHlNZoSU80bjfJ6XyBWSxlFbC5F27csuBCR NN8CAisebiqWqyaXRB9IrylyEgYm/XBS4YVYFRx59g1hSQe0V4lVtVWXildn0aQ2fLVC rBVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wDpp9ELZiyenRroxX962eMlUrvjG30f0+zj0G+7rsMA=; b=lrOEJosamrqSt7vJrPQ15hVTUFBQ8Z7dN6TcMj3TxOXYEYX87zCjgxl3c6S55JPcNq w8VD/P65qn1MlFeeEzuJsU3WWXb0u9LEkt8bAgUHAyUhEutajRZxSJOqerkf29S/kPwq rr8ohd/V0i3Ww+Ars3CEDbovz3xenJBOBXc/aaIzeB9bg4onw6VpooT6xL4q9CQDUQCr AK4MsHF3qVLvFg+2QiS5BVCqom4QyZFT1sx37uuXFtW/6yvfOq+3LYLz0PcO7TvGB2Ki /stjPB3WagMCYT/s6WwTGNTCEtRbrtMktBNmh0ZS4jZ9Kuscoiwbp+jwnz0g4o7xrxvq /R9Q== X-Gm-Message-State: AOAM532qHfjFb9POxHb8Ex4CFeJAv66J25AV3uKKQTCJdaiUWezb7Pbf IkLBfsQ+YQ9GCiSBVVC5BABn8OaQaP6/Kw== X-Google-Smtp-Source: ABdhPJykTpff2b6/7sjmsnARn9QuDjmQI8hDP5BMYy0bqymvd4dTi0HPck0HhBQLByPjhEVbxQYqCw== X-Received: by 2002:adf:f6c9:: with SMTP id y9mr6285148wrp.550.1641576107014; Fri, 07 Jan 2022 09:21:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/19] hw/intc/arm_gicv3_its: Remove redundant ITS_CTLR_ENABLED define Date: Fri, 7 Jan 2022 17:21:27 +0000 Message-Id: <20220107172142.2651911-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::436 (failed) 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::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576536460100001 We currently define a bitmask for the GITS_CTLR ENABLED bit in two ways: as ITS_CTLR_ENABLED, and via the FIELD() macro as R_GITS_CTLR_ENABLED_MASK. Consistently use the FIELD macro version everywhere and remove the redundant ITS_CTLR_ENABLED define. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/gicv3_internal.h | 2 -- hw/intc/arm_gicv3_its.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index b9c37453b04..63de8667c61 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -289,8 +289,6 @@ FIELD(GITS_TYPER, CIL, 36, 1) =20 #define GITS_IDREGS 0xFFD0 =20 -#define ITS_CTLR_ENABLED (1U) /* ITS Enabled */ - #define GITS_BASER_RO_MASK (R_GITS_BASER_ENTRYSIZE_MASK |= \ R_GITS_BASER_TYPE_MASK) =20 diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 677b96dfe23..985ae03f5fc 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -651,7 +651,7 @@ static void process_cmdq(GICv3ITSState *s) uint8_t cmd; int i; =20 - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { return; } =20 @@ -887,7 +887,7 @@ static MemTxResult gicv3_its_translation_write(void *op= aque, hwaddr offset, =20 switch (offset) { case GITS_TRANSLATER: - if (s->ctlr & ITS_CTLR_ENABLED) { + if (s->ctlr & R_GITS_CTLR_ENABLED_MASK) { devid =3D attrs.requester_id; result =3D process_its_cmd(s, data, devid, NONE); } @@ -912,13 +912,13 @@ static bool its_writel(GICv3ITSState *s, hwaddr offse= t, switch (offset) { case GITS_CTLR: if (value & R_GITS_CTLR_ENABLED_MASK) { - s->ctlr |=3D ITS_CTLR_ENABLED; + s->ctlr |=3D R_GITS_CTLR_ENABLED_MASK; extract_table_params(s); extract_cmdq_params(s); s->creadr =3D 0; process_cmdq(s); } else { - s->ctlr &=3D ~ITS_CTLR_ENABLED; + s->ctlr &=3D ~R_GITS_CTLR_ENABLED_MASK; } break; case GITS_CBASER: @@ -926,7 +926,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset, * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * already enabled */ - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { s->cbaser =3D deposit64(s->cbaser, 0, 32, value); s->creadr =3D 0; s->cwriter =3D s->creadr; @@ -937,7 +937,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset, * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * already enabled */ - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { s->cbaser =3D deposit64(s->cbaser, 32, 32, value); s->creadr =3D 0; s->cwriter =3D s->creadr; @@ -979,7 +979,7 @@ static bool its_writel(GICv3ITSState *s, hwaddr offset, * IMPDEF choice:- GITS_BASERn register becomes RO if ITS is * already enabled */ - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { index =3D (offset - GITS_BASER) / 8; =20 if (offset & 7) { @@ -1076,7 +1076,7 @@ static bool its_writell(GICv3ITSState *s, hwaddr offs= et, * IMPDEF choice:- GITS_BASERn register becomes RO if ITS is * already enabled */ - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { index =3D (offset - GITS_BASER) / 8; s->baser[index] &=3D GITS_BASER_RO_MASK; s->baser[index] |=3D (value & ~GITS_BASER_RO_MASK); @@ -1087,7 +1087,7 @@ static bool its_writell(GICv3ITSState *s, hwaddr offs= et, * IMPDEF choice:- GITS_CBASER register becomes RO if ITS is * already enabled */ - if (!(s->ctlr & ITS_CTLR_ENABLED)) { + if (!(s->ctlr & R_GITS_CTLR_ENABLED_MASK)) { s->cbaser =3D value; s->creadr =3D 0; s->cwriter =3D s->creadr; @@ -1298,7 +1298,7 @@ static void gicv3_its_reset(DeviceState *dev) =20 static void gicv3_its_post_load(GICv3ITSState *s) { - if (s->ctlr & ITS_CTLR_ENABLED) { + if (s->ctlr & R_GITS_CTLR_ENABLED_MASK) { extract_table_params(s); extract_cmdq_params(s); } --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576751; cv=none; d=zohomail.com; s=zohoarc; b=GLlFxi30cyn8XOjlPL3cYDzyLEfRT+CqC6yn8nfodIsSbxwIhqjFlV6LQTtFjs2fXuIQQeVuRkOJj/WTN6JYzP9QLZLdLIck7kL7uBE/b4qUfHEZprTfovjPvjYQllwVDTqsF5J27TFfhXra3icO0maSR8uyGosW0SAjbFsQEhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576751; 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=ioH2wN0+IBcuS87mhMbPJHAa9Z11TnOXzEVoVj3sswY=; b=YDpuS5cTk8HG2G3GBGopPyVLHN6mGNqKzG8AtvsIf+9JbMPW5CNtGc0OKfdCg7at6YFHJcY6rZTjphHJAkmEHW7OMIMutaXphqvATitCX8/9Jj/CSY/kDuUbj26f4qWd2WG93xnuob7BPcODXKkJnZIjqjLtxm/Vv7WsdQ/QUlU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576751030226.97816302566298; Fri, 7 Jan 2022 09:32:31 -0800 (PST) Received: from localhost ([::1]:33950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t6L-0004Bu-1H for importer@patchew.org; Fri, 07 Jan 2022 12:32:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw2-00055d-SI for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:51 -0500 Received: from [2a00:1450:4864:20::332] (port=54051 helo=mail-wm1-x332.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw1-0007sd-5Q for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: by mail-wm1-x332.google.com with SMTP id l4so4392821wmq.3 for ; Fri, 07 Jan 2022 09:21:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:47 -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=ioH2wN0+IBcuS87mhMbPJHAa9Z11TnOXzEVoVj3sswY=; b=Yn2i9fdoKJW56+bSTSmdanunvkVsQEiSy5bup0onp7lomGjcLPJkqIpnllyKBfjxYC 1P1mukrWy5zKvaGfA12HzNgMzd5gipoyTV+oXEF/sQ8CtcvH6mUcsqv/SfXV70k+EM1y fIKXLRWOvUk9nCINTzc17iUKbMJ6cTlvHgRwDuJAbWSFsDfO3Mpe0wMSc2ZCzUsK/L8+ U1SByG34WYhmt752QCesFoQdXuzKrmq61Ut0bHPND/nwg4iP8occTUV3pGTJ16K1kRij pAZuam1J8Q84gwheCuOn5MvV4os8J17gRJ1wdEyy/SgZMxmkAlDV+SGEDhFHNtpODff+ ft/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ioH2wN0+IBcuS87mhMbPJHAa9Z11TnOXzEVoVj3sswY=; b=gb+fWgdMCjDPCi7AoKsoACRB0iiExdeuxVbxcJKJdf+nNerXQIh32fS8VFLjk8BiQF czCJbX7FMdZC0dh1LVleJ59+Cpc1orT+1uRvGkWGGu76/Zbdqaa1U2Owc7766Y03elT6 +djjDWX+SGU05V/zSrRXdvRS7SI/33oDaxv8MUtRjUxponOKMP1thdbRQkBdpyftqPp5 aCawhAcVtXMusduuZLWPlkdk9RspHHKzbdcNYlrgeR+UeJcj2PmZIFpX0slL4pjfAW7S EM+1hONUJN6dczx/D+dc+hTQOi9LpIKCp0GK+ZocOsTKM5xDYYfeibM9TuxVvnGZxn+d SVHQ== X-Gm-Message-State: AOAM531UDAG+RLx/E0VVnpOyUOlb2UEVAGG6BUtw/pF9kzgdVvGPLv8s cD9qn6u+LQQONEfYrlrDhsFFuB6cJXgjWg== X-Google-Smtp-Source: ABdhPJwRiVSRIHAXP7crypeikOhxTIK1rS/d77uho9XqQhA7Heu1GE50coteEHDVW1VNX4ojeMwGKw== X-Received: by 2002:a05:600c:1c26:: with SMTP id j38mr11774503wms.101.1641576107561; Fri, 07 Jan 2022 09:21:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/19] hw/intc/arm_gicv3_its: Remove maxids union from TableDesc Date: Fri, 7 Jan 2022 17:21:28 +0000 Message-Id: <20220107172142.2651911-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::332 (failed) 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::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576753440100001 The TableDesc struct defines properties of the in-guest-memory tables which the guest tells us about by writing to the GITS_BASER registers. This struct currently has a union 'maxids', but all the fields of the union have the same type (uint32_t) and do the same thing (record one-greater-than the maximum ID value that can be used as an index into the table). We're about to add another table type (the GICv4 vPE table); rather than adding another specifically-named union field for that table type with the same type as the other union fields, remove the union entirely and just have a 'uint32_t max_ids' struct field. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- include/hw/intc/arm_gicv3_its_common.h | 5 +---- hw/intc/arm_gicv3_its.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_g= icv3_its_common.h index 4e79145dde3..85a144b0e49 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -47,10 +47,7 @@ typedef struct { uint16_t entry_sz; uint32_t page_sz; uint32_t max_entries; - union { - uint32_t max_devids; - uint32_t max_collids; - } maxids; + uint32_t max_ids; uint64_t base_addr; } TableDesc; =20 diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 985ae03f5fc..f321f10189e 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -287,10 +287,10 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_= t value, uint32_t offset, * In this implementation, in case of guest errors we ignore the * command and move onto the next command in the queue. */ - if (devid > s->dt.maxids.max_devids) { + if (devid > s->dt.max_ids) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes: devid %d>%d", - __func__, devid, s->dt.maxids.max_devids); + __func__, devid, s->dt.max_ids); =20 } else if (!dte_valid || !ite_valid || !cte_valid) { qemu_log_mask(LOG_GUEST_ERROR, @@ -384,7 +384,7 @@ static bool process_mapti(GICv3ITSState *s, uint64_t va= lue, uint32_t offset, max_Intid =3D (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; } =20 - if ((devid > s->dt.maxids.max_devids) || (icid > s->ct.maxids.max_coll= ids) + if ((devid > s->dt.max_ids) || (icid > s->ct.max_ids) || !dte_valid || (eventid > max_eventid) || (!ignore_pInt && (((pIntid < GICV3_LPI_INTID_START) || (pIntid > max_Intid)) && (pIntid !=3D INTID_SPURIOUS)))) { @@ -505,7 +505,7 @@ static bool process_mapc(GICv3ITSState *s, uint32_t off= set) =20 valid =3D (value & CMD_FIELD_VALID_MASK); =20 - if ((icid > s->ct.maxids.max_collids) || (rdbase >=3D s->gicv3->num_cp= u)) { + if ((icid > s->ct.max_ids) || (rdbase >=3D s->gicv3->num_cpu)) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPC: invalid collection table attributes " "icid %d rdbase %" PRIu64 "\n", icid, rdbase); @@ -618,7 +618,7 @@ static bool process_mapd(GICv3ITSState *s, uint64_t val= ue, uint32_t offset) =20 valid =3D (value & CMD_FIELD_VALID_MASK); =20 - if ((devid > s->dt.maxids.max_devids) || + if ((devid > s->dt.max_ids) || (size > FIELD_EX64(s->typer, GITS_TYPER, IDBITS))) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPD: invalid device table attributes " @@ -810,8 +810,8 @@ static void extract_table_params(GICv3ITSState *s) (page_sz / s->dt.entry_sz)); } =20 - s->dt.maxids.max_devids =3D (1UL << (FIELD_EX64(s->typer, GITS= _TYPER, - DEVBITS) + 1)); + s->dt.max_ids =3D (1UL << (FIELD_EX64(s->typer, GITS_TYPER, + DEVBITS) + 1)); =20 s->dt.base_addr =3D baser_base_addr(value, page_sz); =20 @@ -842,11 +842,11 @@ static void extract_table_params(GICv3ITSState *s) } =20 if (FIELD_EX64(s->typer, GITS_TYPER, CIL)) { - s->ct.maxids.max_collids =3D (1UL << (FIELD_EX64(s->typer, - GITS_TYPER, CIDBITS) + 1)); + s->ct.max_ids =3D (1UL << (FIELD_EX64(s->typer, + GITS_TYPER, CIDBITS) += 1)); } else { /* 16-bit CollectionId supported when CIL =3D=3D 0 */ - s->ct.maxids.max_collids =3D (1UL << 16); + s->ct.max_ids =3D (1UL << 16); } =20 s->ct.base_addr =3D baser_base_addr(value, page_sz); --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576564; cv=none; d=zohomail.com; s=zohoarc; b=XBs6zTnu16b2LJw6/7DoW6w0TBvlHRxRr+qSk51qsJWeM9Xh78/h33Z4T6wfPuaqL0vI+2J+PlwDp3oAi5UzjajfYi/GjsoifYJXo7fYfFjtYTXmqbLu7etclLv5eeJ6WWUXCMh60emrMa9heB6+2Yat2pIw0v3h34HfVQkW85E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576564; 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=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=NyXAM03gJp6OLD0BsIPtSd5F8MzdBcLDTpyRdaHFFhRikej0To8gIq1Gu1boy23JFgNAaraHrfGWz9HnOLU6IgjU1tB4rJ9dHj75HjZssLyRs0hEC+PZ5Oj+ZvRrFR4Kn5rIBrf8oSfa6U5wRNIRw+KelimGXSey+69L1j8oOXE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164157656414553.88188812898238; Fri, 7 Jan 2022 09:29:24 -0800 (PST) Received: from localhost ([::1]:53492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t3L-0006WM-3T for importer@patchew.org; Fri, 07 Jan 2022 12:29:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw2-00055i-To for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:51 -0500 Received: from [2a00:1450:4864:20::330] (port=44639 helo=mail-wm1-x330.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw1-0007so-GN for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:50 -0500 Received: by mail-wm1-x330.google.com with SMTP id f189-20020a1c1fc6000000b00347ac5ccf6cso1248123wmf.3 for ; Fri, 07 Jan 2022 09:21:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:48 -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=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=O5k6e+ZhI8o59lQNrXtW/0xGbzGn8TCz8UaW85rPlLKb6LJx7jdVu0BJCwGsGDpf4+ EhJ+pcqFtKkitlrDpk+BAPWhmM/lC6rRVeLoI5DMTyEDcJaXhCtK8X/HOGgrAKM1zB2P XLdW3lX20n/qelMvfZMZhpc/Djf4kArrWhTqTh4rDSYJdlcuN0z1yVEVf1DWc053dUB/ MtglYdRULQKI5qPhDd8M26JwJt3hSlo8QXYHfLvr+/98SWutn5lcLwzhTzBKqcAJOE6I niwn9qOejRAdLl2hJ3moQLZjZ1AvkhjV/n08EDDGavA2LQoMjewiHjqBhYSWNjp5ejOT wpkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WhfaxipphljaQnFFNp/teaFMbHkOrGbHBKmTsnpAR9A=; b=VulAei6qoTip/Kz0GjSr6+E/udxqysxsFeb6d+lQFhZL70rzSeLzswMiXk9o7uYebp BLLsoMFuZsByFrRySiY+1ppx6dQGiGPfcxro1H3Ul6J9y3CVg+AOyyHEp9y/oi6j573M b5Pj9PbYNkQHPHi7IYyWKv+VxwSfFlzQmXTjfUMCzD+5KOUhF/pjVkS0DTswdrrzLzho ker7nkdm3h2XO4X8UmrxFSJl0ViXB16t0yIefZzDkEqHWQvrh1TsCffFDWM9PFoJ5I/j mYx3FeqEv/MDaFFI2FVbpAuwqjC+GfPPkIxLN8iRHw4crrYD29RhZ5+1jw9+0rq9Lo67 F20A== X-Gm-Message-State: AOAM530Q6t63/tVra6f5N4hW4V6nKduHiZxUgH64Q27fRcXDf8UD1Fpf zUs1awqQRmm+8Pvh/8RHpW2tFdS3FzipDg== X-Google-Smtp-Source: ABdhPJyaO78Nkek6Ppl46nExTeK/8qAmzQtZlo68dhypwN8Chg4wA2JmI2X6Zlp/c4Tp6zRga38Giw== X-Received: by 2002:a1c:4b10:: with SMTP id y16mr11280698wma.185.1641576108290; Fri, 07 Jan 2022 09:21:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/19] hw/intc/arm_gicv3_its: Don't return early in extract_table_params() loop Date: Fri, 7 Jan 2022 17:21:29 +0000 Message-Id: <20220107172142.2651911-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::330 (failed) 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::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576565760100001 In extract_table_params() we process each GITS_BASER register. If the register's Valid bit is not set, this means there is no in-guest-memory table and so we should not try to interpret the other fields in the register. This was incorrectly coded as a 'return' rather than a 'break', so instead of looping round to process the next GITS_BASER we would stop entirely, treating any later tables as being not valid also. This has no real guest-visible effects because (since we don't have GITS_TYPER.HCC !=3D 0) the guest must in any case set up all the GITS_BASER to point to valid tables, so this only happens in an odd misbehaving-guest corner case. Fix the check to 'break', so that we leave the case statement and loop back around to the next GITS_BASER. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index f321f10189e..c97b9982ae1 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -795,7 +795,7 @@ static void extract_table_params(GICv3ITSState *s) s->dt.valid =3D FIELD_EX64(value, GITS_BASER, VALID); =20 if (!s->dt.valid) { - return; + break; } =20 s->dt.page_sz =3D page_sz; @@ -826,7 +826,7 @@ static void extract_table_params(GICv3ITSState *s) * hence writes are discarded if ct.valid is 0 */ if (!s->ct.valid) { - return; + break; } =20 s->ct.page_sz =3D page_sz; --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576958; cv=none; d=zohomail.com; s=zohoarc; b=Sc1l7iI/68oVunx/pxaoQ9LRKbsP5N7QBjf8XZjPbzqdoTm58r8jszLsSdI7b9nQ6KixctmT/Nh2/XbNbP2ioxdG9sj4ZIkwmkKxTSy17mZ2v56BLz6UYPPi9xWx3DkvLfc0LMR7Yodn9/zGJRJN6UYd7+jSrcrgtCkhZD04B5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576958; 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=OIDDMkIyA7MpvRn1rUvUntrwxdB6HAz6Cx4m2eprMqU=; b=BLjDwmryOjYjNgL5jnxdvkzZDk+W6G9Gv4OEVjJh2jnV6olUt0sg/8hNF8jPUkdIxMMdBrlU/9DyzgsDQT4oaDU3W1Ngx6Osc9gDxU09al88XCbie/h+llDqhBOn4mlIZHGVFmgrNSdSB6eRlCdP5TPL2lqXKmGPmoIPw7QLAyM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576958296652.2307293048469; Fri, 7 Jan 2022 09:35:58 -0800 (PST) Received: from localhost ([::1]:40998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t9h-0000cl-2z for importer@patchew.org; Fri, 07 Jan 2022 12:35:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw3-00056S-Qa for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:53 -0500 Received: from [2a00:1450:4864:20::431] (port=47059 helo=mail-wr1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw2-0007t5-4w for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:51 -0500 Received: by mail-wr1-x431.google.com with SMTP id l25so1495815wrb.13 for ; Fri, 07 Jan 2022 09:21:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:48 -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=OIDDMkIyA7MpvRn1rUvUntrwxdB6HAz6Cx4m2eprMqU=; b=r+2K89bY2aZgaNEybGtQDFDuPirf8SpZbGEqqeX8UQIbD8jU4sEW4Si9R7zTSEVqqL bSxisAoQdxmfAKC4Q6EwqKExmFd5TLRVy47ylra7Lqcgap1DdmUzdq/PqdGvIKXyf5Hx 4bDNczs4nhO6RJrXwsVOymEOuYCGaTLfrUrqyf2xBRrawju1sKAxsNCAupf0XVB5Bk/X Hlt8Fsr6+osdxTTHAlgtfJSsQkWkHckZIjJtmxLD6wAP/zZHXr2YMrRaJY1fmSECV1eO 55l2PTk5l5nhgbOAGele8dsA3uYOrF7q0P91lbb96yAzgfnq7DXHcYXZ7vpg3Qi5DDxM xVGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OIDDMkIyA7MpvRn1rUvUntrwxdB6HAz6Cx4m2eprMqU=; b=BZzrDQuwN3pIoCbBySF7icR0iYe4oXA7PwtEVUptOrovDdtDUcswNYN7gtAh6hGczl 1m9X6tnMWVtKJC9fO8d0+lycFtsQ/0Mcbafx2mSVvCgWGGvFbdNAwz3kiqaTJaNHoCi7 52SIz2EGQ7pcA26ziyQWoIxxlnPXl63dqpYkF8QjEQVYhhP5FbrQ8MWSTzsAGgVI66Yp +6DwGWm2Re6CxkTWMnamyZ7zeyvX6fkNqghl41mSvMrL0eTF95kLNei9c/hbDnXAd0Eg maRhoa0I2HmngHUKbT+cWgHxnt6EANmdXRqMIgohym/vb87WZfHW7+mv66bgeAncPp5s Z5lQ== X-Gm-Message-State: AOAM531jY+iYLq77CyuZke5zez2pK/4pSX5G6ITFxFL9v/yXS0Ge+QxX QZP4ZnF1uXyZplsXqoLiqJAGLFFD4sbvTA== X-Google-Smtp-Source: ABdhPJxJfAwBH8WahlzzyLU8xEL4n0VW2J7PLOMKf09l3Fdql6HSJzaGImdbJtpc+Hsw7bjFHkkN2Q== X-Received: by 2002:adf:b60e:: with SMTP id f14mr32534972wre.11.1641576108846; Fri, 07 Jan 2022 09:21:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/19] hw/intc/arm_gicv3_its: Reduce code duplication in extract_table_params() Date: Fri, 7 Jan 2022 17:21:30 +0000 Message-Id: <20220107172142.2651911-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::431 (failed) 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::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576959547100001 The extract_table_params() decodes the fields in the GITS_BASER registers into TableDesc structs. Since the fields are the same for all the GITS_BASER registers, there is currently a lot of code duplication within the switch (type) statement. Refactor so that the cases include only what is genuinely different for each type: the calculation of the number of bits in the ID value that indexes into the table. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/arm_gicv3_its.c | 97 +++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 57 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index c97b9982ae1..84808b1e298 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -758,6 +758,9 @@ static void extract_table_params(GICv3ITSState *s) uint64_t value; =20 for (int i =3D 0; i < 8; i++) { + TableDesc *td; + int idbits; + value =3D s->baser[i]; =20 if (!value) { @@ -789,73 +792,53 @@ static void extract_table_params(GICv3ITSState *s) type =3D FIELD_EX64(value, GITS_BASER, TYPE); =20 switch (type) { - case GITS_BASER_TYPE_DEVICE: - memset(&s->dt, 0 , sizeof(s->dt)); - s->dt.valid =3D FIELD_EX64(value, GITS_BASER, VALID); - - if (!s->dt.valid) { - break; - } - - s->dt.page_sz =3D page_sz; - s->dt.indirect =3D FIELD_EX64(value, GITS_BASER, INDIRECT); - s->dt.entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE); - - if (!s->dt.indirect) { - s->dt.max_entries =3D (num_pages * page_sz) / s->dt.entry_= sz; - } else { - s->dt.max_entries =3D (((num_pages * page_sz) / - L1TABLE_ENTRY_SIZE) * - (page_sz / s->dt.entry_sz)); - } - - s->dt.max_ids =3D (1UL << (FIELD_EX64(s->typer, GITS_TYPER, - DEVBITS) + 1)); - - s->dt.base_addr =3D baser_base_addr(value, page_sz); - + td =3D &s->dt; + idbits =3D FIELD_EX64(s->typer, GITS_TYPER, DEVBITS) + 1; break; - case GITS_BASER_TYPE_COLLECTION: - memset(&s->ct, 0 , sizeof(s->ct)); - s->ct.valid =3D FIELD_EX64(value, GITS_BASER, VALID); - - /* - * GITS_TYPER.HCC is 0 for this implementation - * hence writes are discarded if ct.valid is 0 - */ - if (!s->ct.valid) { - break; - } - - s->ct.page_sz =3D page_sz; - s->ct.indirect =3D FIELD_EX64(value, GITS_BASER, INDIRECT); - s->ct.entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE); - - if (!s->ct.indirect) { - s->ct.max_entries =3D (num_pages * page_sz) / s->ct.entry_= sz; - } else { - s->ct.max_entries =3D (((num_pages * page_sz) / - L1TABLE_ENTRY_SIZE) * - (page_sz / s->ct.entry_sz)); - } - + td =3D &s->ct; if (FIELD_EX64(s->typer, GITS_TYPER, CIL)) { - s->ct.max_ids =3D (1UL << (FIELD_EX64(s->typer, - GITS_TYPER, CIDBITS) += 1)); + idbits =3D FIELD_EX64(s->typer, GITS_TYPER, CIDBITS) + 1; } else { /* 16-bit CollectionId supported when CIL =3D=3D 0 */ - s->ct.max_ids =3D (1UL << 16); + idbits =3D 16; } - - s->ct.base_addr =3D baser_base_addr(value, page_sz); - break; - default: - break; + /* + * GITS_BASER.TYPE is read-only, so GITS_BASER_RO_MASK + * ensures we will only see type values corresponding to + * the values set up in gicv3_its_reset(). + */ + g_assert_not_reached(); } + + memset(td, 0, sizeof(*td)); + td->valid =3D FIELD_EX64(value, GITS_BASER, VALID); + /* + * If GITS_BASER.Valid is 0 for any then we will not process + * interrupts. (GITS_TYPER.HCC is 0 for this implementation, so we + * do not have a special case where the GITS_BASER.Valid bit is= 0 + * for the register corresponding to the Collection table but we + * still have to process interrupts using non-memory-backed + * Collection table entries.) + */ + if (!td->valid) { + continue; + } + td->page_sz =3D page_sz; + td->indirect =3D FIELD_EX64(value, GITS_BASER, INDIRECT); + td->entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE); + td->base_addr =3D baser_base_addr(value, page_sz); + if (!td->indirect) { + td->max_entries =3D (num_pages * page_sz) / td->entry_sz; + } else { + td->max_entries =3D (((num_pages * page_sz) / + L1TABLE_ENTRY_SIZE) * + (page_sz / td->entry_sz)); + } + td->max_ids =3D 1ULL << idbits; } } =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576265; cv=none; d=zohomail.com; s=zohoarc; b=cxrXKB+kQcklvejYPEAmvZhaA9HvS7BLc4L3RH8wW/VE4KyuE90ckdIOdTzTQvpQ4K1Lsoj4/2CPoKddw0knkqdAX8HVrOLeEHEVXb+T5lJmYfgf1fzO7stHsTFxYfNRyDxeCdKZVVZFGrECf9nC+jMSxulRX5Y3oUs0TGQUpLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576265; 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=Q5OaLs830Ox8Bfylb1X2zHy5rJRr7MHpRwjdBpXLrtw=; b=fpyTPNvLf0FeCBmegUqHOKTVxvL5Nt6WvECw4mnZ+CEYEcJWupByEkHOnnmIoCjo6+xRHsltg0A/o4IJ9dQckHVVntPL0FupRYOMhlgyEUsGiPCSd9M9O01OclUHkeXkj7+FuKrhN7r5w4cO3AV0CZ1Vrdh9W/h00ZAZyo2+sRM= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576265017587.637619690609; Fri, 7 Jan 2022 09:24:25 -0800 (PST) Received: from localhost ([::1]:43500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5syV-0007oA-Ia for importer@patchew.org; Fri, 07 Jan 2022 12:24:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw4-00056g-Vx for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:53 -0500 Received: from [2a00:1450:4864:20::331] (port=44640 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw2-0007tL-Ib for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:52 -0500 Received: by mail-wm1-x331.google.com with SMTP id f189-20020a1c1fc6000000b00347ac5ccf6cso1248150wmf.3 for ; Fri, 07 Jan 2022 09:21:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:49 -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=Q5OaLs830Ox8Bfylb1X2zHy5rJRr7MHpRwjdBpXLrtw=; b=m5Yn572xDBOFXtoMV4O40kBs4+7nVZywJ7KHoFoqcLmqtiiWs3Im0hNTEfr7ar3HN9 8QQeQaHzaQrLi1JrxU3DPUEMu98wgtNLlI+dFZhyqCo21K5SJEEtBU7S+/BFt5aTokDs 4yK7lqjXiJ3mJ/FuYgwJSLVYzStLJkNW8TikbM+ORGsVnDlrjhIXbDgnt1TF+sm+fOxP 1kiabEHux0C+fgnZhSDeGa2WM0bQRO7XCgb6/I8EbLprdceCCd7ReDxDrtsvDQC376UO iOCzPblz7lQdClElDmJWWJsqYNLeEeDzUPf7fT4MzWedX8J1qhrkqdZzNsYVy7Ok5Yl3 gzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q5OaLs830Ox8Bfylb1X2zHy5rJRr7MHpRwjdBpXLrtw=; b=1EMw7yvoVhokvfPqjm7S8D/83uHR+jEQwB/EVLgKQ+fHmCOCbTpujVcY6S1WRwyXRl r6/977OERB6fOOglBX1X3sqCTQYgz7BqtSkp/77WuDGch9ifG/W/JXLeqEuyottX54Yr YKrwZZNO+N2KUsuAo/RlcV0P+hTkxuAbS31lV9wNCNq52f2Ns6+6GyYzZj+R+pA3ySi5 IMDLtU36wIPiODUD4lVQEGLhdkSqeV/Ri8JC+GNLl7dFZPALLKamutOf2LZ+WJ5OIJuH FAEXh+XzPtGGmV72Q6aHR/ftPBcGL9f6gs3hVYu3PkQLBh0opcjfM2aMZNLcLJWkRhe1 Zhbg== X-Gm-Message-State: AOAM533igOSkkBfFkhExfgf3WCAYiSFFvouheW4NC00O0GxG5cWqNzfU HeGFG3rs6L8dMgfAgdKg47RMHGeRxI0qMg== X-Google-Smtp-Source: ABdhPJwyV5GIWZavHC49s5TBaJQU+X9NFwVy87b0YJjT4HICIcuklFnQuUk1u6J98Sv1zWrraKLYxQ== X-Received: by 2002:a05:600c:4e88:: with SMTP id f8mr11938696wmq.45.1641576109361; Fri, 07 Jan 2022 09:21:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/19] hw/intc/arm_gicv3_its: Correct setting of TableDesc entry_sz Date: Fri, 7 Jan 2022 17:21:31 +0000 Message-Id: <20220107172142.2651911-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) 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::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576266619100001 We set the TableDesc entry_sz field from the appropriate GITS_BASER.ENTRYSIZE field. That ID register field specifies the number of bytes per table entry minus one. However when we use td->entry_sz we assume it to be the number of bytes per table entry (for instance we calculate the number of entries in a page by dividing the page size by the entry size). The effects of this bug are: * we miscalculate the maximum number of entries in the table, so our checks on guest index values are wrong (too lax) * when looking up an entry in the second level of an indirect table, we calculate an incorrect index into the L2 table. Because we make the same incorrect calculation on both reads and writes of the L2 table, the guest won't notice unless it's unlucky enough to use an index value that causes us to index off the end of the L2 table page and cause guest memory corruption in whatever follows Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 84808b1e298..88f4d730999 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -829,7 +829,7 @@ static void extract_table_params(GICv3ITSState *s) } td->page_sz =3D page_sz; td->indirect =3D FIELD_EX64(value, GITS_BASER, INDIRECT); - td->entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE); + td->entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE) + 1; td->base_addr =3D baser_base_addr(value, page_sz); if (!td->indirect) { td->max_entries =3D (num_pages * page_sz) / td->entry_sz; --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576961; cv=none; d=zohomail.com; s=zohoarc; b=d6lox4wiQZ6AXujdwdj07pGIfWqvaO50wQnq/jIqf0WnhEmeM1zOejeNwqEfSNemZEp3QKTLZNSMUixZhzyVY3NPOloK/GgHwXgjSzsYmvjW1yUt8g/6UtJrp4EorMjo4tl6W6Wfw55m/E539vD+G3P4ZYk3bHFAdWrC18CJCLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576961; 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=QPaQb/WJdcDDdEPvSwDWxqflQibLtPJdH7ehjP+AciI=; b=SxbS8vSUJen+FCg9ABnbHTbNNuLZ/lfOdZw9yIQd83eSD0Rh6L6rKzWlyhkCeEJ4u22+JHuhi3lo9vZHN6RifU5dZIGldSLmlvYbhoNahiewAqQabWkzYFsF/CJ5gkB9+Zdfu/EqUtKuew05LqXjKvffP+7IrHWL+zo0KyD8Tnc= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576961039992.6150834719648; Fri, 7 Jan 2022 09:36:01 -0800 (PST) Received: from localhost ([::1]:41334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t9j-0000vM-Kz for importer@patchew.org; Fri, 07 Jan 2022 12:35:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swA-0005Bh-50 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:58 -0500 Received: from [2a00:1450:4864:20::331] (port=36496 helo=mail-wm1-x331.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw3-0007tc-4L for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:57 -0500 Received: by mail-wm1-x331.google.com with SMTP id n19-20020a7bc5d3000000b003466ef16375so5836021wmk.1 for ; Fri, 07 Jan 2022 09:21:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:49 -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=QPaQb/WJdcDDdEPvSwDWxqflQibLtPJdH7ehjP+AciI=; b=eOzFPvENla0g605TcpIcJssUwJvVl7aP2WYuOaJ0m7kAnlbNlKtZlp5TWancrsYsrC Cx9Sd2laXxbi0j7onhec1lBDdwYa+bb7XlTTaldUY8SBtSQ1RhHfNeAM0D0bUW8R4wDn QDZQKM66XFZ06JyTvwD1IhLMc8Q9Sd4DSLB/BSv2d9v7f1Z9qYGNzqtzJFAX1amJ9oTv gjgq2/+OQbPBZ3/lb9Yj08izmzE7UbT0rIqHITE6ANk4ijuNqg5Zl1CRdzt2JfKBDXCz EyfZtG8KbapWEtMLyyVhDJVlnQx+90CQwYqfvu9NYPa0t0cHvuP0EsmFSnqOEnSLMbhY EBjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QPaQb/WJdcDDdEPvSwDWxqflQibLtPJdH7ehjP+AciI=; b=jevM0uZWh1xxYfCjkWFQMYawVwYiu7E01jhlMmIwdd6LqtVDMIVNb1XHruVtks5Ajt Jo8QL+9ga4YTZqJ6RaRuvcIRp0Zo2BIxEYWya+8RG66vwvn+VwVEJ75r926vzUpJCr1a L9Ssnp0ffkRUUnuGgUYlTljVi5YfYg9h4RFXwyIhmAPq8VHhzynJZjlOCiazxE7Mtk1v JixBJm2fzSudHISWcYKXUsmmqTUUOs6lxF2MMWRNTvDgoqGMbPvmMUEjirWJhZ9PdHwH /tLu0aLrq7kTmM835IG3R3pkeGQ1VOYTljl38t0krcu0IqIQOUFDoidO02uPxwYxYntp imDg== X-Gm-Message-State: AOAM5338hlOoJw/AKhaN2fev4ahNN5tZ2i0jAq3ggD8l1D1QnDadlQ0U ySAvmkOKp1eNjCI1Cp2Mcrqzyt4eEOtssg== X-Google-Smtp-Source: ABdhPJwqJ50xmmgLMcG53JGnzWe4PM2iT6WDKaQSfkO6EaBKMnt8NCMxMI69Wocvyz9qIXpT0MBXIA== X-Received: by 2002:a1c:7214:: with SMTP id n20mr11982566wmc.118.1641576109910; Fri, 07 Jan 2022 09:21:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/19] hw/intc/arm_gicv3_its: Don't misuse GITS_TYPE_PHYSICAL define Date: Fri, 7 Jan 2022 17:21:32 +0000 Message-Id: <20220107172142.2651911-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::331 (failed) 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::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576963443100001 The GITS_TYPE_PHYSICAL define is the value we set the GITS_TYPER.Physical field to -- this is 1 to indicate that we support physical LPIs. (Support for virtual LPIs is the GITS_TYPER.Virtual field.) We also use this define as the *value* that we write into an interrupt translation table entry's INTTYPE field, which should be 1 for a physical interrupt and 0 for a virtual interrupt. Finally, we use it as a *mask* when we read the interrupt translation table entry INTTYPE field. Untangle this confusion: define an ITE_INTTYPE_VIRTUAL and ITE_INTTYPE_PHYSICAL to be the valid values of the ITE INTTYPE field, and replace the ad-hoc collection of ITE_ENTRY_* defines with use of the FIELD() macro to define the fields of an ITE and the FIELD_EX64() and FIELD_DP64() macros to read and write them. We use ITE in the new setup, rather than ITE_ENTRY, because ITE stands for "Interrupt translation entry" and so the extra "entry" would be redundant. We take the opportunity to correct the name of the field that holds the GICv4 'doorbell' interrupt ID (this is always the value 1023 in a GICv3, which is why we were calling it the 'spurious' field). The GITS_TYPE_PHYSICAL define is then used in only one place, where we set the initial GITS_TYPER value. Since GITS_TYPER.Physical is essentially a boolean, hiding the '1' value behind a macro is more confusing than helpful, so expand out the macro there and remove the define entirely. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/gicv3_internal.h | 26 ++++++++++++++------------ hw/intc/arm_gicv3_its.c | 30 +++++++++++++----------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 63de8667c61..5a63e9ed5ce 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -354,28 +354,30 @@ FIELD(MAPC, RDBASE, 16, 32) #define L2_TABLE_VALID_MASK CMD_FIELD_VALID_MASK #define TABLE_ENTRY_VALID_MASK (1ULL << 0) =20 -/** - * Default features advertised by this version of ITS - */ -/* Physical LPIs supported */ -#define GITS_TYPE_PHYSICAL (1U << 0) - /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec * ITE Lower 8 Bytes * Bits: | 49 ... 26 | 25 ... 2 | 1 | 0 | - * Values: | 1023 | IntNum | IntType | Valid | + * Values: | Doorbell | IntNum | IntType | Valid | * ITE Higher 4 Bytes * Bits: | 31 ... 16 | 15 ...0 | * Values: | vPEID | ICID | + * (When Doorbell is unused, as it always is in GICv3, it is 1023) */ #define ITS_ITT_ENTRY_SIZE 0xC -#define ITE_ENTRY_INTTYPE_SHIFT 1 -#define ITE_ENTRY_INTID_SHIFT 2 -#define ITE_ENTRY_INTID_MASK MAKE_64BIT_MASK(2, 24) -#define ITE_ENTRY_INTSP_SHIFT 26 -#define ITE_ENTRY_ICID_MASK MAKE_64BIT_MASK(0, 16) + +FIELD(ITE_L, VALID, 0, 1) +FIELD(ITE_L, INTTYPE, 1, 1) +FIELD(ITE_L, INTID, 2, 24) +FIELD(ITE_L, DOORBELL, 26, 24) + +FIELD(ITE_H, ICID, 0, 16) +FIELD(ITE_H, VPEID, 16, 16) + +/* Possible values for ITE_L INTTYPE */ +#define ITE_INTTYPE_VIRTUAL 0 +#define ITE_INTTYPE_PHYSICAL 1 =20 /* 16 bits EventId */ #define ITS_IDBITS GICD_TYPER_IDBITS diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 88f4d730999..15eb72a0a15 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -156,12 +156,11 @@ static bool get_ite(GICv3ITSState *s, uint32_t eventi= d, uint64_t dte, MEMTXATTRS_UNSPECIFIED, res); =20 if (*res =3D=3D MEMTX_OK) { - if (ite.itel & TABLE_ENTRY_VALID_MASK) { - if ((ite.itel >> ITE_ENTRY_INTTYPE_SHIFT) & - GITS_TYPE_PHYSICAL) { - *pIntid =3D (ite.itel & ITE_ENTRY_INTID_MASK) >> - ITE_ENTRY_INTID_SHIFT; - *icid =3D ite.iteh & ITE_ENTRY_ICID_MASK; + if (FIELD_EX64(ite.itel, ITE_L, VALID)) { + int inttype =3D FIELD_EX64(ite.itel, ITE_L, INTTYPE); + if (inttype =3D=3D ITE_INTTYPE_PHYSICAL) { + *pIntid =3D FIELD_EX64(ite.itel, ITE_L, INTID); + *icid =3D FIELD_EX32(ite.iteh, ITE_H, ICID); status =3D true; } } @@ -342,8 +341,6 @@ static bool process_mapti(GICv3ITSState *s, uint64_t va= lue, uint32_t offset, MemTxResult res =3D MEMTX_OK; uint16_t icid =3D 0; uint64_t dte =3D 0; - IteEntry ite; - uint32_t int_spurious =3D INTID_SPURIOUS; bool result =3D false; =20 devid =3D ((value & DEVID_MASK) >> DEVID_SHIFT); @@ -400,16 +397,16 @@ static bool process_mapti(GICv3ITSState *s, uint64_t = value, uint32_t offset, */ } else { /* add ite entry to interrupt translation table */ - ite.itel =3D (dte_valid & TABLE_ENTRY_VALID_MASK) | - (GITS_TYPE_PHYSICAL << ITE_ENTRY_INTTYPE_SHIFT); - + IteEntry ite =3D {}; + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, VALID, dte_valid); + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTTYPE, ITE_INTTYPE_PHYS= ICAL); if (ignore_pInt) { - ite.itel |=3D (eventid << ITE_ENTRY_INTID_SHIFT); + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTID, eventid); } else { - ite.itel |=3D (pIntid << ITE_ENTRY_INTID_SHIFT); + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTID, pIntid); } - ite.itel |=3D (int_spurious << ITE_ENTRY_INTSP_SHIFT); - ite.iteh =3D icid; + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, DOORBELL, INTID_SPURIOUS); + ite.iteh =3D FIELD_DP32(ite.iteh, ITE_H, ICID, icid); =20 result =3D update_ite(s, eventid, dte, ite); } @@ -1237,8 +1234,7 @@ static void gicv3_arm_its_realize(DeviceState *dev, E= rror **errp) "gicv3-its-sysmem"); =20 /* set the ITS default features supported */ - s->typer =3D FIELD_DP64(s->typer, GITS_TYPER, PHYSICAL, - GITS_TYPE_PHYSICAL); + s->typer =3D FIELD_DP64(s->typer, GITS_TYPER, PHYSICAL, 1); s->typer =3D FIELD_DP64(s->typer, GITS_TYPER, ITT_ENTRY_SIZE, ITS_ITT_ENTRY_SIZE - 1); s->typer =3D FIELD_DP64(s->typer, GITS_TYPER, IDBITS, ITS_IDBITS); --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641577108; cv=none; d=zohomail.com; s=zohoarc; b=BvkyArmDp0sXI9XR81XATuiww0Hwxt0Uc8pxVoy88qoNLezTqWCAdrOYwZm09X0Viscrnc7QOtM421W3ksw+ToxZ+ry6xDzcFl8/bTxxc/jsgFkj49GHPWwSg3EkwJ4pCTze2TCNc8wa3RUT/aI3OI+OJ9m6WkOG6CJlIH5/9ag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641577108; 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=tSOlgz2UaWbHd7u1uudXrhAizaLypdvlSN/6koFWLOY=; b=Tu2xdm9RCCAbAU9IWcdtT7JG0MevSskT5keyqJVqOPpCww76EYrFxBB/yvQk8hZ6lTllLtw479p1ZWkPVhqFAJrpS68fyD94uY5eBFc1HgN3QZ4Tlkfi6McZl+vJew4xbChoVXqUMSYqSvkv3wFVhmH+ecsb+5uVa/RGn2KA448= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641577108615153.26517636269125; Fri, 7 Jan 2022 09:38:28 -0800 (PST) Received: from localhost ([::1]:49086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tC7-00073d-IU for importer@patchew.org; Fri, 07 Jan 2022 12:38:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw7-00057p-51 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:55 -0500 Received: from [2a00:1450:4864:20::42f] (port=36572 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw4-0007tq-Nc for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:54 -0500 Received: by mail-wr1-x42f.google.com with SMTP id r10so4676938wrc.3 for ; Fri, 07 Jan 2022 09:21:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:50 -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=tSOlgz2UaWbHd7u1uudXrhAizaLypdvlSN/6koFWLOY=; b=C7uVl7tfHyVy2n7Ct6yNIfM930Kl1maSvVA8E8o9Z2ld2wV4NzEiNXgWHWZUEag5cv dvsjwapAZnpvkKrFzYqkD5hvVVErFufGjo7T5PtBOuvFf4pShdHn+O0LSCXUBuiaf8Za VT/xiCFVR8KFUwzAeTNUY+ZaIEQvC5w0itK0GctXdXZbnslKhVni6CjOfm1pqYwsSfl3 zypAuqlplactUwDuyzgEnbnkL7WKpsw6iGw4M6KscPTD5EJ7K3xbh2s8gAQQZB/OdJ03 TxZJuUjDD79tlPjF0I95AlotNUlBWEl3HSe+SmJgGooCzeGWO5ypw0mxl3b8QvQYG91i hM1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tSOlgz2UaWbHd7u1uudXrhAizaLypdvlSN/6koFWLOY=; b=FpR293zV54kPB/FMUgpZoA447sRIyQi/dkp/2hYptuM06yguNNMHx48COOAKj0Eyla /UsmYqAGgor/aTc83SM2IcGw526ExS/LrN1U60NTBxnJa4EY5BDwO7khLZfu9fAMrbgI /mLKtxBX7BQYTJ15whN18vvgBVIcoBh1SZfQ/6swwfYGuB2Ea24ZkWzUNiVrSF68A4Nr HG+s0p80YVJ/aFViw+P5X18dpMVKwK4IbI8z8KvGx3FDYEyhwDXxD1PXvH5REouB9J0k VeTbII1ICbs/TGtnIiErcUYvFRF3FCCiMW6aVpaUR+mcfX4RlVEQx8sd8LsBbVxuAaht b9sQ== X-Gm-Message-State: AOAM530th2ZCqvYcKNHhpXCUM8BWDQqM5ID/O9sWUpMGXbaFwN93n8MP Mwsmm6ArjCr1IcbPOxU01zP5cJPQ+USQgg== X-Google-Smtp-Source: ABdhPJwelehcB1ZTm3MCE43fudJA1Hxvh9bRZjHzG2U0KiY58qcL9zZssTqei1lnj4/AzYam6LgIIg== X-Received: by 2002:adf:e902:: with SMTP id f2mr929189wrm.662.1641576110384; Fri, 07 Jan 2022 09:21:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/19] hw/intc/arm_gicv3_its: Correct handling of MAPI Date: Fri, 7 Jan 2022 17:21:33 +0000 Message-Id: <20220107172142.2651911-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) 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::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641577110330100001 The MAPI command takes arguments DeviceID, EventID, ICID, and is defined to be equivalent to MAPTI DeviceID, EventID, EventID, ICID. (That is, where MAPTI takes an explicit pINTID, MAPI uses the EventID as the pINTID.) We didn't quite get this right. In particular the error checks for MAPI include "EventID does not specify a valid LPI identifier", which is the same as MAPTI's error check for the pINTID field. QEMU's code skips the pINTID error check entirely in the MAPI case. We can fix this bug and in the process simplify the code by switching to the obvious implementation of setting pIntid =3D eventid early if ignore_pInt is true. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 15eb72a0a15..6f21c56fba2 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -354,7 +354,9 @@ static bool process_mapti(GICv3ITSState *s, uint64_t va= lue, uint32_t offset, =20 eventid =3D (value & EVENTID_MASK); =20 - if (!ignore_pInt) { + if (ignore_pInt) { + pIntid =3D eventid; + } else { pIntid =3D ((value & pINTID_MASK) >> pINTID_SHIFT); } =20 @@ -377,14 +379,12 @@ static bool process_mapti(GICv3ITSState *s, uint64_t = value, uint32_t offset, =20 max_eventid =3D (1UL << (((dte >> 1U) & SIZE_MASK) + 1)); =20 - if (!ignore_pInt) { - max_Intid =3D (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; - } + max_Intid =3D (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; =20 if ((devid > s->dt.max_ids) || (icid > s->ct.max_ids) || !dte_valid || (eventid > max_eventid) || - (!ignore_pInt && (((pIntid < GICV3_LPI_INTID_START) || - (pIntid > max_Intid)) && (pIntid !=3D INTID_SPURIOUS)))) { + (((pIntid < GICV3_LPI_INTID_START) || (pIntid > max_Intid)) && + (pIntid !=3D INTID_SPURIOUS))) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes " "devid %d or icid %d or eventid %d or pIntid %d or" @@ -400,11 +400,7 @@ static bool process_mapti(GICv3ITSState *s, uint64_t v= alue, uint32_t offset, IteEntry ite =3D {}; ite.itel =3D FIELD_DP64(ite.itel, ITE_L, VALID, dte_valid); ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTTYPE, ITE_INTTYPE_PHYS= ICAL); - if (ignore_pInt) { - ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTID, eventid); - } else { - ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTID, pIntid); - } + ite.itel =3D FIELD_DP64(ite.itel, ITE_L, INTID, pIntid); ite.itel =3D FIELD_DP64(ite.itel, ITE_L, DOORBELL, INTID_SPURIOUS); ite.iteh =3D FIELD_DP32(ite.iteh, ITE_H, ICID, icid); =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576733; cv=none; d=zohomail.com; s=zohoarc; b=H9+77TfUyXuOXBa8wHnVosutMw39JzAuySrlvu0OLfj064cd/Ql/kpF/YIpxaQpS14cjwMZFuJdqrMi+wKX75v4bdywocJetaHJzRKNUs3JBbhto+rL6g4Y1D4N1kN89ruf91pBwrrIMujhfeWY6Y2r1zX8DBXF34b3aw01kTfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576733; 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=9ONi2g/IZ5sSRQKd44Qd5XV4aNl9CKkjHv/QJp0hkkE=; b=euldIQPPfYKMZX0yYkxn1/RqAWcUwOAc5tpRLD1SzP3g5Y+CFt/H1IgxTRZuOYNUh95PBzEWRx5n+58xIrmrubNT/u0Hqzy+PgQ8OFqVCmq4wlQTNx+dvgy5fJgPakX5NYtZHcG824EM5fSCeCeCqk9JZjsWwslS7FPSpMFFY0o= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576733274874.4093907849817; Fri, 7 Jan 2022 09:32:13 -0800 (PST) Received: from localhost ([::1]:60864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t63-0003DS-4T for importer@patchew.org; Fri, 07 Jan 2022 12:32:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw6-00057m-Bl for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:55 -0500 Received: from [2a00:1450:4864:20::433] (port=37726 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw4-0007u0-NS for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:54 -0500 Received: by mail-wr1-x433.google.com with SMTP id t28so5580218wrb.4 for ; Fri, 07 Jan 2022 09:21:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:50 -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=9ONi2g/IZ5sSRQKd44Qd5XV4aNl9CKkjHv/QJp0hkkE=; b=r+CklIvi3CtCtH+a6EUZPMUwmuBGTQMhvod/J3S2OyAj9qJ/pyMzwODKAZ5uxCSrJ4 0UFd3ZhXIGBg/NEauZv72HGb5B5YHjBfFrK+kfTjRv/5tWmHuA8oWTVHpIGEULqE0gPU IibU3VL14sbdgKtUM9suO0Lz5HLlhBqOR7csDmAfl7tEO9djKLLoYZHnT/KSWwvwuTpO Lc/6uJtEl1sO1AtlrzZq5Djq30i82stgCi7v2ToIB/g1DkNffd+XGlXNpB29hdYN9mzm 4H0+1uInlDzJfBsRd4OkwfcPVixaLnvCoGDjHunZ4qnxNA49Xe3h3cmQlcpgusHFGaQq WhBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9ONi2g/IZ5sSRQKd44Qd5XV4aNl9CKkjHv/QJp0hkkE=; b=yW1bWc+oPW6ndieohk0iadpwwrl7sF6r1dazw5ponCWO/A2qY24xcume/1rCKBwEhk vCQCvVdsnJV4LrfPo+lBZ6OHb+AyBwmB0a2hMcqdcdRlI1y/k7W9pIEmzQHuwCHBK02i SSSh0mruLOcwBf7+FuaBN0Bj8p+dvpkvNc/yCFZLt9JaeOirMzukTlUfAG+pxU0TSUWE Fkg2a6r+UO5YU6ux441IUPHx+uBQgDbTO1kVFM2z9z+CPrbejuhkcZ3ZOQxIj1vNsGuY NUrWVXXS5QmaclYYf/4o4fDwK5nmOO8PAhzk/NyRSldCbmlGn6SKVyURT4deYih620B/ chRg== X-Gm-Message-State: AOAM531xxzZz20HqNLg/idjWkV/vAqPhANKGwXnMknwnHSKcHNZD/Byr E3mTDk3EfeXfjuGoLlUCzJDcqnWIjq+HuQ== X-Google-Smtp-Source: ABdhPJzT7fRhonJLkTUvQMGmyv3rwEln6MXAXjsH/ip45CzNbJ8FIr7xaoilB7wbqQn1UixvzK8KLA== X-Received: by 2002:adf:f6ca:: with SMTP id y10mr3053828wrp.80.1641576110948; Fri, 07 Jan 2022 09:21:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/19] hw/intc/arm_gicv3_its: Use FIELD macros for DTEs Date: Fri, 7 Jan 2022 17:21:34 +0000 Message-Id: <20220107172142.2651911-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) 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::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576735314100001 Currently the ITS code that reads and writes DTEs uses open-coded shift-and-mask to assemble the various fields into the 64-bit DTE word. The names of the macros used for mask and shift values are also somewhat inconsistent, and don't follow our usual convention that a MASK macro should specify the bits in their place in the word. Replace all these with use of the FIELD macro. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/gicv3_internal.h | 7 ++++--- hw/intc/arm_gicv3_its.c | 20 +++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 5a63e9ed5ce..6a3b145f377 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -393,9 +393,10 @@ FIELD(ITE_H, VPEID, 16, 16) * Valid =3D 1 bit,ITTAddr =3D 44 bits,Size =3D 5 bits */ #define GITS_DTE_SIZE (0x8ULL) -#define GITS_DTE_ITTADDR_SHIFT 6 -#define GITS_DTE_ITTADDR_MASK MAKE_64BIT_MASK(GITS_DTE_ITTADDR_SHI= FT, \ - ITTADDR_LENGTH) + +FIELD(DTE, VALID, 0, 1) +FIELD(DTE, SIZE, 1, 5) +FIELD(DTE, ITTADDR, 6, 44) =20 /* * 8 bytes Collection Table Entry size diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 6f21c56fba2..7a217b00f89 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -114,7 +114,7 @@ static bool update_ite(GICv3ITSState *s, uint32_t event= id, uint64_t dte, uint64_t itt_addr; MemTxResult res =3D MEMTX_OK; =20 - itt_addr =3D (dte & GITS_DTE_ITTADDR_MASK) >> GITS_DTE_ITTADDR_SHIFT; + itt_addr =3D FIELD_EX64(dte, DTE, ITTADDR); itt_addr <<=3D ITTADDR_SHIFT; /* 256 byte aligned */ =20 address_space_stq_le(as, itt_addr + (eventid * (sizeof(uint64_t) + @@ -141,7 +141,7 @@ static bool get_ite(GICv3ITSState *s, uint32_t eventid,= uint64_t dte, bool status =3D false; IteEntry ite =3D {}; =20 - itt_addr =3D (dte & GITS_DTE_ITTADDR_MASK) >> GITS_DTE_ITTADDR_SHIFT; + itt_addr =3D FIELD_EX64(dte, DTE, ITTADDR); itt_addr <<=3D ITTADDR_SHIFT; /* 256 byte aligned */ =20 ite.itel =3D address_space_ldq_le(as, itt_addr + @@ -255,10 +255,10 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_= t value, uint32_t offset, if (res !=3D MEMTX_OK) { return result; } - dte_valid =3D dte & TABLE_ENTRY_VALID_MASK; + dte_valid =3D FIELD_EX64(dte, DTE, VALID); =20 if (dte_valid) { - max_eventid =3D (1UL << (((dte >> 1U) & SIZE_MASK) + 1)); + max_eventid =3D 1UL << (FIELD_EX64(dte, DTE, SIZE) + 1); =20 ite_valid =3D get_ite(s, eventid, dte, &icid, &pIntid, &res); =20 @@ -375,10 +375,8 @@ static bool process_mapti(GICv3ITSState *s, uint64_t v= alue, uint32_t offset, if (res !=3D MEMTX_OK) { return result; } - dte_valid =3D dte & TABLE_ENTRY_VALID_MASK; - - max_eventid =3D (1UL << (((dte >> 1U) & SIZE_MASK) + 1)); - + dte_valid =3D FIELD_EX64(dte, DTE, VALID); + max_eventid =3D 1UL << (FIELD_EX64(dte, DTE, SIZE) + 1); max_Intid =3D (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; =20 if ((devid > s->dt.max_ids) || (icid > s->ct.max_ids) @@ -529,9 +527,9 @@ static bool update_dte(GICv3ITSState *s, uint32_t devid= , bool valid, if (s->dt.valid) { if (valid) { /* add mapping entry to device table */ - dte =3D (valid & TABLE_ENTRY_VALID_MASK) | - ((size & SIZE_MASK) << 1U) | - (itt_addr << GITS_DTE_ITTADDR_SHIFT); + dte =3D FIELD_DP64(dte, DTE, VALID, 1); + dte =3D FIELD_DP64(dte, DTE, SIZE, size); + dte =3D FIELD_DP64(dte, DTE, ITTADDR, itt_addr); } } else { return true; --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576536; cv=none; d=zohomail.com; s=zohoarc; b=WpbZZ7PjhmPaVue1dlJSBfHhqRx4tBOZJ6CgglUwjFxIfTepGLqsgwRHP1g81ej+u8GFnQ46OZNIuz5/y1c4rMEffmEKipzsd1sN8+PFEXMyDns5Tg23Cxau6Uk8tF7PDlx00cE4b1O+H8hftDe0L5Vdwk9fNU9JiFfcm97LsjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576536; 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=u3ij0VU4vY4kMQen5OzCseC136vxmVv0PB7jvlGBDEY=; b=jiJxWkY0UfZMK7c6OMIBOmuFMBbqmGUYHOQQMS7z+EpnHMG9SGccx1OL6incxAB+SSvVk+cXmvGOvaXJrIAk6Hq1MxmNzilNjRFHkiMkfPGaW52r4rPHV917vCiYs29TyTtLuyVn9Si4FgpfGv5Cb9MQVrUZTm3NhaLgz5iP09I= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576536834245.81807261779215; Fri, 7 Jan 2022 09:28:56 -0800 (PST) Received: from localhost ([::1]:52202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t2t-0005fF-BY for importer@patchew.org; Fri, 07 Jan 2022 12:28:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5sw6-00057i-3b for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:55 -0500 Received: from [2a00:1450:4864:20::433] (port=43586 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw4-0007u5-NZ for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:53 -0500 Received: by mail-wr1-x433.google.com with SMTP id o3so12307160wrh.10 for ; Fri, 07 Jan 2022 09:21:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21: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=u3ij0VU4vY4kMQen5OzCseC136vxmVv0PB7jvlGBDEY=; b=oK292ymaBd424tZYEzCz6iSNOJBJD3gFM4YAWtuSWThPVDHhuSl8hUfZlgQjjEwD8f DVAAGGrF29cYzvunDAtPhXvWCW+Ph/xk60vTrAq+fo4B4jI2NYVbLz1T0IVfco7Ej6yv F0zxguK/koS9zeGsPh/NiVVXnXq12v9V78MPZS1+hzDWPuxWlAnfSOC+qJ9x2aCg9b6s UdMfgI2s3yf541nC/HhzrrdVBXnIIyGxT8gzMiqHUP4CUNHV/lkyASDXENlCW9ZQsX9Y 6Sdrb3GwrJepbo3AIEETmexjkMAbnghddNACsuFVvBnv+E+GGXq1qH9EP+FLp0J8kJo5 8tew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u3ij0VU4vY4kMQen5OzCseC136vxmVv0PB7jvlGBDEY=; b=peyqBw9OR4RDcihyWb7N6zcd8J7opLp265NLfJhX5XMTs4Uv3oi+Xtdz8xSJOHwxAw jNVOHNdUzk591lsmUXBGhcsdo8GGbEORIfmJMfM730Ay/yQ+VzXAKcjk2UUT/DQggD0s hA/UsynSWKU5DP3wEvb1wwCNQ/bYkwCBdnhEpg9rm0CqtUj223Eciyi5poWHMgAnffLD mWAbr+RgdhUm46aneTv+xaPaXSCgt3K7bY/jTh7PLE9oj4wLZOYjvHCcTy6q5e+nY2gX G4kmhfr5f53wQJvLVTsOwiQO/BlXj0uwvoqPCKKzLDDxDttqz88YRHySSWupaVvefwEU 6A/w== X-Gm-Message-State: AOAM531U1PGvG+sLK9Z91H1GC37laHSKcvDR3n/ZI5aEmhIbHs1Tk9Xz Ye0E9Y/CdU0kmmWEV9REYx49QIXxhVa5kA== X-Google-Smtp-Source: ABdhPJxPDLRdrcaW1ml9Gav9IZdWke+VPs/YQHn9CnQ6y7HbmGX1p3usQ4FCUikYNL8dJk73AlNUUg== X-Received: by 2002:adf:fb4f:: with SMTP id c15mr9727979wrs.509.1641576111408; Fri, 07 Jan 2022 09:21:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/19] hw/intc/arm_gicv3_its: Correct comment about CTE RDBase field size Date: Fri, 7 Jan 2022 17:21:35 +0000 Message-Id: <20220107172142.2651911-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) 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::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576538571100001 The comment says that in our CTE format the RDBase field is 36 bits; in fact for us it is only 16 bits, because we use the RDBase format where it specifies a 16-bit CPU number. The code already uses RDBASE_PROCNUM_LENGTH (16) as the field width, so fix the comment to match it. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/gicv3_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 6a3b145f377..14e8ef68e02 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -400,7 +400,7 @@ FIELD(DTE, ITTADDR, 6, 44) =20 /* * 8 bytes Collection Table Entry size - * Valid =3D 1 bit,RDBase =3D 36 bits(considering max RDBASE) + * Valid =3D 1 bit, RDBase =3D 16 bits */ #define GITS_CTE_SIZE (0x8ULL) #define GITS_CTE_RDBASE_PROCNUM_MASK MAKE_64BIT_MASK(1, RDBASE_PROCNUM_LE= NGTH) --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641577247; cv=none; d=zohomail.com; s=zohoarc; b=ZcknppwBF77gzn/eIyLCFEmqaHurF5Y6KO/RHkYsw49dbvEY7E/f5X73SRksGewFLlM8lYCetps8R/5V6/ci/1FhK/zJX9xAKhHBPDWU6jAUIYCemlRRQmcdyUX6AEmbuzSAac5Ou6Lay9Eu0gBLSxrqJJ3ezS/9rfxAqHuN1ZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641577247; 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=LupUZiFadISWRd6OfQvtso37hN2ZXDsa2I1Sv18LqPg=; b=LJbFlou9WEpxeaueZtGBvGJUm4XfRdGt3rzBPGzmUNsvmaDuIZPBXCCf9nusAOYSTEqP5AG5OySoXspbCMaoYCd00Af2lOn8fC1Eu910JsWDJLmbhbM2cFt0Jo7vS6uy7gdjuJJzUHE46ufucS3+gAAS1bxkJiQUX7JIEbTqgac= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641577247835573.684143782356; Fri, 7 Jan 2022 09:40:47 -0800 (PST) Received: from localhost ([::1]:55142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tEM-0002j2-S9 for importer@patchew.org; Fri, 07 Jan 2022 12:40:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swA-0005BM-1E for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:58 -0500 Received: from [2a00:1450:4864:20::435] (port=43588 helo=mail-wr1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw5-0007uC-47 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:57 -0500 Received: by mail-wr1-x435.google.com with SMTP id o3so12307210wrh.10 for ; Fri, 07 Jan 2022 09:21:52 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21: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=LupUZiFadISWRd6OfQvtso37hN2ZXDsa2I1Sv18LqPg=; b=Sn9XcJ3XNZA1IrsSZ4LTTd6YlPIrBFzTGmnhhAfDroP4MZsv0lmc4/Y8B6/q1hi1hV +iOBczyRBmR7bgPvFKT8LkN37ZWcFmfhEsDUM1DiIuWSI28rP6ER6BTreGOGDyPIqnnX MXhpfh/zZNkR6rczl31u0fMjQLj2E+2U+7PFQ1wQ/iEQoIi9wWV7clef1af/3Mp/y7+z 2GkPYB5/FIkAV+lkOkXomidIYt02IJVTDYFa/wOGV+JjQYNmCKz2/UTiijnDSHL+89a9 Q0cuYIDZiPwZAho/AsORzR/uQkEDHFV/EkyWER1DVkHZXTiA3Ensfp/KovwcmszSxr40 u5Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LupUZiFadISWRd6OfQvtso37hN2ZXDsa2I1Sv18LqPg=; b=Htr78c4RPyCzCQExDlPEB9Fgu0XNWhipbip2QfOG/LGB6FjXPK76U6MNfcq9LV+JCV itvBUXTW0qJ5QB7DQCpK2mRAV+kV9j6CZ3m3UB4nBWmK1/IT4GSKvY47cz3tO5kEg1/j FKKeEXXcWITG4n3oJLWX/ubV38q3WI8BrHBflnTpUlzAJFn/LXAlBqZPAG6EPcXITxGA hdhRVFbluvVLYqsEtZBcdubl80EN70CYCTO9jeNsJ6ZpL1hywXQURIQc+QQj6fZiqjnL 3K2tQHjVVFBjc46/UOd8+bti0LyhP5oKL/Aw/BvcbNdzA0k15AY/pG2M303LwRyt58gX Mmhw== X-Gm-Message-State: AOAM53269uS7807wFxODRcO0NFJDTT8Yhgce9hXm8t+9Bv+kz/2Qfyg1 a6ohV1A0dIAaQOIMHtPBivVZDTB3x2ek6A== X-Google-Smtp-Source: ABdhPJyEHrTvJeCr9kGzEYYjVA2Y4pEwPx5DFcPOjJRv6KzmTuubMj5UZIDlsTmmo+blD/YmydGULg== X-Received: by 2002:a05:6000:c:: with SMTP id h12mr8008573wrx.474.1641576111907; Fri, 07 Jan 2022 09:21:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/19] hw/intc/arm_gicv3_its: Use FIELD macros for CTEs Date: Fri, 7 Jan 2022 17:21:36 +0000 Message-Id: <20220107172142.2651911-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::435 (failed) 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::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641577249625100001 Use FIELD macros to handle CTEs, rather than ad-hoc mask-and-shift. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- hw/intc/gicv3_internal.h | 3 ++- hw/intc/arm_gicv3_its.c | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 14e8ef68e02..1eeb99035da 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -403,7 +403,8 @@ FIELD(DTE, ITTADDR, 6, 44) * Valid =3D 1 bit, RDBase =3D 16 bits */ #define GITS_CTE_SIZE (0x8ULL) -#define GITS_CTE_RDBASE_PROCNUM_MASK MAKE_64BIT_MASK(1, RDBASE_PROCNUM_LE= NGTH) +FIELD(CTE, VALID, 0, 1) +FIELD(CTE, RDBASE, 1, RDBASE_PROCNUM_LENGTH) =20 /* Special interrupt IDs */ #define INTID_SECURE 1020 diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 7a217b00f89..2949157df34 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -104,7 +104,7 @@ static bool get_cte(GICv3ITSState *s, uint16_t icid, ui= nt64_t *cte, MEMTXATTRS_UNSPECIFIED, res); } =20 - return (*cte & TABLE_ENTRY_VALID_MASK) !=3D 0; + return FIELD_EX64(*cte, CTE, VALID); } =20 static bool update_ite(GICv3ITSState *s, uint32_t eventid, uint64_t dte, @@ -308,7 +308,7 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t = value, uint32_t offset, * Current implementation only supports rdbase =3D=3D procnum * Hence rdbase physical address is ignored */ - rdbase =3D (cte & GITS_CTE_RDBASE_PROCNUM_MASK) >> 1U; + rdbase =3D FIELD_EX64(cte, CTE, RDBASE); =20 if (rdbase >=3D s->gicv3->num_cpu) { return result; @@ -426,7 +426,8 @@ static bool update_cte(GICv3ITSState *s, uint16_t icid,= bool valid, =20 if (valid) { /* add mapping entry to collection table */ - cte =3D (valid & TABLE_ENTRY_VALID_MASK) | (rdbase << 1ULL); + cte =3D FIELD_DP64(cte, CTE, VALID, 1); + cte =3D FIELD_DP64(cte, CTE, RDBASE, rdbase); } =20 /* --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576981; cv=none; d=zohomail.com; s=zohoarc; b=QMLzyl7n0Rca3pfPgVHUNETeMYzn+OrQqSRkJK0Bz8CqHdID0z0RMIBIpXolDFJFdbeG5+uW+XYIw66nH80e/MEtuH0uo1lsY8x1MRivjsV5YguyheJ4j1qhNl0EKS6WXIoODSCA1Dt9bxlN+SA10y6fqvByGyB4+NIsXDkiAiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576981; 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=IOcivYbyX4NfWdoqeMZpWI7m9+0DcpfUF9sALZg+RZI=; b=Xd9amtTP+GXgDFqvuRegWpCU6MhzOby7VpEP4NfwvxI1BP1IXAfURwNJ1tdjHR9ss1m19ujPEQDzK6L/F3glJJ3gdAObD/vez3iHDe8Rq1gfhK9ibzn0/WJ4KitmGYDMTpQ29e0HstRPb67vSALPbcCWp4ACZpkveMvy7rbH3kI= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576981381283.62577219817376; Fri, 7 Jan 2022 09:36:21 -0800 (PST) Received: from localhost ([::1]:42820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tA4-0002P6-9h for importer@patchew.org; Fri, 07 Jan 2022 12:36:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swA-0005Bg-56 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:58 -0500 Received: from [2a00:1450:4864:20::32f] (port=37601 helo=mail-wm1-x32f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw5-0007uN-OW for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:57 -0500 Received: by mail-wm1-x32f.google.com with SMTP id l12-20020a7bc34c000000b003467c58cbdfso5371799wmj.2 for ; Fri, 07 Jan 2022 09:21:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:52 -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=IOcivYbyX4NfWdoqeMZpWI7m9+0DcpfUF9sALZg+RZI=; b=byiu143i/mTE9fe+mDcP/cic0iI3cFVfqJxRgKEJA0n/K6MDOCTFcCMksPZZy1wxHM 8BUgGRE4sy3McNjLPKNJj8uhToq+cioD+ltCj31PLRoCRH8FJZ07aAHQ74DNgg4tJbBC T8tCZZ9RVNAOr2+GcG/MsBMrswReeZk6CuM1yCi0L+nngcgJn4aAMYEPaPgdmNYfIk3o LbPNOYGbE/uRz1KFm43urFArU4ptDHxVOaX+fjWpp7+jA+byUb5iN/czyy/W98YQ0Pso S+g+ImVah5nbzUjso7Ru6gD14mzv3U1aPAtWcWb5w74cK/9az6eBZOZFi9CNJ32+RxaV ls/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IOcivYbyX4NfWdoqeMZpWI7m9+0DcpfUF9sALZg+RZI=; b=Qg2SPM7DTdduNsW5Hdi8ifDyYJZ83ynDe9eucue1IAY5V0CLFd6+sYTZ4WpKN10us4 fO1bjeyqzaBztkfIHwVKsrIvh6nlfgCqgLUAWyZLsaYg3NT7oAvgYA/0cUmRWHzmM6cP dz9yDQmnCZcl0sfqTdwsZu2bTc0AfjeE4mUDCx1ydqp2YgynIpBQSZTFtcTeojcIuAR5 xHDK4lGPPb8RHbojv5ZcBKjftDiPrl1Waba+MCBzT0QplvlMXIz4bZo0THK8SMSw5+Nb CZ10uHnvdwt3+TunI0oemNzahky5Zm4bIi6ifpZMWAjQKwi3qKTjyda7Uq9vJmUvNPXl uutA== X-Gm-Message-State: AOAM530plamfhdVT5Mg0W9fsqVRvaqx6hzpSkoA6ErPaexN0Xh0PLcW3 FjQrzyQBYJgE7bofVUTf1LodTx6PkzocUg== X-Google-Smtp-Source: ABdhPJx5ykrpF/zkTA6Xapy/j6tM29vnX4h46qUvCF1bsSAaeZnipqMafdzhF3fx9pZrCnQ9ctZ1Dg== X-Received: by 2002:a7b:c763:: with SMTP id x3mr6593624wmk.49.1641576112556; Fri, 07 Jan 2022 09:21:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/19] hw/intc/arm_gicv3_its: Fix various off-by-one errors Date: Fri, 7 Jan 2022 17:21:37 +0000 Message-Id: <20220107172142.2651911-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32f (failed) 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::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576983538100001 The ITS code has to check whether various parameters passed in commands are in-bounds, where the limit is defined in terms of the number of bits that are available for the parameter. (For example, the GITS_TYPER.Devbits ID register field specifies the number of DeviceID bits minus 1, and device IDs passed in the MAPTI and MAPD command packets must fit in that many bits.) Currently we have off-by-one bugs in many of these bounds checks. The typical problem is that we define a max_foo as 1 << n. In the Devbits example, we set s->dt.max_ids =3D 1UL << (GITS_TYPER.Devbits + 1). However later when we do the bounds check we write if (devid > s->dt.max_ids) { /* command error */ } which incorrectly permits a devid of 1 << n. These bugs will not cause QEMU crashes because the ID values being checked are only used for accesses into tables held in guest memory which we access with address_space_*() functions, but they are incorrect behaviour of our emulation. Fix them by standardizing on this pattern: * bounds limits are named num_foos and are the 2^n value (equal to the number of valid foo values) * bounds checks are either if (fooid < num_foos) { good } or if (fooid >=3D num_foos) { bad } In this commit we fix the handling of the number of IDs in the device table and the collection table, and the number of commands that will fit in the command queue. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e --- include/hw/intc/arm_gicv3_its_common.h | 6 +++--- hw/intc/arm_gicv3_its.c | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_g= icv3_its_common.h index 85a144b0e49..b32c697207f 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -46,14 +46,14 @@ typedef struct { bool indirect; uint16_t entry_sz; uint32_t page_sz; - uint32_t max_entries; - uint32_t max_ids; + uint32_t num_entries; + uint32_t num_ids; uint64_t base_addr; } TableDesc; =20 typedef struct { bool valid; - uint32_t max_entries; + uint32_t num_entries; uint64_t base_addr; } CmdQDesc; =20 diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 2949157df34..95c1914eb32 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -286,10 +286,10 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_= t value, uint32_t offset, * In this implementation, in case of guest errors we ignore the * command and move onto the next command in the queue. */ - if (devid > s->dt.max_ids) { + if (devid >=3D s->dt.num_ids) { qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: devid %d>%d", - __func__, devid, s->dt.max_ids); + "%s: invalid command attributes: devid %d>=3D%d", + __func__, devid, s->dt.num_ids); =20 } else if (!dte_valid || !ite_valid || !cte_valid) { qemu_log_mask(LOG_GUEST_ERROR, @@ -379,7 +379,7 @@ static bool process_mapti(GICv3ITSState *s, uint64_t va= lue, uint32_t offset, max_eventid =3D 1UL << (FIELD_EX64(dte, DTE, SIZE) + 1); max_Intid =3D (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; =20 - if ((devid > s->dt.max_ids) || (icid > s->ct.max_ids) + if ((devid >=3D s->dt.num_ids) || (icid >=3D s->ct.num_ids) || !dte_valid || (eventid > max_eventid) || (((pIntid < GICV3_LPI_INTID_START) || (pIntid > max_Intid)) && (pIntid !=3D INTID_SPURIOUS))) { @@ -497,7 +497,7 @@ static bool process_mapc(GICv3ITSState *s, uint32_t off= set) =20 valid =3D (value & CMD_FIELD_VALID_MASK); =20 - if ((icid > s->ct.max_ids) || (rdbase >=3D s->gicv3->num_cpu)) { + if ((icid >=3D s->ct.num_ids) || (rdbase >=3D s->gicv3->num_cpu)) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPC: invalid collection table attributes " "icid %d rdbase %" PRIu64 "\n", icid, rdbase); @@ -610,7 +610,7 @@ static bool process_mapd(GICv3ITSState *s, uint64_t val= ue, uint32_t offset) =20 valid =3D (value & CMD_FIELD_VALID_MASK); =20 - if ((devid > s->dt.max_ids) || + if ((devid >=3D s->dt.num_ids) || (size > FIELD_EX64(s->typer, GITS_TYPER, IDBITS))) { qemu_log_mask(LOG_GUEST_ERROR, "ITS MAPD: invalid device table attributes " @@ -649,7 +649,7 @@ static void process_cmdq(GICv3ITSState *s) =20 wr_offset =3D FIELD_EX64(s->cwriter, GITS_CWRITER, OFFSET); =20 - if (wr_offset > s->cq.max_entries) { + if (wr_offset >=3D s->cq.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid write offset " "%d\n", __func__, wr_offset); @@ -658,7 +658,7 @@ static void process_cmdq(GICv3ITSState *s) =20 rd_offset =3D FIELD_EX64(s->creadr, GITS_CREADR, OFFSET); =20 - if (rd_offset > s->cq.max_entries) { + if (rd_offset >=3D s->cq.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid read offset " "%d\n", __func__, rd_offset); @@ -721,7 +721,7 @@ static void process_cmdq(GICv3ITSState *s) } if (result) { rd_offset++; - rd_offset %=3D s->cq.max_entries; + rd_offset %=3D s->cq.num_entries; s->creadr =3D FIELD_DP64(s->creadr, GITS_CREADR, OFFSET, rd_of= fset); } else { /* @@ -824,13 +824,13 @@ static void extract_table_params(GICv3ITSState *s) td->entry_sz =3D FIELD_EX64(value, GITS_BASER, ENTRYSIZE) + 1; td->base_addr =3D baser_base_addr(value, page_sz); if (!td->indirect) { - td->max_entries =3D (num_pages * page_sz) / td->entry_sz; + td->num_entries =3D (num_pages * page_sz) / td->entry_sz; } else { - td->max_entries =3D (((num_pages * page_sz) / + td->num_entries =3D (((num_pages * page_sz) / L1TABLE_ENTRY_SIZE) * (page_sz / td->entry_sz)); } - td->max_ids =3D 1ULL << idbits; + td->num_ids =3D 1ULL << idbits; } } =20 @@ -845,7 +845,7 @@ static void extract_cmdq_params(GICv3ITSState *s) s->cq.valid =3D FIELD_EX64(value, GITS_CBASER, VALID); =20 if (s->cq.valid) { - s->cq.max_entries =3D (num_pages * GITS_PAGE_SIZE_4K) / + s->cq.num_entries =3D (num_pages * GITS_PAGE_SIZE_4K) / GITS_CMDQ_ENTRY_SIZE; s->cq.base_addr =3D FIELD_EX64(value, GITS_CBASER, PHYADDR); s->cq.base_addr <<=3D R_GITS_CBASER_PHYADDR_SHIFT; --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641577110; cv=none; d=zohomail.com; s=zohoarc; b=e3UJqYTpMNgyYZia0OcYG00XynQMaMzw0ynGLho3wyg1eKk/rtGmPLGBzChFCAmL32MFNdZUpU9hG1df5MzHgGF8+jg246W6CYJ9ZM50AhLpFOY8XycEsxJJcntdttDgRwF/+GDdid+3FqW9+rslNcgmA6SdmEnXHKZa7Xi0XkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641577110; 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=nrjSzW77KGQ8JhRHJTSWpfcO9Xr9m/zITVHl0Oc0V5I=; b=Q3uV4FdHQatjIam4tR+f4ffjQDSUJPHevOmJ41b/ExuMyRychqldxwdnwGQDoUSODVzbHxHMNhB9aUpRfY+qj9/ykXoRABsWpMTezLxO7ME/hAm5QD1/v6UyFOGSxPCC+DxpqQ/offfH4E5rBlXHvXo9ZSvOEL41d9whdWXmH/c= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641577110920533.291998871984; Fri, 7 Jan 2022 09:38:30 -0800 (PST) Received: from localhost ([::1]:49288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tC9-0007Bz-VH for importer@patchew.org; Fri, 07 Jan 2022 12:38:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swB-0005HV-Iy for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:59 -0500 Received: from [2a00:1450:4864:20::42d] (port=40680 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw9-0007uT-ND for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:59 -0500 Received: by mail-wr1-x42d.google.com with SMTP id l10so12335014wrh.7 for ; Fri, 07 Jan 2022 09:21:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:52 -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=nrjSzW77KGQ8JhRHJTSWpfcO9Xr9m/zITVHl0Oc0V5I=; b=BecUOnAqsUNC528QW/iQNED+TRROnLy10QPtXJLBhbSHF/ac6QyEWB/sxBIsQ7uMrR wS5D54qSt820ldKspItY4dhsrISd4P4NgaawM15LJrTetELzsM9I6psZcAuapAjBsK8F CbG6HmkgYA2N1Sa2mGg2meK3LL7Fj5IuyvAEzO38T4zS+LA3k2Mt+Fp+q3YaFu0N5YIy 3XkrRFKQNqGUmej0z3xmlqizhzh5AqPa7bYNk7JYn8/oeztuNoeG56pYmezOKEG4w9a5 NemNb4dBhHbd2iwCHj+SdB31MkEn5APOB62lELYHk9SUXdva0f5fbANLKz89C+FViw/W md+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nrjSzW77KGQ8JhRHJTSWpfcO9Xr9m/zITVHl0Oc0V5I=; b=5bWnCR2JajseX0zJXfhXbqyDe33kkBd8Izfy8mTPb/d9bwF/7PkcJ+DFE680z+zgna NXPSU4lbfAOajbk9HoZrZ3TL8f7GAFOBB0kmpY+BwqgjAK52Fcmjj6WooO9kFuspb2q1 1eE0lCjeM29U2quFN2RBCMpkeMiTNzPtSwF4DchQgOikxRdXu07R8/BTe1FgyT5ESuSw mYKMHcSE7hxBnZ6uftku3h/V8MoB2h/ZqlKZ3JP2kXSGoDMlh1UIxcVblmmMWpwn8iff H0EGPZBCAOqSTH8sjzt85x51pHDnRiZPlR1cPxxHa1kIY7uADF9e2u4m0yhhM7/U0fJy DWUQ== X-Gm-Message-State: AOAM531T0g/T62UbSY7ysXvWYJ+OikozOLKZEkdaEFIFxBTvM/FniHVB ycOsikdmxdcdRa6AKT8kd+h2UQa1yTGpTw== X-Google-Smtp-Source: ABdhPJxneAcoalAqghrdeQmrESz8vqah0JQ3iW6UCDHLngpwY7zwEuc9J0NhRY2ehPoIeU7D/h3dVw== X-Received: by 2002:adf:d0d0:: with SMTP id z16mr8645828wrh.417.1641576113075; Fri, 07 Jan 2022 09:21:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/19] hw/intc/arm_gicv3_its: Rename max_l2_entries to num_l2_entries Date: Fri, 7 Jan 2022 17:21:38 +0000 Message-Id: <20220107172142.2651911-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) 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::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641577112469100001 In several places we have a local variable max_l2_entries which is the number of entries which will fit in a level 2 table. The calculations done on this value are correct; rename it to num_l2_entries to fit the convention we're using in this code. Signed-off-by: Peter Maydell Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/arm_gicv3_its.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 95c1914eb32..fa3cdb57554 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -74,7 +74,7 @@ static bool get_cte(GICv3ITSState *s, uint16_t icid, uint= 64_t *cte, uint64_t value; bool valid_l2t; uint32_t l2t_id; - uint32_t max_l2_entries; + uint32_t num_l2_entries; =20 if (s->ct.indirect) { l2t_id =3D icid / (s->ct.page_sz / L1TABLE_ENTRY_SIZE); @@ -88,12 +88,12 @@ static bool get_cte(GICv3ITSState *s, uint16_t icid, ui= nt64_t *cte, valid_l2t =3D (value & L2_TABLE_VALID_MASK) !=3D 0; =20 if (valid_l2t) { - max_l2_entries =3D s->ct.page_sz / s->ct.entry_sz; + num_l2_entries =3D s->ct.page_sz / s->ct.entry_sz; =20 l2t_addr =3D value & ((1ULL << 51) - 1); =20 *cte =3D address_space_ldq_le(as, l2t_addr + - ((icid % max_l2_entries) * GITS_CTE_SI= ZE), + ((icid % num_l2_entries) * GITS_CTE_SI= ZE), MEMTXATTRS_UNSPECIFIED, res); } } @@ -176,7 +176,7 @@ static uint64_t get_dte(GICv3ITSState *s, uint32_t devi= d, MemTxResult *res) uint64_t value; bool valid_l2t; uint32_t l2t_id; - uint32_t max_l2_entries; + uint32_t num_l2_entries; =20 if (s->dt.indirect) { l2t_id =3D devid / (s->dt.page_sz / L1TABLE_ENTRY_SIZE); @@ -190,12 +190,12 @@ static uint64_t get_dte(GICv3ITSState *s, uint32_t de= vid, MemTxResult *res) valid_l2t =3D (value & L2_TABLE_VALID_MASK) !=3D 0; =20 if (valid_l2t) { - max_l2_entries =3D s->dt.page_sz / s->dt.entry_sz; + num_l2_entries =3D s->dt.page_sz / s->dt.entry_sz; =20 l2t_addr =3D value & ((1ULL << 51) - 1); =20 value =3D address_space_ldq_le(as, l2t_addr + - ((devid % max_l2_entries) * GITS_DTE_SI= ZE), + ((devid % num_l2_entries) * GITS_DTE_SI= ZE), MEMTXATTRS_UNSPECIFIED, res); } } @@ -416,7 +416,7 @@ static bool update_cte(GICv3ITSState *s, uint16_t icid,= bool valid, uint64_t l2t_addr; bool valid_l2t; uint32_t l2t_id; - uint32_t max_l2_entries; + uint32_t num_l2_entries; uint64_t cte =3D 0; MemTxResult res =3D MEMTX_OK; =20 @@ -450,12 +450,12 @@ static bool update_cte(GICv3ITSState *s, uint16_t ici= d, bool valid, valid_l2t =3D (value & L2_TABLE_VALID_MASK) !=3D 0; =20 if (valid_l2t) { - max_l2_entries =3D s->ct.page_sz / s->ct.entry_sz; + num_l2_entries =3D s->ct.page_sz / s->ct.entry_sz; =20 l2t_addr =3D value & ((1ULL << 51) - 1); =20 address_space_stq_le(as, l2t_addr + - ((icid % max_l2_entries) * GITS_CTE_SIZE), + ((icid % num_l2_entries) * GITS_CTE_SIZE), cte, MEMTXATTRS_UNSPECIFIED, &res); } } else { @@ -521,7 +521,7 @@ static bool update_dte(GICv3ITSState *s, uint32_t devid= , bool valid, uint64_t l2t_addr; bool valid_l2t; uint32_t l2t_id; - uint32_t max_l2_entries; + uint32_t num_l2_entries; uint64_t dte =3D 0; MemTxResult res =3D MEMTX_OK; =20 @@ -556,12 +556,12 @@ static bool update_dte(GICv3ITSState *s, uint32_t dev= id, bool valid, valid_l2t =3D (value & L2_TABLE_VALID_MASK) !=3D 0; =20 if (valid_l2t) { - max_l2_entries =3D s->dt.page_sz / s->dt.entry_sz; + num_l2_entries =3D s->dt.page_sz / s->dt.entry_sz; =20 l2t_addr =3D value & ((1ULL << 51) - 1); =20 address_space_stq_le(as, l2t_addr + - ((devid % max_l2_entries) * GITS_DTE_SIZE= ), + ((devid % num_l2_entries) * GITS_DTE_SIZE= ), dte, MEMTXATTRS_UNSPECIFIED, &res); } } else { --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576800; cv=none; d=zohomail.com; s=zohoarc; b=FJHUYuKNxEfsbA2fJvc0evo8/pdcQuEW6t79spKhGotVGFneHNKRSdR4/Ba/X4vT+MnnJCwachnW82D2kjU4uIgaFncdVauYSai/xLoFoLUvRfGamr7vsp7mDatN1q55zGUWqXKUw3T8rk3AYytJ2ziWMELqw7fMXrg8TTCO/j0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576800; 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=z4EUXGhIseTY6ZgauG9XLglUz/cBDaX/t9IzarQCkyE=; b=TwcDGOZhB65kIB1/B/FZlPz22Z19P4JEHj61CW8tA1kABEEKKcApfBKqE8iqetJAx91WcSk+qOz1iLdSnpPS3XXc0H/wNHsMaqjE9Y/MjcDDKzLMcjceqCiQMppgCZJFoRVUlS5wTxAPYlzQt3ETq8PIigay0sEfTS8bzhuviP8= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576800495211.22176561160052; Fri, 7 Jan 2022 09:33:20 -0800 (PST) Received: from localhost ([::1]:35440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t79-0005MN-HJ for importer@patchew.org; Fri, 07 Jan 2022 12:33:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swC-0005MC-Nd for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:00 -0500 Received: from [2a00:1450:4864:20::335] (port=43594 helo=mail-wm1-x335.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw9-0007ub-PA for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:00 -0500 Received: by mail-wm1-x335.google.com with SMTP id o203-20020a1ca5d4000000b003477d032384so1671589wme.2 for ; Fri, 07 Jan 2022 09:21:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21: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=z4EUXGhIseTY6ZgauG9XLglUz/cBDaX/t9IzarQCkyE=; b=mQK5PxvgzauSEyZF2joa7cQ5TqQeE2Jh1MX4YE4lST/5YwFmfYLtn8dEjMYKQ972K6 PbffKal0HQb5rl5mRItjH02ipiEpyw63SY/JiQ8ykcjsIgm1ynfZDJxqhACV1tKM1+t6 V4F7aw1uGkjVVlKtf3UjGammPj3sF99bOh4nzbr2c3oXZuljwlrqqXrlD/bovCjca6wi a9QvEZLTtWW482GqWds6cQk/yRzQIZadtMt/u98Asx1nJMuloaJvLVtdONID4LwKkxQD 0Hl7miMCU8dd2+7N20yU2fXf8KPgYbrQ3lslnmBL0KTcUMsHogIcG4L5/W9xlx7YEL4A JfRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z4EUXGhIseTY6ZgauG9XLglUz/cBDaX/t9IzarQCkyE=; b=q9/GsdXuAhi3vwCY5SEmCh9BXMJqOJK54tRhCKLEvBLq+gI8ky80Javk525WIRJg0k TjGq9tr1ejP9vS5s2TWOGJUgqqf6jbkKKjWRQB4tS6k4V65XZcteiNkCymTQvlaBXiZY kli1Ta8eqB3EuJqbUrphODEPie40wotlEUPaWapTYhQsPUz6KrOAqJJmwhYPJKiQy9UR l3UUAOqyMxwd3MJz8IOMCnLce02Z9BZjd7QQQ1PWXoinzfG5inFGcQnniX/sidYKUGRD fekwwABI1Dbd0+WNGVTyQ3GhZIfLz+Pu4PTecrQ12nKiuM8zWRIGCDcKWNSV6VeBffzI EJRw== X-Gm-Message-State: AOAM532Ioa7z9q8BoPAWyuSfh0dvfsNrIHneAYvutGdPZEYi5k0I/wBJ nQIJxDuu2NWykn1NhcFP+OH5rXepc3ap4A== X-Google-Smtp-Source: ABdhPJwD6aOFCOHLbWghUOEn7lGebHmn3x0MNcfXhawgf8anvCiU/ZNqSBB1AVsUlwlOylwhk/+43A== X-Received: by 2002:a05:600c:2245:: with SMTP id a5mr8222540wmm.47.1641576113622; Fri, 07 Jan 2022 09:21:53 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/19] hw/arm: Add kudo i2c eeproms. Date: Fri, 7 Jan 2022 17:21:39 +0000 Message-Id: <20220107172142.2651911-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::335 (failed) 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::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576801993100001 From: Chris Rauer Signed-off-by: Chris Rauer Reviewed-by: Hao Wu Reviewed-by: Patrick Venture Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220102215844.2888833-2-venture@google.com Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 0866d2f4f05..37de9fef434 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -328,6 +328,13 @@ static void quanta_gbs_i2c_init(NPCM7xxState *soc) */ } =20 +static void kudo_bmc_i2c_init(NPCM7xxState *soc) +{ + at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */ + at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */ + /* TODO: Add remaining i2c devices. */ +} + static void npcm750_evb_init(MachineState *machine) { NPCM7xxState *soc; @@ -391,6 +398,7 @@ static void kudo_bmc_init(MachineState *machine) npcm7xx_connect_flash(&soc->fiu[1], 0, "mx66u51235f", drive_get(IF_MTD, 3, 0)); =20 + kudo_bmc_i2c_init(soc); npcm7xx_load_kernel(machine, soc); } =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641577250; cv=none; d=zohomail.com; s=zohoarc; b=SaCs8L/e6R4AenGzepIgRXDi/axFz/MuRm2LY6PaINGxBl+oSZa19o01yhn6mU4kc3SSupa8swDn9CntosiA4vrjz2T8fYDMo9KBIViSPS2oHy88JSnFiq1gAS6CBaDzjvbqdgCrvPB1qqdV8xj1re7OmfNxIF45OEZjam1C7V4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641577250; h=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=1MGFxE2DadJZLuKhTnRZO3dY+yqs9rmzcKNVV40KfbM=; b=ePxUkMwi1DlEnwAtqzv16jSE5s0atHsMPlMAwYs9ypmCV71ejhle63P6LCYYAJ4vbRtaRpDG51FWXmzlTI/uvD1dJ1icz9iDrrwHygARniHltz9o3aq0W1fdPwyvWdqSdfHaRFDspv2N5/OoGcaeTRnYhp4qlCj0fRu7o0C0OMQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16415772508861006.6832476249923; Fri, 7 Jan 2022 09:40:50 -0800 (PST) Received: from localhost ([::1]:55298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tEP-0002qb-SJ for importer@patchew.org; Fri, 07 Jan 2022 12:40:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swD-0005LZ-Fr for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:01 -0500 Received: from [2a00:1450:4864:20::336] (port=50801 helo=mail-wm1-x336.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw9-0007uq-PV for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:00 -0500 Received: by mail-wm1-x336.google.com with SMTP id m20so4430838wmi.0 for ; Fri, 07 Jan 2022 09:21:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21: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=1MGFxE2DadJZLuKhTnRZO3dY+yqs9rmzcKNVV40KfbM=; b=pwdNjtqdoLBURz0NsNRg9v2WcOuwldy79D22dT3T6OzgpeXmF1E2QObvV3xRrVzQBy 7mlndkzl8AWZmhaNV3mg3JHj4y5eZhepoETwfO2K5BiAGBa+tE6AtiU4XI6mrb2kNuhH dpOb8UdkLOrCFCTrZv04dsFylN9evNqI2rN8lstHbXJWm7V9fMUG/O9rD46BK9HC7TpQ hW3eLCt0MkDCebo2yEjqrsUNh6pX+cJnH6ALzDt3kH/hyeEIW9tr9Oa7KiAhoUabiR2S LgUBEqCl44TxS5aWvSeN6Solb0Aa1pZwjH5CI9vxVJuLKa+B1PtOzB4igaqjRO89nBf5 LKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1MGFxE2DadJZLuKhTnRZO3dY+yqs9rmzcKNVV40KfbM=; b=TmDu8numIlLxdmSxbt6JP1lbGoevsFzsukE4Zpe/1I1c9p87pJgoWF1dFnAn+HD5P2 ToHyry105ZDfMR6nC73RnHVlOQAnqWw10gFV0UQDueTR+lkhwPCXfJmwzFhKgfpy5YV1 S6jjmOy1FQbLOmdZ8HvfQMVYGzk3yl2bVfuE30Ow4x+YdT3TdagcJ1dRxmr7c+dK+MuH mNLdyfc3q38qAmPJpru31TsrcC8cRFtTtm5SUMW4p+ayftDnDAAb4Qoc2PxeweSkSHZ3 nLXOyS/qjc6r3bnob3fv/YzJbiEaTnNjsuyPjGuVuwEB5gJYMCbCJQo3cB2OZNPvs0BR ALaw== X-Gm-Message-State: AOAM5312PiJrEZ7vzygnpfo+9s+IThMMe//QXNeNt7IoXjpfrUnO7q7s hwNt8GrE4pLLzB9UgwSWO2bIUnrRkcTbfQ== X-Google-Smtp-Source: ABdhPJyFLB33iVUna9y5oN1FPHBkhiAwrIrkQtOOaMLAbtd5ZwmYKBVudwcMMv7CfdkjIHGAXc4HvA== X-Received: by 2002:a05:600c:1990:: with SMTP id t16mr11797899wmq.87.1641576114085; Fri, 07 Jan 2022 09:21:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/19] hw/arm: attach MMC to kudo-bmc Date: Fri, 7 Jan 2022 17:21:40 +0000 Message-Id: <20220107172142.2651911-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::336 (failed) 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::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641577251627100003 Content-Type: text/plain; charset="utf-8" From: Shengtan Mao Signed-off-by: Shengtan Mao Reviewed-by: Hao Wu Reviewed-by: Chris Rauer Message-id: 20220102215844.2888833-3-venture@google.com Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 37de9fef434..257bf638fd5 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -399,6 +399,7 @@ static void kudo_bmc_init(MachineState *machine) drive_get(IF_MTD, 3, 0)); =20 kudo_bmc_i2c_init(soc); + sdhci_attach_drive(&soc->mmc.sdhci, 0); npcm7xx_load_kernel(machine, soc); } =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641576540; cv=none; d=zohomail.com; s=zohoarc; b=mYTWdzLlYvF+WPQkeMRaGDgYGlG+gnAm9/Vs4JF+zRiV+yCrUF/APLtWgGAtJUWbiDwKpQ/ncIvtv9eXmGu3s/QZ1lxzjPhLzP1nBOjISKN6lyu82sUnIkozBFGOL+8avyPGWBVMTD7PIPYCvh9ApTxGRs2FPcRpwX/JPlqCFH0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641576540; 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=DrLtR+BUheQSY3OxzKhmjxErO+2Tcnsj0fXYlPgSiDU=; b=LM4dAjuGvugNoESQCozwdUzuLA+1Dtll1+rWnqfrwm6WKFYQ2Z2FUvX/jJNAdhaC2pnxkne6AC3D2RCLwDd1nPvFzuzmemzpfOBksEU+dnB4EGvi0R3yNEoIGGOMDMrrmQ3xXqMw9RrbHF5cSSJ/sHsXDNyUu25ypzPvNZ2Hpxw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641576540358513.7573541066084; Fri, 7 Jan 2022 09:29:00 -0800 (PST) Received: from localhost ([::1]:52198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5t2x-0005fA-EH for importer@patchew.org; Fri, 07 Jan 2022 12:28:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swB-0005G7-8T for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:59 -0500 Received: from [2a00:1450:4864:20::434] (port=44964 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw9-0007v8-NP for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:21:58 -0500 Received: by mail-wr1-x434.google.com with SMTP id k18so12290810wrg.11 for ; Fri, 07 Jan 2022 09:21:55 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:54 -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=DrLtR+BUheQSY3OxzKhmjxErO+2Tcnsj0fXYlPgSiDU=; b=yN2kdQXyuG0WIZD4cwUtfPTpvxpQOtVC78CrjkUW3nFoIvB642QTzV8tRVS/1K0HNT hYYtMPXOxdaFW71vc4grbHy+TGeOFTNNUEec4b1vW82WlsflU4SS6ygwKS1O4gLFW7ja NvNlngij6SGdsXkaJzvqdCteNP84V8apYd1eYQrfZhuLxvq98cSKORQrO0Ejc2aaMO9j f02h9BrlbxukfN7L7rYeU89Rr/BGpOOX9TmbgGbn93ZWL6M63LI/iIySjn1fOeiHNtQx 6frsEwNeXN25spIi2tClJLsbiAjXPb5YqigVHzIGTjq8dG1bQAHai3fHV0KYNeSP2gJV wQ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DrLtR+BUheQSY3OxzKhmjxErO+2Tcnsj0fXYlPgSiDU=; b=vAd//jFMdY+F05a3GMwSmWI6IJbwncBzw6tl3s2DMsJlnwlU1VNogAUc8RUxxOvcnK BSKJLxjNMPCKKtHDQVTfRxYmuKoq8NmLBIykaFmEuE57fa+P7nr++Dm/QYTBYPgS+BGr LqlKyEZ+S/RNHzIK+v4xE/E0W9aNgJzfHsT0GagyxLKJs/svuU0SCrGRVdljaHr2i77a TDc/scXrVwoAhunJZJdftyDvllehTcXCK+KA0DFOvMzSpoTh7KDoSGv8zt2YFVgump9F eK9WP72Wj2WwE4l72wEsPb9/9Ut+fJoLzmHh0gPUVBO6ciRPyMhJSiwgQTUAu8qacwgS 5kDw== X-Gm-Message-State: AOAM532ddN2N8L8t2URiL1CE1eCWiXtF3EgOuJta/1bfHWIaJKVXmy+n 8ykyNNhi1+OzgLSKek/ZQK+NHnr0idAGIw== X-Google-Smtp-Source: ABdhPJwLWJ/OS43rfueG4yXXBfRaxJlB32NMPTZtZgZmLyezytzBu2FyEf288u19QQCNEi9fkiiqyg== X-Received: by 2002:a5d:64ad:: with SMTP id m13mr56225026wrp.714.1641576114642; Fri, 07 Jan 2022 09:21:54 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/19] hw/arm: add i2c muxes to kudo-bmc Date: Fri, 7 Jan 2022 17:21:41 +0000 Message-Id: <20220107172142.2651911-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) 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::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641576542530100001 From: Patrick Venture Signed-off-by: Patrick Venture Reviewed-by: Hao Wu Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220102215844.2888833-4-venture@google.com Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 257bf638fd5..4cd58972c56 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -330,8 +330,17 @@ static void quanta_gbs_i2c_init(NPCM7xxState *soc) =20 static void kudo_bmc_i2c_init(NPCM7xxState *soc) { + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 1), TYPE_PCA9548, 0x7= 5); + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 1), TYPE_PCA9548, 0x7= 7); + + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), TYPE_PCA9548, 0x7= 7); + at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */ + + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13), TYPE_PCA9548, 0x= 77); + at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */ + /* TODO: Add remaining i2c devices. */ } =20 --=20 2.25.1 From nobody Fri May 3 08:40:49 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1641577027; cv=none; d=zohomail.com; s=zohoarc; b=aVo5lMBwXMZbK4h0Yo/u5YmZ8ObeRgBsuAphP6mfM1BmuATlZio80ocuKUvAFb6HMxkiDnFhG779PpNFpbi+RUspj4wFNWwXLjlH7jlwW6jsPnCzJ7V8afEcuqRhk2BpKVGAzA3UfAzW6sRjUoL2iNDwPYV+xZMf+gPXwZ+7Zm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641577027; 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=zVmLLkxt4dOpZmfYQzdKuBSvUHMgb75r8FoddgZXA8c=; b=WTxoexlHPduUMb+AuwpUKEHp5o1BuGwunWuBtvhQBdJHB3HPPj6L3Qf+NrnWSXqm1yWYRtSPfxVA5Etu6qXvhsIgmq+6uiASDxoqwfk91lw1x8ptHU1YrgAB4YbyYj7GhOh/brsV6+sc9XxGAHrmn39j+pXddAicsvUWM39LDeU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1641577027809498.69234451289776; Fri, 7 Jan 2022 09:37:07 -0800 (PST) Received: from localhost ([::1]:43964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5tAo-0003ES-RP for importer@patchew.org; Fri, 07 Jan 2022 12:37:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5swD-0005O3-GZ for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:01 -0500 Received: from [2a00:1450:4864:20::42f] (port=36573 helo=mail-wr1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5sw9-0007vB-P2 for qemu-devel@nongnu.org; Fri, 07 Jan 2022 12:22:00 -0500 Received: by mail-wr1-x42f.google.com with SMTP id r10so4677391wrc.3 for ; Fri, 07 Jan 2022 09:21:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i6sm6060219wrf.79.2022.01.07.09.21.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jan 2022 09:21:54 -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=zVmLLkxt4dOpZmfYQzdKuBSvUHMgb75r8FoddgZXA8c=; b=uNqeurAStmDBvFC/CcvPCQDpJGAHhiDliXAH3w3goDFgce8CseOFGKlb/m1LXqhslQ p90KJnM6R8rB4dIpuPzyPUEFHJDdoE46CDMjqtuQIxRLFQnRL6dlFYjK2qkiTmYODWAY rGaS946EMjnNCPnLE8R+zkwJobMoVPqu5J4CSlok5Jc5iSI4JnQFHU78LnfCJNwvKXFe uCN1EeE6rkrrjIPd/95fQFlC+8A8oAM/helChZVqYURNmYct29YWB+D7xA79yEby0yA9 706QceWd96d2/lEaxf1Q4aUpo7nOOO57BoGw9gxdFzs7CyntHek7YXaCujBpr4FQxj1v 7+fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zVmLLkxt4dOpZmfYQzdKuBSvUHMgb75r8FoddgZXA8c=; b=s0bPxTRkoEkS83SVXAqNZWrMQXokNsM5+P5lG2wRpeQdm1Df/Dsk7rd21Fuoc91ftJ PjdMkv/aXCB5Vmqo0Yde3wRfEg3MnNK7IGb0v47U01RAVJQ55yqK4TqNZwne3RgARNjm 7hWwj3gXc3+e0uA+897EWF8T2JfTkLV1R3v8JQLtsYDK7qS7U9ZFCvcTF9joKLHqml3d dv2+FbFNtWjEBf2Hlxq2Zxyna7Px9LIQA/6pbbQ14pzwpKm+3ER5MyDGiHhJpse63UYo YzUdwCAYUSno3XjoC7V3bPO3+NUGa9gc7okMEgA3youAwOnSwkoOrfEcxkTjz4bSkkfx ryRw== X-Gm-Message-State: AOAM533czoPN0Tnzu9MUvGvE6c9TToxR2lhPjxmhkPuNigR/hq0fRwb4 ur9ifVRpEOTH7DdricFYl2KnPC8tzMlNBQ== X-Google-Smtp-Source: ABdhPJzeiGMmNhS3mhIWreS0PiJod9hHBArMDrj6iJYGhaUmqCYFVhKrIaC5ws920UO2eAjJY1F3sA== X-Received: by 2002:a5d:5142:: with SMTP id u2mr186016wrt.395.1641576115187; Fri, 07 Jan 2022 09:21:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/19] hw/arm: kudo add lm75s on bus 13 Date: Fri, 7 Jan 2022 17:21:42 +0000 Message-Id: <20220107172142.2651911-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220107172142.2651911-1-peter.maydell@linaro.org> References: <20220107172142.2651911-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42f (failed) 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::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1641577029857100001 From: Patrick Venture Add the four lm75s behind the mux on bus 13. Tested by booting the firmware: lm75 42-0048: hwmon0: sensor 'lm75' lm75 43-0049: supply vs not found, using dummy regulator lm75 43-0049: hwmon1: sensor 'lm75' lm75 44-0048: supply vs not found, using dummy regulator lm75 44-0048: hwmon2: sensor 'lm75' lm75 45-0049: supply vs not found, using dummy regulator lm75 45-0049: hwmon3: sensor 'lm75' Signed-off-by: Patrick Venture Reviewed-by: Titus Rwantare Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20220102215844.2888833-5-venture@google.com Signed-off-by: Peter Maydell --- hw/arm/npcm7xx_boards.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 4cd58972c56..7d0f3148be0 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -330,6 +330,8 @@ static void quanta_gbs_i2c_init(NPCM7xxState *soc) =20 static void kudo_bmc_i2c_init(NPCM7xxState *soc) { + I2CSlave *i2c_mux; + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 1), TYPE_PCA9548, 0x7= 5); i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 1), TYPE_PCA9548, 0x7= 7); =20 @@ -337,7 +339,14 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc) =20 at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */ =20 - i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13), TYPE_PCA9548, 0x= 77); + i2c_mux =3D i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13), + TYPE_PCA9548, 0x77); + + /* tmp105 is compatible with the lm75 */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 2), "tmp105", 0x4= 8); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 3), "tmp105", 0x4= 9); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 4), "tmp105", 0x4= 8); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), "tmp105", 0x4= 9); =20 at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */ =20 --=20 2.25.1