From patchwork Sat Dec 11 19:11:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 523073 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4099092imb; Sat, 11 Dec 2021 11:18:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJznBxVoAnMHHGn+seRwBMDePn72MeeZ9GI9Zh90DKLSDoNLdVkD+S4LWWsx9JI7XX+lMBvV X-Received: by 2002:a05:620a:702:: with SMTP id 2mr17165658qkc.333.1639250324225; Sat, 11 Dec 2021 11:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639250324; cv=none; d=google.com; s=arc-20160816; b=rJ8CJl+gSej4vaPjdCQa/RWrkcpuQmwLyZmbfswgDHD3s4r5XdzQ1FCmwpODs+GGbZ H60WFOySijRDuDiz+zkPYRI5jZgqzQfBkhe+3l76pnMRlDX4P/fCbZDnvCSu6Hg2oqav hCYnSJ+ovRScVNtKTCQLSmRmtpDAeP0BT9sN229OTG6nfy26FqanuFQNNm/O80oDO6Eu eJrzJXwhH4A10IpfxOLH0rB2853ReIQP8+SYI0RJ7dKYils7U4YIfDYpNpdiVaqg9HT/ PfikFGqY9EqrkYNrzC2+KSivnX9ENcyiwqI57U2HhO7MaeoXfyBHK6TKmuQTWQFFJUow ovXg== 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=RWB1PQojSKR8xBPhbTN8F3p44SE2K4q7LWJViYpI6Y0=; b=d/tzxWI0qbjq8IEZB+M+Vj2UJgPLyrrAkJmhRVkmcSbmAH8w7tyemkWqzqbBLVCsWw Zw17Lq9StLGhX4xX6L5LXJdk7MF4Swifh3FTxyAFJ+879iyAJN3z3pI82+7JIHgBQ5j8 ERrfAqiDcG+2nsFDknaEGjLxGzh0Mp3RnodwqXMF5ylKJLkqMw5GJa1k7V25BQZOTdcQ JTKnFEG6s4Pb8JPZmkvC+SkKl9GaaJ0inI9wnAU+WjW1v7m96VOIa5WhlkYOu/3aEjqt 4WYbdfpQ/d+gzy/HmmkiEn0l/fM/8uuIE4qlviMU49eDnFxolca/g2x11b+DbEsSKq80 fI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ilCG5Jqi; 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 p126si6587817qke.708.2021.12.11.11.18.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Dec 2021 11:18:44 -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=ilCG5Jqi; 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]:36662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw7tL-0004w3-NR for patch@linaro.org; Sat, 11 Dec 2021 14:18:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw7mh-0004yY-5w for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:52 -0500 Received: from [2a00:1450:4864:20::42d] (port=47068 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw7me-0006Ei-4n for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:50 -0500 Received: by mail-wr1-x42d.google.com with SMTP id u1so20258090wru.13 for ; Sat, 11 Dec 2021 11:11:47 -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=RWB1PQojSKR8xBPhbTN8F3p44SE2K4q7LWJViYpI6Y0=; b=ilCG5Jqiv8nW1ERNw5WJjav37DfZ8KG623Qr+kFFFfkuKJbmZ52UudOtqX9V5cUyP/ wUPGwNZUo8iATtL+heOSI+Y+QlTNZRwiY/S8EKBeNa5yD5coUOVKdT98SpiYXDuPfvcG SlWd4qHtlgq0ZG50gpkgq1jtuyEWdOXLCfnBSMAKoaBVnNZAE8u9NCdTqm4Td2BMnTBJ GOTZTo9FzeRdnmOTjsi/3iuubD24QWLkWq7yLVh3dwnH7OHq9QrgvS6NYDtrw/fhiLsV mYxYUwHcff03f8FUnCWVBW6tXtcDYuiplod4n9NbtSiFVbXbWHP3wcQu9LRjN2+M35vO 1s2g== 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=RWB1PQojSKR8xBPhbTN8F3p44SE2K4q7LWJViYpI6Y0=; b=LNTQO9NeLIxGVMlTidUm3x70rvYSt9Pf7cHZhqU7koj3Crv3bqGQ6MwEbWMdrV8dPa MKB58r0cCYYHzyvY0Ug8ZtvgVyMtNAgmwS+sHntqDYJq0cXF6gaCIPFS0CgLQKcMAxxi UnuyEjx7AIxOKm9Dm1zFkSEPUwKwzZTlS0Z66Ciy51Ti23Q/XXKFaF5lX2yJkwtFWz9p usAuO5rNXOk9WkLie81sC1GEk1ECjL91w6+frVXiMwkW2+xlUM4Nwuk8OTmB+NGOqyD2 ZuGXwREaGKo71cmfLK21AgmfWQKMvMqCP8hGhFAZH9LnzpgedYi/0YQWfio79DbjFxh9 MSwg== X-Gm-Message-State: AOAM533uwd/r+lQQtNVQG6y7l+ZbEUXgIeh8ScnHyFW7TV6LvBnzYcDe 5UJywPhYe68T6w2BYKYCgXiDGA== X-Received: by 2002:adf:c3cf:: with SMTP id d15mr6249900wrg.689.1639249906986; Sat, 11 Dec 2021 11:11:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id m20sm2205300wmq.11.2021.12.11.11.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Dec 2021 11:11:46 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 11/26] hw/intc/arm_gicv3_its: Use 1ULL when shifting by (DTE.SIZE + 1) Date: Sat, 11 Dec 2021 19:11:20 +0000 Message-Id: <20211211191135.1764649-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211211191135.1764649-1-peter.maydell@linaro.org> References: <20211211191135.1764649-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashi Mallela , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The DTE.SIZE field is 5 bits, which means that DTE.SIZE + 1 might in theory be 32. When calculating 1 << (DTE.SIZE + 1) use 1ULL to ensure that we don't do this arithmetic at 32 bits and shift the 1 off the end in this case. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index 7a217b00f89..d6637229479 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -258,7 +258,7 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, dte_valid = FIELD_EX64(dte, DTE, VALID); if (dte_valid) { - max_eventid = 1UL << (FIELD_EX64(dte, DTE, SIZE) + 1); + max_eventid = 1ULL << (FIELD_EX64(dte, DTE, SIZE) + 1); ite_valid = get_ite(s, eventid, dte, &icid, &pIntid, &res); @@ -376,7 +376,7 @@ static bool process_mapti(GICv3ITSState *s, uint64_t value, uint32_t offset, return result; } dte_valid = FIELD_EX64(dte, DTE, VALID); - max_eventid = 1UL << (FIELD_EX64(dte, DTE, SIZE) + 1); + max_eventid = 1ULL << (FIELD_EX64(dte, DTE, SIZE) + 1); max_Intid = (1ULL << (GICD_TYPER_IDBITS + 1)) - 1; if ((devid > s->dt.max_ids) || (icid > s->ct.max_ids)