From patchwork Fri Apr 22 10:03:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564774 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp324682map; Fri, 22 Apr 2022 03:09:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYKujUgr8Xh37ad4KvU3De2So7Rck3XHLAPC/gSW+MlL37D+lI27RcVS8MZiM8D+dvWOAc X-Received: by 2002:a05:622a:14c6:b0:2e2:3f:f938 with SMTP id u6-20020a05622a14c600b002e2003ff938mr2553110qtx.358.1650622143818; Fri, 22 Apr 2022 03:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622143; cv=none; d=google.com; s=arc-20160816; b=DuQKguhaOHY+ZuedEEbBsQctGN4jEPB2P8QJ0HaV0ILntJGpEs63prfW68FoD+Ikua lrD6i7+0iwkSeL3lGH8bX/En+hsy22qOMSFU0V4hGq2EJh1QeT/Y79KKINb45T2oufnz t76JRJ6R9e1R7WrB8KPITQYdn2JnBCT87jetyEZOL2FEbK0rSZ+QyVnxvQezYwoA6lpt frliWPiDMtEXzZvH/pA3j5OYS13nYtoNztHmo5x1o68B7IzcTTtXEnZnj8WagJq+4Yhy H6cYgqMzNJ+krNltQ025K7wm20e8y/QvApTNAkW4fZnUh/GpcnpeKZR4i+XbLR5bKyzR 8Q9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lVHlaskVehb1HPwJaP5NZWEzj3D8wAIUBCqaFD2xjB0=; b=tVhdABF18ue+6qrz8kmu62/zfBylCNK7AMnVqy76aJr1TVgdbwKl1jDi/Pm/SLcFNP y3Sft694YvIVqmUIOBQpWq/XkmSBhzDPnLkv6BNtUtpSbQUbZT7ENCv668NvmgJVXxwV Uwe9XD343eKr8d59fGspO4kGSU9PqmmN+jr68AnWEhrTJ1+LxYaLE65rwBy5vh5+7i9S oiD4WjA1Vxot6bJ6L6ruswYRS5tG6F3zt7y4HtDeCN3Po1x9EtlDTrHwsrSYLmJz4aDG 2RMs9u4YJ4Vbpq1FtZuDet9uCFo0Nhlfw5uP60tpZrD/0jHHbouicN5TBbTvqCDbNlG3 oncQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WOE0K6wa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t186-20020a375fc3000000b0069c102d4497si2134927qkb.445.2022.04.22.03.09.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WOE0K6wa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqDn-0006e3-Bg for patch@linaro.org; Fri, 22 Apr 2022 06:09:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0004De-LW for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:42 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:40516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9V-0002ZP-T6 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:39 -0400 Received: by mail-wr1-x434.google.com with SMTP id e2so4041138wrh.7 for ; Fri, 22 Apr 2022 03:04:37 -0700 (PDT) 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=lVHlaskVehb1HPwJaP5NZWEzj3D8wAIUBCqaFD2xjB0=; b=WOE0K6wa8inglJFkch3bXsI7gZYHZ5ieCvIXBhWxauBhny7WR+0jIrxYuvfGc+Qeei DF4CY18apaBeTpxkCRLSSnoZvO0tY/bxFzwIWqO84xeE4KoWE7MKky+vgMO0WYaEy8h+ xOpKyqH/5bV69S+XgRCi8gwzSSC11kbkdZHgD4TeIFkmEAhAKKrQPtU4T4MryU/qj3TW fKGOtrlfdsl76fh4d6p7mWK1VOmiqAtLqJ9xhIFdRfmsm2hkW7lp4LYrwsExkNAHrL1x Pxp8JTYlzjsxEYEcynn5WdhJEgHCQcs+NM/aCFIVAbg3HJx59yTUud86TiYAjqB9SI92 o8XQ== 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=lVHlaskVehb1HPwJaP5NZWEzj3D8wAIUBCqaFD2xjB0=; b=p+vwKcJRuMY4cTaqdwzBvHOrk85BgP21wYqBmsdcJMQXbKzj5v3PWV4O2q2VFkU13X 5+jcaND1UIk6/X78XHVVZD3FOUTvB/YjTo++oVIhqu+cCd2QwDsEdltKIHhbog+gjWPz cDsWM9PMznsuFpbxLDpU+J2/sf6unQLaHKfvqBmXsJtmJpiQwtE62jdabY4nCF5Vn/Qy X2yqqJlgT7ZyUsscTvm95+8MwRXtt4l9sLLBRcMt03s9w6ywXHnBBEsrZ8wA7pt/LUFh 9C0nTD/QBp/fWoGGiDdDnYmOuH3SMD8GjXaGHc36/TTKjVSVE5tt72lmW23nMYmKW0DJ GnwQ== X-Gm-Message-State: AOAM532TW7dW9vc20Lv3WHKwSuI59n+TmVpy/8wRlU+cTIuQ2oELWsUp HrjESWLM1z0RdVC8ys0yS4hf38EdV6Pn2w== X-Received: by 2002:a5d:4b45:0:b0:207:ab91:edd8 with SMTP id w5-20020a5d4b45000000b00207ab91edd8mr3098656wrs.168.1650621876389; Fri, 22 Apr 2022 03:04:36 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/61] hw/intc/arm_gicv3_its: Add missing blank line Date: Fri, 22 Apr 2022 11:03:32 +0100 Message-Id: <20220422100432.2288247-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In commit b6f96009acc we split do_process_its_cmd() from process_its_cmd(), but forgot the usual blank line between function definitions. Add it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-2-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 87466732139..44914f25780 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -380,6 +380,7 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, } return CMD_CONTINUE; } + static ItsCmdResult process_its_cmd(GICv3ITSState *s, const uint64_t *cmdpkt, ItsCmdType cmd) { From patchwork Fri Apr 22 10:03:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564772 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp322501map; Fri, 22 Apr 2022 03:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzK3VSzz7DqUFlLC/0xPMoQOptK3yKvF4QkaoFxpS+oUO1N+e+pleIBVZh3aRa9bb+6F5X X-Received: by 2002:a05:6214:29e7:b0:446:6d26:2440 with SMTP id jv7-20020a05621429e700b004466d262440mr2600911qvb.118.1650621977840; Fri, 22 Apr 2022 03:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650621977; cv=none; d=google.com; s=arc-20160816; b=PDreypz8/epm/22FC+3HVGKx+PRpXK2Qr/2K/5XabKvmwN+Jc/31c7BfBiKwns9DPX jnnpFtwLnL3cd2tah4e95Oe7FgR9rsmdr7+2e6Qrp++LHQXYFUm/3050hVGbd9Q567wV 3KWpYSCzkTwVfp8PYuWvX3n3HCJ3tKBqLIG4CxQX+jzjNNktCnhU/9dFAsZU+1GLkTGs /ukbWoKMUSDS1U92BA1KUTMssJRhp7qPayhbUbHfXJq7pfPq8K4YQHtZEi7UOLXT7gCh 7zgSv7GfsjEIcBfEA5ZSemhKN5Va5MrbDnxxcHc/0kahWdXzTgWr370+aUdOmjnWWTsa NzBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=yAceIWPAC8r3Dhs6mVGhU1bKPN0+Q2uC40Z26KOWRwGvUUFQGbRhvJd9RCqgtQma24 iHwZlByr7fpIrPyLn/IGb17sZtFzLu86JEIbqW/suXEOwVqm4HKEzfJUtM1UMHbyfTUz 2gSMVnkvV8YKd2fYC/bSegVv1++JG3C6fW3ELJ2p/dExa74NXwCrKoDjKyUwu9yrmwz1 pCNHV0ALqx5mwYtlZo/LYUChkuBZV/qZnMjKVSrTL1eHIVFmjlfhVDVe22Wq0FW/+C16 B/FXqEna+tYKywrftcsmmiPmvOf5hlnP+haPtuW2fqWOEylXdk1Sxe2dFdpDFdV1rN6U jIpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVA1dWbT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i5-20020ac85c05000000b002f20456f89bsi76991qti.767.2022.04.22.03.06.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVA1dWbT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqB7-0004If-7E for patch@linaro.org; Fri, 22 Apr 2022 06:06:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9b-0004E2-5Y for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:45965) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0002ZU-9M for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:42 -0400 Received: by mail-wr1-x432.google.com with SMTP id w4so10276646wrg.12 for ; Fri, 22 Apr 2022 03:04:38 -0700 (PDT) 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=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=DVA1dWbTaTzwPJZN/KDd/Dd/1bpsQqjIKd/SdeMpwMb2bKLRkZPK9tVoB9n66h8Aqd /zyUFLbXWzad3idW90bRqJCHPvnqeBgE/YaQfvvR7et/1TGO4ZJrKY09FdDOhhm/vzYQ VOjkJ9+w0r7LnV2EDHJTE67zkkR99bdVE5KEbzx0c89bZ+9xpWzyO1Eif+h96aF1+BK9 /WHAjNvFqggKNWPUBhazv6ugIrfQgyhmgzMjXCIpZlwUu9YVUajXN4B/3ZipqV6iTCFi fyPPkZM5P0eAAqUTTmfKGnE6I3LSImX3OOdN70ARgbAicZa4vmy7C4G9Lc86wxNHm6Si q6vg== 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=nusE4iJqKxuXxzxUwLDY6MVU16Qz+ioLkpoA1JeR0xQ=; b=QiC7EwAWEbC2mr4JWmcSlaSvmGQkhqSE/HdKVZQuxPpSICQ3jKHPRHfaA27dt/a9Aq KkFoXXES92tFJioTSPWzpEUhyA9pG66eK0u9jrxUyjogrxoj2xX9YJH3GOKG+rF3foCj kJCv8Px9UAvwCeg15+DiRAI7p15Go48+FnNDd2GzZ5N2tVNwA62ivktKFiPVtM1zNGM8 UQsnyhqu6LI/Ahf2/q2k7ZP9TGfjX+i60sayWeyKejOvp8Ief2O/UUHGLSHPDyeAXbBe osXl6nCPE8VWH5V96vrckQtn92vHad4x3pt5TeruyBXI8KS2WwBsQJHaudK3AwpbLCnZ NhYg== X-Gm-Message-State: AOAM531mWK8WilTLXF8MmHSh7zrzM4VK/Jh53iJ4jyfVsssp9ybswZPQ AHs3WoCo2Fc9oNWxs+UaNRKj+uezd7kUUw== X-Received: by 2002:adf:ebc7:0:b0:1ee:945a:ffb4 with SMTP id v7-20020adfebc7000000b001ee945affb4mr3050675wrn.641.1650621877103; Fri, 22 Apr 2022 03:04:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/61] hw/intc/arm_gicv3: Sanity-check num-cpu property Date: Fri, 22 Apr 2022 11:03:33 +0100 Message-Id: <20220422100432.2288247-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In the GICv3 code we implicitly rely on there being at least one CPU and thus at least one redistributor and CPU interface. Sanity-check that the property the board code sets is not zero. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-3-peter.maydell@linaro.org --- hw/intc/arm_gicv3_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 4ca5ae9bc56..90204be25b6 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -328,6 +328,10 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) s->num_irq, GIC_INTERNAL); return; } + if (s->num_cpu == 0) { + error_setg(errp, "num-cpu must be at least 1"); + return; + } /* ITLinesNumber is represented as (N / 32) - 1, so this is an * implementation imposed restriction, not an architectural one, From patchwork Fri Apr 22 10:03:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564778 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp328755map; Fri, 22 Apr 2022 03:14:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwDCvjZLjPRppKn05ccBTFInEvGfGTeDo85L6Qh8TazYTSPhzKAWFYvHDFNeY51NGtg4mx X-Received: by 2002:a05:620a:298d:b0:69e:eb4d:7333 with SMTP id r13-20020a05620a298d00b0069eeb4d7333mr2059606qkp.305.1650622488736; Fri, 22 Apr 2022 03:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622488; cv=none; d=google.com; s=arc-20160816; b=kdQD/eRY/kDaegCj/8ZbEZP2MwU1bSGwnXoFNS5wQ9ZXZ6NuFOmD/lqkUJ1HFIPLZg 2FBbdd+3XNpyNlHQgIPk2og3rJeO1992QcSdwEsMmZv/8sN/tAxVDyIEVOf2Sa3BaBnP up3Toa8W9Qx/kYLtIoREa5uDqGo06z5osMHZLcZRB3rgbKiJmGQaF45y/PwgDI0Lcwed GuImLpptnet5Zb1ZXZO9IWlCmsCgAdeVND8Er9cqgtju5pf+VeBynqIrGSyjizLX+QDB avOv1hESV2gv1fTKCJzqMFnV7Et5mrRkJ9Kthafx0Q2tEk4zvfiy3uDd14eI6nXVY1SA niwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=C8wjiFGqRwiBdgaooMAg0hTWNbKduRpOV7Hjw4Kt2zU=; b=M2becMdAJsgNaF+dHK7wwExtjwDsYVU28pLRpRzkSGVZfhaalZNnoAN0Ucs8hNHSdm +37HXQ4F6W3hzQNodBVixDQOarSH5SSEO0Pf1tHfMqqv53rRTAUm3+uNRpWkJTeW2j1a K6i9bHDzaf1nVEwhjf7ouk9FrQ54JN/GDZtj/ghWvm73fEsksRsw2xEUBJOy2BYhArDm hVb9TvgoN2Ja1ZeU897lzZ/ncn9zJCPXvUgjgJeQ7BUF2+zJihAArBfP8HqFIfEgdw+s 250AqpmfrHez/uCWnM89DTcselNMVuEiqjNKBPhKLMRbHYcMuVUoy/9m8SAlj2doL+wl w9ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEM4rSF8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ay6-20020a05620a178600b0069ebc89b199si2051002qkb.257.2022.04.22.03.14.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:14:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEM4rSF8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqJM-0004Hj-AL for patch@linaro.org; Fri, 22 Apr 2022 06:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9Z-0004Dw-TZ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:44 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:39604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0002ZW-9H for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:41 -0400 Received: by mail-wr1-x430.google.com with SMTP id m14so10319455wrb.6 for ; Fri, 22 Apr 2022 03:04:38 -0700 (PDT) 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=C8wjiFGqRwiBdgaooMAg0hTWNbKduRpOV7Hjw4Kt2zU=; b=SEM4rSF875JoPfwvIsDtkoCpZ3KwO+zL+5DboekT+Bf2CWbO2j+44p5Snx7fRq4Av2 alhkiWMgYzPhYYYZUDLBwMIKGbm0r6hCYEOba4dJFL8PdS5cSVCBewud6wY26qMnptc2 rWK85TS9JP8sw1LuMWL8B0qAUzEdMh5ViLvhqPt2yMGBSRXbrEbQh6ZRcPE62XsisfI3 QJAJm2g45GRuzbcayZYC2JcUt+n1xR2mOy7BdxHRacqC+aFW3e5l1v+qq4XONHHB/Bgi ytVzzc7Gb2609DTFTbO5+/mCQn7/wIcsom3pC6JdIkD7ZnJ7zOaR/kWd0wUZ8wZQIfuJ Ht5Q== 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=C8wjiFGqRwiBdgaooMAg0hTWNbKduRpOV7Hjw4Kt2zU=; b=zZh6BBTbr+c/Flxe2dNi3yOZaqONwMFOANYW7kRil5znhn/KjL4U9V5QZqmQi/rYwZ gvwCdMLwi8rgffIkinlDJy7pFplFh5dW1DXwcQJCZtbe67nsz4ttrTsFdgMblNqQ+yKV dVwn7oColQu5EJpb8iQRQBRsEzx7o1AQsUmIdyRhFHVVCdqL4SODsgMwn4WIuFOrH37K l3PdGkAdhq7F9LSR598ZqFlwu19FE8FECT4ACeRNrc2W9jkqq8wj2rzUnwEaUDfNk9g4 LSor028VvmyoE2B0pF+51KCWk4l3m5u/4yRBJkdpDXMwJqwLYDrjLr6AzOe+B1/FkhMe aR6g== X-Gm-Message-State: AOAM531ywoRJ8gV5/RKxA1ddrvHFOPJGyE6SSYpd0AEhtHcDu5VEK5WS FhC0ljHvf/w8wWKkRksOmY28wwZB05kgog== X-Received: by 2002:a05:6000:1a87:b0:20a:7ea5:2aef with SMTP id f7-20020a0560001a8700b0020a7ea52aefmr3034302wry.666.1650621877913; Fri, 22 Apr 2022 03:04:37 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:37 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/61] hw/intc/arm_gicv3: Insist that redist region capacity matches CPU count Date: Fri, 22 Apr 2022 11:03:34 +0100 Message-Id: <20220422100432.2288247-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Boards using the GICv3 need to configure it with both the total number of CPUs and also the sizes of all the memory regions which contain redistributors (one redistributor per CPU). At the moment the GICv3 checks that the number of CPUs specified is not too many to fit in the defined redistributor regions, but in fact the code assumes that the two match exactly. For instance when we set the GICR_TYPER.Last bit on the final redistributor in each region, we assume that we don't need to consider the possibility of a region being only half full of redistributors or even completely empty. We also assume in gicv3_redist_read() and gicv3_redist_write() that we can calculate the CPU index from the offset within the MemoryRegion and that this will always be in range. Fortunately all the board code sets the redistributor region sizes to exactly match the CPU count, so this isn't a visible bug. We could in theory make the GIC code handle non-full redistributor regions, or have it automatically reduce the provided region sizes to match the CPU count, but the simplest thing is just to strengthen the error check and insist that the CPU count and redistributor region size settings match exactly, since all the board code does that anyway. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-4-peter.maydell@linaro.org --- hw/intc/arm_gicv3_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 90204be25b6..c797c82786b 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -354,9 +354,9 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) for (i = 0; i < s->nb_redist_regions; i++) { rdist_capacity += s->redist_region_count[i]; } - if (rdist_capacity < s->num_cpu) { + if (rdist_capacity != s->num_cpu) { error_setg(errp, "Capacity of the redist regions(%d) " - "is less than number of vcpus(%d)", + "does not match the number of vcpus(%d)", rdist_capacity, s->num_cpu); return; } From patchwork Fri Apr 22 10:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564775 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp325186map; Fri, 22 Apr 2022 03:09:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNRCuk4Y1eUpaq0PXgn3RVrBkiebCa2XSStoB2mOE3vasm2kXxzggEPZEB3bnQaDOellzt X-Received: by 2002:a05:620a:29cc:b0:69f:637:c396 with SMTP id s12-20020a05620a29cc00b0069f0637c396mr2022959qkp.267.1650622187781; Fri, 22 Apr 2022 03:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622187; cv=none; d=google.com; s=arc-20160816; b=fi256e0thVAddlSRTBQURIuTZR4brsIsPIdQCQNWKrSkxsBxxhoI0LdaX9NrQGuKrZ 49IzHYFGjjyaPP1TLRvU/83CyD3ZfOvLRGo2rRidQNnWMSkFxmw9185QIvVuC+wqcvSy 15rUV+kG/y3QFQ8zU/b1Ohz3MDhlAc7A/H46sA6oiNLcmIPqiDzD/mMW88Cckoaxn2Qq 2KvEoeGoiov3BFehwozYLjvqcW8taekcdGWD8KB52tLOh1VrhyI0G7B5nCM4rEHyI0PF UnuD5tLCXzrQqgjCGT5Z3WPCKzhSAQpqyPmCnw245rlkGe1o/Beocs0O9OdtiyZfQHFf DsKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wUfoPWvKhsZt0M/M5TnHwpw7PYiqD+FRJMBmRgeWQGE=; b=0yS7gEavLGbjT4FU9AclYrbxS5CtTAtt/u7Ju1C2DxJNzE/pOf6QP5EESFSTcSHGih o3gCB9W0TK17w3qP/eAzb6HaqQ+t3H1hcyz7iSPSMDp8micB7JHjlBZS3fYXxn2cLYlq dy98/9FbQ7ltaXYUaDXwu4P5ITb+6+AEYqVjj/UF/sJgwaiZOJlsn0B/J0uOh9yMlbK+ er6rTru+LkUYP6w5esFRdXepygvrxGJEbMBt6f1gUy81Gp2ZZcPauxHmG0aSukM9tRl8 o+2Bbr0LFLucZ8sYT+yBZ/pJWjCyP40a45jAWK+FhUrl6yxRjAqHzFIgtHo4ObT6exeG dArg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XOAbAHsX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ge5-20020a05621427c500b00443e1c54a35si2070973qvb.44.2022.04.22.03.09.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XOAbAHsX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqEV-0007Er-BK for patch@linaro.org; Fri, 22 Apr 2022 06:09:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9Z-0004Dv-Sx for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:42 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:44900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0002Zd-9F for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:41 -0400 Received: by mail-wr1-x429.google.com with SMTP id b19so10279171wrh.11 for ; Fri, 22 Apr 2022 03:04:39 -0700 (PDT) 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=wUfoPWvKhsZt0M/M5TnHwpw7PYiqD+FRJMBmRgeWQGE=; b=XOAbAHsXgnrMJmjyQ8srma9P9TdFT5TpOcCPQi9sgfP+Tl+jfU/YqZ7HwpxeHnjo48 0cgMhEWfRiIpvFQ+ZX5SSRl1HCWLaZcrxZlAme1cTQBtHik9J13cn8mwI1QHufQtOBlw epYvTdJ8vlk1RvMmmCx+mUl+jp+JW07qsD6sXS1xJlbnSl2z1o5lItGOL+hRvBAdthdv H0QUl+yFqEvRaSiUazr9aEicRHqUyKHEKTH/KcDbIvPKqNdHfuo3qM1YmJnuh9fHTVFY g84NrczeFMfR4Gkf5hJA5IGWABu3+rEuE2ofT9f7DYkEc7oTKCd4g98+tTwBqarcfOZ1 kdDQ== 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=wUfoPWvKhsZt0M/M5TnHwpw7PYiqD+FRJMBmRgeWQGE=; b=kPVMAWPii/Wn06vqFAT0yNKzzmWJ2xhPLbIlYbPwDWSALjKkRbAjDgbXLjL/ofYjhi T6ghVGPV0JQBR1xr9NiKRkWIYJRYIA9phuwoYo/akLWX8zPMSzzhTW313IxGc5oaWK/H m3zph6INgTDtcIr1PQtzbhYtQSOCHRjverxJmM/XpsPtYmKIT2b0z37VqQoMibz4U2Nv T6I5yL75zD06z8edlYw9XAUFJqwHf2jRwFzdEB0vE/TOg2kP5S56OPXQuE6zDozKtDnm 3dm/2L4pVUSwLIYQesj4xNAsprZHZLTvAEgfAKm5d/trvlBGHrjvYTFLde5lz4ZZ0sXf H5Yg== X-Gm-Message-State: AOAM533VbY4mUmYfBLw2Ztedlz9nRwAOogr+b3pBbA+g4sfE6fEcB8TL LwXRj3OWqh1wHtvMKdbOh2X3H7IC1T850w== X-Received: by 2002:adf:d1ce:0:b0:20a:992a:3b54 with SMTP id b14-20020adfd1ce000000b0020a992a3b54mr3004181wrd.270.1650621878736; Fri, 22 Apr 2022 03:04:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:38 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/61] hw/intc/arm_gicv3: Report correct PIDR0 values for ID registers Date: Fri, 22 Apr 2022 11:03:35 +0100 Message-Id: <20220422100432.2288247-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We use the common function gicv3_idreg() to supply the CoreSight ID register values for the GICv3 for the copies of these ID registers in the distributor, redistributor and ITS register frames. This isn't quite correct, because while most of the register values are the same, the PIDR0 value should vary to indicate which of these three frames it is. (You can see this and also the correct values of these PIDR0 registers by looking at the GIC-600 or GIC-700 TRMs, for example.) Make gicv3_idreg() take an extra argument for the PIDR0 value. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-5-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 15 +++++++++++++-- hw/intc/arm_gicv3_dist.c | 2 +- hw/intc/arm_gicv3_its.c | 2 +- hw/intc/arm_gicv3_redist.c | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 2bf1baef047..dec413f7cfa 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -555,7 +555,12 @@ static inline uint32_t gicv3_iidr(void) return 0x43b; } -static inline uint32_t gicv3_idreg(int regoffset) +/* CoreSight PIDR0 values for ARM GICv3 implementations */ +#define GICV3_PIDR0_DIST 0x92 +#define GICV3_PIDR0_REDIST 0x93 +#define GICV3_PIDR0_ITS 0x94 + +static inline uint32_t gicv3_idreg(int regoffset, uint8_t pidr0) { /* Return the value of the CoreSight ID register at the specified * offset from the first ID register (as found in the distributor @@ -565,7 +570,13 @@ static inline uint32_t gicv3_idreg(int regoffset) static const uint8_t gicd_ids[] = { 0x44, 0x00, 0x00, 0x00, 0x92, 0xB4, 0x3B, 0x00, 0x0D, 0xF0, 0x05, 0xB1 }; - return gicd_ids[regoffset / 4]; + + regoffset /= 4; + + if (regoffset == 4) { + return pidr0; + } + return gicd_ids[regoffset]; } /** diff --git a/hw/intc/arm_gicv3_dist.c b/hw/intc/arm_gicv3_dist.c index 28d913b2114..7f6275363ea 100644 --- a/hw/intc/arm_gicv3_dist.c +++ b/hw/intc/arm_gicv3_dist.c @@ -557,7 +557,7 @@ static bool gicd_readl(GICv3State *s, hwaddr offset, } case GICD_IDREGS ... GICD_IDREGS + 0x2f: /* ID registers */ - *data = gicv3_idreg(offset - GICD_IDREGS); + *data = gicv3_idreg(offset - GICD_IDREGS, GICV3_PIDR0_DIST); return true; case GICD_SGIR: /* WO registers, return unknown value */ diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 44914f25780..f8467b61ec5 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1161,7 +1161,7 @@ static bool its_readl(GICv3ITSState *s, hwaddr offset, break; case GITS_IDREGS ... GITS_IDREGS + 0x2f: /* ID registers */ - *data = gicv3_idreg(offset - GITS_IDREGS); + *data = gicv3_idreg(offset - GITS_IDREGS, GICV3_PIDR0_ITS); break; case GITS_TYPER: *data = extract64(s->typer, 0, 32); diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 412a04f59cf..dc9729e8395 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -234,7 +234,7 @@ static MemTxResult gicr_readl(GICv3CPUState *cs, hwaddr offset, *data = cs->gicr_nsacr; return MEMTX_OK; case GICR_IDREGS ... GICR_IDREGS + 0x2f: - *data = gicv3_idreg(offset - GICR_IDREGS); + *data = gicv3_idreg(offset - GICR_IDREGS, GICV3_PIDR0_REDIST); return MEMTX_OK; default: return MEMTX_ERROR; From patchwork Fri Apr 22 10:03:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564780 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp331001map; Fri, 22 Apr 2022 03:17:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyB+lbxSUhPE8mPw/ES86m1H7Bm11lianvawemv7GyMGUljgqpv9rIydQT1BXCMY1gFW2V X-Received: by 2002:a37:62cf:0:b0:69c:a334:f5ce with SMTP id w198-20020a3762cf000000b0069ca334f5cemr2105419qkb.783.1650622675534; Fri, 22 Apr 2022 03:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622675; cv=none; d=google.com; s=arc-20160816; b=QfqmzKCbAYEyPszyXon4u43qMtDYM4ccnBS/U3/oYwwi6ibLAZSbx0u6XfPk5JgROr unWs88mgpeJlPlEClIyQxVzCjM04VlWsJP572h+T+8YUlSPTXWfcHc66Uui0WniulqpW N1wO5KZi1NQLsGbbJD1YCFU/jgHPN+ngqMztPz9TRc11Bt+Y3Ep3dUr8ETKQTmhYWjHW 4aSVqM0hnX2DsxuZdMN2na5wix36NouHHX1ILD56VMVOc/tLmm/EXk3nTAi0RLcGZxrZ NS61h8IGRnrig7wAK5n9E2DxTXYkHBQxyyr/o8P7Fz29PvhlT5OJkWyzhgoAS9pSqnas AQ6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LtCQjZwy+MRjUms9uMTdrmBqMtKUGnilvU+NhBGq9yg=; b=O51go+60mVt++w1OCpXZReTruBJCQF7q0Q1s6KlYf++4Qg/YSxf2hKloJyebFOuimO JTeZuMxjldV8Z/OqDLUQu6wTjQ2c1I+O73BbZ51NdMEZyJA40N71eg2QYG+U/OC2apym wkyFbYcyREdj0mkIbdd3iZpBYE/VkVJEOwkQNu+sg/3dDll90B6Py/SreUHlSkvLKZlf wDfELnvYaffSCUg1d6H3+3+rJz0VO++SunzoYztti3Pna8cidTNI0nsm6dOuRUTWt8zt W+dbDFaxBS5sp9roFULg4DZRZeiwsolnR8EgABW49ygCI5oyGUas/TSgsmbF8nuD6vIf ukZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="smQ2s+/h"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bm1-20020a05620a198100b0069eecbfed61si1310195qkb.491.2022.04.22.03.17.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:17:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="smQ2s+/h"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqMN-0008L2-2a for patch@linaro.org; Fri, 22 Apr 2022 06:17:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9b-0004E3-A8 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:36573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Y-0002Zi-Vq for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:43 -0400 Received: by mail-wr1-x42e.google.com with SMTP id u3so10334631wrg.3 for ; Fri, 22 Apr 2022 03:04:40 -0700 (PDT) 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=LtCQjZwy+MRjUms9uMTdrmBqMtKUGnilvU+NhBGq9yg=; b=smQ2s+/ho0xJoSSucvSUaEqSmHtBWj99DVg1pOvSzMcMZoOCTChZfO/uwQ9QaS/SML pTg5SMrKdreV+hGdZJsvL0p8/HShd4tvqYSNj+Kq//BZcBqV8EViZb3MQrlUEAIRM/O/ qdG0BAlaxD3P0XCI7MPwF6xIJH/b52nALXSgibMplC/K4Y03tyuRU6FqHLtSHgru8vuJ WwvF8t8IOW819OYU20/c277Lxv1w1cXUIxAjLi1P4cuTjOfCgm1R804Z+NdSZ1Ap9T3s iWkWsiypJHLrX+z8O2p6fTc1NPToeT2JSxBXE1p77VpcLDwGJ1H06j/Dv7kGV4XOSGW2 m3JA== 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=LtCQjZwy+MRjUms9uMTdrmBqMtKUGnilvU+NhBGq9yg=; b=vBw/A2nS5RBUnEtDU0yGiWXxth7bZgZIQKcSFQYMJmGIoaHhPR/UU2Ey3KP1ekCgIE kPerXeUtT9jSGOjFTBiLJfQu6nEF0QxjiBR5QxR23uTL/U+g9WnIr1jBd5uAwXwvsj1/ rXCKeOI419Rk1DEkI5FYkd/HjvXfodueNvRPIXeGBU4qNT5yxZO7bSPvM+hTjSZOzbrS NuxBqcA271xrwfay5X47k9R+TH2CIU335uo/t1fK9EQGQAQuRsur2bK1WopokXJIRAPs l4Od56xiJxJpJeLJ7oeqzR5/y1rPW41gp6g8JVEkkgr/rp+wZ+8nDe6U0y6qd6G1SVCc QOag== X-Gm-Message-State: AOAM533bwBE3rhH5v8M9+E1eT3tfgbgR3/GUyB1OYJCeJXDskH+ZsSlY K9qUeW+fZ0LchbXzdu7ag3yES+yLc3F5iQ== X-Received: by 2002:a05:6000:1a8a:b0:20a:af19:ad12 with SMTP id f10-20020a0560001a8a00b0020aaf19ad12mr3082692wry.4.1650621879520; Fri, 22 Apr 2022 03:04:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/61] target/arm/cpu.c: ignore VIRQ and VFIQ if no EL2 Date: Fri, 22 Apr 2022 11:03:36 +0100 Message-Id: <20220422100432.2288247-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In a GICv3, it is impossible for the GIC to deliver a VIRQ or VFIQ to the CPU unless the CPU has EL2, because VIRQ and VFIQ are only configurable via EL2-only system registers. Moreover, in our implementation we were only calculating and updating the state of the VIRQ and VFIQ lines in gicv3_cpuif_virt_irq_fiq_update() when those EL2 system registers changed. We were therefore able to assert in arm_cpu_set_irq() that we didn't see a VIRQ or VFIQ line update if EL2 wasn't present. This assumption no longer holds with GICv4: * even if the CPU does not have EL2 the guest is able to cause the GIC to deliver a virtual LPI by programming the ITS (which is a silly thing for it to do, but possible) * because we now need to recalculate the state of the VIRQ and VFIQ lines in more cases than just "some EL2 GIC sysreg was written", we will see calls to arm_cpu_set_irq() for "VIRQ is 0, VFIQ is 0" even if the guest is not using the virtual LPI parts of the ITS Remove the assertions, and instead simply ignore the state of the VIRQ and VFIQ lines if the CPU does not have EL2. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-6-peter.maydell@linaro.org --- target/arm/cpu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 3609de08882..fa13fce355a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -694,6 +694,16 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level) [ARM_CPU_VFIQ] = CPU_INTERRUPT_VFIQ }; + if (!arm_feature(env, ARM_FEATURE_EL2) && + (irq == ARM_CPU_VIRQ || irq == ARM_CPU_VFIQ)) { + /* + * The GIC might tell us about VIRQ and VFIQ state, but if we don't + * have EL2 support we don't care. (Unless the guest is doing something + * silly this will only be calls saying "level is still 0".) + */ + return; + } + if (level) { env->irq_line_state |= mask[irq]; } else { @@ -702,11 +712,9 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level) switch (irq) { case ARM_CPU_VIRQ: - assert(arm_feature(env, ARM_FEATURE_EL2)); arm_cpu_update_virq(cpu); break; case ARM_CPU_VFIQ: - assert(arm_feature(env, ARM_FEATURE_EL2)); arm_cpu_update_vfiq(cpu); break; case ARM_CPU_IRQ: From patchwork Fri Apr 22 10:03:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564788 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp338610map; Fri, 22 Apr 2022 03:28:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynWpQJn2S8VvylrUVV5et+kCSNMMXVFMTj7F+jBN5Qa4InilBF33AoC8tdQGiiXq7K4dxh X-Received: by 2002:a05:620a:a8f:b0:69e:8e6b:c674 with SMTP id v15-20020a05620a0a8f00b0069e8e6bc674mr2150175qkg.625.1650623333400; Fri, 22 Apr 2022 03:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623333; cv=none; d=google.com; s=arc-20160816; b=uMqOp+uumolpYvGhINWfiY/FsjGevE4lul0jlhLKd3dH8wc/8Ccr+caw8q9hi2quU1 8vcnBqXBICBvhvV5fr92VSuCksSPLuVvtFd8F+XKF3UzacfycHTJLcYMMZkI1Ssg+1p3 56+PSDAbf1TZ+aKe831P5r1BoYU9yhRIN7+vUGEecPxYRgJOe9zWgo7ZHx5/x0fmyZTv N9kXPj3h87Ie0L11cnDf/xJ37vrr/F/XPR66orevMao/wmUj2kQq5+sJeU9tLjElTj9A qymNipEkAAhVk2pxgkLHwPmnlJcb82S6JmF4iF/reiPYc2Q7wiD3hCMLsKGTkHJ/HThT l+wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KP3EMe4IHC9X6u7x67z2Ghb+uxnwdwXPMr6nFHH0Zg4=; b=Sstbj3+YQVh6bUco4DtGEbBhfPbEBnwDI8AX6UAsUK+8BXqSizbaMQMGDcK+DDuwHF 8V9kHnm30rML1s5zNfGJiF9ZUNq6mVDzl3fwuuhog+76TW8ANlizxaHBFJDul+Iz/3VA 34fKAtodvRNwfYdN8LmOVuaGPtMFViY/deg1FEClsu6bnzYNXVtFV4XJaWiszYrjmi5l zKLbqmycyh+F/wgAJKxwfX6ue02/ELvMwfnCWxxr3/LwvdQpi4/2dfkaKjJzIQN2wwZD 2tmpXXcdPAKisM5DZnOvtAO6q9dRntLLVssipshyOtVNLVO70qSkG6z+kadRre/m7/vU 6t3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lpsm4YiM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p12-20020a05622a13cc00b002ebde465d0dsi2120393qtk.664.2022.04.22.03.28.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:28:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lpsm4YiM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqWT-0003Yv-TR for patch@linaro.org; Fri, 22 Apr 2022 06:28:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9b-0004E4-Ar for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:40513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9Z-0002Zs-Gt for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:43 -0400 Received: by mail-wr1-x430.google.com with SMTP id e2so4041351wrh.7 for ; Fri, 22 Apr 2022 03:04:41 -0700 (PDT) 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=KP3EMe4IHC9X6u7x67z2Ghb+uxnwdwXPMr6nFHH0Zg4=; b=lpsm4YiMnsxOUzslWJMTZLakAC9jrY8ESrIASr6CXFDm1ADr32DzSbV7XGLARF8Wwf 18Vk7hEG9G2W4zXBJeLqE5glyTAyRoFDLNPo+pYJYwDLc1OpTpgI+ewMAU5h+ox2Nhgg i+52DZiAWfoENz1BOXZFYiqN/v4jqXz+ugGXY7umKnAQuVz/wzTQZFiZEuh5+9RPZYOg pQ9NCwB1cGV0UkkO7r5ipN+FebwKa33LoYqa/ttb7bV7ICjJHSn5FvPdKBLZ5rTU/+mX eGnVsGrtwcXJvnj0d33GFl/8q69Ybb80WHziPZxJA3L3rWrzzFg4kwkWGWwlEPTmatlZ YIbw== 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=KP3EMe4IHC9X6u7x67z2Ghb+uxnwdwXPMr6nFHH0Zg4=; b=4hefZUVq4E/MylQkE0ACr2w89x3YQMgQMwF4kKljl0LAU7wk11IQCYxMQwkIvSCdo9 UpppNFZPC0EMaKyRHhW+dnALu2cRl1/ZE+HU83ZxRZHQ5Ko1jD4lVQp9U8altGIvIoeo LNiFYvOjvRMij3hpRPQ5nnyeXtZ0M65AKGDnlM77xijCNBEcx7urZrrlF1GCuehX2AMX KTal5+p0GtrlFndo1jRkOh251upf5BlUAnmz0gNEGPGFnHUWAq/EV9enpcLz2+oCsGEP Rrp+MF/kEWLuz3Jkgjw+so959jyvfLUCoP9rHRVFqYtq7ZpZHXF0cOSQiM+xM4aqco5A RXBw== X-Gm-Message-State: AOAM532NRLPeU66MlSki8vC2RIM/qbkELGnHU9mznvugmRFBzgYIYSxg ovQI+7nh0F188YAVuQUGdmWzSbBLnC+ajw== X-Received: by 2002:a05:6000:1c8:b0:207:af9e:a4ec with SMTP id t8-20020a05600001c800b00207af9ea4ecmr3031721wrx.9.1650621880259; Fri, 22 Apr 2022 03:04:40 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:39 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/61] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?" Date: Fri, 22 Apr 2022 11:03:37 +0100 Message-Id: <20220422100432.2288247-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In process_mapti() we check interrupt IDs to see whether they are in the valid LPI range. Factor this out into its own utility function, as we're going to want it elsewhere too for GICv4. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-7-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index f8467b61ec5..a2462098445 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -79,6 +79,12 @@ typedef enum ItsCmdResult { CMD_CONTINUE = 1, } ItsCmdResult; +static inline bool intid_in_lpi_range(uint32_t id) +{ + return id >= GICV3_LPI_INTID_START && + id < (1 << (GICD_TYPER_IDBITS + 1)); +} + static uint64_t baser_base_addr(uint64_t value, uint32_t page_sz) { uint64_t result = 0; @@ -410,7 +416,6 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, uint32_t devid, eventid; uint32_t pIntid = 0; uint64_t num_eventids; - uint32_t num_intids; uint16_t icid = 0; DTEntry dte; ITEntry ite; @@ -438,7 +443,6 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, return CMD_STALL; } num_eventids = 1ULL << (dte.size + 1); - num_intids = 1ULL << (GICD_TYPER_IDBITS + 1); if (icid >= s->ct.num_entries) { qemu_log_mask(LOG_GUEST_ERROR, @@ -460,7 +464,7 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, return CMD_CONTINUE; } - if (pIntid < GICV3_LPI_INTID_START || pIntid >= num_intids) { + if (!intid_in_lpi_range(pIntid)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid interrupt ID 0x%x\n", __func__, pIntid); return CMD_CONTINUE; From patchwork Fri Apr 22 10:03:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564776 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp326881map; Fri, 22 Apr 2022 03:12:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUajvnLtBMBf1LMy4AS6zqaRDhkna3fQlHFdRZwT3FR+8d2R/b62v453ulFJCGgG/WIwN7 X-Received: by 2002:a0c:ab02:0:b0:443:a395:cc1c with SMTP id h2-20020a0cab02000000b00443a395cc1cmr2997802qvb.72.1650622332303; Fri, 22 Apr 2022 03:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622332; cv=none; d=google.com; s=arc-20160816; b=gfFMHKGkXMXWiS0i+dTUBN9AhH4EaZ0D1eZMGis8KnCIEWWhB07G2O9xhR37+GNMZ/ t2sn/12jW3fA80aXhABBNYXd9t509dGVxpQHl2MJW1KYibucOHX7xM+q4QVBPkCkrGo+ 4CQztXLqw2Tr6YibhaIiNb5+rr/TDRKvuhSxyKA9uK3YKCG088F4r6O8/cDOmVPsPmnm Fvmk/TsDoyjE949A+LiW5SVBOkSs7fFBTRNJqcLz065d5vElFSX096DxRY5kGMgBIulp W6yPeILQTPAX2ghmRKaxLr+Y9s6eH8nQVAYtKbxIP2mpE7knWmZPJEVo5xzvS0bQDoc1 rZNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=I+8r6HdyLDfSMNsAkocsqcRvO9Us4MwlveyivyaGjRg=; b=WlH+fo4zjqV0wJzWHLq6vR2RLrcY2ec7F4dyjzEaSGCuo9CXHswqbMm7i/MUVzX3Cu YKQs5+/+kIVZj/M1EtBRFmJuvOjsvHOxF+qoyYvtd29SJHzZpDaq0Jkz0RVC9XM18+yg FMBIyEysnCyXKF/+rShiDyzjLdfrJLY1AqTYJBZlhr/qLrte3WdLOdiH8bTayUJpS8bD hekOuUI7mH646FSxG9AODej+ChwrOYrxyhmz8cGniI/6JaoVfJEuTlz8xLXrVzinq7ox mpmSbjA/noiZKKs2pLfiQhVmmzzupQXnebt1fMzYfNhG6c2hD/4e3npc3meBSY2mVU6r I+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CA7xS+kS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g4-20020a05620a278400b0069ebef09b92si1938907qkp.58.2022.04.22.03.12.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:12:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CA7xS+kS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqGp-0002N0-MR for patch@linaro.org; Fri, 22 Apr 2022 06:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9c-0004EA-JP for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9a-0002aA-Lr for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:44 -0400 Received: by mail-wm1-x334.google.com with SMTP id bg25so4090795wmb.4 for ; Fri, 22 Apr 2022 03:04:42 -0700 (PDT) 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=I+8r6HdyLDfSMNsAkocsqcRvO9Us4MwlveyivyaGjRg=; b=CA7xS+kSriE4laVRHcBgz5HnjlEsFovIwHepM6V6sMnggiKTjwS4ubnLMhwM4MiIng 2jnT7MlHPo+HaTUszasL/UlWuq/atYmFFbtF0I2z3tvDkaoH78JKeLi0JCZ32btqEE0W Mw0IkOo8fLswR3L3/hZAU/8Bp4FSJ+5/sUkQ2Ib5aNgi3I/hwzmQjzUDgI3gkck+AimZ /+VdAQ2rKQZ3mDRZx/LU8CYPctEcX5Dpm4yF0h8Wo6nV415KpGm4gbdWpCv9t+C8s5iZ 91VjF1GUBLUScyoI1Tq7wYswMIM8anIRw3dygL5kvWLXABm6Ohr1GWX6QDVPA/EpTqiq nGSA== 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=I+8r6HdyLDfSMNsAkocsqcRvO9Us4MwlveyivyaGjRg=; b=VXvnQTwUaeBN3jN9uRdTx7kI+wVt2e/lUAY7xPoD7ecgY2n1N2eZ4Nf6cLktUHor2I pUwp2iVXavSF3chOpOT5xuwiix274zRJ3HjPY+J2xs9j37Yz7yPnTA/XYOlOBEbXHX61 wQvV/qDpwCN7LST9G7vIT2D1WMb8pU/q0yd5qhMCdPMBvt1haipB9NG4qJaJa/Lawzzn fPaZAC51HOgGkJ5l1+sWBB5OJmIBWUWFwOeaofmAOCPl0FpdTNB+n/FUWQtm39ttLLAx XPH3rV8Ke+j/APmhg74JgpKH+0xkNsG+t00f+jLIuWWsY0R0fFiNVhNCTMdBnK1AKfEW iBMA== X-Gm-Message-State: AOAM530YHnKbT6rCA6/HgPpEGOfdc1XMAjoFkylPaczmTwSYN6ZUAM1f piSHkEoT9waaleCDHpa6qII+dz6sZ4vq+Q== X-Received: by 2002:a05:600c:25c5:b0:38f:f0b9:4c8c with SMTP id 5-20020a05600c25c500b0038ff0b94c8cmr3536873wml.20.1650621881097; Fri, 22 Apr 2022 03:04:41 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:40 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/61] hw/intc/arm_gicv3_its: Implement GITS_BASER2 for GICv4 Date: Fri, 22 Apr 2022 11:03:38 +0100 Message-Id: <20220422100432.2288247-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The GICv4 defines a new in-guest-memory table for the ITS: this is the vPE table. Implement the new GITS_BASER2 register which the guest uses to tell the ITS where the vPE table is located, including the decode of the register fields into the TableDesc structure which we do for the GITS_BASER when the guest enables the ITS. We guard provision of the new register with the its_feature_virtual() function, which does a check of the GITS_TYPER.Virtual bit which indicates presence of ITS support for virtual LPIs. Since this bit is currently always zero, GICv4-specific features will not be accessible to the guest yet. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-8-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 16 ++++++++++++++++ include/hw/intc/arm_gicv3_its_common.h | 1 + hw/intc/arm_gicv3_its.c | 25 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index dec413f7cfa..4613b9e59ba 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -280,6 +280,7 @@ FIELD(GITS_CTLR, ENABLED, 0, 1) FIELD(GITS_CTLR, QUIESCENT, 31, 1) FIELD(GITS_TYPER, PHYSICAL, 0, 1) +FIELD(GITS_TYPER, VIRTUAL, 1, 1) FIELD(GITS_TYPER, ITT_ENTRY_SIZE, 4, 4) FIELD(GITS_TYPER, IDBITS, 8, 5) FIELD(GITS_TYPER, DEVBITS, 13, 5) @@ -298,6 +299,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_BASER_PAGESIZE_64K 2 #define GITS_BASER_TYPE_DEVICE 1ULL +#define GITS_BASER_TYPE_VPE 2ULL #define GITS_BASER_TYPE_COLLECTION 4ULL #define GITS_PAGE_SIZE_4K 0x1000 @@ -419,6 +421,20 @@ FIELD(DTE, ITTADDR, 6, 44) FIELD(CTE, VALID, 0, 1) FIELD(CTE, RDBASE, 1, RDBASE_PROCNUM_LENGTH) +/* + * 8 bytes VPE table entry size: + * Valid = 1 bit, VPTsize = 5 bits, VPTaddr = 36 bits, RDbase = 16 bits + * + * Field sizes for Valid and size are mandated; field sizes for RDbase + * and VPT_addr are IMPDEF. + */ +#define GITS_VPE_SIZE 0x8ULL + +FIELD(VTE, VALID, 0, 1) +FIELD(VTE, VPTSIZE, 1, 5) +FIELD(VTE, VPTADDR, 6, 36) +FIELD(VTE, RDBASE, 42, RDBASE_PROCNUM_LENGTH) + /* Special interrupt IDs */ #define INTID_SECURE 1020 #define INTID_NONSECURE 1021 diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h index 0f130494dd3..7d1cc0f7177 100644 --- a/include/hw/intc/arm_gicv3_its_common.h +++ b/include/hw/intc/arm_gicv3_its_common.h @@ -78,6 +78,7 @@ struct GICv3ITSState { TableDesc dt; TableDesc ct; + TableDesc vpet; CmdQDesc cq; Error *migration_blocker; diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index a2462098445..f9704c07591 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -79,6 +79,12 @@ typedef enum ItsCmdResult { CMD_CONTINUE = 1, } ItsCmdResult; +/* True if the ITS supports the GICv4 virtual LPI feature */ +static bool its_feature_virtual(GICv3ITSState *s) +{ + return s->typer & R_GITS_TYPER_VIRTUAL_MASK; +} + static inline bool intid_in_lpi_range(uint32_t id) { return id >= GICV3_LPI_INTID_START && @@ -946,6 +952,15 @@ static void extract_table_params(GICv3ITSState *s) idbits = 16; } break; + case GITS_BASER_TYPE_VPE: + td = &s->vpet; + /* + * For QEMU vPEIDs are always 16 bits. (GICv4.1 allows an + * implementation to implement fewer bits and report this + * via GICD_TYPER2.) + */ + idbits = 16; + break; default: /* * GITS_BASER.TYPE is read-only, so GITS_BASER_RO_MASK @@ -1425,6 +1440,7 @@ static void gicv3_its_reset(DeviceState *dev) /* * setting GITS_BASER0.Type = 0b001 (Device) * GITS_BASER1.Type = 0b100 (Collection Table) + * GITS_BASER2.Type = 0b010 (vPE) for GICv4 and later * GITS_BASER.Type,where n = 3 to 7 are 0b00 (Unimplemented) * GITS_BASER<0,1>.Page_Size = 64KB * and default translation table entry size to 16 bytes @@ -1442,6 +1458,15 @@ static void gicv3_its_reset(DeviceState *dev) GITS_BASER_PAGESIZE_64K); s->baser[1] = FIELD_DP64(s->baser[1], GITS_BASER, ENTRYSIZE, GITS_CTE_SIZE - 1); + + if (its_feature_virtual(s)) { + s->baser[2] = FIELD_DP64(s->baser[2], GITS_BASER, TYPE, + GITS_BASER_TYPE_VPE); + s->baser[2] = FIELD_DP64(s->baser[2], GITS_BASER, PAGESIZE, + GITS_BASER_PAGESIZE_64K); + s->baser[2] = FIELD_DP64(s->baser[2], GITS_BASER, ENTRYSIZE, + GITS_VPE_SIZE - 1); + } } static void gicv3_its_post_load(GICv3ITSState *s) From patchwork Fri Apr 22 10:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564784 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp333908map; Fri, 22 Apr 2022 03:22:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFc2X+N35H56Uc7GIfZ+y/wUPGlzAYydj43axBoHs3u/UgU8dnJBo9clbgrKzF4PeBhmye X-Received: by 2002:a05:6214:260b:b0:449:f39f:7c89 with SMTP id gu11-20020a056214260b00b00449f39f7c89mr2754808qvb.84.1650622928307; Fri, 22 Apr 2022 03:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622928; cv=none; d=google.com; s=arc-20160816; b=Kqbc2NEb90awbBC4k6FNZ9KzZ0nHnLE70WpQE3n8jRSWc27QGCb1fxLvUuM5aBMuIM eUlsrXRmXisEqcTb4c4Pp2UVK+6Yh9UgUZ0juvhSGvgO/Ywo6mRmmq5CB92Ygly0BbM1 hyAOVwvBfAouPK3XKN5t3cfKTQ89CDiEtVoyu6X7DmJ+i86GntRAGEv10z5E1IWTcIFp /0bZlcXhj51pbRRz+qQeB57aYdD7Tp2nidUbwJx2kNIrLY7NKZYOO/VlsIH3Zsag2R85 vonGmACSxyogfAD1K4RA9hnYXl4u/lyms//Emo7R8YGxEF+mYG5X8QwhRx1EBNBKnLoY jm6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Iyy9EqxwlVZCqOVtM7LRAHzdMyn2Ivljkfto580g+2g=; b=YzVlyNjuw3MPmY64heSm8uIlcUr3APRL2XYPhtI6VFHlSb/bQIBfamFmR/0LYayld0 niFFQ7nGP6lwA3FL+tMEyoFTlXXjjTc9uXRsbp04YKsGBu2eVXxDDKs8nmMm81fKR0pa P7TukaVQe7ac+dl4xN7yaTcX52psQ497XpT1NjryGiuWNjOTPT4XtvvqAQUO7vPDLcYB dpUf8pfvEpd/3fmyQtK6WKnhbsNCpOTTi1bgq47mhE6dkM7mkx4HXl4jc8Kukgs8Cfb7 DedqPqYfbKpq65VA5iV3W8N5KYQrRXOSrbWMDshwcw6afJsMTK3xGmo9jP/nxjk3T65A UNeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V5ApZ4u7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n13-20020a05620a294d00b0069c4a3c4fe8si1339442qkp.479.2022.04.22.03.22.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:22:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V5ApZ4u7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqQR-0005vv-Qq for patch@linaro.org; Fri, 22 Apr 2022 06:22:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9d-0004EB-Bm for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:48 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:39608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9b-0002aH-GR for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:45 -0400 Received: by mail-wr1-x433.google.com with SMTP id m14so10319703wrb.6 for ; Fri, 22 Apr 2022 03:04:43 -0700 (PDT) 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=Iyy9EqxwlVZCqOVtM7LRAHzdMyn2Ivljkfto580g+2g=; b=V5ApZ4u71jJ8zljRy5kZSeA2kRKvjcwHbeefpY38/rUG747cmZoDUo15/KFPpCGxpY YSfbPhLfYdykesy/yxULWZfsESkY3/pA61vHA7hmZDTHMHcmwS6AwVpgKvG4LNnktAeL mfmdbNerrp9tW6FVSIdsTnowntfQ15Ga3qCNwlfHkGrp5WiiOTEm9D/QjHebtYkbQ+tB VoV7OdLdEGDeie4ERgeR38QeFUcoLlfGn1ACzaB4/3y21b4DQpegPKLbWagfZQoDU8Np bCSFNfusUjwWMvxq6IINzntIRmXX53As9rodoeBUWa9GVVmusoRmP+kSt3zO8jk75gW4 jHuA== 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=Iyy9EqxwlVZCqOVtM7LRAHzdMyn2Ivljkfto580g+2g=; b=3zRTfZXYXzzOf7AOEd+q0gHIkPh81QHRPU5yEUXVkuCB6kx1l6HwR1KMwhI5YRPijI HaQC+fHySIiUlLJBsZfzI35ESmd8Tr0jagg+u0MJ3JPGEqMNUkv0fI9GPWqgd0mnCyAD sQ40QhGV/2jYFQdx95ybbd6K2PaTbQ7P/DKO58fhn/COur/wtOAU7EHsSNHbDGLTEkFu a3PJi7gOJpRF/baN2duo4VkHiwcUs9DpoGLfDJaujT8zpoY8YCYJUMMDtO1NHj1IHhqb 1NibdkE/Y5ZhOMVI+xn3kRtnXFXii4sejNEst58qL6HSVUgqu4+alfZ/BMMahEPg7uV2 CRGw== X-Gm-Message-State: AOAM531c4U9nLQFM1RLTCpy5MCFs8e7vG1ljI/53Pwdbp8EX598X3RJG I7lnjQ+eQoPL5OGwrDtDl1o5Fysjw68o6g== X-Received: by 2002:a5d:4ed2:0:b0:207:b7f7:d02f with SMTP id s18-20020a5d4ed2000000b00207b7f7d02fmr3154723wrv.593.1650621882029; Fri, 22 Apr 2022 03:04:42 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:41 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/61] hw/intc/arm_gicv3_its: Implement VMAPI and VMAPTI Date: Fri, 22 Apr 2022 11:03:39 +0100 Message-Id: <20220422100432.2288247-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the GICv4 VMAPI and VMAPTI commands. These write an interrupt translation table entry that maps (DeviceID,EventID) to (vPEID,vINTID,doorbell). The only difference between VMAPI and VMAPTI is that VMAPI assumes vINTID == EventID rather than both being specified in the command packet. (This code won't be reachable until we allow the GIC version to be set to 4. Support for reading this new virtual-interrupt DTE and handling it correctly will be implemented in a later commit.) Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-9-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 9 ++++ hw/intc/arm_gicv3_its.c | 91 ++++++++++++++++++++++++++++++++++++++++ hw/intc/trace-events | 2 + 3 files changed, 102 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 4613b9e59ba..d3670a8894e 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -329,6 +329,8 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_INVALL 0x0D #define GITS_CMD_MOVALL 0x0E #define GITS_CMD_DISCARD 0x0F +#define GITS_CMD_VMAPTI 0x2A +#define GITS_CMD_VMAPI 0x2B /* MAPC command fields */ #define ICID_LENGTH 16 @@ -368,6 +370,13 @@ FIELD(MOVI_0, DEVICEID, 32, 32) FIELD(MOVI_1, EVENTID, 0, 32) FIELD(MOVI_2, ICID, 0, 16) +/* VMAPI, VMAPTI command fields */ +FIELD(VMAPTI_0, DEVICEID, 32, 32) +FIELD(VMAPTI_1, EVENTID, 0, 32) +FIELD(VMAPTI_1, VPEID, 32, 16) +FIELD(VMAPTI_2, VINTID, 0, 32) /* VMAPTI only */ +FIELD(VMAPTI_2, DOORBELL, 32, 32) + /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index f9704c07591..8aed57e7040 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -91,6 +91,12 @@ static inline bool intid_in_lpi_range(uint32_t id) id < (1 << (GICD_TYPER_IDBITS + 1)); } +static inline bool valid_doorbell(uint32_t id) +{ + /* Doorbell fields may be an LPI, or 1023 to mean "no doorbell" */ + return id == INTID_SPURIOUS || intid_in_lpi_range(id); +} + static uint64_t baser_base_addr(uint64_t value, uint32_t page_sz) { uint64_t result = 0; @@ -486,6 +492,85 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; } +static ItsCmdResult process_vmapti(GICv3ITSState *s, const uint64_t *cmdpkt, + bool ignore_vintid) +{ + uint32_t devid, eventid, vintid, doorbell, vpeid; + uint32_t num_eventids; + DTEntry dte; + ITEntry ite; + + if (!its_feature_virtual(s)) { + return CMD_CONTINUE; + } + + devid = FIELD_EX64(cmdpkt[0], VMAPTI_0, DEVICEID); + eventid = FIELD_EX64(cmdpkt[1], VMAPTI_1, EVENTID); + vpeid = FIELD_EX64(cmdpkt[1], VMAPTI_1, VPEID); + doorbell = FIELD_EX64(cmdpkt[2], VMAPTI_2, DOORBELL); + if (ignore_vintid) { + vintid = eventid; + trace_gicv3_its_cmd_vmapi(devid, eventid, vpeid, doorbell); + } else { + vintid = FIELD_EX64(cmdpkt[2], VMAPTI_2, VINTID); + trace_gicv3_its_cmd_vmapti(devid, eventid, vpeid, vintid, doorbell); + } + + if (devid >= s->dt.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid DeviceID 0x%x (must be less than 0x%x)\n", + __func__, devid, s->dt.num_entries); + return CMD_CONTINUE; + } + + if (get_dte(s, devid, &dte) != MEMTX_OK) { + return CMD_STALL; + } + + if (!dte.valid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: no entry in device table for DeviceID 0x%x\n", + __func__, devid); + return CMD_CONTINUE; + } + + num_eventids = 1ULL << (dte.size + 1); + + if (eventid >= num_eventids) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: EventID 0x%x too large for DeviceID 0x%x " + "(must be less than 0x%x)\n", + __func__, eventid, devid, num_eventids); + return CMD_CONTINUE; + } + if (!intid_in_lpi_range(vintid)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: VIntID 0x%x not a valid LPI\n", + __func__, vintid); + return CMD_CONTINUE; + } + if (!valid_doorbell(doorbell)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Doorbell %d not 1023 and not a valid LPI\n", + __func__, doorbell); + return CMD_CONTINUE; + } + if (vpeid >= s->vpet.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: VPEID 0x%x out of range (must be less than 0x%x)\n", + __func__, vpeid, s->vpet.num_entries); + return CMD_CONTINUE; + } + /* add ite entry to interrupt translation table */ + ite.valid = true; + ite.inttype = ITE_INTTYPE_VIRTUAL; + ite.intid = vintid; + ite.icid = 0; + ite.doorbell = doorbell; + ite.vpeid = vpeid; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; +} + /* * Update the Collection Table entry for @icid to @cte. Returns true * on success, false if there was a memory access error. @@ -872,6 +957,12 @@ static void process_cmdq(GICv3ITSState *s) case GITS_CMD_MOVALL: result = process_movall(s, cmdpkt); break; + case GITS_CMD_VMAPTI: + result = process_vmapti(s, cmdpkt, false); + break; + case GITS_CMD_VMAPI: + result = process_vmapti(s, cmdpkt, true); + break; default: trace_gicv3_its_cmd_unknown(cmd); break; diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 53414aa1979..c6b2b9ab459 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -187,6 +187,8 @@ gicv3_its_cmd_mapti(uint32_t devid, uint32_t eventid, uint32_t icid, uint32_t in gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INVALL" gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVALL RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" +gicv3_its_cmd_vmapi(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x Dbell_pINTID 0x%x" +gicv3_its_cmd_vmapti(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t vintid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x vINTID 0x%x Dbell_pINTID 0x%x" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" From patchwork Fri Apr 22 10:03:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564781 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp332140map; Fri, 22 Apr 2022 03:19:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwXRzyfFSbkMcBtqHsOUWgEwXVtlZzlFv311dubYz9MmeDorckq5d4qpzSD0TI2+khdY0w X-Received: by 2002:ae9:ed4b:0:b0:69e:7169:7f35 with SMTP id c72-20020ae9ed4b000000b0069e71697f35mr2069745qkg.69.1650622780902; Fri, 22 Apr 2022 03:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622780; cv=none; d=google.com; s=arc-20160816; b=qPReLl43LHBkXF4A9HDtp3ZzwCrC8VyRbsliSKeyPWBPd5jU1hbP3q/+O6Vy8HpOKT dUoTtwoFxiK1aRL5dBZ6eElTYChZyqzK/mH0Qktw8SxY9kxCxqgaeefksPZ9abEDWVo0 eHh8/pxWfEX3qEHOO2oqHkJwI03y2zF22poDC38sQm53wZykenTjl+P5PtAC6WNQEmcN aPl0L0lE9NqssPflB/+QiYKloOecp8gMJAvOP8XVojazythVrrckV9PHLYWn7QwPVw4s r1GHu0WzYgKFizmGuU8KfA74LDg1Aotqu+YTIYk072HCRuNZG7kYvxzQaP2JwqPpcTlM PfGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VXuFbzZjCf1PlSy1g0YLTlpUCyHi9JXwBsfwU+Cdrqg=; b=uPkCrqzszKgZv5bdRk1zhyj0aJ7IUJp7JlnOKxwwSNMABdnB1tcJnvtRs/sZfZvWqS b97y9HZWh/wdGU8l3zKZJrIT81f+j55UtAYFpDCk6b8Gs11t/NUEL/2oO29tQZCi3v4q ES67Xez7nlVkQ1mCgVX7piKF2tFjokGIbzFn3VZPZYvwu9CIV1Gbq2lnUsVR5DQy50+w 2ImPDD1DUMjs/NJ6pPRQE4ZeDoWMG690n2L4g5u4iAWSAlLnT2GMNvVF21FQ6DcP1z8z JQSXlfxEHfmCPbSYbzfTtOBEGjeUYFBgM0O0PAWF3oxWg3ZKIEe294rhn27hYfCzl+Oi Fpbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bO+1ekqZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u7-20020a05622a010700b002f3578ec717si574599qtw.166.2022.04.22.03.19.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:19:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bO+1ekqZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqO4-0002Go-Ax for patch@linaro.org; Fri, 22 Apr 2022 06:19:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9e-0004ET-Df for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:48 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:39611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9c-0002aZ-Gw for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:46 -0400 Received: by mail-wr1-x436.google.com with SMTP id m14so10319762wrb.6 for ; Fri, 22 Apr 2022 03:04:44 -0700 (PDT) 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=VXuFbzZjCf1PlSy1g0YLTlpUCyHi9JXwBsfwU+Cdrqg=; b=bO+1ekqZMU2LeIKzIp1NmCncTZcV9ZDm4zJly0P96IO8njJ4IZAK8Qe5s76v9DXL9l Ytl3+kp5DNnK9skLslU1FTtJyHj3K8xJzQPYdXG1rraVJKqCCT1kneoGRrmEuK4o+5v/ GQo2NhF0BcvLbGO6n9Qz+jptqsbc/gq5UeVpC6ygv5s3z4CKpJypULu6Hj2+yPVHAen7 QFBCeqhLOBwARwZUWva421weNMgJCO07FdPnDovkX61HeUc/794DzAJFWEWOHHsdENRt rnwX9x8IP9ew5lb2rhaV77B0JwssM0SgkDuyz6LNI3utzOpbdMoHqfgoCWZCyjLr0+5r Kj1w== 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=VXuFbzZjCf1PlSy1g0YLTlpUCyHi9JXwBsfwU+Cdrqg=; b=KdFHiXNXBMEwIDOWuMQwM8zPAJZXXSqar75Itz8XmtS6N5h2IWpxdrsVu4ZCImz7d+ XMzLyLsv7ZLLrXeUG6mBMIL1sj+WLfUKfbQV6DO3Mxd2E84WbLbNLqE2LGCOWMygi4Ab 8a4+F3qrWE4DN2WnEliQPsYsfHkEpaFBwvKMOqmwGTqVEY0sQgMbeupM38O/JOs+tYiG OnVsi+fO5k168p5aPf8aB6wjN7pEV25lfuOnrOKzNOv0vhmqseErtXEtVdIQaOiu1Dtk XwTljQqB2oHj5yETw0rZ31SFAS0QviWzWeukAtY+lz6eU4brQv0TEY/3cTGRc3bunale dW8A== X-Gm-Message-State: AOAM532DeBXqBs6gzAMpvcehDNXbuccP+oziqkSWm0xbDZEcBecJK4eg PK4jGJpCfz+KqGZJMtHli4zpd4lrn1PYmQ== X-Received: by 2002:a05:6000:8b:b0:207:b80e:c711 with SMTP id m11-20020a056000008b00b00207b80ec711mr3121689wrx.178.1650621883200; Fri, 22 Apr 2022 03:04:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:42 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/61] hw/intc/arm_gicv3_its: Implement VMAPP Date: Fri, 22 Apr 2022 11:03:40 +0100 Message-Id: <20220422100432.2288247-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the GICv4 VMAPP command, which writes an entry to the vPE table. For GICv4.1 this command has extra fields in the command packet and additional behaviour. We define the 4.1-only fields with the FIELD macro, but only implement the GICv4.0 version of the command. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-10-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 12 ++++++ hw/intc/arm_gicv3_its.c | 88 ++++++++++++++++++++++++++++++++++++++++ hw/intc/trace-events | 2 + 3 files changed, 102 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index d3670a8894e..bbb8a20ce61 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -329,6 +329,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_INVALL 0x0D #define GITS_CMD_MOVALL 0x0E #define GITS_CMD_DISCARD 0x0F +#define GITS_CMD_VMAPP 0x29 #define GITS_CMD_VMAPTI 0x2A #define GITS_CMD_VMAPI 0x2B @@ -377,6 +378,17 @@ FIELD(VMAPTI_1, VPEID, 32, 16) FIELD(VMAPTI_2, VINTID, 0, 32) /* VMAPTI only */ FIELD(VMAPTI_2, DOORBELL, 32, 32) +/* VMAPP command fields */ +FIELD(VMAPP_0, ALLOC, 8, 1) /* GICv4.1 only */ +FIELD(VMAPP_0, PTZ, 9, 1) /* GICv4.1 only */ +FIELD(VMAPP_0, VCONFADDR, 16, 36) /* GICv4.1 only */ +FIELD(VMAPP_1, DEFAULT_DOORBELL, 0, 32) /* GICv4.1 only */ +FIELD(VMAPP_1, VPEID, 32, 16) +FIELD(VMAPP_2, RDBASE, 16, 36) +FIELD(VMAPP_2, V, 63, 1) +FIELD(VMAPP_3, VPTSIZE, 0, 8) /* For GICv4.0, bits [7:6] are RES0 */ +FIELD(VMAPP_3, VPTADDR, 16, 36) + /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 8aed57e7040..880bc6f647c 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -61,6 +61,12 @@ typedef struct ITEntry { uint32_t vpeid; } ITEntry; +typedef struct VTEntry { + bool valid; + unsigned vptsize; + uint32_t rdbase; + uint64_t vptaddr; +} VTEntry; /* * The ITS spec permits a range of CONSTRAINED UNPREDICTABLE options @@ -842,6 +848,85 @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) return update_ite(s, eventid, &dte, &old_ite) ? CMD_CONTINUE : CMD_STALL; } +/* + * Update the vPE Table entry at index @vpeid with the entry @vte. + * Returns true on success, false if there was a memory access error. + */ +static bool update_vte(GICv3ITSState *s, uint32_t vpeid, const VTEntry *vte) +{ + AddressSpace *as = &s->gicv3->dma_as; + uint64_t entry_addr; + uint64_t vteval = 0; + MemTxResult res = MEMTX_OK; + + trace_gicv3_its_vte_write(vpeid, vte->valid, vte->vptsize, vte->vptaddr, + vte->rdbase); + + if (vte->valid) { + vteval = FIELD_DP64(vteval, VTE, VALID, 1); + vteval = FIELD_DP64(vteval, VTE, VPTSIZE, vte->vptsize); + vteval = FIELD_DP64(vteval, VTE, VPTADDR, vte->vptaddr); + vteval = FIELD_DP64(vteval, VTE, RDBASE, vte->rdbase); + } + + entry_addr = table_entry_addr(s, &s->vpet, vpeid, &res); + if (res != MEMTX_OK) { + return false; + } + if (entry_addr == -1) { + /* No L2 table for this index: discard write and continue */ + return true; + } + address_space_stq_le(as, entry_addr, vteval, MEMTXATTRS_UNSPECIFIED, &res); + return res == MEMTX_OK; +} + +static ItsCmdResult process_vmapp(GICv3ITSState *s, const uint64_t *cmdpkt) +{ + VTEntry vte; + uint32_t vpeid; + + if (!its_feature_virtual(s)) { + return CMD_CONTINUE; + } + + vpeid = FIELD_EX64(cmdpkt[1], VMAPP_1, VPEID); + vte.rdbase = FIELD_EX64(cmdpkt[2], VMAPP_2, RDBASE); + vte.valid = FIELD_EX64(cmdpkt[2], VMAPP_2, V); + vte.vptsize = FIELD_EX64(cmdpkt[3], VMAPP_3, VPTSIZE); + vte.vptaddr = FIELD_EX64(cmdpkt[3], VMAPP_3, VPTADDR); + + trace_gicv3_its_cmd_vmapp(vpeid, vte.rdbase, vte.valid, + vte.vptaddr, vte.vptsize); + + /* + * For GICv4.0 the VPT_size field is only 5 bits, whereas we + * define our field macros to include the full GICv4.1 8 bits. + * The range check on VPT_size will catch the cases where + * the guest set the RES0-in-GICv4.0 bits [7:6]. + */ + if (vte.vptsize > FIELD_EX64(s->typer, GITS_TYPER, IDBITS)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid VPT_size 0x%x\n", __func__, vte.vptsize); + return CMD_CONTINUE; + } + + if (vte.valid && vte.rdbase >= s->gicv3->num_cpu) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid rdbase 0x%x\n", __func__, vte.rdbase); + return CMD_CONTINUE; + } + + if (vpeid >= s->vpet.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: VPEID 0x%x out of range (must be less than 0x%x)\n", + __func__, vpeid, s->vpet.num_entries); + return CMD_CONTINUE; + } + + return update_vte(s, vpeid, &vte) ? CMD_CONTINUE : CMD_STALL; +} + /* * Current implementation blocks until all * commands are processed @@ -963,6 +1048,9 @@ static void process_cmdq(GICv3ITSState *s) case GITS_CMD_VMAPI: result = process_vmapti(s, cmdpkt, true); break; + case GITS_CMD_VMAPP: + result = process_vmapp(s, cmdpkt); + break; default: trace_gicv3_its_cmd_unknown(cmd); break; diff --git a/hw/intc/trace-events b/hw/intc/trace-events index c6b2b9ab459..2fcc9e40e55 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -189,6 +189,7 @@ gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVALL RDba gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" gicv3_its_cmd_vmapi(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x Dbell_pINTID 0x%x" gicv3_its_cmd_vmapti(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t vintid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x vINTID 0x%x Dbell_pINTID 0x%x" +gicv3_its_cmd_vmapp(uint32_t vpeid, uint64_t rdbase, int valid, uint64_t vptaddr, uint32_t vptsize) "GICv3 ITS: command VMAPP vPEID 0x%x RDbase 0x%" PRIx64 " V %d VPT_addr 0x%" PRIx64 " VPT_size 0x%x" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" @@ -199,6 +200,7 @@ gicv3_its_ite_write(uint64_t ittaddr, uint32_t eventid, int valid, int inttype, gicv3_its_dte_read(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table read for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 gicv3_its_dte_write(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table write for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 gicv3_its_dte_read_fault(uint32_t devid) "GICv3 ITS: Device Table read for DeviceID 0x%x: faulted" +gicv3_its_vte_write(uint32_t vpeid, int valid, uint32_t vptsize, uint64_t vptaddr, uint32_t rdbase) "GICv3 ITS: vPE Table write for vPEID 0x%x: valid %d VPTsize 0x%x VPTaddr 0x%" PRIx64 " RDbase 0x%x" # armv7m_nvic.c nvic_recompute_state(int vectpending, int vectpending_prio, int exception_prio) "NVIC state recomputed: vectpending %d vectpending_prio %d exception_prio %d" From patchwork Fri Apr 22 10:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564789 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp340644map; Fri, 22 Apr 2022 03:31:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyec2IKCqSACFLx4RGJXWbROsEAlC58xmphPQI3PrUHSX2d9+b8jlS+hA9/eWhByA0hSwdg X-Received: by 2002:a05:622a:6205:b0:2f1:e9d9:df34 with SMTP id hj5-20020a05622a620500b002f1e9d9df34mr2581511qtb.86.1650623510097; Fri, 22 Apr 2022 03:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623510; cv=none; d=google.com; s=arc-20160816; b=U/CzrMaMVeJDgmUgHEl/G8VJxQgKFcTSIDXy9IiW31w6J/QnttSRcrBWl9nfIW+zoz 7vAqslRO4b/bhcKae0LZ21lQUxMHSTN7BukXcREmyEtRP/LPSQO7TYeL3HXp493j4lLH 69xatPDirZtb2vItbmj0hyTLnrS5/nKMiLsn7kHyZM+bnm+qlPLMgRQ7ADZKWQgQ20NB AXcwZWONOFqZioIPUiXIpelQLFj82eqsQJZ2vB26NxuAfTf1Rq9rymdaTRZwMirr0csN GyEHGpadMOsoTnpDq2d3Pe7ge4lMXWDQ+q2R+KCrrrewnlRFGtqiD9oD3juLZ9T5Nc1l zbFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=vSeSHouskJxqnlYzDYeYh5s4IUZC1L12qjNbT0z95D3oauoLgho6osfbH3/p1hDtr8 szAbymD55z2gd9TZt7mHdwmDdOougBe3ZGVoK3upCj9BQoBH7taFbgOSMRojXS4fEfWO wyMQX2yN6tFy8giHC/1OErqlKRkcHGAL7Mkuo39tZGRV036nuwbNItHsxsHOJ8o0PQsi xNyN6gY36EDRP6Sddkxo3PanHBgc72/B2NRfVPvORNv9rMMioMWcDsZOGd0GLrovrf4P 59uZzJgvXQe6Smubzpvyo4AAcOq0vryr7fwKgRsMw95ueeC54MoRkMp9qdC59Vqz6DYU xmWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9ddXcVx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l20-20020a05622a051400b002f34c9a3c1esi1262592qtx.474.2022.04.22.03.31.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:31:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9ddXcVx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqZp-0005mN-ID for patch@linaro.org; Fri, 22 Apr 2022 06:31:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58324) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9f-0004Eg-6C for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:49 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:34763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9d-0002ah-F1 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:46 -0400 Received: by mail-wr1-x42e.google.com with SMTP id c10so10334541wrb.1 for ; Fri, 22 Apr 2022 03:04:45 -0700 (PDT) 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=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=J9ddXcVxdyYgoyQintDV4POXii7agiIKzE+ReamVH9m9COd3zGDyGBCbcptb6Vtzl1 696/BAFlN7Zi2ViRv9SfYdn9lHv3o0d+JdYectPdr9GIREVAbAxzei/VH2OLoYyEoTQE KaKlUUPvycfOZpBhyf6zdFU30XdJtTgD6bzd+MQc3ZidERPs3Att8SdGDqnxt0WqJMlt eEsxQxPu3fzfqKrgQmklKvJqL4V5hQ8DfGgAArs163d1b4HhaBvvARCcuuxcpr4remUH kQR5E4NasQ9VzBWtSscJSM6nYl1+aFNoN7Qa4eAC0P+l2xmTRQlJvQfyWZu79nZqnp/r LYSQ== 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=5uD+m1v7OaY8Vt76UhAAZWA6827cTfQzBkx7Ps8s2No=; b=LmTwJ7UjTIj3zmGo2ITt+ytxYXq4t6gFbT4ZCekg7YgYi0dMxzxq9q5JVVqpaY4oeo UGZwNN31Wzvev2OZJxxxOXZBzG1eqz4XgQi4/7fs3pVYOcsAHy20G4tgPujoS3kp64B0 LI0350tJXZgbiHCJT/90dD4le8zZ3IH/kaWZCn5GNGw4BdFQr9i5ZM712qDjxn4jVpPn vPhOkf1yiO2g9fAecW0PyK5pgVVtjnjLsBkJcqTByQQFbPRWj2dhji9ExkKFsv22+o1m qjJcYAVl0lTYDn50NYhZKCOy6FYkQkK0nET8WZjAMklbQkCJKgdcyffHPFTAPIitlCA0 wxdw== X-Gm-Message-State: AOAM5327Pn4RA0ugiCLod7W8ovhbK/s7HwxfVLIKQ6wglGTkLbiIxLDj yozB7/BtGWrK93qYD3NaG6CpxlsxCV9STg== X-Received: by 2002:a5d:48ce:0:b0:20a:bb9b:62a3 with SMTP id p14-20020a5d48ce000000b0020abb9b62a3mr3050360wrs.307.1650621883994; Fri, 22 Apr 2022 03:04:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/61] hw/intc/arm_gicv3_its: Distinguish success and error cases of CMD_CONTINUE Date: Fri, 22 Apr 2022 11:03:41 +0100 Message-Id: <20220422100432.2288247-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In the ItsCmdResult enum, we currently distinguish only CMD_STALL (failure, stall processing of the command queue) and CMD_CONTINUE (keep processing the queue), and we use the latter both for "there was a parameter error, go on to the next command" and "the command succeeded, go on to the next command". Sometimes we would like to distinguish those two cases, so add CMD_CONTINUE_OK to the enum to represent the success situation, and use it in the relevant places. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-11-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 880bc6f647c..179a9b032c2 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -78,11 +78,13 @@ typedef struct VTEntry { * and continue processing. * The process_* functions which handle individual ITS commands all * return an ItsCmdResult which tells process_cmdq() whether it should - * stall or keep going. + * stall, keep going because of an error, or keep going because the + * command was a success. */ typedef enum ItsCmdResult { CMD_STALL = 0, CMD_CONTINUE = 1, + CMD_CONTINUE_OK = 2, } ItsCmdResult; /* True if the ITS supports the GICv4 virtual LPI feature */ @@ -400,9 +402,9 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, ITEntry ite = {}; /* remove mapping from interrupt translation table */ ite.valid = false; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STALL; } - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } static ItsCmdResult process_its_cmd(GICv3ITSState *s, const uint64_t *cmdpkt, @@ -495,7 +497,7 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, ite.icid = icid; ite.doorbell = INTID_SPURIOUS; ite.vpeid = 0; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STALL; } static ItsCmdResult process_vmapti(GICv3ITSState *s, const uint64_t *cmdpkt, @@ -574,7 +576,7 @@ static ItsCmdResult process_vmapti(GICv3ITSState *s, const uint64_t *cmdpkt, ite.icid = 0; ite.doorbell = doorbell; ite.vpeid = vpeid; - return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STALL; } /* @@ -635,7 +637,7 @@ static ItsCmdResult process_mapc(GICv3ITSState *s, const uint64_t *cmdpkt) return CMD_CONTINUE; } - return update_cte(s, icid, &cte) ? CMD_CONTINUE : CMD_STALL; + return update_cte(s, icid, &cte) ? CMD_CONTINUE_OK : CMD_STALL; } /* @@ -696,7 +698,7 @@ static ItsCmdResult process_mapd(GICv3ITSState *s, const uint64_t *cmdpkt) return CMD_CONTINUE; } - return update_dte(s, devid, &dte) ? CMD_CONTINUE : CMD_STALL; + return update_dte(s, devid, &dte) ? CMD_CONTINUE_OK : CMD_STALL; } static ItsCmdResult process_movall(GICv3ITSState *s, const uint64_t *cmdpkt) @@ -725,13 +727,13 @@ static ItsCmdResult process_movall(GICv3ITSState *s, const uint64_t *cmdpkt) if (rd1 == rd2) { /* Move to same target must succeed as a no-op */ - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } /* Move all pending LPIs from redistributor 1 to redistributor 2 */ gicv3_redist_movall_lpis(&s->gicv3->cpu[rd1], &s->gicv3->cpu[rd2]); - return CMD_CONTINUE; + return CMD_CONTINUE_OK; } static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) @@ -845,7 +847,7 @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) /* Update the ICID field in the interrupt translation table entry */ old_ite.icid = new_icid; - return update_ite(s, eventid, &dte, &old_ite) ? CMD_CONTINUE : CMD_STALL; + return update_ite(s, eventid, &dte, &old_ite) ? CMD_CONTINUE_OK : CMD_STALL; } /* @@ -924,7 +926,7 @@ static ItsCmdResult process_vmapp(GICv3ITSState *s, const uint64_t *cmdpkt) return CMD_CONTINUE; } - return update_vte(s, vpeid, &vte) ? CMD_CONTINUE : CMD_STALL; + return update_vte(s, vpeid, &vte) ? CMD_CONTINUE_OK : CMD_STALL; } /* @@ -963,7 +965,7 @@ static void process_cmdq(GICv3ITSState *s) } while (wr_offset != rd_offset) { - ItsCmdResult result = CMD_CONTINUE; + ItsCmdResult result = CMD_CONTINUE_OK; void *hostmem; hwaddr buflen; uint64_t cmdpkt[GITS_CMDQ_ENTRY_WORDS]; @@ -1055,7 +1057,8 @@ static void process_cmdq(GICv3ITSState *s) trace_gicv3_its_cmd_unknown(cmd); break; } - if (result == CMD_CONTINUE) { + if (result != CMD_STALL) { + /* CMD_CONTINUE or CMD_CONTINUE_OK */ rd_offset++; rd_offset %= s->cq.num_entries; s->creadr = FIELD_DP64(s->creadr, GITS_CREADR, OFFSET, rd_offset); From patchwork Fri Apr 22 10:03:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564779 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp329074map; Fri, 22 Apr 2022 03:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkDF/ZyX3HU+K8oQXA5PjuVUNYaswXRkODghmeR7EoAi1MA5o9+/BSLlwEBfhY+6kAAMnG X-Received: by 2002:a05:622a:14a:b0:2f1:ff33:89e5 with SMTP id v10-20020a05622a014a00b002f1ff3389e5mr2507516qtw.678.1650622513078; Fri, 22 Apr 2022 03:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622513; cv=none; d=google.com; s=arc-20160816; b=sCKdS6K1A0D9yEggbJ3t+viZHy+rVF0b5smpNH9E02i0deVEsVHLNTFwzofgYrDkPg b4UDCU98HoWPu6JMMErex+nIU+2bEc/r/DhyxPrXIU1LQdgAfmn+xASMpwuinOQ/jQqV +MqHlKIJKIy1gUMu6QDHmoUePSy6tWaH42Bl3tQ4uGacssqtzr/6CQf6I9AhsJLJ5QBt 15n5ACQJPE3xEqF0bIpHmrBWbUUwFm3iGdLek+WXe4gWLnE9kdgxhgw8ehT7XGVbibj9 S3Y7o4h8N1qbJ7uyjPsBx7K0m5u7WVXZ9N5b0twF5uS1vctCURKaNamdg6yvyYRJDufr F68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jWdp/zYXmce0jcV8IFNr0A3WhWo/fJGJjHVaToScuuU=; b=ti0EZvxG7O3ZGY73NXFAA5cInakg5tyHF+6JCEuXE04GWQSuQQeD5FOZt9S+9ZBO4A TVU5kPujGBOLLXscrSU4U45+nChBqXMzWoSx7Hz1NvTMlATAAZIJX0Ml6WR4t3svvdSY MtkYqT8iJkLKS9Sb6bhzgPhd4KD0ck780C4Lf3pk8wbYyKF4IvsZJYtUTVmPrfHkA8Ia XKaLDU+C/d2FRDlFLEg5XVgv+W32WLk8KJiF5KBkcOgJyHUoYpvAjOA/wAsEuC4GsQyB DvqrGBeH87rMs9oO4qXdZJmXZBZi5/VXWDPtmqjQI/PNx9aoGRoHNcjvKN7MNh9CUjPa 4k2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WpitD8p+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z20-20020ac87f94000000b002e1fbf3bf93si2044406qtj.388.2022.04.22.03.15.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:15:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WpitD8p+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqJk-0004jF-Ky for patch@linaro.org; Fri, 22 Apr 2022 06:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9f-0004Ei-VW for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:50 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:33690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9e-0002ar-7U for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:47 -0400 Received: by mail-wr1-x436.google.com with SMTP id x18so10354818wrc.0 for ; Fri, 22 Apr 2022 03:04:45 -0700 (PDT) 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=jWdp/zYXmce0jcV8IFNr0A3WhWo/fJGJjHVaToScuuU=; b=WpitD8p+xH3MqcBqvNdfqAoOI9S9fK9JCeRxNPDjnYMU2VnWpj51ggPPGxhGrMuuMy BYPs/Ykl1e1Tw07KsF+gL5nRuUyuIwKKNnPGu/7u5D3YASgi/Z6Jnvmlqx3wOqrn9+69 mxC8f5JheI3CQ+ANz45j/hpyyJSG+RMahukhP4zr/7gpAJLu0ie+bD2Qc7TKdnKrdp9f i6APQ+5fqMywabb1veLNpTg8cO3U0RKW3nSPmQUWuPD8P8afNgTVz6dafo30dpD9xQXt 3YtMTs1wqcVvqd1su0QtDhZaot2SVgR+gtg32CqdWXMZ9wK5MChyiibvkXFX5wKcesrM PXRQ== 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=jWdp/zYXmce0jcV8IFNr0A3WhWo/fJGJjHVaToScuuU=; b=2B8NgAd+fPf327JVEJ8xJ6F5ad/EZcmu4e3UOKlGFmaTGgzwS/MPdvu37+up+NaUPC vhkUxoRWEc+d+qShA1emymxsnxklkiw4P1ABSlzHtMznMa9dzNiocG2vrCZoZtQCPBGv Fa7hP5xHAzJRbMCIRC10amRHIo3qZalLz84SRWgBvKccJp2SIbp7r3b5ZTyAYL64Djao isubWJIrjmkY2gojN+3746wJWlpzI4BvIfp+61SiR/0XAwLFp6k335NDzvN8L2G5GH5E 1lFm1PC2l/pFt9jzE5X0SHL3j4o3moqArqKZNO2MoMHmHmr6WZ16zNsbhTWfj6PksG/S oJig== X-Gm-Message-State: AOAM532k7zhphzU6D40NguO2Rvt4acwyFOa1szc4RYdjd75W/Bl9e8We l98M6rXtjFdawk8x0WzyIe95FEiXyClYNQ== X-Received: by 2002:a05:6000:1809:b0:20a:cafc:fd39 with SMTP id m9-20020a056000180900b0020acafcfd39mr1441204wrh.255.1650621884952; Fri, 22 Apr 2022 03:04:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/61] hw/intc/arm_gicv3_its: Factor out "find ITE given devid, eventid" Date: Fri, 22 Apr 2022 11:03:42 +0100 Message-Id: <20220422100432.2288247-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The operation of finding an interrupt table entry given a (DeviceID, EventID) pair is necessary in multiple different ITS commands. The process requires first using the DeviceID as an index into the device table to find the DTE, and then useng the EventID as an index into the interrupt table specified by that DTE to find the ITE. We also need to handle all the possible error cases: indexes out of range, table memory not readable, table entries not valid. Factor this out into a separate lookup_ite() function which we can then call from the places where we were previously open-coding this sequence. We'll also need this for some of the new GICv4.0 commands. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-12-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 124 +++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 179a9b032c2..4a029d754ad 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -314,6 +314,60 @@ out: return res; } +/* + * Given a (DeviceID, EventID), look up the corresponding ITE, including + * checking for the various invalid-value cases. If we find a valid ITE, + * fill in @ite and @dte and return CMD_CONTINUE_OK. Otherwise return + * CMD_STALL or CMD_CONTINUE as appropriate (and the contents of @ite + * should not be relied on). + * + * The string @who is purely for the LOG_GUEST_ERROR messages, + * and should indicate the name of the calling function or similar. + */ +static ItsCmdResult lookup_ite(GICv3ITSState *s, const char *who, + uint32_t devid, uint32_t eventid, ITEntry *ite, + DTEntry *dte) +{ + uint64_t num_eventids; + + if (devid >= s->dt.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: devid %d>=%d", + who, devid, s->dt.num_entries); + return CMD_CONTINUE; + } + + if (get_dte(s, devid, dte) != MEMTX_OK) { + return CMD_STALL; + } + if (!dte->valid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: " + "invalid dte for %d\n", who, devid); + return CMD_CONTINUE; + } + + num_eventids = 1ULL << (dte->size + 1); + if (eventid >= num_eventids) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: eventid %d >= %" + PRId64 "\n", who, eventid, num_eventids); + return CMD_CONTINUE; + } + + if (get_ite(s, eventid, dte, ite) != MEMTX_OK) { + return CMD_STALL; + } + + if (!ite->valid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: invalid ITE\n", who); + return CMD_CONTINUE; + } + + return CMD_CONTINUE_OK; +} + /* * This function handles the processing of following commands based on * the ItsCmdType parameter passed:- @@ -325,42 +379,17 @@ out: static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, uint32_t eventid, ItsCmdType cmd) { - uint64_t num_eventids; DTEntry dte; CTEntry cte; ITEntry ite; + ItsCmdResult cmdres; - if (devid >= s->dt.num_entries) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: devid %d>=%d", - __func__, devid, s->dt.num_entries); - return CMD_CONTINUE; + cmdres = lookup_ite(s, __func__, devid, eventid, &ite, &dte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; } - if (get_dte(s, devid, &dte) != MEMTX_OK) { - return CMD_STALL; - } - if (!dte.valid) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: " - "invalid dte for %d\n", __func__, devid); - return CMD_CONTINUE; - } - - num_eventids = 1ULL << (dte.size + 1); - if (eventid >= num_eventids) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: eventid %d >= %" - PRId64 "\n", - __func__, eventid, num_eventids); - return CMD_CONTINUE; - } - - if (get_ite(s, eventid, &dte, &ite) != MEMTX_OK) { - return CMD_STALL; - } - - if (!ite.valid || ite.inttype != ITE_INTTYPE_PHYSICAL) { + if (ite.inttype != ITE_INTTYPE_PHYSICAL) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes: invalid ITE\n", __func__); @@ -740,10 +769,10 @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) { uint32_t devid, eventid; uint16_t new_icid; - uint64_t num_eventids; DTEntry dte; CTEntry old_cte, new_cte; ITEntry old_ite; + ItsCmdResult cmdres; devid = FIELD_EX64(cmdpkt[0], MOVI_0, DEVICEID); eventid = FIELD_EX64(cmdpkt[1], MOVI_1, EVENTID); @@ -751,37 +780,12 @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) trace_gicv3_its_cmd_movi(devid, eventid, new_icid); - if (devid >= s->dt.num_entries) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: devid %d>=%d", - __func__, devid, s->dt.num_entries); - return CMD_CONTINUE; - } - if (get_dte(s, devid, &dte) != MEMTX_OK) { - return CMD_STALL; + cmdres = lookup_ite(s, __func__, devid, eventid, &old_ite, &dte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; } - if (!dte.valid) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: " - "invalid dte for %d\n", __func__, devid); - return CMD_CONTINUE; - } - - num_eventids = 1ULL << (dte.size + 1); - if (eventid >= num_eventids) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: eventid %d >= %" - PRId64 "\n", - __func__, eventid, num_eventids); - return CMD_CONTINUE; - } - - if (get_ite(s, eventid, &dte, &old_ite) != MEMTX_OK) { - return CMD_STALL; - } - - if (!old_ite.valid || old_ite.inttype != ITE_INTTYPE_PHYSICAL) { + if (old_ite.inttype != ITE_INTTYPE_PHYSICAL) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes: invalid ITE\n", __func__); From patchwork Fri Apr 22 10:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564785 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp334555map; Fri, 22 Apr 2022 03:23:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZP1g7YhAeEvVkxGpw1GoOH2Wj+HnTAjNliys0TvHH0vwE7v90gpbhI+BzuP1BND/h6DeO X-Received: by 2002:a05:622a:1044:b0:2f1:f974:35a1 with SMTP id f4-20020a05622a104400b002f1f97435a1mr2583860qte.142.1650622986086; Fri, 22 Apr 2022 03:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622986; cv=none; d=google.com; s=arc-20160816; b=BB8LhmiJkUV+g4uHwM8p0ZknzSNsmGkqCJPtSMyKuDxqu15joSPkJ75iPerXe/4aUn th7x/NAb1MdaxhcyoOljKhuyB9CNkpxeKZZ7t0N3LuUH3beXsB9dPmfpqC0kDMGYAgyQ yIFH0fv3M5FxIfGbnZT5yLRcyKdKqq7gXjKdlr2CswBYG6/W1HVzk2I5wHc/0yZ100Ba T1PLqHunOxmhKDPIhRxYGdOxThtCGNmOMYt62eQa+nsSsWHuwUoZn43YWLimVC15lxcH OWjczgyZQFtQ13gfl9fYWDkODkcv3Ii7xr0RCFJ5XAO4sWzUwtwbeLdb6hNjHqipQlTR BihA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=oE4dJBqIPuYMUXDEJtYKoOIm9KCvHl6Yg1E7509GUMc=; b=mHVjKpm/Ekjv6luCoVstNqKbuOzUqkQ7Num55q42TB047pqGsRKJKK/7DE1qwfYAdH o5KFRlpY/stpbD4oADJrA5YuYx8wTCsQ1zgTqc714HaDOaGNE0s0DeD5bRH6tpH0DC39 WBHHQf0QYWQcXhfxTyTAx6mQbC7PzevXVDnSVL1iGf/BeV90sUdL6tj+R7LrGvNB6xMp QwUt1Vs58R8B3wYojK4Zjf0Pitr4sa3GnecAk1yTsv0gz0o+eCy+CPOwMXIuGDSAvG1N G02yPksyggwr5diAp9D9stsCXIbIWvK8RkzJaHnNHBcD+2w9cfw32b/bmAbiZ5YgXYAE ZYew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PsPu23K7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k16-20020a05622a03d000b002f1e352ef4dsi2065498qtx.407.2022.04.22.03.23.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PsPu23K7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqRN-00085D-KA for patch@linaro.org; Fri, 22 Apr 2022 06:23:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9g-0004Ep-Qn for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:50 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9f-0002az-5u for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:48 -0400 Received: by mail-wr1-x432.google.com with SMTP id t6so6881982wra.4 for ; Fri, 22 Apr 2022 03:04:46 -0700 (PDT) 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=oE4dJBqIPuYMUXDEJtYKoOIm9KCvHl6Yg1E7509GUMc=; b=PsPu23K77z2tyhpGM7sn2OMSoAQP+jjqJgU6WGh415xdJbwVdG6ZKB/2RIXsXB7i1/ /L8uQZ/8yoKFfr1VpQA+gozcT9BjYsm854MwkzHUgJNJeDlBamabVPNyMv/fob/5hEai WfZNr0Y8zt5HZ4L3QH6Ub+cgXJ+Ltdqw8ycNNR8eoh8aWJDQzy3E7Yp/a8PbvXoZVedH dW1NoSi0tQ2EN8zsdJ/e+WUPBhdTEKmF+Qdf1omo9BPpIuYYuh8FXlkXD0yMm9+YyJ9R yj9bjwEj55lJ49FWYvpF6glknbdX+RDDwlR4ZPlJi/wafGS/7oAYaj3pFilgAvdyaTwb +dpQ== 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=oE4dJBqIPuYMUXDEJtYKoOIm9KCvHl6Yg1E7509GUMc=; b=ve1/6unCcVKH4EqKfQ/2VmHYlWYg5KEXgv1TIqFhtKhfHkGypMqrEQcUFyPBZF9APo yJJmxjCBqclrcv1+5dwwAWJw3WLndgogwXsKZ19bkQdNAS+qDqWJLYfiTpggf7FIdayt KEnW1HdzPu7eNuaf3oTuVKdAPSrvNmuHiuvVyCbqOlS5uM9aE/r5/LfMpoK6uAbAJ8uT oFJFOz5hCZAdvSLG8o2IdHcPRs9iReAW9+gZeWygCCgZcXTuy9dbTXVO3TDcoplySPNM qlIlOlk0Vb5AMVhO+uyMWcKEZjAeqgQUBf+ursAAdSD+e9VMgBxj/LfzA6jbRGv8N1sU JvWw== X-Gm-Message-State: AOAM531TnNuIo8AHszF5TDcDdzxgByHCuXU0h9veANH7vsycl2hpSEzU aqMu34pxpvDNW6lG/fZ0CgjyWQV2Fjvocg== X-Received: by 2002:a5d:4b45:0:b0:207:ab91:edd8 with SMTP id w5-20020a5d4b45000000b00207ab91edd8mr3099278wrs.168.1650621885766; Fri, 22 Apr 2022 03:04:45 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/61] hw/intc/arm_gicv3_its: Factor out CTE lookup sequence Date: Fri, 22 Apr 2022 11:03:43 +0100 Message-Id: <20220422100432.2288247-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Factor out the sequence of looking up a CTE from an ICID including the validity and error checks. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-13-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 109 ++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 70 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 4a029d754ad..a2a4e3de56e 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -368,6 +368,36 @@ static ItsCmdResult lookup_ite(GICv3ITSState *s, const char *who, return CMD_CONTINUE_OK; } +/* + * Given an ICID, look up the corresponding CTE, including checking for various + * invalid-value cases. If we find a valid CTE, fill in @cte and return + * CMD_CONTINUE_OK; otherwise return CMD_STALL or CMD_CONTINUE (and the + * contents of @cte should not be relied on). + * + * The string @who is purely for the LOG_GUEST_ERROR messages, + * and should indicate the name of the calling function or similar. + */ +static ItsCmdResult lookup_cte(GICv3ITSState *s, const char *who, + uint32_t icid, CTEntry *cte) +{ + if (icid >= s->ct.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid ICID 0x%x\n", who, icid); + return CMD_CONTINUE; + } + if (get_cte(s, icid, cte) != MEMTX_OK) { + return CMD_STALL; + } + if (!cte->valid) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid CTE\n", who); + return CMD_CONTINUE; + } + if (cte->rdbase >= s->gicv3->num_cpu) { + return CMD_CONTINUE; + } + return CMD_CONTINUE_OK; +} + + /* * This function handles the processing of following commands based on * the ItsCmdType parameter passed:- @@ -396,29 +426,9 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, return CMD_CONTINUE; } - if (ite.icid >= s->ct.num_entries) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid ICID 0x%x in ITE (table corrupted?)\n", - __func__, ite.icid); - return CMD_CONTINUE; - } - - if (get_cte(s, ite.icid, &cte) != MEMTX_OK) { - return CMD_STALL; - } - if (!cte.valid) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: invalid CTE\n", - __func__); - return CMD_CONTINUE; - } - - /* - * Current implementation only supports rdbase == procnum - * Hence rdbase physical address is ignored - */ - if (cte.rdbase >= s->gicv3->num_cpu) { - return CMD_CONTINUE; + cmdres = lookup_cte(s, __func__, ite.icid, &cte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; } if ((cmd == CLEAR) || (cmd == DISCARD)) { @@ -792,54 +802,13 @@ static ItsCmdResult process_movi(GICv3ITSState *s, const uint64_t *cmdpkt) return CMD_CONTINUE; } - if (old_ite.icid >= s->ct.num_entries) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid ICID 0x%x in ITE (table corrupted?)\n", - __func__, old_ite.icid); - return CMD_CONTINUE; + cmdres = lookup_cte(s, __func__, old_ite.icid, &old_cte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; } - - if (new_icid >= s->ct.num_entries) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: ICID 0x%x\n", - __func__, new_icid); - return CMD_CONTINUE; - } - - if (get_cte(s, old_ite.icid, &old_cte) != MEMTX_OK) { - return CMD_STALL; - } - if (!old_cte.valid) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: " - "invalid CTE for old ICID 0x%x\n", - __func__, old_ite.icid); - return CMD_CONTINUE; - } - - if (get_cte(s, new_icid, &new_cte) != MEMTX_OK) { - return CMD_STALL; - } - if (!new_cte.valid) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: " - "invalid CTE for new ICID 0x%x\n", - __func__, new_icid); - return CMD_CONTINUE; - } - - if (old_cte.rdbase >= s->gicv3->num_cpu) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: CTE has invalid rdbase 0x%x\n", - __func__, old_cte.rdbase); - return CMD_CONTINUE; - } - - if (new_cte.rdbase >= s->gicv3->num_cpu) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: CTE has invalid rdbase 0x%x\n", - __func__, new_cte.rdbase); - return CMD_CONTINUE; + cmdres = lookup_cte(s, __func__, new_icid, &new_cte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; } if (old_cte.rdbase != new_cte.rdbase) { From patchwork Fri Apr 22 10:03:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564777 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp326934map; Fri, 22 Apr 2022 03:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/qKS6nTJ3Sl+MlvoKj0ltvhEiq7DFhG7ZETL83aSqd21Ph28Lh/LMzOtpXNi1/JnU+omL X-Received: by 2002:a05:620a:4489:b0:69e:d399:9ca7 with SMTP id x9-20020a05620a448900b0069ed3999ca7mr2026794qkp.47.1650622337060; Fri, 22 Apr 2022 03:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622337; cv=none; d=google.com; s=arc-20160816; b=lDnkGhOXrCBQPRnSp+Ks5CNB7ubUZQGLn3OX4/uCmXrSsIn+sxDs9hEQ2Nb6GWsOXE k38rNGoPVK4HEDJqEtRVZHL29eUYOi7aNlVfA/Jhh3y+SuQiyaT/6md2r+U0HbS7Efve 7K1Qt/sqSMQC1R2/Fu66k75jTqE81wQPjLF0DoVKNFO6sA5ITBbnhs3leQibjqyjA0g1 IkKt1e7xbYG3s5eMP9ofsgv7lN2hqtVhDRI1na6FQakBjergfrHDsD3k9d+vgil7RS8i Ag3jKJ8R8Z8TUxsQ97jme84CT4Bqgcsx1yzdxz+uAUj+DbljIYIyl6UTV+3Ofj96oSdm s1ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OtRB/R8Eaisib9dHQMdldij6U8w9ALtuwnHTBkYALOQ=; b=h2gexd5TY1GFHoEGci4KoK/XvrDXCintwkbfZBIfNmw2mRXEySRxLwdyAYf91TA/O9 8Ip3R7hG/vJn7V0UK0y32XUTWj0Cirm6SSQ1zxwMtaiHsyU87gJetgM6394fQn3phhE/ 3i5sRMvtBY9k+xei7WnHwWxJy16aJuQ0O2BczjrbG1Q3vgzTC658QgqJnIAW/nSIcL0f LfeT83T71+oF4Xd+erKHOo4KwKFJPXIdaXOOgszjnLif62J+pOyqdeN9dILwt69vkn66 biz6SNeKG6mh1KXIsmg8ILCmQ+Owl+ZcjUS0FudhiBbe7wvOvjmR6lrhdbwywpzfsIYe oJuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FehyDWsE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id br18-20020a05620a461200b0069ee4d0ca72si1895739qkb.747.2022.04.22.03.12.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FehyDWsE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqGu-0002RX-F1 for patch@linaro.org; Fri, 22 Apr 2022 06:12:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9i-0004Et-7P for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:50 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9g-0002bB-1M for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:49 -0400 Received: by mail-wr1-x42c.google.com with SMTP id u3so10335030wrg.3 for ; Fri, 22 Apr 2022 03:04:47 -0700 (PDT) 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=OtRB/R8Eaisib9dHQMdldij6U8w9ALtuwnHTBkYALOQ=; b=FehyDWsEEgYSg5WIaq3bp0r9T9KKZcHTAsN+3XpOP69kHn61e3fXAR2x94KGTvAhf7 soOGqUeKkGcGR4OuvM2flLk1rLKK0ct9DEq0bOfgOrwisv+6EHc8lXFLHKdU4jYt+0MF gQsC2BT0olgZO4iBWpznEIFOy+OIxr2FTbK93lcxyxwCqc7ulwP6S3TZhi57lK51XN5K CC2jPFfm74oa8sS9BYKAcNOd1tnWobiI9OVf4CsLf45zm19bR93gVbwEfKhweLTJJE5x gBojETDNyNxMasBwK5QxdkUlKW6uGei/pkmN4tupHAp54d9XgNvjWMOfuaqz2cIOxQf9 xeSw== 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=OtRB/R8Eaisib9dHQMdldij6U8w9ALtuwnHTBkYALOQ=; b=jZ6Mk6C9mlq/v/iUDzF41hiPQZJ4m1oui1o5uHUAZR9X7fUpSESJ1sPuS+G6yDtYlK ylSCLAVp6PBIYLCA4NsJ9TMr8ocbuEIj8by/wBau0cTlhe6q34kJgXWKRmAxmA31SdDg FdeyvaYYbOcOiOOA4HVbI53gkkR8zD8nZNzm3tedhq4LMOccUtO0osMo/QdGrogNlfmq ZCCtEK3E0PXx/Iit+nwPU7q5zRIfvBqKyCz/ZAe72YLm+G3BoNtCLLhdiU9pE8UQv6uH S2fG5Nuae5SRsBFgzQ4nTOLRkQw6OY3hZuaGs9b22WQ0n+x6InLz6PpqdW2U3R1lMvLn K3dg== X-Gm-Message-State: AOAM532vPYhUSHSB2BCe+H+J4QBLsKtElNYsiBOS/K8QtVe0GdKLykDQ XCRavX2Uf7+4MIlmQDuXcVUNwuZmLLp7uw== X-Received: by 2002:adf:fb48:0:b0:203:f986:874a with SMTP id c8-20020adffb48000000b00203f986874amr3089835wrs.614.1650621886607; Fri, 22 Apr 2022 03:04:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/61] hw/intc/arm_gicv3_its: Split out process_its_cmd() physical interrupt code Date: Fri, 22 Apr 2022 11:03:44 +0100 Message-Id: <20220422100432.2288247-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Split the part of process_its_cmd() which is specific to physical interrupts into its own function. This is the part which starts by taking the ICID and looking it up in the collection table. The handling of virtual interrupts is significantly different (involving a lookup in the vPE table) so structuring the code with one sub-function for the physical interrupt case and one for the virtual interrupt case will be clearer than putting both cases in one large function. The code for handling the "remove mapping from ITE" for the DISCARD command remains in process_its_cmd() because it is common to both virtual and physical interrupts. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-14-peter.maydell@linaro.org --- hw/intc/arm_gicv3_its.c | 51 ++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index a2a4e3de56e..e7e1769fa41 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -397,6 +397,19 @@ static ItsCmdResult lookup_cte(GICv3ITSState *s, const char *who, return CMD_CONTINUE_OK; } +static ItsCmdResult process_its_cmd_phys(GICv3ITSState *s, const ITEntry *ite, + int irqlevel) +{ + CTEntry cte; + ItsCmdResult cmdres; + + cmdres = lookup_cte(s, __func__, ite->icid, &cte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + gicv3_redist_process_lpi(&s->gicv3->cpu[cte.rdbase], ite->intid, irqlevel); + return CMD_CONTINUE_OK; +} /* * This function handles the processing of following commands based on @@ -410,34 +423,36 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, uint32_t eventid, ItsCmdType cmd) { DTEntry dte; - CTEntry cte; ITEntry ite; ItsCmdResult cmdres; + int irqlevel; cmdres = lookup_ite(s, __func__, devid, eventid, &ite, &dte); if (cmdres != CMD_CONTINUE_OK) { return cmdres; } - if (ite.inttype != ITE_INTTYPE_PHYSICAL) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes: invalid ITE\n", - __func__); - return CMD_CONTINUE; + irqlevel = (cmd == CLEAR || cmd == DISCARD) ? 0 : 1; + + switch (ite.inttype) { + case ITE_INTTYPE_PHYSICAL: + cmdres = process_its_cmd_phys(s, &ite, irqlevel); + break; + case ITE_INTTYPE_VIRTUAL: + if (!its_feature_virtual(s)) { + /* Can't happen unless guest is illegally writing to table memory */ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid type %d in ITE (table corrupted?)\n", + __func__, ite.inttype); + return CMD_CONTINUE; + } + /* The GICv4 virtual interrupt handling will go here */ + g_assert_not_reached(); + default: + g_assert_not_reached(); } - cmdres = lookup_cte(s, __func__, ite.icid, &cte); - if (cmdres != CMD_CONTINUE_OK) { - return cmdres; - } - - if ((cmd == CLEAR) || (cmd == DISCARD)) { - gicv3_redist_process_lpi(&s->gicv3->cpu[cte.rdbase], ite.intid, 0); - } else { - gicv3_redist_process_lpi(&s->gicv3->cpu[cte.rdbase], ite.intid, 1); - } - - if (cmd == DISCARD) { + if (cmdres == CMD_CONTINUE_OK && cmd == DISCARD) { ITEntry ite = {}; /* remove mapping from interrupt translation table */ ite.valid = false; From patchwork Fri Apr 22 10:03:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564792 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp343862map; Fri, 22 Apr 2022 03:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKXGBB2WOsS/eq/rEmNnvd2mOdW26ZCcr3IYid7qoCppNfpBJ3/Rw5qdcku89HAp9DdWhX X-Received: by 2002:ae9:ddc5:0:b0:69e:6b21:10c8 with SMTP id r188-20020ae9ddc5000000b0069e6b2110c8mr2113860qkf.677.1650623793280; Fri, 22 Apr 2022 03:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623793; cv=none; d=google.com; s=arc-20160816; b=Ijcf7A3ws5rEWaIEqkMnfg2KZwtlUQQvgkuDdIL9ezeT9bxV+egmu9lM59S0c02QmV YFtKgz1PU1adeRIQYiNz4I2QTA/PsXrO3J/G0OE8qTrmhFVN9BcWFpfM41X50wnoAfYp OPMEZ6GGKGx0YxbY/WxbAEjSLPJHNi/TQTyQLTwazs4Hb90RN92QFZVrYuhoiWawarJv a9QZ3uFm2SpTvjPv/aZBhCtZXcAZvBlkY/wGAFQon9GgsgMfq4FEpVPsBLJ4XBUMRCoL 5rN3R0zxlmpUS4WzTrQqpQtluZN1gYPm/SVKNYqU2pqBElWCatRxHZh33QmZJPaMb8i1 DzLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=DJiY/tgKJhJy8+LIvxeHxLLKq7rqsAI2KRSR0lukesA=; b=fP7/9vi0/nogd5mRCl0jn5ZVmYc0aVAoA9v5qvbECyWcwLanxdRSIIq0J/3KlWv5Nv QoCHiZegZBl8zR4F7YIu3sOBtK2G3el28nEPQY3i1U+jZsq9ZovLKBl/oaGEcHlAaMgv r2IOOeHnbbQK8k8JsSh1Y+7Mb247HgycahPto37n1iw+2z/1UU3X7pItAtoK/D6FNNYH g2pzhSz1BQlz88PyFigNQeiRQRS2fPgweNPjNInHgZLxZ+YPtnMwaEQXCJiT2shXI+fb nsXWL4cw7stteTuaW192vxnpxe6Ye56rgKBmAyBy/SI7BK+zzfaTJ/PVbHgwLRvjyYf4 5ZAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pyQy12zN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gu8-20020a056214260800b004467be745dcsi2232632qvb.449.2022.04.22.03.36.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pyQy12zN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqeO-0002Vx-IC for patch@linaro.org; Fri, 22 Apr 2022 06:36:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9k-0004I3-1w for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:52 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9h-0002bM-VU for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:51 -0400 Received: by mail-wr1-x42d.google.com with SMTP id b19so10279727wrh.11 for ; Fri, 22 Apr 2022 03:04:48 -0700 (PDT) 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=DJiY/tgKJhJy8+LIvxeHxLLKq7rqsAI2KRSR0lukesA=; b=pyQy12zNdPlJp75X97973Usa8Q11fAliqGLkKs9Srdx+dpkBHvp8m97SmQz4wY+dEE RTGfPrA7nvfoPIR2P2/u+TG9ISxrpKWs5V9N/7Z41T2KbUJD6CF0LADjsBNf9/BTXKQ/ jjYbvGFzfesMnaSSfQEUOl52J9uTOJ4fbGMYYce6jRGDCejd8Qlev9IOB2KRTpxqCgeL cIFXW4JMxv6dBDj1ISGm+Tr63zcawaPmv6CplUoBwBFXbQFN5/jj0gjvq8L+1o3QKW6n nswdIlpH0HA8NCJedJyqRQNS2RWxfBqv5CP9HctYWJMl1NfI0PwOV5c1MyPm6BbQH6pg k1rQ== 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=DJiY/tgKJhJy8+LIvxeHxLLKq7rqsAI2KRSR0lukesA=; b=IcM4w2Ay53rbSU/vcgUHNkksf2AJFv3x6s0WjCkF8C4lQLMfvM2Y9eBySrSPYXR1I1 TZ5TI2c1Gnhvo5kySt2OREYJWFCFiDkpzajHnohQP6jsFIHMLrhFV+HGLjsbf3g4X265 eNwit0RZLMFBkklevpPjx1tJifaMUHsJSOEUy9DuotxbNR8iKD7uUHQHMlvr/tmSvueg 9hCjp6HkCKezBTOF3qtc4hBiJru5emObu4la4uxPDx+7EyxUWrm+pUrncYXjSPC0zn2M SIJ4/KUYSEv9bvWky8t6OtOrrgUJRlCSfcSH3itNycc7dA/MD99MrwPB1nPncRC1T9B2 zhSQ== X-Gm-Message-State: AOAM532TLv/O4jt/TkRxWFOr5I7G1GXABSpH+P+FgenozGMjdV9r04of gxdvTQaHM/zpmrO3KQlA5u+Uq93FgwgUhA== X-Received: by 2002:adf:e346:0:b0:205:97d0:50db with SMTP id n6-20020adfe346000000b0020597d050dbmr3071854wrj.257.1650621887429; Fri, 22 Apr 2022 03:04:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/61] hw/intc/arm_gicv3_its: Handle virtual interrupts in process_its_cmd() Date: Fri, 22 Apr 2022 11:03:45 +0100 Message-Id: <20220422100432.2288247-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For GICv4, interrupt table entries read by process_its_cmd() may indicate virtual LPIs which are to be directly injected into a VM. Implement the ITS side of the code for handling this. This is similar to the existing handling of physical LPIs, but instead of looking up a collection ID in a collection table, we look up a vPEID in a vPE table. As with the physical LPIs, we leave the rest of the work to code in the redistributor device. The redistributor half will be implemented in a later commit; for now we just provide a stub function which does nothing. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-15-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 17 +++++++ hw/intc/arm_gicv3_its.c | 99 +++++++++++++++++++++++++++++++++++++- hw/intc/arm_gicv3_redist.c | 9 ++++ hw/intc/trace-events | 2 + 4 files changed, 125 insertions(+), 2 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index bbb8a20ce61..6e22c8072e9 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -527,6 +527,23 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, void gicv3_dist_set_irq(GICv3State *s, int irq, int level); void gicv3_redist_set_irq(GICv3CPUState *cs, int irq, int level); void gicv3_redist_process_lpi(GICv3CPUState *cs, int irq, int level); +/** + * gicv3_redist_process_vlpi: + * @cs: GICv3CPUState + * @irq: (virtual) interrupt number + * @vptaddr: (guest) address of VLPI table + * @doorbell: doorbell (physical) interrupt number (1023 for "no doorbell") + * @level: level to set @irq to + * + * Process a virtual LPI being directly injected by the ITS. This function + * will update the VLPI table specified by @vptaddr and @vptsize. If the + * vCPU corresponding to that VLPI table is currently running on + * the CPU associated with this redistributor, directly inject the VLPI + * @irq. If the vCPU is not running on this CPU, raise the doorbell + * interrupt instead. + */ +void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, + int doorbell, int level); void gicv3_redist_lpi_pending(GICv3CPUState *cs, int irq, int level); /** * gicv3_redist_update_lpi: diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index e7e1769fa41..d2c0ca5f726 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -314,6 +314,42 @@ out: return res; } +/* + * Read the vPE Table entry at index @vpeid. On success (including + * successfully determining that there is no valid entry for this index), + * we return MEMTX_OK and populate the VTEntry struct accordingly. + * If there is an error reading memory then we return the error code. + */ +static MemTxResult get_vte(GICv3ITSState *s, uint32_t vpeid, VTEntry *vte) +{ + MemTxResult res = MEMTX_OK; + AddressSpace *as = &s->gicv3->dma_as; + uint64_t entry_addr = table_entry_addr(s, &s->vpet, vpeid, &res); + uint64_t vteval; + + if (entry_addr == -1) { + /* No L2 table entry, i.e. no valid VTE, or a memory error */ + vte->valid = false; + goto out; + } + vteval = address_space_ldq_le(as, entry_addr, MEMTXATTRS_UNSPECIFIED, &res); + if (res != MEMTX_OK) { + goto out; + } + vte->valid = FIELD_EX64(vteval, VTE, VALID); + vte->vptsize = FIELD_EX64(vteval, VTE, VPTSIZE); + vte->vptaddr = FIELD_EX64(vteval, VTE, VPTADDR); + vte->rdbase = FIELD_EX64(vteval, VTE, RDBASE); +out: + if (res != MEMTX_OK) { + trace_gicv3_its_vte_read_fault(vpeid); + } else { + trace_gicv3_its_vte_read(vpeid, vte->valid, vte->vptsize, + vte->vptaddr, vte->rdbase); + } + return res; +} + /* * Given a (DeviceID, EventID), look up the corresponding ITE, including * checking for the various invalid-value cases. If we find a valid ITE, @@ -397,6 +433,38 @@ static ItsCmdResult lookup_cte(GICv3ITSState *s, const char *who, return CMD_CONTINUE_OK; } +/* + * Given a VPEID, look up the corresponding VTE, including checking + * for various invalid-value cases. if we find a valid VTE, fill in @vte + * and return CMD_CONTINUE_OK; otherwise return CMD_STALL or CMD_CONTINUE + * (and the contents of @vte should not be relied on). + * + * The string @who is purely for the LOG_GUEST_ERROR messages, + * and should indicate the name of the calling function or similar. + */ +static ItsCmdResult lookup_vte(GICv3ITSState *s, const char *who, + uint32_t vpeid, VTEntry *vte) +{ + if (vpeid >= s->vpet.num_entries) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid VPEID 0x%x\n", who, vpeid); + return CMD_CONTINUE; + } + + if (get_vte(s, vpeid, vte) != MEMTX_OK) { + return CMD_STALL; + } + if (!vte->valid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid VTE for VPEID 0x%x\n", who, vpeid); + return CMD_CONTINUE; + } + + if (vte->rdbase >= s->gicv3->num_cpu) { + return CMD_CONTINUE; + } + return CMD_CONTINUE_OK; +} + static ItsCmdResult process_its_cmd_phys(GICv3ITSState *s, const ITEntry *ite, int irqlevel) { @@ -411,6 +479,33 @@ static ItsCmdResult process_its_cmd_phys(GICv3ITSState *s, const ITEntry *ite, return CMD_CONTINUE_OK; } +static ItsCmdResult process_its_cmd_virt(GICv3ITSState *s, const ITEntry *ite, + int irqlevel) +{ + VTEntry vte; + ItsCmdResult cmdres; + + cmdres = lookup_vte(s, __func__, ite->vpeid, &vte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + + if (!intid_in_lpi_range(ite->intid) || + ite->intid >= (1ULL << (vte.vptsize + 1))) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: intid 0x%x out of range\n", + __func__, ite->intid); + return CMD_CONTINUE; + } + + /* + * For QEMU the actual pending of the vLPI is handled in the + * redistributor code + */ + gicv3_redist_process_vlpi(&s->gicv3->cpu[vte.rdbase], ite->intid, + vte.vptaddr << 16, ite->doorbell, irqlevel); + return CMD_CONTINUE_OK; +} + /* * This function handles the processing of following commands based on * the ItsCmdType parameter passed:- @@ -446,8 +541,8 @@ static ItsCmdResult do_process_its_cmd(GICv3ITSState *s, uint32_t devid, __func__, ite.inttype); return CMD_CONTINUE; } - /* The GICv4 virtual interrupt handling will go here */ - g_assert_not_reached(); + cmdres = process_its_cmd_virt(s, &ite, irqlevel); + break; default: g_assert_not_reached(); } diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index dc9729e8395..b08b599c887 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -788,6 +788,15 @@ void gicv3_redist_movall_lpis(GICv3CPUState *src, GICv3CPUState *dest) gicv3_redist_update_lpi(dest); } +void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, + int doorbell, int level) +{ + /* + * The redistributor handling for being handed a VLPI by the ITS + * will be added in a subsequent commit. + */ +} + void gicv3_redist_set_irq(GICv3CPUState *cs, int irq, int level) { /* Update redistributor state for a change in an external PPI input line */ diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 2fcc9e40e55..d529914eca2 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -200,6 +200,8 @@ gicv3_its_ite_write(uint64_t ittaddr, uint32_t eventid, int valid, int inttype, gicv3_its_dte_read(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table read for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 gicv3_its_dte_write(uint32_t devid, int valid, uint32_t size, uint64_t ittaddr) "GICv3 ITS: Device Table write for DeviceID 0x%x: valid %d size 0x%x ITTaddr 0x%" PRIx64 gicv3_its_dte_read_fault(uint32_t devid) "GICv3 ITS: Device Table read for DeviceID 0x%x: faulted" +gicv3_its_vte_read(uint32_t vpeid, int valid, uint32_t vptsize, uint64_t vptaddr, uint32_t rdbase) "GICv3 ITS: vPE Table read for vPEID 0x%x: valid %d VPTsize 0x%x VPTaddr 0x%" PRIx64 " RDbase 0x%x" +gicv3_its_vte_read_fault(uint32_t vpeid) "GICv3 ITS: vPE Table read for vPEID 0x%x: faulted" gicv3_its_vte_write(uint32_t vpeid, int valid, uint32_t vptsize, uint64_t vptaddr, uint32_t rdbase) "GICv3 ITS: vPE Table write for vPEID 0x%x: valid %d VPTsize 0x%x VPTaddr 0x%" PRIx64 " RDbase 0x%x" # armv7m_nvic.c From patchwork Fri Apr 22 10:03:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564796 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp346521map; Fri, 22 Apr 2022 03:41:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlAqCtzaPiJvR8l2HUrNPcUVXrt9JJpHEEKOzV2OddN7YLms01ieviQnf27oymopzBU3U2 X-Received: by 2002:a05:6214:e68:b0:44f:87a3:cf89 with SMTP id jz8-20020a0562140e6800b0044f87a3cf89mr3024332qvb.17.1650624093505; Fri, 22 Apr 2022 03:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624093; cv=none; d=google.com; s=arc-20160816; b=tos/SCq8vj33bwGhZXQSsrYH0YkjKqzZpxmLmgKVKmAc48U5dOJd2EkOHYexFm5jsw pZ1DVuspuqolpn6NnuKA7Lnoa6YM2nWyOsyNxIdRuN1YXGnf6saayMWda59Ja77qgRZ9 UrL9Kcsxi2dYALCIa2hX610lAvhNm6B7tNHHJk2G8OwPAEizza2CtvqyX6+Ynb0dOM2c +NValY+3HZ0dYXrIRLfnfAytQFzwJ+Nw4FdGLE7/lGJ5PjPO6ByIkvqKe3tYMGMvubAe pvoqfM1p9iCD4tzwC/nxdF7WmOCwK8jYFWp0IeilToJ8jYf84MQ3PHEarP8CfJHDB0NO vfiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=I7pSO+EBd/yh29lG2tTeORRFQM+zqHoD6Z5G9/i+n7o=; b=LAkNov45wVSKYk0AWdNgplN3uDw54cnVCW7RH7VdjThEUO7RnfFAtrSOuY7E11kTwi SIqFiaetinouIwCnDmhRfikqk0o8ZsDXiCdHKzWTUTLRv3QVKXyxORop7VxzBBUdsGpL C0Ckft13cyd4GUlYGvUdVuO20wWi3UDi/BWr0bDOYNivxlvCQg9syvrHUSJ98B7/dtoG f/+DvswlvDHR/YY9lxEJn+nkMLDidJ17f5LThFsh2cZGFvGU8NY8Py7DH9on7rQX8oSS dgmMOkxlfweAKNCucdOuqLRrWulByVvBmZeWgGSCgNH0UwjormKbBEbQbj5nv2JwD7l7 lc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=otr7nirS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j21-20020a05620a411500b00699a8013fc4si1010282qko.450.2022.04.22.03.41.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=otr7nirS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqjE-0000NQ-Vx for patch@linaro.org; Fri, 22 Apr 2022 06:41:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9l-0004LI-Py for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:43568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9i-0002bb-QF for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:53 -0400 Received: by mail-wr1-x433.google.com with SMTP id v12so3513280wrv.10 for ; Fri, 22 Apr 2022 03:04:50 -0700 (PDT) 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=I7pSO+EBd/yh29lG2tTeORRFQM+zqHoD6Z5G9/i+n7o=; b=otr7nirSXi4cADsvwacUJzdRJv2U2+LYilUEsCBYBMWPWj7ycSIhzwIgfigBt87pB+ +WobJwbU8xBut16okixZFS1VniaKcZb9muBOnvZeFBzJ1gsmWOEq47sbULMTQMKR87aS VYDfWrYe42n5kz3Y77UzRsUqMv9KkawrWK3wJ/GYTWpG3bpUb7eLvLDgooZ0DwFlrqQq YPF8IiAjifyvD6t82fHGxHTVR/Z+tsB9TcQhT2iqnJCRK1T3l3eC2/C2ec7nHUnzMIqI wW3aGy9v6sciS/Ev78FgpzBLlchm75J+fIzUrP35ZYLO7raGzuy3lMt9Ms8k1ZiYXLt3 TRPw== 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=I7pSO+EBd/yh29lG2tTeORRFQM+zqHoD6Z5G9/i+n7o=; b=INES+vwGnppKeYzba6kp7Zeyo0A3vtzpyfiMQl6VXF4KxIUKqQ3yB4meYjyq6s3aG/ KbIqbR5h3q8LIDzKWtiGHPPuz/juC2M66acoMDG18J+STHiwQzpJbt7I2FxeZbZ/Ojk9 zTr1dL4gZZL/DbsZTzplQthkIX8qGLRxpOHvl8EMP4sIIaQ09TacpwbDZ+V7TNasL5du BOt7QRDoaH9q7meFgTwYzF4xOIcJgDzu3Ks94XkEGSjBAvHLXrz9QMqtgbHK1KKOsJSa aRF9aVCnJJiP7dT5Z2xSRHXOe2xJORWoQzrkJ8iWmofkndLLxqUl5VpS3OMqC7KI4FXK gFOw== X-Gm-Message-State: AOAM531gP8HtEF0FA6kEyxEFI6fVvbDsesc8Jyu+o8IpNqT6r8MDKGBT DcMKXfdmN59bAudrCnzzJsx6acBuIdZAGA== X-Received: by 2002:adf:eacf:0:b0:20a:c8c4:ac51 with SMTP id o15-20020adfeacf000000b0020ac8c4ac51mr2077086wrn.510.1650621888302; Fri, 22 Apr 2022 03:04:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/61] hw/intc/arm_gicv3: Keep pointers to every connected ITS Date: Fri, 22 Apr 2022 11:03:46 +0100 Message-Id: <20220422100432.2288247-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The GICv4 ITS VMOVP command's semantics require it to perform the operation on every ITS connected to the same GIC that the ITS that received the command is attached to. This means that the GIC object needs to keep a pointer to every ITS that is connected to it (previously it was sufficient for the ITS to have a pointer to its GIC). Add a glib ptrarray to the GICv3 object which holds pointers to every connected ITS, and make the ITS add itself to the array for the GIC it is connected to when it is realized. Note that currently all QEMU machine types with an ITS have exactly one ITS in the system, so typically the length of this ptrarray will be 1. Multiple ITSes are typically used to improve performance on real hardware, so we wouldn't need to have more than one unless we were modelling a real machine type that had multile ITSes. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-16-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 9 +++++++++ include/hw/intc/arm_gicv3_common.h | 2 ++ hw/intc/arm_gicv3_common.c | 2 ++ hw/intc/arm_gicv3_its.c | 2 ++ hw/intc/arm_gicv3_its_kvm.c | 2 ++ 5 files changed, 17 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 6e22c8072e9..69a59daf867 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -709,4 +709,13 @@ static inline void gicv3_cache_all_target_cpustates(GICv3State *s) void gicv3_set_gicv3state(CPUState *cpu, GICv3CPUState *s); +/* + * The ITS should call this when it is realized to add itself + * to its GIC's list of connected ITSes. + */ +static inline void gicv3_add_its(GICv3State *s, DeviceState *its) +{ + g_ptr_array_add(s->itslist, its); +} + #endif /* QEMU_ARM_GICV3_INTERNAL_H */ diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index fc38e4b7dca..08b27789385 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -272,6 +272,8 @@ struct GICv3State { uint32_t gicd_nsacr[DIV_ROUND_UP(GICV3_MAXIRQ, 16)]; GICv3CPUState *cpu; + /* List of all ITSes connected to this GIC */ + GPtrArray *itslist; }; #define GICV3_BITMAP_ACCESSORS(BMP) \ diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index c797c82786b..dcc5ce28c6a 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -414,6 +414,8 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) cpuidx += s->redist_region_count[i]; s->cpu[cpuidx - 1].gicr_typer |= GICR_TYPER_LAST; } + + s->itslist = g_ptr_array_new(); } static void arm_gicv3_finalize(Object *obj) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index d2c0ca5f726..46d9e0169f9 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1680,6 +1680,8 @@ static void gicv3_arm_its_realize(DeviceState *dev, Error **errp) } } + gicv3_add_its(s->gicv3, dev); + gicv3_its_init_mmio(s, &gicv3_its_control_ops, &gicv3_its_translation_ops); /* set the ITS default features supported */ diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c index 0b4cbed28b3..529c7bd4946 100644 --- a/hw/intc/arm_gicv3_its_kvm.c +++ b/hw/intc/arm_gicv3_its_kvm.c @@ -106,6 +106,8 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp) kvm_arm_register_device(&s->iomem_its_cntrl, -1, KVM_DEV_ARM_VGIC_GRP_ADDR, KVM_VGIC_ITS_ADDR_TYPE, s->dev_fd, 0); + gicv3_add_its(s->gicv3, dev); + gicv3_its_init_mmio(s, NULL, NULL); if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS, From patchwork Fri Apr 22 10:03:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564800 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp349117map; Fri, 22 Apr 2022 03:46:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXL0Tzt/orAcSH/P1XGDGuCpR3svnkw9AMnmocAs7YzMRnKx/pMYlxrgXRW8BsNj7tL5Cr X-Received: by 2002:a05:620a:2546:b0:680:f744:5bc6 with SMTP id s6-20020a05620a254600b00680f7445bc6mr2199910qko.113.1650624387119; Fri, 22 Apr 2022 03:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624387; cv=none; d=google.com; s=arc-20160816; b=dPllXfR5e43/9COtAc7xGVXKoeMH6dejoWAr2qZ0OuJ0pNioAduaHCBljX/qjKe6rR V+Fm1sLg8k58kMGvY867AFkpyC7pit8yqy0chcNYHmpMt6pLOHinZrOWl3HgkVaa9LDJ Xvt3JU9eXvoC1IIF2gP7cRBNco6G2gs0MIV0rem+wIl5jLKsRMHdv2GLQj1oS6onACeX HsaEeKQ4HofXwwVetPVLrAc0Ps3eIiRwuatxifhUgNRH+/yy/6NKAGvGQzx42GUfGehI Ud24iihQwhd+QbVGKi0Eegn2PpO06RGY5ulHtCv1hURi1QnmHSIt+I8QdnrJtghz1Xq0 s7dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9JIpRBTm63udjzml/qD9iCIGqEv/JkcdC9XjAHuZkOE=; b=0A26UHV8E84LjJO5lba0h13znyTQF+5MaSwo8BHMZEAYuEjwCMWFmYzMYXcshoy0Yc jr8dh+unaXZIFo/6NhoFj3wo3li6DNSttDfAAuETwpEDSrKtJkQ2tYR/7tRydkCDVyST Nqvu9Gu4OcKME3jIOMV1H54gn+mHBnrcPA1Y1yrbGR54jxNVX//J9BFXxAdQ0IdrIsBG COlZsVSLfZd8RmP/PK9JJds/CTfwZUmIf0vUtod+qC4f7Khdl2XXDS2piM4YD3VDJTni ikGyx2Bw7nGG0gSVyG7oeRkC7QpP2ajdUsj3nrXPB2gcUm346cGhI9iJci+n7JfUajxh DA5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFPSsRmB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o1-20020a05622a008100b002e1fbf3bed6si2068025qtw.199.2022.04.22.03.46.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:46:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFPSsRmB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqny-0000Jz-B8 for patch@linaro.org; Fri, 22 Apr 2022 06:46:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9l-0004LO-Rt for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:34761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9i-0002ba-Py for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:53 -0400 Received: by mail-wr1-x42b.google.com with SMTP id c10so10334870wrb.1 for ; Fri, 22 Apr 2022 03:04:50 -0700 (PDT) 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=9JIpRBTm63udjzml/qD9iCIGqEv/JkcdC9XjAHuZkOE=; b=FFPSsRmBZe7M8PMD8ERKoAdoQlu8NOnmSPokplAgiAg/w8fzf/TAlxXRrhmz411inL keBJSx+TV8bI0Ijg/laFf/8uQXAkbxbUf9Oh62FvFul9PjjtYkiO7YCxNbW32TdCFtHi f9hv3xus06BKZF7/KSYio2fcqLsJnSjOJJW7tD3WudGOx2IV6aByR29cL/DVO6dOK9Ih dHl7aEsT+lkaYI5p6oEj1t40vMyU1JGaGsvpLDLUb84AvEduxiHecCS/OVrFl/GcmCJf jn23q+EzWl/FeOHmMUErrqJaWF2XidQXKYV1AYRnYLvpew/20dlpzcHJeEou2/OXe6i7 +Zpw== 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=9JIpRBTm63udjzml/qD9iCIGqEv/JkcdC9XjAHuZkOE=; b=dtnlDmQ8xBH342qntCiwePc+I03fa+niO4HD66PIdzZb431JOc7I6O5ao5EHDs5MR/ ASCkXU9jw5vbiSaQ6qLRWR6Zj7qN1qbs9JumJ3YtHJz/h2jwC6QE8QrwpLEy+aBsb00B fdUhLstmDOyy5aNfYirx74r6hOV+rqQpoiBriYR22hQNlIlNMOYiIgyJz4zzqh4KDLk7 4zAPmu4rLwQo9ovcgVUnNFECLpn/DGIcQ0zG4M96dn9jthKk6pE66QuMWWaiGoCOmAvA CVuunR7lA7Y7KDtzHoUot39QLXiyUT/Ywr38nwUHsvhClxYB/pEhW+DFOo/qdD8mV209 QkqQ== X-Gm-Message-State: AOAM532cDFX3K8sHW2njPsi0N8JJjOEUGetQBV77nA4Zuwre2v+vp3vI yec/wY9LNS8bV3m5S2fzm/wSfbcQMRg0Ww== X-Received: by 2002:a5d:48c7:0:b0:20a:c72d:279b with SMTP id p7-20020a5d48c7000000b0020ac72d279bmr2808761wrs.379.1650621889271; Fri, 22 Apr 2022 03:04:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/61] hw/intc/arm_gicv3_its: Implement VMOVP Date: Fri, 22 Apr 2022 11:03:47 +0100 Message-Id: <20220422100432.2288247-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the GICv4 VMOVP command, which updates an entry in the vPE table to change its rdbase field. This command is unique in the ITS command set because its effects must be propagated to all the other ITSes connected to the same GIC as the ITS which executes the VMOVP command. The GICv4 spec allows two implementation choices for handling the propagation to other ITSes: * If GITS_TYPER.VMOVP is 1, the guest only needs to issue the command on one ITS, and the implementation handles the propagation to all ITSes * If GITS_TYPER.VMOVP is 0, the guest must issue the command on every ITS, and arrange for the ITSes to synchronize the updates with each other by setting ITSList and Sequence Number fields in the command packets We choose the GITS_TYPER.VMOVP = 1 approach, and synchronously execute the update on every ITS. For GICv4.1 this command has extra fields in the command packet and additional behaviour. We define the 4.1-only fields with the FIELD macro, but only implement the GICv4.0 version of the command. Note that we don't update the reported GITS_TYPER value here; we'll do that later in a commit which updates all the reported feature bit and ID register values for GICv4. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-17-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 18 ++++++++++ hw/intc/arm_gicv3_its.c | 75 ++++++++++++++++++++++++++++++++++++++++ hw/intc/trace-events | 1 + 3 files changed, 94 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 69a59daf867..c1467ce7263 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -329,6 +329,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_INVALL 0x0D #define GITS_CMD_MOVALL 0x0E #define GITS_CMD_DISCARD 0x0F +#define GITS_CMD_VMOVP 0x22 #define GITS_CMD_VMAPP 0x29 #define GITS_CMD_VMAPTI 0x2A #define GITS_CMD_VMAPI 0x2B @@ -389,6 +390,14 @@ FIELD(VMAPP_2, V, 63, 1) FIELD(VMAPP_3, VPTSIZE, 0, 8) /* For GICv4.0, bits [7:6] are RES0 */ FIELD(VMAPP_3, VPTADDR, 16, 36) +/* VMOVP command fields */ +FIELD(VMOVP_0, SEQNUM, 32, 16) /* not used for GITS_TYPER.VMOVP == 1 */ +FIELD(VMOVP_1, ITSLIST, 0, 16) /* not used for GITS_TYPER.VMOVP == 1 */ +FIELD(VMOVP_1, VPEID, 32, 16) +FIELD(VMOVP_2, RDBASE, 16, 36) +FIELD(VMOVP_2, DB, 63, 1) /* GICv4.1 only */ +FIELD(VMOVP_3, DEFAULT_DOORBELL, 0, 32) /* GICv4.1 only */ + /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec @@ -718,4 +727,13 @@ static inline void gicv3_add_its(GICv3State *s, DeviceState *its) g_ptr_array_add(s->itslist, its); } +/* + * The ITS can use this for operations that must be performed on + * every ITS connected to the same GIC that it is + */ +static inline void gicv3_foreach_its(GICv3State *s, GFunc func, void *opaque) +{ + g_ptr_array_foreach(s->itslist, func, opaque); +} + #endif /* QEMU_ARM_GICV3_INTERNAL_H */ diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 46d9e0169f9..8bc93295fb5 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1012,6 +1012,78 @@ static ItsCmdResult process_vmapp(GICv3ITSState *s, const uint64_t *cmdpkt) return update_vte(s, vpeid, &vte) ? CMD_CONTINUE_OK : CMD_STALL; } +typedef struct VmovpCallbackData { + uint64_t rdbase; + uint32_t vpeid; + /* + * Overall command result. If more than one callback finds an + * error, STALL beats CONTINUE. + */ + ItsCmdResult result; +} VmovpCallbackData; + +static void vmovp_callback(gpointer data, gpointer opaque) +{ + /* + * This function is called to update the VPEID field in a VPE + * table entry for this ITS. This might be because of a VMOVP + * command executed on any ITS that is connected to the same GIC + * as this ITS. We need to read the VPE table entry for the VPEID + * and update its RDBASE field. + */ + GICv3ITSState *s = data; + VmovpCallbackData *cbdata = opaque; + VTEntry vte; + ItsCmdResult cmdres; + + cmdres = lookup_vte(s, __func__, cbdata->vpeid, &vte); + switch (cmdres) { + case CMD_STALL: + cbdata->result = CMD_STALL; + return; + case CMD_CONTINUE: + if (cbdata->result != CMD_STALL) { + cbdata->result = CMD_CONTINUE; + } + return; + case CMD_CONTINUE_OK: + break; + } + + vte.rdbase = cbdata->rdbase; + if (!update_vte(s, cbdata->vpeid, &vte)) { + cbdata->result = CMD_STALL; + } +} + +static ItsCmdResult process_vmovp(GICv3ITSState *s, const uint64_t *cmdpkt) +{ + VmovpCallbackData cbdata; + + if (!its_feature_virtual(s)) { + return CMD_CONTINUE; + } + + cbdata.vpeid = FIELD_EX64(cmdpkt[1], VMOVP_1, VPEID); + cbdata.rdbase = FIELD_EX64(cmdpkt[2], VMOVP_2, RDBASE); + + trace_gicv3_its_cmd_vmovp(cbdata.vpeid, cbdata.rdbase); + + if (cbdata.rdbase >= s->gicv3->num_cpu) { + return CMD_CONTINUE; + } + + /* + * Our ITS implementation reports GITS_TYPER.VMOVP == 1, which means + * that when the VMOVP command is executed on an ITS to change the + * VPEID field in a VPE table entry the change must be propagated + * to all the ITSes connected to the same GIC. + */ + cbdata.result = CMD_CONTINUE_OK; + gicv3_foreach_its(s->gicv3, vmovp_callback, &cbdata); + return cbdata.result; +} + /* * Current implementation blocks until all * commands are processed @@ -1136,6 +1208,9 @@ static void process_cmdq(GICv3ITSState *s) case GITS_CMD_VMAPP: result = process_vmapp(s, cmdpkt); break; + case GITS_CMD_VMOVP: + result = process_vmovp(s, cmdpkt); + break; default: trace_gicv3_its_cmd_unknown(cmd); break; diff --git a/hw/intc/trace-events b/hw/intc/trace-events index d529914eca2..a2dd1bdb6c3 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -190,6 +190,7 @@ gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: gicv3_its_cmd_vmapi(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x Dbell_pINTID 0x%x" gicv3_its_cmd_vmapti(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t vintid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x vINTID 0x%x Dbell_pINTID 0x%x" gicv3_its_cmd_vmapp(uint32_t vpeid, uint64_t rdbase, int valid, uint64_t vptaddr, uint32_t vptsize) "GICv3 ITS: command VMAPP vPEID 0x%x RDbase 0x%" PRIx64 " V %d VPT_addr 0x%" PRIx64 " VPT_size 0x%x" +gicv3_its_cmd_vmovp(uint32_t vpeid, uint64_t rdbase) "GICv3 ITS: command VMOVP vPEID 0x%x RDbase 0x%" PRIx64 gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" From patchwork Fri Apr 22 10:03:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564782 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp332157map; Fri, 22 Apr 2022 03:19:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBGAHnaqlZ+oZpnSdtWeImOrsfJGFJ/C9cBfc6vVqmDA8C6M+UZ9o2GX6NCcK36Jsb3z4t X-Received: by 2002:ad4:5968:0:b0:446:60d1:40d7 with SMTP id eq8-20020ad45968000000b0044660d140d7mr2953899qvb.88.1650622783284; Fri, 22 Apr 2022 03:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622783; cv=none; d=google.com; s=arc-20160816; b=LCrEz8EDtWcmh1jHJBeVLQpiBqn5Pe09MTvz/vdq1upg4KAbYl6VJxdJyAp2MSi5w9 Y5siAgxmLEvJ18RVzuiFeuGWPjvgU1eXnQPLyG/9W8JzvkGqoJLARECorPFyFqHwAggr PhpVoyV04fBjqPWjCCLmXHJ//9B1vFppdacrNkehU3mLJb1XFNW/ds8g7WTA2cf5vqye qE6RESJLL1YBYmloQMjGKt5VPm+JNJbSY99POl42pds4xxrfx9xbO3PPiM6rTEI629hw TN6NVcBMowzLZedhK9tFVAXRVhbSmFWBOyvD2/+aTis0HmdUahhS6t5XrpRCE0d92Ri0 CkDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bF2VxJju+9YWyEUIW0SitG+F9+86cJzwUXdO302ijVA=; b=KlN4iOjSc6Rsa+n60pQsI8DPTGTyHgImMty61dn+NycrgA9VTBtyMEaZLdc2djrJzO w/onP/dSDmuW+ug2o3oXQbAnQbL6YmL3QwgUg+h29aUrob8T2hHQZwi8nboI3ygSxuiv yQR3ru2DQvgDXSlP27Cedg4YW/Z7+Wu3203BScemrGfPtGjjxibVLfJzPFXjHLWoC6w7 6XmdcvU6uRSBIha9/TmAbdzdu/V93Dw4Zp5TJsTmFhP7Byb9EqhUvlMY6cwT9niKW7hV oD0qIbq6g7WmXQdT6xQu9K7TjrgmoUtd6eaVqe6GGJSh29W6L9AeViPmqrNL1PQ7Nrpp /oyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TsNezgKt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v2-20020a05622a014200b002ed08723842si2352772qtw.92.2022.04.22.03.19.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TsNezgKt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqO6-0002Mi-Rz for patch@linaro.org; Fri, 22 Apr 2022 06:19:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9l-0004LG-Ph for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:33680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9j-0002bt-D1 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:53 -0400 Received: by mail-wr1-x42a.google.com with SMTP id x18so10355180wrc.0 for ; Fri, 22 Apr 2022 03:04:51 -0700 (PDT) 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=bF2VxJju+9YWyEUIW0SitG+F9+86cJzwUXdO302ijVA=; b=TsNezgKtO5E0odcdgJ/9efnHdoRqShKIkrEZUfyirqxilbvHkmi9FYX3l2AfH3YoVq WCwYRWI9Pwq9k2tBqtNvL891j4n6kiXZRPVD+FAg6tLiHPAjBMqPvkLDxj1N3fpA0uK6 1IorTwa3BVxi3vCLGoziQA8XTfsQhFMShKzRs9Av17YoWSCxUkkFdNVjPz5++ZwiSKC2 8ZX8VrG4NnJfkYM9TwIKusrXTnAflv6KluaUy25Mg2Y3nDQvR4g0ILYWqIJtOBHcj17W tnoeSum8uRFy/vc/7nOP/L5yPxEaS1vYKC6LNe52uf+yM7h1S8nOx3vmJ9//pbKAZHUa ZsRw== 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=bF2VxJju+9YWyEUIW0SitG+F9+86cJzwUXdO302ijVA=; b=UN6T8gBn1TIp2RG45xgqc9bm8so0401OY+t81T7p2P0CTR8xB9QbYvnCXoWJ5iCuok zFaM786TiV+e6+4wXTLbU12dYqnY2bD4K8wbqhmCZTHyJpPMSwcDldtrXe5VKs8rj0ug vP30rgekBa7u6ugrjoLzXmru5HGQigEy2qnPYp7Mt71yN6DqLSfOaNYvz2i3N4PWqjoV j1G/ksueTW+ZTOrzolWvA5XKOaycj/MF+hcp5hYNflk5H3248KeYjLzQl3JgW9kcDtyc n2pCyee15Vyax6Hn1qTwWGlnGUv0nohmaRoXHwvI+KDwn9mq6wY92HRX/dVZ38ZsNF/Y tR1A== X-Gm-Message-State: AOAM531lmvowG+0CmpSjZQ8vu8zO3e2FOD3SwybHI1NvNVQGSEmhNrAR yEQGZ/ukuZ1gQKOl9595lk+Jh0JbqYuoSw== X-Received: by 2002:a5d:6e87:0:b0:206:452:5b87 with SMTP id k7-20020a5d6e87000000b0020604525b87mr2987031wrz.473.1650621889996; Fri, 22 Apr 2022 03:04:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/61] hw/intc/arm_gicv3_its: Implement VSYNC Date: Fri, 22 Apr 2022 11:03:48 +0100 Message-Id: <20220422100432.2288247-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The VSYNC command forces the ITS to synchronize all outstanding ITS operations for the specified vPEID, so that subsequent writes to GITS_TRANSLATER honour them. The QEMU implementation is always in sync, so for us this is a nop, like the existing SYNC command. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-18-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 1 + hw/intc/arm_gicv3_its.c | 11 +++++++++++ hw/intc/trace-events | 1 + 3 files changed, 13 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index c1467ce7263..ef1d75b3cf4 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -330,6 +330,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_MOVALL 0x0E #define GITS_CMD_DISCARD 0x0F #define GITS_CMD_VMOVP 0x22 +#define GITS_CMD_VSYNC 0x25 #define GITS_CMD_VMAPP 0x29 #define GITS_CMD_VMAPTI 0x2A #define GITS_CMD_VMAPI 0x2B diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 8bc93295fb5..a3f5bac5513 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1165,6 +1165,17 @@ static void process_cmdq(GICv3ITSState *s) */ trace_gicv3_its_cmd_sync(); break; + case GITS_CMD_VSYNC: + /* + * VSYNC also is a nop, because our implementation is always + * in sync. + */ + if (!its_feature_virtual(s)) { + result = CMD_CONTINUE; + break; + } + trace_gicv3_its_cmd_vsync(); + break; case GITS_CMD_MAPD: result = process_mapd(s, cmdpkt); break; diff --git a/hw/intc/trace-events b/hw/intc/trace-events index a2dd1bdb6c3..b9efe14c690 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -191,6 +191,7 @@ gicv3_its_cmd_vmapi(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t d gicv3_its_cmd_vmapti(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t vintid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x vINTID 0x%x Dbell_pINTID 0x%x" gicv3_its_cmd_vmapp(uint32_t vpeid, uint64_t rdbase, int valid, uint64_t vptaddr, uint32_t vptsize) "GICv3 ITS: command VMAPP vPEID 0x%x RDbase 0x%" PRIx64 " V %d VPT_addr 0x%" PRIx64 " VPT_size 0x%x" gicv3_its_cmd_vmovp(uint32_t vpeid, uint64_t rdbase) "GICv3 ITS: command VMOVP vPEID 0x%x RDbase 0x%" PRIx64 +gicv3_its_cmd_vsync(void) "GICv3 ITS: command VSYNC" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" From patchwork Fri Apr 22 10:03:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564793 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp344473map; Fri, 22 Apr 2022 03:37:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzbPIez18TvMQWo0DxovxaudFy7KemSjo1KYcCFTLFnma1xLmVMRvbOTOBAslY638t1B0U X-Received: by 2002:a05:6214:89:b0:444:4e37:9d7a with SMTP id n9-20020a056214008900b004444e379d7amr3016267qvr.119.1650623854181; Fri, 22 Apr 2022 03:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623854; cv=none; d=google.com; s=arc-20160816; b=Ny8+N2WIPDbCHyZdh3kZ7zp49Dt1vVPaEoL2+qdXFz/fEAbt1gE7Qx4nJyf+ynt8jU YxoZC7erCr74LstlN2dtMK2+NtqOMjYcgLYjjAsvk9WORkMGMqznZsZRbb9XWnTis+Ir Sp0DFOtjY7bUxwXXCFPt9kHZTL+XmE7c0tHezrVN8cGmWxZJgNHy1JaGDLYAem/ObKJQ BM5WITsJ4088TX26hu8ieSMUmCHKuy8t/JObaKgNAn8qIrZ5BQpAJZOwR7QC8H3vjitO WWx8O/1zDlA2Trk3ZmV4vyrXhlOaALbhImj4wS14PHMv0hKe/nMAK0QkctaQ7K+3KDrm UrcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PcdPPQOjNbwfXaTfJK9YXBBIueNNQIzSTQ868HQOcpY=; b=p62UKq3DYkwlMzNtAArb5ieyVIhqon+2I+lXbdkXj7vDJxWsx3nI+pi77vZ0r4yZMT MSWLNgSZtsxHmiBEkGLJv0f4+8htxObPpEHXDNcCcxw9czF1xhjN6q5Epu+x4s5efE8r UP3XNBvRE03XJLHpysOtci2iCe2BBysUpmnDed99fVeYF7zNxcipI5vCnc5jt+MVc5nM Z3buqAVLnU+XZyMXnGgW6Q/88LZDDgGWduWxRNoyA5tS+3ysWq/migof88waTdfEPDOH Y8pWAaU8+3WxAWeo4IZBKQoUMoBu+yRuXoP8Jvfv2r6HeMYTDnHlBZZ5IKqi+tQRKl3r N26w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L6qR13FD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c13-20020ad45aed000000b0044452fd9feasi2107060qvh.101.2022.04.22.03.37.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L6qR13FD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqfN-0004g5-4A for patch@linaro.org; Fri, 22 Apr 2022 06:37:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9m-0004MJ-KD for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9k-0002c6-JJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: by mail-wr1-x42d.google.com with SMTP id x18so10355246wrc.0 for ; Fri, 22 Apr 2022 03:04:52 -0700 (PDT) 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=PcdPPQOjNbwfXaTfJK9YXBBIueNNQIzSTQ868HQOcpY=; b=L6qR13FDEhkLKu3UzcpPteU7R2IoNr6C6mNWnaNN4bfqsvN/ZA9FReKJMtnkby3mL4 8iaeBi44LWK8UB+UAAqe961EoHEYccqUuFnuTkC39A/9U2JKZoQG574dZJl/UKy2esL4 dG98we/clnuCQM/uCap/liu8LTdFvm560VqYsEbjUW2AczAYM6HRFVgPy+hERIFPFStx Y0OP6LWSoakCA+9n3JJs24INl1v94PICmg1hmPzLCI+hDhYdGa6TNNtltBR9Do/LfTZd u7v8qayUYEtX3h7sCb0lyX/LlIn3r434YuA5U+cmMMy+83JhZqeoimbzzrGBjI7yMZfh 8SWA== 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=PcdPPQOjNbwfXaTfJK9YXBBIueNNQIzSTQ868HQOcpY=; b=KbYY8ixcdqhnjtEFcculhBIq0U3sm3c98cRniKMPYS183dg431lr30342slz7eQGzf Xgoc80gEPJKyqRHQpQpwLkl7zZcbpACAAFRo7R4XasjzgnZfIrMuIC5o87ImRkn5xstZ Jp7bX6NC00Z8WGCp0fQaoBoMgQ1fGYOAee4U+WyTMiBAAVolxo0jgvOrVRl8W7wXe8ji 85YwOTcT2eBzFZmmxxg03w4bWB3m83Y0taBTTfwHCw7spwWnzf1LQqmU5lrOBHicEvcL iPWC8DoJaJ0C8C6SAl0QxsgCp7Ed9e3CtCy/z56EbO0EU4bd1XYsa5wWt4rIZwhU05dJ 2L2Q== X-Gm-Message-State: AOAM532Cm2HwSg/zdqSVZIoeEvddProdhBWqFGWU9mv+Y/vfKlZwPbdR bcQDD7UBgniMb+dvBCEL+yBnh6hHDw992w== X-Received: by 2002:a05:6000:2c5:b0:20a:9675:d26c with SMTP id o5-20020a05600002c500b0020a9675d26cmr3019749wry.185.1650621890987; Fri, 22 Apr 2022 03:04:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/61] hw/intc/arm_gicv3_its: Implement INV command properly Date: Fri, 22 Apr 2022 11:03:49 +0100 Message-Id: <20220422100432.2288247-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We were previously implementing INV (like INVALL) to just blow away cached highest-priority-pending-LPI information on all connected redistributors. For GICv4.0, this isn't going to be sufficient, because the LPI we are invalidating cached information for might be either physical or virtual, and the required action is different for those two cases. So we need to do the full process of looking up the ITE from the devid and eventid. This also means we can do the error checks that the spec lists for this command. Split out INV handling into a process_inv() function like our other command-processing functions. For the moment, stick to handling only physical LPIs; we will add the vLPI parts later. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-19-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 12 +++++++++ hw/intc/arm_gicv3_its.c | 50 +++++++++++++++++++++++++++++++++++++- hw/intc/arm_gicv3_redist.c | 11 +++++++++ hw/intc/trace-events | 3 ++- 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index ef1d75b3cf4..25ea19de385 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -373,6 +373,10 @@ FIELD(MOVI_0, DEVICEID, 32, 32) FIELD(MOVI_1, EVENTID, 0, 32) FIELD(MOVI_2, ICID, 0, 16) +/* INV command fields */ +FIELD(INV_0, DEVICEID, 32, 32) +FIELD(INV_1, EVENTID, 0, 32) + /* VMAPI, VMAPTI command fields */ FIELD(VMAPTI_0, DEVICEID, 32, 32) FIELD(VMAPTI_1, EVENTID, 0, 32) @@ -573,6 +577,14 @@ void gicv3_redist_update_lpi(GICv3CPUState *cs); * an incoming migration has loaded new state. */ void gicv3_redist_update_lpi_only(GICv3CPUState *cs); +/** + * gicv3_redist_inv_lpi: + * @cs: GICv3CPUState + * @irq: LPI to invalidate cached information for + * + * Forget or update any cached information associated with this LPI. + */ +void gicv3_redist_inv_lpi(GICv3CPUState *cs, int irq); /** * gicv3_redist_mov_lpi: * @src: source redistributor diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index a3f5bac5513..aa0a62510e5 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1084,6 +1084,50 @@ static ItsCmdResult process_vmovp(GICv3ITSState *s, const uint64_t *cmdpkt) return cbdata.result; } +static ItsCmdResult process_inv(GICv3ITSState *s, const uint64_t *cmdpkt) +{ + uint32_t devid, eventid; + ITEntry ite; + DTEntry dte; + CTEntry cte; + ItsCmdResult cmdres; + + devid = FIELD_EX64(cmdpkt[0], INV_0, DEVICEID); + eventid = FIELD_EX64(cmdpkt[1], INV_1, EVENTID); + + trace_gicv3_its_cmd_inv(devid, eventid); + + cmdres = lookup_ite(s, __func__, devid, eventid, &ite, &dte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + + switch (ite.inttype) { + case ITE_INTTYPE_PHYSICAL: + cmdres = lookup_cte(s, __func__, ite.icid, &cte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + gicv3_redist_inv_lpi(&s->gicv3->cpu[cte.rdbase], ite.intid); + break; + case ITE_INTTYPE_VIRTUAL: + if (!its_feature_virtual(s)) { + /* Can't happen unless guest is illegally writing to table memory */ + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid type %d in ITE (table corrupted?)\n", + __func__, ite.inttype); + return CMD_CONTINUE; + } + /* We will implement the vLPI invalidation in a later commit */ + g_assert_not_reached(); + break; + default: + g_assert_not_reached(); + } + + return CMD_CONTINUE_OK; +} + /* * Current implementation blocks until all * commands are processed @@ -1192,14 +1236,18 @@ static void process_cmdq(GICv3ITSState *s) result = process_its_cmd(s, cmdpkt, DISCARD); break; case GITS_CMD_INV: + result = process_inv(s, cmdpkt); + break; case GITS_CMD_INVALL: /* * Current implementation doesn't cache any ITS tables, * but the calculated lpi priority information. We only * need to trigger lpi priority re-calculation to be in * sync with LPI config table or pending table changes. + * INVALL operates on a collection specified by ICID so + * it only affects physical LPIs. */ - trace_gicv3_its_cmd_inv(); + trace_gicv3_its_cmd_invall(); for (i = 0; i < s->gicv3->num_cpu; i++) { gicv3_redist_update_lpi(&s->gicv3->cpu[i]); } diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index b08b599c887..78650a3bb4c 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -681,6 +681,17 @@ void gicv3_redist_process_lpi(GICv3CPUState *cs, int irq, int level) gicv3_redist_lpi_pending(cs, irq, level); } +void gicv3_redist_inv_lpi(GICv3CPUState *cs, int irq) +{ + /* + * The only cached information for LPIs we have is the HPPLPI. + * We could be cleverer about identifying when we don't need + * to do a full rescan of the pending table, but until we find + * this is a performance issue, just always recalculate. + */ + gicv3_redist_update_lpi(cs); +} + void gicv3_redist_mov_lpi(GICv3CPUState *src, GICv3CPUState *dest, int irq) { /* diff --git a/hw/intc/trace-events b/hw/intc/trace-events index b9efe14c690..ae4a3cfb004 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -184,7 +184,8 @@ gicv3_its_cmd_mapd(uint32_t devid, uint32_t size, uint64_t ittaddr, int valid) " gicv3_its_cmd_mapc(uint32_t icid, uint64_t rdbase, int valid) "GICv3 ITS: command MAPC ICID 0x%x RDbase 0x%" PRIx64 " V %d" gicv3_its_cmd_mapi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MAPI DeviceID 0x%x EventID 0x%x ICID 0x%x" gicv3_its_cmd_mapti(uint32_t devid, uint32_t eventid, uint32_t icid, uint32_t intid) "GICv3 ITS: command MAPTI DeviceID 0x%x EventID 0x%x ICID 0x%x pINTID 0x%x" -gicv3_its_cmd_inv(void) "GICv3 ITS: command INV or INVALL" +gicv3_its_cmd_inv(uint32_t devid, uint32_t eventid) "GICv3 ITS: command INV DeviceID 0x%x EventID 0x%x" +gicv3_its_cmd_invall(void) "GICv3 ITS: command INVALL" gicv3_its_cmd_movall(uint64_t rd1, uint64_t rd2) "GICv3 ITS: command MOVALL RDbase1 0x%" PRIx64 " RDbase2 0x%" PRIx64 gicv3_its_cmd_movi(uint32_t devid, uint32_t eventid, uint32_t icid) "GICv3 ITS: command MOVI DeviceID 0x%x EventID 0x%x ICID 0x%x" gicv3_its_cmd_vmapi(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t doorbell) "GICv3 ITS: command VMAPI DeviceID 0x%x EventID 0x%x vPEID 0x%x Dbell_pINTID 0x%x" From patchwork Fri Apr 22 10:03:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564786 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp334620map; Fri, 22 Apr 2022 03:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6wxuNga8TJHwMYZgiJXCWpX/3YqTuonxtmxSsSPWZsmfLjIxrFYRi7Nd12hEnSLysodjF X-Received: by 2002:a05:6214:5185:b0:443:a821:31fc with SMTP id kl5-20020a056214518500b00443a82131fcmr2680312qvb.129.1650622990059; Fri, 22 Apr 2022 03:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622990; cv=none; d=google.com; s=arc-20160816; b=xUaUazC+t1fNtT2U+6IjDf3SP2dNnuUeuwonwZTb7Gb/D4xb9AHQmYtRSD7fSUHzKb oTkRa6JVlRSRG9Pb0MtJ7bL6/WjkM8mJOalKRDnifUShg/XfuEmAt21I1oaZIu7LjwZ6 lHiIsVPC4ithNmPqy/Cj7xGDphPBaot5ik2zIOB2DW9RUc0obZdnn7XwDIVLQesH2aIY q7gjEFBgIhZ7mokCH2mOmiQgk95VHcz+2AYbHKyphySZqNeDApEbr1hBYSosgtsoCvr4 r7NifxeIdz7i/NLvqR9wMqTHiEWFgihX8FgbCp4HJxbCfyf3q6TRjy9lGUwyGO4gTpub kaPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wi2fGPBxkZ6i5KbZuM7Jvw/j5gXrJnvmG9yJChG88LE=; b=oBeA9379NP1vdOuYtB/2dP1HpImuroyX7+s/Wuj5DmMEXAdk3LWXGQgGgO0cBPS4tf ChRevVk0q3lNw6zMPeaijFhjcfW8cZi3IZDY9M93uHESab/WQoQjNy4bbdbSkCA9iMZ0 AEF6rq7aAKeKc3cOfO637ZoNwh61wVL6dz3k8XIipHsCEqTloZFZaByLEdHG1OrmJ8fi I1xD9CJzGDJCDj7jvtkcsxFofJl2S+Fy4hBrr1Gz2t1M/5n4qamdrQVQYlO5WPOrTrOH kjn3T7xmJyhVtytmfbIQn1e5c3YmiCzrHrHiaJgoD+EsiCKqJFXf+KslvggeNJQbJXYV rrLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LyuES/af"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s4-20020ae9de04000000b0069c72f8053esi1987271qkf.341.2022.04.22.03.23.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:23:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LyuES/af"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqRR-0008B8-J1 for patch@linaro.org; Fri, 22 Apr 2022 06:23:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9n-0004NQ-8w for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:55 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:39602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9l-0002cV-Gq for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:54 -0400 Received: by mail-wr1-x42b.google.com with SMTP id m14so10320308wrb.6 for ; Fri, 22 Apr 2022 03:04:52 -0700 (PDT) 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=wi2fGPBxkZ6i5KbZuM7Jvw/j5gXrJnvmG9yJChG88LE=; b=LyuES/afO9uQgr9431a6ZqVpd2IgD95wzC17/xrplFaDNpXBofL+gyVOqqzTWaJn7l 9wfLF53mUmjkTQhQKv8QMtRkcoVrnf7mV1M9p+SE1/aoHIe5vEW6UuUlJLW2W4ERdPj9 dH1sXQFXNNKSAogur2Xo1//66Tv5nsmukGkRLAjRsQfUYkewBnMrYvoY9147Jl776Vav rG8s+L2P1VxKz4R5AA6UsOyC/o79Bfzbf/hQmCd0XE/4+YefDCfBwjUOBSYi+5NW2uyI 6myAGzembiQHhL7lGjHhgizYZl3sAjLzg3s6mG6q+p3AILL3t6vcJw5+gK5lX7y8w23L wccw== 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=wi2fGPBxkZ6i5KbZuM7Jvw/j5gXrJnvmG9yJChG88LE=; b=sctpKIYEunazIHgIzCWmydorRZWP+buSLkcistLJJ4ZYeLmOj754CirwltHeUmkq7Z QMN1fPKMvsRayE6GDhQjVHWiUW1ov4evVwnsEClc8LwL3wF/5YyUDsAH5T8LuDvOUJQ1 E6+mSPXB+0MJqFrPy17FWtBVoxM7H9SDxB+7FK6X4S2oz81/3cC+OBFFRiN8krwD9vD5 /ycISOoQS1H1xjI+fzwv4fCt19qhltqi3Oe9lAnoTAe9VtytFoD/2CU6IPk7VZ13dQCL PQbrBjYv/tPzWkBR4m/Xeg5U57XYtDAadsUIVnI+1IFHzSd+v0IaAMyKJkkzkNCbchRw Wp/Q== X-Gm-Message-State: AOAM530TkNdF0GhxroEmIHImGhOXcr5+jF4PamcAaJsoptY46OvLnsdg lyNCoKLz/RzO9cjH4O/G3Qb40sBIyvoZEg== X-Received: by 2002:a05:6000:18a8:b0:20a:8a58:1639 with SMTP id b8-20020a05600018a800b0020a8a581639mr3020545wri.483.1650621891820; Fri, 22 Apr 2022 03:04:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/61] hw/intc/arm_gicv3_its: Implement INV for virtual interrupts Date: Fri, 22 Apr 2022 11:03:50 +0100 Message-Id: <20220422100432.2288247-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the ITS side of the handling of the INV command for virtual interrupts; as usual this calls into a redistributor function which we leave as a stub to fill in later. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-20-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 9 +++++++++ hw/intc/arm_gicv3_its.c | 16 ++++++++++++++-- hw/intc/arm_gicv3_redist.c | 8 ++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 25ea19de385..2f653a9b917 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -585,6 +585,15 @@ void gicv3_redist_update_lpi_only(GICv3CPUState *cs); * Forget or update any cached information associated with this LPI. */ void gicv3_redist_inv_lpi(GICv3CPUState *cs, int irq); +/** + * gicv3_redist_inv_vlpi: + * @cs: GICv3CPUState + * @irq: vLPI to invalidate cached information for + * @vptaddr: (guest) address of vLPI table + * + * Forget or update any cached information associated with this vLPI. + */ +void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr); /** * gicv3_redist_mov_lpi: * @src: source redistributor diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index aa0a62510e5..f7c01c2be19 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1090,6 +1090,7 @@ static ItsCmdResult process_inv(GICv3ITSState *s, const uint64_t *cmdpkt) ITEntry ite; DTEntry dte; CTEntry cte; + VTEntry vte; ItsCmdResult cmdres; devid = FIELD_EX64(cmdpkt[0], INV_0, DEVICEID); @@ -1118,8 +1119,19 @@ static ItsCmdResult process_inv(GICv3ITSState *s, const uint64_t *cmdpkt) __func__, ite.inttype); return CMD_CONTINUE; } - /* We will implement the vLPI invalidation in a later commit */ - g_assert_not_reached(); + + cmdres = lookup_vte(s, __func__, ite.vpeid, &vte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + if (!intid_in_lpi_range(ite.intid) || + ite.intid >= (1ULL << (vte.vptsize + 1))) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: intid 0x%x out of range\n", + __func__, ite.intid); + return CMD_CONTINUE; + } + gicv3_redist_inv_vlpi(&s->gicv3->cpu[vte.rdbase], ite.intid, + vte.vptaddr << 16); break; default: g_assert_not_reached(); diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 78650a3bb4c..856494b4e8f 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -808,6 +808,14 @@ void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, */ } +void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr) +{ + /* + * The redistributor handling for invalidating cached information + * about a VLPI will be added in a subsequent commit. + */ +} + void gicv3_redist_set_irq(GICv3CPUState *cs, int irq, int level) { /* Update redistributor state for a change in an external PPI input line */ From patchwork Fri Apr 22 10:03:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564797 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp347262map; Fri, 22 Apr 2022 03:43:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUs+LnFz+NsTC9YL62SctCEqInZyfAqxV2PaVk/gd03Qeu4tbLSB41ZRViOKhNWWyusick X-Received: by 2002:a05:6214:21eb:b0:454:9bc0:ae47 with SMTP id p11-20020a05621421eb00b004549bc0ae47mr188066qvj.114.1650624184113; Fri, 22 Apr 2022 03:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624184; cv=none; d=google.com; s=arc-20160816; b=rH3+CkC76Mmz9eYl7uKg5xddBUc0/cQCiVc1qZzU4CHlahCG69YxQOZwSaqpUWZClu qTksNp3fImobFhJQO2qO8DWyfAScvO9S6sCX/tmrYhyCJDHSzzPV5r8w4oFZRbcERhO+ oH8yQHPcXaBdEOSZdbhWzVLFFXlSVY07uv+CzS+YtA69401RgnAV+om8SD2P9Y1YvKwn oEuPIKwzObYxTdKNk7ldGJx9V1AU9rUMSc+Rtk5HmzM3/o4kRiM+AswKar2h/CSfJFxK CB7ORYhPL6RfhKwGhnTvVLaSznqqx8Z4SPJzzemNi4lc5gN7DZyyDMQEvlAZ9kuCfQGJ jLGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=8RgWYhgKur6Ax4yz2dzmYZrqxwZTXpBGbv3xdnrc6bE=; b=vwK3fgyJ7IKsY7PNo9Oo9Bq9gN3SwF4tch4uj4X9Z1esfL6OuxWz8LiBhvexPaq6hA O/HU3lEeuU34g+qEE0en4x8sfrXJFkkzAufdDG6mFdxHH1H7VnIK3QaEOLf6B82TOh7b Tz+qN+GLXjLh2x4eq4w72oXxvTC+k7EEXVeG/wzH9IL3WyVUH5zrxshyjcUtQR2gj/Kf gD67KI2sF+L+mgdNszW+PewzJzm7TruKEFhzo+ogbZI015+mWxEsT33TBRbCuvrqrTax QuhziAnZxI0eEL4VvhPbfMWkc8x4ZloOq088RAqMmG5cEZs91UB1PVZahlQAJFrbK7oL uGQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VlnFJ792; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k1-20020ad45be1000000b00444487614e0si2190463qvc.282.2022.04.22.03.43.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VlnFJ792; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqkh-0003Dw-LN for patch@linaro.org; Fri, 22 Apr 2022 06:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9p-0004UH-Br for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:57 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:34687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9n-0002cv-C2 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:57 -0400 Received: by mail-wm1-x32d.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so4691727wmb.1 for ; Fri, 22 Apr 2022 03:04:54 -0700 (PDT) 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=8RgWYhgKur6Ax4yz2dzmYZrqxwZTXpBGbv3xdnrc6bE=; b=VlnFJ792NRBN7jywmFqgn8v6wunMHPCXHCPmHCsLGBjzOeSN8O/ne3B4ZOyW9FBSpc flw3j8RDgcNK0lyZ7yd7bvvhdKKLEJCECN26fxE0j2I/b6DLF/J0Cgae/xrs5w3Abeiz 7iOl4Nfd+k+o9QEz8c9mT3zyeIGu31WObvMW/U2tqr5+mngSCdgUC/dlMMunM16tVv52 /Qkhlhb9tD2d64TgIGBfISWhirHMBGbWixtXlboHSNdVG/ni24v6AnNm+rvUQSNdkZBn Da3fv06xI0vK5H5zbjIuB4SZfIsmk91UqKf13UYctoNxYhewTEdr0cV6Kt3cOjaPBVNb BkOA== 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=8RgWYhgKur6Ax4yz2dzmYZrqxwZTXpBGbv3xdnrc6bE=; b=wTfdqT3UuDfUmjeBZkF/UHm70jB6cRyCD9Cf0drjkQbXPcqLOvwVcNz7aF32KApT1j pyBqXZQ2VOAp9eOpFhSqkrC07JvYx6PAsZFVs5x8YWzJ+9lejc+PNT32Tyr5fXx6zvfP R3B9+rOYSIIeay7Pe/Xzz/YmkRkr+mulTPyBQMgLyilMMCfMFznDc0otdoKtR1CQWmJG Js5eQd9OqaJrrJnpZpBRB7PWchuBkUtJV9Oa4kspxqL+7022IU0kT+iLPbdlQrz49LDs qHwRpkJioliXT89+dh+eR4wDnlKTPWCVgRuREqwoG1fcepLIJ9m70it1ChspB3njTWVp g6yQ== X-Gm-Message-State: AOAM531mbcbwVkIngI0BXuXmKz+7ccHjx97mGWLR6MzWOtU1y2M/agZa GiYc16vrBnB+1WmXGXakAd6w8DRVgUqGuA== X-Received: by 2002:a05:600c:a06:b0:392:a4f2:2097 with SMTP id z6-20020a05600c0a0600b00392a4f22097mr12706179wmp.97.1650621892808; Fri, 22 Apr 2022 03:04:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/61] hw/intc/arm_gicv3_its: Implement VMOVI Date: Fri, 22 Apr 2022 11:03:51 +0100 Message-Id: <20220422100432.2288247-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the GICv4 VMOVI command, which moves the pending state of a virtual interrupt from one redistributor to another. As with MOVI, we handle the "parse and validate command arguments and table lookups" part in the ITS source file, and pass the final results to a function in the redistributor which will do the actual operation. As with the "make a VLPI pending" change, for the moment we leave that redistributor function as a stub, to be implemented in a later commit. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-21-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 23 +++++++++++ hw/intc/arm_gicv3_its.c | 82 ++++++++++++++++++++++++++++++++++++++ hw/intc/arm_gicv3_redist.c | 10 +++++ hw/intc/trace-events | 1 + 4 files changed, 116 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 2f653a9b917..050e19d133b 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -329,6 +329,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_INVALL 0x0D #define GITS_CMD_MOVALL 0x0E #define GITS_CMD_DISCARD 0x0F +#define GITS_CMD_VMOVI 0x21 #define GITS_CMD_VMOVP 0x22 #define GITS_CMD_VSYNC 0x25 #define GITS_CMD_VMAPP 0x29 @@ -403,6 +404,13 @@ FIELD(VMOVP_2, RDBASE, 16, 36) FIELD(VMOVP_2, DB, 63, 1) /* GICv4.1 only */ FIELD(VMOVP_3, DEFAULT_DOORBELL, 0, 32) /* GICv4.1 only */ +/* VMOVI command fields */ +FIELD(VMOVI_0, DEVICEID, 32, 32) +FIELD(VMOVI_1, EVENTID, 0, 32) +FIELD(VMOVI_1, VPEID, 32, 16) +FIELD(VMOVI_2, D, 0, 1) +FIELD(VMOVI_2, DOORBELL, 32, 32) + /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec @@ -614,6 +622,21 @@ void gicv3_redist_mov_lpi(GICv3CPUState *src, GICv3CPUState *dest, int irq); * by the ITS MOVALL command. */ void gicv3_redist_movall_lpis(GICv3CPUState *src, GICv3CPUState *dest); +/** + * gicv3_redist_mov_vlpi: + * @src: source redistributor + * @src_vptaddr: (guest) address of source VLPI table + * @dest: destination redistributor + * @dest_vptaddr: (guest) address of destination VLPI table + * @irq: VLPI to update + * @doorbell: doorbell for destination (1023 for "no doorbell") + * + * Move the pending state of the specified VLPI from @src to @dest, + * as required by the ITS VMOVI command. + */ +void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, + GICv3CPUState *dest, uint64_t dest_vptaddr, + int irq, int doorbell); void gicv3_redist_send_sgi(GICv3CPUState *cs, int grp, int irq, bool ns); void gicv3_init_cpuif(GICv3State *s); diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index f7c01c2be19..c718ef2ff92 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1084,6 +1084,85 @@ static ItsCmdResult process_vmovp(GICv3ITSState *s, const uint64_t *cmdpkt) return cbdata.result; } +static ItsCmdResult process_vmovi(GICv3ITSState *s, const uint64_t *cmdpkt) +{ + uint32_t devid, eventid, vpeid, doorbell; + bool doorbell_valid; + DTEntry dte; + ITEntry ite; + VTEntry old_vte, new_vte; + ItsCmdResult cmdres; + + if (!its_feature_virtual(s)) { + return CMD_CONTINUE; + } + + devid = FIELD_EX64(cmdpkt[0], VMOVI_0, DEVICEID); + eventid = FIELD_EX64(cmdpkt[1], VMOVI_1, EVENTID); + vpeid = FIELD_EX64(cmdpkt[1], VMOVI_1, VPEID); + doorbell_valid = FIELD_EX64(cmdpkt[2], VMOVI_2, D); + doorbell = FIELD_EX64(cmdpkt[2], VMOVI_2, DOORBELL); + + trace_gicv3_its_cmd_vmovi(devid, eventid, vpeid, doorbell_valid, doorbell); + + if (doorbell_valid && !valid_doorbell(doorbell)) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid doorbell 0x%x\n", __func__, doorbell); + return CMD_CONTINUE; + } + + cmdres = lookup_ite(s, __func__, devid, eventid, &ite, &dte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + + if (ite.inttype != ITE_INTTYPE_VIRTUAL) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: ITE is not for virtual interrupt\n", + __func__); + return CMD_CONTINUE; + } + + cmdres = lookup_vte(s, __func__, ite.vpeid, &old_vte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + cmdres = lookup_vte(s, __func__, vpeid, &new_vte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + + if (!intid_in_lpi_range(ite.intid) || + ite.intid >= (1ULL << (old_vte.vptsize + 1)) || + ite.intid >= (1ULL << (new_vte.vptsize + 1))) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: ITE intid 0x%x out of range\n", + __func__, ite.intid); + return CMD_CONTINUE; + } + + ite.vpeid = vpeid; + if (doorbell_valid) { + ite.doorbell = doorbell; + } + + /* + * Move the LPI from the old redistributor to the new one. We don't + * need to do anything if the guest somehow specified the + * same pending table for source and destination. + */ + if (old_vte.vptaddr != new_vte.vptaddr) { + gicv3_redist_mov_vlpi(&s->gicv3->cpu[old_vte.rdbase], + old_vte.vptaddr << 16, + &s->gicv3->cpu[new_vte.rdbase], + new_vte.vptaddr << 16, + ite.intid, + ite.doorbell); + } + + /* Update the ITE to the new VPEID and possibly doorbell values */ + return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STALL; +} + static ItsCmdResult process_inv(GICv3ITSState *s, const uint64_t *cmdpkt) { uint32_t devid, eventid; @@ -1282,6 +1361,9 @@ static void process_cmdq(GICv3ITSState *s) case GITS_CMD_VMOVP: result = process_vmovp(s, cmdpkt); break; + case GITS_CMD_VMOVI: + result = process_vmovi(s, cmdpkt); + break; default: trace_gicv3_its_cmd_unknown(cmd); break; diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 856494b4e8f..dc25997d1f9 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -808,6 +808,16 @@ void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, */ } +void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, + GICv3CPUState *dest, uint64_t dest_vptaddr, + int irq, int doorbell) +{ + /* + * The redistributor handling for moving a VLPI will be added + * in a subsequent commit. + */ +} + void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr) { /* diff --git a/hw/intc/trace-events b/hw/intc/trace-events index ae4a3cfb004..9894756e55a 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -193,6 +193,7 @@ gicv3_its_cmd_vmapti(uint32_t devid, uint32_t eventid, uint32_t vpeid, uint32_t gicv3_its_cmd_vmapp(uint32_t vpeid, uint64_t rdbase, int valid, uint64_t vptaddr, uint32_t vptsize) "GICv3 ITS: command VMAPP vPEID 0x%x RDbase 0x%" PRIx64 " V %d VPT_addr 0x%" PRIx64 " VPT_size 0x%x" gicv3_its_cmd_vmovp(uint32_t vpeid, uint64_t rdbase) "GICv3 ITS: command VMOVP vPEID 0x%x RDbase 0x%" PRIx64 gicv3_its_cmd_vsync(void) "GICv3 ITS: command VSYNC" +gicv3_its_cmd_vmovi(uint32_t devid, uint32_t eventid, uint32_t vpeid, int dbvalid, uint32_t doorbell) "GICv3 ITS: command VMOVI DeviceID 0x%x EventID 0x%x vPEID 0x%x D %d Dbell_pINTID 0x%x" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" From patchwork Fri Apr 22 10:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564804 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp352476map; Fri, 22 Apr 2022 03:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy0EMI3q9zuye48m3ik19fKivDH0emWVJaisDY5dFib8EEdeJDKByDRQk2ODKXsoMt2+RU X-Received: by 2002:a05:6214:2587:b0:453:7467:c4af with SMTP id fq7-20020a056214258700b004537467c4afmr813634qvb.19.1650624720356; Fri, 22 Apr 2022 03:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624720; cv=none; d=google.com; s=arc-20160816; b=v0BPe3R9OTJkD7dyo6sS8ZHko3L3A+IsqoQlkLWZbvYJ+NBXUAhLARsFuv/sdM3I6w AzgGOAVu14OeFnPrh14G63yz5dOEjpWnC469K9z2hIELHZ0PspJ1QCCFzVEGx5oJ7uUb PoNNqDCMDiQqHJ5ugYExJ8PjN4xOIaDEHHc5C66qBij/lvufCOatfdWgXlPnIGPJhVLK 3wqHQxL2yfkx1EdNSKaw7sljuECcn5meEobj/lNULvD/zEWFNr3oYucUl7Y2pHqyN7Y7 tOt4XrUJrdbb3CGiQB8w0Ny5xcok5Us4y85nNbvykFSWAyAJ4MYDN5BoUuhgDL+H7NoZ FLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WIST8kjiIGq+L/1mU+YgaPeTPxejflCj2X2BV/ommNc=; b=DRzTOMX23UacpjwSA1TxolVh8v9g7leqimucid9Y/h/GqVmKsuRbgZMAqXJrQn5WyO Mhfv11oMliNJTL++LODEMz1+8mxRTsu8+vGrVFbDjfxZijfmceS4DsbB2yHMlGiwjHnW 4dHujhuUgsMdEBPbkbh9sEYlHYxIvViVp8FnBE3dD5mpP1fyA9rKCm773SQi9v14OaQf +p7HWjDgXUKstcStAw/O+zriI8bKpBRhWB5MYUE1mlwBFxJdxLliYBXie5UjI4TKmVYm eGWhM9QixUkdYCPrnqHOA2yVbobFVkhKjq5ETrUH/UhpG9VzH3SVM3BqHc9OgKy2c+Qn Tbyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eUabf6FY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q21-20020a05622a031500b002f1f38b4eb8si2140750qtw.699.2022.04.22.03.52.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:52:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eUabf6FY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqtL-0006aJ-RO for patch@linaro.org; Fri, 22 Apr 2022 06:51:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9p-0004TQ-2i for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:57 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:51054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9n-0002cr-96 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:56 -0400 Received: by mail-wm1-x32e.google.com with SMTP id r19so4805219wmq.0 for ; Fri, 22 Apr 2022 03:04:54 -0700 (PDT) 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=WIST8kjiIGq+L/1mU+YgaPeTPxejflCj2X2BV/ommNc=; b=eUabf6FYm6XHFWyEhI8QYYDKGptEjsdraJtgoiqkwExudh04nhCbR1EONTSxQ48sHM bVHE+VcTvAIZTkYwFNjFED5hjND/rLbqMnMLeis12B8FQiAmJ2b7Dnku/0xXcT0hoDmD SFeFpYjsmd+8Bjll1mfOqJvcZTCjnPqefR8OZ3Vlvejb9rULwCiFScc+EzAXgn9JjcBF crycMaVvZGDepjFUereq2aKVnpzVDSajGXkHhTAnm4vMUx/Xwl8QOb2JejT49PhFAMx/ EfxKEi+10syD2I3F9yIm3yWCxL5J31ElW24qrnn8TIcIsWKUSRPLWDrtTxKMsmqG8sx2 /s1w== 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=WIST8kjiIGq+L/1mU+YgaPeTPxejflCj2X2BV/ommNc=; b=TtUXMkkhoZDgsHZxpFP3bCJMNov2JkVMoK/JbSmeVF8QUth50z7dMqdm+4nZCJdNf8 onOvF2FwvDmfgXAz/Uiyhpa3yTDPmio2dnpVXPw3M0IBImPusmomVFG5IOEaYLvzjFqI +vPJLvSxNCH7e+ymxYIflbdtIWDQ79uQ0F515VtpvptJWZ9VwyVFChcmwkGcF5RLkGM7 Py+fQRiT57a3cv97SpIEovXTbCIFmivxC2T72OaD/qAaSsCmIaxI4TgQyyyTDUe+B40Q Pab+Ir4OWVBXzOiQnn/Y8h425UA6DLzIAgyIActDycJ28lmgCz2qTJYGcvhfc/qbYOMt mgng== X-Gm-Message-State: AOAM531WfMxDsRWXpvO4Q7hwdI3AjJtbO6PUvlI5Tiwphd0D7KeAE0H9 yppeq1vZbx9FmYQdMXuaxHpn78WbVdvO0A== X-Received: by 2002:a05:600c:1e85:b0:391:ca59:76be with SMTP id be5-20020a05600c1e8500b00391ca5976bemr12411734wmb.184.1650621893686; Fri, 22 Apr 2022 03:04:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/61] hw/intc/arm_gicv3_its: Implement VINVALL Date: Fri, 22 Apr 2022 11:03:52 +0100 Message-Id: <20220422100432.2288247-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The VINVALL command should cause any cached information in the ITS or redistributor for the specified vCPU to be dropped or otherwise made consistent with the in-memory LPI configuration tables. Here we implement the command and table parsing, leaving the redistributor part as a stub for the moment, as usual. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-22-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 13 +++++++++++++ hw/intc/arm_gicv3_its.c | 26 ++++++++++++++++++++++++++ hw/intc/arm_gicv3_redist.c | 5 +++++ hw/intc/trace-events | 1 + 4 files changed, 45 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 050e19d133b..8d58d38836f 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -335,6 +335,7 @@ FIELD(GITS_TYPER, CIL, 36, 1) #define GITS_CMD_VMAPP 0x29 #define GITS_CMD_VMAPTI 0x2A #define GITS_CMD_VMAPI 0x2B +#define GITS_CMD_VINVALL 0x2D /* MAPC command fields */ #define ICID_LENGTH 16 @@ -411,6 +412,9 @@ FIELD(VMOVI_1, VPEID, 32, 16) FIELD(VMOVI_2, D, 0, 1) FIELD(VMOVI_2, DOORBELL, 32, 32) +/* VINVALL command fields */ +FIELD(VINVALL_1, VPEID, 32, 16) + /* * 12 bytes Interrupt translation Table Entry size * as per Table 5.3 in GICv3 spec @@ -637,6 +641,15 @@ void gicv3_redist_movall_lpis(GICv3CPUState *src, GICv3CPUState *dest); void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, GICv3CPUState *dest, uint64_t dest_vptaddr, int irq, int doorbell); +/** + * gicv3_redist_vinvall: + * @cs: GICv3CPUState + * @vptaddr: address of VLPI pending table + * + * On redistributor @cs, invalidate all cached information associated + * with the vCPU defined by @vptaddr. + */ +void gicv3_redist_vinvall(GICv3CPUState *cs, uint64_t vptaddr); void gicv3_redist_send_sgi(GICv3CPUState *cs, int grp, int irq, bool ns); void gicv3_init_cpuif(GICv3State *s); diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index c718ef2ff92..0670aca4d46 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1163,6 +1163,29 @@ static ItsCmdResult process_vmovi(GICv3ITSState *s, const uint64_t *cmdpkt) return update_ite(s, eventid, &dte, &ite) ? CMD_CONTINUE_OK : CMD_STALL; } +static ItsCmdResult process_vinvall(GICv3ITSState *s, const uint64_t *cmdpkt) +{ + VTEntry vte; + uint32_t vpeid; + ItsCmdResult cmdres; + + if (!its_feature_virtual(s)) { + return CMD_CONTINUE; + } + + vpeid = FIELD_EX64(cmdpkt[1], VINVALL_1, VPEID); + + trace_gicv3_its_cmd_vinvall(vpeid); + + cmdres = lookup_vte(s, __func__, vpeid, &vte); + if (cmdres != CMD_CONTINUE_OK) { + return cmdres; + } + + gicv3_redist_vinvall(&s->gicv3->cpu[vte.rdbase], vte.vptaddr << 16); + return CMD_CONTINUE_OK; +} + static ItsCmdResult process_inv(GICv3ITSState *s, const uint64_t *cmdpkt) { uint32_t devid, eventid; @@ -1364,6 +1387,9 @@ static void process_cmdq(GICv3ITSState *s) case GITS_CMD_VMOVI: result = process_vmovi(s, cmdpkt); break; + case GITS_CMD_VINVALL: + result = process_vinvall(s, cmdpkt); + break; default: trace_gicv3_its_cmd_unknown(cmd); break; diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index dc25997d1f9..7c75dd6f072 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -818,6 +818,11 @@ void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, */ } +void gicv3_redist_vinvall(GICv3CPUState *cs, uint64_t vptaddr) +{ + /* The redistributor handling will be added in a subsequent commit */ +} + void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr) { /* diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 9894756e55a..004a1006fb8 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -194,6 +194,7 @@ gicv3_its_cmd_vmapp(uint32_t vpeid, uint64_t rdbase, int valid, uint64_t vptaddr gicv3_its_cmd_vmovp(uint32_t vpeid, uint64_t rdbase) "GICv3 ITS: command VMOVP vPEID 0x%x RDbase 0x%" PRIx64 gicv3_its_cmd_vsync(void) "GICv3 ITS: command VSYNC" gicv3_its_cmd_vmovi(uint32_t devid, uint32_t eventid, uint32_t vpeid, int dbvalid, uint32_t doorbell) "GICv3 ITS: command VMOVI DeviceID 0x%x EventID 0x%x vPEID 0x%x D %d Dbell_pINTID 0x%x" +gicv3_its_cmd_vinvall(uint32_t vpeid) "GICv3 ITS: command VINVALL vPEID 0x%x" gicv3_its_cmd_unknown(unsigned cmd) "GICv3 ITS: unknown command 0x%x" gicv3_its_cte_read(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table read for ICID 0x%x: valid %d RDBase 0x%x" gicv3_its_cte_write(uint32_t icid, int valid, uint32_t rdbase) "GICv3 ITS: Collection Table write for ICID 0x%x: valid %d RDBase 0x%x" From patchwork Fri Apr 22 10:03:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564808 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp354534map; Fri, 22 Apr 2022 03:55:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEOVCJhA2rVWEB5GmaaYe+sBG4xY0+ien3Adx+Wk/NcIDsKnb6Dskjlanb7EG2ww7QqnTd X-Received: by 2002:a05:620a:462a:b0:69e:cfa5:b9c5 with SMTP id br42-20020a05620a462a00b0069ecfa5b9c5mr2234931qkb.422.1650624931077; Fri, 22 Apr 2022 03:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624931; cv=none; d=google.com; s=arc-20160816; b=LqGKPYg57yZnhQmqmVk0YBKL6zz5ciQCJbPzgslw0TyGSZSgvpQWjFHxtIl7vY2FB4 W69XvPlKbcF4TEOUZyrAo9xzqYEISzEF9qIjPSn+i0m0wSZ5FT0ED/I6OGvhMIUCxPgO 1ESR34CkeMEKcUVAjWswLBl8yQ8yOLJBNFlByNZYR/wIV/qEMSzPnIjEdmbC61SAibpp 2Yz3iHGEGMHvSaHbFGCCTMuX8n7f9Mi8KbqUkfjJu9xeYGC4hngqnfWhGjPo7wepsQ5v vsv9092MKmyJzASt8J8TWHeC45uD7EtBLOBuQSaH+SdPJV38lgLyyq1cxqvjKWtO7ARE VaMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c0yHcR8YX+80NnBGhmsGm2fxQhfDVLS6/G8Kbm/Fj84=; b=eAkTU6AIHb5GbH4VHP+8S/76k90/2V2cP5TOZHV6LGiuUDj6+KTZJURkyovKpe33Zf 0EFRbQdvao/X1lnRAcdtPWvs/7vT7wjwBEaMoPdkLG27OHzGBCPwSWXeXO8wxRAUcnki I5jO2Y3sW2pI2NwHPy8e3s8MsKf72c2F9amNqMRMec67MrcUp7sAOr+92oPtLSGXTeRr 8b1BvdMzNjthCcFr8b02TnCTySvU2qrs20JJWIV3YXgGWQ+LVXJIa6HuXoOBjHynKQbx pZCWArOlKAYi8/KowDTrcsHd57y7gSyb3uJ+QeroRMaOc6UdengOYT6C0yq7CwS6+4V6 ae0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tmTTrwiJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d14-20020a05621421ce00b0044361aca758si777235qvh.526.2022.04.22.03.55.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:55:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tmTTrwiJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqwk-0005L0-MB for patch@linaro.org; Fri, 22 Apr 2022 06:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9q-0004YZ-L2 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:58 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:43560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9o-0002dR-MU for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:58 -0400 Received: by mail-wr1-x429.google.com with SMTP id v12so3513643wrv.10 for ; Fri, 22 Apr 2022 03:04:56 -0700 (PDT) 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=c0yHcR8YX+80NnBGhmsGm2fxQhfDVLS6/G8Kbm/Fj84=; b=tmTTrwiJbvK+gh7yf6bmS+eWH7jbBLcE5UujWpp5n1q2LtZ4QS0bEuJZeaUutsa4ym 6dWpDnOBSlSz0LFluZNY6qYETWG6nWKmz9S/Fk1+lTGHn3iNcweTSXTvJUBT1ZTX3FWM s7LlzqFAneGxWPIXx2WTQGt6soqEXBnvDZzw7hprQz2PAgyKYdjlYKJ9CYlqBWzIUTi9 NzT6GE38eOciasEgNYeKXANLALI5ci9EQwOyCjVEJhECTENwVK9PQ0QA0ahnqRRiht+N eSnzQInJb1WFFMFZMd0VBui/UbZ1xxyPFfVZPBRsiTkcVwV/oGz6x3BRleE3Wv21y83D K4AQ== 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=c0yHcR8YX+80NnBGhmsGm2fxQhfDVLS6/G8Kbm/Fj84=; b=0QT+1O9IsSaaMTqKc522ZiXTeKLJTGtyIRFT8GKIhDgdcyIuxpbY1o20dXGZ8XVlxy XhrAcq3vrUz9c/jaTzZk5L1SQ49UdRnHEbAwsZsFMxDHVLQOvcrAAdLF9fhUSExpftCn 49NkcsjrM0c8aOn2tb69QeEYxke4MJrEAKyOg9HjId3cncUfHkR6zruxhCO8uvemvtxk 9tESbNZRvETrjpQB9uuGcXj2biwx8+UXzZb6UCuVPgW3eVZtLVsH6/dkMX6vMpOh7wa2 XZdxNGC65ajmAHMa9jsrqc2gAEt000a+aLcNbtypq681V07CoybsetRH/CyE65yFMdnP n9CQ== X-Gm-Message-State: AOAM533M80D/NMb6GXOFYLsDCPr0lmqg2bK+MyV/BOIxDCLoAmledkTR I+gSF6VKHtEmG42Wy986bCTtF5DDRkiHKQ== X-Received: by 2002:adf:d1ce:0:b0:20a:992a:3b54 with SMTP id b14-20020adfd1ce000000b0020a992a3b54mr3005173wrd.270.1650621894704; Fri, 22 Apr 2022 03:04:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/61] hw/intc/arm_gicv3: Implement GICv4's new redistributor frame Date: Fri, 22 Apr 2022 11:03:53 +0100 Message-Id: <20220422100432.2288247-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The GICv4 extends the redistributor register map -- where GICv3 had two 64KB frames per CPU, GICv4 has four frames. Add support for the extra frame by using a new gicv3_redist_size() function in the places in the GIC implementation which currently use a fixed constant size for the redistributor register block. (Until we implement the extra registers they will RAZ/WI.) Any board that wants to use a GICv4 will need to also adjust to handle the different sized redistributor register block; that will be done separately. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-23-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 21 +++++++++++++++++++++ include/hw/intc/arm_gicv3_common.h | 5 +++++ hw/intc/arm_gicv3_common.c | 2 +- hw/intc/arm_gicv3_redist.c | 8 ++++---- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 8d58d38836f..9720ccf7507 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -489,6 +489,27 @@ FIELD(VTE, RDBASE, 42, RDBASE_PROCNUM_LENGTH) /* Functions internal to the emulated GICv3 */ +/** + * gicv3_redist_size: + * @s: GICv3State + * + * Return the size of the redistributor register frame in bytes + * (which depends on what GIC version this is) + */ +static inline int gicv3_redist_size(GICv3State *s) +{ + /* + * Redistributor size is controlled by the redistributor GICR_TYPER.VLPIS. + * It's the same for every redistributor in the GIC, so arbitrarily + * use the register field in the first one. + */ + if (s->cpu[0].gicr_typer & GICR_TYPER_VLPIS) { + return GICV4_REDIST_SIZE; + } else { + return GICV3_REDIST_SIZE; + } +} + /** * gicv3_intid_is_special: * @intid: interrupt ID diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index 08b27789385..40bc404a652 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -38,7 +38,12 @@ #define GICV3_LPI_INTID_START 8192 +/* + * The redistributor in GICv3 has two 64KB frames per CPU; in + * GICv4 it has four 64KB frames per CPU. + */ #define GICV3_REDIST_SIZE 0x20000 +#define GICV4_REDIST_SIZE 0x40000 /* Number of SGI target-list bits */ #define GICV3_TARGETLIST_BITS 16 diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index dcc5ce28c6a..18999e3c8bb 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -295,7 +295,7 @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, memory_region_init_io(®ion->iomem, OBJECT(s), ops ? &ops[1] : NULL, region, name, - s->redist_region_count[i] * GICV3_REDIST_SIZE); + s->redist_region_count[i] * gicv3_redist_size(s)); sysbus_init_mmio(sbd, ®ion->iomem); g_free(name); } diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 7c75dd6f072..9f1fe09a78e 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -442,8 +442,8 @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data, * in the memory map); if so then the GIC has multiple MemoryRegions * for the redistributors. */ - cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE; - offset %= GICV3_REDIST_SIZE; + cpuidx = region->cpuidx + offset / gicv3_redist_size(s); + offset %= gicv3_redist_size(s); cs = &s->cpu[cpuidx]; @@ -501,8 +501,8 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, * in the memory map); if so then the GIC has multiple MemoryRegions * for the redistributors. */ - cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE; - offset %= GICV3_REDIST_SIZE; + cpuidx = region->cpuidx + offset / gicv3_redist_size(s); + offset %= gicv3_redist_size(s); cs = &s->cpu[cpuidx]; From patchwork Fri Apr 22 10:03:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564812 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp356556map; Fri, 22 Apr 2022 03:59:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOQjuhXk7NBW9GMTqEyVLWCbz5OGATpZZO3GlwZPC5+ADDidPVx8rW3G/eIU2kGpC8cIRg X-Received: by 2002:a05:622a:1651:b0:2f3:440c:5ffb with SMTP id y17-20020a05622a165100b002f3440c5ffbmr2643649qtj.232.1650625146514; Fri, 22 Apr 2022 03:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625146; cv=none; d=google.com; s=arc-20160816; b=x7eJ9CYREo2CTGkrkjrTgxoOMAHtULMNzm4u8j+vIFgyp8pQ+s6c/rNfOdYn2TNomA YFnEDvOfVvmHkKN96kXbeZg6M95rN0lBOZSVsGRG9lfhh9PP5gjtzvLiA/NNF9HXD4Hp tvctg0RVw5eljEYthIaWeLd4QHi6erbcp3TjgNaGNKNTfcHhnwkjB4EIKy853EzvfX3h mO6Js6SR58fQEhz3cDaItItktA6Fza+PPZEG4FUrQIo/g6IppUfWiIoz0ty0ggX5WnGs JKWd7YGx47PhzRckrMjDfLKZB+KMhJlhiVfbxewO815Kz2oHMSPrQXujZJ6RoPsk8xZT CeMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=SsmXZg+uwjL7FCu6QoUQXU4qkVe/XwjPaQqP4D8bLQU=; b=qsMhHtQVqtX5XLp2rau9xANKYI9AVEsElJ+seeasFbV5AnjG9nF5xK1QmhkXCzZl+s yP8DAwcEWVnA7QotroJ+QpdIifgp/QUGjtLwcSFjNRSHpEQpepAoxLIZ8uGmEbTJHfnD evOx3MHTwZBRiilLe1vX7lL6b7CppzyMCXM9uUwKxckC7wSu1W8FYqFmeT/oiWy0B9Yn z47uCmh48nVj4pT4goXbrsKVob3djM4Alulku83RFELUmoXn8n/7KmG7T8lXQRfAZNzj 9QvCsQgrT2vS2PdWIDGhH31rjOebOPqqkShnyZbSMKJnaRZwcIQDov7yJFHGvwcqGr8b LYzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yBqv585d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s10-20020ac85cca000000b002f357365206si706836qta.74.2022.04.22.03.59.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yBqv585d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr0E-0004bq-2Q for patch@linaro.org; Fri, 22 Apr 2022 06:59:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9r-0004Zm-7M for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:59 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:33760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9p-0002dW-Ai for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:04:58 -0400 Received: by mail-wm1-x330.google.com with SMTP id l3-20020a05600c1d0300b0038ff89c938bso4849676wms.0 for ; Fri, 22 Apr 2022 03:04:56 -0700 (PDT) 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=SsmXZg+uwjL7FCu6QoUQXU4qkVe/XwjPaQqP4D8bLQU=; b=yBqv585d25wr3ORR9wOllFEzGHe4WXeipZTf8Ua5KXmMTdF9hIAcOY7bB6bZYIewpA zoVcBh919xIv7cWh/e8KebzL53tatn6zZsMqzVQDTRDqjljkPei8C9PDI7jUsYn4UHGA qRYhHTYnghCXgqBd2UwVDKqwD3ATC8dek2xomwobVQwELxEgetY7CEqO1H7+PNbIR0fz SN30wuJjlM7gHkJvEURJCxaPnzUMSEfm6BtAOEb4ugpD0z9DrW97Nqj2GvejjjwLC06Y mfo7ApRJQ7G492Eqj/3KwhKsU9gfr4SAZNgghVlDZMV8eqsIQveGPmQv7xZ4tBrhpU9K DRSg== 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=SsmXZg+uwjL7FCu6QoUQXU4qkVe/XwjPaQqP4D8bLQU=; b=MyAY6HO4QjNQOkC4GWneUjQPYrySFTONZZ+POHCuBWIFwGiRj4XVMFjMFv1hDzQr+4 t8pvIEIMlWetj4tyKq9B2iXnl3MoceTnUJQ5sv0tibXJbxVT0GAu3W2J5RlyxB0Kp7p6 b6y5357L1jio9SNKbCona2HvBV4gAcYfZxEMquOj1YdEel2iitAhbq6brj1Kch2ZF6La 0guRSJvN6728d3ul6RsKvPcqmgEalnira59jDR3j7lUvnXZg14H9BSFkFtS09QKNCB/s 9bi5WhXBujtXsuaFV3Cymk7jU4PO23rXivDD+k0ku6IQcE0Miynale+unoiXHghdUSon sknw== X-Gm-Message-State: AOAM530neBDcjqFSeElaZVXTCR+EcpB0zQoe81bjrbXmQR+HIhqph3v7 hcz8oDGaQNScj0EeaaOE/OniVVIsozXbaA== X-Received: by 2002:a1c:2904:0:b0:37b:ea53:4cbf with SMTP id p4-20020a1c2904000000b0037bea534cbfmr3428072wmp.46.1650621895704; Fri, 22 Apr 2022 03:04:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/61] hw/intc/arm_gicv3: Implement new GICv4 redistributor registers Date: Fri, 22 Apr 2022 11:03:54 +0100 Message-Id: <20220422100432.2288247-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the new GICv4 redistributor registers: GICR_VPROPBASER and GICR_VPENDBASER; for the moment we implement these as simple reads-as-written stubs, together with the necessary migration and reset handling. We don't put ID-register checks on the handling of these registers, because they are all in the only-in-v4 extra register frames, so they're not accessible in a GICv3. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-24-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 21 +++++++++++ include/hw/intc/arm_gicv3_common.h | 3 ++ hw/intc/arm_gicv3_common.c | 22 ++++++++++++ hw/intc/arm_gicv3_redist.c | 56 ++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 9720ccf7507..795bf57d2b3 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -77,6 +77,7 @@ * Redistributor frame offsets from RD_base */ #define GICR_SGI_OFFSET 0x10000 +#define GICR_VLPI_OFFSET 0x20000 /* * Redistributor registers, offsets from RD_base @@ -109,6 +110,10 @@ #define GICR_IGRPMODR0 (GICR_SGI_OFFSET + 0x0D00) #define GICR_NSACR (GICR_SGI_OFFSET + 0x0E00) +/* VLPI redistributor registers, offsets from VLPI_base */ +#define GICR_VPROPBASER (GICR_VLPI_OFFSET + 0x70) +#define GICR_VPENDBASER (GICR_VLPI_OFFSET + 0x78) + #define GICR_CTLR_ENABLE_LPIS (1U << 0) #define GICR_CTLR_CES (1U << 1) #define GICR_CTLR_RWP (1U << 3) @@ -143,6 +148,22 @@ FIELD(GICR_PENDBASER, PTZ, 62, 1) #define GICR_PROPBASER_IDBITS_THRESHOLD 0xd +/* These are the GICv4 VPROPBASER and VPENDBASER layouts; v4.1 is different */ +FIELD(GICR_VPROPBASER, IDBITS, 0, 5) +FIELD(GICR_VPROPBASER, INNERCACHE, 7, 3) +FIELD(GICR_VPROPBASER, SHAREABILITY, 10, 2) +FIELD(GICR_VPROPBASER, PHYADDR, 12, 40) +FIELD(GICR_VPROPBASER, OUTERCACHE, 56, 3) + +FIELD(GICR_VPENDBASER, INNERCACHE, 7, 3) +FIELD(GICR_VPENDBASER, SHAREABILITY, 10, 2) +FIELD(GICR_VPENDBASER, PHYADDR, 16, 36) +FIELD(GICR_VPENDBASER, OUTERCACHE, 56, 3) +FIELD(GICR_VPENDBASER, DIRTY, 60, 1) +FIELD(GICR_VPENDBASER, PENDINGLAST, 61, 1) +FIELD(GICR_VPENDBASER, IDAI, 62, 1) +FIELD(GICR_VPENDBASER, VALID, 63, 1) + #define ICC_CTLR_EL1_CBPR (1U << 0) #define ICC_CTLR_EL1_EOIMODE (1U << 1) #define ICC_CTLR_EL1_PMHE (1U << 6) diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index 40bc404a652..7ff5a1aa5fc 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -179,6 +179,9 @@ struct GICv3CPUState { uint32_t gicr_igrpmodr0; uint32_t gicr_nsacr; uint8_t gicr_ipriorityr[GIC_INTERNAL]; + /* VLPI_base page registers */ + uint64_t gicr_vpropbaser; + uint64_t gicr_vpendbaser; /* CPU interface */ uint64_t icc_sre_el1; diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 18999e3c8bb..14d76d74840 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -144,6 +144,25 @@ const VMStateDescription vmstate_gicv3_cpu_sre_el1 = { } }; +static bool gicv4_needed(void *opaque) +{ + GICv3CPUState *cs = opaque; + + return cs->gic->revision > 3; +} + +const VMStateDescription vmstate_gicv3_gicv4 = { + .name = "arm_gicv3_cpu/gicv4", + .version_id = 1, + .minimum_version_id = 1, + .needed = gicv4_needed, + .fields = (VMStateField[]) { + VMSTATE_UINT64(gicr_vpropbaser, GICv3CPUState), + VMSTATE_UINT64(gicr_vpendbaser, GICv3CPUState), + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_gicv3_cpu = { .name = "arm_gicv3_cpu", .version_id = 1, @@ -175,6 +194,7 @@ static const VMStateDescription vmstate_gicv3_cpu = { .subsections = (const VMStateDescription * []) { &vmstate_gicv3_cpu_virt, &vmstate_gicv3_cpu_sre_el1, + &vmstate_gicv3_gicv4, NULL } }; @@ -444,6 +464,8 @@ static void arm_gicv3_common_reset(DeviceState *dev) cs->gicr_waker = GICR_WAKER_ProcessorSleep | GICR_WAKER_ChildrenAsleep; cs->gicr_propbaser = 0; cs->gicr_pendbaser = 0; + cs->gicr_vpropbaser = 0; + cs->gicr_vpendbaser = 0; /* If we're resetting a TZ-aware GIC as if secure firmware * had set it up ready to start a kernel in non-secure, we * need to set interrupts to group 1 so the kernel can use them. diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 9f1fe09a78e..c310d7f8ff2 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -236,6 +236,23 @@ static MemTxResult gicr_readl(GICv3CPUState *cs, hwaddr offset, case GICR_IDREGS ... GICR_IDREGS + 0x2f: *data = gicv3_idreg(offset - GICR_IDREGS, GICV3_PIDR0_REDIST); return MEMTX_OK; + /* + * VLPI frame registers. We don't need a version check for + * VPROPBASER and VPENDBASER because gicv3_redist_size() will + * prevent pre-v4 GIC from passing us offsets this high. + */ + case GICR_VPROPBASER: + *data = extract64(cs->gicr_vpropbaser, 0, 32); + return MEMTX_OK; + case GICR_VPROPBASER + 4: + *data = extract64(cs->gicr_vpropbaser, 32, 32); + return MEMTX_OK; + case GICR_VPENDBASER: + *data = extract64(cs->gicr_vpendbaser, 0, 32); + return MEMTX_OK; + case GICR_VPENDBASER + 4: + *data = extract64(cs->gicr_vpendbaser, 32, 32); + return MEMTX_OK; default: return MEMTX_ERROR; } @@ -379,6 +396,23 @@ static MemTxResult gicr_writel(GICv3CPUState *cs, hwaddr offset, "%s: invalid guest write to RO register at offset " TARGET_FMT_plx "\n", __func__, offset); return MEMTX_OK; + /* + * VLPI frame registers. We don't need a version check for + * VPROPBASER and VPENDBASER because gicv3_redist_size() will + * prevent pre-v4 GIC from passing us offsets this high. + */ + case GICR_VPROPBASER: + cs->gicr_vpropbaser = deposit64(cs->gicr_vpropbaser, 0, 32, value); + return MEMTX_OK; + case GICR_VPROPBASER + 4: + cs->gicr_vpropbaser = deposit64(cs->gicr_vpropbaser, 32, 32, value); + return MEMTX_OK; + case GICR_VPENDBASER: + cs->gicr_vpendbaser = deposit64(cs->gicr_vpendbaser, 0, 32, value); + return MEMTX_OK; + case GICR_VPENDBASER + 4: + cs->gicr_vpendbaser = deposit64(cs->gicr_vpendbaser, 32, 32, value); + return MEMTX_OK; default: return MEMTX_ERROR; } @@ -397,6 +431,17 @@ static MemTxResult gicr_readll(GICv3CPUState *cs, hwaddr offset, case GICR_PENDBASER: *data = cs->gicr_pendbaser; return MEMTX_OK; + /* + * VLPI frame registers. We don't need a version check for + * VPROPBASER and VPENDBASER because gicv3_redist_size() will + * prevent pre-v4 GIC from passing us offsets this high. + */ + case GICR_VPROPBASER: + *data = cs->gicr_vpropbaser; + return MEMTX_OK; + case GICR_VPENDBASER: + *data = cs->gicr_vpendbaser; + return MEMTX_OK; default: return MEMTX_ERROR; } @@ -418,6 +463,17 @@ static MemTxResult gicr_writell(GICv3CPUState *cs, hwaddr offset, "%s: invalid guest write to RO register at offset " TARGET_FMT_plx "\n", __func__, offset); return MEMTX_OK; + /* + * VLPI frame registers. We don't need a version check for + * VPROPBASER and VPENDBASER because gicv3_redist_size() will + * prevent pre-v4 GIC from passing us offsets this high. + */ + case GICR_VPROPBASER: + cs->gicr_vpropbaser = value; + return MEMTX_OK; + case GICR_VPENDBASER: + cs->gicr_vpendbaser = value; + return MEMTX_OK; default: return MEMTX_ERROR; } From patchwork Fri Apr 22 10:03:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564790 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp340727map; Fri, 22 Apr 2022 03:31:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkgvjFFsbAhQXfgGOXy/axKLrlwnyoNKGvyOuZOniG8L9RWki6VghVmanr5ydlFVBP3O/o X-Received: by 2002:ac8:5c8e:0:b0:2f1:f1a5:c10a with SMTP id r14-20020ac85c8e000000b002f1f1a5c10amr2573420qta.414.1650623515542; Fri, 22 Apr 2022 03:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623515; cv=none; d=google.com; s=arc-20160816; b=SjPc7WmIOqSUoB1z0wrdD8ejQlW9OHk4fZf6dV+yMiGp09HqaOg5zTk4S+NPgUBrlW HUxUz2AAEmcC9+DYQ08BDTmgU7Q19GGwNef4MG614VlHne7mGnOUS8BD1OLLtZRvBE5t Gm7vWc7Wm3Dkd1GStRK9xT9k/7smrypsxsskKan9XAStn1K56790p3V3XnTN4HCIiOYk JHL/BrlfPERdWBRnUB/vmY6P6TvYobd/rHPvvkjTLu+VezhdvzcJCcTWwxb1UreRlt/v r8AcTLBFoErl4XL56bdAYGcJPUw+jTpIAFvjPnjNwAhVeULfH/+j8duBGo+1FUAoaXZe rgnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=OUTDe5oYT3hUigG/8y80ols+FyBgd0MbuwPZpWR766U=; b=KUxc5iG0vlGwCzZABP9Luf6BY33aEltnrZ3u1EzhMhqMB5rPCnxdgh8cMheGcHouGs 8DjqAbaiOFU1uC5vKcqdhTw8omY7bXjuEeai7FNQyCsrBwMXgUyR2MIEow1KbfyuQYbi r9+hnHc0YebNMvuCGLDVBrE/gOJ7CDjlJ3qdNHhhIfW89oHrMiKKpY3e2U0epSpi9Hh8 9PzmlHltPEj3GujDNFHo33LRKVHifBRgBdQIUv9BflYBXAjjfKgEv2odgiuIxB8aD1O9 jPWMBAw5ga06L+wbGGTDGG65E+y4ipWSN5exeGKQC19wg94rzWUkmhrS4hAV2CRZAJrZ GTGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fIabD+F7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j13-20020a05620a146d00b0067e4be23a1bsi1926875qkl.608.2022.04.22.03.31.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:31:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fIabD+F7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqZv-0005u3-0m for patch@linaro.org; Fri, 22 Apr 2022 06:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9t-0004ev-Bw for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:01 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:45960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9q-0002do-CL for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:01 -0400 Received: by mail-wr1-x429.google.com with SMTP id w4so10277872wrg.12 for ; Fri, 22 Apr 2022 03:04:57 -0700 (PDT) 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=OUTDe5oYT3hUigG/8y80ols+FyBgd0MbuwPZpWR766U=; b=fIabD+F7/FgPDyoEr/hzppsEQ/zLetXTAt+nHVzkqexcB7SeBwG93htkn7Dz6LQllq aXTUzuxqB+ZuK3rMU9jMR29ir0u7j3vawkLGqjzocwEdMPXsYL7UoFetYMbU4Sa/PL88 ooxcFWUi8nUK0YYGPQ7adVllJSj5PsCUUQ+8Q4+jC5uRGPD87ISyICuRdkGDs0+bITWu lJymSsFviXa7PAxj00OhM4k3tp69oxyfhwVALBipGLzJ74zFqdYBJYfe+HUIXe9RQW5s u2L5vx/h0tEjWHv4vLA0KHfXq3f3FfKsIFE55DYAaWEXseWnTBDrQAtWtsCehJEm9zj/ E1Rw== 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=OUTDe5oYT3hUigG/8y80ols+FyBgd0MbuwPZpWR766U=; b=mEoo4zPhbZeu2tA+l+K+7YP2WsH6sTU2DNfzB3beq9EiB8lVOn9WxjuNUD7u7mXDqm yMeFDb5ntv6JiVlZEcmrt+IkwiOTmrABGCC+KqOVrrdx6hwMIEZ/9sCZOGiwGOBLEMuw nfmvW5AZyn+YPXpW51dw0qeyZXQ3A2tl6xyhVeO1hCFaWR1RciwqMGHt+Enw2iSLL945 xRA3c5y8CpjcfD3z+f9D+b0lQQv2JhcfJ1ZmsODeuCDsjWoO8o46yWnqrB2wC2wM7sbF cRi5IDPthHHowcULPGJ+b25ttpGyFrFRW2zQra/qe+0NlXaU4xWg0ebg8NcIG0OGqeHF ZnWg== X-Gm-Message-State: AOAM532KPxugt1dNjxryhIJ1NVr8M+VCfy8SnFElBrkmLeS34bgJImjx Kdk1tRfVHgz48FoEsZzU8pn9PkNJj230hA== X-Received: by 2002:adf:eacf:0:b0:20a:c8c4:ac51 with SMTP id o15-20020adfeacf000000b0020ac8c4ac51mr2077635wrn.510.1650621896626; Fri, 22 Apr 2022 03:04:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/61] hw/intc/arm_gicv3_cpuif: Split "update vIRQ/vFIQ" from gicv3_cpuif_virt_update() Date: Fri, 22 Apr 2022 11:03:55 +0100 Message-Id: <20220422100432.2288247-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The function gicv3_cpuif_virt_update() currently sets all of vIRQ, vFIQ and the maintenance interrupt. This implies that it has to be used quite carefully -- as the comment notes, setting the maintenance interrupt will typically cause the GIC code to be re-entered recursively. For handling vLPIs, we need the redistributor to be able to tell the cpuif to update the vIRQ and vFIQ lines when the highest priority pending vLPI changes. Since that change can't cause the maintenance interrupt state to change, we can pull the "update vIRQ/vFIQ" parts of gicv3_cpuif_virt_update() out into a separate function, which the redistributor can then call without having to worry about the reentrancy issue. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-25-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 11 +++++++ hw/intc/arm_gicv3_cpuif.c | 64 ++++++++++++++++++++++++--------------- hw/intc/trace-events | 3 +- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 795bf57d2b3..f25ddeca579 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -707,6 +707,17 @@ void gicv3_init_cpuif(GICv3State *s); */ void gicv3_cpuif_update(GICv3CPUState *cs); +/* + * gicv3_cpuif_virt_irq_fiq_update: + * @cs: GICv3CPUState for the CPU to update + * + * Recalculate whether to assert the virtual IRQ or FIQ lines after + * a change to the current highest priority pending virtual interrupt. + * Note that this does not recalculate and change the maintenance + * interrupt status (for that, see gicv3_cpuif_virt_update()). + */ +void gicv3_cpuif_virt_irq_fiq_update(GICv3CPUState *cs); + static inline uint32_t gicv3_iidr(void) { /* Return the Implementer Identification Register value diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 1a3d440a54b..5fb64d4663c 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -370,30 +370,20 @@ static uint32_t maintenance_interrupt_state(GICv3CPUState *cs) return value; } -static void gicv3_cpuif_virt_update(GICv3CPUState *cs) +void gicv3_cpuif_virt_irq_fiq_update(GICv3CPUState *cs) { - /* Tell the CPU about any pending virtual interrupts or - * maintenance interrupts, following a change to the state - * of the CPU interface relevant to virtual interrupts. - * - * CAUTION: this function will call qemu_set_irq() on the - * CPU maintenance IRQ line, which is typically wired up - * to the GIC as a per-CPU interrupt. This means that it - * will recursively call back into the GIC code via - * gicv3_redist_set_irq() and thus into the CPU interface code's - * gicv3_cpuif_update(). It is therefore important that this - * function is only called as the final action of a CPU interface - * register write implementation, after all the GIC state - * fields have been updated. gicv3_cpuif_update() also must - * not cause this function to be called, but that happens - * naturally as a result of there being no architectural - * linkage between the physical and virtual GIC logic. + /* + * Tell the CPU about any pending virtual interrupts. + * This should only be called for changes that affect the + * vIRQ and vFIQ status and do not change the maintenance + * interrupt status. This means that unlike gicv3_cpuif_virt_update() + * this function won't recursively call back into the GIC code. + * The main use of this is when the redistributor has changed the + * highest priority pending virtual LPI. */ int idx; int irqlevel = 0; int fiqlevel = 0; - int maintlevel = 0; - ARMCPU *cpu = ARM_CPU(cs->cpu); idx = hppvi_index(cs); trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx); @@ -410,16 +400,42 @@ static void gicv3_cpuif_virt_update(GICv3CPUState *cs) } } + trace_gicv3_cpuif_virt_set_irqs(gicv3_redist_affid(cs), fiqlevel, irqlevel); + qemu_set_irq(cs->parent_vfiq, fiqlevel); + qemu_set_irq(cs->parent_virq, irqlevel); +} + +static void gicv3_cpuif_virt_update(GICv3CPUState *cs) +{ + /* + * Tell the CPU about any pending virtual interrupts or + * maintenance interrupts, following a change to the state + * of the CPU interface relevant to virtual interrupts. + * + * CAUTION: this function will call qemu_set_irq() on the + * CPU maintenance IRQ line, which is typically wired up + * to the GIC as a per-CPU interrupt. This means that it + * will recursively call back into the GIC code via + * gicv3_redist_set_irq() and thus into the CPU interface code's + * gicv3_cpuif_update(). It is therefore important that this + * function is only called as the final action of a CPU interface + * register write implementation, after all the GIC state + * fields have been updated. gicv3_cpuif_update() also must + * not cause this function to be called, but that happens + * naturally as a result of there being no architectural + * linkage between the physical and virtual GIC logic. + */ + ARMCPU *cpu = ARM_CPU(cs->cpu); + int maintlevel = 0; + + gicv3_cpuif_virt_irq_fiq_update(cs); + if ((cs->ich_hcr_el2 & ICH_HCR_EL2_EN) && maintenance_interrupt_state(cs) != 0) { maintlevel = 1; } - trace_gicv3_cpuif_virt_set_irqs(gicv3_redist_affid(cs), fiqlevel, - irqlevel, maintlevel); - - qemu_set_irq(cs->parent_vfiq, fiqlevel); - qemu_set_irq(cs->parent_virq, irqlevel); + trace_gicv3_cpuif_virt_set_maint_irq(gicv3_redist_affid(cs), maintlevel); qemu_set_irq(cpu->gicv3_maintenance_interrupt, maintlevel); } diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 004a1006fb8..36c3fe4da0b 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -152,7 +152,8 @@ gicv3_icv_dir_write(uint32_t cpu, uint64_t val) "GICv3 ICV_DIR write cpu 0x%x va gicv3_icv_iar_read(int grp, uint32_t cpu, uint64_t val) "GICv3 ICV_IAR%d read cpu 0x%x value 0x%" PRIx64 gicv3_icv_eoir_write(int grp, uint32_t cpu, uint64_t val) "GICv3 ICV_EOIR%d write cpu 0x%x value 0x%" PRIx64 gicv3_cpuif_virt_update(uint32_t cpuid, int idx) "GICv3 CPU i/f 0x%x virt HPPI update LR index %d" -gicv3_cpuif_virt_set_irqs(uint32_t cpuid, int fiqlevel, int irqlevel, int maintlevel) "GICv3 CPU i/f 0x%x virt HPPI update: setting FIQ %d IRQ %d maintenance-irq %d" +gicv3_cpuif_virt_set_irqs(uint32_t cpuid, int fiqlevel, int irqlevel) "GICv3 CPU i/f 0x%x virt HPPI update: setting FIQ %d IRQ %d" +gicv3_cpuif_virt_set_maint_irq(uint32_t cpuid, int maintlevel) "GICv3 CPU i/f 0x%x virt HPPI update: setting maintenance-irq %d" # arm_gicv3_dist.c gicv3_dist_read(uint64_t offset, uint64_t data, unsigned size, bool secure) "GICv3 distributor read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u secure %d" From patchwork Fri Apr 22 10:03:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564801 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp350009map; Fri, 22 Apr 2022 03:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfRs2LQBF63jT+gHRaYmDjla8WBVTem9y+aibvN0v7FigUxYxoAerldpSR8OptaW9B7Alr X-Received: by 2002:ad4:5c62:0:b0:444:560e:32ae with SMTP id i2-20020ad45c62000000b00444560e32aemr2749601qvh.76.1650624482094; Fri, 22 Apr 2022 03:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624482; cv=none; d=google.com; s=arc-20160816; b=RK2rWiUvdiAIlLzZbi+EU2hmP6mp0dAfI14nWshBM6mS9+kJRmSFOf6s5bKu3r+QQr Z/FA5j1k1CI7jw/iw+IzrhPc6A7R2RaGebvJHGvyw6KWXu6Ro527Gw3Ce1XTIvtXUF7D OIMe8i4W8T40R6l53fx3LlwzF/zzGzD+08BaJOyQqhNTvxosw/QcnauNYf+Gyz/ZvyL4 e26K8H2E6r8qYy+i9K8U/xWC5TOewIhIWKOveHyy3oB2z0kYtvDC18FO2FmiKpL3j5sb LaplVpnl7v1lzO0kA2Su0kccFi+XJvh4iLscAZkZ2tU1TW/EH3oi44d+lwAHcL3TDvxB WZmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lfat0Xo/XZAzlvrsuN37d4qZ7GyWb7N5yMXurCOySu8=; b=SX6mxtXn8M72cqjsb6FJ1KGL4z3NBqQYCT2hYrZMj5TwQ5yCAcx1mfvTJhxAODgNSs VN9WFuI+an8+LnupCVxX+Y8/+X4Xl+0ory/82NtCEMulm8MnLrRKfQLsa9wLOlGwqxeH 8pV0uje6NGyU3Uq9YLnhafag6upM/GlK/xWp2QlZ5/uEPxrdOK8loRLz8fyl9lqOyTEx QZpyqrWc8OBrI3kqz3FEjBhtWhx+/DlAReLiKiIOTwPKwmcoYEd+yf2jWtkiyuZ9thRV Fbd+UUWjLDx888kHHgyHgSDCV2yzak0B2ZfHTTGr+kM5T0xRJ9u0ae7vEvNkkyl5tIR9 nSaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g7AgjRiY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q9-20020ad45749000000b00443eedd0113si2111507qvx.451.2022.04.22.03.48.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g7AgjRiY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqpV-0002VX-Kb for patch@linaro.org; Fri, 22 Apr 2022 06:48:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9t-0004fF-EE for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:01 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9r-0002du-7H for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:01 -0400 Received: by mail-wr1-x42d.google.com with SMTP id b19so10280361wrh.11 for ; Fri, 22 Apr 2022 03:04:58 -0700 (PDT) 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=lfat0Xo/XZAzlvrsuN37d4qZ7GyWb7N5yMXurCOySu8=; b=g7AgjRiYDd9vjDztgvWEr7GWUhHX/7YXpBllx8qiVhvyzUEbnRrvc++5cQ84d+OaJF zj2aAeoLXy2Oprg4dlT4o32e55Ez0zhN3xaFcXH0xrypiN9oWs/Rdjhxc7C+Hnsxoq8p SZlt0M8aZY1rLsoDQiDUafaiM8tMrYsz2a8G127WIbwOKY1pLzdT418GJF8Vb9saYCnT gxcPt5wncPhCgfy6eIiOkgqTHgEfQFCbBSxk8PjrKVRPH+0KxrMp9JXxWFgYmDeAYC/A 2AshtWN0pHjRLElm1AVD8aH9kKTI8ppJQCkBkblzsY5OLGVLgR+VGjZY8E69FlOJPvW7 zfng== 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=lfat0Xo/XZAzlvrsuN37d4qZ7GyWb7N5yMXurCOySu8=; b=XF7wO6J4TuF4ApHMgRd8iDoDAQw1t2qyv2CcEH2wHGNBgiQWZDLE0Zwb2EjUHvIzMz Q2W7wAXci5jIW7jRpoe7CoN1mPRRMpNfgfMer50OhCI/tdUtbJkMVskU5Xfe/UyOB+FM 3abFu9yfwTkzwvuGuCBmADi0+2zk+temsvdEHmxSXeZMyay/MtFX3pEka5ud8vO+EOpL INSnwuwQfJziEXXMIXiS8yRJp7+/Gx+ZdSMvoT+7S5MjJuPBkRi9TL90zLZVOq8r8Toq 4E2GC1UVGAip1JwmnYc5eLBxnRIiUcW9DrkQ8xlijROuVksh+qHKCsGqi2sMPAwyuHF9 9Heg== X-Gm-Message-State: AOAM532v0KJFw1ue1QpoVDeS+XiroLoqx9ctroiG0UWRhueP4+AvMXqH NQ1k+pSRlykEgkFMcwD1D3/B+JcPjgVkog== X-Received: by 2002:a5d:47aa:0:b0:20a:8b96:5b2c with SMTP id 10-20020a5d47aa000000b0020a8b965b2cmr3070941wrb.621.1650621897645; Fri, 22 Apr 2022 03:04:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/61] hw/intc/arm_gicv3_cpuif: Support vLPIs Date: Fri, 22 Apr 2022 11:03:56 +0100 Message-Id: <20220422100432.2288247-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The CPU interface changes to support vLPIs are fairly minor: in the parts of the code that currently look at the list registers to determine the highest priority pending virtual interrupt, we must also look at the highest priority pending vLPI. To do this we change hppvi_index() to check the vLPI and return a special-case value if that is the right virtual interrupt to take. The callsites (which handle HPPIR and IAR registers and the "raise vIRQ and vFIQ lines" code) then have to handle this special-case value. This commit includes two interfaces with the as-yet-unwritten redistributor code: * the new GICv3CPUState::hppvlpi will be set by the redistributor (in the same way as the existing hpplpi does for physical LPIs) * when the CPU interface acknowledges a vLPI it needs to set it to non-pending; the new gicv3_redist_vlpi_pending() function (which matches the existing gicv3_redist_lpi_pending() used for physical LPIs) is a stub that will be filled in later Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-26-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 13 ++++ include/hw/intc/arm_gicv3_common.h | 3 + hw/intc/arm_gicv3_common.c | 1 + hw/intc/arm_gicv3_cpuif.c | 119 +++++++++++++++++++++++++++-- hw/intc/arm_gicv3_redist.c | 8 ++ hw/intc/trace-events | 2 +- 6 files changed, 140 insertions(+), 6 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index f25ddeca579..07644b2be6f 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -612,6 +612,19 @@ void gicv3_redist_process_lpi(GICv3CPUState *cs, int irq, int level); */ void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, int doorbell, int level); +/** + * gicv3_redist_vlpi_pending: + * @cs: GICv3CPUState + * @irq: (virtual) interrupt number + * @level: level to set @irq to + * + * Set/clear the pending status of a virtual LPI in the vLPI table + * that this redistributor is currently using. (The difference between + * this and gicv3_redist_process_vlpi() is that this is called from + * the cpuif and does not need to do the not-running-on-this-vcpu checks.) + */ +void gicv3_redist_vlpi_pending(GICv3CPUState *cs, int irq, int level); + void gicv3_redist_lpi_pending(GICv3CPUState *cs, int irq, int level); /** * gicv3_redist_update_lpi: diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h index 7ff5a1aa5fc..4e416100559 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -219,6 +219,9 @@ struct GICv3CPUState { */ PendingIrq hpplpi; + /* Cached information recalculated from vLPI tables in guest memory */ + PendingIrq hppvlpi; + /* This is temporary working state, to avoid a malloc in gicv3_update() */ bool seenbetter; }; diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 14d76d74840..3f47b3501fe 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -487,6 +487,7 @@ static void arm_gicv3_common_reset(DeviceState *dev) cs->hppi.prio = 0xff; cs->hpplpi.prio = 0xff; + cs->hppvlpi.prio = 0xff; /* State in the CPU interface must *not* be reset here, because it * is part of the CPU's reset domain, not the GIC device's. diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 5fb64d4663c..f11863ff613 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -21,6 +21,12 @@ #include "hw/irq.h" #include "cpu.h" +/* + * Special case return value from hppvi_index(); must be larger than + * the architecturally maximum possible list register index (which is 15) + */ +#define HPPVI_INDEX_VLPI 16 + static GICv3CPUState *icc_cs_from_env(CPUARMState *env) { return env->gicv3state; @@ -157,10 +163,18 @@ static int ich_highest_active_virt_prio(GICv3CPUState *cs) static int hppvi_index(GICv3CPUState *cs) { - /* Return the list register index of the highest priority pending + /* + * Return the list register index of the highest priority pending * virtual interrupt, as per the HighestPriorityVirtualInterrupt * pseudocode. If no pending virtual interrupts, return -1. + * If the highest priority pending virtual interrupt is a vLPI, + * return HPPVI_INDEX_VLPI. + * (The pseudocode handles checking whether the vLPI is higher + * priority than the highest priority list register at every + * callsite of HighestPriorityVirtualInterrupt; we check it here.) */ + ARMCPU *cpu = ARM_CPU(cs->cpu); + CPUARMState *env = &cpu->env; int idx = -1; int i; /* Note that a list register entry with a priority of 0xff will @@ -202,6 +216,23 @@ static int hppvi_index(GICv3CPUState *cs) } } + /* + * "no pending vLPI" is indicated with prio = 0xff, which always + * fails the priority check here. vLPIs are only considered + * when we are in Non-Secure state. + */ + if (cs->hppvlpi.prio < prio && !arm_is_secure(env)) { + if (cs->hppvlpi.grp == GICV3_G0) { + if (cs->ich_vmcr_el2 & ICH_VMCR_EL2_VENG0) { + return HPPVI_INDEX_VLPI; + } + } else { + if (cs->ich_vmcr_el2 & ICH_VMCR_EL2_VENG1) { + return HPPVI_INDEX_VLPI; + } + } + } + return idx; } @@ -289,6 +320,47 @@ static bool icv_hppi_can_preempt(GICv3CPUState *cs, uint64_t lr) return false; } +static bool icv_hppvlpi_can_preempt(GICv3CPUState *cs) +{ + /* + * Return true if we can signal the highest priority pending vLPI. + * We can assume we're Non-secure because hppvi_index() already + * tested for that. + */ + uint32_t mask, rprio, vpmr; + + if (!(cs->ich_hcr_el2 & ICH_HCR_EL2_EN)) { + /* Virtual interface disabled */ + return false; + } + + vpmr = extract64(cs->ich_vmcr_el2, ICH_VMCR_EL2_VPMR_SHIFT, + ICH_VMCR_EL2_VPMR_LENGTH); + + if (cs->hppvlpi.prio >= vpmr) { + /* Priority mask masks this interrupt */ + return false; + } + + rprio = ich_highest_active_virt_prio(cs); + if (rprio == 0xff) { + /* No running interrupt so we can preempt */ + return true; + } + + mask = icv_gprio_mask(cs, cs->hppvlpi.grp); + + /* + * We only preempt a running interrupt if the pending interrupt's + * group priority is sufficient (the subpriorities are not considered). + */ + if ((cs->hppvlpi.prio & mask) < (rprio & mask)) { + return true; + } + + return false; +} + static uint32_t eoi_maintenance_interrupt_state(GICv3CPUState *cs, uint32_t *misr) { @@ -386,8 +458,18 @@ void gicv3_cpuif_virt_irq_fiq_update(GICv3CPUState *cs) int fiqlevel = 0; idx = hppvi_index(cs); - trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx); - if (idx >= 0) { + trace_gicv3_cpuif_virt_update(gicv3_redist_affid(cs), idx, + cs->hppvlpi.irq, cs->hppvlpi.grp, + cs->hppvlpi.prio); + if (idx == HPPVI_INDEX_VLPI) { + if (icv_hppvlpi_can_preempt(cs)) { + if (cs->hppvlpi.grp == GICV3_G0) { + fiqlevel = 1; + } else { + irqlevel = 1; + } + } + } else if (idx >= 0) { uint64_t lr = cs->ich_lr_el2[idx]; if (icv_hppi_can_preempt(cs, lr)) { @@ -619,7 +701,11 @@ static uint64_t icv_hppir_read(CPUARMState *env, const ARMCPRegInfo *ri) int idx = hppvi_index(cs); uint64_t value = INTID_SPURIOUS; - if (idx >= 0) { + if (idx == HPPVI_INDEX_VLPI) { + if (cs->hppvlpi.grp == grp) { + value = cs->hppvlpi.irq; + } + } else if (idx >= 0) { uint64_t lr = cs->ich_lr_el2[idx]; int thisgrp = (lr & ICH_LR_EL2_GROUP) ? GICV3_G1NS : GICV3_G0; @@ -650,6 +736,18 @@ static void icv_activate_irq(GICv3CPUState *cs, int idx, int grp) cs->ich_apr[grp][regno] |= (1 << regbit); } +static void icv_activate_vlpi(GICv3CPUState *cs) +{ + uint32_t mask = icv_gprio_mask(cs, cs->hppvlpi.grp); + int prio = cs->hppvlpi.prio & mask; + int aprbit = prio >> (8 - cs->vprebits); + int regno = aprbit / 32; + int regbit = aprbit % 32; + + cs->ich_apr[cs->hppvlpi.grp][regno] |= (1 << regbit); + gicv3_redist_vlpi_pending(cs, cs->hppvlpi.irq, 0); +} + static uint64_t icv_iar_read(CPUARMState *env, const ARMCPRegInfo *ri) { GICv3CPUState *cs = icc_cs_from_env(env); @@ -657,7 +755,12 @@ static uint64_t icv_iar_read(CPUARMState *env, const ARMCPRegInfo *ri) int idx = hppvi_index(cs); uint64_t intid = INTID_SPURIOUS; - if (idx >= 0) { + if (idx == HPPVI_INDEX_VLPI) { + if (cs->hppvlpi.grp == grp && icv_hppvlpi_can_preempt(cs)) { + intid = cs->hppvlpi.irq; + icv_activate_vlpi(cs); + } + } else if (idx >= 0) { uint64_t lr = cs->ich_lr_el2[idx]; int thisgrp = (lr & ICH_LR_EL2_GROUP) ? GICV3_G1NS : GICV3_G0; @@ -2632,6 +2735,12 @@ static void gicv3_cpuif_el_change_hook(ARMCPU *cpu, void *opaque) GICv3CPUState *cs = opaque; gicv3_cpuif_update(cs); + /* + * Because vLPIs are only pending in NonSecure state, + * an EL change can change the VIRQ/VFIQ status (but + * cannot affect the maintenance interrupt state) + */ + gicv3_cpuif_virt_irq_fiq_update(cs); } void gicv3_init_cpuif(GICv3State *s) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index c310d7f8ff2..3464972c139 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -855,6 +855,14 @@ void gicv3_redist_movall_lpis(GICv3CPUState *src, GICv3CPUState *dest) gicv3_redist_update_lpi(dest); } +void gicv3_redist_vlpi_pending(GICv3CPUState *cs, int irq, int level) +{ + /* + * The redistributor handling for changing the pending state + * of a vLPI will be added in a subsequent commit. + */ +} + void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, int doorbell, int level) { diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 36c3fe4da0b..5271590304b 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -151,7 +151,7 @@ gicv3_icv_hppir_read(int grp, uint32_t cpu, uint64_t val) "GICv3 ICV_HPPIR%d rea gicv3_icv_dir_write(uint32_t cpu, uint64_t val) "GICv3 ICV_DIR write cpu 0x%x value 0x%" PRIx64 gicv3_icv_iar_read(int grp, uint32_t cpu, uint64_t val) "GICv3 ICV_IAR%d read cpu 0x%x value 0x%" PRIx64 gicv3_icv_eoir_write(int grp, uint32_t cpu, uint64_t val) "GICv3 ICV_EOIR%d write cpu 0x%x value 0x%" PRIx64 -gicv3_cpuif_virt_update(uint32_t cpuid, int idx) "GICv3 CPU i/f 0x%x virt HPPI update LR index %d" +gicv3_cpuif_virt_update(uint32_t cpuid, int idx, int hppvlpi, int grp, int prio) "GICv3 CPU i/f 0x%x virt HPPI update LR index %d HPPVLPI %d grp %d prio %d" gicv3_cpuif_virt_set_irqs(uint32_t cpuid, int fiqlevel, int irqlevel) "GICv3 CPU i/f 0x%x virt HPPI update: setting FIQ %d IRQ %d" gicv3_cpuif_virt_set_maint_irq(uint32_t cpuid, int maintlevel) "GICv3 CPU i/f 0x%x virt HPPI update: setting maintenance-irq %d" From patchwork Fri Apr 22 10:03:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564817 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp364987map; Fri, 22 Apr 2022 04:09:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvu5Foh2i05H4a0hpmqpsQkMtlbV9vXWtT9NH8Igc6od1nG3TO3rhdDxIK8O3qqJXK5M2l X-Received: by 2002:a37:34b:0:b0:69e:5a7e:745e with SMTP id 72-20020a37034b000000b0069e5a7e745emr2234935qkd.385.1650625745601; Fri, 22 Apr 2022 04:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625745; cv=none; d=google.com; s=arc-20160816; b=TFrVMkYrarOHRP8Le1kO9T4fNlqgKz6NtNNDX65owax4Moe5j0rRVHmKqOgwAJ85K3 4fBKXysS4Pm5JFmfAWcXNlaFU5PfR2beOsAKh4K/JH7NxiwI5MNEIRLobfXTqIgau9q+ WzMEoaXVmq8yobU7YQRnrdjc/1wKGkkVoDWrmY3fZvSNPVrhmYrIDj1NAiXC8v7Uk0NL 4euJQA8HaLJAefOhHCNUtwY2D6KA/w26eAFNz6P4Mn64bo27tSpSg3K7mfxzOZVfSifm 7lbYpvrBAchuKzDzRLNLJtlyP5Ur9EscUMDfTqL2JGfgeaUreGIVmyluBMlutORG2Cbs I3lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=EjeZtA3tZWg+aDhUloJoLuwvQBqCQPUULzcGK3wHquE=; b=ZJPoHwa/QR80FVg7urs5j8YtgN9MqIy5jA2bSrEKzG3i3eE8G+5yoaLFbOgTOHZD46 zjN4utdO/6BygUUxWau24t0Oc7tX9y+54cFM3ebQEEAymNzhcEK7Bu4KSFHAI5uMEXWZ OKRYjcyVTK0f+3E7oexFmlv99WFDEfMxw1ELe/bmKb2a9LRKHcRUMOUv7CetfgvaNSW6 kYmW5igWqt/cKjmHdo0XJCjWLHR1o7JjnaK9azCB8RjzUo4iI/sdq0A+VRBXKq1Qa21l bWKlnfUZ2ETnN6iWLvGKWHWqC2JFR6k50YvdaEgnV0TRQeaHXR9kS1WZ3O5rOCt/kK5v goOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CXs5SrNZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p83-20020a37a656000000b0069e13f46f99si2034046qke.427.2022.04.22.04.09.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:09:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CXs5SrNZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr9t-0005oz-07 for patch@linaro.org; Fri, 22 Apr 2022 07:09:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9t-0004fO-Sk for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:02 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:37785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9s-0002e9-7m for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:01 -0400 Received: by mail-wr1-x429.google.com with SMTP id t6so6882787wra.4 for ; Fri, 22 Apr 2022 03:04:59 -0700 (PDT) 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=EjeZtA3tZWg+aDhUloJoLuwvQBqCQPUULzcGK3wHquE=; b=CXs5SrNZLUu29Ysw4+S58yi4ltUAKYGZIS/E5z6NwVuDOM3hdf7A9KQQocUA1KiYGp TYOKdPQBg0AzaOTlmEeeHxcmlwbP4pQFDG+fyqVmdVP/Agi8KzOFHIEs3R2woywcC7tc 7YSEynFjMXGemp/TGB2D8yQqyBM1275tr+LZlZax7ha0p5kyEsRF4T4VFJ/U4Jzz3pfS tcS1O12myO+9WD1h5gS+7eKcG9BneDLcoFp+dk1RUxcb2cldjE09Mg2sazB8kRooE6ya 8MjXzqqWe0Sg7lyw7G5ulgXdxn28Qc5dBxRHJzgLU6tDsBNCOGTUM7kmAT3Vdh1WcwuT k0/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=EjeZtA3tZWg+aDhUloJoLuwvQBqCQPUULzcGK3wHquE=; b=RF8QjrqCP2+zhvOs4FVliRVT+9sIVylBrTLEaiDryzAkK1rvbPInHiPUWI0cYcw+Sm 5ylDfCiBVaNMAUymHZRfSie/lt53DI9KQFPYyEWYM4eLnbF/SkCNs+g+uZ+8m4OiDbaH 1smOWHM440gV83QVNIpiKo2Ukz+Jo4MXN+DXV3hH6NmU0EOLMxGHGEfTwQpTI+gZHHaL dyJpERli4QmQlzp7J/WJwNHf/4IsFLxitVF4KQv9RJ7ZIaHhmOoYvxcff8W3nmV89j4V 7kbvZ9tN/7pqVtHqbYHme4uGUtaBkak/e+1xiNmuz67HPpQRuY8Qsn1BN1TBNxtJE2MO efeA== X-Gm-Message-State: AOAM533lkKRB2tyg3nAzlUHGL7LEGvErXCe7Q3WvSPeNmWNYi6FiYL7K BicHGC/p03qPKdB0tlFj57qNR5hsxnllLg== X-Received: by 2002:adf:db8b:0:b0:207:9a90:3819 with SMTP id u11-20020adfdb8b000000b002079a903819mr3133255wri.617.1650621898411; Fri, 22 Apr 2022 03:04:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/61] hw/intc/arm_gicv3_cpuif: Don't recalculate maintenance irq unnecessarily Date: Fri, 22 Apr 2022 11:03:57 +0100 Message-Id: <20220422100432.2288247-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The maintenance interrupt state depends only on: * ICH_HCR_EL2 * ICH_LR_EL2 * ICH_VMCR_EL2 fields VENG0 and VENG1 Now we have a separate function that updates only the vIRQ and vFIQ lines, use that in places that only change state that affects vIRQ and vFIQ but not the maintenance interrupt. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-27-peter.maydell@linaro.org --- hw/intc/arm_gicv3_cpuif.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index f11863ff613..d627ddac90f 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -543,7 +543,7 @@ static void icv_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, cs->ich_apr[grp][regno] = value & 0xFFFFFFFFU; - gicv3_cpuif_virt_update(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); return; } @@ -588,7 +588,7 @@ static void icv_bpr_write(CPUARMState *env, const ARMCPRegInfo *ri, write_vbpr(cs, grp, value); - gicv3_cpuif_virt_update(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); } static uint64_t icv_pmr_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -615,7 +615,7 @@ static void icv_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri, cs->ich_vmcr_el2 = deposit64(cs->ich_vmcr_el2, ICH_VMCR_EL2_VPMR_SHIFT, ICH_VMCR_EL2_VPMR_LENGTH, value); - gicv3_cpuif_virt_update(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); } static uint64_t icv_igrpen_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -682,7 +682,7 @@ static void icv_ctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, cs->ich_vmcr_el2 = deposit64(cs->ich_vmcr_el2, ICH_VMCR_EL2_VEOIM_SHIFT, 1, value & ICC_CTLR_EL1_EOIMODE ? 1 : 0); - gicv3_cpuif_virt_update(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); } static uint64_t icv_rpr_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -2452,7 +2452,7 @@ static void ich_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, trace_gicv3_ich_ap_write(ri->crm & 1, regno, gicv3_redist_affid(cs), value); cs->ich_apr[grp][regno] = value & 0xFFFFFFFFU; - gicv3_cpuif_virt_update(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); } static uint64_t ich_hcr_read(CPUARMState *env, const ARMCPRegInfo *ri) From patchwork Fri Apr 22 10:03:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564805 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp353321map; Fri, 22 Apr 2022 03:53:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYOFmMubVQVvZ2uU0HV3rBDKMumx2BKHr4Vrjdr5q6FcR+T4BOiIsHE7zkTgUlqsZD6MKy X-Received: by 2002:a37:aa97:0:b0:69e:5c01:86f4 with SMTP id t145-20020a37aa97000000b0069e5c0186f4mr2253734qke.366.1650624805877; Fri, 22 Apr 2022 03:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624805; cv=none; d=google.com; s=arc-20160816; b=nkG7Ep7OznpjqpMIgIS2zPnhMZZc33TXqv/2gq1H3lEZbnED5jt2YUQFUj/BKANeMq 7u7FgF684BSO4yVUj0osCyefVpBrYeVaBDs2o9LNnKKf0yjDQTYINfm3ow/+oLygY7q1 sl5r/BZaP/88de1XyPwETH+OUYfuVcOgZISckZchd+vRRnGSgxkvQJGJEi2QT/TzO/XT KdMiQpf7zS+2+JWjSzSYRTgoMvK/JRukIAiI2L8ebVMSXu3qNCmrWQJNNAqYP1RTRS8j POkn0YH+rwR4VeUZJbKGF/JnSI6I2v4cLXrlG+pQlWE+PaTxtDaGfSHSieM/tBkl+5dK 974A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3ilgvfjObbIjUWYmzt8kRu+jcO5Jk2GypxqucG8W5ao=; b=mIV3Szh90Xvhvz8SNdaL6smC6VZo02+l2VNetSx05sd5lRYSTdAK8VcayKQcmCn7dg L8UoXNPXhAe8n/z/2bSiVETcT4dKmvm7ZDPlWfnsWr24HzL4RRm2pv/ewMhRvRBCl6Kf CAgvja4DlBE40NpzHIPqj5dipRo1jNf20uzoMmxEOZN3ZbDBFAsqC2ooQFUqt7NpddfN 01v3Gtb+Y2kfCsLNvJqhEdlbVkYJiQcOjzggaGtYdl4AdFDDehP7jf81eJc8g5KGfxPI vGqWO8ybx4IC3mzysi/OpQOrwLhdR8z6USh6cuc8zXjgOwU3d8CVkgWDOrmMVM+Lx+f3 mZNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oI2VE+9S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o8-20020a37a508000000b00699f7a36b38si1889355qke.694.2022.04.22.03.53.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oI2VE+9S; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhquj-0000g6-CR for patch@linaro.org; Fri, 22 Apr 2022 06:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9u-0004hX-Te for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:03 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:34692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9s-0002eF-Ui for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:02 -0400 Received: by mail-wm1-x332.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so4691868wmb.1 for ; Fri, 22 Apr 2022 03:05:00 -0700 (PDT) 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=3ilgvfjObbIjUWYmzt8kRu+jcO5Jk2GypxqucG8W5ao=; b=oI2VE+9SoLKn5lT76R7giAMeW53NuDdAaIa62ciMUa3Be901JalZYC6ukOyAjw0kk6 OnnEQdtDylfXhKdEyd4a4ByYwqdwXgujmQrk/Vj7eOVoFifxSZQB/aC1TfFmp6uNdEbC wj/11hOzAkYzEc85q4o8Qlnz3ItfND6RYMcIIJRP1IgQEUlv6QaVhdb4k9/ekSUmB2HI 6aL9hKxg1oKptZawFRHlESLy0RjNLw2t54n0iAvpGkslxI6IzeK+KXrtd9K3sfIRLn/Y SdgeMR3Js5XS0z9Lf9oN/uqz9M14qdW7BkjhKlkxCZlce59LC+s6rRAnSVt2a9O8VeIu 2rMw== 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=3ilgvfjObbIjUWYmzt8kRu+jcO5Jk2GypxqucG8W5ao=; b=Yup2ry/X0AQK9AlsinqhShBw291uN5MC0u5WsrFIBbWA3QA3yuXOEqwOk3+c/BejaM a9mr6pEQXZNhhuMCJ8SY7xFGhJE/D7hsDpbIwYTBi5FXfOlTZqluH54A32aA39+e7w0I gjhssfZG8R2D3bCfO5Q2XIAk7OkllHyp7MdpAOOnxGmyzouLFPLxJsTNB9KvFU+kL7/n VW2NQz789S/KQmCiH0f/wFmvfet7uQi3mwP5NN/n3u7lWr6U/fQOWAYpekama8KtPbVb OnlHCx5XFREPAbqxSxjFoBapkDcctWqcL7yhuUwCPrhzl18kBFrTdk1dq3YHGEWF78Qq zHOA== X-Gm-Message-State: AOAM532q712IOoAzk4XNpl+OXsmQlAJ44eSmeexDKeqkqbGrNIvflwMg 1kRu+fWEMWKQOtkowFsCGok0ZqLkgcLsnw== X-Received: by 2002:a05:600c:4f53:b0:392:e99:3002 with SMTP id m19-20020a05600c4f5300b003920e993002mr3432196wmq.35.1650621899294; Fri, 22 Apr 2022 03:04:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:04:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/61] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for one LPI" logic Date: Fri, 22 Apr 2022 11:03:58 +0100 Message-Id: <20220422100432.2288247-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently the functions which update the highest priority pending LPI information by looking at the LPI Pending and Configuration tables are hard-coded to use the physical LPI tables addressed by GICR_PENDBASER and GICR_PROPBASER. To support virtual LPIs we will need to do essentially the same job, but looking at the current virtual LPI Pending and Configuration tables and updating cs->hppvlpi instead of cs->hpplpi. Factor out the common part of the gicv3_redist_check_lpi_priority() function into a new update_for_one_lpi() function, which updates a PendingIrq struct if the specified LPI is higher priority than what is currently recorded there. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-28-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 74 ++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 3464972c139..571e0fa8309 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -60,6 +60,49 @@ static uint32_t gicr_read_bitmap_reg(GICv3CPUState *cs, MemTxAttrs attrs, return reg; } +/** + * update_for_one_lpi: Update pending information if this LPI is better + * + * @cs: GICv3CPUState + * @irq: interrupt to look up in the LPI Configuration table + * @ctbase: physical address of the LPI Configuration table to use + * @ds: true if priority value should not be shifted + * @hpp: points to pending information to update + * + * Look up @irq in the Configuration table specified by @ctbase + * to see if it is enabled and what its priority is. If it is an + * enabled interrupt with a higher priority than that currently + * recorded in @hpp, update @hpp. + */ +static void update_for_one_lpi(GICv3CPUState *cs, int irq, + uint64_t ctbase, bool ds, PendingIrq *hpp) +{ + uint8_t lpite; + uint8_t prio; + + address_space_read(&cs->gic->dma_as, + ctbase + ((irq - GICV3_LPI_INTID_START) * sizeof(lpite)), + MEMTXATTRS_UNSPECIFIED, &lpite, sizeof(lpite)); + + if (!(lpite & LPI_CTE_ENABLED)) { + return; + } + + if (ds) { + prio = lpite & LPI_PRIORITY_MASK; + } else { + prio = ((lpite & LPI_PRIORITY_MASK) >> 1) | 0x80; + } + + if ((prio < hpp->prio) || + ((prio == hpp->prio) && (irq <= hpp->irq))) { + hpp->irq = irq; + hpp->prio = prio; + /* LPIs and vLPIs are always non-secure Grp1 interrupts */ + hpp->grp = GICV3_G1NS; + } +} + static uint8_t gicr_read_ipriorityr(GICv3CPUState *cs, MemTxAttrs attrs, int irq) { @@ -598,34 +641,11 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data, static void gicv3_redist_check_lpi_priority(GICv3CPUState *cs, int irq) { - AddressSpace *as = &cs->gic->dma_as; - uint64_t lpict_baddr; - uint8_t lpite; - uint8_t prio; + uint64_t lpict_baddr = cs->gicr_propbaser & R_GICR_PROPBASER_PHYADDR_MASK; - lpict_baddr = cs->gicr_propbaser & R_GICR_PROPBASER_PHYADDR_MASK; - - address_space_read(as, lpict_baddr + ((irq - GICV3_LPI_INTID_START) * - sizeof(lpite)), MEMTXATTRS_UNSPECIFIED, &lpite, - sizeof(lpite)); - - if (!(lpite & LPI_CTE_ENABLED)) { - return; - } - - if (cs->gic->gicd_ctlr & GICD_CTLR_DS) { - prio = lpite & LPI_PRIORITY_MASK; - } else { - prio = ((lpite & LPI_PRIORITY_MASK) >> 1) | 0x80; - } - - if ((prio < cs->hpplpi.prio) || - ((prio == cs->hpplpi.prio) && (irq <= cs->hpplpi.irq))) { - cs->hpplpi.irq = irq; - cs->hpplpi.prio = prio; - /* LPIs are always non-secure Grp1 interrupts */ - cs->hpplpi.grp = GICV3_G1NS; - } + update_for_one_lpi(cs, irq, lpict_baddr, + cs->gic->gicd_ctlr & GICD_CTLR_DS, + &cs->hpplpi); } void gicv3_redist_update_lpi_only(GICv3CPUState *cs) From patchwork Fri Apr 22 10:03:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564821 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp367967map; Fri, 22 Apr 2022 04:12:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYo+mFWZBOjbxlXYt+0RAwGyoxIJQrRYRfyrlp6wa0Cu/1hKYZ+l0Xy9pZuFOVq9ZdrZgn X-Received: by 2002:a37:697:0:b0:69e:6246:b69a with SMTP id 145-20020a370697000000b0069e6246b69amr2232304qkg.206.1650625964224; Fri, 22 Apr 2022 04:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625964; cv=none; d=google.com; s=arc-20160816; b=z7mE+/xLx9sJlv9maNNs/GWOnQN9Fzejgqo4oEXDSEgK0hAjZeonWO/XH9PpleSuqH hFVfmFrO/32T8zz9okiO3DpgIpy52fXbGVBrxNKIRcVXZjqVVz2KsWLMfUYi/XAKPS5G /ob13Ab0vfPOjMpM55H9te4qp0k7MmUPt2p8W1dc6Glo2zdiUz7rW4JfPMmdf5XVZo17 Hxd7kC3L34TDB0yEd7Xqjl9kSgnYmlF66ceUDCE230eLNrcrScodspMo+iDa2WDryD4E 7r+9xERNGrudlYxERtuqdhmhIORzDfEUlNzcbjLbbEUGAQukxym9lzi7hNkk3o5aWjJ8 29Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Jjd65YXtvG5lQwdp8xCN6MNJ/6af5LF+gZQZc18vANc=; b=nBf22lse9HvVpnAYnU4sSpRkq0UHryCutxpTyjuZpA31G8QLH2I9O1U6Phb3EODXqr XPoHpVJ7reHvAufegopiRLEU3tfMX1zVjrhCOyjiBqV/J964NsikED2+BB8sWUGgkfNL E15yZTZycaGxO6znnHd/eVZwLSNrFv/IasRdBRHtoHMjmYUZoTeKy71S2KU4+N8DloUU gCVQE0x0dpB4mFpkR51PkLGXIOH39f/fZ2X5ig0Me2ZOzp6ipwi0VRqNt6MahLCrIbQ8 uye8ORG/tsM01EvXK2la2q/17L6cY3hAY58UZ0XVGuW/W/+1mSIUMtjUa9WLtsMzrANm gqcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4Sl8ZxD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e16-20020ac85dd0000000b002ebe8c933dasi2278511qtx.192.2022.04.22.04.12.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4Sl8ZxD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrDP-000539-ND for patch@linaro.org; Fri, 22 Apr 2022 07:12:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9v-0004hs-TJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:03 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:45671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9t-0002eQ-RJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:03 -0400 Received: by mail-wm1-x332.google.com with SMTP id 17-20020a05600c021100b00393a19f8f98so2067545wmi.4 for ; Fri, 22 Apr 2022 03:05:01 -0700 (PDT) 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=Jjd65YXtvG5lQwdp8xCN6MNJ/6af5LF+gZQZc18vANc=; b=B4Sl8ZxDwKQhJtVN/Tqi/ox3tQspIR6X5wPY9cPIeSPOEnFk4Eq3SVsbo2Mf2CVBCB Aa14u3qm4KkuxykUXBCZUgfxWcdvFEgNjPH6WPaGuh7k3UuU17diUmaN5PlEKArXFGBZ 7yo8CfQ+f/1o9uzQS7iZzt4+H0R18IEFXjoHV8KNZZsheiY+txq3TXjfuR/twwAIBdcQ rwmXJZ1uWeSCP6DYzmQSiEGMIlweaWzKKgLyoUxKnyGSGUkgyjsK1vP5z+A20zOnErY1 CazuOvQ2m2lJrtFQPQlzFlKa8NKy0MTPK9t30q8m9von5u/d0KnrtpuduJz7GxJehKBo 2vgQ== 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=Jjd65YXtvG5lQwdp8xCN6MNJ/6af5LF+gZQZc18vANc=; b=YZem6fI7BCw2BJ0aolYS92gNc8veQVk4yIclQtzbNUQwieRlzEAH3aPDTT7XgCRPQ7 iO+wLjWgvluZOG2gzmJ8TEvT6IP8JNjiCIwuaieATDcqRyGRFl35pHdcKdj3Nyr2Pl+p OWDCsldzdpY1Afgx4LtfupIjeVV98h9GZ/gl2Rh6y+ngDZ9dH67mcfZrZtU97JloKAzF hWwvSEG4sv8j8YvZylV8vNOx9+aF3JCSknnJpHhBYr/VQTH/cbmmPLXfRHZ70tv2flN/ 79zx3tIMl8/Q/JUnskj9ftCdJVo6fn1J/T+aZeHWy9siWIeHkQjSo3ITURTwRC39pGPk 0l2Q== X-Gm-Message-State: AOAM532mo+15FoDjP02W8xj4SIPMR8yFtZyQF8RdD137YwIPYV6DgjUr brprgBgu7cL+MwSIpU/BQePmzf5qmwGePQ== X-Received: by 2002:a7b:c5cd:0:b0:38c:8b1b:d220 with SMTP id n13-20020a7bc5cd000000b0038c8b1bd220mr3397663wmk.118.1650621900418; Fri, 22 Apr 2022 03:05:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.04.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/61] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for all LPIs" logic Date: Fri, 22 Apr 2022 11:03:59 +0100 Message-Id: <20220422100432.2288247-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Factor out the common part of gicv3_redist_update_lpi_only() into a new function update_for_all_lpis(), which does a full rescan of an LPI Pending table and sets the specified PendingIrq struct with the highest priority pending enabled LPI it finds. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-29-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 66 ++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 571e0fa8309..2379389d14e 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -103,6 +103,48 @@ static void update_for_one_lpi(GICv3CPUState *cs, int irq, } } +/** + * update_for_all_lpis: Fully scan LPI tables and find best pending LPI + * + * @cs: GICv3CPUState + * @ptbase: physical address of LPI Pending table + * @ctbase: physical address of LPI Configuration table + * @ptsizebits: size of tables, specified as number of interrupt ID bits minus 1 + * @ds: true if priority value should not be shifted + * @hpp: points to pending information to set + * + * Recalculate the highest priority pending enabled LPI from scratch, + * and set @hpp accordingly. + * + * We scan the LPI pending table @ptbase; for each pending LPI, we read the + * corresponding entry in the LPI configuration table @ctbase to extract + * the priority and enabled information. + * + * We take @ptsizebits in the form idbits-1 because this is the way that + * LPI table sizes are architecturally specified in GICR_PROPBASER.IDBits + * and in the VMAPP command's VPT_size field. + */ +static void update_for_all_lpis(GICv3CPUState *cs, uint64_t ptbase, + uint64_t ctbase, unsigned ptsizebits, + bool ds, PendingIrq *hpp) +{ + AddressSpace *as = &cs->gic->dma_as; + uint8_t pend; + uint32_t pendt_size = (1ULL << (ptsizebits + 1)); + int i, bit; + + hpp->prio = 0xff; + + for (i = GICV3_LPI_INTID_START / 8; i < pendt_size / 8; i++) { + address_space_read(as, ptbase + i, MEMTXATTRS_UNSPECIFIED, &pend, 1); + while (pend) { + bit = ctz32(pend); + update_for_one_lpi(cs, i * 8 + bit, ctbase, ds, hpp); + pend &= ~(1 << bit); + } + } +} + static uint8_t gicr_read_ipriorityr(GICv3CPUState *cs, MemTxAttrs attrs, int irq) { @@ -657,11 +699,7 @@ void gicv3_redist_update_lpi_only(GICv3CPUState *cs) * priority is lower than the last computed high priority lpi interrupt. * If yes, replace current LPI as the new high priority lpi interrupt. */ - AddressSpace *as = &cs->gic->dma_as; - uint64_t lpipt_baddr; - uint32_t pendt_size = 0; - uint8_t pend; - int i, bit; + uint64_t lpipt_baddr, lpict_baddr; uint64_t idbits; idbits = MIN(FIELD_EX64(cs->gicr_propbaser, GICR_PROPBASER, IDBITS), @@ -671,23 +709,11 @@ void gicv3_redist_update_lpi_only(GICv3CPUState *cs) return; } - cs->hpplpi.prio = 0xff; - lpipt_baddr = cs->gicr_pendbaser & R_GICR_PENDBASER_PHYADDR_MASK; + lpict_baddr = cs->gicr_propbaser & R_GICR_PROPBASER_PHYADDR_MASK; - /* Determine the highest priority pending interrupt among LPIs */ - pendt_size = (1ULL << (idbits + 1)); - - for (i = GICV3_LPI_INTID_START / 8; i < pendt_size / 8; i++) { - address_space_read(as, lpipt_baddr + i, MEMTXATTRS_UNSPECIFIED, &pend, - sizeof(pend)); - - while (pend) { - bit = ctz32(pend); - gicv3_redist_check_lpi_priority(cs, i * 8 + bit); - pend &= ~(1 << bit); - } - } + update_for_all_lpis(cs, lpipt_baddr, lpict_baddr, idbits, + cs->gic->gicd_ctlr & GICD_CTLR_DS, &cs->hpplpi); } void gicv3_redist_update_lpi(GICv3CPUState *cs) From patchwork Fri Apr 22 10:04:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564794 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp344585map; Fri, 22 Apr 2022 03:37:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziebpgBsBtntGxDHv4ebAZLYJH3K87OYOIzo4EbWoPgC5J3c8oeefUg+vYrgpZxIVsJDMU X-Received: by 2002:a05:620a:2410:b0:69f:73d:6e2e with SMTP id d16-20020a05620a241000b0069f073d6e2emr2200333qkn.228.1650623863187; Fri, 22 Apr 2022 03:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623863; cv=none; d=google.com; s=arc-20160816; b=l0TEeBrQM12W8jF50oZaLZZ2BXQkdtRUZVzZ0jsWpiB6Q3PhjsSEp/i8urYGXH9nGt 6jX9NmtAeVVpieCCiTb6no3X+xETqZdi2N3Bsyf+VLK/eLLin1cGt2u/w3QDNXRURSRU 2C2W1NX1fEnDJd48JP9ejSUIejyActmBejlLzdMTvfymjMg7HKdiSowG9osvL9IGVrnT 8GKHvy4IkUdNwMWgpTepVI1Yi/Te2yIGqHsw6tl13IjhCS1rCcISPN+pNY597uhAM6yD XmA+ie86/FTxcwPaBpOq4g1VZkVlD8Y8qmZlF4OZuhmHr1Jax4bZnWrAxmbGveUJOzxr BGGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PdLMMw5e/CkRPkREdXaW3qct/qWLck3R567GcZMXhrc=; b=DB5YKerNcQpoYtk6uQ1J7EnlV3H6uDwieSDuLh/iXsVHzDVc5VFEHBKyZ5+Nom8LJy 29xtfC8cvKyHz7KbwVPdarJNzGhGTmDSLgyqbBIFx3heTa/4ErnHEGq+TqqmUviM0q+6 q76PLRzEFj/JjBT0Np3VkhwL42z7PCQGbCXfhFQLQ4Oduiy2qX0ofZXdW1olJDiXS95s 1xTGwO76ds69FY7fi4e8JPSDUwwbTRI60fe59A2jOU1VP4Gv0Az/YHZLgJuYXJAH/Dwm 5nt9T9VzgJxlCwWbN3hRNLYG8ml+DmXHMJZaazDkH/L46LIeq5/rJLE3x8LuI9pJdnFf Wvjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GUTL6/Uz"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z10-20020ac87f8a000000b002f357539493si622310qtj.47.2022.04.22.03.37.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:37:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GUTL6/Uz"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqfW-0004ql-KR for patch@linaro.org; Fri, 22 Apr 2022 06:37:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9x-0004m1-HS for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:05 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:38725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9u-0002es-TY for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:05 -0400 Received: by mail-wr1-x430.google.com with SMTP id q7so2680742wrm.5 for ; Fri, 22 Apr 2022 03:05:02 -0700 (PDT) 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=PdLMMw5e/CkRPkREdXaW3qct/qWLck3R567GcZMXhrc=; b=GUTL6/UzGInFbTI/NIpLFOtDjolpt0Oao0s6MxWGJVoj3zwtYXwc3HbmET22bvOnZY fLktZHlKZdmGPSR1C36UE+oT5/r9tatJfCBV8gOGvzLC6VqpXBkV7CJ6MPLIajeHr/Ct 3VdSsoB8kHISo9F0TN+ZkvN3um7LkcJ4AxXGnb/6bUF9rx/nL/RUiDKlYoB8+5p2wq27 zHaC5gIny3NPFSJEqOGmYjSTYDq2b+c0pOSQ9XNT/t7MwB9eh+qBMYjqK+93zoMMXjpd v411up325xjbON8iFlGdGLwBMY5MqbZugEJUHe2lIaDwpCFuwZX32ZRlRMEKVuPFUQ0m qzNA== 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=PdLMMw5e/CkRPkREdXaW3qct/qWLck3R567GcZMXhrc=; b=4QdqM1sNSs7An2QP+tBhfhEZ+fQ/N9t6MxGZBzaRbV+FV2C6vRNDqxps3d7ffRL0Fh Q1c9lE+VcLbHAJSpaj7TYy1nh836Se8U8ihD2R531PnzByWVcUKO266abqPJTWb9xf5y 53NNBwCHhshJ4CM6n7zIAEAG1lOpuYY5bIxh2THhnn92vZOD4XJx28HAb7SZFbJ2Flpw D0+brgbRGL8q4a8/RbmkiPt2dgFu0WySAT0DjWuBRcnhMEDq5gLJOB88ykMpltTVvhoF FOFTz7s6w8X9mLvHdM8Dh0JG18efLQdUYDd6t7w55TEBqCIq2SzrgZjCIFNeCrUFUAiv sVoA== X-Gm-Message-State: AOAM530o/oQqBmM/MEuBO+CSKlGpe4ucCGomphzAVFjTRJvPn6hFGRVP lt9PWIB85I87PERH4k3Ilsbuqmk7L4DMSA== X-Received: by 2002:a05:6000:1789:b0:20a:9fbc:b1b5 with SMTP id e9-20020a056000178900b0020a9fbcb1b5mr3028148wrg.581.1650621901406; Fri, 22 Apr 2022 03:05:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/61] hw/intc/arm_gicv3_redist: Recalculate hppvlpi on VPENDBASER writes Date: Fri, 22 Apr 2022 11:04:00 +0100 Message-Id: <20220422100432.2288247-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The guest uses GICR_VPENDBASER to tell the redistributor when it is scheduling or descheduling a vCPU. When it writes and changes the VALID bit from 0 to 1, it is scheduling a vCPU, and we must update our view of the current highest priority pending vLPI from the new Pending and Configuration tables. When it writes and changes the VALID bit from 1 to 0, it is descheduling, which means that there is no longer a highest priority pending vLPI. The specification allows the implementation to use part of the vLPI Pending table as an IMPDEF area where it can cache information when a vCPU is descheduled, so that it can avoid having to do a full rescan of the tables when the vCPU is scheduled again. For now, we don't take advantage of this, and simply do a complete rescan. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-30-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 87 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 2379389d14e..bfdde36a206 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -185,6 +185,87 @@ static void gicr_write_ipriorityr(GICv3CPUState *cs, MemTxAttrs attrs, int irq, cs->gicr_ipriorityr[irq] = value; } +static void gicv3_redist_update_vlpi_only(GICv3CPUState *cs) +{ + uint64_t ptbase, ctbase, idbits; + + if (!FIELD_EX64(cs->gicr_vpendbaser, GICR_VPENDBASER, VALID)) { + cs->hppvlpi.prio = 0xff; + return; + } + + ptbase = cs->gicr_vpendbaser & R_GICR_VPENDBASER_PHYADDR_MASK; + ctbase = cs->gicr_vpropbaser & R_GICR_VPROPBASER_PHYADDR_MASK; + idbits = FIELD_EX64(cs->gicr_vpropbaser, GICR_VPROPBASER, IDBITS); + + update_for_all_lpis(cs, ptbase, ctbase, idbits, true, &cs->hppvlpi); +} + +static void gicv3_redist_update_vlpi(GICv3CPUState *cs) +{ + gicv3_redist_update_vlpi_only(cs); + gicv3_cpuif_virt_irq_fiq_update(cs); +} + +static void gicr_write_vpendbaser(GICv3CPUState *cs, uint64_t newval) +{ + /* Write @newval to GICR_VPENDBASER, handling its effects */ + bool oldvalid = FIELD_EX64(cs->gicr_vpendbaser, GICR_VPENDBASER, VALID); + bool newvalid = FIELD_EX64(newval, GICR_VPENDBASER, VALID); + bool pendinglast; + + /* + * The DIRTY bit is read-only and for us is always zero; + * other fields are writeable. + */ + newval &= R_GICR_VPENDBASER_INNERCACHE_MASK | + R_GICR_VPENDBASER_SHAREABILITY_MASK | + R_GICR_VPENDBASER_PHYADDR_MASK | + R_GICR_VPENDBASER_OUTERCACHE_MASK | + R_GICR_VPENDBASER_PENDINGLAST_MASK | + R_GICR_VPENDBASER_IDAI_MASK | + R_GICR_VPENDBASER_VALID_MASK; + + if (oldvalid && newvalid) { + /* + * Changing other fields while VALID is 1 is UNPREDICTABLE; + * we choose to log and ignore the write. + */ + if (cs->gicr_vpendbaser ^ newval) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: Changing GICR_VPENDBASER when VALID=1 " + "is UNPREDICTABLE\n", __func__); + } + return; + } + if (!oldvalid && !newvalid) { + cs->gicr_vpendbaser = newval; + return; + } + + if (newvalid) { + /* + * Valid going from 0 to 1: update hppvlpi from tables. + * If IDAI is 0 we are allowed to use the info we cached in + * the IMPDEF area of the table. + * PendingLast is RES1 when we make this transition. + */ + pendinglast = true; + } else { + /* + * Valid going from 1 to 0: + * Set PendingLast if there was a pending enabled interrupt + * for the vPE that was just descheduled. + * If we cache info in the IMPDEF area, write it out here. + */ + pendinglast = cs->hppvlpi.prio != 0xff; + } + + newval = FIELD_DP64(newval, GICR_VPENDBASER, PENDINGLAST, pendinglast); + cs->gicr_vpendbaser = newval; + gicv3_redist_update_vlpi(cs); +} + static MemTxResult gicr_readb(GICv3CPUState *cs, hwaddr offset, uint64_t *data, MemTxAttrs attrs) { @@ -493,10 +574,10 @@ static MemTxResult gicr_writel(GICv3CPUState *cs, hwaddr offset, cs->gicr_vpropbaser = deposit64(cs->gicr_vpropbaser, 32, 32, value); return MEMTX_OK; case GICR_VPENDBASER: - cs->gicr_vpendbaser = deposit64(cs->gicr_vpendbaser, 0, 32, value); + gicr_write_vpendbaser(cs, deposit64(cs->gicr_vpendbaser, 0, 32, value)); return MEMTX_OK; case GICR_VPENDBASER + 4: - cs->gicr_vpendbaser = deposit64(cs->gicr_vpendbaser, 32, 32, value); + gicr_write_vpendbaser(cs, deposit64(cs->gicr_vpendbaser, 32, 32, value)); return MEMTX_OK; default: return MEMTX_ERROR; @@ -557,7 +638,7 @@ static MemTxResult gicr_writell(GICv3CPUState *cs, hwaddr offset, cs->gicr_vpropbaser = value; return MEMTX_OK; case GICR_VPENDBASER: - cs->gicr_vpendbaser = value; + gicr_write_vpendbaser(cs, value); return MEMTX_OK; default: return MEMTX_ERROR; From patchwork Fri Apr 22 10:04:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564783 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp332225map; Fri, 22 Apr 2022 03:19:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIoi119lVerugGr/tzuqxkZ+6tbtopatxtZQVN3dJVIWv3WA7AxR+PUlzZnJfdP3/w1AaY X-Received: by 2002:a05:622a:1716:b0:2f2:56d:c8a8 with SMTP id h22-20020a05622a171600b002f2056dc8a8mr2556250qtk.26.1650622791330; Fri, 22 Apr 2022 03:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650622791; cv=none; d=google.com; s=arc-20160816; b=tQ5t8YTIaJpLuvBS2uUgEeGo6qjsHGPVAhfPGNSKzlTA3wiXovHTuIiw5fG1CtoghR pWoCycAON+vYjS+PXvwYb4z3vhXdI+O8Nq77tXexIzwMyiEzh6WWSjZjaM4C+2wZP/x0 BbKHWjfYfYT/OAOe7BwHrUy9NqWJWhqICrwLtVSjCqjCBVf1XfaGkxmWYIgOU614QONB iml//52ayOojOx1rCiBbgyTxCoK0jFTvW+Jovg8Cza466C4Mz88BzytL93V+Bp2eN2t/ VcpQJSO1P33TlQl+vfFlyiStqpNWp00jCwAq3OqiacppXHQGwzMDCv62bsAw/VmS+nj+ 3eJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PX0NLhcQng/vzkYLEUDXWQWxmx/78hsVtwkLTCrl74k=; b=mq68ucqGPFhRnUUDGo/k8+jVsGTEKsP6ZiqsG71pyuOI+tOm41ZQ9MsQ5MPfh5XBje E8RBomQeCD8Cx7j1ly4D0bjI1SiZiFFL+c7tpU+3HyuRltjX2XEYK3dcQX/bjCLWAp+v UvGEAllLL1Vaq0gRWGPGSx6doB1Wi00oTr1StChrmjZxEQ/wZzg7uCCXwyJntLsQ0zog ZwGipCPY/bBbEQO6Hj5aQYDSMrXPp/9bVUytL5N8ZlST7MnTuSrmYkrDaKq+jzCqO39B ejpvKNP0tHN36lfcVMdt+3+U2Ez6jtFIHXOP52saexPnekopMy1lV8ONC5nO+v9oVegL xXaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zwfq1Es7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d8-20020ac85ac8000000b002e1fbf3bf63si2057874qtd.340.2022.04.22.03.19.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zwfq1Es7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqOE-0002rK-Su for patch@linaro.org; Fri, 22 Apr 2022 06:19:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9x-0004m6-If for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:05 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:44911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9v-0002f5-NJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:05 -0400 Received: by mail-wr1-x430.google.com with SMTP id b19so10280649wrh.11 for ; Fri, 22 Apr 2022 03:05:03 -0700 (PDT) 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=PX0NLhcQng/vzkYLEUDXWQWxmx/78hsVtwkLTCrl74k=; b=zwfq1Es7nurcUCHl/O7JMglGaIgN9lkvHmtImvbdg3RGjxz4LehQHhS/pPeYXzE27l PujXVj0//2Fex81DEkrS5tYYMBJxyNk/x5y+Zo47dnaRmUbgA9Nt1F30xSDncjt9rAuJ WDBY6gdYKLO6ZKylqN5VF1X6D8pXtZpfF3GlgOY9v991FPbCOwBkol/C3YJvqYmGIU/x TYufT1TgYvanddheOzu6chJMhN70/fP3edJzHdJ3TpgUpvwernsHdcJqrM1bvRIesWXJ Elgj0CSsyugIAbsPbSeNBbKxfEM5kOS7RwmWmhL7XbqeJmqKuE50xF7JNhMQAnAqpo7v fSOQ== 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=PX0NLhcQng/vzkYLEUDXWQWxmx/78hsVtwkLTCrl74k=; b=XPExODtDuxmG3Ik2xYuocTlRfiqCrMQWq/P0xX4xSw/GQT+Xu/g4VJtJFFPuMu8drv b3FEHHW7y6GsQ1zowxTSYkrDtAqYnd9sVs70x9aePrWrhqBLN94Cr/Pw1QFaiDLUHg5T 1xJbN2Rahiuu7eoXI+q1P+aa7T7yoZgO1Fy35PZnXaITi4RFmA79ABMBYQJzOTcl+4t0 7b6J3sir65/QmeAKgGeNTr/gqoZ8kmllZA8RUmZdFyLQFTQpsIlJ5fbXMMblCTzlc4oq PIGjESvT9ijKQKiNIBJh4sMe0fEVXvbEDppFu11yL+SGr1NimYxpDShGJQDpbC60d3Wk JKmw== X-Gm-Message-State: AOAM533E7X7CMHP7MTMqv21exSAKo+JYPlOQ3d7zMRp3HkCy6kMyVlLx WZRwuyfCkCtRLlPQz3L3jzgfz8LWQZE4fw== X-Received: by 2002:a5d:6e87:0:b0:206:452:5b87 with SMTP id k7-20020a5d6e87000000b0020604525b87mr2987799wrz.473.1650621902288; Fri, 22 Apr 2022 03:05:02 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:01 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/61] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code Date: Fri, 22 Apr 2022 11:04:01 +0100 Message-Id: <20220422100432.2288247-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Factor out the code which sets a single bit in an LPI pending table. We're going to need this for handling vLPI tables, not just the physical LPI table. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-31-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 49 +++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index bfdde36a206..d54ed9a0332 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -145,6 +145,34 @@ static void update_for_all_lpis(GICv3CPUState *cs, uint64_t ptbase, } } +/** + * set_lpi_pending_bit: Set or clear pending bit for an LPI + * + * @cs: GICv3CPUState + * @ptbase: physical address of LPI Pending table + * @irq: LPI to change pending state for + * @level: false to clear pending state, true to set + * + * Returns true if we needed to do something, false if the pending bit + * was already at @level. + */ +static bool set_pending_table_bit(GICv3CPUState *cs, uint64_t ptbase, + int irq, bool level) +{ + AddressSpace *as = &cs->gic->dma_as; + uint64_t addr = ptbase + irq / 8; + uint8_t pend; + + address_space_read(as, addr, MEMTXATTRS_UNSPECIFIED, &pend, 1); + if (extract32(pend, irq % 8, 1) == level) { + /* Bit already at requested state, no action required */ + return false; + } + pend = deposit32(pend, irq % 8, 1, level ? 1 : 0); + address_space_write(as, addr, MEMTXATTRS_UNSPECIFIED, &pend, 1); + return true; +} + static uint8_t gicr_read_ipriorityr(GICv3CPUState *cs, MemTxAttrs attrs, int irq) { @@ -809,30 +837,13 @@ void gicv3_redist_lpi_pending(GICv3CPUState *cs, int irq, int level) * This function updates the pending bit in lpi pending table for * the irq being activated or deactivated. */ - AddressSpace *as = &cs->gic->dma_as; uint64_t lpipt_baddr; - bool ispend = false; - uint8_t pend; - /* - * get the bit value corresponding to this irq in the - * lpi pending table - */ lpipt_baddr = cs->gicr_pendbaser & R_GICR_PENDBASER_PHYADDR_MASK; - - address_space_read(as, lpipt_baddr + ((irq / 8) * sizeof(pend)), - MEMTXATTRS_UNSPECIFIED, &pend, sizeof(pend)); - - ispend = extract32(pend, irq % 8, 1); - - /* no change in the value of pending bit, return */ - if (ispend == level) { + if (!set_pending_table_bit(cs, lpipt_baddr, irq, level)) { + /* no change in the value of pending bit, return */ return; } - pend = deposit32(pend, irq % 8, 1, level ? 1 : 0); - - address_space_write(as, lpipt_baddr + ((irq / 8) * sizeof(pend)), - MEMTXATTRS_UNSPECIFIED, &pend, sizeof(pend)); /* * check if this LPI is better than the current hpplpi, if yes From patchwork Fri Apr 22 10:04:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564824 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp370163map; Fri, 22 Apr 2022 04:15:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOWL+8HJgheJ3PW03S6HdKw35BPdiFVFqaFBeuoNfxaC9bFjAyat79OnNCZFhsqMbafR91 X-Received: by 2002:a05:6214:d63:b0:446:4ed7:e21d with SMTP id 3-20020a0562140d6300b004464ed7e21dmr3182453qvs.95.1650626157348; Fri, 22 Apr 2022 04:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626157; cv=none; d=google.com; s=arc-20160816; b=uAXy0nPrm3gZbjHrzkl0eYZxhBZ51dmtXxw4xEl5jysn6S+FRG2Mxq9Fqhe1I6eu4k Jqp216BnKCIBvZAUW9IfC1YG+YkGg6QzfeueIMB0zSxJC9/EZpRryisg/cWgYgozDeRl cTF9Tn6cg5Fr+prsXsv1yjvGepbsShC4fXAD0l+PyNGBA2imgIWOCpV9w/b2ElDuEcfs dd+iarT9J0uwgLugapfDAZ7N8SZqMt0WpeL7Ml9nh1lqADfrk011TkI6+LKVkc4+nEQc j6tqHqvzbne9mwh+dSYELTWkk1kbQOR3boZ3YnxS5oab6bgMNRhP+r9JBVYgc5pR8giH xbHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jiS+itmO7Fo/3fiG/QD88OIh41bUATPpy7hpLVT0VSI=; b=YxxCQMwHKFGOaOqpfQHRwQEV3ABIA4x1odgjuX6qGRhNOkmeFaqxiYleAojoRYKzqT gV4zzcrL0CaSPwWqHi3W5SOFB/NB6stBGiTgW29krl4BfqKFW3tgJdCVh5DA2b0zGy0u qXQTrUux1RiXZgPgEgXi4sSW8L1lMeQqGybP9DaFbFe4KNQCuMOR2x3zvu3y7K3oCNBC NvmxfqTQd3Vkj2hPtMv6gRSEXVxlTVEADzoFmqRdsz6HxgNrittUdIFf3mAZbi1cHkLB Ab9vINhB20ThtnvtOl4EX56GhTckPJJQS2NpMLnqdiih5I0f1lVuij0Dgidzc9vVaPYf RYUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uEw3R04i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h202-20020a379ed3000000b0067e4be23a26si1986877qke.619.2022.04.22.04.15.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:15:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uEw3R04i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrGV-0002h3-Km for patch@linaro.org; Fri, 22 Apr 2022 07:15:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhq9z-0004pm-0R for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:07 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9w-0002j9-DC for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:06 -0400 Received: by mail-wr1-x42b.google.com with SMTP id u3so10335960wrg.3 for ; Fri, 22 Apr 2022 03:05:03 -0700 (PDT) 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=jiS+itmO7Fo/3fiG/QD88OIh41bUATPpy7hpLVT0VSI=; b=uEw3R04ibjWVV7VnQE0HSKR5EsUQzrLFyvDJno1VljzVAUGV4jJaJm3apZiNWjg5fX ffXZr8CMfWxdWXJXPd56kNMDHJAER8fsoMjTScIR9BulaMj4toV5xcaupL70RstFLj+w A5nr5SwRsSIk94kBTrdy8iDqcjaFlNAe28AagCfNE/6tqI4OZaYXe415FVctniA65OuV 9uRhLffVHPTSMoh7QL+AV+GVz1IPYt+CZMRndnnE1E9OaIT57/rrR6r3s22k8lFKLt7o RmRsTItxvP2Tn1RPPmnEOA9vKF1L04CNhet0SfowJuSdin/jaFuM4oNIxjN+OLgd2ZRi j2mg== 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=jiS+itmO7Fo/3fiG/QD88OIh41bUATPpy7hpLVT0VSI=; b=IrNL+j5P1kxRJWTOECoqonw0nbD24t9UddySRMtOoGpvLKEck7sfjWIkrcTFIzascZ UpXy6LRmjFXYOkf7G5w+VKSJYLYixHOUSGIFX/oEZ+uIRPNk4myK0NVp7EnssQJde27S WL4tZR19hGKyeyFbZu31xYkD8vhjnLcym/Cr8PMgFKJinFcUTHf8MAtvTtVBlF6N+RES Q1Q3cvgLobZfcChJJT9pvo+VhP0e6tra3KhmZfIW8WDSe02k8tCsMMspdnRpw8EWyF2w YR6wDqBuz1+GxY4xAsXeWABm1IE8bgYmq6kQYvBkI7QhxYT+ZJTkS1BJn/ncosAbPoV6 lcoQ== X-Gm-Message-State: AOAM530apgHc2pzKxCzc3vkyp9RPk1EX1bb5TnnWCxbFnzEtrpuicNRG 7fOax2Hw0DHoHAyOezAbeUpxNV/chyAduA== X-Received: by 2002:a05:6000:8b:b0:207:b80e:c711 with SMTP id m11-20020a056000008b00b00207b80ec711mr3122993wrx.178.1650621903017; Fri, 22 Apr 2022 03:05:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/61] hw/intc/arm_gicv3_redist: Implement gicv3_redist_process_vlpi() Date: Fri, 22 Apr 2022 11:04:02 +0100 Message-Id: <20220422100432.2288247-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the function gicv3_redist_process_vlpi(), which was left as just a stub earlier. This function deals with being handed a VLPI by the ITS. It must set the bit in the pending table. If the vCPU is currently resident we must recalculate the highest priority pending vLPI; otherwise we may need to ring a "doorbell" interrupt to let the hypervisor know it might want to reschedule the vCPU. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-32-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index d54ed9a0332..1ed251b87be 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -60,6 +60,19 @@ static uint32_t gicr_read_bitmap_reg(GICv3CPUState *cs, MemTxAttrs attrs, return reg; } +static bool vcpu_resident(GICv3CPUState *cs, uint64_t vptaddr) +{ + /* + * Return true if a vCPU is resident, which is defined by + * whether the GICR_VPENDBASER register is marked VALID and + * has the right virtual pending table address. + */ + if (!FIELD_EX64(cs->gicr_vpendbaser, GICR_VPENDBASER, VALID)) { + return false; + } + return vptaddr == (cs->gicr_vpendbaser & R_GICR_VPENDBASER_PHYADDR_MASK); +} + /** * update_for_one_lpi: Update pending information if this LPI is better * @@ -1004,10 +1017,37 @@ void gicv3_redist_vlpi_pending(GICv3CPUState *cs, int irq, int level) void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, int doorbell, int level) { - /* - * The redistributor handling for being handed a VLPI by the ITS - * will be added in a subsequent commit. - */ + bool bit_changed; + bool resident = vcpu_resident(cs, vptaddr); + uint64_t ctbase; + + if (resident) { + uint32_t idbits = FIELD_EX64(cs->gicr_vpropbaser, GICR_VPROPBASER, IDBITS); + if (irq >= (1ULL << (idbits + 1))) { + return; + } + } + + bit_changed = set_pending_table_bit(cs, vptaddr, irq, level); + if (resident && bit_changed) { + if (level) { + /* Check whether this vLPI is now the best */ + ctbase = cs->gicr_vpropbaser & R_GICR_VPROPBASER_PHYADDR_MASK; + update_for_one_lpi(cs, irq, ctbase, true, &cs->hppvlpi); + gicv3_cpuif_virt_irq_fiq_update(cs); + } else { + /* Only need to recalculate if this was previously the best vLPI */ + if (irq == cs->hppvlpi.irq) { + gicv3_redist_update_vlpi(cs); + } + } + } + + if (!resident && level && doorbell != INTID_SPURIOUS && + (cs->gicr_ctlr & GICR_CTLR_ENABLE_LPIS)) { + /* vCPU is not currently resident: ring the doorbell */ + gicv3_redist_process_lpi(cs, doorbell, 1); + } } void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, From patchwork Fri Apr 22 10:04:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564798 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp347299map; Fri, 22 Apr 2022 03:43:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykFDa1j10tkJF+3KpDasyiyMVPYpnWyf85Cq1Szu1Ril+Bo1SWKlCJcwl5sMnBRViRJRG4 X-Received: by 2002:a05:620a:1a9a:b0:69c:4a99:ea50 with SMTP id bl26-20020a05620a1a9a00b0069c4a99ea50mr2144124qkb.632.1650624188422; Fri, 22 Apr 2022 03:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624188; cv=none; d=google.com; s=arc-20160816; b=mSaoPzYWq9fiE/uFQABYs81qqgbEBpEofP29PO5CEePQndrExMKtGFW2Ze8xnHAW4x SC8GuKKZH8sv/hBJXWJdXHXE33r529rikZNDndJoWogogFBnvHLOUdGpsB3jSvWqxjg/ QnJ/+srL9dS0I4GMbaSxr1IMiSABYoMJ22+p+m5GTB+I4quagSCYOpm6g5lzTmRFjjUZ 5vzyMZj9vM4zFtC68lIMhvZWurejSsAtYYHJGZLzFpe66xMuM5bId0yOyjG+3Sx4Rgp6 A1ka+FXPLe9aTGps3V54BoCoenQKOfpKWIgU4n5+n/qB6KAWGWxLQmj9/yoMFbdQUw5G QkuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Fd3KVJcBKmzClgCV6dFquqvBXsUvGLaOK7cLjXe1F7c=; b=Yj6L34/AFszRtqEWRQyC4QHYTucMX3cm3kqio2jKplcnyOLReJmN9BzLU8JrMcPw8R JvEUf1hejL1R7HppCfB/dYuWBMLxCU8hJpzU2kUsiYGozEQTWrYIfXB4lxFyuFHGOLpI IACRcyrFemoHSHfTDnpcmusrLJuGYWh6HZSfZf4SX/ki5cse5H9Y65shDOKBdkt7oz/a 3nb2k8VM+/rfSmMCmxTCnR4ofHyQ1Yw7+982Pz073ReiIYvXe2qkg1OLwqGRVtBoGSv0 X4ylwb8ukOAzbQ5BfZu0VC5ZJWoDmhVfr9zm3aMOaZz4E7bjJq9lihoai5iom0344Bv/ aDkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BLXX2csi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p7-20020a05621421e700b004464f471090si2069917qvj.501.2022.04.22.03.43.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BLXX2csi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqkl-0003QX-W4 for patch@linaro.org; Fri, 22 Apr 2022 06:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA3-0004xw-1C for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:11 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:51054) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9x-0002pn-J3 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:10 -0400 Received: by mail-wm1-x32d.google.com with SMTP id r19so4805432wmq.0 for ; Fri, 22 Apr 2022 03:05:05 -0700 (PDT) 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=Fd3KVJcBKmzClgCV6dFquqvBXsUvGLaOK7cLjXe1F7c=; b=BLXX2csiLGOBJC0uhGqiuzQG5ybKZPT78oJ5pqQCEHb6oobkX0HEV83QFnTYZStJnU WGzgl9boRn8VWGSXh8P4seUQUGFP7ZMshXHxR+4tOoljmLvCfxUJj9RBnHWxFkXmjIB9 9JgMmbLyGpc+fJ1ecxB6zumd1TvK01v15ikC1FZRNgyv9RIFmT+dLvAdG27KWyRLsjI7 V6K12NYZdB7GpOMwpN0UjSxJ3CYbUEqbIB1XGnnw8eTi18UZNlPUyiZlysgZ+GWYB9M3 iDJFVDCxDVvLePpX5+wRhwOC486A0CHN2z1Np7S6PZ6O6ipEljz70qYYcNspafABkN6/ UX6A== 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=Fd3KVJcBKmzClgCV6dFquqvBXsUvGLaOK7cLjXe1F7c=; b=Ge0ZjIqQ910uVD5B287QC1CI2hJ0b49k6hvhdb9P3u2u58N1uSumTqbXyszuZUY5gg mCHwDjh+qqOdoLBqnFAlSQg1rFEC+pXwTpo4YwALp2WxN/BIBwzdUqnfJVsTaneX8Nci y96fFct9aTl6I7YVAueX9y51tabSS6bOytb6W7Y6BIBsU1ZrhOPsMtmw4D8n/rmIAn83 z4Yd8tQCUnvJxL6yJ/27kWaqkb2gTNsR9Wv0QmF+F0ghYFK2up9GRrqq/qKqNq25jpJ3 lTnU7yp2HLpawBSwAzRWs+De6bLIJ7wa8Jofc6TlCNPlj5XbsGRXMNvvsuAb7imD2CF6 TXuw== X-Gm-Message-State: AOAM533718NbcQCFo8aXeVdgJboyROVx+I02bo4iWWjgn5T+CN/bBppj 0XNJmiNB7S86YX3aYHiR48Trrt4dnkkodQ== X-Received: by 2002:a05:600c:a06:b0:392:a4f2:2097 with SMTP id z6-20020a05600c0a0600b00392a4f22097mr12706970wmp.97.1650621904141; Fri, 22 Apr 2022 03:05:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/61] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vlpi_pending() Date: Fri, 22 Apr 2022 11:04:03 +0100 Message-Id: <20220422100432.2288247-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the function gicv3_redist_vlpi_pending(), which was previously left as a stub. This is the function that is called by the CPU interface when it changes the state of a vLPI. It's similar to gicv3_redist_process_vlpi(), but we know that the vCPU is definitely resident on the redistributor and the irq is in range, so it is a bit simpler. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-33-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 1ed251b87be..0fbb04f9986 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -1009,9 +1009,28 @@ void gicv3_redist_movall_lpis(GICv3CPUState *src, GICv3CPUState *dest) void gicv3_redist_vlpi_pending(GICv3CPUState *cs, int irq, int level) { /* - * The redistributor handling for changing the pending state - * of a vLPI will be added in a subsequent commit. + * Change the pending state of the specified vLPI. + * Unlike gicv3_redist_process_vlpi(), we know here that the + * vCPU is definitely resident on this redistributor, and that + * the irq is in range. */ + uint64_t vptbase, ctbase; + + vptbase = FIELD_EX64(cs->gicr_vpendbaser, GICR_VPENDBASER, PHYADDR) << 16; + + if (set_pending_table_bit(cs, vptbase, irq, level)) { + if (level) { + /* Check whether this vLPI is now the best */ + ctbase = cs->gicr_vpropbaser & R_GICR_VPROPBASER_PHYADDR_MASK; + update_for_one_lpi(cs, irq, ctbase, true, &cs->hppvlpi); + gicv3_cpuif_virt_irq_fiq_update(cs); + } else { + /* Only need to recalculate if this was previously the best vLPI */ + if (irq == cs->hppvlpi.irq) { + gicv3_redist_update_vlpi(cs); + } + } + } } void gicv3_redist_process_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr, From patchwork Fri Apr 22 10:04:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564826 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp372674map; Fri, 22 Apr 2022 04:19:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp6p+9IgP2sf79oNlrtvpSnhcYowKj6h20pLdwZ9QMlg4dsGO5XazU/uSXxPAVf8vmEkH8 X-Received: by 2002:ae9:edc7:0:b0:69e:1318:3251 with SMTP id c190-20020ae9edc7000000b0069e13183251mr2265327qkg.57.1650626373994; Fri, 22 Apr 2022 04:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626373; cv=none; d=google.com; s=arc-20160816; b=OKyesWxcJ3kKUFguqt/TFBjzC1BiK/LpfDv0GQtmMocXzPbQeT27fPMWrMHBvAU9Cv wbpw52UMfqqhl0IPFqtanVRGIRkBvVBGITdaEs0d1Tus3TV6rrPxxQ2KlIdMPvtx8GoG 0VjLR4HEfjekphUQ+MSv8H1YPJg8iiyLK8vC9y9552Az8eK3yuCdyfm1OB6AYj4zGrQF aF5RMomFGDevy7QSBCRoyZFeJupECLQqAcMM+QUB+f11Mank8/5VGDCjlS01eIbJhYSJ bKUN2GFk/kdtphyCLDXTAVhEIuucayTBqrLRKFZSodsZPhq73dzcdxFgKQ0u0TcNrNg7 0WFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Sllr6EGIV1uqtp8xOnIt6F7gaB5mrGXL+fViUdJftLg=; b=GXk2AkTTiPE44JGqQOq4TzWnRviSNPQ9s7BI/9loR2kQQ/pxTSRqMocI/XFlnAPcVc RQ4doN8xfsWKNvDxU6WUWnpvdWEyDLIGRTsQMCoWb/zvXcnDLjraGFhQIRkevXIVKK4I IL5CoGg4C6YyAEzZeY0HrFKA8vgifdgxZnPe59DtlpJnLyvg5ngTiVN5CbGMOmH5HC9p IOIBx2E4YjWeiusSsB1x39LK6hs9WVDguy9w4NKfUQz9kt7rtUblp8JO1m1wxFmDaunx WXRwvSkeIGDoHbU0n6139M4Pjo4oxF3MGvmsbD+BR3YicV0TAs9dv9yWVecrAvA745Hs vkVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTIArm9x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e16-20020ac85dd0000000b002ebe8c933dasi2283777qtx.192.2022.04.22.04.19.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTIArm9x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrK1-0000K0-I3 for patch@linaro.org; Fri, 22 Apr 2022 07:19:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA0-0004tD-BC for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:08 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:38897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9y-0002qO-LL for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:08 -0400 Received: by mail-wm1-x330.google.com with SMTP id r187-20020a1c44c4000000b0038ccb70e239so7618497wma.3 for ; Fri, 22 Apr 2022 03:05:06 -0700 (PDT) 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=Sllr6EGIV1uqtp8xOnIt6F7gaB5mrGXL+fViUdJftLg=; b=BTIArm9xV7nueRM0VgmSqa4zA+lVIdper/Md3paLpjSU0rzXqvTWdbBDaPURIQ96YW gwfbbdeZ3VgtYY20JyZjATZV5T4nPzhY4/UbXEdpVDRV7S5zxWejSkxUUDQBIsfr+FPu 7ZiSqqjfHEjL7NouiktoYOOU+PIwfvFRbRkPdnBr6980sUPciyWaXgh4747ZTWhIs1WL 6vyPQB+24WjlPnhszEoSn08AnuWAi0RvacWA3iPLYNR7WQeA/rTNDFMEnZRPKZAYJnP6 1j13O/hI9kzrntITTLLJSzOrGfUa9jdAsIFIrdfJX8Tbb2dHc+u9sVzP3QhtsdeS1sEF I2LA== 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=Sllr6EGIV1uqtp8xOnIt6F7gaB5mrGXL+fViUdJftLg=; b=f3ASIpr/W33N66LZ9AK0Bjl3g+Ejg93m8TPBKlavEprXuUNNYg2VkQBGqw6HRrlnah yXdGJllAtcZMFAy69b/e4iprAmG+2GGI0fyrK0Kl8bWq6kQrtLUiiSEhQDh0IW6Cgj8P uZfbzBwUU7sk20B4LC/2+mstO6lemoXcImRptIqTrbutWm61057lqS0UCInJlX9Z47V8 keNRjbZfE1H/ctEK5RcxyhMAHDOAHdJct7gK4QK4Ok+bMB4fGMDhTdDC1qZYlV6yVHfF qfUUd5tQIjhM6v+I+cvrjS0jCiTK5WtAQcUqlz6Y2N/p+fwkND3uZc1LAiqyfubgTUgk 0Ttw== X-Gm-Message-State: AOAM533nKTevcI4UO6OKruu1SzKb/jCXweZHRJmAzd3cZ9AX4WG6XW8W 8JLjsxNHO+U2QnhNvBemlpO7kTxBdFAnlQ== X-Received: by 2002:a05:600c:1e85:b0:391:ca59:76be with SMTP id be5-20020a05600c1e8500b00391ca5976bemr12412497wmb.184.1650621904981; Fri, 22 Apr 2022 03:05:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 33/61] hw/intc/arm_gicv3_redist: Use set_pending_table_bit() in mov handling Date: Fri, 22 Apr 2022 11:04:04 +0100 Message-Id: <20220422100432.2288247-34-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can use our new set_pending_table_bit() utility function in gicv3_redist_mov_lpi() to clear the bit in the source pending table, rather than doing the "load, clear bit, store" ourselves. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-34-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 0fbb04f9986..2c4a87318bc 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -909,11 +909,9 @@ void gicv3_redist_mov_lpi(GICv3CPUState *src, GICv3CPUState *dest, int irq) * we choose to NOP. If LPIs are disabled on source there's nothing * to be transferred anyway. */ - AddressSpace *as = &src->gic->dma_as; uint64_t idbits; uint32_t pendt_size; uint64_t src_baddr; - uint8_t src_pend; if (!(src->gicr_ctlr & GICR_CTLR_ENABLE_LPIS) || !(dest->gicr_ctlr & GICR_CTLR_ENABLE_LPIS)) { @@ -932,15 +930,10 @@ void gicv3_redist_mov_lpi(GICv3CPUState *src, GICv3CPUState *dest, int irq) src_baddr = src->gicr_pendbaser & R_GICR_PENDBASER_PHYADDR_MASK; - address_space_read(as, src_baddr + (irq / 8), - MEMTXATTRS_UNSPECIFIED, &src_pend, sizeof(src_pend)); - if (!extract32(src_pend, irq % 8, 1)) { + if (!set_pending_table_bit(src, src_baddr, irq, 0)) { /* Not pending on source, nothing to do */ return; } - src_pend &= ~(1 << (irq % 8)); - address_space_write(as, src_baddr + (irq / 8), - MEMTXATTRS_UNSPECIFIED, &src_pend, sizeof(src_pend)); if (irq == src->hpplpi.irq) { /* * We just made this LPI not-pending so only need to update From patchwork Fri Apr 22 10:04:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564787 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp334778map; Fri, 22 Apr 2022 03:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz3LLuUoMv0Xm3k3SZgRrwc/GvvJB+GyB2RCPA2FhPIa1wMppk9e7mz6zkTbdItKfZ4ZVG X-Received: by 2002:a05:622a:20e:b0:2f3:4ef6:3aa7 with SMTP id b14-20020a05622a020e00b002f34ef63aa7mr2641297qtx.136.1650623001981; Fri, 22 Apr 2022 03:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623001; cv=none; d=google.com; s=arc-20160816; b=OCLn+IA7Q42DNWhAq2otGEIdo2iTj9Y3VnyBYYp98uRVHbAySF8ZOSoCd29vG70uU+ qOK7RMh6veel1W8kwlc/o8eRMlsrNvwLFwRJI4PX6fZrmczFixiwNqy6VB5IfcmfQVr5 wxfCu4TZ2aF5dMeVtuhXkEYPVrnjQv+3fzHRvXX/RWiV/NxmKOU+Ag5LicWSPkMaZj7r 6pj0q5CMxeYmIKYdHtrnlp30/3fsOYNVdP3dvXrdwmXjKfEQg1NvqHTHjM+Eiif3vumr 01J2eI8RUGb3BKfzjEo2jUqNA6YnefZ3XTFWe/AlfGjW0RDrxnoYkDTOVzZQi4LFmQGb Rhwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=l5uJxy4WfAzOW7qSBnV+0WxIG9WxiypmDb7cHj2F97M=; b=Yjh3oWvG6m2/bdQOdQXC2u5rWpmeLHY5Ri6VolzDCGxhZLubsbc25TwEFMqxYPo4Nn +RAMpEh+mmZodNS7cB8Oul2AG2lB26750y9/uSdbRLkIKjEm4ZYt+Re9zCPYWvAUTz+J FUFsQcKoKvn8CrpB1dA6ytZvvCvO5dXkTyJqTT+gp+YaY/wEBdxH6X5dB453cYol+EiI 545kipcuRyH3KpQuyU/sUIBdxQ//3ZvvRgKv1qxIIS4DMH7e6VJLkC49pt32b+uGMopa 4pnR6Gnn9syxYl3gvLYykWjmxFh0bpRFiAe2wfERd1wKk0KLxcvTcFLJrZ0yWYRpMQRx MKDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n4HQ57pz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 2-20020a05621420c200b0044ccdbad094si1276799qve.389.2022.04.22.03.23.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n4HQ57pz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqRd-0000Fq-HR for patch@linaro.org; Fri, 22 Apr 2022 06:23:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA0-0004um-OX for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:08 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:51059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhq9z-0002qS-5J for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:08 -0400 Received: by mail-wm1-x332.google.com with SMTP id r19so4805479wmq.0 for ; Fri, 22 Apr 2022 03:05:06 -0700 (PDT) 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=l5uJxy4WfAzOW7qSBnV+0WxIG9WxiypmDb7cHj2F97M=; b=n4HQ57pzA89rxgqy9XnftRnmfbPKrlkiPHcoU57SL6YE3GU2knV/MWH3LtS8tQdHZ3 XlobWnsboUmB15JFZ+PAbZ7/qNx2iF7kMOnMSxwNoaiO4yv+h+RcHShu95Bdlrx0DCFS 3GSWI+mcQ7DZM2klgSOTmzrWav7esYRtQ6HGW26FRoqG41KnqrR5vucawmgMRsnhmKUA gmWlqC+/rA7iuh/eL0ZMrClaqotj8R9AHcAjBxpQxjrKaTu/ojVgUqvKqzRg5NC6HQt7 YK6HxB7t+hG1GptKkE5PDBJ41bhS5pH3kpINwpsbVUZOyfwx4fPXbMDi7BYCI1/RuGwc PcjQ== 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=l5uJxy4WfAzOW7qSBnV+0WxIG9WxiypmDb7cHj2F97M=; b=G2RlnRc0D9R989kftBzgR6Mdrcky3wkqNQhYJALCHUuoSnL4751vG1J0hHcTzxxg7E mLVUMuSIiJ9cr+3Vbov2KbHEBdrUrNm1jOpWeQa+KJyKTJlUnjDENfp04DIK920vk1P2 bufVhrD+jI93sXbc3AA99Y66VMJRzd/r/wW7QzH2uwaqQDD8v0WGvbb7Vg22yWa2FD1/ Az8iblFT1KRbUMDljyigPn3X6ZB2T/TueHHKVKThHcCTW94v3uGhX/SVHc58qiwHYYUI B40DlMHuYBs94TUAW0z9ZMp/VKjnAam0aih4W8OMCCYwsMYTRfA+/QxwxF1VBTmGfDpe IxnA== X-Gm-Message-State: AOAM532pp5TZYaHvPXYaXPTBty52+8Z/Lk8nJ1oEIL/9xN0BSu/QXBQ0 kjQn3G039851Pwfj8AiKMYRZ7PADLmRpgw== X-Received: by 2002:a1c:2904:0:b0:37b:ea53:4cbf with SMTP id p4-20020a1c2904000000b0037bea534cbfmr3428761wmp.46.1650621905830; Fri, 22 Apr 2022 03:05:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/61] hw/intc/arm_gicv3_redist: Implement gicv3_redist_mov_vlpi() Date: Fri, 22 Apr 2022 11:04:05 +0100 Message-Id: <20220422100432.2288247-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the gicv3_redist_mov_vlpi() function (previously left as a stub). This function handles the work of a VMOVI command: it marks the vLPI not-pending on the source and pending on the destination. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-35-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 2c4a87318bc..78dcdcc7621 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -1067,9 +1067,25 @@ void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, int irq, int doorbell) { /* - * The redistributor handling for moving a VLPI will be added - * in a subsequent commit. + * Move the specified vLPI's pending state from the source redistributor + * to the destination. */ + if (!set_pending_table_bit(src, src_vptaddr, irq, 0)) { + /* Not pending on source, nothing to do */ + return; + } + if (vcpu_resident(src, src_vptaddr) && irq == src->hppvlpi.irq) { + /* + * Update src's cached highest-priority pending vLPI if we just made + * it not-pending + */ + gicv3_redist_update_vlpi(src); + } + /* + * Mark the vLPI pending on the destination (ringing the doorbell + * if the vCPU isn't resident) + */ + gicv3_redist_process_vlpi(dest, irq, dest_vptaddr, doorbell, irq); } void gicv3_redist_vinvall(GICv3CPUState *cs, uint64_t vptaddr) From patchwork Fri Apr 22 10:04:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564791 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp341639map; Fri, 22 Apr 2022 03:33:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbpH+WCy0Pk9w+x6ERkW01Zex1aM5CVkmdKUMOkbiw6pJN2VqlZ+0FufJSAv8l2NEJopqL X-Received: by 2002:ad4:5842:0:b0:444:5137:44c6 with SMTP id de2-20020ad45842000000b00444513744c6mr2720337qvb.27.1650623593502; Fri, 22 Apr 2022 03:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623593; cv=none; d=google.com; s=arc-20160816; b=KprrQ3Mk3bBSfY7R1/3zldIjzuWjX/8N8r/su16WVzO7vARZ2l9ziTQxo0e4fNXWE+ ceK6QCmo0hQyuj98oXKxWM+CwnmXJFMXz8duaE6WYkPFWQTsbs5MLxocrZX1wZQrPIk5 t4VpWH9Hdf4K287UT+JYoOdMIrydR3HWmnkS8Yv6mlvNz2R1XUXB9GBuaFKJ41fRlOGB wFMdq/9ES8GTFzcSOhver9LnliH/D7Vid7Fbc2HD5Wcy7OufQr+QvUvnWhUNuWbIdTUH 7GLN/5cLithQ+t6uvHK7iOy1LwcoFe1SXQCF8q3CzIdpAqBrESpnY82+8DTRC2hlT2bQ UZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZEhoOIoK2+oeX738Kznp6czGDdThyWg3QrQY8i6NzM0=; b=mLb+qo+O14pULqUc9ily51oQO8lX4Clyj7XGGajjLlwM7n/lrZ88UyLA8geCgYgdWS wr4Z6Lqfhj7MFocmkivDfmZTPP5NuV24edw22JbUaB/nobpveFgLUCwOa11aBQM2k3y3 sYIF2sxDhoAST+ApgmkI4Vidn3YuOB8/EJ58rBNgQB2VmMWS7IOiSD1on3nKO3xDRx5s 70mwTrbGsU5COHIxbzQrDshIeEnsvypWcrDUI4a3qXo/bbSJF3Ec49sgstQ/VAPqILIC QxHEuB0O6yKT6hnvh28QbBb8EVyffUFBth0ANsXje6zKetZ8X1zFP7uGcsc9E1ZTihDw cvaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MoyIsUrh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s5-20020a05622a1a8500b002ef63b951adsi2201217qtc.116.2022.04.22.03.33.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:33:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MoyIsUrh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:38940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqbB-0006b5-1G for patch@linaro.org; Fri, 22 Apr 2022 06:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA2-0004wt-2N for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:10 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:35597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA0-0002qs-Gw for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:09 -0400 Received: by mail-wm1-x32c.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso7650563wma.0 for ; Fri, 22 Apr 2022 03:05:08 -0700 (PDT) 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=ZEhoOIoK2+oeX738Kznp6czGDdThyWg3QrQY8i6NzM0=; b=MoyIsUrhbX8z+D1d/v09P6DK6oMWiIkQEzXOLO/MRfPRCpubjk/HgHNJIvjCsGa706 B8qI/wJx4bEykrOF9x1CY0gu0xc08SX6ew3y36Ao2CzEK23NYQrDWCoEISkA3I7k13N1 aIE/FIeaG1npI3jRHcuXle16PP65NdtYZM4O1P7DY0rv2gYPql2c5VhvueMjI9FEWAfc 6O2/jrWqp4GA2LHbvlUMPVcaRCzGGm79UM+XedGTWncoVAWUtrZNwLF2Wka1V8tB0DyZ J4KlCUFYohV941cf+yUBNe5nap8BwdJHCOOdRw8X2WQzDSNP/0+pktSWXn8+V/kEu1bH K8xw== 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=ZEhoOIoK2+oeX738Kznp6czGDdThyWg3QrQY8i6NzM0=; b=5vB7I/vlr8xrvSdwzxDfdOmZplW0+E5w3Q66uezmU2uidiaAdvs8HyCv/KR3ABSinw j4VO9krcQpYK3/bP/snQlJkK/81Ic5Jy9lGq2KXi9S1Hfxccmqcyt1xFN5dGYEQRdo13 sCLWVIzs5M1B4rI/axA4yqNOxVD4dJBvDvI1Ydh8KzsfDTfpmCHtGXG/fDPOre0PZTJd RGnwKV/+VH1jRWkuWNjT7HIesXJVrWYuiBdJ25UppjHFUgrDWnZlmtoIB/AR76/3da6+ MwmBVB+aU97fI/+XTIKyv4ZBpTll8Z4K921ZTX+Ijpqt6jO7IyriJX8QS+lKOI1n61bQ v4iw== X-Gm-Message-State: AOAM530I7qdoapSM+SuH8e2AmE67FKe/sWi90sMN7m1woDB6dHs+4TKg O23sMPFGoXP0DcmUJ12CHnwROwLg0RxQSw== X-Received: by 2002:a1c:f415:0:b0:37f:ab4d:1df2 with SMTP id z21-20020a1cf415000000b0037fab4d1df2mr12281839wma.75.1650621906733; Fri, 22 Apr 2022 03:05:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/61] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vinvall() Date: Fri, 22 Apr 2022 11:04:06 +0100 Message-Id: <20220422100432.2288247-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the gicv3_redist_vinvall() function (previously left as a stub). This function handles the work of a VINVALL command: it must invalidate any cached information associated with a specific vCPU. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-36-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 78dcdcc7621..34f4308e980 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -1090,7 +1090,13 @@ void gicv3_redist_mov_vlpi(GICv3CPUState *src, uint64_t src_vptaddr, void gicv3_redist_vinvall(GICv3CPUState *cs, uint64_t vptaddr) { - /* The redistributor handling will be added in a subsequent commit */ + if (!vcpu_resident(cs, vptaddr)) { + /* We don't have anything cached if the vCPU isn't resident */ + return; + } + + /* Otherwise, our only cached information is the HPPVLPI info */ + gicv3_redist_update_vlpi(cs); } void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr) From patchwork Fri Apr 22 10:04:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564810 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp355854map; Fri, 22 Apr 2022 03:57:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjZMGjnp0mi2KbvtIrw4j2/ywQoMm5SUwRLZNTpw1Ep6470X4kOLPt23C936NCL1zXyplR X-Received: by 2002:a05:622a:28f:b0:2e1:cebc:8c44 with SMTP id z15-20020a05622a028f00b002e1cebc8c44mr2668694qtw.648.1650625063243; Fri, 22 Apr 2022 03:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625063; cv=none; d=google.com; s=arc-20160816; b=000s/YZ2Fk8ABVz56NkMzWY1Y3v/N9MLlAVcztcqDz5mCn2XaCDG0DL2U/M1aMlbn5 SuKc1MrqEdgJXoTga21ZdvsfEDzBG0gAZKF+4aC+fECOhbmXoDNnx51oaBXKG2PipCHb /js+G5B80eu+7X0+kCp1NTk19pwCLp1QtzWWCBPNxAUnrTClqAuvxqM17VBB45HS+IFZ TwFW3ytqX2JT+QKo+tcXorn6Ga79MO5N1XqLaneK1/BJcaUgjN6l9qEvMTwr0IKz9Uvr 5BkQ0n7s7I9Rq2E7OZoChrxAWJS27Ylmk97KsmbjeEI+8tOTFfh+cAsmThhz4DGbx0U9 g7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mPgmj5RVzDAw4cIOgcMQ1RCLJRgE1k4EGIsJB8ypEvA=; b=x4yoNeSbA8s73LHemrm3kl52jfZQRStZLbkBczcwD+cxocD3pt2AVvgN7Z/lOwRu9l k4C6L186zXUKNPpzpwCLPdLeHzi5RNGc7sFEILWxJykDEK0SX22VJR8FYj6s7rMKcXQg 2Yba9WQziOkUbN5z6BvGFjEHRkv2i36gdXegNWIVQP6XbLinn4zEAGohon7j3wCKjQg8 XTxiCXGh2xJn2GTsOBQytnyvNY3T72VVf6L5X2eH+ITuQnEDiFutayY5M4iuSsrYA7kv uckouLatX8yjv7uqDlki0KOb4bjxfUfpwZkoWgT/ktRSvLkV3X8TOADdOAPlayz4A79X Mz3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGETRI5O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x127-20020a379585000000b0067e4be2392dsi2023392qkd.370.2022.04.22.03.57.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGETRI5O; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqyr-00086v-RF for patch@linaro.org; Fri, 22 Apr 2022 06:57:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA3-0004yM-CX for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:11 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:43565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA1-0002rG-EU for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:11 -0400 Received: by mail-wm1-x32f.google.com with SMTP id n40-20020a05600c3ba800b0038ff1939b16so5090734wms.2 for ; Fri, 22 Apr 2022 03:05:08 -0700 (PDT) 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=mPgmj5RVzDAw4cIOgcMQ1RCLJRgE1k4EGIsJB8ypEvA=; b=zGETRI5Op4KYHdCpVfyRZKvL0y/ysalWTYXUnBesVAZnDnbGxiDGetBEcLS8RS6CZ/ 6fA2OwD+hFKA9cXmmFJcwxrN9xVXQ27NyL2W1qbVvpstF+9v1ASmGPYzrMAFXP28M4Ex dEeCt09fOgb+56H1bmYqGNGrKIqIVp2Em4LhABYzonurzfXUTVZIqxtL6YzeST6r7FtM 467toEYyWietXnpKXt4aS2YqSaokv+z0TVhuVWNkV+M9yfHl8oS9GwpZyWZQSUSL9KQp RQS1oeN++MxNxpNHurJ3Z6Zdv04IrNR7fycK8RHotKnMdBII/Z7m0OML/2J0oZ2a3pOo H7Pw== 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=mPgmj5RVzDAw4cIOgcMQ1RCLJRgE1k4EGIsJB8ypEvA=; b=DxSIrajKLicntvy8Z+f5E3uF1tR/8lfESUNhzf3lyv4ACG+CABJ/v9sJ8V731/bgRj g1oU+sS292G4n8QL/CeD5lrsiRPKFfKZrbdS+3JaOrVDd+VjRAW1yZG2CmfvQiqldHlc 39YHxKhRK8OGzaeHT0mHmgY5HEFpnvvVnZfIVRc+GHm3LgipH01Dp5ym5W5oo+5DyJk0 g2vcNg3iu7P1sY5CDnW2XfsdRwQCJRcFsl5tYa6FHkH1T895SIyNJ0wOhRd6uWpNRFZ4 5djlGnT68kuO/HXDYG4AoV6x8XBK9GfS5miXW6i+qCZRD1L8I6Cc/Ze9paIGtatMLKd/ +gVA== X-Gm-Message-State: AOAM531Z6m9V4J0tN6qOIw2swE/7LMn7Ymnx0ThqQJW3TXWWwdB0mFOt I5IT6X4SHGH0oaTgYMP4ue/8TXphptQyOg== X-Received: by 2002:a05:600c:4ecc:b0:392:938a:d85 with SMTP id g12-20020a05600c4ecc00b00392938a0d85mr12352783wmq.165.1650621907872; Fri, 22 Apr 2022 03:05:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 36/61] hw/intc/arm_gicv3_redist: Implement gicv3_redist_inv_vlpi() Date: Fri, 22 Apr 2022 11:04:07 +0100 Message-Id: <20220422100432.2288247-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Implement the function gicv3_redist_inv_vlpi(), which was previously left as a stub. This is the function that does the work of the INV command for a virtual interrupt. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-37-peter.maydell@linaro.org --- hw/intc/arm_gicv3_redist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 34f4308e980..bcb54bef76e 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -1102,9 +1102,12 @@ void gicv3_redist_vinvall(GICv3CPUState *cs, uint64_t vptaddr) void gicv3_redist_inv_vlpi(GICv3CPUState *cs, int irq, uint64_t vptaddr) { /* - * The redistributor handling for invalidating cached information - * about a VLPI will be added in a subsequent commit. + * The only cached information for LPIs we have is the HPPLPI. + * We could be cleverer about identifying when we don't need + * to do a full rescan of the pending table, but until we find + * this is a performance issue, just always recalculate. */ + gicv3_redist_vinvall(cs, vptaddr); } void gicv3_redist_set_irq(GICv3CPUState *cs, int irq, int level) From patchwork Fri Apr 22 10:04:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564802 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp350016map; Fri, 22 Apr 2022 03:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjswkM6tDC9RW5qY7BfM2Vd6aBbjALt2dzBJHDMQac0oBlHj6rAFA+of8/PL2zpe+9p/c6 X-Received: by 2002:a05:620a:280d:b0:67d:2480:fdea with SMTP id f13-20020a05620a280d00b0067d2480fdeamr2132731qkp.157.1650624482557; Fri, 22 Apr 2022 03:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624482; cv=none; d=google.com; s=arc-20160816; b=WPpI5YAhFKrzrht0vaQgNDcJ4WDkotbOXySNdFDd3dS6YFGzu784/TyNYIbg36ft/t 4fee7qcATjjGhrxfslKKr/ZJyZewosX8VZiyrrt1yKIh0D5AxFfu2KIi9COEJTFc335I xNF0bYuMp51QVmMNxnw9qbaObh8s8p6/90NgQc7ga7ueFPJjh4ep6u15I/WJBLfkP2+b U22UmWaWyY45LTC3HzLLiVVPcfB+KlcZ8dcA6MqlDRaeADWb4SDuKOFZhNoboMdI4sss U3CdayoIau1tSxd8g4fKrOJ01r/fbFO44xv0Ft1uJUPPhSGh5Hb+k3TWObvfefdFas3t a3/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ndm3t5N4OR0qFLpk2c9QhA+QCMSP9KicMr+q+FQ7Er8=; b=t0Q5oFXOYF1AaID+UF49MBzskCfzbQDk9OUMd3yH9gXHSwRD7mwtpYEKY/CDnsSXmv KgMVBa4W+27DJCLhJux+r9L3fmmzLzSXSuRiZBceeVfUiB5l77oamZfRwsXzJzNQQMcf IFRhSprWitt6vpKzCMM+OMbd5C44YQtbgh7Mu1G8QMnHB/nOoONsse2wJxiGiW8aPDiU MrJRwv+K34esvOg7TS4Ooo7ZGNhDerii2hONQYdNr3fJJ+5aQ3zUsDH/81y+r3HtJ5cw VNYTM+9B9gbq2PP+7vY1Vk8/Kmom4aA/A+j0uwFIPK2QeCIYeo2ZGNq1+SwLSL63cN8Q Mslg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z5oWSDwS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p12-20020a05622a13cc00b002ebde465d0dsi2133005qtk.664.2022.04.22.03.48.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z5oWSDwS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqpW-0002bG-3E for patch@linaro.org; Fri, 22 Apr 2022 06:48:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA4-00050X-QL for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:12 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA2-0002rc-BG for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:12 -0400 Received: by mail-wm1-x335.google.com with SMTP id r19so4805549wmq.0 for ; Fri, 22 Apr 2022 03:05:09 -0700 (PDT) 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=Ndm3t5N4OR0qFLpk2c9QhA+QCMSP9KicMr+q+FQ7Er8=; b=Z5oWSDwSdklSKXP6VScla6be5zMXhMm42x35OwYLCFM/HGc6K6oddzLkbwLhiwDJN6 odm0y1e0avNrsTDN3LEYIipBi80j5X6ZU3khjW06s3GUpude2/dvO245EpBJ6Z2IUMGt cfLdqxiFys4Uxliq4ZJT2sj2PQe6aY5AYchDpw3kfDXZw1AL9erXPmFtqEO42N9TCccO MMA6+Hulsrf1QRefdDKL/RMlGw1NT0NcnkJ/7IrA18okSw4HU01v+EYwiBsaQhElTLiU 9RpImDBsOnQg/nWV8//62vPl5z8gaO6hg/4DpSjwlsnZXHycaGndWtoJPhbhGtOotqiT xUaA== 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=Ndm3t5N4OR0qFLpk2c9QhA+QCMSP9KicMr+q+FQ7Er8=; b=mJpSPcYIbEQNRSXViEN1p1RLPdDklahnlGpGvPCgXu3EoVX+Yhrgu5cHLKnX8GsKfx 9vdZpt7TSK1gC/yPuorfr0t2MlRApa38Cf+13aykvxtIauznVB4taoLk2KwurceO/k+H D3O9RIPCQp2XuU316CEHEuO1Hp4vcuqzYrKYdwmFdlnXa8fR1kVaqWpnmMxdVrf0wo1A tf1QF0UQSr0ePRjU4bUpXxfZ+Pb1kSarKfIFieGp36HVYdSJ4yS2+KOgOQ4ASA5Ur9Zy +X7RY3R7lCS5tl5EpOUdmlYVJTvTJ6bezNPnIj8C70QYzDv8ULRKWlKGS2BwWTqarUZk kXZg== X-Gm-Message-State: AOAM533HsMfJK1MQzMMzYLnROW7p+wg6f3D2F5vIwvPF68+4uUVX3lg7 yNYICU8+znbymkANkvzL5yka93SDjHHDzQ== X-Received: by 2002:a7b:c5cd:0:b0:38c:8b1b:d220 with SMTP id n13-20020a7bc5cd000000b0038c8b1bd220mr3398281wmk.118.1650621908963; Fri, 22 Apr 2022 03:05:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/61] hw/intc/arm_gicv3: Update ID and feature registers for GICv4 Date: Fri, 22 Apr 2022 11:04:08 +0100 Message-Id: <20220422100432.2288247-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update the various GIC ID and feature registers for GICv4: * PIDR2 [7:4] is the GIC architecture revision * GICD_TYPER.DVIS is 1 to indicate direct vLPI injection support * GICR_TYPER.VLPIS is 1 to indicate redistributor support for vLPIs * GITS_TYPER.VIRTUAL is 1 to indicate vLPI support * GITS_TYPER.VMOVP is 1 to indicate that our VMOVP implementation handles cross-ITS synchronization for the guest * ICH_VTR_EL2.nV4 is 0 to indicate direct vLPI injection support Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-38-peter.maydell@linaro.org --- hw/intc/gicv3_internal.h | 15 +++++++++++---- hw/intc/arm_gicv3_common.c | 7 +++++-- hw/intc/arm_gicv3_cpuif.c | 6 +++++- hw/intc/arm_gicv3_dist.c | 7 ++++--- hw/intc/arm_gicv3_its.c | 7 ++++++- hw/intc/arm_gicv3_redist.c | 2 +- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/hw/intc/gicv3_internal.h b/hw/intc/gicv3_internal.h index 07644b2be6f..0bf68452395 100644 --- a/hw/intc/gicv3_internal.h +++ b/hw/intc/gicv3_internal.h @@ -309,6 +309,7 @@ FIELD(GITS_TYPER, SEIS, 18, 1) FIELD(GITS_TYPER, PTA, 19, 1) FIELD(GITS_TYPER, CIDBITS, 32, 4) FIELD(GITS_TYPER, CIL, 36, 1) +FIELD(GITS_TYPER, VMOVP, 37, 1) #define GITS_IDREGS 0xFFD0 @@ -747,23 +748,29 @@ static inline uint32_t gicv3_iidr(void) #define GICV3_PIDR0_REDIST 0x93 #define GICV3_PIDR0_ITS 0x94 -static inline uint32_t gicv3_idreg(int regoffset, uint8_t pidr0) +static inline uint32_t gicv3_idreg(GICv3State *s, int regoffset, uint8_t pidr0) { /* Return the value of the CoreSight ID register at the specified * offset from the first ID register (as found in the distributor * and redistributor register banks). - * These values indicate an ARM implementation of a GICv3. + * These values indicate an ARM implementation of a GICv3 or v4. */ static const uint8_t gicd_ids[] = { - 0x44, 0x00, 0x00, 0x00, 0x92, 0xB4, 0x3B, 0x00, 0x0D, 0xF0, 0x05, 0xB1 + 0x44, 0x00, 0x00, 0x00, 0x92, 0xB4, 0x0B, 0x00, 0x0D, 0xF0, 0x05, 0xB1 }; + uint32_t id; regoffset /= 4; if (regoffset == 4) { return pidr0; } - return gicd_ids[regoffset]; + id = gicd_ids[regoffset]; + if (regoffset == 6) { + /* PIDR2 bits [7:4] are the GIC architecture revision */ + id |= s->revision << 4; + } + return id; } /** diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 3f47b3501fe..181f342f32c 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -406,8 +406,8 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) * Last == 1 if this is the last redistributor in a series of * contiguous redistributor pages * DirectLPI == 0 (direct injection of LPIs not supported) - * VLPIS == 0 (virtual LPIs not supported) - * PLPIS == 0 (physical LPIs not supported) + * VLPIS == 1 if vLPIs supported (GICv4 and up) + * PLPIS == 1 if LPIs supported */ cpu_affid = object_property_get_uint(OBJECT(cpu), "mp-affinity", NULL); @@ -422,6 +422,9 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) if (s->lpi_enable) { s->cpu[i].gicr_typer |= GICR_TYPER_PLPIS; + if (s->revision > 3) { + s->cpu[i].gicr_typer |= GICR_TYPER_VLPIS; + } } } diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index d627ddac90f..8404f46ee0b 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -2578,11 +2578,15 @@ static uint64_t ich_vtr_read(CPUARMState *env, const ARMCPRegInfo *ri) uint64_t value; value = ((cs->num_list_regs - 1) << ICH_VTR_EL2_LISTREGS_SHIFT) - | ICH_VTR_EL2_TDS | ICH_VTR_EL2_NV4 | ICH_VTR_EL2_A3V + | ICH_VTR_EL2_TDS | ICH_VTR_EL2_A3V | (1 << ICH_VTR_EL2_IDBITS_SHIFT) | ((cs->vprebits - 1) << ICH_VTR_EL2_PREBITS_SHIFT) | ((cs->vpribits - 1) << ICH_VTR_EL2_PRIBITS_SHIFT); + if (cs->gic->revision < 4) { + value |= ICH_VTR_EL2_NV4; + } + trace_gicv3_ich_vtr_read(gicv3_redist_affid(cs), value); return value; } diff --git a/hw/intc/arm_gicv3_dist.c b/hw/intc/arm_gicv3_dist.c index 7f6275363ea..b9ed955e36b 100644 --- a/hw/intc/arm_gicv3_dist.c +++ b/hw/intc/arm_gicv3_dist.c @@ -383,7 +383,7 @@ static bool gicd_readl(GICv3State *s, hwaddr offset, * No1N == 1 (1-of-N SPI interrupts not supported) * A3V == 1 (non-zero values of Affinity level 3 supported) * IDbits == 0xf (we support 16-bit interrupt identifiers) - * DVIS == 0 (Direct virtual LPI injection not supported) + * DVIS == 1 (Direct virtual LPI injection supported) if GICv4 * LPIS == 1 (LPIs are supported if affinity routing is enabled) * num_LPIs == 0b00000 (bits [15:11],Number of LPIs as indicated * by GICD_TYPER.IDbits) @@ -399,8 +399,9 @@ static bool gicd_readl(GICv3State *s, hwaddr offset, * so we only need to check the DS bit. */ bool sec_extn = !(s->gicd_ctlr & GICD_CTLR_DS); + bool dvis = s->revision >= 4; - *data = (1 << 25) | (1 << 24) | (sec_extn << 10) | + *data = (1 << 25) | (1 << 24) | (dvis << 18) | (sec_extn << 10) | (s->lpi_enable << GICD_TYPER_LPIS_SHIFT) | (0xf << 19) | itlinesnumber; return true; @@ -557,7 +558,7 @@ static bool gicd_readl(GICv3State *s, hwaddr offset, } case GICD_IDREGS ... GICD_IDREGS + 0x2f: /* ID registers */ - *data = gicv3_idreg(offset - GICD_IDREGS, GICV3_PIDR0_DIST); + *data = gicv3_idreg(s, offset - GICD_IDREGS, GICV3_PIDR0_DIST); return true; case GICD_SGIR: /* WO registers, return unknown value */ diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 0670aca4d46..2ff21ed6bbe 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -1699,7 +1699,7 @@ static bool its_readl(GICv3ITSState *s, hwaddr offset, break; case GITS_IDREGS ... GITS_IDREGS + 0x2f: /* ID registers */ - *data = gicv3_idreg(offset - GITS_IDREGS, GICV3_PIDR0_ITS); + *data = gicv3_idreg(s->gicv3, offset - GITS_IDREGS, GICV3_PIDR0_ITS); break; case GITS_TYPER: *data = extract64(s->typer, 0, 32); @@ -1946,6 +1946,11 @@ static void gicv3_arm_its_realize(DeviceState *dev, Error **errp) s->typer = FIELD_DP64(s->typer, GITS_TYPER, DEVBITS, ITS_DEVBITS); s->typer = FIELD_DP64(s->typer, GITS_TYPER, CIL, 1); s->typer = FIELD_DP64(s->typer, GITS_TYPER, CIDBITS, ITS_CIDBITS); + if (s->gicv3->revision >= 4) { + /* Our VMOVP handles cross-ITS synchronization itself */ + s->typer = FIELD_DP64(s->typer, GITS_TYPER, VMOVP, 1); + s->typer = FIELD_DP64(s->typer, GITS_TYPER, VIRTUAL, 1); + } } static void gicv3_its_reset(DeviceState *dev) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index bcb54bef76e..c3d4cdd66b7 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -441,7 +441,7 @@ static MemTxResult gicr_readl(GICv3CPUState *cs, hwaddr offset, *data = cs->gicr_nsacr; return MEMTX_OK; case GICR_IDREGS ... GICR_IDREGS + 0x2f: - *data = gicv3_idreg(offset - GICR_IDREGS, GICV3_PIDR0_REDIST); + *data = gicv3_idreg(cs->gic, offset - GICR_IDREGS, GICV3_PIDR0_REDIST); return MEMTX_OK; /* * VLPI frame registers. We don't need a version check for From patchwork Fri Apr 22 10:04:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564806 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp353375map; Fri, 22 Apr 2022 03:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWWRAZWD8Akru+tsCIRhnhi+haEI35M4evhKtYe88WYUVyPD0P6e4qLBNqPQnURPBRqNmt X-Received: by 2002:a05:620a:6db:b0:69e:84e3:5059 with SMTP id 27-20020a05620a06db00b0069e84e35059mr2140034qky.709.1650624811718; Fri, 22 Apr 2022 03:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624811; cv=none; d=google.com; s=arc-20160816; b=Rvv1W0cSU5J/ZsZoP26gNSO5Ez6N8XdtzI8Cztzp5tAzXJmNHZuPMpZNnwfYO93+9x +tseiEBLJV0TEXy4dWii3YCWiEzBxfLA1iWh7FbDjKIyNAvfFHa4MPuDR8iqxT/e6Iui 4FStlNLN49eIX3N1HsidGFfjCIITi9I9slcyJf8OZNyopl39Hl/nM/zrIVFunyvmseL/ ZMLujG96/0beeAcNCW0L+5Ku+XT3yy4OQPmWBLXG95O+PSgAsvyYp7Bzcr5cinOxLPHS p9mxBqHVEvL6PUI/0SW/nvuhrS3u+WUAVykdrpblLlxMNAGptLKuY6vas9wJc5Vyve9o /kKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=nwR0F+kQpRh5ysY0hrWi1Qr5NGs5AixMK7L0vpka4Arq2BF/5IRONForXlxo7qIoN1 +BZEO2E4iWPVMlr489AuGXeBdmChRQBe8HRlYKNiw+z5dff8QhNmDtWT58FQLjUJtGxr Yr/9VAOyizwCC5tLs+YHJiZgghd4Rw87i+V4PCy2FOFsHFFMqEl5lVaFFcbUFui2M/Rk vcmcw5M+JF+96mVNb1V1Pth5bzEqurhav7RoK3brU2tYCDCIEgav64T8FMaNK2jkTu0v Q0GIGaFDgxvnVfIWcRZizQZyUEZv1yrtarXArSCI7iNBPIlEEOpu1fSC7Tv24rc2FFis WGGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0KuIr0e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o11-20020a0562140e4b00b004466c300c0fsi2124578qvc.396.2022.04.22.03.53.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z0KuIr0e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqup-0000qp-59 for patch@linaro.org; Fri, 22 Apr 2022 06:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA4-00050s-UM for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:13 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:36815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA3-0002ru-7Y for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:12 -0400 Received: by mail-wm1-x335.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso7631626wml.1 for ; Fri, 22 Apr 2022 03:05:10 -0700 (PDT) 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=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=Z0KuIr0eLj+gAGyOmHaDaqJWTv4aAbxESISDcj83njDvBGh6uK1E0vY68ae2lPjFlg VPvp5lJsGQngVguRBLq7PbVh6h2lyP7Fdiy1HXvMnVw5IRo1qFxTqqHJ+N+uWNCQFOYE 4AQ9ggBA6hIyM/JZeKG2Ot1OEwg4qL1t3aJV7d1d0YWJF74AGa68QYOcGHehtdsnWesC cTNtSW4Q01l6Bq7Pj/BFfxhfGR5hXmxPaJb5DAvPsvKXXkGtPS0Hub+PH1gghe+Q85nF AQhd3+GKVV7PwTEZr8WsBidzgKjNmza8K70+0XHBvvlhaWonYMuXu/2iWDo9mlTLBR1v htlg== 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=JusjhwmCYsYrAoBkrOFAzh+RoRO01/bInTb0P5AYwvE=; b=JZESNXMiGyvVY5vIP1yVB97S5YwzKVW/A54Vb3sUjfTZ/qVf+9z9kK8icXQIoPDCAS EpHR/wqOkXs8qJiPF76tHpKNQlsp9bdNqzmrvnBcBnAI8sV0SMzbZ//we0UarOy2eosZ /TgvEXlqa+oC0svhyzsmStZs1PWRS/M5SRUzhAh7nUe/hHbaSJGz9d4HrkOppUSUcqtv 7b2nHa8lCSzhYQiSVlHfI5swgHCgvvKexhN26df1WME5F8Fk6f+ee5DMwshNuv+3zDZA UNCegNkxzt/JJkzDSxSV6uoLaVTX3FYpWCJyqKUaBiQF4W9yQ4FShb5Gq/Bqdk5qwqyr 9wLw== X-Gm-Message-State: AOAM532+WcBA7Db4yXWITeW4/L/Oajc3q441pgtGw/k3u+MnNl2f/xkG oSSpFIYx5Nf2qUo3sQ2fT7tZgudHuGD/tg== X-Received: by 2002:a05:600c:3785:b0:38e:bca8:f0c1 with SMTP id o5-20020a05600c378500b0038ebca8f0c1mr12346874wmr.56.1650621909744; Fri, 22 Apr 2022 03:05:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 38/61] hw/intc/arm_gicv3: Allow 'revision' property to be set to 4 Date: Fri, 22 Apr 2022 11:04:09 +0100 Message-Id: <20220422100432.2288247-39-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now that we have implemented all the GICv4 requirements, relax the error-checking on the GIC object's 'revision' property to allow a TCG GIC to be a GICv4, whilst still constraining the KVM GIC to GICv3. Our 'revision' property doesn't consider the possibility of wanting to specify the minor version of the GIC -- for instance there is a GICv3.1 which adds support for extended SPI and PPI ranges, among other things, and also GICv4.1. But since the QOM property is internal to QEMU, not user-facing, we can cross that bridge when we come to it. Within the GIC implementation itself code generally checks against the appropriate ID register feature bits, and the only use of s->revision is for setting those ID register bits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-39-peter.maydell@linaro.org --- hw/intc/arm_gicv3_common.c | 12 +++++++----- hw/intc/arm_gicv3_kvm.c | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 181f342f32c..5634c6fc788 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -326,12 +326,14 @@ static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) GICv3State *s = ARM_GICV3_COMMON(dev); int i, rdist_capacity, cpuidx; - /* revision property is actually reserved and currently used only in order - * to keep the interface compatible with GICv2 code, avoiding extra - * conditions. However, in future it could be used, for example, if we - * implement GICv4. + /* + * This GIC device supports only revisions 3 and 4. The GICv1/v2 + * is a separate device. + * Note that subclasses of this device may impose further restrictions + * on the GIC revision: notably, the in-kernel KVM GIC doesn't + * support GICv4. */ - if (s->revision != 3) { + if (s->revision != 3 && s->revision != 4) { error_setg(errp, "unsupported GIC revision %d", s->revision); return; } diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 5ec5ff9ef6e..06f5aceee52 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -781,6 +781,11 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp) return; } + if (s->revision != 3) { + error_setg(errp, "unsupported GIC revision %d for in-kernel GIC", + s->revision); + } + if (s->security_extn) { error_setg(errp, "the in-kernel VGICv3 does not implement the " "security extensions"); From patchwork Fri Apr 22 10:04:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564809 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp355795map; Fri, 22 Apr 2022 03:57:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvadv7AXjR7Xa+Euf+z450bafki+5xorxfcb4y2SxeNTrpcYoFKOwbH2a8ARFqGzsuRMJi X-Received: by 2002:a05:6214:2aaf:b0:446:70be:8377 with SMTP id js15-20020a0562142aaf00b0044670be8377mr2846387qvb.105.1650625056119; Fri, 22 Apr 2022 03:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625056; cv=none; d=google.com; s=arc-20160816; b=gnO2lQdpVWUkBQmjhvkn4Tkr1uKCTnPiZc0260LcJlj8x733wTEIlNRnOsmJhg2gFb 0SL9giksNSWphpIfS/VEAc94XXGnOuFJtQSyXoFszzGKvNzf3QpOIYGOJo8WHME8Pjx2 lCpIlOFXGeYivMvBn/jVgb4ypyYjGoOQsoD8SYcmoy8i8XgHOsSxRgd9j/aLGaVtgpht 9yAzi7iwuBqqaOjf0KSSAeDstmQAdaaLgDj1B0uuas/NPpkQcPaiCeFPOFvT+j8I5V1S LK4zdPn7aPBXfXCM0okCj0YBpOl8JnKLYakbgocXDAIqfYBtyBglHYxr0iNkWHoZmaPZ AZoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ppb9q2JdzKJCAX+yRCeZ8lM7X4SqlcHbmDsxajJSFyc=; b=DgxcSnBQ3IqqBaz/LgUTHegJYo6d3YqJLO2HLTbEFXygDoB4JdmiPxDl0REzhOMIpI Eha+rSxLl3ETEgIajHng+x2oU5HPHlzKmAG1EtIlewtE+gFWTwrTpAlOFdNaCw6QeVfU 2duOdQBMbtIZYDoEX1jC2Ya/Iz5KbP7QignxDsqqL5x7YGIktoMY/GsDP8g93u2oYkNl 85pr6iikMKJ6jQ5LSqeMwhrFi1cTxt63h60DqvoZ6JDrT5WWnxAegTID9eILDWQKgOoD v9NAapJqTLrNJdDqcJzuMOnsfeoqsWRHpLnkIoia+/UshHW+NZAh+vJWW7orkhXP7aCC CU0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7PdLcKj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m15-20020a0562141bcf00b00453b38bd86dsi177476qvc.301.2022.04.22.03.57.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s7PdLcKj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqyl-0007pg-MK for patch@linaro.org; Fri, 22 Apr 2022 06:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA5-000524-Mo for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:14 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:46593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA3-0002s7-UC for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:13 -0400 Received: by mail-wr1-x436.google.com with SMTP id h25so4284450wrc.13 for ; Fri, 22 Apr 2022 03:05:11 -0700 (PDT) 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=ppb9q2JdzKJCAX+yRCeZ8lM7X4SqlcHbmDsxajJSFyc=; b=s7PdLcKjTNz1AkMbEHtcT0M4CDCfvXob/oxUbEsA9v/Wx6bT8s7+w7DIqx9BjCIRVD FMIC0GNI2IJyBnd6VWBloWMEnZ85NR29HvuOjfWYpBPIVBS48eCgdxx9gIPq7r/aA6LN SaEqMWRc8VjDgqBp+qT2lv5PRilXvjknI0tNXH1/ZMiNhBkaRNZmjgpiFU+n//IZap3M XWRAP2SxwsoeUCIbuyFx8utr7kY+CAKcba26dFA4L8srzvtkgmtGI4aAAgvRd+MoXI8B +nIxcCBGWtZPf7r0LW4XcQj/hXQjfeId7Gzv41c/qusMr3SFt1mWHj95hngfMXUJe1e/ mqjg== 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=ppb9q2JdzKJCAX+yRCeZ8lM7X4SqlcHbmDsxajJSFyc=; b=H8sI4fUxpi1IJrJR39prP03YvXk8YVTu93sbua5DcOnn9mf2HPGr1RV/jxvv1UgStG 2WYxbdEmC0Gzzjgyk+UUGMXeVD9vv2z+B5QTCuQKrMMGeaWNI57KwZLUgr0q7CVS/fes KomyJKC7zte97Z8vR5N679Nm7LDgGHTXnBBlo7mlvQh7u70KzZY+VG05XQwrSkVZmW7i mhgqOKv7CPSuAie/2H3RFRWpdY2Cg0Wp+mK99AOC9aqT9wa26bsHEFVxs4ypC4Aets+x a9ga0ehkjhVj/wVo4noW9LIcGuQ620wBNOIJSDMPlI+OZxOvf2Y83bzrGeIzvXPC0BcP n6OQ== X-Gm-Message-State: AOAM533SOBdABaK1bMhT33M5fdDaBOJRCIK0n1C6OYWj5NVDyubcA0b+ hUY3W1DkHI0s+d3m1vhpeI3kHC7aK8obUA== X-Received: by 2002:a5d:4b45:0:b0:207:ab91:edd8 with SMTP id w5-20020a5d4b45000000b00207ab91edd8mr3100939wrs.168.1650621910662; Fri, 22 Apr 2022 03:05:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 39/61] hw/arm/virt: Use VIRT_GIC_VERSION_* enum values in create_gic() Date: Fri, 22 Apr 2022 11:04:10 +0100 Message-Id: <20220422100432.2288247-40-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Everywhere we need to check which GIC version we're using, we look at vms->gic_version and use the VIRT_GIC_VERSION_* enum values, except in create_gic(), which copies vms->gic_version into a local 'int' variable and makes direct comparisons against values 2 and 3. For consistency, change this function to check the GIC version the same way we do elsewhere. This includes not implicitly relying on the enumeration type values happening to match the integer 'revision' values the GIC device object wants. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-40-peter.maydell@linaro.org --- hw/arm/virt.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index bb6a2484d81..d5f8b0c74ad 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -690,14 +690,29 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) /* We create a standalone GIC */ SysBusDevice *gicbusdev; const char *gictype; - int type = vms->gic_version, i; + int i; unsigned int smp_cpus = ms->smp.cpus; uint32_t nb_redist_regions = 0; + int revision; - gictype = (type == 3) ? gicv3_class_name() : gic_class_name(); + if (vms->gic_version == VIRT_GIC_VERSION_2) { + gictype = gic_class_name(); + } else { + gictype = gicv3_class_name(); + } + switch (vms->gic_version) { + case VIRT_GIC_VERSION_2: + revision = 2; + break; + case VIRT_GIC_VERSION_3: + revision = 3; + break; + default: + g_assert_not_reached(); + } vms->gic = qdev_new(gictype); - qdev_prop_set_uint32(vms->gic, "revision", type); + qdev_prop_set_uint32(vms->gic, "revision", revision); qdev_prop_set_uint32(vms->gic, "num-cpu", smp_cpus); /* Note that the num-irq property counts both internal and external * interrupts; there are always 32 of the former (mandated by GIC spec). @@ -707,7 +722,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) qdev_prop_set_bit(vms->gic, "has-security-extensions", vms->secure); } - if (type == 3) { + if (vms->gic_version == VIRT_GIC_VERSION_3) { uint32_t redist0_capacity = vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; uint32_t redist0_count = MIN(smp_cpus, redist0_capacity); @@ -742,7 +757,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) gicbusdev = SYS_BUS_DEVICE(vms->gic); sysbus_realize_and_unref(gicbusdev, &error_fatal); sysbus_mmio_map(gicbusdev, 0, vms->memmap[VIRT_GIC_DIST].base); - if (type == 3) { + if (vms->gic_version == VIRT_GIC_VERSION_3) { sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_REDIST].base); if (nb_redist_regions == 2) { sysbus_mmio_map(gicbusdev, 2, @@ -780,7 +795,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) ppibase + timer_irq[irq])); } - if (type == 3) { + if (vms->gic_version == VIRT_GIC_VERSION_3) { qemu_irq irq = qdev_get_gpio_in(vms->gic, ppibase + ARCH_GIC_MAINT_IRQ); qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", @@ -806,9 +821,9 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) fdt_add_gic_node(vms); - if (type == 3 && vms->its) { + if (vms->gic_version == VIRT_GIC_VERSION_3 && vms->its) { create_its(vms); - } else if (type == 2) { + } else if (vms->gic_version == VIRT_GIC_VERSION_2) { create_v2m(vms); } } From patchwork Fri Apr 22 10:04:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564795 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp344753map; Fri, 22 Apr 2022 03:38:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyb66gbR56KXRQlUGaP+Uw0Sr3o2n02Lb3SyWlAe6QUgPqgCPqMZpFexMe5FL/poe6PkiM X-Received: by 2002:a05:622a:5c7:b0:2e1:d599:9e0d with SMTP id d7-20020a05622a05c700b002e1d5999e0dmr2560254qtb.491.1650623879946; Fri, 22 Apr 2022 03:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650623879; cv=none; d=google.com; s=arc-20160816; b=ulwOxkhGHqhIviEKEoel5nWT2k7m+Pz0Ujles5aC2acBb7LlFE2fPjVEQS4rYxafCP ExxBypR5ppaA8m/4t7smqUs/8rMAhtwTaFigUTvuKeqOVo53Q0rRljwj09OPFbM3ESTn 3hDnk5Skkbv7TU1MdyIaO8PGal6QoRtI8clV4wc3t80rXaAuYxGQmW7piNtYTCxw9O4E uo2vTGzd/9GPagM42SQida9He0X6OHUBJ4At4VdhPfK9AtWpybOeZ43Rfi/APGZmec69 iI3Tq0TgHVexJjHo0DHFcNmYOpJOApaaXMBbl38poPO0rymKUl1rt44lW80ZtTSnZyKJ aJ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dD0gXSrq4cJBnHFPk7NEn42McsBj8OdsQUpLVwThouk=; b=lVZkSyUZ/JgwjIegCfBF+HClUWdYd3waGBYclCsqWbAL51ESPVESLb48sXThKd058N WQwrwXt49q83ZaWLdSt/1T1E0K3AKI9r2suORMxRXVKRN5N0H6xkgoHWKx8M+I21YICu K53bV5jDMnLAAf/P6gIGmQ7eC4G/d/DjZ3K/h53MxrxRjF4T5CNk+yQdtJhL3TNO7V1Q RKZXoqfDIg7aBCZwUk6N5PnNGdQ0ZsfLFVx59l+FnUv5oNTaTNEFiIYcWQKAAwT3JD6R KDHKrcERqnL0OygudIrOUBj7V0fd17OoRtdt7atC4KwzszrD8e9g/IgE1iVHUpq/LQHy 9BvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QbSVKU/4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x18-20020ae9e912000000b0069c58379b72si1990619qkf.40.2022.04.22.03.37.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:37:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QbSVKU/4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqfn-0005Ua-Fx for patch@linaro.org; Fri, 22 Apr 2022 06:37:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA6-00052z-Em for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:14 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:43570) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA4-0002sM-RJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:14 -0400 Received: by mail-wm1-x334.google.com with SMTP id n40-20020a05600c3ba800b0038ff1939b16so5090810wms.2 for ; Fri, 22 Apr 2022 03:05:12 -0700 (PDT) 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=dD0gXSrq4cJBnHFPk7NEn42McsBj8OdsQUpLVwThouk=; b=QbSVKU/4WObnW0UWA/uBBMRWjKeeJxeENJOy9OkRDkxrg8I2zZWSeks14ajMpoNWKP HbHEtgGjfkKNsl5PQQKeqXCzPGGtuLxXNYiBEh70b/GQwfXRFTDRylQSa8O3/wfF5VmZ uUK7qdYOaFoXoxCBXtyaOVKDQQE0UryRonII/eZrn6UoH3b/h0apz2eleimS0CmFhpJX Vq96P+Eg0MXLEZ5FqPEHCXvHCn1wLjVM4+6nxNjtrcKCqrD3YftJsnTXy+YkZk9y7KH7 7LR1xRCgXCvf85/C3j3I2hodjPhlXCXoYibbA6e4+5aQSt5ocNY/9aDgotgVuMcT0Qh0 lSCg== 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=dD0gXSrq4cJBnHFPk7NEn42McsBj8OdsQUpLVwThouk=; b=bs8MKNO5n0b2ls0Lth05V2C1itLgFgabxRTIKDsjKnfxhfYRYZKiiy+rYFonMyBL16 JSa/zP2QVLVxkrZgF32qmyTl9noAdfd0tlCEIb5ETvUq0HNcfNr9ti6CVLSdiS+KlRLP W/NtryN1DvEve0NTPKMpQPoaVtYDCVJUwqDg3e6yXNt7iZhkFz/cyqjOHL6pW8jzWNbs 6DxmSVUOsXOw2a1vCmCZ6Jf2KeAS3WQ+uuaVSpjm1kyMqMAJgC6DVrOfloQtU1n2EyYT 7bPXd4t1ZOoHXkwN5K20B0bq2TOCC5TahLiITGlSEhPZ3N7I03rFrpcpTBnqSHzHworC oWUw== X-Gm-Message-State: AOAM532c23h0OYt/Mm9Z83v0K4vDzwAV3zjErjapspBfqWZmAhhrnQBG XFZrVSRaPGhtYWa/w5kDGldHoMhbGEIF1g== X-Received: by 2002:a05:600c:4e12:b0:391:18da:1883 with SMTP id b18-20020a05600c4e1200b0039118da1883mr3443054wmq.101.1650621911529; Fri, 22 Apr 2022 03:05:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 40/61] hw/arm/virt: Abstract out calculation of redistributor region capacity Date: Fri, 22 Apr 2022 11:04:11 +0100 Message-Id: <20220422100432.2288247-41-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" In several places in virt.c we calculate the number of redistributors that fit in a region of our memory map, which is the size of the region divided by the size of a single redistributor frame. For GICv4, the redistributor frame is a different size from that for GICv3. Abstract out the calculation of redistributor region capacity so that we have one place we need to change to handle GICv4 rather than several. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-41-peter.maydell@linaro.org --- include/hw/arm/virt.h | 9 +++++++-- hw/arm/virt.c | 11 ++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 7e76ee26198..360463e6bfb 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -185,11 +185,16 @@ OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE) void virt_acpi_setup(VirtMachineState *vms); bool virt_is_acpi_enabled(VirtMachineState *vms); +/* Return number of redistributors that fit in the specified region */ +static uint32_t virt_redist_capacity(VirtMachineState *vms, int region) +{ + return vms->memmap[region].size / GICV3_REDIST_SIZE; +} + /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) { - uint32_t redist0_capacity = - vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; + uint32_t redist0_capacity = virt_redist_capacity(vms, VIRT_GIC_REDIST); assert(vms->gic_version == VIRT_GIC_VERSION_3); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d5f8b0c74ad..1227c64e5b1 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -723,8 +723,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) } if (vms->gic_version == VIRT_GIC_VERSION_3) { - uint32_t redist0_capacity = - vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; + uint32_t redist0_capacity = virt_redist_capacity(vms, VIRT_GIC_REDIST); uint32_t redist0_count = MIN(smp_cpus, redist0_capacity); nb_redist_regions = virt_gicv3_redist_region_count(vms); @@ -743,7 +742,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) if (nb_redist_regions == 2) { uint32_t redist1_capacity = - vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; + virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2); qdev_prop_set_uint32(vms->gic, "redist-region-count[1]", MIN(smp_cpus - redist0_count, redist1_capacity)); @@ -2048,10 +2047,8 @@ static void machvirt_init(MachineState *machine) * many redistributors we can fit into the memory map. */ if (vms->gic_version == VIRT_GIC_VERSION_3) { - virt_max_cpus = - vms->memmap[VIRT_GIC_REDIST].size / GICV3_REDIST_SIZE; - virt_max_cpus += - vms->memmap[VIRT_HIGH_GIC_REDIST2].size / GICV3_REDIST_SIZE; + virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST) + + virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2); } else { virt_max_cpus = GIC_NCPU; } From patchwork Fri Apr 22 10:04:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564814 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp357978map; Fri, 22 Apr 2022 04:01:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCwCO1z0NnAODdbAqVXu3TLHuFa3ein1EAtzdnIe0p84WLtqygKxSn50Fi67GEyuIgxqq1 X-Received: by 2002:ad4:5943:0:b0:446:5c3e:2c2a with SMTP id eo3-20020ad45943000000b004465c3e2c2amr2797518qvb.75.1650625271755; Fri, 22 Apr 2022 04:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625271; cv=none; d=google.com; s=arc-20160816; b=JlF/pcQnkmmpQIOVyQ6TPIrQQ02KSZre/nw9JqUZ0XTgR0qEvkV8qIp0mLaiiM0Fmu /YPzGeBxArIv0916oiLPnrQwg9LWESxqyomgdcvl61l3TXJfp2dJaZAXySXjjQ9cL2oM qkUn1mPdhKHnZp5UsfIi/ICkL03pnLVIeKLl8CCBYB/B4qP6RgUl0bol6wiVRiEqLXyu r/vCmre4Laib9XONMZs94Ci88GPxMGzBTER7Cch2XQ0tj2J/gs/nopPF7+W3GyhgDqnv 8S7uL0ZpzfNJZJgztA5uKVeeqLhOYh9BAQD5uuYRbTYAHHtMdttWIZvkgc63L4irQbMi REQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lqt/sr/PjNxjy/2aE/5Huf/D94yrcwPJG4y/I0I31vg=; b=KJpDW1Wf9OyQJ9d9chdggG48WggJtI5xQsaL71A8wXtWBJPQfL0Tq3FlWHn/Vbu5Di TDjar3oM2LHoBwch3UkMyEIMFPZ13BP6e57g2jUg7PrDudll51U1Ts1cIDCGYZs7pqYp B5YCLoLnrvPeGDLaLTObdAkspO9Dd6diAClGnl0aoEdRCw/4W7ChewLB2FkBAUfJSKjP REq1gwXVhmqKI9Pd7x4+Ygk8wIX10CFLYLRj+SoSOAB+Gl752nb+0lHf2ds5AMgCXrzj /vPDlPkZi6+H7yr2Cg/QWjoaacoJCCOx/Ek+swUT1W0kkaSYoZ8m6zioF4L8yrg+9Y7N WMYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbQxBnFj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m6-20020ad45dc6000000b004463873fd1dsi2126910qvh.503.2022.04.22.04.01.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:01:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbQxBnFj; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr2F-0007eD-5S for patch@linaro.org; Fri, 22 Apr 2022 07:01:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAI-0005Zs-Tb for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA6-0002sf-9U for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:26 -0400 Received: by mail-wr1-x431.google.com with SMTP id k22so10331301wrd.2 for ; Fri, 22 Apr 2022 03:05:13 -0700 (PDT) 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=lqt/sr/PjNxjy/2aE/5Huf/D94yrcwPJG4y/I0I31vg=; b=wbQxBnFj//moBjII3HKwJ4wKRJ5ZjWfJYf5cuwSr/L6pLqXd61atVEuUoZG6NAjJTN 2GTCukXWLC1vRmuPP5AGcqPR+CpbFSQLLlUHjN9Y5+LsT2e/zxjShdofaevBsSORWay7 TS1W3jUKiQBGmSJK7CBVnh7+hGhT4lDiKuI0PvkPPOh+vGK/pgyLogwiQC0RdK3V9+JG +UG8EmA35dq6F3haJRVpF9zuZNKYDSt7MSvciblSuTW1O88SnWInyeUoN++nYF5cHkB0 bnKcmoW9qrxUUZ8xiZ7udxT8lc5Guc1xuF48nf5fUh+A8GDKE9ukTtj8J0DuQCOTQyys FAhg== 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=lqt/sr/PjNxjy/2aE/5Huf/D94yrcwPJG4y/I0I31vg=; b=wT/s4r2eAxMxlWT7dl5VclWimulAYLPkk/k6JJ6Qh62UnhVQwTp/rdMqjy1+X9EqxZ bxcMmPkgNxDggzrcmVQP168M1mtttpdzkf3l7A0CF+fAmxZoCxqO0q58WnaT3855Bbp2 4GbLU2ioLIfuwuIOFpp7dT17NAAc3kQMVIITbUjUoippiD2S8QjZvprWemwryoVfLQKP onOdEoax57kzjVOV7A6k350lXve9I7058P58QoZS29D81PZxzoqDa4YTAZPO1mP3gVvi 0HmOdSfOL6zdLUKWpViHZOtQ7ZcW30Df8QmNJVmFlZmWHGckjR/aYGUb6RhhTuOA6ZJl Gckg== X-Gm-Message-State: AOAM531O1R1Ddn5OGizNFjJsDJ1sbbZyt03lkPOudst14sGzuH9e8LEK p8wZXMPbgRqMMYQDTO0cUIH29BJb2XK1OA== X-Received: by 2002:a05:6000:18d:b0:20a:9e33:8e64 with SMTP id p13-20020a056000018d00b0020a9e338e64mr3042851wrx.123.1650621912669; Fri, 22 Apr 2022 03:05:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 41/61] hw/arm/virt: Support TCG GICv4 Date: Fri, 22 Apr 2022 11:04:12 +0100 Message-Id: <20220422100432.2288247-42-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add support for the TCG GICv4 to the virt board. For the board, the GICv4 is very similar to the GICv3, with the only difference being the size of the redistributor frame. The changes here are thus: * calculating virt_redist_capacity correctly for GICv4 * changing various places which were "if GICv3" to be "if not GICv2" * the commandline option handling Note that using GICv4 reduces the maximum possible number of CPUs on the virt board from 512 to 317, because we can now only fit half as many redistributors into the redistributor regions we have defined. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20220408141550.1271295-42-peter.maydell@linaro.org --- docs/system/arm/virt.rst | 5 ++- include/hw/arm/virt.h | 12 +++++-- hw/arm/virt.c | 70 ++++++++++++++++++++++++++++++---------- 3 files changed, 67 insertions(+), 20 deletions(-) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 1297dff5228..5fe045cbf06 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -99,11 +99,14 @@ gic-version GICv2. Note that this limits the number of CPUs to 8. ``3`` GICv3. This allows up to 512 CPUs. + ``4`` + GICv4. Requires ``virtualization`` to be ``on``; allows up to 317 CPUs. ``host`` Use the same GIC version the host provides, when using KVM ``max`` Use the best GIC version possible (same as host when using KVM; - currently same as ``3``` for TCG, but this may change in future) + with TCG this is currently ``3`` if ``virtualization`` is ``off`` and + ``4`` if ``virtualization`` is ``on``, but this may change in future) its Set ``on``/``off`` to enable/disable ITS instantiation. The default is ``on`` diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 360463e6bfb..15feabac63d 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -113,6 +113,7 @@ typedef enum VirtGICType { VIRT_GIC_VERSION_HOST, VIRT_GIC_VERSION_2, VIRT_GIC_VERSION_3, + VIRT_GIC_VERSION_4, VIRT_GIC_VERSION_NOSEL, } VirtGICType; @@ -188,7 +189,14 @@ bool virt_is_acpi_enabled(VirtMachineState *vms); /* Return number of redistributors that fit in the specified region */ static uint32_t virt_redist_capacity(VirtMachineState *vms, int region) { - return vms->memmap[region].size / GICV3_REDIST_SIZE; + uint32_t redist_size; + + if (vms->gic_version == VIRT_GIC_VERSION_3) { + redist_size = GICV3_REDIST_SIZE; + } else { + redist_size = GICV4_REDIST_SIZE; + } + return vms->memmap[region].size / redist_size; } /* Return the number of used redistributor regions */ @@ -196,7 +204,7 @@ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) { uint32_t redist0_capacity = virt_redist_capacity(vms, VIRT_GIC_REDIST); - assert(vms->gic_version == VIRT_GIC_VERSION_3); + assert(vms->gic_version != VIRT_GIC_VERSION_2); return (MACHINE(vms)->smp.cpus > redist0_capacity && vms->highmem_redists) ? 2 : 1; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 1227c64e5b1..5bdd98e4a1f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -522,7 +522,7 @@ static void fdt_add_gic_node(VirtMachineState *vms) qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 0x2); qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 0x2); qemu_fdt_setprop(ms->fdt, nodename, "ranges", NULL, 0); - if (vms->gic_version == VIRT_GIC_VERSION_3) { + if (vms->gic_version != VIRT_GIC_VERSION_2) { int nb_redist_regions = virt_gicv3_redist_region_count(vms); qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", @@ -708,6 +708,9 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) case VIRT_GIC_VERSION_3: revision = 3; break; + case VIRT_GIC_VERSION_4: + revision = 4; + break; default: g_assert_not_reached(); } @@ -722,7 +725,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) qdev_prop_set_bit(vms->gic, "has-security-extensions", vms->secure); } - if (vms->gic_version == VIRT_GIC_VERSION_3) { + if (vms->gic_version != VIRT_GIC_VERSION_2) { uint32_t redist0_capacity = virt_redist_capacity(vms, VIRT_GIC_REDIST); uint32_t redist0_count = MIN(smp_cpus, redist0_capacity); @@ -756,7 +759,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) gicbusdev = SYS_BUS_DEVICE(vms->gic); sysbus_realize_and_unref(gicbusdev, &error_fatal); sysbus_mmio_map(gicbusdev, 0, vms->memmap[VIRT_GIC_DIST].base); - if (vms->gic_version == VIRT_GIC_VERSION_3) { + if (vms->gic_version != VIRT_GIC_VERSION_2) { sysbus_mmio_map(gicbusdev, 1, vms->memmap[VIRT_GIC_REDIST].base); if (nb_redist_regions == 2) { sysbus_mmio_map(gicbusdev, 2, @@ -794,7 +797,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) ppibase + timer_irq[irq])); } - if (vms->gic_version == VIRT_GIC_VERSION_3) { + if (vms->gic_version != VIRT_GIC_VERSION_2) { qemu_irq irq = qdev_get_gpio_in(vms->gic, ppibase + ARCH_GIC_MAINT_IRQ); qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", @@ -820,7 +823,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) fdt_add_gic_node(vms); - if (vms->gic_version == VIRT_GIC_VERSION_3 && vms->its) { + if (vms->gic_version != VIRT_GIC_VERSION_2 && vms->its) { create_its(vms); } else if (vms->gic_version == VIRT_GIC_VERSION_2) { create_v2m(vms); @@ -1672,10 +1675,10 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx) * purposes are to make TCG consistent (with 64-bit KVM hosts) * and to improve SGI efficiency. */ - if (vms->gic_version == VIRT_GIC_VERSION_3) { - clustersz = GICV3_TARGETLIST_BITS; - } else { + if (vms->gic_version == VIRT_GIC_VERSION_2) { clustersz = GIC_TARGETLIST_BITS; + } else { + clustersz = GICV3_TARGETLIST_BITS; } } return arm_cpu_mp_affinity(idx, clustersz); @@ -1808,6 +1811,10 @@ static void finalize_gic_version(VirtMachineState *vms) error_report( "gic-version=3 is not supported with kernel-irqchip=off"); exit(1); + case VIRT_GIC_VERSION_4: + error_report( + "gic-version=4 is not supported with kernel-irqchip=off"); + exit(1); } } @@ -1845,6 +1852,9 @@ static void finalize_gic_version(VirtMachineState *vms) case VIRT_GIC_VERSION_2: case VIRT_GIC_VERSION_3: break; + case VIRT_GIC_VERSION_4: + error_report("gic-version=4 is not supported with KVM"); + exit(1); } /* Check chosen version is effectively supported by the host */ @@ -1868,7 +1878,12 @@ static void finalize_gic_version(VirtMachineState *vms) case VIRT_GIC_VERSION_MAX: if (module_object_class_by_name("arm-gicv3")) { /* CONFIG_ARM_GICV3_TCG was set */ - vms->gic_version = VIRT_GIC_VERSION_3; + if (vms->virt) { + /* GICv4 only makes sense if CPU has EL2 */ + vms->gic_version = VIRT_GIC_VERSION_4; + } else { + vms->gic_version = VIRT_GIC_VERSION_3; + } } else { vms->gic_version = VIRT_GIC_VERSION_2; } @@ -1876,6 +1891,12 @@ static void finalize_gic_version(VirtMachineState *vms) case VIRT_GIC_VERSION_HOST: error_report("gic-version=host requires KVM"); exit(1); + case VIRT_GIC_VERSION_4: + if (!vms->virt) { + error_report("gic-version=4 requires virtualization enabled"); + exit(1); + } + break; case VIRT_GIC_VERSION_2: case VIRT_GIC_VERSION_3: break; @@ -2043,14 +2064,16 @@ static void machvirt_init(MachineState *machine) vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC; } - /* The maximum number of CPUs depends on the GIC version, or on how - * many redistributors we can fit into the memory map. + /* + * The maximum number of CPUs depends on the GIC version, or on how + * many redistributors we can fit into the memory map (which in turn + * depends on whether this is a GICv3 or v4). */ - if (vms->gic_version == VIRT_GIC_VERSION_3) { + if (vms->gic_version == VIRT_GIC_VERSION_2) { + virt_max_cpus = GIC_NCPU; + } else { virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST) + virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2); - } else { - virt_max_cpus = GIC_NCPU; } if (max_cpus > virt_max_cpus) { @@ -2438,8 +2461,19 @@ static void virt_set_mte(Object *obj, bool value, Error **errp) static char *virt_get_gic_version(Object *obj, Error **errp) { VirtMachineState *vms = VIRT_MACHINE(obj); - const char *val = vms->gic_version == VIRT_GIC_VERSION_3 ? "3" : "2"; + const char *val; + switch (vms->gic_version) { + case VIRT_GIC_VERSION_4: + val = "4"; + break; + case VIRT_GIC_VERSION_3: + val = "3"; + break; + default: + val = "2"; + break; + } return g_strdup(val); } @@ -2447,7 +2481,9 @@ static void virt_set_gic_version(Object *obj, const char *value, Error **errp) { VirtMachineState *vms = VIRT_MACHINE(obj); - if (!strcmp(value, "3")) { + if (!strcmp(value, "4")) { + vms->gic_version = VIRT_GIC_VERSION_4; + } else if (!strcmp(value, "3")) { vms->gic_version = VIRT_GIC_VERSION_3; } else if (!strcmp(value, "2")) { vms->gic_version = VIRT_GIC_VERSION_2; @@ -2905,7 +2941,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) virt_set_gic_version); object_class_property_set_description(oc, "gic-version", "Set GIC version. " - "Valid values are 2, 3, host and max"); + "Valid values are 2, 3, 4, host and max"); object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu); object_class_property_set_description(oc, "iommu", From patchwork Fri Apr 22 10:04:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564799 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp348419map; Fri, 22 Apr 2022 03:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0ZBhDYeJfdJ0Rh8o4smzvAjgnxN1IB+opiEB+ukwsv7xYkAxvc6Rysah4BlrQHpzwMjY9 X-Received: by 2002:a05:6214:2b09:b0:446:7c3a:92c0 with SMTP id jx9-20020a0562142b0900b004467c3a92c0mr2726156qvb.87.1650624315967; Fri, 22 Apr 2022 03:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624315; cv=none; d=google.com; s=arc-20160816; b=g/vjTImBpBc6weqG7Sug4qY4hyxU3kDCK7Eh73HfZ92Y30exkV9bjkR/o0NacM3qlN Mrx3Y2VzE4D2fKbCKcHN24E+nRbVIFbV4BxjMqBcw0hwoxLYMKjG5dvO0QAhaKc59hqZ MjhXgiOVkf1kqYHYzpTpNLy8TloJKUJ2NcU0TjRNFoGKBPkqQzSHl2w9ymcFiKEr0rZ3 FiRtusWm5Cfe53DLnAw3RnUtKGh62/+bXIpNgYSfE19MB+LUIB1OT+SXdsrAP7VEzq3D hQ+0X5Kl8oYFuZx8ThkOFdegzxg9NRPepqmJqvfZki8xBsmElcze7wOplPpdrIuzGH+x zUNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c/OOC42uprblXlXB5QXrfAyFGH41UtdvfiTd3g5mfb4=; b=uOwXgmZIxLFH5mnCLOA+FA56iJ5G4c9xLaIuqJ63NeIMAoDnTcBDG7gAhhRrp5aYTt UW4pEfwy653zOpsFUgpkq/2Ln56zZi5Qa5FfByoUcv/B6Nn/ShwS0meP7UZBZVmM4OD7 GWmw0ripG4zp+oevDW+YjGb+G+6Ga95ltPpSgrJO0vrL280e7cNU8OEyuXMs4PpucDoa 25zh6ZYUYM5iYcO5FJR82JCg/ldxjxxlnUsdrQKf4MY919N3/IisggQIVqcfJm/IX8JI qpBqlEkhrbvd5pwbddwZqzMdOEAvvGddh6xmKNfgO48CqXgRZ378ahRe6PBSKqtloMxV PMVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IQHtHXqf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y1-20020a05620a44c100b0067e4be23858si2331461qkp.157.2022.04.22.03.45.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IQHtHXqf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqmp-0007Jy-Du for patch@linaro.org; Fri, 22 Apr 2022 06:45:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA9-00059F-JV for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:17 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:34690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA7-0002t5-RY for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:17 -0400 Received: by mail-wm1-x32f.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so4692208wmb.1 for ; Fri, 22 Apr 2022 03:05:15 -0700 (PDT) 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=c/OOC42uprblXlXB5QXrfAyFGH41UtdvfiTd3g5mfb4=; b=IQHtHXqfQefIJl5DmILOuHO6p/n5v/818cNo7tD+aOep1QMLWOvHR3fWSD74NkdjQh vQXLdP2qXQtEcKuHx+7OQy1acFQwKsz5FPIV6r0RS//4UHbcr5D84jwVtFgR3+hKq95w trK+eKrCY1KEShqFFsM/BEMHUsNtvsypTvu1tx8LFLGaiVDFzIk8LHs9aL8VVVdqIrIi ThQM4MzG9/7E3PJ3GfRDbFN6nQhrCZ2tTTVWu9fpOmCGWeCKIT0HJGTa1oSet+8VjOa5 V2mAplKIQztQBe9+fGJU0PQ6qUZrDpKvzVPdDDoAmX8c4S/b4DhEz3gt3SbgrwUNm33M 2jxg== 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=c/OOC42uprblXlXB5QXrfAyFGH41UtdvfiTd3g5mfb4=; b=juHjZ6LALZDajwZEfrXMYFZfm5oRiU0J8f94VHVyvTrjONZ11oc0V6i3QciHx1JW8M +t0E6tEQgO426c9aphOs4x9P903vdTqpqzeTL+2+Rm52qjuxqgb3QtbuuiL6p2XGxzqC t8pT0xUEPnJn2vbWgBL7wLUJ3KmZLnOMiRyuoKbubf5I2NfSvaMSCTlCC9k6m9vgZSTq SS8hsm0bXkXe5N4kU6RNDIcgGy070Hoc23F6wYqeLZC1gUVmwYbaVS0v/R4ehIMl7cAa bQEYxxYtJc1dcW/vXFhOIltoYSmc/QPqbXq4cmfbCBeKf+2VoT/eOyRZo0wOksprBw2B iL7A== X-Gm-Message-State: AOAM533h/6yQXYiRaUXXJ+qJ1e+yclT3OAsuapEzdz8npYcSAQDKGabU Yh96jaYgAMMQMjZdfyegsmfMtfe/DymAkg== X-Received: by 2002:a05:600c:1c15:b0:392:8c46:4fd4 with SMTP id j21-20020a05600c1c1500b003928c464fd4mr12248177wms.205.1650621913597; Fri, 22 Apr 2022 03:05:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 42/61] target/arm: Update ISAR fields for ARMv8.8 Date: Fri, 22 Apr 2022 11:04:13 +0100 Message-Id: <20220422100432.2288247-43-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Update isar fields per ARM DDI0487 H.a. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Peter Maydell --- target/arm/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cb5359a7470..564821eeded 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1934,6 +1934,7 @@ FIELD(ID_MMFR4, CCIDX, 24, 4) FIELD(ID_MMFR4, EVT, 28, 4) FIELD(ID_MMFR5, ETS, 0, 4) +FIELD(ID_MMFR5, NTLBPA, 4, 4) FIELD(ID_PFR0, STATE0, 0, 4) FIELD(ID_PFR0, STATE1, 4, 4) @@ -1986,6 +1987,16 @@ FIELD(ID_AA64ISAR1, SPECRES, 40, 4) FIELD(ID_AA64ISAR1, BF16, 44, 4) FIELD(ID_AA64ISAR1, DGH, 48, 4) FIELD(ID_AA64ISAR1, I8MM, 52, 4) +FIELD(ID_AA64ISAR1, XS, 56, 4) +FIELD(ID_AA64ISAR1, LS64, 60, 4) + +FIELD(ID_AA64ISAR2, WFXT, 0, 4) +FIELD(ID_AA64ISAR2, RPRES, 4, 4) +FIELD(ID_AA64ISAR2, GPA3, 8, 4) +FIELD(ID_AA64ISAR2, APA3, 12, 4) +FIELD(ID_AA64ISAR2, MOPS, 16, 4) +FIELD(ID_AA64ISAR2, BC, 20, 4) +FIELD(ID_AA64ISAR2, PAC_FRAC, 24, 4) FIELD(ID_AA64PFR0, EL0, 0, 4) FIELD(ID_AA64PFR0, EL1, 4, 4) @@ -2008,6 +2019,10 @@ FIELD(ID_AA64PFR1, SSBS, 4, 4) FIELD(ID_AA64PFR1, MTE, 8, 4) FIELD(ID_AA64PFR1, RAS_FRAC, 12, 4) FIELD(ID_AA64PFR1, MPAM_FRAC, 16, 4) +FIELD(ID_AA64PFR1, SME, 24, 4) +FIELD(ID_AA64PFR1, RNDR_TRAP, 28, 4) +FIELD(ID_AA64PFR1, CSV2_FRAC, 32, 4) +FIELD(ID_AA64PFR1, NMI, 36, 4) FIELD(ID_AA64MMFR0, PARANGE, 0, 4) FIELD(ID_AA64MMFR0, ASIDBITS, 4, 4) @@ -2034,6 +2049,11 @@ FIELD(ID_AA64MMFR1, SPECSEI, 24, 4) FIELD(ID_AA64MMFR1, XNX, 28, 4) FIELD(ID_AA64MMFR1, TWED, 32, 4) FIELD(ID_AA64MMFR1, ETS, 36, 4) +FIELD(ID_AA64MMFR1, HCX, 40, 4) +FIELD(ID_AA64MMFR1, AFP, 44, 4) +FIELD(ID_AA64MMFR1, NTLBPA, 48, 4) +FIELD(ID_AA64MMFR1, TIDCP1, 52, 4) +FIELD(ID_AA64MMFR1, CMOW, 56, 4) FIELD(ID_AA64MMFR2, CNP, 0, 4) FIELD(ID_AA64MMFR2, UAO, 4, 4) @@ -2060,7 +2080,10 @@ FIELD(ID_AA64DFR0, CTX_CMPS, 28, 4) FIELD(ID_AA64DFR0, PMSVER, 32, 4) FIELD(ID_AA64DFR0, DOUBLELOCK, 36, 4) FIELD(ID_AA64DFR0, TRACEFILT, 40, 4) +FIELD(ID_AA64DFR0, TRACEBUFFER, 44, 4) FIELD(ID_AA64DFR0, MTPMU, 48, 4) +FIELD(ID_AA64DFR0, BRBE, 52, 4) +FIELD(ID_AA64DFR0, HPMN0, 60, 4) FIELD(ID_AA64ZFR0, SVEVER, 0, 4) FIELD(ID_AA64ZFR0, AES, 4, 4) @@ -2082,6 +2105,7 @@ FIELD(ID_DFR0, PERFMON, 24, 4) FIELD(ID_DFR0, TRACEFILT, 28, 4) FIELD(ID_DFR1, MTPMU, 0, 4) +FIELD(ID_DFR1, HPMN0, 4, 4) FIELD(DBGDIDR, SE_IMP, 12, 1) FIELD(DBGDIDR, NSUHD_IMP, 14, 1) From patchwork Fri Apr 22 10:04:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564803 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp351688map; Fri, 22 Apr 2022 03:50:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf9d560sW304ZDbFUpWhDdUYOk6SA2YOOLVfviryeHETzxRN7pQemrvnUX3JwyfrXkWG3y X-Received: by 2002:ad4:5cc2:0:b0:448:c1f8:58f6 with SMTP id iu2-20020ad45cc2000000b00448c1f858f6mr3006873qvb.91.1650624645959; Fri, 22 Apr 2022 03:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624645; cv=none; d=google.com; s=arc-20160816; b=CcGiS9b9yVNvrulsR9vsx4hwrFLGiMnaYwuJRpyUpPQCgubgqDjvD4R6wbhuy7SGRN 07Ch4l7bSSfYeq7es32yY5Ia/MigejL0zYRJw3YajXV2riXTeNVeHqThZKBd8IlZ7BO1 6ZOxiorhLGu4hDYDfxhKd59C1ogW8TuJL4bHvNfkk6Hmk+mM1/GMwqOgTmgl1I7t7gbw uPk32uD7e2VPLphThkj4wlflB+y/XROKdnDW0q8imdSazouLcj9TJ1VugMuoTA+5jgtI inZrhyiKZp92IV6yERnPW1QojO5x7PFXizlYfgpTwv1ZUzUsOlfsTSebyYv/G0Czhkxo YiQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ivxQ1qvgY8YzLhlS8QE+z47bKLIgh4ThHo8REAZyZdE=; b=q1bt+nbBm18CCEhRWTfu1fiHpch5E1gJc3DQ7DLmUl10oLD1kY+X5Y6fntJhj5ctpT O1LZS4zxzraysBuA89TLwuiYTLVhqeDcnLRGsin4Ms2XXuE4rd7fXjcf5BsVbYml1qYT aP17eMqWIoMkl9eu4vS/x9/I0w1XvNM7il7cQxYMSFJ6wdPMFaVYFadGXUh6l5x+n+d9 1k7NaP6SlyzKDJTMU4svFXNmpacs7ipeennk1k91Q63uBsvQBT2zoRT/keHQbFxgC6f3 fSY8YlMbhsXpnJY/0Un3BYALBbdoMf5vMIXu07wK15K2Ym2naUSI9cr6H0xIbqJz7KzD Ccpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uLqY0t8a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r12-20020ac85c8c000000b002edcf29de05si2250535qta.181.2022.04.22.03.50.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uLqY0t8a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqs9-0005DU-Fc for patch@linaro.org; Fri, 22 Apr 2022 06:50:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqA9-00059i-TV for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:17 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:39562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA8-0002t7-3o for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:17 -0400 Received: by mail-wm1-x32e.google.com with SMTP id ay11-20020a05600c1e0b00b0038eb92fa965so7622795wmb.4 for ; Fri, 22 Apr 2022 03:05:15 -0700 (PDT) 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=ivxQ1qvgY8YzLhlS8QE+z47bKLIgh4ThHo8REAZyZdE=; b=uLqY0t8acPwAsFT6XUl6HDrfqj1001TsoDz/02yMPefsoftRtO/7oI/ZbFFSIcsLWu nYw2LuG/mR1jZqblOcUXPGZjFiAkApPm2m3kPmirDB4nfKhx5BG93IzF9HKZkkDtgGj7 Ih7ZLTnlTfMFoM0J/q8oVoKbkili/C3XvQ0txFW3/7amRMEdLR3ST+yCFpSluHZ7hdiO VKrp6+hpdv6Yeez+x/jTKfbLopM4w+HlhxaD4vTyXd4w/+cPQHp0YAD6K7g4RddPjELJ ANAI4m6UbbNnOzISw/XooB04lTYxc1HIsSDURW7B0cyGYuSqQwMj+kHU6VIUbAYnASjv +G8Q== 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=ivxQ1qvgY8YzLhlS8QE+z47bKLIgh4ThHo8REAZyZdE=; b=RTvxFhKJZURnB5K9rqOETtiB1ZpX1FPzS4reFslZdziuK76/DBVIl4pB7M0Yw4OVRY NtjaVLWIcG8vhuODzM4E+ND7cSQsYo60vynsje9jCtxM3WW1VBMsdZaaot8Vwh14RO/z 9YoxycT5z9D3EJqxlmIyXV+ntFu1T5lMS5M1q0Fnu3ScL5soWCeM8iDJq+Cuq15SWauc t23ijqy6dChjm8KxbNCm6VFWpNxIYpD0eeGOIv9TgsMxcb3pBxsZKRqpUfitACXX8NRL UgcYAViXtwxPKoePAN84B2xYvQrkH/m82ptxgBKdlpkm03sDhYuyH8nr/UlXjgL/Sr4J I1Og== X-Gm-Message-State: AOAM532Jn2Vpj6RT+hnrHUAmSuZN8/CZsOIxk7cnwqPbTx2ql+enJyNd vEdbghP8SyYjqwjby/nbrGo6NOC/++sgag== X-Received: by 2002:a05:600c:240a:b0:38e:af6f:510f with SMTP id 10-20020a05600c240a00b0038eaf6f510fmr12556963wmp.46.1650621914605; Fri, 22 Apr 2022 03:05:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 43/61] target/arm: Update SCR_EL3 bits to ARMv8.8 Date: Fri, 22 Apr 2022 11:04:14 +0100 Message-Id: <20220422100432.2288247-44-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Update SCR_EL3 fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Peter Maydell --- target/arm/cpu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 564821eeded..cc8f7f74eab 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1545,6 +1545,18 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) #define SCR_FIEN (1U << 21) #define SCR_ENSCXT (1U << 25) #define SCR_ATA (1U << 26) +#define SCR_FGTEN (1U << 27) +#define SCR_ECVEN (1U << 28) +#define SCR_TWEDEN (1U << 29) +#define SCR_TWEDEL MAKE_64BIT_MASK(30, 4) +#define SCR_TME (1ULL << 34) +#define SCR_AMVOFFEN (1ULL << 35) +#define SCR_ENAS0 (1ULL << 36) +#define SCR_ADEN (1ULL << 37) +#define SCR_HXEN (1ULL << 38) +#define SCR_TRNDR (1ULL << 40) +#define SCR_ENTP2 (1ULL << 41) +#define SCR_GPF (1ULL << 48) #define HSTR_TTEE (1 << 16) #define HSTR_TJDBX (1 << 17) From patchwork Fri Apr 22 10:04:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564807 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp354263map; Fri, 22 Apr 2022 03:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz65CLGXC/75kT/QoEluv9jFSwtEXttWQnYhLSihhFc1Dh5XKXHcRWk7KOyyQITfpZfK/Vn X-Received: by 2002:a05:6214:21e1:b0:440:fa7a:493e with SMTP id p1-20020a05621421e100b00440fa7a493emr3073648qvj.55.1650624908226; Fri, 22 Apr 2022 03:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650624908; cv=none; d=google.com; s=arc-20160816; b=zqmdyPanjmlW+nZqRxBBYY0IErRTgYn+1MRV/DFf1yHojzUteJsrt86YGsW3z/ikNc 4FvnTR1BWR0zWShpO988XMdIDtEcwhJJLmIulCxIsFHVf5mmkHxWp3S9Xk6RDhZibBoQ TkdHR2pDxq5Gfoh7/eFd9ThpYjcwU3JJZrCCa0khruH5HY9RrZzmMwm8abrQa/Zbj5V5 PP/kLHOq2+TzP/cDteLuWqpI02TYjQhw7QN+ICBjqSPoWqhg75DF7eIt88KzehBYj5Cv A+7dlGBok7N+X4p0i0nZovXkfI4WybAzDqI+eW+SlG6NDuRoh8cGQeNOQZ+pFa7s5cHW N0Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=S4r+9Jtute0CnHhryAfrHHj2Bmc0mJidkIeWbRs5UF8=; b=Tb815qIpk+WT2qQEhYaVuYBaNoZ+Tx0uX4dIjWJz0L69ojs8Cvt38u3jLIjqGR5sQJ vcmYMnUQBWfzR0WUOfRo/r0rvD8Ge6YLVEGbFz42Iw4zF84R58Dek2Qc5lmKjIus9vz/ rWwjsIyZ+pGVBhpu8oHEZpOVZhrykRAWw4JLyuKyrB2TehIMJ605bWiAI+jfrOdr4yXx oxQLILE6rnDdWbVX0Nljwjw4Dtape5YGucy2tM7sfJWMDAbxcpr9lTk66avpPO88aEbP Im4hLgfvRFXUooEaEj/0cSca5oXY8+pAgI81B4ijDp8UleQ342LcY9+84FqOmXUmvqNB c2Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BnfiCVdq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s14-20020a05620a254e00b0069c2847a80csi2215530qko.235.2022.04.22.03.55.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BnfiCVdq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqwN-0004Dc-Me for patch@linaro.org; Fri, 22 Apr 2022 06:55:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAC-0005Gh-NT for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:20 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:42901) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqA9-0002tH-TG for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:20 -0400 Received: by mail-wr1-x433.google.com with SMTP id bv16so10285276wrb.9 for ; Fri, 22 Apr 2022 03:05:16 -0700 (PDT) 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=S4r+9Jtute0CnHhryAfrHHj2Bmc0mJidkIeWbRs5UF8=; b=BnfiCVdqaEy7bhtikvhHLs9ze4nuHawhV9Cl/OB3Upw2EP4mVi7IlxC4iQNqqZsJDp jK2ttVqhlTAs+jNnVGyzpYAR+tWA9dzHQVvqz+OeTKVybl9yZa5JzOoXJZ2Hgkuw6ro1 J8BDmy/w3A5YGff8p1m680ZInSSk67nGw22SGZNm+JxIMPsIIwrMc2q8m0c9LFUl5Vuu M0Qtw7KhmbRmNN8DltrfWeH3Pp61YGllCjmqu8Qqcv4ypsY+Ql/Npo5KC1xrLBTUFAkX da1zZRukhHrrydQsDHyBgTqBSRuwNZWo3krM/nVimkeZLN/t7IyDwvnGlQAQohuQumZm 7Kaw== 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=S4r+9Jtute0CnHhryAfrHHj2Bmc0mJidkIeWbRs5UF8=; b=7Rb1k+hFnqgmBtqDnctvD8h2BUOAfNDJI9AY2O1+ggw+1t1a4siI0B+I8hsmkQ8gJa VxdhWG8UvaCTX7zT78CTV1ju+R2XV6JFQq362xrhYkw3LX7MCTNY1iKRZsynE4M0BYVz 0fmgLsTXxitXF5q/ghKEZ4KvNP7r0Bdx3eFe3xnnKtSESPjqkxYR2OhnimH5cFlA7Amy kDZEjklzyLhfJ0DSDnb0QiNnWUgIkqvR1zOZ6rqCGI84kZH1bUhmHddfPcZ07UIx65qG H2EQXXO2kM722eWIMSuieGE1znm2DHc47xrgdRHfFi9s8qkTFnvxUQMmPXV+nsDgXaKq 7tIg== X-Gm-Message-State: AOAM533oxwIGjDNvvrkrKXDwNm5+Q7TQ6A5z61miWUMVPBEVdWpqkgkh TxbZaOweVbz72l4hPnpPV3EJ/I8PmAtziQ== X-Received: by 2002:adf:eacf:0:b0:20a:c8c4:ac51 with SMTP id o15-20020adfeacf000000b0020ac8c4ac51mr2078936wrn.510.1650621915500; Fri, 22 Apr 2022 03:05:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 44/61] target/arm: Update SCTLR bits to ARMv9.2 Date: Fri, 22 Apr 2022 11:04:15 +0100 Message-Id: <20220422100432.2288247-45-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Update SCTLR_ELx fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Peter Maydell --- target/arm/cpu.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index cc8f7f74eab..bee1cf4653a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1233,6 +1233,20 @@ void pmu_init(ARMCPU *cpu); #define SCTLR_ATA0 (1ULL << 42) /* v8.5-MemTag */ #define SCTLR_ATA (1ULL << 43) /* v8.5-MemTag */ #define SCTLR_DSSBS_64 (1ULL << 44) /* v8.5, AArch64 only */ +#define SCTLR_TWEDEn (1ULL << 45) /* FEAT_TWED */ +#define SCTLR_TWEDEL MAKE_64_MASK(46, 4) /* FEAT_TWED */ +#define SCTLR_TMT0 (1ULL << 50) /* FEAT_TME */ +#define SCTLR_TMT (1ULL << 51) /* FEAT_TME */ +#define SCTLR_TME0 (1ULL << 52) /* FEAT_TME */ +#define SCTLR_TME (1ULL << 53) /* FEAT_TME */ +#define SCTLR_EnASR (1ULL << 54) /* FEAT_LS64_V */ +#define SCTLR_EnAS0 (1ULL << 55) /* FEAT_LS64_ACCDATA */ +#define SCTLR_EnALS (1ULL << 56) /* FEAT_LS64 */ +#define SCTLR_EPAN (1ULL << 57) /* FEAT_PAN3 */ +#define SCTLR_EnTP2 (1ULL << 60) /* FEAT_SME */ +#define SCTLR_NMI (1ULL << 61) /* FEAT_NMI */ +#define SCTLR_SPINTMASK (1ULL << 62) /* FEAT_NMI */ +#define SCTLR_TIDCP (1ULL << 63) /* FEAT_TIDCP1 */ #define CPTR_TCPAC (1U << 31) #define CPTR_TTA (1U << 20) From patchwork Fri Apr 22 10:04:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564828 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp375416map; Fri, 22 Apr 2022 04:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3V8fBxiND+4RAocjPj69SddEndbUGjpGfEXtm9qX5woluNHZZ6la59deMYriPBDWrJFxk X-Received: by 2002:ac8:4e81:0:b0:2f3:4a7b:2282 with SMTP id 1-20020ac84e81000000b002f34a7b2282mr2699217qtp.474.1650626604372; Fri, 22 Apr 2022 04:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626604; cv=none; d=google.com; s=arc-20160816; b=jyyFdaNvFv+LlKyK9P3dGzphVqzBXUQGWwba/MRJXG4Ccnk9q1VQZ9NFDWoF4dj+Z7 8LyyyrXaAaOHMwuc65MXfBciY6rDeKUyTUU4oqqrIu5L47tCSCNJZxDknfJnOvnyGCNV kskT7b5UUk0cmvKBXVAPDS3n8aUiOlZLkofp4SIvTALMTi6Q1vdttRRzZ3NuTm1/CdJ2 bTKsDji+DqYMRTM4G8jTuT497mnVzenRdivgbysuqv1cXM2MtGD5bGH/C/RmCylhyvuJ PUhxhq2NxFNW1dCapCOWtjDA1lhlOoGZ1N6DHo5pXuKLZ45ZDxUzslT09sm5R5Ki5TgE LzOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=eHw+HjmQRq2oIAbizpb+nwuiBNkSn27k7ONTIxuJM9E=; b=UDcxkocm2v22YiqS6EDsv7UU76PNXQHnrt31EFDg1EHP35qP/f258uD1z3BiAUvmkH y0zGBOXa0vCbGd42DwIhjrcT4lh1SqkGLPi+uwKMRWdSs11LOaoOe/kMEox4l2JQHpLJ 5KpXzgKgOhPZvbwPQ8mIMNqYE0T8XVjvxpLdU4+XeUH/SSlLvDpClBvRWRLOypW9mQQ7 CARhrcLHXo8RFxngYK0+TgQuSa5O/LOfMuZXKA92UeFTeg7TI/ddxZF1GE06qhmKCDKN rhmlX2B2BS+IU7pff11TlxcwebxSXyF0HrVqs4qehyFzuV2RMeZDsPw9ZLMd8O8deZ9E cvVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=icGpDVA7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i10-20020a05620a248a00b0069ed8327ee8si2215902qkn.176.2022.04.22.04.23.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:23:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=icGpDVA7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrNj-0005Su-UC for patch@linaro.org; Fri, 22 Apr 2022 07:23:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAD-0005It-AZ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:21 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:44587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAB-0002tb-LA for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:21 -0400 Received: by mail-wm1-x329.google.com with SMTP id r4-20020a05600c35c400b0039295dc1fc3so5088113wmq.3 for ; Fri, 22 Apr 2022 03:05:18 -0700 (PDT) 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=eHw+HjmQRq2oIAbizpb+nwuiBNkSn27k7ONTIxuJM9E=; b=icGpDVA7TDqsxOI5X+kKz7V2Fnzqt4YUlpYJ08PebBwJ7Fem/u/gDP4KQNDhHTi9BD +DmPO25KMktbctQR+cfCZQ+jBCHtrm8IMKO1DAUYCEZq9zO0RZaPfXiUJuGiKQvbIV/S qd8TtAgIaUcYwsE2dpQlGP82hm/Ub++u3mgaw9MQJQlHTfE692UZ+4D91nhrCAezUkFk BCaXch2ZkcDF5ILDvyACQN6toxRzHqPxFPLlt0QxwHmXVQn6W8iTPmLM0fWMCqfLG0FU FtpC+kq4dsvEcEpmz4S7QcnQZ1ze4ndacw09MmCf5e4B+kO3vASM8CnwTrSV/MxVZLcr HcNQ== 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=eHw+HjmQRq2oIAbizpb+nwuiBNkSn27k7ONTIxuJM9E=; b=mD6O4V0gMrZif+14J1DdBZK6o7ebRdgCNM0OHyh7u6x0SHykK5lO/uVq0hPar6G1VR L4ERSNpLHU4FrgQ/YTcSQmTuMR/oIhU/7+7jaUOB4utDjqGXQcz9G/Wowe7QeTOXeJ2m 9Eo58P2EFlqdEj5MMhgs3Cs0jan5/7CF/TnTufwSm2Scw/XvUA8tvKAyu3Wa1/EKHQ3i Lu44I+fM+5PI+gGC+9zJqPCShfH1ZZHLat9yHvtiq4cHOgZVaeXw/3Uw4G9f7MWRimL9 qvopo0sAzzo73IdEPj+DCyD/UwdkyiTbzJtXkEunyEoiqss9PIT36FjMtqRkGt5r2PhH BUsQ== X-Gm-Message-State: AOAM533gWYlyhxkjSJ2oFXN+PqwberRpd+3ud71KOQSGHWqvN/M8QanF W2JKE8LO+wa61AznD6+ScicLNG7ey91eiQ== X-Received: by 2002:a05:600c:4313:b0:38e:b150:2f8e with SMTP id p19-20020a05600c431300b0038eb1502f8emr12585999wme.198.1650621917031; Fri, 22 Apr 2022 03:05:17 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 45/61] target/arm: Change DisasContext.aarch64 to bool Date: Fri, 22 Apr 2022 11:04:16 +0100 Message-Id: <20220422100432.2288247-46-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Peter Maydell --- target/arm/translate.h | 2 +- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 3a0db801d3b..8b7dd1a4c05 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -59,12 +59,12 @@ typedef struct DisasContext { * so that top level loop can generate correct syndrome information. */ uint32_t svc_imm; - int aarch64; int current_el; /* Debug target exception level for single-step exceptions */ int debug_target_el; GHashTable *cp_regs; uint64_t features; /* CPU features bits */ + bool aarch64; /* Because unallocated encodings generate different exception syndrome * information from traps due to FP being disabled, we can't do a single * "is fp access disabled" check at a high level in the decode tree. diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 19c09c3b535..f6303848918 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14664,7 +14664,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->isar = &arm_cpu->isar; dc->condjmp = 0; - dc->aarch64 = 1; + dc->aarch64 = true; /* If we are coming from secure EL0 in a system with a 32-bit EL3, then * there is no secure EL1, so we route exceptions to EL3. */ diff --git a/target/arm/translate.c b/target/arm/translate.c index 38e7a38f280..6018fee2ef1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9334,7 +9334,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->isar = &cpu->isar; dc->condjmp = 0; - dc->aarch64 = 0; + dc->aarch64 = false; /* If we are coming from secure EL0 in a system with a 32-bit EL3, then * there is no secure EL1, so we route exceptions to EL3. */ From patchwork Fri Apr 22 10:04:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564829 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp378528map; Fri, 22 Apr 2022 04:28:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynilhASCl0hUDvim65MbeY2HWcPvWKqCIrlweZSf4dhhfOVZY8xMwO9TNujXefBw9IJRJc X-Received: by 2002:ac8:5f07:0:b0:2e1:d695:d857 with SMTP id x7-20020ac85f07000000b002e1d695d857mr2804510qta.40.1650626883825; Fri, 22 Apr 2022 04:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626883; cv=none; d=google.com; s=arc-20160816; b=I/GGDr8VkaJtsl+0p675dK3WwTDwtdnvcuYZ4eOtO0sWTMJ+LP4OEmKlKiFHWAhNtb wavl1xYRunVOGAOvh85EDjXk1GS4yN+wtpidJhiQu8GLfl2L/31FXSFudaW/IQGo3ucV PjigFkoB/p7SVetRKEem3ei5sn/qt+FaF0gMXodWjqfCgar8cguol6BGFYcWDd5mtoI4 /KhPwqCHsLbQm+XiM9wVoZ7F84jMIckkxSAnucGI53na4k5NOH+sJDUOfwzpo9DUDYz+ d9p8F8fxr+OY5sdAnTdH6igXZdLfmKktJrtkDZ7U+BdPS1BpUuPbayk1k860T1tYlMll RBvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gKRci0cpIs4ADQf7JfcVVwdBVmU79gOg4J5HNz/ZQik=; b=ARcY8k3MQjf9VWqWzfA5/rpG02GYa4YW2/+HDP2Bel5glIfuG7aCd2m7/7isBysqxv RJN2r+Qtu3z6juC+LYL+e52tYWGgoSqaXem+54pWYi6Nx7oZ94IhjysgBU9/bpOLEO7N 943v3Pg/PnFSAxy8etOHojUDXnozxQkscy3OBmM0j/qbz4BXS5XyNeR4u43VS2oPc2qw 3LSL33Y+88W0mcLN81/Z60DraTtn2hr5aOCFwhlDQOmQL6kGoPKmYuo/HkLIt7x3n8iy P+bymR2ugDN1R9C8PHhOo26T5fYJopCY7cyy4i3L4gORV753Z4QuuGTfQ3/h8NehShOj 8RBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ei799HtU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id az10-20020a05620a170a00b0069beaa775fdsi2164763qkb.548.2022.04.22.04.28.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ei799HtU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrSF-0002PY-DG for patch@linaro.org; Fri, 22 Apr 2022 07:28:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAE-0005M1-1v for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:22 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:35600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAC-0002tu-49 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:21 -0400 Received: by mail-wm1-x32e.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso7650896wma.0 for ; Fri, 22 Apr 2022 03:05:19 -0700 (PDT) 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=gKRci0cpIs4ADQf7JfcVVwdBVmU79gOg4J5HNz/ZQik=; b=Ei799HtUxox5oTeG4xLGDhhbg0jjio6IJGF5qjPxQqFqPBhVLO6U19UbrqZZz8cyUX F7AbasH96/lAzQlzNjQ4ni3o15ZMfBvXir27OLQXJwzDRGDiY+kVUm3b3EwO/pDpsMMW AM6KHvAq8XNqsgwLP4vwu2giCc33b5x0r63A5FIbnGk3GT7R/Uv06+JodmZGF7lWfRRS DYnLXYZnLKB9NTUUvq4uzEnA63jh73TSCxA+NCrpEDicpF5pRykCLz2yqMWkLbqeS1MX ye50Ah0s5c3XmEEgZKmQSOJXs8Zz5SWuRqGL2nAp6Y7HZCLMkFCZFQGQVLAnybr91cF5 qLJA== 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=gKRci0cpIs4ADQf7JfcVVwdBVmU79gOg4J5HNz/ZQik=; b=sAWcRMWygu9Lr/y8cKpjImReyuPLf0sQNVEa4whHj0Y9/hbUqoY/FF4RmgaO4hQPnG mrKgIFQh6gdSM9TKx02nar091hUMe9o5Rl12+9NtZ56zP0BNw7J0MMY1gt6axtNXg7jE AQ0xan7RpwDWLswpYpXWSadKgWN5ESTjoVjcAOBm1il2BImG/iHPMhYUacpvO2X8lxpj uzFzIvWN5iTsCGKJc28NOyze1T1tgCQ2Ufz3QaRrjjGaaBeHvNHgxTgCmsYKHbWSY0IV ZFfKyZk+eHLtKDkq++2M2B+Cwb95fQ5gFwf8mbT4lMDdL43cyiJkGzFoFcA5vQr8//eb aKmQ== X-Gm-Message-State: AOAM531Av/uL4W6r9caBQwiM1tLojDXrsKdeZEX721JElUwXW8I/PNfH 5b/GgG4LcZKye59DYpm+PIo59mUV6d9iZw== X-Received: by 2002:a05:600c:a06:b0:392:a4f2:2097 with SMTP id z6-20020a05600c0a0600b00392a4f22097mr12708019wmp.97.1650621918071; Fri, 22 Apr 2022 03:05:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:17 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 46/61] target/arm: Change CPUArchState.aarch64 to bool Date: Fri, 22 Apr 2022 11:04:17 +0100 Message-Id: <20220422100432.2288247-47-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 +- target/arm/cpu.c | 2 +- target/arm/helper-a64.c | 4 ++-- target/arm/helper.c | 2 +- target/arm/hvf/hvf.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index bee1cf4653a..31e46709277 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -259,7 +259,7 @@ typedef struct CPUArchState { * all other bits are stored in their correct places in env->pstate */ uint32_t pstate; - uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */ + bool aarch64; /* True if CPU is in aarch64 state; inverse of PSTATE.nRW */ /* Cached TBFLAGS state. See below for which bits are included. */ CPUARMTBFlags hflags; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index fa13fce355a..7e9f7d146df 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -189,7 +189,7 @@ static void arm_cpu_reset(DeviceState *dev) if (arm_feature(env, ARM_FEATURE_AARCH64)) { /* 64 bit CPUs always start in 64 bit mode */ - env->aarch64 = 1; + env->aarch64 = true; #if defined(CONFIG_USER_ONLY) env->pstate = PSTATE_MODE_EL0t; /* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */ diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 7cf953b1e64..77a8502b6b6 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -952,7 +952,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) qemu_mutex_unlock_iothread(); if (!return_to_aa64) { - env->aarch64 = 0; + env->aarch64 = false; /* We do a raw CPSR write because aarch64_sync_64_to_32() * will sort the register banks out for us, and we've already * caught all the bad-mode cases in el_from_spsr(). @@ -975,7 +975,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) } else { int tbii; - env->aarch64 = 1; + env->aarch64 = true; spsr &= aarch64_pstate_valid_mask(&env_archcpu(env)->isar); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { diff --git a/target/arm/helper.c b/target/arm/helper.c index d7715c911a1..f1e91b197e2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10181,7 +10181,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) } pstate_write(env, PSTATE_DAIF | new_mode); - env->aarch64 = 1; + env->aarch64 = true; aarch64_restore_sp(env, new_el); helper_rebuild_hflags_a64(env, new_el); diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 567e296b21c..b11a8b9a189 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -564,7 +564,7 @@ int hvf_arch_init_vcpu(CPUState *cpu) hv_return_t ret; int i; - env->aarch64 = 1; + env->aarch64 = true; asm volatile("mrs %0, cntfrq_el0" : "=r"(arm_cpu->gt_cntfrq_hz)); /* Allocate enough space for our sysreg sync */ From patchwork Fri Apr 22 10:04:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564830 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp380505map; Fri, 22 Apr 2022 04:30:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylZ4qSCED1qfEJEiaCiL7sZiCvk34TkMRwP+WTMtPjHtoAS5QqISGbPKzOJ9iVoFyDuh9O X-Received: by 2002:a05:620a:2018:b0:69e:5941:5db6 with SMTP id c24-20020a05620a201800b0069e59415db6mr2250203qka.621.1650627058744; Fri, 22 Apr 2022 04:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650627058; cv=none; d=google.com; s=arc-20160816; b=qx8OY+c323C5wVWlWtD2tSfiwVmW8HwL6lg12/VUgSs6wQ4dT17kyRTfowRIvPNhVX kGkudPgjsRM5pFGRcjGRUTN/WsAjqGwTEJrfj81QlSU3in568cmFrdxvhnsWXLuHnHKx K8NaaCfYlXpNzF6kyM+DuslmRqEUMUDWqseKs+S6sUuB8gVTTAdtXkWDKgFpzjJV+k4K +bQEkZ0qWhk7M3zuhOdWgRKvfyiErNGR52kGdXe2CW2/49xoivJbWwf4dy2CG5C654hV esQMNmvcdohYSBfvOhf8BcM/UxGpKGjhjr/ZvchY9mhOLuQO+HlbW0KB9+youMG5XHgw lSZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3Z1wuSZ1tsgvZXbrivj/X+wswM16HNWMbK2oDsPm2EI=; b=SzFNrsdW+P4t23+MhafRCI3w+vBiMjsJQ9/3f7vTVWRjDIFpm7tOGSJ/B9oaI/97Gb hFn9l7Vo7mq/ZknfkBn0ns7y/hy6ZJvUx6JMRHXpLVAMrZcp9MDXztmgJ0W5S9dNCD5x QEx7F0fE5c1cSC8/s8qj6a3DINuv+NclThu9VzdPwQ8Wk+eOPg+Fc3pwOQQsRmYJV0/8 IyK5rnfzH0h0MIRKzRMiXd64YgrlFJIV1MhfMNfTi/pEJnk5Z0779gKLc+lmbiEl13Kn Sj78QZK4+YW02CKCw+qzMw/Ny8+w8O/Hg7nxrC1yWbAv5DQALwvNEb4x+A5RvL97Nmm8 b+ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FT+dci79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bl29-20020a05620a1a9d00b0069bdb456359si2239070qkb.173.2022.04.22.04.30.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FT+dci79; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrV4-00009c-Ad for patch@linaro.org; Fri, 22 Apr 2022 07:30:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAE-0005O4-K5 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:22 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:44915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAC-0002u6-VB for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:22 -0400 Received: by mail-wr1-x430.google.com with SMTP id b19so10281824wrh.11 for ; Fri, 22 Apr 2022 03:05:20 -0700 (PDT) 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=3Z1wuSZ1tsgvZXbrivj/X+wswM16HNWMbK2oDsPm2EI=; b=FT+dci79aZMw7Pb8vhep+Ve4qSWTbxi2lBKxvvGah2cnVkB4YOaeIvuFmJV0Zel8Vd VW8x5iaHgq+ZI4g79/gxRuXbBI1/PEzezNADad2J9c2Zdud3aPY055iaIPeQpiEpMTqG HBLFJguw94oVAXeKYiUTg0ZmGfwMzbJHxEnOz6/13AfRCAZi6NTa2COxifrn8Fi2YP6t FOv6Bb+LEVg5gQVk4xgw6R38bDTIf3JvMpZ08nbjjXTIQCxXTeqvqyAHsdKs/h+9K7d2 ImRQYWCQWee7kqtLMO/jEhVfVNlbjTIaBw/80/5tFADaJBqo8nGe+GBscgWuHi58hE0q bKdQ== 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=3Z1wuSZ1tsgvZXbrivj/X+wswM16HNWMbK2oDsPm2EI=; b=CUtInTpLD9jt//gmVBANIFqX1T435kONgrrooyf2wB+hvXJffCcqoAE/FSb94o/r8x aVGpsRZKneWVS22qJZ9Y567QnM0A00QsB4Zb9lCwTxfOz+THeo1Du9wv+3lxMiigVVem gQsvtPxyKNqRxNQz6n0Z5Wp3QLgu/EBsE6aBq1PcwLBMEJtZ9mC5JE4+6w/QFq3VJdW5 A0neheBq8oH3Slj1zMhwuUkyB8hVHQJcVV7x5H+TY8ODQUzOWaRe+uG4KqZV8p6rPXgK H1Y6uDheCv/2FzHKOfoLrLUw6FBT//KU4QTS8QWh3Vgiou+L90sf9vLhnzGlbCxjA1Ee 3Ajw== X-Gm-Message-State: AOAM531DdYMvSaCw7un0Wal2lig3exYI5XDoj8BTdRQ1oMv2TDpa9WxJ O7Z+mL8SXjMqE0toto44Bymrss7YflJjrQ== X-Received: by 2002:a5d:6e87:0:b0:206:452:5b87 with SMTP id k7-20020a5d6e87000000b0020604525b87mr2989003wrz.473.1650621919445; Fri, 22 Apr 2022 03:05:19 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:19 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 47/61] target/arm: Extend store_cpu_offset to take field size Date: Fri, 22 Apr 2022 11:04:18 +0100 Message-Id: <20220422100432.2288247-48-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Currently we assume all fields are 32-bit. Prepare for fields of a single byte, using sizeof_field(). Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell [PMM: use sizeof_field() instead of raw sizeof()] Signed-off-by: Peter Maydell --- target/arm/translate-a32.h | 13 +++++-------- target/arm/translate.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h index 5be4b9b8346..09010ad2dad 100644 --- a/target/arm/translate-a32.h +++ b/target/arm/translate-a32.h @@ -61,17 +61,14 @@ static inline TCGv_i32 load_cpu_offset(int offset) #define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) -static inline void store_cpu_offset(TCGv_i32 var, int offset) -{ - tcg_gen_st_i32(var, cpu_env, offset); - tcg_temp_free_i32(var); -} +void store_cpu_offset(TCGv_i32 var, int offset, int size); -#define store_cpu_field(var, name) \ - store_cpu_offset(var, offsetof(CPUARMState, name)) +#define store_cpu_field(var, name) \ + store_cpu_offset(var, offsetof(CPUARMState, name), \ + sizeof_field(CPUARMState, name)) #define store_cpu_field_constant(val, name) \ - tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, offsetof(CPUARMState, name)) + store_cpu_field(tcg_constant_i32(val), name) /* Create a new temporary and set it to the value of a CPU register. */ static inline TCGv_i32 load_reg(DisasContext *s, int reg) diff --git a/target/arm/translate.c b/target/arm/translate.c index 6018fee2ef1..1314406b193 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -180,6 +180,25 @@ typedef enum ISSInfo { ISSIs16Bit = (1 << 8), } ISSInfo; +/* + * Store var into env + offset to a member with size bytes. + * Free var after use. + */ +void store_cpu_offset(TCGv_i32 var, int offset, int size) +{ + switch (size) { + case 1: + tcg_gen_st8_i32(var, cpu_env, offset); + break; + case 4: + tcg_gen_st_i32(var, cpu_env, offset); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_i32(var); +} + /* Save the syndrome information for a Data Abort */ static void disas_set_da_iss(DisasContext *s, MemOp memop, ISSInfo issinfo) { @@ -4852,7 +4871,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); - store_cpu_offset(tmp, ri->fieldoffset); + store_cpu_offset(tmp, ri->fieldoffset, 4); } } } From patchwork Fri Apr 22 10:04:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564819 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp366799map; Fri, 22 Apr 2022 04:11:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxFlVgob2trMBDi0ACQwQlFROvi5q4IOMm3iG7lZPkukKeLwXmqaPdGc2kW1wHZKphiTqo X-Received: by 2002:ac8:58d2:0:b0:2e1:c5d9:9060 with SMTP id u18-20020ac858d2000000b002e1c5d99060mr2639721qta.168.1650625888009; Fri, 22 Apr 2022 04:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625888; cv=none; d=google.com; s=arc-20160816; b=ucdyErJB2+PVixQOyY9FsVh5tItMAUcp8WK4UxdJVTaSq/xh8lY6tfyjB1WBxWQbx7 mNBya/kTdwEdKdtHJGseb6Exsf5YjCVtP3QC06dPLhNYmQcx8ctd0X8EDNsApgHbZRwj ++BkwTWcXsCzpHRiu0X7R1XPK/OuDjxyOwvs3fpFXuXMyw1MO/PtRWPzKQPgsR8P5gr0 Qt7L0KpkKrWM2iut8dmN5gKBuRvpnZffGs33ej2+jSsGaa0oTijD1Rj3COZOPQ/Ujatg kbyG8TPAeGT5zQPolx6zsvszm9lYmKm7WNCQ23KfgvcKhsXaijP+FAGtfmbnMpZd4ref 29Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/Wc2molG4qiAr3BjeYuq/HUxjFtE+KVmYa08eBlI6Z4=; b=WxqE6rqTgXPbOMVJZX1YYGcksab1OvB6rkmDz9r41iQfvGE2ee6BCEZBUBngoTJEmS yL6qchEZc87xLgCLMZok9Q8FrX5j0VVKYGNN0XbjqmJgCOJDifKcaM8/9e2LR8KBztgW 3DTCZVeRJablZJs38RpULihY4bsQ4pRFq82WgBaE35ztkN+9V9OgBuNmFF5QkAUx+giZ WcAlEyf9zlZNsKwli/HZe4JORdWCAE7JjuynpugMdpM6iLJl+BEmSwqnzJyKWSaATKEy v3rK9aROSGhGsG6W2/ou32guF/KDy49+ZojcGWSiehA08PBnvdSYTupvbiGVlKbMbtxY ppjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b35r+kZO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id hr10-20020a05621423ca00b00443e248fbb2si2108778qvb.472.2022.04.22.04.11.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b35r+kZO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrCB-0000wz-HJ for patch@linaro.org; Fri, 22 Apr 2022 07:11:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAK-0005aL-CD for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAI-0002wQ-PX for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:28 -0400 Received: by mail-wr1-x42f.google.com with SMTP id c10so10337081wrb.1 for ; Fri, 22 Apr 2022 03:05:26 -0700 (PDT) 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=/Wc2molG4qiAr3BjeYuq/HUxjFtE+KVmYa08eBlI6Z4=; b=b35r+kZOGY1qAIN7AHze5z2zuAAtqsN4RtOBlCxZKZ+H2uH4eG+vjGPBgKjM+rfNTq 49LiT/KH3aCsVNwAm6kCTDyg/uHx11sA321xrFUI9XzjnWqJJqEKGytdEgQceXnbDpny lbAK+cEmhX49roo/sxcWKyMlDONFSFvBFf2bWgU+pt+PpCpYyB3LfQQh1zCposvPyB7V GcNQIJc67aSz+m0rXGdBvuBe6H2NNkB4+AsovEQjU/fFFro8p2ThFkjVz/aCa6676doV XRJByj1rj5Bn5luFy/uvV+iFMIbRKQwhHdlpVhiAiJGiJJDoxjoIVtutJgZ9Ke8RJPmG UJrg== 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=/Wc2molG4qiAr3BjeYuq/HUxjFtE+KVmYa08eBlI6Z4=; b=jIdfxx9PH+cC+IB/n65Hj6G/NLvrtGC6ds58DI75IJao7jhn+RaW+ZeKvEY4f4sHQD ojQCwtzYaS8Rrxu0dUjB70V/t3OTwMz9zT3P/M9HQMqWtqF5z/82jZkLmwHqpMwLbj/S DRSsrz9bYrrISlfxDWrCS1f4UlQ9iXfRir5cSlEZU47fDKZ0BzKWSJ6u2e4+HEKjEd5R 1Iso/Dvo3MfF4ukUOGFpI7fiDjQZRCnSj+uDua1wCj3oXmKYtc6/Gmhsx0dbTehaLfpT 9JUSlaZ5vSYtNGnnFgXTzxk5PXXKUWeNIv6J9sRLA7ylJeoZ1l8MCfUxDhZZ2yw26ewv LOhQ== X-Gm-Message-State: AOAM531JMo9ItgIMh241ZM6pbwVFqaBivQgOcf41/lWXEqV7lDi3ASrY qXo6jFrlNjq9ins+NOhakLV33WY65UbKKg== X-Received: by 2002:a05:6000:1809:b0:20a:cafc:fd39 with SMTP id m9-20020a056000180900b0020acafcfd39mr1443525wrh.255.1650621920369; Fri, 22 Apr 2022 03:05:20 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:19 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 48/61] target/arm: Change DisasContext.thumb to bool Date: Fri, 22 Apr 2022 11:04:19 +0100 Message-Id: <20220422100432.2288247-49-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.h | 2 +- target/arm/translate-a64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 8b7dd1a4c05..050d80f6f90 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -30,7 +30,6 @@ typedef struct DisasContext { bool eci_handled; /* TCG op to rewind to if this turns out to be an invalid ECI state */ TCGOp *insn_eci_rewind; - int thumb; int sctlr_b; MemOp be_data; #if !defined(CONFIG_USER_ONLY) @@ -65,6 +64,7 @@ typedef struct DisasContext { GHashTable *cp_regs; uint64_t features; /* CPU features bits */ bool aarch64; + bool thumb; /* Because unallocated encodings generate different exception syndrome * information from traps due to FP being disabled, we can't do a single * "is fp access disabled" check at a high level in the decode tree. diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f6303848918..1ae465687ad 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14670,7 +14670,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, */ dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) && !arm_el_is_aa64(env, 3); - dc->thumb = 0; + dc->thumb = false; dc->sctlr_b = 0; dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; dc->condexec_mask = 0; From patchwork Fri Apr 22 10:04:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564811 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp356392map; Fri, 22 Apr 2022 03:58:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN50dF1fnv30/zHgiw76gfV5WP9dZeoTrX37NwjexcandVovTwx500N4FmsGr7uYHXagPx X-Received: by 2002:a05:622a:1a0c:b0:2f2:8b07:795d with SMTP id f12-20020a05622a1a0c00b002f28b07795dmr2586775qtb.633.1650625127204; Fri, 22 Apr 2022 03:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625127; cv=none; d=google.com; s=arc-20160816; b=MzrVNmkaqrHM44J8QpSpXgJF6ukr8H80L9JTEji3k2GgjYMsMPevF2yA270FqBi84r BXca5xDn+bxIhlRelUd+2cfG5W6IhaumtDUWZcPr7ECgD4hF6Cdl1lOnnyXG7TDKLqfB TpK6vaRU5IWBY3eAc0eV1Xm9tiHPk/XQ2cgfvy1JqMpUb2sIFqUPcQD98daDNZ/Bs3vP z7g5mAJjiFIDmRiQX5wKElvwa+vtYXzPhsDxcmu8i+43+oc8iSy2lQIPbITAxIy+vIIT h1TtC0+HNZ6ZtmXZ/UTqMPUy8CdAtisJOaGgTII2EAHQSv6bR4FC6edCaRzo25UqxJg9 noMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HIzaTyax7/dChL1AhyXtTDs+LrJvN7HbLgBA7vTKI7g=; b=dXDPEJIS1KJi5ADqTkAKgS4zOi6c8nSKk6N045zbqB9uckbn13IbpCuknl1m1WzWOI JhwlYIGPYDrOiusRhk/1zhfLXxA6O9fZo0G0XWI/Ymw5gIfbpmltas4rmr8EnJf9Gvuq +7mPzAnZJhnEaJS9Bt1ahTMr5Ww8eLOptvkAsrjgNYgDsNEfA1qycD0n+5AJtQykGos9 FAefhdSZ40cMqXKhLwTuCgApmMCDAC1bWljEo7x8nSmdtm1BVdCmdN5GBRnieoiAhQcx cZXPu+rgmuiygYXPghL18lyUsA58GHsciJhGMs5lufsnOOOUqXQ2kq4TMZlaA/pEdjWQ qWiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=viCv7oil; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u3-20020a05620a0c4300b0069e705460fcsi2400630qki.742.2022.04.22.03.58.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 03:58:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=viCv7oil; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhqzu-0003DD-QO for patch@linaro.org; Fri, 22 Apr 2022 06:58:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAG-0005UH-RT for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:25 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:45966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAF-0002uS-38 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:24 -0400 Received: by mail-wr1-x42b.google.com with SMTP id w4so10279489wrg.12 for ; Fri, 22 Apr 2022 03:05:22 -0700 (PDT) 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=HIzaTyax7/dChL1AhyXtTDs+LrJvN7HbLgBA7vTKI7g=; b=viCv7oilKeYVF3fhng/AiCWzKd1ICm4GTvOxTq3pEWT7+fBHYUtPcAiwRQzjKOwv1V r/3ihHxwgJ7RPTRh9vpUvie807bFEs8anub7F9HFPry036QQvCIRAyWcPMmKw21uZSka mChaERItIPwMxKpU3n7PLLuOD6eCxw28jeWu/kL3dVVpE4SdcnTB6WI7XbTcrXI9OvFE 9joRl73CbwxBG894jP/wBWC4ghjsmt2+8E8vSxiJq7QdIXndHxd0fQcJ4pI3fBFicgYG A+iXOzttlRdlYo1lUUBtCYKv0Opihak/xdJMsNm9RHAnx/FnJ+XqRD24LyUmek8T3L+m GOZA== 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=HIzaTyax7/dChL1AhyXtTDs+LrJvN7HbLgBA7vTKI7g=; b=hHFpX54YoYQD8QVup1MJu04kl4zZSLH2IBhvI6CXajU/tCEJklZpzmNZOoMfiXGInx X/qUkSHmwZsXLZXy0tVecKNo6R99AKXVHQQPdZgYdm6aBXPYrqX+O6U7q4yexwTfOwlO yCFiwxI9ExDMqmYFbYMEPNw9jJB/Hp8OjBj4T0fUWm+pDuvVTF5Q5+RDxXSPsxV8Vm60 4RG5DBmc2u4PuCFBLPDugEyUxcjQ8bBT2sLtU4Pj82j1WwgLZPkhKud5UozBEQV1vCup xRARr4KuRz6w0cVb24xCtQ2dAO+2Zo04qf0fisGEoFGl+kKUborX3lDzlA7Nbv9Q7TTg go9g== X-Gm-Message-State: AOAM533+hBitcPrVyHVd99Vfh/64N2514prclRybSOPvqgCrHiK6rof+ /51fH710ADLPfgKzpIJBPbAiC2j/UwSn2g== X-Received: by 2002:adf:c547:0:b0:207:9abc:cfa1 with SMTP id s7-20020adfc547000000b002079abccfa1mr3000657wrf.390.1650621921127; Fri, 22 Apr 2022 03:05:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:20 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 49/61] target/arm: Change CPUArchState.thumb to bool Date: Fri, 22 Apr 2022 11:04:20 +0100 Message-Id: <20220422100432.2288247-50-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 2 +- linux-user/arm/cpu_loop.c | 2 +- target/arm/cpu.c | 2 +- target/arm/m_helper.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 31e46709277..d2a34f6ea8a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -260,6 +260,7 @@ typedef struct CPUArchState { */ uint32_t pstate; bool aarch64; /* True if CPU is in aarch64 state; inverse of PSTATE.nRW */ + bool thumb; /* True if CPU is in thumb mode; cpsr[5] */ /* Cached TBFLAGS state. See below for which bits are included. */ CPUARMTBFlags hflags; @@ -286,7 +287,6 @@ typedef struct CPUArchState { uint32_t ZF; /* Z set if zero. */ uint32_t QF; /* 0 or 1 */ uint32_t GE; /* cpsr[19:16] */ - uint32_t thumb; /* cpsr[5]. 0 = arm mode, 1 = thumb mode. */ uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */ uint32_t btype; /* BTI branch type. spsr[11:10]. */ uint64_t daif; /* exception masks, in the bits they are in PSTATE */ diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 3268e5f1f1f..d950409d5b0 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -230,7 +230,7 @@ do_kernel_trap(CPUARMState *env) /* Jump back to the caller. */ addr = env->regs[14]; if (addr & 1) { - env->thumb = 1; + env->thumb = true; addr &= ~1; } env->regs[15] = addr; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7e9f7d146df..e3f82152035 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -51,7 +51,7 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value) if (is_a64(env)) { env->pc = value; - env->thumb = 0; + env->thumb = false; } else { env->regs[15] = value & ~1; env->thumb = value & 1; diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index b7a0fe01141..a740c3e160f 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -564,7 +564,7 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; } switch_v7m_security_state(env, dest & 1); - env->thumb = 1; + env->thumb = true; env->regs[15] = dest & ~1; arm_rebuild_hflags(env); } @@ -590,7 +590,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) * except that the low bit doesn't indicate Thumb/not. */ env->regs[14] = nextinst; - env->thumb = 1; + env->thumb = true; env->regs[15] = dest & ~1; return; } @@ -626,7 +626,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) } env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; switch_v7m_security_state(env, 0); - env->thumb = 1; + env->thumb = true; env->regs[15] = dest; arm_rebuild_hflags(env); } From patchwork Fri Apr 22 10:04:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564831 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp382959map; Fri, 22 Apr 2022 04:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwP3qVqPc8lW9HneLLFBKHrxmRBLTfp2hvr6JVztd2i3Gyx+SOrD6PQTEprk7P4tGJKk+l X-Received: by 2002:a37:ba45:0:b0:69b:e728:34b7 with SMTP id k66-20020a37ba45000000b0069be72834b7mr2255127qkf.606.1650627255225; Fri, 22 Apr 2022 04:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650627255; cv=none; d=google.com; s=arc-20160816; b=j4j9HPj5IMDrJhkh5tnCOmt0g865c7HapgNjKfl0xKXMzffRM+uF0ZVI8c7LBaaW9R mPMf35p1j/pidtd3AQouAD/f1i6AD5zmNlYGq0TSr/8CtNFXojv8tRLMMqhqOTvzv/vw CrErDE4qc26Vv9ZkV7w7wKU2bwYRc+D5qdAQZQYYBrqGuwsPdSnmcIqviMAbjIIKj5G3 7STxUHLpPxuz0iQkna8VWiP0Vl+UIGUNCd9TGIS1I4DTaoT6/fjal0BoWfD40KARn14M 8JWUh62OTswbJT/GtGw+1IubywtcfS9++jb7ENogUaX4/oAi7JWiFN36afoqivDfC5+D dD+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NIplvZLPteSaDUAHt7JEfPh2GX+SAGRpajBGdTIzQe0=; b=JnNhuqw+R7tepVtxDd2cW26eFmDonF8JNlBLBktZ1ZZR2CZ5WKmUbGkxRppJc3ce8l EkXqgpqyJUp9gSqZtj0oY8/0qVLY+bT1SHe6RtiY/19u620yG/4cKUEJL54LXH/yGeN7 pr0/7dqPWMaHw7XjMVTYEXOPE6eIgH5m4p7JBZkQBzutJ5fCaDSPZo2iOgoau0U8Buvx hLYXYcwMNU2ekmc5xDNVeWe+akg9Wnblz/kw5p2ABQDh3pLThtmUHH3QKavkQS9URpVh 5onpopQ0xe4qrMwRIsoipuC8m8/p0lNbxvEBjQGMPLk1bVx+S63acO40zgZg1wzZvY+w zrVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YiCtjKt4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jo14-20020a056214500e00b004461edfdb5dsi2193783qvb.220.2022.04.22.04.34.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YiCtjKt4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrYE-00072m-OZ for patch@linaro.org; Fri, 22 Apr 2022 07:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAH-0005Ur-4Z for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:25 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:33692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAF-0002uV-9Q for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:24 -0400 Received: by mail-wr1-x42f.google.com with SMTP id x18so10357208wrc.0 for ; Fri, 22 Apr 2022 03:05:22 -0700 (PDT) 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=NIplvZLPteSaDUAHt7JEfPh2GX+SAGRpajBGdTIzQe0=; b=YiCtjKt4lG7is7rRu0fBVsFDOFHFTHeT/Pc2NJj3qRJB4z1+AbDaivf6OzpDiJy4eB tO1rNjoK3h/0RfKdui1IfFlSSJy4YTLzhHeVcQbVxLGMf7OXsjMO74f+JfovUHVpaTRz JQFzBLx6nOMuwjAz8yZ1e11uMvDPerpKQLToScjfNOprfZbDNi+fpVTPYkA03gzc2UAY rtvw6eo1VR5eSopZ79Pe7rJ4mU7N11cetsQJaSwWNlge9GPgHm3lRAYgfy0N7HguenfV jW0QEhVTxIuh+3Zs2gr+mQiiF8bQosRBkPiBy+U2aE3CjzYj5gntfx1h0r6sD6w6RMAn xCOw== 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=NIplvZLPteSaDUAHt7JEfPh2GX+SAGRpajBGdTIzQe0=; b=OD0g0IEg9mSOdiZIevK6M8OG9LELveXNwj/+2yBvZPs8SB563Jj8gYtk2kBLjOsYKX cQ9ez4i/Ok/s80/kwX+4GPvTOYVkdKyZ8j6ZhES/sMPaYGXJVoei+ERSLfU111KMVUUp 7z1UxAbHUvig5IkvrISFDvmkTQoW/i0WkWotGzNiuPIUtW107WH427pktGbICdCWbOla b5fNL4YNmZi2PkUewRynTsWSdtHk4+EsmDIF49IFrFIEeEqKkAlHIJuCPUJGXH5nuRR5 LMqm4UdRTxUIjE5IXzLj9UXf8+w4sbsPh+eqe0kXPgFeEUIhjCDmxdAHYrW36x7Ol9O5 YZGg== X-Gm-Message-State: AOAM530GqMMTj695EOaWaL+NZsX1EuI5d+zOC1Ew9iqgawvVOvG1k1nP 1P44XSXGc7NaU4i+H1k3P4dtPBiAlnjjew== X-Received: by 2002:a05:6000:18a8:b0:20a:8a58:1639 with SMTP id b8-20020a05600018a800b0020a8a581639mr3022592wri.483.1650621921950; Fri, 22 Apr 2022 03:05:21 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:21 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 50/61] target/arm: Remove fpexc32_access Date: Fri, 22 Apr 2022 11:04:21 +0100 Message-Id: <20220422100432.2288247-51-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This function is incorrect in that it does not properly consider CPTR_EL2.FPEN. We've already got another mechanism for raising an FPU access trap: ARM_CP_FPU, so use that instead. Remove CP_ACCESS_TRAP_FP_EL{2,3}, which becomes unused. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 5 ----- target/arm/helper.c | 17 ++--------------- target/arm/op_helper.c | 13 ------------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index d2a34f6ea8a..db8ff044497 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2807,11 +2807,6 @@ typedef enum CPAccessResult { /* As CP_ACCESS_UNCATEGORIZED, but for traps directly to EL2 or EL3 */ CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = 5, CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = 6, - /* Access fails and results in an exception syndrome for an FP access, - * trapped directly to EL2 or EL3 - */ - CP_ACCESS_TRAP_FP_EL2 = 7, - CP_ACCESS_TRAP_FP_EL3 = 8, } CPAccessResult; /* Access functions for coprocessor registers. These cannot fail and diff --git a/target/arm/helper.c b/target/arm/helper.c index f1e91b197e2..63397bbac1d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4784,18 +4784,6 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, } } -static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo *ri, - bool isread) -{ - if ((env->cp15.cptr_el[2] & CPTR_TFP) && arm_current_el(env) == 2) { - return CP_ACCESS_TRAP_FP_EL2; - } - if (env->cp15.cptr_el[3] & CPTR_TFP) { - return CP_ACCESS_TRAP_FP_EL3; - } - return CP_ACCESS_OK; -} - static void sdcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { @@ -5097,9 +5085,8 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, - .type = ARM_CP_ALIAS, - .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), - .access = PL2_RW, .accessfn = fpexc32_access }, + .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_FPU, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]) }, { .name = "DACR32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 0, .opc2 = 0, .access = PL2_RW, .resetvalue = 0, diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 70b42b55fd0..2b87e8808b6 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -691,19 +691,6 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, target_el = 3; syndrome = syn_uncategorized(); break; - case CP_ACCESS_TRAP_FP_EL2: - target_el = 2; - /* Since we are an implementation that takes exceptions on a trapped - * conditional insn only if the insn has passed its condition code - * check, we take the IMPDEF choice to always report CV=1 COND=0xe - * (which is also the required value for AArch64 traps). - */ - syndrome = syn_fp_access_trap(1, 0xe, false); - break; - case CP_ACCESS_TRAP_FP_EL3: - target_el = 3; - syndrome = syn_fp_access_trap(1, 0xe, false); - break; default: g_assert_not_reached(); } From patchwork Fri Apr 22 10:04:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564815 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp362462map; Fri, 22 Apr 2022 04:06:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0JZT0gkfLTtYhAdHfXyTctCLXBK8cOgIXDRKwiXndmAXt8S2gqctaqbC9u3Tahh5acy5y X-Received: by 2002:a05:6214:2aa7:b0:446:4356:ef25 with SMTP id js7-20020a0562142aa700b004464356ef25mr2839144qvb.124.1650625563191; Fri, 22 Apr 2022 04:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625563; cv=none; d=google.com; s=arc-20160816; b=Y4sGCh7GajTI6KaXcQoHBoTEGJG71QgKV6n/EdR0hAESnpxBBTUC/SPojJfqRL2EF+ IAJ4rgKeEjSTLM+wcO0I2UNrapn/LmzpJo0ZHTywO4d/6GJ62TllJBWRfGowFJqtGiTj nR5r0CrDVoPebJPZLK5rOibLn3JcR3H/lFZs9jvAzowMjG7wUuq5IaYSjcmTg0W4D/PK vrsEh0KTdR6AJsXMnJ2Xm1ylWqmt5IYZj3azTug3SCc53qhSbOyE9jGWDXK4dJ1K7Esf OJEDLx5M1ivkoobpmHkSqJowwdpjVWFNXE9ctQe3gljqI9E7NWbq7Nu+mpjtrLshiKDP 5LZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=XMB2cuJAMepvczrd8k6H1C+FfGlgxfpWHFi4NbZyvtk=; b=C5kSsuIn9WWZGYuKkNzPIF3cO60QOw3xglQyjQa72wBQQndVLwW947f+zHKdOqFHAN jvSmOgzhMpfmeApqiPLz5OdERXIzybTVFFSQHhD7d9Dq4VkM8H+LIoxBIbV26aE8Zcvw B2ZyC8jph1GKuHad+1IktfCswg+cqKToAHFVEbyqnNwbAry5nqof+UkekO+M53BR5wo8 DgqTCjMyO7g++fpm5ZVmh0RTooTdL0nH+BMk+eig0CzasH3jYkoccG54gYSZ4v7cO1Fz swg/Gc71FRabzxA8wJUqXpHQ236v6AWq5VjLlyIVopOOZ47HxKhgcb+Go3VdejvTlB5I IaKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQkCOTVE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v22-20020a05622a131600b002f352d9262fsi995816qtk.653.2022.04.22.04.06.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:06:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SQkCOTVE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr6w-0001ai-D8 for patch@linaro.org; Fri, 22 Apr 2022 07:06:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAI-0005YM-Da for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:26 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:33756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAG-0002uj-3q for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:26 -0400 Received: by mail-wm1-x329.google.com with SMTP id l3-20020a05600c1d0300b0038ff89c938bso4850292wms.0 for ; Fri, 22 Apr 2022 03:05:23 -0700 (PDT) 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=XMB2cuJAMepvczrd8k6H1C+FfGlgxfpWHFi4NbZyvtk=; b=SQkCOTVEJjf4QvNGEmezwwghpiaLVd2jQyJLtAzF/b/fXGT9oXNTkxqUZcgSsjakEd ZIQ6bonWeTDcTB8X/HswQ+zsnO6p+5f7Z9HuQvPYuZrNy/PLx4EAc3sTb//n1CM7BdSt fSsnepeLtOMlWgC80L1WJh3rDSSNvkP0VPRDroV+e75pkCHpddQejYLEK9l2dzJN3Shs kBc1eksNCBrEvxIW+tUKFF6lDTyaJ26LGwDH47EV/OnHUCRhS4olMCH/DjMv3iezHoQd 4DP9o+A+HkA/9BpmygMRnjRLcPdPRVy/GEhqHOAZnlImdecnZWdypqfjOo/F2tlVMEBr siqQ== 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=XMB2cuJAMepvczrd8k6H1C+FfGlgxfpWHFi4NbZyvtk=; b=3wCkf+Cnu//u+N705ndKbqGXe9kqZVlII/dBHPyjh9VKWBoHwlOa6L2w6YnwiArRYq /F/q367JItIm0ciT4x/gdF8beVygc8xAH0a1fJS/Loprek0eg1HOUuXl6UCOummbbLL1 bvgKvUGxk8jHMPp7WF6QFKIwgRXBlI4LLUDOJ0KBCYiw+N3Hy5Ggt6JJMPVEQ28MA306 AnKEi9IfKttmsCcZCsR8sd32Dx15ycEvVaFSQqolIlkSb5NMRna/mbSz37GEVURRSl7T r4EobnPDD+QVZ/HmaNPrVi0Io+yOCtpN6uYFTRa4QjI4qcdWoK7NTYXMrG6rlCMh0rNR +ALw== X-Gm-Message-State: AOAM5307NlEUG6pflODUi692ED4c7v40LLPkLoepAIp9NA7Go6lO5hV0 QPncsUqkR9INsnYcfSzU8m5uyXpabOsAEw== X-Received: by 2002:a1c:f415:0:b0:37f:ab4d:1df2 with SMTP id z21-20020a1cf415000000b0037fab4d1df2mr12283016wma.75.1650621922848; Fri, 22 Apr 2022 03:05:22 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 51/61] target/arm: Split out set_btype_raw Date: Fri, 22 Apr 2022 11:04:22 +0100 Message-Id: <20220422100432.2288247-52-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Common code for reset_btype and set_btype. Use tcg_constant_i32. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 1ae465687ad..13a3527345f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -128,29 +128,28 @@ static int get_a64_user_mem_index(DisasContext *s) return arm_to_core_mmu_idx(useridx); } -static void reset_btype(DisasContext *s) +static void set_btype_raw(int val) { - if (s->btype != 0) { - TCGv_i32 zero = tcg_const_i32(0); - tcg_gen_st_i32(zero, cpu_env, offsetof(CPUARMState, btype)); - tcg_temp_free_i32(zero); - s->btype = 0; - } + tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, + offsetof(CPUARMState, btype)); } static void set_btype(DisasContext *s, int val) { - TCGv_i32 tcg_val; - /* BTYPE is a 2-bit field, and 0 should be done with reset_btype. */ tcg_debug_assert(val >= 1 && val <= 3); - - tcg_val = tcg_const_i32(val); - tcg_gen_st_i32(tcg_val, cpu_env, offsetof(CPUARMState, btype)); - tcg_temp_free_i32(tcg_val); + set_btype_raw(val); s->btype = -1; } +static void reset_btype(DisasContext *s) +{ + if (s->btype != 0) { + set_btype_raw(0); + s->btype = 0; + } +} + void gen_a64_set_pc_im(uint64_t val) { tcg_gen_movi_i64(cpu_pc, val); From patchwork Fri Apr 22 10:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564822 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp368391map; Fri, 22 Apr 2022 04:13:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAPs+L5SCmM5OhkLeop6khz01NV5x2/+c5ouoOlw/Ivu6npn+ndJ9fueA3LI0P0Jiyo7RM X-Received: by 2002:a05:6214:4103:b0:440:e4d1:a2a0 with SMTP id kc3-20020a056214410300b00440e4d1a2a0mr2863231qvb.42.1650626008475; Fri, 22 Apr 2022 04:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626008; cv=none; d=google.com; s=arc-20160816; b=OO/WMMs1Qv/ibylVSgem7e5RBuirXQNhlnGK/w+oaf9Qajj3EsTkcBrvbDvlitwfHZ dqdspFBwfCSH7UBJKmEzKJsKHyd/gWy0v6sHl+7WJoWuahfGAjOXsbjHfXdpA9KZaKUc DMUiLDm0JSOhKXeH3Wj2QjSOyvHXC3zFd/fI55TedoYyLGz8V0ojJjL/IZxHT8Bm2tKd junqvd3WyApS9GP51fXjTisDge7/A+9DFMX0xhmQGxmeR0qEWim6NK8HCuD18rUX/icX K/kRexXxP8Z4SaX8Hv7oFmOMfrw4iEEHri8AiBs601HgkyBHJ2wqCiSSx37I4oMtCzyM qSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=eR7NYfDsDp0GzWfno2vjeiAO+oaOfi4kY26EnfhTTNM=; b=Q+UPRM83Tajv8PjLhTd79bYSiwem4G/Vf6D5vbF05EdLIHDEkYStm2q9rfpaTuDI60 gxo5B0Yw3vHL0Af3NyqNPCE3sLhVKlZjOCKfYEml09DFwjaCRpgQwoHZ2K/D8IuvAhfo /c0nmuhnNjWdr67SWadm1NQKB4V/OGxFWxgEOb7JP8FBAWczlThbfB1Wy2efKL1CREgk 2p8nwilCekqRg6gkGaQ/+J0D1qSqnjiXsBjaakX3LntJe/QFz7+wP/FxY8R7aQMzKVZz X0yihzFzjjOOfv++f2Z5jaQ6i0YHScpq3FsR43zzqxJpk/lpvcBSRYhkaiuIOuy0i0Ls hoPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qcUYVdtv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 17-20020ac856f1000000b002f205019ae9si1943590qtu.747.2022.04.22.04.13.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:13:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qcUYVdtv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrE8-0007tZ-05 for patch@linaro.org; Fri, 22 Apr 2022 07:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAJ-0005aF-45 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:44918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAH-0002ux-5E for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:26 -0400 Received: by mail-wr1-x432.google.com with SMTP id b19so10282073wrh.11 for ; Fri, 22 Apr 2022 03:05:24 -0700 (PDT) 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=eR7NYfDsDp0GzWfno2vjeiAO+oaOfi4kY26EnfhTTNM=; b=qcUYVdtvDpexnRzsdu6RSVZCwmGH9zIscqLuCSbFWZ0+ZAtlBfmHMQpASWQ2AqdGIh qpFSrCXhhfTImz/ISjI4dkq6vnGj10JlLRasnVPpjQ00EZqo7X6scssNeGu3TuHYjyqR 7Zzf/gx24CKBKNlmOCoB6iKu2vbYVNy4O+TYLfvQP8+ZsTH6SMkgYdnZgueBrW1l+rvH H1TGzpxN07/xxvyJ1WyLZh8lDJybOuHRcZlPoPvAQ5S3Qo61gCyDk5AS6p3W3sLOaibY CTPtfXG4p6zdhXfZmVPT0R0xSoj2N7Sn34ooMMZQy8+US6JxVYsRfNPXsPPA3EUnRpw9 TgVQ== 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=eR7NYfDsDp0GzWfno2vjeiAO+oaOfi4kY26EnfhTTNM=; b=Iewx36SJbP3gbm0/yNe6dTX1XH4MmDUpG41fd4AP6dAJoNveotppHkjEWqB3MsjbZG f6R307wAa5GN4+RKW6RK3skUGHgoVAKkU8GHbK9fwyi3blhUKDJsqgsqZxGkUgC/K5sp 0NjFg7hjCCRbQ6xxColNcdVDljOA0dDasOB318FUZTFlf0Oxh77L0yLE0BJEg5V41Pfw Jo0KN5SlNzR9Z4RrPUvNbcoS5A6SRrRDHptcNtX1n9TGOaX/pgIuajM6fynQzwE1VFh2 2MaJ/TUfnaZXXU1x7U5DLMNPVNBqFMOXnyFaJsQ0aR2OOT3VHQvEM1bNLMcRVL7xqaRI oJTg== X-Gm-Message-State: AOAM53107g2txLpbWVhSqmW8mCBAbwDU960ljxaRJINRHVnk02WlpM8E 3Ne/yzzeeY/A2tFrk3eCGPBBNb8sXtKkQQ== X-Received: by 2002:adf:fb48:0:b0:203:f986:874a with SMTP id c8-20020adffb48000000b00203f986874amr3092370wrs.614.1650621923733; Fri, 22 Apr 2022 03:05:23 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:23 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 52/61] target/arm: Split out gen_rebuild_hflags Date: Fri, 22 Apr 2022 11:04:23 +0100 Message-Id: <20220422100432.2288247-53-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson For aa32, the function has a parameter to use the new el. For aa64, that never happens. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 21 +++++++++----------- target/arm/translate.c | 40 +++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 13a3527345f..adbcd999415 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -341,6 +341,11 @@ static void a64_free_cc(DisasCompare64 *c64) tcg_temp_free_i64(c64->value); } +static void gen_rebuild_hflags(DisasContext *s) +{ + gen_helper_rebuild_hflags_a64(cpu_env, tcg_constant_i32(s->current_el)); +} + static void gen_exception_internal(int excp) { TCGv_i32 tcg_excp = tcg_const_i32(excp); @@ -1667,9 +1672,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_UAO); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); break; case 0x04: /* PAN */ @@ -1681,9 +1684,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_PAN); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); break; case 0x05: /* SPSel */ @@ -1741,9 +1742,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_TCO); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); /* Many factors, including TCO, go into MTE_ACTIVE. */ s->base.is_jmp = DISAS_UPDATE_NOCHAIN; } else if (dc_isar_feature(aa64_mte_insn_reg, s)) { @@ -1990,9 +1989,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, * A write to any coprocessor regiser that ends a TB * must rebuild the hflags for the next TB. */ - TCGv_i32 tcg_el = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, tcg_el); - tcg_temp_free_i32(tcg_el); + gen_rebuild_hflags(s); /* * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition diff --git a/target/arm/translate.c b/target/arm/translate.c index 1314406b193..4d7886fa853 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -351,6 +351,26 @@ void gen_set_cpsr(TCGv_i32 var, uint32_t mask) tcg_temp_free_i32(tmp_mask); } +static void gen_rebuild_hflags(DisasContext *s, bool new_el) +{ + bool m_profile = arm_dc_feature(s, ARM_FEATURE_M); + + if (new_el) { + if (m_profile) { + gen_helper_rebuild_hflags_m32_newel(cpu_env); + } else { + gen_helper_rebuild_hflags_a32_newel(cpu_env); + } + } else { + TCGv_i32 tcg_el = tcg_constant_i32(s->current_el); + if (m_profile) { + gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); + } else { + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); + } + } +} + static void gen_exception_internal(int excp) { TCGv_i32 tcg_excp = tcg_const_i32(excp); @@ -4885,17 +4905,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, * A write to any coprocessor register that ends a TB * must rebuild the hflags for the next TB. */ - TCGv_i32 tcg_el = tcg_const_i32(s->current_el); - if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); - } else { - if (ri->type & ARM_CP_NEWEL) { - gen_helper_rebuild_hflags_a32_newel(cpu_env); - } else { - gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); - } - } - tcg_temp_free_i32(tcg_el); + gen_rebuild_hflags(s, ri->type & ARM_CP_NEWEL); /* * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition @@ -6445,7 +6455,7 @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) tcg_temp_free_i32(addr); tcg_temp_free_i32(reg); /* If we wrote to CONTROL, the EL might have changed */ - gen_helper_rebuild_hflags_m32_newel(cpu_env); + gen_rebuild_hflags(s, true); gen_lookup_tb(s); return true; } @@ -8897,7 +8907,7 @@ static bool trans_CPS(DisasContext *s, arg_CPS *a) static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) { - TCGv_i32 tmp, addr, el; + TCGv_i32 tmp, addr; if (!arm_dc_feature(s, ARM_FEATURE_M)) { return false; @@ -8920,9 +8930,7 @@ static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } - el = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_m32(cpu_env, el); - tcg_temp_free_i32(el); + gen_rebuild_hflags(s, false); tcg_temp_free_i32(tmp); gen_lookup_tb(s); return true; From patchwork Fri Apr 22 10:04:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564813 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp357709map; Fri, 22 Apr 2022 04:00:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZz0oQOZpiBi2xJgulZg/M6tUkgba5kmJMtF8sr5W3hu3RgLgdNgKmwn+HnmzvxwptAzYB X-Received: by 2002:a05:622a:11cc:b0:2f3:4f1a:fa0c with SMTP id n12-20020a05622a11cc00b002f34f1afa0cmr2629097qtk.441.1650625254590; Fri, 22 Apr 2022 04:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625254; cv=none; d=google.com; s=arc-20160816; b=ozN/XA3J7hGOIziM61IR2brwj7RGUIJm3cBp+lTzgWKXtd4mnfehQ4SLIYIYGXgCc8 9RvFgONKweIznGmXIpLFgnWWUDlQSwu9Bqbs7Px2qoyEDUoLPBc5l/M3MFuWzDwkQ8jL kDoZ2pF9zO/ygs5jjD3zEE/hy1CGqWwIXH8WMw33lYql41ctShq/poZT+hX76iqpi5+g 64gV1We+xgv0uJvwkw6QSXkHL3g/z4bmacJHQ5o+K4Msu7GtCJ0ELzyVY+AyQyLdutS4 E1AF2qIkw5M0bZRcpdpq+DWFRB+X0jd8fbJczoA4LoqSRVKHQ3iYlI6yovLiZzEQfNew /NNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7SQzC5lAEqp5CMAsa+8Njn6FSg2/QmhMegZg1nRW8BE=; b=bCD/Uec8ZWEoCjl7LTS+ydWtJc5FLTwFK+4QFp1Ebzex6UVMsRUiXygR8gd3Z5lToW s8HtLxBumiFDH73s5zmAJwL+XhQ2QE8pJ9N8WvemVNo80EmyU7c9IfNzaL7pqzxltaPm S4nlvSnr7gLJUOh9WX1izVWW4bydp5Kx2uOe5zvQicChYYsBsHhjSTfgXs57+EVyzo/h uQm2olq1kErbA7FbEYppG70tq6e0B7SIrio081ImUqh3zQ7Rvee/Ms4nt5OGAxWATtgY I1BqLL9qJv7m+iwEIthuPy/G70Y6HWbKTDpesM2rLYYyFo0wlKwlRMGOBEbysMuaDbev T6nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r/2Fc9tM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 9-20020a05621420c900b004463549ab85si2194948qve.564.2022.04.22.04.00.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:00:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r/2Fc9tM"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:32870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr1y-00077q-68 for patch@linaro.org; Fri, 22 Apr 2022 07:00:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAJ-0005aK-Lw for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45966) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAH-0002wI-Ur for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:27 -0400 Received: by mail-wr1-x42a.google.com with SMTP id w4so10279697wrg.12 for ; Fri, 22 Apr 2022 03:05:25 -0700 (PDT) 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=7SQzC5lAEqp5CMAsa+8Njn6FSg2/QmhMegZg1nRW8BE=; b=r/2Fc9tM+dO9ptE5xAcfNqAZqG/+s2l3NcMwagHwZncxYBdZ+2ZJNVAOoe0/ZGVcbu Q2DrefOWE4mrFcDBFEVw0Py9oZhajDjiIIDTkcshOxPvupV/NKAWS7Po8++vbHebMCsR Q1FC8Ybxo62JaMXdoyB5auLBzlFlFKze3LfgTbUpKMjX0B1ysTjx5MCJG87jOsmx2djY OhbEmD9OouzdNc9u1bV5LybEcfhcw4w9j/3WAp4jSg769cC6Tu/WmVOVWiZQxwfM3eMH QHALCprCrDrOecdp2qYmdi55cmctDnhCVlke7AiU/hb1SLswOik5kx6rWIF+30KzdlVG QBDQ== 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=7SQzC5lAEqp5CMAsa+8Njn6FSg2/QmhMegZg1nRW8BE=; b=sSBJgZsmI3qQ6i0GgjF8jJk6Wd5eRyNTxz+dpCU9Jb60sXkNcMElTj9wGTxM/fxiIo vGaH1AOODnrcoOF7iAlhj+wvHETEIHiwC1+/6IoiCCY/Qi4J8R72ce//U+df3sM1Otea d9ygdgCuykCUDes4YwGQZ5bXRZ4opM7LWEhYLPEhjIsfNiLNVln5NE+FYKzdLUclSXwe rMVchohRb617UDLh8zdYFNshPNi5wsCDcLl333khU7y5N8U6v4gxoio0ctCIVj4gVadb WWMQ/B4i+OOYCRhD/L/aX5QBDLcwt8R7fc4ezMxqRw7Yz//D67CuEkgmFYmDy6AyEgoh BReg== X-Gm-Message-State: AOAM531aYxWXYq1/Pb9K2fYhrxjUhAHe9xRlyE5tamhvlgBMHy/p0fZ9 i5+JBLiiNUkaHnv6LsDCqmVyb2iZFrnuig== X-Received: by 2002:a05:6000:1a87:b0:20a:7ea5:2aef with SMTP id f7-20020a0560001a8700b0020a7ea52aefmr3037461wry.666.1650621924610; Fri, 22 Apr 2022 03:05:24 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:24 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 53/61] target/arm: Simplify GEN_SHIFT in translate.c Date: Fri, 22 Apr 2022 11:04:24 +0100 Message-Id: <20220422100432.2288247-54-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Instead of computing tmp1 = shift & 0xff; dest = (tmp1 > 0x1f ? 0 : value) << (tmp1 & 0x1f) use tmpd = value << (shift & 0x1f); dest = shift & 0xe0 ? 0 : tmpd; which has a flatter dependency tree. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 4d7886fa853..0c9d50d48df 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -552,16 +552,14 @@ static void gen_sbc_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) #define GEN_SHIFT(name) \ static void gen_##name(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) \ { \ - TCGv_i32 tmp1, tmp2, tmp3; \ - tmp1 = tcg_temp_new_i32(); \ - tcg_gen_andi_i32(tmp1, t1, 0xff); \ - tmp2 = tcg_const_i32(0); \ - tmp3 = tcg_const_i32(0x1f); \ - tcg_gen_movcond_i32(TCG_COND_GTU, tmp2, tmp1, tmp3, tmp2, t0); \ - tcg_temp_free_i32(tmp3); \ - tcg_gen_andi_i32(tmp1, tmp1, 0x1f); \ - tcg_gen_##name##_i32(dest, tmp2, tmp1); \ - tcg_temp_free_i32(tmp2); \ + TCGv_i32 tmpd = tcg_temp_new_i32(); \ + TCGv_i32 tmp1 = tcg_temp_new_i32(); \ + TCGv_i32 zero = tcg_constant_i32(0); \ + tcg_gen_andi_i32(tmp1, t1, 0x1f); \ + tcg_gen_##name##_i32(tmpd, t0, tmp1); \ + tcg_gen_andi_i32(tmp1, t1, 0xe0); \ + tcg_gen_movcond_i32(TCG_COND_NE, dest, tmp1, zero, zero, tmpd); \ + tcg_temp_free_i32(tmpd); \ tcg_temp_free_i32(tmp1); \ } GEN_SHIFT(shl) From patchwork Fri Apr 22 10:04:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564816 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp364963map; Fri, 22 Apr 2022 04:09:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmqX+uKsQxQBo77izUXB2yqsIc72adJHndlRL0aSBzB7A84xpHv53mIm+jOMiiBFDz8Bb6 X-Received: by 2002:a37:62cf:0:b0:69c:a334:f5ce with SMTP id w198-20020a3762cf000000b0069ca334f5cemr2218792qkb.783.1650625744593; Fri, 22 Apr 2022 04:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625744; cv=none; d=google.com; s=arc-20160816; b=kb7R62QN/YrOnoYH0g9/WlakGOs+q/vwzV8U5p4hxuBz6P2JuGDiByhIYTAe3ANpEj mP6BDuObehvXZknyDPYMvqNbF9/hHYI9ZIIjhEVpnwOiZr7OJM6MHCdl3jUzF5CRw4l4 izonPyLrEgKGha5UJkZ4+jP1Ge6Vi4OsPge4M1eTWTWgbOmZ/eyoMnqlPUs3Uznl1MHV theRqZx3/EhSjXELFZodQFjc3bjTMYJs+8KNzZSuPwB1eOVoM2J7PAQlke7AdXr5liod DkW5X9JdxtiTSFrw/uP3l/7MuSNeFrGcvG9ztwST3nZyCWF/IrvcQLdCypjX26rFivVy Ag+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1C1mIsbiB+RmAWojouCaP2qiHomdsW424z2/fuwD7jI=; b=OtqLK2QFWdjzjdKTFinW9S+XpNUlfVVQ7Lmq5GAXnkoYZK+AewfxRLa/kgzL2R/Pql bncBsGxdNFEr3hiCqi8IjfABEI6wGPr3k3s31Jg5vHtX51Bk+q0SJ2qAzyh9L8VFwPdb OR2bbxokypxfn2GClm+BFqp6r9L4s5lS1aD5kyDfuptO00SECnEaHZjtQecAV9h5JnSs 23fVTNReHQCYibt6Xtn008QNPf7Y2VPyKMBSKiIFDTxZFb0Q5DjXSnCQbbHN/UcQ5mcV ae9CrGW5pC48a0+WRs2WNCpNS+mq5Im78N0wndAS/EAixmjuX9BLYXzQQYmZc7u2aHVg KIgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WLndpUSY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iu13-20020ad45ccd000000b00443e7f37b05si2223870qvb.285.2022.04.22.04.09.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:09:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WLndpUSY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhr9s-0005nK-2b for patch@linaro.org; Fri, 22 Apr 2022 07:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAK-0005aM-Fu for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:34693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAI-0002wU-TZ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:28 -0400 Received: by mail-wm1-x331.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so4692467wmb.1 for ; Fri, 22 Apr 2022 03:05:26 -0700 (PDT) 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=1C1mIsbiB+RmAWojouCaP2qiHomdsW424z2/fuwD7jI=; b=WLndpUSY3PrjvdvGp2hz0Uu4lK9/Z28LDPmYshVRNoPFu9vagmNiCcxFjEZn2I1CqX e2qBVps8euCbVt3TF3vMktFW6hyzs2vkdNTxuQ9s4eRc6RBUSWA46ylTB8AuSZcTq0GC 4Hjl+pCdQDpSQ9hFLmjFIQHZ7rA+KzPdBptJU+cW+Uj8YGi0im8tpTBs4w1ad7vr5zj8 3Roh/yLQ34cN78NRliji3XRAIqchgT1LAodo5OOGyU1H4yjfUve/Om+P3jJ6xMysPs8M ikRKV30TQ2dy7ZJc5mXG7e/eb2dM5jlgS+5ufQ9S0/t9vLqeTniD1pkpOnrGmxlUizds zNVw== 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=1C1mIsbiB+RmAWojouCaP2qiHomdsW424z2/fuwD7jI=; b=rY1pEZS6F8chwQVnOOsZhaJOTfoBIp6WeDinU28BbEzS1eorMj7TkxFcqhajbqNnDe YflCpYsVqdlGk4j/BaAUnVLLHdx2HuoJnQMRDnjtcJK3qK28F14GhcVxxYNOhoooeaCo bfeK/H+gZriuhDDImsL+a5PpJVjjLgio6P1TZyasEzLKZBUTp1EBAgqr9lcw6iWA02sm l5ZI2LfbQiQrqyzsdOL/RK/j3Opr+HRZRU5mg4XZB/2I0EcruUCaED6LkRfcejKyA7F6 aWyE9GCXvguAVZTOIOHQsiWOn8Ap6P2FomEDEzbJnzkCpQvrDBW6oxX9EYW9YRrdL28/ z9aA== X-Gm-Message-State: AOAM53246y31Q7iLNtOLQI6KaXRPLwT9+azw0dI4UuOa01B2WQ9xXDPT l28oh9hnFQkky+hn5Re7NZwSS/szKsxKXg== X-Received: by 2002:a1c:c912:0:b0:37b:e074:dfcb with SMTP id f18-20020a1cc912000000b0037be074dfcbmr12363110wmb.161.1650621925491; Fri, 22 Apr 2022 03:05:25 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 54/61] target/arm: Simplify gen_sar Date: Fri, 22 Apr 2022 11:04:25 +0100 Message-Id: <20220422100432.2288247-55-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use tcg_gen_umin_i32 instead of tcg_gen_movcond_i32. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 0c9d50d48df..086dc0d3b15 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -568,12 +568,10 @@ GEN_SHIFT(shr) static void gen_sar(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) { - TCGv_i32 tmp1, tmp2; - tmp1 = tcg_temp_new_i32(); + TCGv_i32 tmp1 = tcg_temp_new_i32(); + tcg_gen_andi_i32(tmp1, t1, 0xff); - tmp2 = tcg_const_i32(0x1f); - tcg_gen_movcond_i32(TCG_COND_GTU, tmp1, tmp1, tmp2, tmp2, tmp1); - tcg_temp_free_i32(tmp2); + tcg_gen_umin_i32(tmp1, tmp1, tcg_constant_i32(31)); tcg_gen_sar_i32(dest, t0, tmp1); tcg_temp_free_i32(tmp1); } From patchwork Fri Apr 22 10:04:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564820 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp367850map; Fri, 22 Apr 2022 04:12:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtUvFp19PnvPU3gwHAc2Pm1LoEXi650dmINryN2FCXhd/LxFbCG5hLpIY12JW28GQ8ygFn X-Received: by 2002:a37:86c2:0:b0:69c:6dd:e4bf with SMTP id i185-20020a3786c2000000b0069c06dde4bfmr2235830qkd.105.1650625963215; Fri, 22 Apr 2022 04:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625963; cv=none; d=google.com; s=arc-20160816; b=jnHeJUIOX2DmV6m6PoUKPT41Wz3UMgUPQezRoTS9mEPDhzioaYX+9w+hhq91Qkq3MN P/klt3XQLfwbj9xGycs01+dOYey3A6Il78k+bjH/KMotnKeQzPZY2gXu4S7VoQcbattC mJZz03uL1EToTYyj0MzWYkIrazg3Cn09rfvErXdjO6ZWNi4pESSfTTRr9WguIwPTPU6p dGzn0rtfpWUcI/Eh9Nc+pUMO8/Buq4+92vGKXaa9Rbo10WPgsiR913tKFqr7yzEw9TvJ VoWWrw2AB8Ur9yx7EJCu+/vBf6BISdAd2PEdvYBEYuYVRo4ltfrJmRbGZog4BLseSewu FMDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Qx1JjAG3lYRZ0uJz1kolQCY/eQ8GjTyEi5vBbytSLK0=; b=k6/sFCb4SBrtqL7PRTG/v45PCmaZplVCqe6ONplXfSJmsynB0m/MzDtJKeZuDJ1gfh h9px5glm7UOkAt5kfNASZiYe6KSBwJRfIligrEizz3rEcBkuWV79q4jtHZ30JAVW2Rvu zs9FvDx2eu7pxC+Co2Q5Rn3Q9x0w4YOwgi4PHT5QOPifOYzv2FBBjVMTPkeUksRtL7YP X00Nn666OMhXVcqJmUGg9n5/VM2QJXA3YRgFkGhsJXdxrGHkxQh2z7x7Dkvol5K6LE+b zpZn1U/lI6Z2qooQMrvqJZxgLKMhtSzpGZAKebgGiswl3NNfMVofrOwsau5Q8/sm5ko+ gpCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iP9ToNzI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 20-20020ac85914000000b002ebf03bd986si2108627qty.312.2022.04.22.04.12.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iP9ToNzI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrDO-00057a-Pi for patch@linaro.org; Fri, 22 Apr 2022 07:12:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAL-0005aO-AJ for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:38725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAJ-0002wm-NO for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:28 -0400 Received: by mail-wr1-x42b.google.com with SMTP id q7so2682417wrm.5 for ; Fri, 22 Apr 2022 03:05:27 -0700 (PDT) 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=Qx1JjAG3lYRZ0uJz1kolQCY/eQ8GjTyEi5vBbytSLK0=; b=iP9ToNzIPeJFtMRcC9Y5TYJ0M08wbS+1GNabsx2ZWrteJ0gwbkYp6VkbPjVjCmcA2N m8QGTMU2CEh7my8VRMKWPd2/geokc69dnMwXRfqHamWMsBHM8VQz48k8PoTjhUKvLJGf OvUmKUuUcN9VJuzdTCgmdDN0a15sRFtt64jYU5qYNIKhg4dfBn0HUf2LRxSsMcfqTcXc JCnizLGCKu3+Fpf5Y9i3YCcBRykaX87Ld4xu20zZRZ83m07ZhKBm80f5F6KmPEvqeQe6 hgZ6z7MdApdBJRBPZHfIcnkh6fIn3z2h3ETgNVLwKPMZDaTD3um/LqUKOSsQd+6SpVJz z3fA== 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=Qx1JjAG3lYRZ0uJz1kolQCY/eQ8GjTyEi5vBbytSLK0=; b=KJ1dnNG2zaw9ResRBTnu72Uf8ToT+nBHO48KSOL/3VkCujicypxMmS/iv93c6Sf9PV jPQ/k+s0837kMdMMPWAnDqWpXXjZHNqkcBtI01iYS6CzBkEW1MmGEcO6+X1E797GfmQk JsX1amq6B/p0UV8/claofMfxnL59URK0BAbvzsTRIq8RcqpYMS+gOK5M4euuFjanKyrK 1ply+mfGWZA8QlsMRtS9wRHGPq1FuzvWJmu++FeDy5vblQRC6gO2q53JV3d4Xjg2h+ff mQP/gCJyh6b+pOUMlPqnkID04At0nlcbw2HjmkBEURFlnNYTJ2xSHct85NfoKjCCjW// 2qJg== X-Gm-Message-State: AOAM532nhgg7WfBXz7zD3ASWgN5aKv3mxIm23OoxIOzIx4ZAkPKhh5fI yicfPPyKOnPRzZdewSxnBDrbYodQVphfiA== X-Received: by 2002:adf:ed8f:0:b0:207:ac33:801f with SMTP id c15-20020adfed8f000000b00207ac33801fmr2981950wro.453.1650621926405; Fri, 22 Apr 2022 03:05:26 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 55/61] target/arm: Simplify aa32 DISAS_WFI Date: Fri, 22 Apr 2022 11:04:26 +0100 Message-Id: <20220422100432.2288247-56-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The length of the previous insn may be computed from the difference of start and end addresses. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 086dc0d3b15..d09692c125b 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9870,18 +9870,14 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* nothing more to generate */ break; case DISAS_WFI: - { - TCGv_i32 tmp = tcg_const_i32((dc->thumb && - !(dc->insn & (1U << 31))) ? 2 : 4); - - gen_helper_wfi(cpu_env, tmp); - tcg_temp_free_i32(tmp); - /* The helper doesn't necessarily throw an exception, but we + gen_helper_wfi(cpu_env, + tcg_constant_i32(dc->base.pc_next - dc->pc_curr)); + /* + * The helper doesn't necessarily throw an exception, but we * must go back to the main loop to check for interrupts anyway. */ tcg_gen_exit_tb(NULL, 0); break; - } case DISAS_WFE: gen_helper_wfe(cpu_env); break; From patchwork Fri Apr 22 10:04:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564825 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp371404map; Fri, 22 Apr 2022 04:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHQsEZpKwBy6l3ccdrU1zDDFKl6TAp9Bqv+PZ0UA3gN9ISxdbZSjK2aHZLoZN3tuJRn7lT X-Received: by 2002:ad4:5c4f:0:b0:443:fd5b:b7ba with SMTP id a15-20020ad45c4f000000b00443fd5bb7bamr2889017qva.0.1650626265967; Fri, 22 Apr 2022 04:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626265; cv=none; d=google.com; s=arc-20160816; b=dGjC9Ai/D0TBXuMzZ0gE/2lgW+dWw0k1+SMPqby7/rswNnANRPDHVmIedDbk+AEF4w lKnYfBCjJNrjZB/BbYc1YC6UxiW9q5u0o9HlMORSiTCGes55LDORB9FlPt1GzHsnbZ81 PBukWVNDqGWwAASbtpo/9kMpadPYQBBYc6H7sDCB4uSxlQ/FuGTrfVcbX++HoK/mNl2X I3umVGDajAGV68hEiAaX20fCkpsmFVGAzp0BGXxkkwrh2RcEQLfKKba4wv7ntv6B3fkc qdYCpwpQJctAkCipP6b7++uzSeeZfdHZWxjz+o4/oYDrnjTxjM3IFmLZW4I2aJztim1+ 7YSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=h5cbU++jOseQZg+uHAX8kICA8i+7LryH4hXcFQtNTbo=; b=Th5Yd+cCvpuFmogded/UkYTfH9vIamQdJTIgZYVroqQvFZCY8twA7poNPY5bHlb0Mf 1oa70WKSHU8ECVy4invJuGsGXhtN2nzkF3pKXAKT/3Ss6bkPwaUUbv3iLBBwbxwpFPT9 9fGM4PkLuh29fLnQ+gUQqpv8nrgsfvYV2FJFcM0+U0P/rjpMT2sVurSn0GqBEk6SfDSv XvLrMpXaBNcgJemoSDUGL4YbMJu3iuveHxm3ATG2Clj/wbXqwnx0MoQ82BoZ7yXMt4sd 5yy8nUgn4ToafUsrL3vRBHq36T2p1Qr4nlNIMTKSJq7Z0JZWhJbdwselg9HyHcBWiXDZ qIMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBRGzsiF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t29-20020a05622a181d00b002f3572bb351si769078qtc.387.2022.04.22.04.17.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBRGzsiF; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrIH-0005Yu-EO for patch@linaro.org; Fri, 22 Apr 2022 07:17:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAN-0005cB-6R for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:32 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:40517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAL-0002x4-1b for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:30 -0400 Received: by mail-wr1-x42a.google.com with SMTP id e2so4044207wrh.7 for ; Fri, 22 Apr 2022 03:05:28 -0700 (PDT) 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=h5cbU++jOseQZg+uHAX8kICA8i+7LryH4hXcFQtNTbo=; b=TBRGzsiFrgB293Bb0K7JvRw/MbMBJ1QIpq2AgAdaLa17cJhVTbMH4Z5LelkUMMOxcr CEGXsB7TWyqRbZVgXY1XppE7AqyzMrY1RlpJryzugggy2j5qzYSdPduWI67jBgqzg02j Nr1MqZDLzg2FL9ljJ0/FAmTJmOCMOlOPP72B3B7tcQLtct7ACiq7TeJpkdfS5iruNOIO wYGuUccromIgEXX1EPYq/4Y7yAXh3HBiHPMiO/pv8qRdtSLLn+EI9+3J4AkNPQ49VPQo G8dwbcTdza6anrt4kI5t9N8gLFNWi1SSEhQLNZIy2Wjo9MIkU7k+zhNmonMrAqe7Kf4T 5uOA== 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=h5cbU++jOseQZg+uHAX8kICA8i+7LryH4hXcFQtNTbo=; b=cc2vF+SpyqimcAsyoFSrk3fye/Hy8BzWTdWvDW+k6yy0OelBKcXhDJ2M296d7YRb3p BaKhF7HYvjK5BZRoW3d+I9QC9vnEkHjaXcr5iclXYVLKMnX4hqrRNKvGS2dfEgpAwVg5 +ddaXQ1j2ghhEXXysjJirZxHsaH5kJa68tsem3ZzrkJlHtv/8AB9JLdoTFGyZt8x39mM 1JwzmLvq7kCwa6m56YceRaZNJYq8j0MwZm+fQyHSXSobJM3+YJVYGsILfDMpUivvwwlm dMlkTXl6BJdZSeJmuqjQbVTxupyDSLMi4o7Qhm13o3yt498pXMdNVcyWXS9r4vK0TEs9 BdoA== X-Gm-Message-State: AOAM532RjMMQ/Bg3NDdSRXWiD8qn85ea8cxEKUUmtz27Wune0udd6tuF JKBV5QiHPlKO05fIG2DQbilVS59FxMwNOg== X-Received: by 2002:adf:d1ce:0:b0:20a:992a:3b54 with SMTP id b14-20020adfd1ce000000b0020a992a3b54mr3007286wrd.270.1650621927254; Fri, 22 Apr 2022 03:05:27 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:26 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 56/61] target/arm: Use tcg_constant in translate-m-nocp.c Date: Fri, 22 Apr 2022 11:04:27 +0100 Message-Id: <20220422100432.2288247-57-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use tcg_constant_{i32,i64} as appropriate throughout. This fixes a bug in trans_VSCCLRM() where we were leaking a TCGv. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-m-nocp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c index d9e144e8eb3..27363a7b4ec 100644 --- a/target/arm/translate-m-nocp.c +++ b/target/arm/translate-m-nocp.c @@ -173,7 +173,7 @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) } /* Zero the Sregs from btmreg to topreg inclusive. */ - zero = tcg_const_i64(0); + zero = tcg_constant_i64(0); if (btmreg & 1) { write_neon_element64(zero, btmreg >> 1, 1, MO_32); btmreg++; @@ -187,8 +187,7 @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) } assert(btmreg == topreg + 1); if (dc_isar_feature(aa32_mve, s)) { - TCGv_i32 z32 = tcg_const_i32(0); - store_cpu_field(z32, v7m.vpr); + store_cpu_field(tcg_constant_i32(0), v7m.vpr); } clear_eci_state(s); @@ -512,7 +511,7 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, } case ARM_VFP_FPCXT_NS: { - TCGv_i32 control, sfpa, fpscr, fpdscr, zero; + TCGv_i32 control, sfpa, fpscr, fpdscr; TCGLabel *lab_active = gen_new_label(); lookup_tb = true; @@ -552,10 +551,9 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, storefn(s, opaque, tmp, true); /* If SFPA is zero then set FPSCR from FPDSCR_NS */ fpdscr = load_cpu_field(v7m.fpdscr[M_REG_NS]); - zero = tcg_const_i32(0); - tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr); + tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, tcg_constant_i32(0), + fpdscr, fpscr); gen_helper_vfp_set_fpscr(cpu_env, fpscr); - tcg_temp_free_i32(zero); tcg_temp_free_i32(sfpa); tcg_temp_free_i32(fpdscr); tcg_temp_free_i32(fpscr); From patchwork Fri Apr 22 10:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564832 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp385549map; Fri, 22 Apr 2022 04:37:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3EarAEz2ziT2ezlkFzTrYkv3V/y6ptVAzERlOGM2QxVFtiWbsPKl0Hjtysy5dDaVGJ8qs X-Received: by 2002:ac8:7fd4:0:b0:2f3:4323:7f91 with SMTP id b20-20020ac87fd4000000b002f343237f91mr2739976qtk.354.1650627467390; Fri, 22 Apr 2022 04:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650627467; cv=none; d=google.com; s=arc-20160816; b=Bmv7z5cERfi+oJBYuL6gsi/E+DxYRaDPtWYkFE7yY7Mnp/zFcx7qOZOBiIY+P8iMvK A6Ll+Lqknq15+4uDq+3J1ssyJiTv6WejgnvPWcpPNoG5VOO22aFlSvEcMmwi/nBfaLnE uTtfAuco4+yqjg4WC+22hOFXGTeB9FpO+uySTGZUxlLb7gphqQTpSfRReUGDki6CwY8r nEM+DZE869G1gX7Sw+lQfheRlts5zl5q5xSEmGnqEczmx72HcRNlnvnUh69kiKfx98m2 bjHLi9c1BVQlSpuV/1cM008bpBw+rbV2Epvw9vocurbAEj223X56pCctDx6nHE4Yglpb kZBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=yoqGxrEuo7I20WDwXqzVyfNrC/olOohOaVj3LWj1G34=; b=0EiJyqS0+4fEG9VzRtAUH5li/eVF3p0Lr0UvGUNzuy70Nax5ieIIugp+L9Kd7oqHcD Lct0c4XvPwpv37XzcHVYx8FVEW29Nuqh6ZjRbNPGah4VnLtK/NJV27QieTYfUHalxIcH daFyREMCXn6vzDeV2neeQWgxuwegPxxFePlU8+ebdt6Eh38iOXIb/wqpVCwO4E7lDLFe WxA7mlmNQ5/QgjW+Migw8sI0QnHyZR7+SNVx8UXraFQ8tK7d2vYa8yyYrFrVlLaFJ5Yo Hg9HjGlkg2ezwOp1UVChFMD2QTkVoelrV2QGcT4G8EnHK+0ctW5O9a+hSCo3+rbWljOm XMyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s60jTgZa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jv8-20020a05621429e800b004465d7c37c5si2120743qvb.104.2022.04.22.04.37.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:37:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s60jTgZa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrbe-000571-U5 for patch@linaro.org; Fri, 22 Apr 2022 07:37:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAO-0005cG-77 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:33 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:38899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAL-0002xY-Pq for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:31 -0400 Received: by mail-wm1-x330.google.com with SMTP id r187-20020a1c44c4000000b0038ccb70e239so7619145wma.3 for ; Fri, 22 Apr 2022 03:05:29 -0700 (PDT) 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=yoqGxrEuo7I20WDwXqzVyfNrC/olOohOaVj3LWj1G34=; b=s60jTgZao/qCB51Yz2M8VR4RCNei7e0duKPv7WMidFV3SDwLadDY8myMpxz9X7SnnQ tvh3ok12Psm88zMqlHXaCdWZA6sSXJsaaceA5U1LTDcKG2xW7ztcTTEPTChBt6JXH4Ow 75tGDBXwnVPxG5iTnCknP9ioJw1mOZ3TTeC7FNDUKuXwxtzIezFRA3OdmkR0mXMYx8I8 VaWWb5BDUTTWNjEL+KQTCcpZ/U/Oba5qlSa1exq3/IrSWk4QxoGUtI6QYI7XwRIJFeEX cDmi0Fqb8A2gykJ0ET7JJKxGqvlFXtVr2UbDIg7dh+5vUvpUydmBHhNLX8VsIES3GzL3 0ctw== 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=yoqGxrEuo7I20WDwXqzVyfNrC/olOohOaVj3LWj1G34=; b=aJiQ2ickB66TEM+DUxjZAnB2F2s8VNYr1Cgws9l6E3NZRdta7x9+swoy1ODvIggFLk tgN/hFoR39/njP1aJx9Bw/uJEohu3NqlTCipBpIiQHF7yw3EiETwYZNA3PyGKBuwWiUK HXhajx9P/+967vrhmQ1GUJhqBzOaB7uOa+BEbcLein3NgFzAafNKvVxq7Q48q/g79vzp EcOVlAbHn4lR+fRmrs+b6T6uMyHiCoRXEyX+Ry+rzeTrw72A8dgJIWEK0+t7tMbEbw51 gTgp4qmqgkDjnVxsOVmSlwljLl7E15NMbtXapqCHBXCVbC9RZOosHiJ84ZlICf3dl/WB H7/g== X-Gm-Message-State: AOAM530fTGSILUbnIvQe4t1dnUqYppzCe/eLk2d/2iqvS5CIsaFKxk0P 30c+CnQiEDCS2y00dhpPCyv+dSL6oZjUoA== X-Received: by 2002:a05:600c:1d9d:b0:38e:c8e0:209f with SMTP id p29-20020a05600c1d9d00b0038ec8e0209fmr3504808wms.43.1650621928123; Fri, 22 Apr 2022 03:05:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:27 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 57/61] target/arm: Use tcg_constant in translate-neon.c Date: Fri, 22 Apr 2022 11:04:28 +0100 Message-Id: <20220422100432.2288247-58-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-neon.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c index 384604c0095..2e4d1ec87d9 100644 --- a/target/arm/translate-neon.c +++ b/target/arm/translate-neon.c @@ -447,7 +447,7 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) int mmu_idx = get_mem_index(s); int size = a->size; TCGv_i64 tmp64; - TCGv_i32 addr, tmp; + TCGv_i32 addr; if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { return false; @@ -513,7 +513,6 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) tmp64 = tcg_temp_new_i64(); addr = tcg_temp_new_i32(); - tmp = tcg_const_i32(1 << size); load_reg_var(s, addr, a->rn); mop = endian | size | align; @@ -530,7 +529,7 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) neon_load_element64(tmp64, tt, n, size); gen_aa32_st_internal_i64(s, tmp64, addr, mmu_idx, mop); } - tcg_gen_add_i32(addr, addr, tmp); + tcg_gen_addi_i32(addr, addr, 1 << size); /* Subsequent memory operations inherit alignment */ mop &= ~MO_AMASK; @@ -538,7 +537,6 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) } } tcg_temp_free_i32(addr); - tcg_temp_free_i32(tmp); tcg_temp_free_i64(tmp64); gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); @@ -1348,7 +1346,7 @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, * To avoid excessive duplication of ops we implement shift * by immediate using the variable shift operations. */ - constimm = tcg_const_i64(dup_const(a->size, a->shift)); + constimm = tcg_constant_i64(dup_const(a->size, a->shift)); for (pass = 0; pass < a->q + 1; pass++) { TCGv_i64 tmp = tcg_temp_new_i64(); @@ -1358,7 +1356,6 @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, write_neon_element64(tmp, a->vd, pass, MO_64); tcg_temp_free_i64(tmp); } - tcg_temp_free_i64(constimm); return true; } @@ -1394,7 +1391,7 @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, * To avoid excessive duplication of ops we implement shift * by immediate using the variable shift operations. */ - constimm = tcg_const_i32(dup_const(a->size, a->shift)); + constimm = tcg_constant_i32(dup_const(a->size, a->shift)); tmp = tcg_temp_new_i32(); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { @@ -1403,7 +1400,6 @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, write_neon_element32(tmp, a->vd, pass, MO_32); } tcg_temp_free_i32(tmp); - tcg_temp_free_i32(constimm); return true; } @@ -1457,7 +1453,7 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, * This is always a right shift, and the shiftfn is always a * left-shift helper, which thus needs the negated shift count. */ - constimm = tcg_const_i64(-a->shift); + constimm = tcg_constant_i64(-a->shift); rm1 = tcg_temp_new_i64(); rm2 = tcg_temp_new_i64(); rd = tcg_temp_new_i32(); @@ -1477,7 +1473,6 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, tcg_temp_free_i32(rd); tcg_temp_free_i64(rm1); tcg_temp_free_i64(rm2); - tcg_temp_free_i64(constimm); return true; } @@ -1521,7 +1516,7 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, /* size == 2 */ imm = -a->shift; } - constimm = tcg_const_i32(imm); + constimm = tcg_constant_i32(imm); /* Load all inputs first to avoid potential overwrite */ rm1 = tcg_temp_new_i32(); @@ -1546,7 +1541,6 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, shiftfn(rm3, rm3, constimm); shiftfn(rm4, rm4, constimm); - tcg_temp_free_i32(constimm); tcg_gen_concat_i32_i64(rtmp, rm3, rm4); tcg_temp_free_i32(rm4); @@ -2911,7 +2905,7 @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) return true; } - desc = tcg_const_i32((a->vn << 2) | a->len); + desc = tcg_constant_i32((a->vn << 2) | a->len); def = tcg_temp_new_i64(); if (a->op) { read_neon_element64(def, a->vd, 0, MO_64); @@ -2926,7 +2920,6 @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) tcg_temp_free_i64(def); tcg_temp_free_i64(val); - tcg_temp_free_i32(desc); return true; } From patchwork Fri Apr 22 10:04:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564827 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp374445map; Fri, 22 Apr 2022 04:21:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7G4X5OiJRzRzmqZsQP/O0qT/gLR5BS0xwSQwXCvKXrrZ3sDOyGTgeEhw5/c2acMfp0jty X-Received: by 2002:a05:6214:2a4c:b0:446:738c:f733 with SMTP id jf12-20020a0562142a4c00b00446738cf733mr2825607qvb.121.1650626518498; Fri, 22 Apr 2022 04:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626518; cv=none; d=google.com; s=arc-20160816; b=FmF6YkhAJ1NRZNxtJwsLl9l2IYOzkZTyXgP3QREBqDMSDOET547p9/vE38hFQmRqBj yj9ocQoqdvY9TjN5gm45SvfICkEyYFuqh0LK7jcPY/IB8/8f+9uYgaGoLaf7Jj53bHrP huzT7e5Ymb791pDrm+kgT8q2HQSt2hUKXWlJMF1cWE6hqBRWN+tKbpk96BEisfp1x0xq mrWHEiiRwMpn1+Z27OPo1B3R3gWg+fC+ksCXle2ThYTW9nwcAkN+0+dkaBU5kFAqHjUN 8zd8tL3J8FPnZ0yAN8ZBQj8Zww9pz3E0pWzi7QmPDyAO20/Wf3JuZekpdPZ5PPtU5a5k S0LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zaKs7nV/Bv9VFOMg50MhiPk1cL7Obi+7zlrOm4dY3bM=; b=OcQiPFstcaCxM541MhxqA10kM0wHJ8pRLDt/38Co0BJM0gP2ens97ucJfbUvudXeiH dLUQxS3GKn/dpJnEnsg44y/T+Z/l7QkbHW9ezsfxnShsfHhXGmbUXPZTmWJSf56LJu1k 6lccj89o88QLaSULDBCakbrXj2XaP8zXszx7j+DKvypIzLfDdM6qYhDz84+nzVuVuex5 6V4I1Pd+jF/VGs9b2JVOF8NjBpJRWEpJmkb0LHw3R/x+mG2h/6QW8jrOQIIrQjumZk9J O+LN8hhrRrdUKex/VpHADLGgG6tIJ3txOWxaT1s0P8acTwkknBt47KufOVStCwa52RdK Beog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aw74E6hd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bm31-20020a05620a199f00b0067e4be237c3si2153925qkb.8.2022.04.22.04.21.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:21:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aw74E6hd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrMM-0002bq-3n for patch@linaro.org; Fri, 22 Apr 2022 07:21:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAV-0005hg-W9 for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:40 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:34695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAM-0002xh-Rb for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:38 -0400 Received: by mail-wm1-x333.google.com with SMTP id ay36-20020a05600c1e2400b0038ebc885115so4692547wmb.1 for ; Fri, 22 Apr 2022 03:05:30 -0700 (PDT) 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=zaKs7nV/Bv9VFOMg50MhiPk1cL7Obi+7zlrOm4dY3bM=; b=aw74E6hdP1Rf33WMmCKAhc0wtRx2sTcz0n4Eg40KXzBjH0fdbgU0CzXwxBKaOWCVNF g4CkbKTmf4M3+AxBe1IZOqOIlZB0GAg3kL4Q5zgcVtiJJYOndQpsBnOX5NUbV2KHKDhF yNQR83OLf+iOWV+yPOegRi6wW4svRfqbSMwxiS23LCbMuKZjpz5xGhLoekpiCn6oTeHZ b3EZJgr5zeDaGtdnVwrB8Z9rB2d5nWNwyzAA0QaP1IWYTFq8kKfCeT630KVA21xwoQo0 jtSeaE6rOWBVdr1R1t6VzhPp1QSde/r4AEWmYrAfBKqEnZf7TpVn0YgcSYjriHvgv27N qixw== 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=zaKs7nV/Bv9VFOMg50MhiPk1cL7Obi+7zlrOm4dY3bM=; b=Z5LSmStvY7eJNp2Aylu5s1hbIrRqKzDir12JfWwidx1bPOq4jhnP99yLChFQSlHFrF Ok9SUJv7ReSwsvo8AzMKGEyXYCl6khwoXmFU0fvGWyWO4DTMRGCGoFdOhhgEDPRKg6Sc eAwwHhgty5uwcQhu4McAjxCcD8swL+xO2186ySE9+2puNrxWOGxiM2y2Bfu+5yqZEiSn VLGBDidaUhaljfkwPLXc10O3rx5pAXVEdwPqFR189DF74L7S2VdemAAWF2VewwLAyRpa 3DYBeidb6qFsidD2JD9jclPhTtgQRNqRCAoV8+G/N1kC80PVl020/mmJ3cPnNdOfbvMZ Gumw== X-Gm-Message-State: AOAM532WUeSeIGtPILTvLaM/lwVm6dvtd4YXWbBzcLcILJfEkMdAupQ9 vjU5Mxq9x6slJP7+jLQw/3i/0kEJEQaFYw== X-Received: by 2002:a05:600c:29c7:b0:38e:c58d:7b00 with SMTP id s7-20020a05600c29c700b0038ec58d7b00mr3535714wmd.47.1650621929065; Fri, 22 Apr 2022 03:05:29 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 58/61] target/arm: Use smin/smax for do_sat_addsub_32 Date: Fri, 22 Apr 2022 11:04:29 +0100 Message-Id: <20220422100432.2288247-59-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The operation we're performing with the movcond is either min/max depending on cond -- simplify. Use tcg_constant_i64 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-sve.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 180e14d9f88..726cf88d7c5 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1916,8 +1916,6 @@ static bool trans_PNEXT(DisasContext *s, arg_rr_esz *a) static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) { int64_t ibound; - TCGv_i64 bound; - TCGCond cond; /* Use normal 64-bit arithmetic to detect 32-bit overflow. */ if (u) { @@ -1928,15 +1926,12 @@ static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) if (d) { tcg_gen_sub_i64(reg, reg, val); ibound = (u ? 0 : INT32_MIN); - cond = TCG_COND_LT; + tcg_gen_smax_i64(reg, reg, tcg_constant_i64(ibound)); } else { tcg_gen_add_i64(reg, reg, val); ibound = (u ? UINT32_MAX : INT32_MAX); - cond = TCG_COND_GT; + tcg_gen_smin_i64(reg, reg, tcg_constant_i64(ibound)); } - bound = tcg_const_i64(ibound); - tcg_gen_movcond_i64(cond, reg, reg, bound, bound, reg); - tcg_temp_free_i64(bound); } /* Similarly with 64-bit values. */ From patchwork Fri Apr 22 10:04:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564818 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp365427map; Fri, 22 Apr 2022 04:09:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9kdQfJBsyx14vNMbydLOkrz8oNpXXHu90RsrdXOr4WDYXlX08TTH2pX9QjHOCg4JF7Zbr X-Received: by 2002:ad4:574d:0:b0:446:493a:ad1c with SMTP id q13-20020ad4574d000000b00446493aad1cmr2872127qvx.34.1650625775413; Fri, 22 Apr 2022 04:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650625775; cv=none; d=google.com; s=arc-20160816; b=bIv2+w4RHQYlv2dQk/VeHwYM04MApbIaxT3Tkfzq87VpEKb2wfKyydQgCkerKd/Go6 uZXFPXRrPu94bD6gQ98ua8KEYmHh4wmihnW3aK3I641q+nsBVZL0yYxkaFBFKBLn4IaB XZjJ3PflmaTTHK/67oWeNzcU5ckrwpIwV97mrrZ4bt93Bo51NB4jsbt8OxBdcJ+RoZP9 Qhei+rAFXDr+fAnNcN4S7U/HYLw3gAUOQF8O6Ax7Ojql7FHkrvhcanmw5bT8wpCbuVHW ZkqE1DxtgbDIouv7aCLc4vD180Z1XqR2A9k36UgPCM6fl8U46tl5qdvVtDQU3bVv4gCf L3zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=w6FKJY6h72UKhiMo8F0Q/EK0rQTfrxHRC6BdPcnyVtE=; b=Scr7x+t1vSP2KRtoMA+9eyqh8i1IlH301vnRPLHd1WCtHoUbw5ysziWd+RO4+p/Wrl zmk+PSTyk1LU79IKxhiOmgCM4AXkr05AL8+FtA+o9sVZky8sIFs/wylvGZSnfotNDPhB QaO1AHkHEFHdyr85qFfOZDN8Mx/LsGzgtNhlhVbNyMJoBjhYxCfD1qGHWyoJbcxMQAzZ 8+XmD/W8j8sCe8QLan0Rhmtxq7wsrfuDtkobyVVbv1hIj8rNjJ6jK7EGk6th7ud+N8cg NYytVpp2J8XXUYRRUIbkaXSAhL+0m8FN91tueI8DHQFAHaRxAQXv1JPAqfeu64WYR7Q1 Q+aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kdGmiq7g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g20-20020a05620a279400b0069c393ffc7bsi2123089qkp.412.2022.04.22.04.09.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kdGmiq7g; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrAM-0006Ea-Sc for patch@linaro.org; Fri, 22 Apr 2022 07:09:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAS-0005di-3Q for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:36 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:46988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAP-0002zX-Tb for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:35 -0400 Received: by mail-wm1-x331.google.com with SMTP id l62-20020a1c2541000000b0038e4570af2fso5079609wml.5 for ; Fri, 22 Apr 2022 03:05:33 -0700 (PDT) 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=w6FKJY6h72UKhiMo8F0Q/EK0rQTfrxHRC6BdPcnyVtE=; b=kdGmiq7gBE8fF9Mo5+lZGmQS2OKBmEBToQ52GiTpHhSUUpbgoVnhnB4wUQ1C1QLIUk D7qEivumfldzE54Npf/IdCXizCHEDIyGrx0/aL2xeYRBpbQZ+ncWC19bP7eu4BK1BFpQ fzdnmI5f7VmH5L88ZAQxSKKv2HfGjXAEgy8qhBesl9YFQ0sP0EVDyQ4GoA7oA1giOide IOskSRk8iOpTDmc/AH5DHbzoBa8le2eqPH1HJOTPP28Sq6/ZRtJX9OnjMpIWTXWQwTnX n9SfgSK0E1SVCeUDh6n8usU01DFnF0PsgjlBc1GIf6cYRfDrdHZKsLJFaretH3GTAfLk MzVA== 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=w6FKJY6h72UKhiMo8F0Q/EK0rQTfrxHRC6BdPcnyVtE=; b=7Q1+impsV/Z6Js60Y3EqGibH1d+Am9f07RZBY7XuTllgFuzQ78nZrA6dvGjOcpOb3a bfzTSiYUUhPpAoqKg8d5TGTzEka7fVKCLa89Wdw6ASwESmQqrl8TvXcuNBbUQ+xQmlEB bzhxCk+rzpRWdoh287zbgSS/N3IOG1HmTZ8G+KSGowXIpLAqOKt5J0Sr0lrPA+np4DFd 9bBVwEmqm5QmaNUJ/sT9Fw/zTyVxYCWYxrGWUysrhaVg6dAcLei3rwJMnONJQhIEvBzg 108FF1OXkl5GIY232AqNRoOPt64lpw/b/vaXhBYiLLhSxIun7v/cuYu3lPZpSmCBy/KM VDdg== X-Gm-Message-State: AOAM530JnnHHyMWQhdVp/Gl3FrArEwg+7gcbSWtrdlebVKajlbdNfq8m TL08r8vGlVQdumm5sL+rzLgFoN2sIOkiRQ== X-Received: by 2002:a05:600c:4f87:b0:392:8e86:4754 with SMTP id n7-20020a05600c4f8700b003928e864754mr12347678wmq.130.1650621931796; Fri, 22 Apr 2022 03:05:31 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:31 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 59/61] target/arm: Use tcg_constant in translate-vfp.c Date: Fri, 22 Apr 2022 11:04:30 +0100 Message-Id: <20220422100432.2288247-60-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-vfp.c | 76 ++++++++++++-------------------------- 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 6a95a67a69e..40a513b8221 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -180,8 +180,7 @@ static void gen_update_fp_context(DisasContext *s) gen_helper_vfp_set_fpscr(cpu_env, fpscr); tcg_temp_free_i32(fpscr); if (dc_isar_feature(aa32_mve, s)) { - TCGv_i32 z32 = tcg_const_i32(0); - store_cpu_field(z32, v7m.vpr); + store_cpu_field(tcg_constant_i32(0), v7m.vpr); } /* * We just updated the FPSCR and VPR. Some of this state is cached @@ -317,7 +316,7 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) TCGv_i64 frn, frm, dest; TCGv_i64 tmp, zero, zf, nf, vf; - zero = tcg_const_i64(0); + zero = tcg_constant_i64(0); frn = tcg_temp_new_i64(); frm = tcg_temp_new_i64(); @@ -335,27 +334,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) vfp_load_reg64(frm, rm); switch (a->cc) { case 0: /* eq: Z */ - tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, frn, frm); break; case 1: /* vs: V */ - tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, frn, frm); break; case 2: /* ge: N == V -> N ^ V == 0 */ tmp = tcg_temp_new_i64(); tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, frn, frm); tcg_temp_free_i64(tmp); break; case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, frn, frm); tmp = tcg_temp_new_i64(); tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - dest, frm); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, dest, frm); tcg_temp_free_i64(tmp); break; } @@ -367,13 +361,11 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i64(zf); tcg_temp_free_i64(nf); tcg_temp_free_i64(vf); - - tcg_temp_free_i64(zero); } else { TCGv_i32 frn, frm, dest; TCGv_i32 tmp, zero; - zero = tcg_const_i32(0); + zero = tcg_constant_i32(0); frn = tcg_temp_new_i32(); frm = tcg_temp_new_i32(); @@ -382,27 +374,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) vfp_load_reg32(frm, rm); switch (a->cc) { case 0: /* eq: Z */ - tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, frn, frm); break; case 1: /* vs: V */ - tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, frn, frm); break; case 2: /* ge: N == V -> N ^ V == 0 */ tmp = tcg_temp_new_i32(); tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, frn, frm); tcg_temp_free_i32(tmp); break; case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, frn, frm); tmp = tcg_temp_new_i32(); tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - dest, frm); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, dest, frm); tcg_temp_free_i32(tmp); break; } @@ -414,8 +401,6 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i32(frn); tcg_temp_free_i32(frm); tcg_temp_free_i32(dest); - - tcg_temp_free_i32(zero); } return true; @@ -547,7 +532,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) fpst = fpstatus_ptr(FPST_FPCR); } - tcg_shift = tcg_const_i32(0); + tcg_shift = tcg_constant_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -595,8 +580,6 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); tcg_temp_free_i32(tcg_rmode); - tcg_temp_free_i32(tcg_shift); - tcg_temp_free_ptr(fpst); return true; @@ -850,15 +833,11 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) case ARM_VFP_MVFR2: case ARM_VFP_FPSID: if (s->current_el == 1) { - TCGv_i32 tcg_reg, tcg_rt; - gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - tcg_reg = tcg_const_i32(a->reg); - tcg_rt = tcg_const_i32(a->rt); - gen_helper_check_hcr_el2_trap(cpu_env, tcg_rt, tcg_reg); - tcg_temp_free_i32(tcg_reg); - tcg_temp_free_i32(tcg_rt); + gen_helper_check_hcr_el2_trap(cpu_env, + tcg_constant_i32(a->rt), + tcg_constant_i32(a->reg)); } /* fall through */ case ARM_VFP_FPEXC: @@ -2388,8 +2367,6 @@ MAKE_VFM_TRANS_FNS(dp) static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a) { - TCGv_i32 fd; - if (!dc_isar_feature(aa32_fp16_arith, s)) { return false; } @@ -2402,9 +2379,7 @@ static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a) return true; } - fd = tcg_const_i32(vfp_expand_imm(MO_16, a->imm)); - vfp_store_reg32(fd, a->vd); - tcg_temp_free_i32(fd); + vfp_store_reg32(tcg_constant_i32(vfp_expand_imm(MO_16, a->imm)), a->vd); return true; } @@ -2440,7 +2415,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) } } - fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm)); + fd = tcg_constant_i32(vfp_expand_imm(MO_32, a->imm)); for (;;) { vfp_store_reg32(fd, vd); @@ -2454,7 +2429,6 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) vd = vfp_advance_sreg(vd, delta_d); } - tcg_temp_free_i32(fd); return true; } @@ -2495,7 +2469,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) } } - fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm)); + fd = tcg_constant_i64(vfp_expand_imm(MO_64, a->imm)); for (;;) { vfp_store_reg64(fd, vd); @@ -2509,7 +2483,6 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) vd = vfp_advance_dreg(vd, delta_d); } - tcg_temp_free_i64(fd); return true; } @@ -3294,7 +3267,7 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_load_reg32(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR_F16); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3328,7 +3301,6 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_store_reg32(vd, a->vd); tcg_temp_free_i32(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } @@ -3353,7 +3325,7 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_load_reg32(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3387,7 +3359,6 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_store_reg32(vd, a->vd); tcg_temp_free_i32(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } @@ -3418,7 +3389,7 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vfp_load_reg64(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3452,7 +3423,6 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vfp_store_reg64(vd, a->vd); tcg_temp_free_i64(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } From patchwork Fri Apr 22 10:04:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564823 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp369707map; Fri, 22 Apr 2022 04:15:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU3xcHQIyYoYQ6E2ReOWReAO+vJqINHUyIT7vPbJbtzvswt2t7/pPZw4Cu53PL8dZlRqBC X-Received: by 2002:a05:622a:6094:b0:2f0:6a1f:b7cc with SMTP id hf20-20020a05622a609400b002f06a1fb7ccmr2700107qtb.392.1650626114758; Fri, 22 Apr 2022 04:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650626114; cv=none; d=google.com; s=arc-20160816; b=KygnePhLVg2GPfENlTC8Z4LrYARRU36cQuwJnCCOVbOOLNWburkdu5mgvPF+wjuHwN kEIBmsUH545abpjuZwH2Jz9MDZSZ4K/xCcE++LQUI1aiQc5YXuBMObIKYO768Ifait1u jza9n06xToKKwWOxpN4zGfJh4cE1AW3qfT1siPJQH/LtwyglN2jt4vmr7kUX+ltpFF5B 1PPeRe6My+c8/kp7ras9yuYoOD9QLr7iojTo9YhI4nYO1TqtIwaBJKZTaKiUgEPJGSBV ihkQpyU6yoo3NdjBAAHzosMlihWJSPxq7UjwTJqemP9N781qfnRABhnUwzs6r08lLPMI ywnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=B02wNUQWPbSndWLw/MyCz76UBwGsg2MrYi8CgBL9/W0=; b=yql+fvaLTgv4cxzdp9glA1gK8khYV39U6B1YCRxmSi/TI0VyiRMlasZNi81CER+Um1 GQg+K+DJpoaivluFekJDqjJhG8ErfCE0QiN+huolsZ6xZ+e7WfABjj/9KAtouiT3jmQ1 YLhYuqrT2bPmVsNbNa6YMtsvep3jN7fy4caleBNT5FH8natyhP/VXFeN1i9FiGEuR0mE cj8lOqjfTq8/ep644gu9aEDuIfWT+YBg2WV+GMlvKGH0V/aDzNHnDHuOI5bIC1LKEJWj HZRb6MbF7qn0129KH8uIk/BXgDV6glWSKfxejbLqOtMfzp3P2onpLSbcivb8KWI9FROB /rhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VI8kYcVg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t189-20020a372dc6000000b0069e68f301ddsi1984605qkh.640.2022.04.22.04.15.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:15:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VI8kYcVg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhrFq-0002a3-B1 for patch@linaro.org; Fri, 22 Apr 2022 07:15:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAR-0005dc-Cv for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:36 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:44918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAP-0002zZ-Tk for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:35 -0400 Received: by mail-wr1-x430.google.com with SMTP id b19so10282612wrh.11 for ; Fri, 22 Apr 2022 03:05:33 -0700 (PDT) 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=B02wNUQWPbSndWLw/MyCz76UBwGsg2MrYi8CgBL9/W0=; b=VI8kYcVgKhiY8f8DOPY+6th2FfzdCM3llZ9LIzXFeRzPYASoGMUxCqvekXmInkQ3jl RuDU/qkC+gADu2xZaO+p22YKzfHdqRJl1HjCBToNW6MUslh06P9Tryhp6oog2azFcI0m 9dQUT7/4LYUnjMp3GjnVYVi1VcK49ym4gGkbt1o5kSRS52PrrulwYtoPRgAul3GRgccs VG/+BJmynfYNt2SgfiMX7IYX2idC5T7zpDZuB+y1R9m9ReKO3hlMVxjcW1S0LM4QGZ7D ldjBjojdEySo3S/IcnTMInlw5UErKNr8QGL5DfABzWcvoua4OAf4svJGaGeJtJJNJOA+ /FDg== 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=B02wNUQWPbSndWLw/MyCz76UBwGsg2MrYi8CgBL9/W0=; b=urqyIcErjJnHsoqMglvXZD5rZ5aATQrJLzmr3S9HASA4Huyz2eyRcb7IuW9gHrve/6 FzEff2nTEAs4a/tLGb0k9shlboQIsWf1VN7uyvANZpC6+2rKuIOBmJPpp+sU6dZD2e34 IFdm8z1/Bgf7JqxI58sCNv9qcYMcy7uSbrhAsAAKxYOV9rtGlPVW9Tgvnk0V5QFEhwHz X7qTH/G1UbeWo42FoAT2U8pxWK2q4Tp2swW+tIqSdOCikY5BbhX2TbzM8/z2XntIzYgX HwVdmui6WGCtBRIqafsISfhhVahb/HFi7HAHCUGVN+Vjdz9zpesH+DHRfA9SwweKx0t2 yAmA== X-Gm-Message-State: AOAM530Ht4pDviChKjqVD5HXi7Of2FOykBhsY8qWktW5faA4QPSb9CY0 eDsBVEF6WlILwxilUTy/7sKuYrbik2/xaQ== X-Received: by 2002:a5d:49c1:0:b0:20a:a65b:4648 with SMTP id t1-20020a5d49c1000000b0020aa65b4648mr3074559wrs.707.1650621932558; Fri, 22 Apr 2022 03:05:32 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:32 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 60/61] target/arm: Use tcg_constant_i32 in translate.h Date: Fri, 22 Apr 2022 11:04:31 +0100 Message-Id: <20220422100432.2288247-61-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 050d80f6f90..6f0ebdc88e5 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -332,16 +332,9 @@ static inline void gen_ss_advance(DisasContext *s) static inline void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) { - TCGv_i32 tcg_excp = tcg_const_i32(excp); - TCGv_i32 tcg_syn = tcg_const_i32(syndrome); - TCGv_i32 tcg_el = tcg_const_i32(target_el); - - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, - tcg_syn, tcg_el); - - tcg_temp_free_i32(tcg_el); - tcg_temp_free_i32(tcg_syn); - tcg_temp_free_i32(tcg_excp); + gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syndrome), + tcg_constant_i32(target_el)); } /* Generate an architectural singlestep exception */ From patchwork Fri Apr 22 10:04:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 564833 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp389877map; Fri, 22 Apr 2022 04:44:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1bdzmW292N+VW4tb8AvovfyTyrY3yk+lKVzlbAsPElodnnbyZsLKxgrXgwi1276O21eZe X-Received: by 2002:ac8:4e1b:0:b0:2f1:eabf:e3de with SMTP id c27-20020ac84e1b000000b002f1eabfe3demr2733453qtw.415.1650627866492; Fri, 22 Apr 2022 04:44:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650627866; cv=none; d=google.com; s=arc-20160816; b=zscxyRQlhbkcCVszSOBYBs3+AL3OMXROz30g5sbpwTAQhFcr3StofHwu18QQSOcR7a L8MsUoMhkzOfG5IgVja2LG19qWhplGEcT0uI2GSlNzgq/g/gig+ONi6Ksjui/NBd0ABc 8eRj32GCQXTgiTIquMwaSfXw4JXqmqSEtzKDzOYDMI1FaHlYGdg3r8AITV+K8/RYOW3s 2zh/AJzsYMGCvEkF0zUmd3oZDOKhdAMhq4LJbdFxU6hGjRmO+kIjyl6YqrurQNSFIGtv 2kdtwlGgDyX29bOWASLbrBtU65UNNLxwKEj9s54f87TftlrgADxQdSMA+3AhLBfGxfei 62jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=F5JxzY641qwLK/UV9n1xJjYcWBo1utd1eisOSylOdzc=; b=l10l1e9pYIUzP1Vw3gDZUhhN8wHy1HLg2J2nTv5XbRIsrTYVpj+mHD9AriHSZaLj/U XuurqGA8k0HAql0/m7mG7K0cz6pRgKTbR96CcwFS1IEKalBe/cEVkEqw7LeqMMVKPSPX LyiIeqfdpuXXZHhaQMmr0dIA187ONJPxxnIFUR8+bnW6HvylfbP604jCfHkJbKIvcK6+ rsjyyD0RGtpPAtBCWidEtr5pGkQ3h3ptaGA40kdhZejCE47oJKJmJ966qZN3SkWU5KSa rzQnFRmHLyHV8ts+oXoTtYQ30mj7Ta4gzPJCovXEzK7MabDzUHRXv9I2qUcA7UJo2hzu L1+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IbkzBmU8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o13-20020ac85a4d000000b002e1fbf3bfdesi2216989qta.463.2022.04.22.04.44.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Apr 2022 04:44:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IbkzBmU8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhri6-0003gj-3i for patch@linaro.org; Fri, 22 Apr 2022 07:44:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhqAS-0005dj-KS for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:36 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:36806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhqAQ-0002zh-SM for qemu-devel@nongnu.org; Fri, 22 Apr 2022 06:05:36 -0400 Received: by mail-wm1-x329.google.com with SMTP id u17-20020a05600c211100b0038eaf4cdaaeso7632256wml.1 for ; Fri, 22 Apr 2022 03:05:34 -0700 (PDT) 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=F5JxzY641qwLK/UV9n1xJjYcWBo1utd1eisOSylOdzc=; b=IbkzBmU8ns9+Kr9vM+cGnoJpbNjXCiI5a2t+w1oC+u2vfERwiiTFn5+2S16VH1to+g XY3J9I5N2+uuV4/XvaTQz72qskARdO7yws+DCY8zBgPW5ZdPqleagDxKZz0z1p2cL0cc qkSB2T6epdcZUwjdII4JBjeuph0SxIEP4Hp3155dERIydsaXVX3THoCnmauJrnAwDwuS sGnR1HCg8PuaLrf9uLtmL0bQMg7+/A9RRFBjkRV/3Xr/M3qQqPCI8SNHQQ5zvBb1RXyD zeaqgGFU9eulz5Lj8TSEXgDb5vlqMr+eGxlRgP0oGO2MSwWl2yWlGJFha2xg+QgZ0cHx fzdg== 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=F5JxzY641qwLK/UV9n1xJjYcWBo1utd1eisOSylOdzc=; b=ewKAvhNI+3GwDSVQ+EjVo/+6be+4a5LduGJXv2iRHUaLQaKRbB/LmOd3E2zg4pBbfq a7t1bSN2ItTPxV3/kKIkae8tcvb4OU9HI0D9Kk55CW1T7IN/svhuhrfnhTT6c4grjEp0 5W8wA2/RMW3SbJ20PIjbSrTCl2mpUbphQpM6hwZ0fNM5BR6GQ8yzdn2EzF0Ffo6tPi4T eJ4pxgVg9VAWogiK+yTRjYR3mV6Los4HafutB2CiYzl3JJsSugUUZD6rmcxUtYGAzEmd 4GHvoWcqN8GQa14tFNfa4oqkr/B36Rr6TWYVRWK3vEt3nddzJz4z6kNtpwFmF8vYnnJ4 q1DQ== X-Gm-Message-State: AOAM533iCPqAzxuY+BaRtdUAKenr5f6YSCDicfSA1HbDjBWktDYYEyJA OX/42/NsF/ksqR/mhsjNYMQHagWETXVbDw== X-Received: by 2002:a05:600c:240a:b0:38e:af6f:510f with SMTP id 10-20020a05600c240a00b0038eaf6f510fmr12558318wmp.46.1650621933367; Fri, 22 Apr 2022 03:05:33 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e16-20020a05600c2dd000b0038ed449cbdbsm4312148wmh.3.2022.04.22.03.05.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 03:05:32 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 61/61] hw/arm/smmuv3: Pass the actual perm to returned IOMMUTLBEntry in smmuv3_translate() Date: Fri, 22 Apr 2022 11:04:32 +0100 Message-Id: <20220422100432.2288247-62-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422100432.2288247-1-peter.maydell@linaro.org> References: <20220422100432.2288247-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Xiang Chen It always calls the IOMMU MR translate() callback with flag=IOMMU_NONE in memory_region_iommu_replay(). Currently, smmuv3_translate() return an IOMMUTLBEntry with perm set to IOMMU_NONE even if the translation success, whereas it is expected to return the actual permission set in the table entry. So pass the actual perm to returned IOMMUTLBEntry in the table entry. Signed-off-by: Xiang Chen Reviewed-by: Eric Auger Message-id: 1650094695-121918-1-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Peter Maydell --- hw/arm/smmuv3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 674623aabea..707eb430c23 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -760,7 +760,7 @@ epilogue: qemu_mutex_unlock(&s->mutex); switch (status) { case SMMU_TRANS_SUCCESS: - entry.perm = flag; + entry.perm = cached_entry->entry.perm; entry.translated_addr = cached_entry->entry.translated_addr + (addr & cached_entry->entry.addr_mask); entry.addr_mask = cached_entry->entry.addr_mask;