Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2612972rda; Wed, 25 Oct 2023 07:42:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnbxZOCDDthalEHKvJBAc6M/dSkSRolxj6jQ2gXM5+ADu8NtA93ho1atS6TTlrDf8fPbqk X-Received: by 2002:a25:358a:0:b0:d9a:4178:70d5 with SMTP id c132-20020a25358a000000b00d9a417870d5mr20648198yba.6.1698244926423; Wed, 25 Oct 2023 07:42:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698244926; cv=pass; d=google.com; s=arc-20160816; b=o0cmS9FoLPCLtk0elN/WR/o52gPen0Hn+COroUmHTYkmVFUsXk+2YVnQOHNPg+toEU 9S3Grgtr47sum/le4lbPe7P69oTwNQ6P861T3IsDncv1j7o8gju7O7jY2tXlozcXAvw3 czDunzYSIqOIx4NC5FbEcpA0zaTX/XR3SEtoWJ+Kg/tBJ/pMjtj3pGD4GN4VIjZRIrHV 47vjsnSfg/kabvxOiOZWlpUQm+sLHoQtgpRmWUiAXqXJvA3ON/nRsOH/1ZzXOI+qBDVf voCSUGwdK+fTWhHr06T5yTqcDkW4G0RB9yh5D9+VI6DbheWLS813Bqjveoe3MM+3AXWB APpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=7NJ3xuULQNMGAjaQcQOV3ILEQCB56CrGOHafwg9urkU=; fh=bM7jYwTiAnLUId0QfFdXFVUpFQ0HvbceLZH0IKIvga0=; b=S7HL9QFBfky1ljEL7Digf8rWYQnAskjObX1ttfhwQU/hdpNm2VuM295gCJlEqM5v9a gxwUgExQfyp/c65+2OTNipq3FWjMVvp7JYy64h6lEvV6/SItcRrvuYKdfrOP53JfuZHn VpNnInhrcv2TsQG2MzZw1N5R1mYhNMI3km9NRwcdEZE1/Ft4DbqXIzSXuo8tMoWK6Ii+ 6csxA2Jo9HoCRfM6dGaqpocJlWbVv1VxO9kiPz7FSVuwfWO0I+NgP1srV18vHdYHHuFs kCwnFQtgkeXxTreQiErf3ShUsYytPEi5GwszXE42tWr0Hndfm/KwWAI22PFZ1Z73VvQd vgIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="17/SfDlg"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 130-20020a250c88000000b00d9ad91f3886si9503602ybm.638.2023.10.25.07.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="17/SfDlg"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 20D3D803ACA7; Wed, 25 Oct 2023 07:42:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343498AbjJYOlo (ORCPT + 99 others); Wed, 25 Oct 2023 10:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235020AbjJYOl3 (ORCPT ); Wed, 25 Oct 2023 10:41:29 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2041.outbound.protection.outlook.com [40.107.237.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DD4510F2 for ; Wed, 25 Oct 2023 07:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=leQMMQ9Vejl4Y5deOFiy97OcxaR34K5++/0ZlPS3T89BVCyN6KzAlei6T5kmCOkhM200Hp8zhT53Am08ARuZU7TSjPD3gg1aPAPwapgT5bU5gYqCnYvqf9LFh+d7n7E9K8lIsJSCOk6VZyoj3sKQYjgWurmIIaR+abwh/mfg9kpHf3t2EOH2n8LKcPYACJ2BkE2UYI0kjFawpUv05OORfH+yDIyMwpZjY51PsFgbMqQZ448UyAY1bacq6Y2GnfEn6OXv3ffcakTwqrOgwrNZmjynrU2l/JzLxDw5uk0AqouXy3Q3uRwFev7OlFc6jo5dJ4Dxjis6WbpQpL7TW43YfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7NJ3xuULQNMGAjaQcQOV3ILEQCB56CrGOHafwg9urkU=; b=gKfoJlLXZt0mi78sbsmJnPQllYc5YdUI0wJHquJF+GPIaGVAF3lqR9Gu3Wc1Vo/6MHwMcqXZrMUPzfNI7/8aszlsNyIJC+hQpN5pwrW9teGT2W1aRXKqc4FHbrOmz+Kz/8dH1tYU77RpLihPRRmUqepdP8oIMo1oQZydh+kSq9AyvYLgqU6WCYmCsTQX9s0GtX88RAhXNyUC5vbMBR1w8zHU3AP4asyyGo6WR/I3w4wzAOXPX6X6HQi8YvtaS+Uz06fkh5C+nLCIWjXa9w76lidVRx39u4pA+GlWN1n7NeT/XGKL9Q4Wf8Xv45nc77lmNRT5HeeAzgk5/grm9Da3OA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7NJ3xuULQNMGAjaQcQOV3ILEQCB56CrGOHafwg9urkU=; b=17/SfDlgPtOfvEdgymqq+YTM4Wyh6iRbsb/9JimHoIAWz4lgy6OsRLyD+CWj70eqlXbki9/8RX6X9r4DGKaouXotUdgl02/LjKLQl3BWHk4KSJfQQoZ4VY1YprSrTspK1EZgRNMAb4ayORbsV5annwqN0YeI66nEzCP35CSVcyI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) by MW4PR12MB6874.namprd12.prod.outlook.com (2603:10b6:303:20b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.26; Wed, 25 Oct 2023 14:41:09 +0000 Received: from MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::83d7:9c4f:4d9b:1f2a]) by MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::83d7:9c4f:4d9b:1f2a%4]) with mapi id 15.20.6907.022; Wed, 25 Oct 2023 14:41:08 +0000 Message-ID: <32bcaa8a-0413-4aa4-97a0-189830da8654@amd.com> Date: Wed, 25 Oct 2023 09:41:06 -0500 User-Agent: Mozilla Thunderbird Subject: Re: PIC probing code from e179f6914152 failing Content-Language: en-US To: Thomas Gleixner , Hans de Goede , kys@microsoft.com, hpa@linux.intel.com, dlazar@gmail.com Cc: x86@kernel.org, LKML , Borislav Petkov , "Rafael J. Wysocki" References: <878r7z4kb4.ffs@tglx> <87ttqhcotn.ffs@tglx> <87v8avawe0.ffs@tglx> From: Mario Limonciello In-Reply-To: <87v8avawe0.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA1PR03CA0014.namprd03.prod.outlook.com (2603:10b6:806:2d3::10) To MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR12MB6101:EE_|MW4PR12MB6874:EE_ X-MS-Office365-Filtering-Correlation-Id: 383834bf-f96a-4bb9-6ef2-08dbd5686d13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HGOwl92mC/doJzr1rZ6jiLIYAG0RA+9kWDOXlb2G/KIouBCDZJsKAVyOZynKTyiJrIUx6N38uFRyChKGV2pqGQMltW5TwJ8w3Y7XrvcZuxLZ782tJt3joYSS73unIXR0D3tK/ilD7qwcMr1hbPMfuEVstqAPt00MkYgPZnGlDje2tinjqYXZ1isryiU4002kOeKwEElqWvKamWiQ3GqFF7SiVC61a2rMWvkOXimLm6dLcGm0qYHRH6OaXa1OS8oc+786rpKkbMCIr972Q2JplsSUPkrTso8pqDGHPHlNm/LSxtjXDRFHSOh1x937j7r2U2xhSA++M2vxbNaFhpVMpwO+Ric2U31W1k/Nv4hoCc0JJAoswGla0N1DZcPh+/wmsq7CSiPl6MZ+++Nh2dfNqj1RES4x5foRtXgIsXy1foLf8QuykpiweSZ6LtQWYZVGD68zmSBdJmhk162WQKpq7eFaWxFEByzqPfDsh78qdub7+PueIxI/4OAOs4Tek5y/gSz5EvqraDzXgKXiXzNrTo2J3g/cinCM/opEjhSGXoWZZJVuCRI78bMN+yNYhgniWmIX/cYfVNeigTPVVVd64F6KHisy5tc6iMXNx+K0LVxl9kv8mIPdpD/VeUcAqglvk+eRNbl8/AXxLrYG0Z4UiA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR12MB6101.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(346002)(136003)(376002)(366004)(39860400002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(44832011)(83380400001)(5660300002)(6506007)(53546011)(6512007)(2616005)(31686004)(54906003)(478600001)(66946007)(66476007)(6486002)(66556008)(316002)(110136005)(38100700002)(26005)(36756003)(86362001)(31696002)(4326008)(8676002)(8936002)(2906002)(41300700001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ckNad2MwZ1pHeFJOU2g3Y1o3WFJ6L0EvOVoxN1ZLWFZOMm84VGhXOHk3Z1JC?= =?utf-8?B?dXBtRC9pY0FtV01OTUt4aDdlV2kyODgzMWY2NURRRElnTVBBZnB1MDNQZlNo?= =?utf-8?B?R0UyV0xWYVpxZC9ZR25uMmxvc2tXYlVBblZFV09BckZBeXBsS3Q1aVZ4SFI0?= =?utf-8?B?aW1VOTZGbEdGL2IydS80VU13bmM4MDllQUlLdk9KK2xBNGkzaThVUHVIRExQ?= =?utf-8?B?dHhqUlR3QXUwNHliNm9IRDI4SW5YSWxxaVFSbHJMSFdDZG9sdEFMd2tsd2d1?= =?utf-8?B?ektGMWpHUUxVM1JMaHZVQzE2Vng1NytNVU5YUTJuVDB6azNuM21MNnIza1hx?= =?utf-8?B?aDR2M2JoaUdoazBwR2F4eHZXVWE3eVBuclBEOUVFNlErZDhrO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-08dbd5686d13 X-MS-Exchange-CrossTenant-AuthSource: MN0PR12MB6101.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 14:41:08.8236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OhlTZDnT+sO3gAokl1yNu+uqhHnEX3RS/3HUYU/DAV4nnm1RkutOPFcK/iR0OLjQkYW1O5anHfZ765g5H/Dypw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6874 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 25 Oct 2023 07:42:02 -0700 (PDT) On 10/25/2023 04:23, Thomas Gleixner wrote: > On Mon, Oct 23 2023 at 17:59, Thomas Gleixner wrote: >> On Thu, Oct 19 2023 at 16:20, Mario Limonciello wrote: >>> struct legacy_pic null_legacy_pic = { >>> - .nr_legacy_irqs = 0, >>> + .nr_legacy_irqs = 1, >>> .chip = &dummy_irq_chip, >>> .mask = legacy_pic_uint_noop, >>> .unmask = legacy_pic_uint_noop, >>> >>> I think it's cleaner than changing all the places that use >>> nr_legacy_irqs(). >> >> No. It's not cleaner. It's a hack and you still need to audit all places >> which depend on nr_legacy_irqs(). Also why '1'? You could as well use >> '16', no? > > So I sat down and did a thorough analysis of legacy PIC dependencies. > > Unfortunately this is an unholy mess and sprinkled all over the place, > so there is no trivial way to resolve this quickly. This needs a proper > overhaul to decouple the actual PIC driver selection from the fact that > the kernel runs on a i8259 equipped hardware and therefore needs to > honour the legacy PNP overrides etc. > > The probing itself is to stay in order to avoid sprinkling weird > conditions and NULL PIC selections all over the place. > > It could be argued that the probe function should try to initialize the > PIC, but that's overkill for scenarios where the PIC does not exist. > > Though it turns out that ACPI/MADT is helpful here because the MADT > header has a flags field which denotes in bit 0, whether the system has > a 8259 setup or not. > > This allows to override the probe for now until we actually resolved the > dependency problems in a clean way. > > Untested patch below. +David from the bugzilla. I checked his acpidump and I do think this will work for him. [024h 0036 4] Local Apic Address : FEE00000 [028h 0040 4] Flags (decoded below) : 00000001 PC-AT Compatibility : 1 David - can you see if the below helps your hardware? > > Thanks, > > tglx > --- > --- a/arch/x86/include/asm/i8259.h > +++ b/arch/x86/include/asm/i8259.h > @@ -69,6 +69,8 @@ struct legacy_pic { > void (*make_irq)(unsigned int irq); > }; > > +void legacy_pic_pcat_compat(void); > + > extern struct legacy_pic *legacy_pic; > extern struct legacy_pic null_legacy_pic; > > --- a/arch/x86/kernel/acpi/boot.c > +++ b/arch/x86/kernel/acpi/boot.c > @@ -148,6 +148,9 @@ static int __init acpi_parse_madt(struct > pr_debug("Local APIC address 0x%08x\n", madt->address); > } > > + if (madt->flags & ACPI_MADT_PCAT_COMPAT) > + legacy_pic_pcat_compat(); > + > /* ACPI 6.3 and newer support the online capable bit. */ > if (acpi_gbl_FADT.header.revision > 6 || > (acpi_gbl_FADT.header.revision == 6 && > --- a/arch/x86/kernel/i8259.c > +++ b/arch/x86/kernel/i8259.c > @@ -32,6 +32,7 @@ > */ > static void init_8259A(int auto_eoi); > > +static bool pcat_compat __ro_after_init; > static int i8259A_auto_eoi; > DEFINE_RAW_SPINLOCK(i8259A_lock); > > @@ -299,15 +300,32 @@ static void unmask_8259A(void) > > static int probe_8259A(void) > { > + unsigned char new_val, probe_val = ~(1 << PIC_CASCADE_IR); > unsigned long flags; > - unsigned char probe_val = ~(1 << PIC_CASCADE_IR); > - unsigned char new_val; > + > + /* > + * If MADT has the PCAT_COMPAT flag set, then do not bother probing > + * for the PIC. Some BIOSes leave the PIC uninitialized and probing > + * fails. > + * > + * Right now this causes problems as quite some code depends on > + * nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly > + * when the system has an IO/APIC because then PIC is not required > + * at all, except for really old machines where the timer interrupt > + * must be routed through the PIC. So just pretend that the PIC is > + * there and let legacy_pic->init() initialize it for nothing. > + * > + * Alternatively this could just try to initialize the PIC and > + * repeat the probe, but for cases where there is no PIC that's > + * just pointless. > + */ > + if (pcat_compat) > + return nr_legacy_irqs(); > + > /* > - * Check to see if we have a PIC. > - * Mask all except the cascade and read > - * back the value we just wrote. If we don't > - * have a PIC, we will read 0xff as opposed to the > - * value we wrote. > + * Check to see if we have a PIC. Mask all except the cascade and > + * read back the value we just wrote. If we don't have a PIC, we > + * will read 0xff as opposed to the value we wrote. > */ > raw_spin_lock_irqsave(&i8259A_lock, flags); > > @@ -429,5 +447,9 @@ static int __init i8259A_init_ops(void) > > return 0; > } > - > device_initcall(i8259A_init_ops); > + > +void __init legacy_pic_pcat_compat(void) > +{ > + pcat_compat = true; > +} >