From patchwork Tue Feb 1 19:32: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: 539297 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1180092imr; Tue, 1 Feb 2022 16:45:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuw3uyS33Gp8dwx42ZwXyBi01DAQdwQ2BEI+gi9oF5NVvGGjl4fPYB7Ztezvj41SYCCuYX X-Received: by 2002:a25:d042:: with SMTP id h63mr37865296ybg.218.1643762752751; Tue, 01 Feb 2022 16:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643762752; cv=none; d=google.com; s=arc-20160816; b=oBW9zIQeFvJIQ7uI9rH0nG4Pt4rn4YNZCVDhUgmhCNjE5KL5qP3BH4eyv8li9Y7pYr WhRp7/b+giI3gj62NMnSw+IGdwA1roA6gj+wSRa3xiqUPcM7AGp5sWNR8WzqLCK4Lcqo WNFeBfZZR4pSLzcRetNBoCrXvTovPoIBJSfRKZwGMo061tKuLkeHz0n660FkcA8WTV0g 0Br2QTIi0QvwkbZq5M2nP1nkg9GNpVaL8jwoQDmOU4ZQac/t1GtBNUjWv0o2r3jH792r DKltlCTQ5K/U7UrdjNRZUE99WWcljgAQA/tgsaXjb/J8bephO9dwLh+mn7MgALeHM7y8 DcMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=PyoYFz0rNK5fksgWbnYb2wlrhqu+KYVYudh2oRoiZhU=; b=R7IwlR7q/6QZ1qG/xE7BIwp/JhJ6GiW3GbPNwqUFOl8jXDDSmv15reLgksd1AzSP2U XStJU9oI0Zd0nIe08hQWjbBaYJlXppnXp4SND1GJLshXEzE1cdcroIAsSF0djVvZ8d44 iytnR05TYnqQ+VVtHAkezGhAryUkwHbpAQx+goxFXz2W0ACesE2kDJ/xlkYvUQ2nVTen +pBWNWYgvc5oE7kHiq26ALi3DHJYcISH4ybs4KbWEnPJ4zi4J3QGL9SX6xMiIgJzbbsi j0ZlXIrKg/HNMNpHe1xcVhbU0Bu6+NWax+GEml0ubMqFW1Ds40PlHhIFw97Ai85tydhn me/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DRJO4rd5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e138si38136074yba.606.2022.02.01.16.45.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Feb 2022 16:45:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DRJO4rd5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nF3mR-0003TR-3X for patch@linaro.org; Tue, 01 Feb 2022 19:45:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEytI-0001p4-6x for qemu-devel@nongnu.org; Tue, 01 Feb 2022 14:32:37 -0500 Received: from [2a00:1450:4864:20::431] (port=45612 helo=mail-wr1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEytC-0002Xx-70 for qemu-devel@nongnu.org; Tue, 01 Feb 2022 14:32:35 -0500 Received: by mail-wr1-x431.google.com with SMTP id m14so33787015wrg.12 for ; Tue, 01 Feb 2022 11:32:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PyoYFz0rNK5fksgWbnYb2wlrhqu+KYVYudh2oRoiZhU=; b=DRJO4rd5AVFypEImjA7KJFFGxfCuH6D6v8JACNPRmzBOEsGeMwFOmUmKEJU0UhV+Zq 5jMSyUJM06eD/0WjLKttEfdnpxpnABPINsq/GYx+9BLXE1oQWLSD7azDdGj2JO13yeQQ dgQos0uFsG3ElJM6bXqnAxL4GjO0awqopx21nc8XI9Q1AM8bXoqWkswldPsxS25mnyK2 Jorrc2DfcH7CAuK3eDCBgasnYMpZaHgUi+MWm2cHyri5s7UBWCJQZkgA3gEAUoYBUtPN CPaugd8AyiwJBvaVBWgLQb1YvxIlUBekGndKCLd2+qAgRAtuCpbEWL+gEGcSKBEWk/X0 dUMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PyoYFz0rNK5fksgWbnYb2wlrhqu+KYVYudh2oRoiZhU=; b=hNn+5VOXdH96RisqupVNSdgjZ3myZL2ObUoIwekJjZHiBoLHRzw+rjH0FvMXp2MkfP PV0AhcQ3yig55jhNesFS3Cci7tQ9FSzcJAG8sFjfbjyXihT1yXNag6Op5HDvi0TdYWsp NSAAKkFyRbD6BstSdV1qrt8W+kUHJesX14o5CwE0DBHvBQ/0QlzKGEV6I1X4dBwWbMn1 2JZqooid0b7LyHxmoSQzxkbuMHA7rmbGGaqMot81iuqIoCb3MXaJGgnIuGQyiDmJcQgU JwTq5D1OeU4MQTVChwxm2DuDPPaMZ7YnsXQE4klLutqM3cbd93wmCdKHIz3DS9h5zYvV oHjg== X-Gm-Message-State: AOAM531FpwvlCRhkImEnHZhpjTFYYT9c2HgEZSvRdXaMgKux/0n205Ql UhtV0Dm/w78QCsDpOc9Dc9EV4A== X-Received: by 2002:adf:fb10:: with SMTP id c16mr22693982wrr.200.1643743940023; Tue, 01 Feb 2022 11:32:20 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id z5sm3491265wmp.10.2022.02.01.11.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 11:32:19 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 12/13] hw/intc/arm_gicv3_its: Don't allow intid 1023 in MAPI/MAPTI Date: Tue, 1 Feb 2022 19:32:06 +0000 Message-Id: <20220201193207.2771604-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220201193207.2771604-1-peter.maydell@linaro.org> References: <20220201193207.2771604-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::431 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: Richard Henderson , Shashi Mallela , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When handling MAPI/MAPTI, we allow the supplied interrupt ID to be either 1023 or something in the valid LPI range. This is a mistake: only a real valid LPI is allowed. (The general behaviour of the ITS is that most interrupt ID fields require a value in the LPI range; the exception is that fields specifying a doorbell value, which are all in GICv4 commands, allow also 1023 to mean "no doorbell".) Remove the condition that incorrectly allows 1023 here. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- This one's my fault -- Shashi's original code did the right thing, IIRC. The spec text and pseudocode disagree here, and in code review I backed the wrong horse. Sorry. --- hw/intc/arm_gicv3_its.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 069991f7f36..8dade9440ac 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -406,8 +406,7 @@ static ItsCmdResult process_mapti(GICv3ITSState *s, const uint64_t *cmdpkt, if ((icid >= s->ct.num_entries) || !dte.valid || (eventid >= num_eventids) || - (((pIntid < GICV3_LPI_INTID_START) || (pIntid >= num_intids)) && - (pIntid != INTID_SPURIOUS))) { + (((pIntid < GICV3_LPI_INTID_START) || (pIntid >= num_intids)))) { qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command attributes " "icid %d or eventid %d or pIntid %d or"