From patchwork Tue Jun 6 10:46:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 689739 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp2561835wru; Tue, 6 Jun 2023 03:47:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WtBtMBYi8tEChjNN9ULYP7lMWb0m44Uqd3Dm5dgvkd6dwvnJMQJaIeSf76YZb6NY4HnP7 X-Received: by 2002:a05:620a:4409:b0:75c:cc9f:1e3f with SMTP id v9-20020a05620a440900b0075ccc9f1e3fmr1664996qkp.4.1686048432841; Tue, 06 Jun 2023 03:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686048432; cv=none; d=google.com; s=arc-20160816; b=cEs38sOurMBRKejrnZm8K2JTILo8sNGWdaTIfuBpjEwaTFRDfvsKEEuhoNTp4QjIPl CkXvekm+fZe3OWVNHtJJHfOWe6HfJMjai2ds8lbKfBGIfCjwz+E4R9/c79gt9alfmTQf +PrcnudwPJz/3oIsm4ef8dDYKrSjcHqwftBkP8Wf24RP9wnPN/KTtuLUnsRnylYQ3Jgc TU6eEwIs/DdPBLhvmAgvqs5lzYwTyIbnkobMeI1aBj97tggDIjCat4BkepXvkYr2Ev4l q/97ywm+YszgsaEohKt0glAQN4MROvGZxiDSux4+L/p2xYW6QLY/vicsoIy+WE0GPSnq +vpA== 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:cc:to :from:dkim-signature; bh=4aD9+19nYJuVLBjwZpPyQ1i9VBe5ol2xDDEn/QIZ0OQ=; b=J93nfVcnz41hP98c+jdathl2/xYm2DlB7QrbcLn1z4KNXGhLYT0uhk2nql33eejcDe LP3FCVsC1LQu7brFdbdUiCE0BqJTPwBQ/HOZp7x5BybvgKsyuhs+RAJ2IQ5r2dw035L7 qUUSfEzx+KZTRU/kk0HsWZtivSqpFIQC3Ai2wu48vs/mkzr7kCTsJKpaBwIGL6mDbztU DXsI12Y+HVXB5PBLsR4ywtNQqyGboo5DHH5y0c5YM4LvVXkMDy0t0yrEe57kJaJx0Fbw uCY1pNhzSVHxzOp84xuJroX7D12uI1T9niWHpbU6xQoCLquY3vGxX2Rcf6RwiViQ3gfz /vAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CIJ8oOID; 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 dc8-20020a05620a520800b0074b0b533931si5696479qkb.147.2023.06.06.03.47.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Jun 2023 03:47: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=CIJ8oOID; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6UCg-00015q-Dc; Tue, 06 Jun 2023 06:46:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6UCe-00013y-LJ for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:46:16 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6UCb-0008Ei-9x for qemu-devel@nongnu.org; Tue, 06 Jun 2023 06:46:16 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f7353993cbso21378475e9.0 for ; Tue, 06 Jun 2023 03:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686048371; x=1688640371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4aD9+19nYJuVLBjwZpPyQ1i9VBe5ol2xDDEn/QIZ0OQ=; b=CIJ8oOIDc6dTDWS1nq6qF9glYAhB1YR/HoIJirnb8WXyKD3d35NJHick7/SorY2z0x Vbcrx4TqayC04jpTAf89/FOeBn7hgK3C/5BQb+yTI761D2P5DbPVA6GmONOscP458WTJ 3bllAoUbFdX8vH6d8xsmgYOBjWCgceEaTWbIg06N808NnmCOohC3Bj8mUwjhWL0oEZeP TTQ4S/zuwqkGV/9tb2MHqlxRg2LAq9ccpVQ4WHQV9ztwcp8MIhzHtEUGwygX0lArIWts HVlG4dBbhwo8cFEjRwlYcVdS/Ch+yzgPxsxDcA59GYHA8hhAI6X7cNXP7LcF8aTXtSRK 5gXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686048371; x=1688640371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4aD9+19nYJuVLBjwZpPyQ1i9VBe5ol2xDDEn/QIZ0OQ=; b=MxXNQpHSRhwPF191lUOTK8tLArTIJeqN9n63/lroJy5lSM01cPn3StTiRH5LV7DRT3 x2x99lSmL0Mpjg9oBeT8ApC4TDDCmRBfDXyYSJBAlHnTmeoKZWt/U4Sf7a13tNk2QYti Z+0UG81NQKBLD99wXRE+uvrPwRntA0Oe/373cfHL3fAnYCnANynkvVnjebtOfWnPcpsW JWKyScqyWBhMaCqszGWFJvVnOvnStaCXli1w1gZL0eCtbcKsJ2sgVQSvi8tVMhw+tvYQ ia6mmqkqHBcAiRtnUdwejcfuYYbOJxUKaBZQmHmxktkj1yifsaZ5444fCF0Y0dvrLvyY jZtw== X-Gm-Message-State: AC+VfDyfA3eKCifRMpLDQ4HtVy7GMDox9bATAq3tp3Kh/RYHKILp/co6 7V7ceuj5beR22nEViI/MLGIoXw== X-Received: by 2002:a7b:c417:0:b0:3f7:367a:bd28 with SMTP id k23-20020a7bc417000000b003f7367abd28mr1552445wmi.4.1686048371156; Tue, 06 Jun 2023 03:46:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y17-20020a1c4b11000000b003f7298a32ccsm12195508wma.41.2023.06.06.03.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 03:46:10 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Beniamino Galvani , Strahinja Jankovic , Guenter Roeck , qemu-stable@nongnu.org, Michael Tokarev Subject: [PATCH 1/2] hw/intc/allwinner-a10-pic: Handle IRQ levels other than 0 or 1 Date: Tue, 6 Jun 2023 11:46:08 +0100 Message-Id: <20230606104609.3692557-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606104609.3692557-1-peter.maydell@linaro.org> References: <20230606104609.3692557-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=unavailable 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-bounces+patch=linaro.org@nongnu.org In commit 2c5fa0778c3b430 we fixed an endianness bug in the Allwinner A10 PIC model; however in the process we introduced a regression. This is because the old code was robust against the incoming 'level' argument being something other than 0 or 1, whereas the new code was not. In particular, the allwinner-sdhost code treats its IRQ line as 0-vs-non-0 rather than 0-vs-1, so when the SD controller set its IRQ line for any reason other than transmit the interrupt controller would ignore it. The observed effect was a guest timeout when rebooting the guest kernel. Handle level values other than 0 or 1, to restore the old behaviour. Fixes: 2c5fa0778c3b430 ("hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()") Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Tested-by: Guenter Roeck --- hw/intc/allwinner-a10-pic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c index 4875e68ba6a..d0bf8d545ba 100644 --- a/hw/intc/allwinner-a10-pic.c +++ b/hw/intc/allwinner-a10-pic.c @@ -51,7 +51,7 @@ static void aw_a10_pic_set_irq(void *opaque, int irq, int level) AwA10PICState *s = opaque; uint32_t *pending_reg = &s->irq_pending[irq / 32]; - *pending_reg = deposit32(*pending_reg, irq % 32, 1, level); + *pending_reg = deposit32(*pending_reg, irq % 32, 1, !!level); aw_a10_pic_update(s); }