From patchwork Wed Dec 15 10:40:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 524245 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp227481imb; Wed, 15 Dec 2021 03:08:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxI0eyGHQqVxtQve6Nm/Eyq8tatJbfVfwqKove5dXfzlKRZzsuM/VK3sAo3LN9LBNkaOatj X-Received: by 2002:a05:622a:58c:: with SMTP id c12mr11345116qtb.594.1639566506763; Wed, 15 Dec 2021 03:08:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639566506; cv=none; d=google.com; s=arc-20160816; b=JD1GnJM+KA9TyS4vW+iRgDk41QPQbFpCSfxRuG+PGt9zzflP9NODhGEKmgdSFggKbW jNG8NIE/4QDTtiIZwG2oygl3WjFS+dAoxeuNrs96ELvkGXAS08C8NuZwGgxvS5eayw1V 7eS2lccLiLB3AnHp/GhUz99BMOwyUdGCTAmzL151xkem/L8tWIZemwhYoejPoxcPmgem Ge8cA2SLkbs7PjKr50e8RqoT/WEH+rdCrX5rY2GhMK6/O2QR1k3ta3D7vPEV5SFs/a6x XrQoocCv2wBnlQLc0OpmMjNZsgE5MDlg36bnx9nt84bXYRGaCha1kaZRxuqy+nKtfu1z Td/Q== 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=3N0iy2J8eRGNFowJGqdNyiNWKQh5DXE+loi7lECLI40=; b=iPsAXtLmIJSn7nlV8sBHDmcVbEje19UgOp9vigi+h/0nHu6dps+cMwh2cpZ8M3b5Qe x5BLyogIhm50q6LFPSkLuoFT7VM+woXAm/9oTL7G2yZkST95Woyb6dtRxovj2ZwQavw/ 4Z/Rs1DSX1p6aMjLpJlxCA+zJPkFRo4qHSaTQsCUw/4BjXepPzGMG1Y2BEHBsM7B+J0g LbK7yncHYsa7ikzmCkrsZd8wh0COU6Rl76sl5Y80YD6NSlt0UE2nWUlNtPwR4Yo+1FXD wZ5MXlPOgSbfX25gDRaYzy7jsmey6JAnENuA0dkd4tI8nUV5saen4JGc2VfSSt8PuRtM TAcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UmvqEaKd; 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 h11si851230qtk.626.2021.12.15.03.08.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Dec 2021 03:08:26 -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=pass header.i=@linaro.org header.s=google header.b=UmvqEaKd; 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]:32804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxS92-0003Wi-PS for patch@linaro.org; Wed, 15 Dec 2021 06:08:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxRiW-0006gQ-W3 for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:41:01 -0500 Received: from [2a00:1450:4864:20::42a] (port=42980 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mxRiQ-0008PK-7G for qemu-devel@nongnu.org; Wed, 15 Dec 2021 05:41:00 -0500 Received: by mail-wr1-x42a.google.com with SMTP id c4so37352578wrd.9 for ; Wed, 15 Dec 2021 02:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3N0iy2J8eRGNFowJGqdNyiNWKQh5DXE+loi7lECLI40=; b=UmvqEaKdyDTg0wll9UQi/LVi7KAST4Moggwh9aWhCv+voIiSF/CvHEfI42KmLj097t qCXdguAYaLUKbgICfggLj/zknN6HJsS3AF1O11xLpbBtM+C/csnf9ElqJDsCtwSsdk+G JitLznrjtIbXwY9MDXTm7SD1sCayBRMNJlZzOkbhheIsoGH04YjtsD+s9nJqk9G2n8Wn LTQY5BkyrOzipQy2ng8NliqpRvbOBQIawPTHiakKg4alm8qVYnHt+wgKrG6K39YVVy3u OhlXOH5dM1xK6KIGx1ENrbgZ3KyUVqjnKHAR0oJBGC5cqHj3N+c7TRGoM5Cxhbix6FlS os5g== 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=3N0iy2J8eRGNFowJGqdNyiNWKQh5DXE+loi7lECLI40=; b=v8k1N89ieJj5KQ/S/XAl2gJGSFI2qaKJysN/pyo0R//H6327EIOKJRVy7WRURExLkP HLcVnOGnXFvFgc/mjG+UOJvdwdDGiQF4x0Hzo0mQlK70Xp893xPWWzM6Pqr8PWebVBuW ccA48KA7vwEnAnyDtDd3/F+zttbbx1i8ewv6ECkgLhekjmMeoE6OH2He0I//QXBNfGXH /kU3JHbobqrgpvhyAJnaNX4sbJJ+00HugjYmDXFnHk9aycqgfx7YveNyi9mFHgu5SE5u U+q6w52tXgAGzfJRsGWMA2/fVgO/EcnZgspBhXXXRqgOFp4lhzVctuYhYUhDT6TKwSF5 W98Q== X-Gm-Message-State: AOAM532i2qUrVvO0MOuOZOGJ7EmYIyLzLgl4M7zpCalRLFoJ6N4TCjUT X8A247FkjOUcpsqeIRtU/cn9hWNvBINy8A== X-Received: by 2002:a5d:434f:: with SMTP id u15mr3999447wrr.492.1639564851839; Wed, 15 Dec 2021 02:40:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id e18sm1600815wrs.48.2021.12.15.02.40.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:40:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/33] hw/intc: clean-up error reporting for failed ITS cmd Date: Wed, 15 Dec 2021 10:40:17 +0000 Message-Id: <20211215104049.2030475-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215104049.2030475-1-peter.maydell@linaro.org> References: <20211215104049.2030475-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) 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: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+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 Reviewed-by: Peter Maydell Message-id: 20211112170454.3158925-1-alex.bennee@linaro.org Cc: Shashi Mallela Cc: Peter Maydell Signed-off-by: Peter Maydell --- 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