From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amdcloud-onmicrosoft-com header.b=sxNbTBcd; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.75.79, mailfrom: garrett.kirkendall@amd.com) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (NAM02-BL2-obe.outbound.protection.outlook.com [40.107.75.79]) by groups.io with SMTP; Tue, 28 May 2019 09:36:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zNlmmizw3WCg2UxQ4OLJiYjVkGGMFkafL9RZVDrmdls=; b=sxNbTBcds8mNRDnIXyNB9kVQOJyUs12c4fTDKZUAcYMRbniGxqhgo8DBO/w739G6s84ESIRHcIzcL73eadHH49TSR1Ua0AJ8YrMyW94OW6I0DinJdOmCyD1Fv2+KeJbo/0ID6Tt0VF9DIGB+dpgDLsQwl0XhAPjQVpbSMNcaG3Q= Received: from DM6PR12MB2730.namprd12.prod.outlook.com (20.176.118.84) by DM6PR12MB3434.namprd12.prod.outlook.com (20.178.198.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.15; Tue, 28 May 2019 16:36:06 +0000 Received: from DM6PR12MB2730.namprd12.prod.outlook.com ([fe80::ec97:a83f:e2c:54da]) by DM6PR12MB2730.namprd12.prod.outlook.com ([fe80::ec97:a83f:e2c:54da%6]) with mapi id 15.20.1922.021; Tue, 28 May 2019 16:36:06 +0000 From: "Kirkendall, Garrett" To: "devel@edk2.groups.io" , "hao.a.wu@intel.com" CC: Ray Ni , Andrew Fish , Laszlo Ersek , Leif Lindholm , Michael D Kinney Subject: Linux Kernel soft hangs if 8259 PIC is not configured by BIOS: was (RE: [edk2-devel] [RFC][PATCH v1 0/1] PcAtChipsetPkg: Remove framework modules) Thread-Topic: Linux Kernel soft hangs if 8259 PIC is not configured by BIOS: was (RE: [edk2-devel] [RFC][PATCH v1 0/1] PcAtChipsetPkg: Remove framework modules) Thread-Index: AdUVcyKWCxYtiJo2QI+CMTGTDjwSAg== Date: Tue, 28 May 2019 16:36:06 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Garrett.Kirkendall@amd.com; x-originating-ip: [165.204.77.11] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c65b7751-5d19-447d-a275-08d6e38a94fb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DM6PR12MB3434; x-ms-traffictypediagnostic: DM6PR12MB3434: x-ms-exchange-purlcount: 22 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1148; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6029001)(396003)(376002)(366004)(136003)(346002)(39860400002)(199004)(189003)(13464003)(99286004)(486006)(14454004)(7696005)(476003)(26005)(25786009)(6506007)(53546011)(8936002)(4326008)(102836004)(81166006)(2501003)(8676002)(86362001)(81156014)(2906002)(186003)(305945005)(71200400001)(33656002)(74316002)(6116002)(52536014)(76116006)(64756008)(66476007)(66446008)(73956011)(66556008)(66946007)(53936002)(6436002)(6306002)(9686003)(55016002)(110136005)(54906003)(966005)(68736007)(316002)(72206003)(66066001)(3846002)(7736002)(256004)(5660300002)(71190400001)(19627235002)(478600001)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3434;H:DM6PR12MB2730.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: c1yCAsirfVGydRqhGDiogp3yBkGiNrQwwQTTZECz8k5Rl6oJaS14WYuT6yhoKalN7ViCQX1vOYMjzisPsOHFkvg3UBT0S98Rtt1MH5bMEHA7NTmZrPS3cIlicgqibGorW743gwv5CiXNciGeJzFn/2PhoAnrJfjDAtXIFHlKHMLmtGoTRG6SXwzgbFPKQtDu+OI/e1H5k84P7OSI7tvLYw9d8gA6Ag3TrUfcokjUTeUoF6pAMsir6A7ZwbXL2QSa/+n/q7hl6NKtFXv1w8OZFBLKUxZw6ZTPnR0F8D2bvmCnwgN1G9Nb/D5NHew6bNVfBfaw04TlreSnlqCniyBehLEA9oWY8O6CXOTAlkD7RS5e0gyGG7piL1zOm6W+BRrliIyW7lRjpuBh7mxwOHWZmhbmAgOLIsIEaaOv9PHTYA0= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c65b7751-5d19-447d-a275-08d6e38a94fb X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2019 16:36:06.2255 (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: gkirkend@amd.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3434 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Since this change will be removing the 8259 PIC driver, I'll mention a quir= k I ran into in the Linux Kernel up through at least 5.0 (and I am sure lat= er, I just didn't verify): Does anyone have pull in the Linux Kernel world to get them to take this s= eriously? Hopefully someday soon end users will let legacy devices, like t= he PIC, die a long overdue and graceful death. I sent the following to the responsible Linux Kernel developers and quickl= y got back a "working as designed" response: ************************* I am trying to boot a UEFI BIOS with minimal legacy hardware support. The= Linux kernel soft hangs when the PIC is not configured by the BIOS because= it is using IOAPIC. Hopefully, this provides enough information. Observed under Ubuntu Server Linux 18.04 LTS with kernel 4.15.0, and with = kernel compiled from source tag v5.0 Where it hangs: Soft hang occurs in calibrate_APIC_clock(): https://github.com/torvalds/li= nux/blob/v5.0/arch/x86/kernel/apic/apic.c#L805 specific location of soft hang waiting for interrupts: https://github.com/= torvalds/linux/blob/v5.0/arch/x86/kernel/apic/apic.c#L854 How it gets to the hang: If 8259A PIC is not configured before kernel is launched, HPET IRQ 0 regis= tration fails because probe_8259A returns PIC as not available and therefor= e interrupt descriptors 0-15 are not allocated. This happens when BIOS doe= s not configure 8259A PIC because it uses IOAPIC. This sequence prevents allocating interrupts 0-15 unless PIC is configured= before kernel starts. legacy_pic.init =3D init_8259A is not called before= early_irq_init(): early_irq_init(): https://github.com/torvalds/linux/blob/v5.0/init/main.= c#L642 initcnt =3D arch_probe_nr_irqs(): https://github.com/torvalds/linux/bl= ob/v5.0/kernel/irq/irqdesc.c#L512 return legacy_pic->probe(): https://github.com/torvalds/linux/blob/v= 5.0/arch/x86/kernel/apic/vector.c#L656 default_legacy_pic.probe: https://github.com/torvalds/linux/blob/v= 5.0/arch/x86/kernel/i8259.c#L418 probe_8259A(): https://github.com/torvalds/linux/blob/v5.0/arch/= x86/kernel/i8259.c#L301 interrupt 0-15 descriptors not allocated and prevents IOAPIC interrupt= s 0-15: https://github.com/torvalds/linux/blob/v5.0/kernel/irq/irqdesc.c#L= 525 In this call is where init_8259A is called and PIC is initialized. Howeve= r, interrupt descriptors for 0-15 were not allocated in early_irq_init() se= quence, so descriptors are not available later. init_IRQ() : https://github.com/torvalds/linux/blob/v5.0/init/main.c#L64= 3 This sequence tries to register the HPET to irq0, but irq0 descriptor is n= ot allocated by early_irq_init() sequence: late_time_init(): https://github.com/torvalds/linux/blob/v5.0/init/main.= c#L703 late_time_init =3D x86_late_time_init: https://github.com/torvalds/lin= ux/blob/v5.0/arch/x86/kernel/time.c#L107 x86_init.timers.timer_init(): https://github.com/torvalds/linux/blob= /v5.0/arch/x86/kernel/time.c#L92 x86_init.timers.timer_init =3D hpet_time_init: https://github.com/= torvalds/linux/blob/v5.0/arch/x86/kernel/x86_init.c#L75 setup_default_timer_irq(): https://github.com/torvalds/linux/blo= b/v5.0/arch/x86/kernel/time.c#L83 if (setup_irq(0, &irq0)): https://github.com/torvalds/linux/bl= ob/v5.0/arch/x86/kernel/time.c#L78 This gets called at some point after the above sequences, I couldn't track= it all the way back to main.c easily: x86_init.timers.setup_percpu_clockev =3D setup_boot_APIC_clock: https://= github.com/torvalds/linux/blob/v5.0/arch/x86/kernel/x86_init.c#L74 https://github.com/torvalds/linux/blob/v5.0/arch/x86/kernel/apic/apic.= c#L961 *** soft hang in calibrate_APIC_clock(): https://github.com/torvalds= /linux/blob/v5.0/arch/x86/kernel/apic/apic.c#L854 ************************* GARRETT KIRKENDALL SMTS Firmware Engineer | CTE 7171 Southwest Parkway, Austin, TX 78735 USA=20 AMD=A0=A0 facebook=A0 |=A0 amd.com -----Original Message----- From: devel@edk2.groups.io On Behalf Of Wu, Hao A v= ia Groups.Io Sent: Monday, May 27, 2019 1:37 AM To: devel@edk2.groups.io Cc: Hao A Wu ; Ray Ni ; Andrew Fish = ; Laszlo Ersek ; Leif Lindholm ; Michael D Kinney Subject: [edk2-devel] [RFC][PATCH v1 0/1] PcAtChipsetPkg: Remove framework= modules [CAUTION: External Email] ''' Please note that this patch will be hold until all the below requirements = are met: A. edk2-stable201905 is created; B. OvmfPkg has drop its usage of the legacy ISA stack (which includes the IsaAcpiDxe driver); C. UefiPayloadPkg has been updated to drop its consume to the 8259InterruptControllerDxe driver. ''' This patch itself will not be sent to the mailing list and is only availab= le at: https://github.com/hwu25/edk2/tree/delete_framework (https://github.com/hwu25/edk2/commit/84e58f89f6d03f9cc3399cced9d5d5529e06= a416) Below modules will be removed from PcAtChipsetPkg: * PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf * PcAtChipsetPkg/8254TimerDxe/8254Timer.inf * PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf They are considered legacy framework components and will no longer be used= after the removal of IntelFramework[Module]Pkg. Also, the unused (after the modules being removed) PCDs will be deleted in= package level DEC/UNI files. Cc: Ray Ni Cc: Andrew Fish Cc: Laszlo Ersek Cc: Leif Lindholm Cc: Michael D Kinney Hao A Wu (1): PcAtChipsetPkg: Remove framework modules PcAtChipsetPkg/PcAtChipsetPkg.dec | 58 -- PcAtChipsetPkg/PcAtChipsetPkg.dsc | 5 +- PcAtChipsetPkg/8254TimerDxe/8254Timer.inf | 42 -- PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf | 46 -- PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf | 50 -- PcAtChipsetPkg/8254TimerDxe/Timer.h | 185 -----= - PcAtChipsetPkg/8259InterruptControllerDxe/8259.h | 220 -----= -- PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.h | 269 -----= ---- PcAtChipsetPkg/8254TimerDxe/Timer.c | 401 -----= -------- PcAtChipsetPkg/8259InterruptControllerDxe/8259.c | 622 -----= --------------- PcAtChipsetPkg/IsaAcpiDxe/ComponentName.c | 301 -----= ----- PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.c | 353 -----= ------ PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c | 386 -----= ------- PcAtChipsetPkg/8254TimerDxe/Timer.uni | 16 - PcAtChipsetPkg/8254TimerDxe/TimerExtra.uni | 14 - PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259.uni | 16 - PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259Extra.uni | 14 - PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.uni | 16 - PcAtChipsetPkg/IsaAcpiDxe/IsaAcpiExtra.uni | 14 - PcAtChipsetPkg/PcAtChipsetPkg.uni | 52 +- 20 files changed, 2 insertions(+), 3078 deletions(-) delete mode 100644 = PcAtChipsetPkg/8254TimerDxe/8254Timer.inf delete mode 100644 PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf delete mode 100644 PcAtChipsetPkg/8254TimerDxe/Timer.h delete mode 100644 PcAtChipsetPkg/8259InterruptControllerDxe/8259.h delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.h delete mode 100644 PcAtChipsetPkg/8254TimerDxe/Timer.c delete mode 100644 PcAtChipsetPkg/8259InterruptControllerDxe/8259.c delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/ComponentName.c delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.c delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/PcatIsaAcpi.c delete mode 100644 PcAtChipsetPkg/8254TimerDxe/Timer.uni delete mode 100644 PcAtChipsetPkg/8254TimerDxe/TimerExtra.uni delete mode 100644 PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259.u= ni delete mode 100644 PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259Ex= tra.uni delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.uni delete mode 100644 PcAtChipsetPkg/IsaAcpiDxe/IsaAcpiExtra.uni -- 2.12.0.windows.1