From patchwork Sat Dec 11 19:11:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 523067 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp4095266imb; Sat, 11 Dec 2021 11:13:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJ2JPoDfeCcMMkWyL7WYabb6/DiBb+Uhv8Cb6Rrg59X3CxPTFsxlNptSs83zVxxjwcnIAl X-Received: by 2002:a05:622a:612:: with SMTP id z18mr35027386qta.616.1639250012715; Sat, 11 Dec 2021 11:13:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639250012; cv=none; d=google.com; s=arc-20160816; b=DPzMxufWuYYGjBOcUAGpxLMnyZ28V2otd5tvh0nJXDVx/XcCddN1/vtp1I/OOfVykw nJHSRC6OTt6iGy+LPYclFM9uRQAXofv3TQHugkFFcuV8qTZpfDAPLawTvapWryj+ptO/ LgtdfZYW+u3FA1YjRXIfX8CBt6YiNm7b8S61pG7isaS32xNInTW/MMLamFjtxDapmo85 wmzUp9Ny9wJhoRlC+XOx1IclqQwlkNcNbbESV3Ot2hmQ1pKtUxOjZ/IJDCAKOY9hF8sI 4abdc4Nd79+PacJWdxNuYZyZtPJ4JPs+H1ScmAf6SfagZkIvHjNlX261CLgTE7kJcpsv 7TnQ== 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=xCxczYnF9ENjygSdEdbIw8X3a8w7yrOW7vR3UKB8V04=; b=TZCU/IVuwyhy6Hilm5IW9jpRy0XZym13a27eEHe5D+vMFwlIfljOmi8KLxQ3bLAMIC ucdKSaN29y+E2dmdx/ssEoHX2umuqOyLGImbMgyPyTnd/7RQo0ZLUt56sUVjvtUQE2Tr FlJq7cn7XgR63FfML8pTT0ThpZDcLqXp1oWdv6iegpCaNipeB5QAZUh0U2xT3F3aMPHG R0a7aIscXU3jQUFDNz30VckExuuaVIuOpCOSOEt0xaiKWYTFh3RU0cRnkl29+7Oa54/g TY3fCgyvsBcJ070PHly//A1q1kCB6/l3kP2kLs/iCNh3SZl0BUNl8OHlwULIR7BffX08 lpjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZNPLTguM; 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 f11si4963197qvt.173.2021.12.11.11.13.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Dec 2021 11:13:32 -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=ZNPLTguM; 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]:52444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw7oK-0004rQ-4W for patch@linaro.org; Sat, 11 Dec 2021 14:13:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw7mY-0004lW-H6 for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:42 -0500 Received: from [2a00:1450:4864:20::429] (port=41741 helo=mail-wr1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw7mV-0006BQ-MJ for qemu-devel@nongnu.org; Sat, 11 Dec 2021 14:11:42 -0500 Received: by mail-wr1-x429.google.com with SMTP id a9so20322555wrr.8 for ; Sat, 11 Dec 2021 11:11:38 -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=xCxczYnF9ENjygSdEdbIw8X3a8w7yrOW7vR3UKB8V04=; b=ZNPLTguMsjyMtt/U2jDu3AuCfHr6fLpsRayXnhFsJMoXzGrmxwapNyVwYferI0C8zg 8Cj52vWdqsqFw05QtRWGN2AK2ZquQIb8xQo90ZgwV00XvUTDi5AZnQqz22Tk7re9u519 mUzntddDebSKieWIyDa5yZ2l436kugWftRak3bx39XNVwa4BsGIJJXgyUBU/am6jx53F w3wDYijsZhQUpJWvxsmqchgoPx/pPll1WwQQA0o7xVPHHeAIU1N2n6avMLgcnMiqKN3Q 6Fn0S2oWWvP31K3RcbLNgriW8eErOsChMIsFGQK9eKpaoCR1Si8ZHHGzFOHXF7KCPXqU ZVmg== 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=xCxczYnF9ENjygSdEdbIw8X3a8w7yrOW7vR3UKB8V04=; b=R82TO1UozDI8Q9+AU9pm9vuOC0vYiEwMiY30/Bn6NRuLQHXUg/5agu3vZcU3Q4nGN0 4JvXqwV0nOmgAqlkEMsOkSHRusMOdGdiZI0TFf+d7IYZwPeK9hhR9Vy+kXERCwqSVxhE NzkbICzSLZNZZEBZxzt6RmN1QmHZXOZik5lDROf8WVB2lPXx5C58+TnotRYB+IMb6GOP jesqK3I9Y2fQd4hAsXBqF2uBOUjUaGhwbur2FhoITiPKvwE0yGltcg9EVVGSkN09rPqm gOX+Np0vYMRgZ0+gzG4CkQaCl3SFhevcq2tvdk9P82+lmlrFKrHAEmBWsjFuHiIVbw5G zcMA== X-Gm-Message-State: AOAM533gzfnPToCk52l/h+fGzOWg1zvXjlJW+85ROrPjz0862q019PyA 3ntXiCKMtL2mQcln2Y03QSiUcw== X-Received: by 2002:a05:6000:1a48:: with SMTP id t8mr21586049wry.66.1639249897800; Sat, 11 Dec 2021 11:11:37 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Dec 2021 11:11:37 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 01/26] hw/intc: clean-up error reporting for failed ITS cmd Date: Sat, 11 Dec 2021 19:11:10 +0000 Message-Id: <20211211191135.1764649-2-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::429 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shashi Mallela , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée While trying to debug a GIC ITS failure I saw some guest errors that had poor formatting as well as leaving me confused as to what failed. As most of the checks aren't possible without a valid dte split that check apart and then check the other conditions in steps. This avoids us relying on undefined data. I still get a failure with the current kvm-unit-tests but at least I know (partially) why now: Exception return from AArch64 EL1 to AArch64 EL1 PC 0x40080588 PASS: gicv3: its-trigger: inv/invall: dev2/eventid=20 now triggers an LPI ITS: MAPD devid=2 size = 0x8 itt=0x40430000 valid=0 INT dev_id=2 event_id=20 process_its_cmd: invalid command attributes: invalid dte: 0 for 2 (MEM_TX: 0) PASS: gicv3: its-trigger: mapd valid=false: no LPI after device unmap SUMMARY: 6 tests, 1 unexpected failures Signed-off-by: Alex Bennée Cc: Shashi Mallela Cc: Peter Maydell Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- hw/intc/arm_gicv3_its.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gicv3_its.c index c929a9cb5c3..b99e63d58f7 100644 --- a/hw/intc/arm_gicv3_its.c +++ b/hw/intc/arm_gicv3_its.c @@ -274,21 +274,36 @@ static bool process_its_cmd(GICv3ITSState *s, uint64_t value, uint32_t offset, if (res != MEMTX_OK) { return result; } + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: " + "invalid dte: %"PRIx64" for %d (MEM_TX: %d)\n", + __func__, dte, devid, res); + return result; } - if ((devid > s->dt.maxids.max_devids) || !dte_valid || !ite_valid || - !cte_valid || (eventid > max_eventid)) { + + /* + * In this implementation, in case of guest errors we ignore the + * command and move onto the next command in the queue. + */ + if (devid > s->dt.maxids.max_devids) { qemu_log_mask(LOG_GUEST_ERROR, - "%s: invalid command attributes " - "devid %d or eventid %d or invalid dte %d or" - "invalid cte %d or invalid ite %d\n", - __func__, devid, eventid, dte_valid, cte_valid, - ite_valid); - /* - * in this implementation, in case of error - * we ignore this command and move onto the next - * command in the queue - */ + "%s: invalid command attributes: devid %d>%d", + __func__, devid, s->dt.maxids.max_devids); + + } else if (!dte_valid || !ite_valid || !cte_valid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: " + "dte: %s, ite: %s, cte: %s\n", + __func__, + dte_valid ? "valid" : "invalid", + ite_valid ? "valid" : "invalid", + cte_valid ? "valid" : "invalid"); + } else if (eventid > max_eventid) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid command attributes: eventid %d > %d\n", + __func__, eventid, max_eventid); } else { /* * Current implementation only supports rdbase == procnum