From patchwork Mon Jun 26 18:58:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 696480 Delivered-To: patch@linaro.org Received: by 2002:adf:e885:0:0:0:0:0 with SMTP id d5csp3390274wrm; Mon, 26 Jun 2023 12:12:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GeYEQbpupX8RoVUeiSgnxRCzs7H0mr24fhuVM2XFNE1hWBWjkbLEMod9kN29MIsHVwEdM X-Received: by 2002:a0d:d9c7:0:b0:565:a3e6:1b7b with SMTP id b190-20020a0dd9c7000000b00565a3e61b7bmr29923113ywe.18.1687806729864; Mon, 26 Jun 2023 12:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687806729; cv=none; d=google.com; s=arc-20160816; b=GCYdmyQfSWMayhGdydjCO6Pgi4SmFqwCjiW4Ri7sy9BAETFaxkAwPv/OUjyRu533L7 +ct7fyVjW10JAJ0YVR8k/7YB5MemToA980mMc+JDTCqIv8phP2cpAGMq/Dk6a89v0s/B 1P/nQceecU88PbgJm3w72zpSqjsGx1gu3WxW/KuWJnMye3OlSV2JhuUDBKMEP6AH0Pd+ kM5R2xXnTsjFzenvTK8gozBFv+uDhbP+lcMnLYO4hqn7DC1sIS18Nrf+yTxUu9OSJTqh gCmCpvJioHnjFt33c+SOkBZ0nXt7zGg6pecPnwaPpIbLYPX6tqk3n1a3l544DQOZ0s6e kQcw== 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; bh=+6wr5riQEs84r4DX8fVIKbQW+ymbnnvOaCUJc9Pl2fw=; fh=aDE9/c4c4updyTg5EjMEty1hnd1R8wyIvX5PILnUv5k=; b=e9NnPePnuELi7CExAVNYZs+D3m5QkKZtYSkljx+xKhDeO9m4fsCFIZZw/ui/QLToKk rmPTJdg9cW42VReMyM9EvH47alV5/gYU6CsfFwnpHUNFREMOxBNDIXq/ujIT9vBUXGpL +JAYz4BATfLWN7GBHi7iZbm9aL0zJAILls4zzq096gIMvClghBRx6kIX2h/NFJxqavlc pUCjlZ+Dmw9UOzvW3kzG9AkJGOXDtTxjOZEe7FUfpqJj0rWLcuryo6QgdNk9C5wppAwX SeCxvheoYpEAWIwHPON50cI70gmh4Cl9e1H1prQCzzolgAAvsEg9cK/cQvK48Fd9fd9O NXNw== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id br35-20020a05620a462300b007625731b2besi2175676qkb.551.2023.06.26.12.12.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Jun 2023 12:12:09 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDrTs-0002ha-5O; Mon, 26 Jun 2023 15:02:34 -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 1qDrTG-0000Vc-F5; Mon, 26 Jun 2023 15:01:54 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDrTD-0007qp-86; Mon, 26 Jun 2023 15:01:54 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 03CDDEFC2; Mon, 26 Jun 2023 21:59:14 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 8ABD3F7FE; Mon, 26 Jun 2023 21:59:12 +0300 (MSK) Received: (nullmailer pid 1575376 invoked by uid 1000); Mon, 26 Jun 2023 18:59:05 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org, qemu-stable@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Guenter Roeck , Michael Tokarev Subject: [Stable-7.2.4 33/43] hw/intc/allwinner-a10-pic: Handle IRQ levels other than 0 or 1 Date: Mon, 26 Jun 2023 21:58:51 +0300 Message-Id: <20230626185902.1575177-33-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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 From: Peter Maydell 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()") (Mjt: 5eb742fce562dc7 in stable-7.2) Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Tested-by: Guenter Roeck Message-id: 20230606104609.3692557-2-peter.maydell@linaro.org (cherry picked from commit f837b468cdaa7e736b5385c7dc4f8c5adcad3bf1) Signed-off-by: Michael Tokarev diff --git a/hw/intc/allwinner-a10-pic.c b/hw/intc/allwinner-a10-pic.c index 4875e68ba6..d0bf8d545b 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); }