From nobody Mon Feb 9 12:15:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1696682492; cv=none; d=zohomail.com; s=zohoarc; b=OcV8OFlisvi3c/A+fYL0SGaTRFxm+fkASxSjg8JTuUtwFa9JJ3GMBx9cFl154lCl9uGKcu+1uxsTv3d54cveeHKNdznWIDOU/LlhaUsIqHX9BAQtdYwINIq9RB24HLd7IIwVLKm85MD3dOEOilOS+/2dGkTx/QKzocunn0R5wvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696682492; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hlqrcCW6WI2SoijcsQ9BLxuEWIahgOUvgp3M1HY14Nw=; b=CRCF4+RV5ufLAYzTAb5tEeLeXY9ybaQGxUWYOgSFQ6U2MrWk9wk8JTI2noZSUL/S404nLS1UeVUZIe0Qyxu8BJFhQplPFsWO3741SN33SqA5I2EV7UXHFnRzOGjLWr70QKY29SimLxoOEvUKS/4oUabE56ihwJb9LG61Yw5863o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696682492711939.0184521096236; Sat, 7 Oct 2023 05:41:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qp6ab-00032V-8a; Sat, 07 Oct 2023 08:39:25 -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 1qp6aP-0002rg-5n for qemu-devel@nongnu.org; Sat, 07 Oct 2023 08:39:13 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qp6aA-0002js-CZ for qemu-devel@nongnu.org; Sat, 07 Oct 2023 08:39:12 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-9a645e54806so532291866b.0 for ; Sat, 07 Oct 2023 05:38:58 -0700 (PDT) Received: from archlinux.. (pd95eda61.dip0.t-ipconnect.de. [217.94.218.97]) by smtp.gmail.com with ESMTPSA id e27-20020a170906045b00b009b655c43710sm4241401eja.24.2023.10.07.05.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 05:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696682336; x=1697287136; darn=nongnu.org; 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=hlqrcCW6WI2SoijcsQ9BLxuEWIahgOUvgp3M1HY14Nw=; b=S/HCBr1m3/UUBq27TxldObKgnxTh9a5YUVdl3Qf07LiJxr3P76U2EVij8YlIyT1aDw wRZ25UgB3Ppj/dvKSyXPmauXXXA36hZMbqeQG9+dc9+yhbjRZ/QFyAjRXEYDOLrxAiEg q1QK/HWm6TtVlahD4n+vugs61BtcXjTdjA8rxaUTYjLynI6wm8RfJlMDLl6WZn+pDHo+ LH6oVuzPB3Jpygwx8dVxYckkbns6DBFrld5HhyVsFLcZpcAaHa20nkowHaIhPXyZWsOu JkjGytzMED1nuLoL6dNT0YzALNB7PoIj4xXscJx422zIgDyzOxRAjlVdnbwe70kHw7hF Fb8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696682336; x=1697287136; 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=hlqrcCW6WI2SoijcsQ9BLxuEWIahgOUvgp3M1HY14Nw=; b=PtEcuujKHeP9tEq1ArBd4s56r7PZ0nZhmCwAW8TbgWcxCgZVIwtzmUChmFrP6GaBVy regbx0ssIV61OO53YShYS/sfaY0K4pEhJ0CHDei6Pgpp89cwG2RBnSqg2YpDGS+EJOp7 Ff5hvY3TO4pIkpqEcTZsxwHJfQfykQKm4j8D9CzmHqiKKUk8GjRPYNosl3HdgIGGsNEx 5b0EyPsGr6Beoay3NxqUYatLRC3MPCez09dOwZczgzQllRdtKF3JajQECAuP5RzJr9lY XZ20mKIAnlI/2UNh8kIopx0PEkwHspcbVJQvOpYuQuaq0Te5oIhD7d8Z43WCyAL26IEf pwzg== X-Gm-Message-State: AOJu0YxWlDbQUi+H90+iKwPVC5hwT38gw0u+6/Xead4AXzrqpFX9Xvcj quXIeWShFuBTdD65Jjod1iQgvHdsqdo= X-Google-Smtp-Source: AGHT+IEvtyLdUJe1FtZpvq35K3jCwKZ7uOLG0Sih6L/j/k4f3eG3ekWKeuSPDZVlTp/Y+mBAbPZwww== X-Received: by 2002:a17:906:2253:b0:9b2:6db8:e108 with SMTP id 19-20020a170906225300b009b26db8e108mr9334359ejr.13.1696682335977; Sat, 07 Oct 2023 05:38:55 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Chuck Zmudzinski , Marcel Apfelbaum , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Eduardo Habkost , Aurelien Jarno , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Richard Henderson , Bernhard Beschow Subject: [PATCH v8 04/29] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS Date: Sat, 7 Oct 2023 14:38:12 +0200 Message-ID: <20231007123843.127151-5-shentey@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231007123843.127151-1-shentey@gmail.com> References: <20231007123843.127151-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=shentey@gmail.com; helo=mail-ej1-x630.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, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1696682493523100009 Content-Type: text/plain; charset="utf-8" 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 --- 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 278171752f..2317bb7974 100644 --- a/include/hw/southbridge/piix.h +++ b/include/hw/southbridge/piix.h @@ -27,7 +27,6 @@ */ #define PIIX_RCR_IOPORT 0xcf9 =20 -#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */ #define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */ =20 struct PIIXState { @@ -39,10 +38,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 =3D 64 bits with + * PIIX_NUM_PIRQS * ISA_NUM_IRQS =3D 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 117024e450..7240c91440 100644 --- a/hw/isa/piix3.c +++ b/hw/isa/piix3.c @@ -48,7 +48,7 @@ static void piix3_set_irq_level_internal(PIIX3State *piix= 3, int pirq, int level) uint64_t mask; =20 pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { + if (pic_irq >=3D ISA_NUM_IRQS) { return; } =20 @@ -62,7 +62,7 @@ static void piix3_set_irq_level(PIIX3State *piix3, int pi= rq, int level) int pic_irq; =20 pic_irq =3D piix3->dev.config[PIIX_PIRQCA + pirq]; - if (pic_irq >=3D PIIX_NUM_PIC_IRQS) { + if (pic_irq >=3D ISA_NUM_IRQS) { return; } =20 @@ -83,7 +83,7 @@ static PCIINTxRoute piix3_route_intx_pin_to_irq(void *opa= que, int pin) int irq =3D piix3->dev.config[PIIX_PIRQCA + pin]; PCIINTxRoute route; =20 - if (irq < PIIX_NUM_PIC_IRQS) { + if (irq < ISA_NUM_IRQS) { route.mode =3D PCI_INTX_ENABLED; route.irq =3D irq; } else { @@ -115,7 +115,7 @@ static void piix3_write_config(PCIDevice *dev, =20 pci_bus_fire_intx_routing_notifier(pci_get_bus(&piix3->dev)); piix3_update_irq_levels(piix3); - for (pic_irq =3D 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { + for (pic_irq =3D 0; pic_irq < ISA_NUM_IRQS; pic_irq++) { piix3_set_irq_pic(piix3, pic_irq); } } --=20 2.42.0