Received: by 2002:a17:906:dac7:b0:886:babc:7eeb with SMTP id xi7csp3593569ejb; Sun, 12 Feb 2023 04:39:49 -0800 (PST) X-Google-Smtp-Source: AK7set8Ym6K4+9cZruvWLCKBvtuyfUR2jzhUVQ7MhjLbkhN40U1QMgAGx/O8DKAFPxSvK0ZYzRZF X-Received: by 2002:a05:6214:20e6:b0:56e:9f78:26c3 with SMTP id 6-20020a05621420e600b0056e9f7826c3mr8854381qvk.14.1676205589662; Sun, 12 Feb 2023 04:39:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676205589; cv=none; d=google.com; s=arc-20160816; b=OubSxhaOIU3vc18irm0GTlNvcKyFbh5WN+NIcsB3J4xxtQt2iVpJwV0OCg15LiuFe/ jYAe0GyRosksiocowm6H+bOpBn0Ek1eBisDFQo6iTPDx59K19vVnDfCZSCSvzS8mSN6K +zimiae74qpJfCOYoRHuJqNHN8Y1hpTttgB1vU+oZqSOPTBda3V7++k3OSpwcuoBVaFo 3pfANGcdFKLyBywh6s8W6lzVYZkdKomk0tZXsrXFd17JN4GUdks8WEOwyPjrGGDgJKVL otOQyLTTAwBzXnUSBKVl013GlYTojMhHhMZAJZV1nbwlwD/dSuGjXz0jXxOiDdDOttBk 55aA== 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=g3J7z7xliSlCmB9QGs/KdusO2yNEljDH1ElRLLJ5jyk=; b=JmTg39DOMtOvPfNUwGcPhd6p6oeGiUt8bignqp7jNCe1OxkJ4v+C1rSjjZipPijjNV /WcS4JZAmYesdGErel7ISY+DEumKw5GKQ8h30Ymd+s3MAqZAcnM+R1xoAaP0tCMkPg3a lkAoq9jdcAR+bmakPDn5VJtN8hON4z86o/9USLc0Rk/LsJYvrSxJN+TLjmdFCw+JzU57 WTvS9xo8CUIc+63jDnqrBZyPT9GbdTX3kFjhdd3bzDvjeZ+UoqcMIqgYPA01dowfXH76 IOlOUbgTdr2AbVksFbKQ4kEPy8tsA4mWspfaFXxP3Nr1koHo86detQNctrVRDBKnc0oJ 6ykw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O+5NX9c7; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h28-20020a0cab1c000000b0056c0b6b01e5si150191qvb.312.2023.02.12.04.39.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 04:39:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=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=@gmail.com header.s=20210112 header.b=O+5NX9c7; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRBdp-000861-W1; Sun, 12 Feb 2023 07:39:39 -0500 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 1pRBdC-0007ae-2j; Sun, 12 Feb 2023 07:38:59 -0500 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRBd6-0001Lh-PJ; Sun, 12 Feb 2023 07:38:57 -0500 Received: by mail-ej1-x62a.google.com with SMTP id qw12so25909012ejc.2; Sun, 12 Feb 2023 04:38:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=g3J7z7xliSlCmB9QGs/KdusO2yNEljDH1ElRLLJ5jyk=; b=O+5NX9c77Q5EpQnyQfSBgESW5kIh9wxlYEtEJqLg7xVPC+ldxfrPErN+nfHEXnzDrd cAJCfPisarzMoXnGR40wTT/ZrqjUDvzUyRQAG9gT1aJhk1yiFjb2NZJLxvMbCDKsg3DZ DzR33euikHlu7FvpTftSab9sl3nspq5VuS7jaM1v7WaXuUIV7GH6kV9Z7y9/6acJ+sCT 6fNIFjXD2mkAGI7C2i6RGa5Nbn06xyjLVaiUkMy6kJ4M2QFGE6MW0Re4YNQZkfmt9K0K 57tdiKmodelJM+wYJwDToxDqb++Bj8mgxgUjByGrUuS4IbIVIL0W5tWX2xbgsYmfaZ/a FKLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=g3J7z7xliSlCmB9QGs/KdusO2yNEljDH1ElRLLJ5jyk=; b=L6AhG4sHXN+v1jWQCD9Fqcmal4jLaM1CKjjP5CAPxwjCd2yCXgKHT75YZ57I6lifTV Kt++ywNVYMhuzm6GgPdZuL7ufc8whcU/yJUtKZTAXFu9xN6kjdvl/nc786xuWZ2HCqwX AqJB75E1BCVZBCD5ZLuDcWKbwJLU1pW0OryzkHcc/OBTK4k1XkuvZaVW5S1W5H8YKvfz /OUFIK+kdZD+Hy4YZKeC4qWUTPS+c4spdtWMlmh+Me2A57QPPfTmcaJmXcWYYNBngunT w+4ICN4ZRVMJ83H+BmIYYOvEnhbk6/BFOBdOD1c0N+xnxyYs2B8VAJwlZBrRF6CkNlqa 5Zpg== X-Gm-Message-State: AO0yUKX5af8MEWp6Kw9mBfecCEBiN+dJkXiG6m4SYwvJ5NthAAYIgAmq e1YZ750f/ZcPsFZF9hO7Lq/5xqc7A+k= X-Received: by 2002:a17:906:d9cb:b0:895:ef96:9d9b with SMTP id qk11-20020a170906d9cb00b00895ef969d9bmr21355812ejb.30.1676205530252; Sun, 12 Feb 2023 04:38:50 -0800 (PST) Received: from localhost.localdomain (dynamic-077-011-172-153.77.11.pool.telefonica.de. [77.11.172.153]) by smtp.gmail.com with ESMTPSA id qw14-20020a170906fcae00b008af1f1bee79sm5233164ejb.9.2023.02.12.04.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Feb 2023 04:38:49 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-arm@nongnu.org, Elena Ufimtseva , qemu-block@nongnu.org, Richard Henderson , Jiaxun Yang , Peter Maydell , Gerd Hoffmann , Ani Sinha , John Snow , Marcel Apfelbaum , Aurelien Jarno , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Jagannathan Raman , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Igor Mammedov , John G Johnson , Bernhard Beschow Subject: [PATCH v7 09/23] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS Date: Sun, 12 Feb 2023 13:37:51 +0100 Message-Id: <20230212123805.30799-10-shentey@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230212123805.30799-1-shentey@gmail.com> References: <20230212123805.30799-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=shentey@gmail.com; helo=mail-ej1-x62a.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+alex.bennee=linaro.org@nongnu.org Sender: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: 1Ew7cvGTpsU2 PIIX_NUM_PIC_IRQS is assumed to be the same as ISA_NUM_IRQS, otherwise inconsistencies can occur. Signed-off-by: Bernhard Beschow Reviewed-by: Michael S. Tsirkin Message-Id: <20221022150508.26830-21-shentey@gmail.com> --- include/hw/southbridge/piix.h | 5 ++--- hw/isa/piix3.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h index f84a5d15cf..096a85e384 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -31,7 +31,6 @@ */ #define PIIX_RCR_IOPORT 0xcf9 -#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ struct PIIXState { @@ -43,10 +42,10 @@ struct PIIXState { * So one PIC level is tracked by PIIX_NUM_PIRQS bits. * * PIRQ is mapped to PIC pins, we track it by - * PIIX_NUM_PIRQS * PIIX_NUM_PIC_IRQS = 64 bits with + * PIIX_NUM_PIRQS * ISA_NUM_IRQS = 64 bits with * pic_irq * PIIX_NUM_PIRQS + pirq */ -#if PIIX_NUM_PIC_IRQS * PIIX_NUM_PIRQS > 64 +#if ISA_NUM_IRQS * PIIX_NUM_PIRQS > 64 #error "unable to encode pic state in 64bit in pic_levels." #endif uint64_t pic_levels; diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c index dfdae27daf..55835912b8 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -52,7 +52,7 @@ static void piix3_set_irq_level_internal(PIIX3State *piix3, int pirq, int level) uint64_t mask; pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >= PIIX_NUM_PIC_IRQS) { + if (pic_irq >= ISA_NUM_IRQS) { return; } @@ -66,7 +66,7 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pirq, int level) int pic_irq; pic_irq = piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >= PIIX_NUM_PIC_IRQS) { + if (pic_irq >= ISA_NUM_IRQS) { return; } @@ -87,7 +87,7 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opaque, int pin) int irq = piix3->dev.config[PIIX_PIRQCA + pin]; PCIINTxRoute route; - if (irq < PIIX_NUM_PIC_IRQS) { + if (irq < ISA_NUM_IRQS) { route.mode = PCI_INTX_ENABLED; route.irq = irq; } else { @@ -119,7 +119,7 @@ static void piix3_write_config(PCIDevice *dev, pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); piix3_update_irq_levels(piix3); - for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { + for (pic_irq = 0; pic_irq < ISA_NUM_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } -- 2.39.1