Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4207674pxv; Mon, 19 Jul 2021 20:29:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT1ffYwJTS0RuTlHYUM9f893p3Ino1PvaC4D/tMZN7cMjO0S7//rTT5y8NFzLzwY7ofdXd X-Received: by 2002:a02:a595:: with SMTP id b21mr24480329jam.122.1626751793733; Mon, 19 Jul 2021 20:29:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626751793; cv=none; d=google.com; s=arc-20160816; b=cO9FCt2gLt5P8fd5slk5zjVgVgcQGNuO9MUwbipE4OFeqRAv8eKyd1q1zB7Sgn7Ew2 rOLaZfskLFhLtZB/Jz+mFrJnmJub7sxvMfuA8AOb4I/VqGpSiyxMy3qPRB95zda3ryK1 ozG+MWg4KQmJTTaHXG2LSxqmsF4zJ9yFdMpCrN2lTWT+rJtpbHbB+Hs2pDF+mc5Bp2Fs Xyh1XkYXlb+cKJ/cUUVPRB/VsQHETLoQ6EpbO49lW8JvO7k7/9Pc7HdMf4SyuLhXEAtF 49rtehsNEP2mK773zEiB5WbPKUL+L1bqtAx1v4gGz5Yl30U2QnAPwwFon9iq2n9Ing8H uZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=8vYxtSaqP58r7FvsXlsgus+H2gPKnOSCIp8gzng0K04=; b=jhdaEuboc7c9Liq7JKv9dF+QbK7QvFhusazzFNd7xvfkm+5/LKhqPpMDQ6ADN/ssjz Hsk+P+lErv04nPa9id1rgMbLwHak27YwXfULehTnR00yd0wWBu7aJfdqpgM85tTJLrXm LaAo5ytuUEBdo6q7hshTJcLYKLVKg/nfG3qgxn51jaGemV+hbDLxoC0FtfiuPi+2eyew m6iyGYEIi2J7Ddx++slRrw1cMQXDG4xjVgzjY+0qzrtaQCnuf7OUVwv5MJUHFjel9Wtj 0eYH3iNZmKCT+3k335uzIe/UYizr1pU/1MnNQxItfnWqhFcsccmfzNOjcQW0DFuw39bN YAPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si5397255iow.27.2021.07.19.20.29.42; Mon, 19 Jul 2021 20:29:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346627AbhGTCrt (ORCPT + 99 others); Mon, 19 Jul 2021 22:47:49 -0400 Received: from angie.orcam.me.uk ([78.133.224.34]:60906 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242865AbhGTCr0 (ORCPT ); Mon, 19 Jul 2021 22:47:26 -0400 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 32C1C9200BC; Tue, 20 Jul 2021 05:28:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 2B64C9200BB; Tue, 20 Jul 2021 05:28:04 +0200 (CEST) Date: Tue, 20 Jul 2021 05:28:04 +0200 (CEST) From: "Maciej W. Rozycki" To: Nikolai Zhubr , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel cc: x86@kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] x86/PCI: Add support for the Intel 82426EX PIRQ router In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Intel 82426EX ISA Bridge (IB), a part of the Intel 82420EX PCIset, implements PCI interrupt steering with a PIRQ router in the form of two PIRQ Route Control registers, available in the PCI configuration space at locations 0x66 and 0x67 for the PIRQ0# and PIRQ1# lines respectively. The semantics is the same as with the PIIX router, however it is not clear if BIOSes use register indices or line numbers as the cookie to identify PCI interrupts in their routing tables and therefore support either scheme. The IB is directly attached to the Intel 82425EX PCI System Controller (PSC) component of the chipset via a dedicated PSC/IB Link interface rather than the host bus or PCI. Therefore it does not itself appear in the PCI configuration space even though it responds to configuration cycles addressing registers it implements. Use 82425EX's identification then for determining the presence of the IB. References: [1] "82420EX PCIset Data Sheet, 82425EX PCI System Controller (PSC) and 82426EX ISA Bridge (IB)", Intel Corporation, Order Number: 290488-004, December 1995, Section 3.3.18 "PIRQ1RC/PIRQ0RC--PIRQ Route Control Registers", p. 61 Signed-off-by: Maciej W. Rozycki --- arch/x86/pci/irq.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/pci_ids.h | 1 2 files changed, 50 insertions(+) linux-x86-pirq-router-ib.diff Index: linux-macro-pirq/arch/x86/pci/irq.c =================================================================== --- linux-macro-pirq.orig/arch/x86/pci/irq.c +++ linux-macro-pirq/arch/x86/pci/irq.c @@ -447,6 +447,50 @@ static int pirq_piix_set(struct pci_dev } /* + * PIRQ routing for the 82426EX ISA Bridge (IB) ASIC used with the + * Intel 82420EX PCIset. + * + * There are only two PIRQ Route Control registers, available in the + * combined 82425EX/82426EX PCI configuration space, at 0x66 and 0x67 + * for the PIRQ0# and PIRQ1# lines respectively. The semantics is + * the same as with the PIIX router. + * + * References: + * + * "82420EX PCIset Data Sheet, 82425EX PCI System Controller (PSC) + * and 82426EX ISA Bridge (IB)", Intel Corporation, Order Number: + * 290488-004, December 1995 + */ + +#define PCI_I82426EX_PIRQ_ROUTE_CONTROL 0x66u + +static int pirq_ib_get(struct pci_dev *router, struct pci_dev *dev, int pirq) +{ + int reg; + u8 x; + + reg = pirq; + if (reg >= 1 && reg <= 2) + reg += PCI_I82426EX_PIRQ_ROUTE_CONTROL - 1; + + pci_read_config_byte(router, reg, &x); + return (x < 16) ? x : 0; +} + +static int pirq_ib_set(struct pci_dev *router, struct pci_dev *dev, int pirq, + int irq) +{ + int reg; + + reg = pirq; + if (reg >= 1 && reg <= 2) + reg += PCI_I82426EX_PIRQ_ROUTE_CONTROL - 1; + + pci_write_config_byte(router, reg, irq); + return 1; +} + +/* * The VIA pirq rules are nibble-based, like ALI, * but without the ugly irq number munging. * However, PIRQD is in the upper instead of lower 4 bits. @@ -892,6 +936,11 @@ static __init int intel_router_probe(str r->get = pirq_piix_get; r->set = pirq_piix_set; return 1; + case PCI_DEVICE_ID_INTEL_82425: + r->name = "PSC/IB"; + r->get = pirq_ib_get; + r->set = pirq_ib_set; + return 1; } if ((device >= PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN && Index: linux-macro-pirq/include/linux/pci_ids.h =================================================================== --- linux-macro-pirq.orig/include/linux/pci_ids.h +++ linux-macro-pirq/include/linux/pci_ids.h @@ -2644,6 +2644,7 @@ #define PCI_DEVICE_ID_INTEL_82375 0x0482 #define PCI_DEVICE_ID_INTEL_82424 0x0483 #define PCI_DEVICE_ID_INTEL_82378 0x0484 +#define PCI_DEVICE_ID_INTEL_82425 0x0486 #define PCI_DEVICE_ID_INTEL_MRST_SD0 0x0807 #define PCI_DEVICE_ID_INTEL_MRST_SD1 0x0808 #define PCI_DEVICE_ID_INTEL_MFD_SD 0x0820