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=s55xMC1v; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.70.51, mailfrom: garrett.kirkendall@amd.com) Received: from NAM04-SN1-obe.outbound.protection.outlook.com (NAM04-SN1-obe.outbound.protection.outlook.com [40.107.70.51]) by groups.io with SMTP; Tue, 28 May 2019 10:31:16 -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=KH83ip1c+4ObJ6HbN1TUBpUMtRO1AiERbjl/+rxTF0I=; b=s55xMC1vKrHFNRupmN5Ek7uQd6UgUMZ6YaZYkgYf0cU3Qc0vO2WTowXpgpcD4AnKJB+b63k4PKhujeKV9fK482vG/9w0g11ildYGT47QfXAigHRv9qqZ2MMAHtZSQgeY1Ao+hOTxFFKvk/6Lc/XEQXeVhOD3U4vcUWhjdqJhG9o= Received: from DM6PR12MB2730.namprd12.prod.outlook.com (20.176.118.84) by DM6PR12MB3627.namprd12.prod.outlook.com (20.178.199.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1922.18; Tue, 28 May 2019 17:31:11 +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 17:31:11 +0000 From: "Kirkendall, Garrett" To: "Kinney, Michael D" , "devel@edk2.groups.io" , "Wu, Hao A" CC: "Ni, Ray" , Andrew Fish , Laszlo Ersek , Leif Lindholm Subject: Re: 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+CMTGTDjwSAgABCYowAABB0pA= Date: Tue, 28 May 2019 17:31:10 +0000 Message-ID: References: In-Reply-To: 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: 317a9de9-0928-4f66-b95a-08d6e39246e1 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:DM6PR12MB3627; x-ms-traffictypediagnostic: DM6PR12MB3627: x-ms-exchange-purlcount: 8 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 00514A2FE6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6029001)(346002)(136003)(396003)(376002)(366004)(39860400002)(13464003)(189003)(199004)(476003)(6306002)(68736007)(9686003)(55016002)(54906003)(6436002)(53936002)(99286004)(66066001)(33656002)(110136005)(19627235002)(81156014)(76176011)(8936002)(7696005)(486006)(446003)(81166006)(26005)(8676002)(316002)(86362001)(53546011)(25786009)(6506007)(102836004)(229853002)(11346002)(14454004)(52536014)(64756008)(66476007)(30864003)(66946007)(66556008)(3846002)(256004)(14444005)(6246003)(966005)(2906002)(186003)(478600001)(73956011)(2501003)(6116002)(4326008)(5660300002)(7736002)(74316002)(66446008)(305945005)(72206003)(71190400001)(71200400001)(76116006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3627;H:DM6PR12MB2730.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: FHgWy7wpMb59sGfegk38Ra9xXdgEcjVTlvcYrxGNqb69sdV/dNiICgM4elefcAacFNlzchkMBueYs/o5IIEgwh8uZADxq9cVH9Zk2RAND0VVbWZgQRPPtQy227wa0KomARHymaS++Y3USp0PbBMRKYtkjurFf9uBSpzv2RTtbzH88YiVcp/lm1euHpTrZhIcmK8xcZwMmvfIcbIMe/urGvbiEMrWphamJZXZxajJGnXJbxilXcxsHjr09QJfcw1pkzJDHoFyP1MiZH65+ImcY/Go0sPNKy2Bqjp09aLRDFATtHU7X3eoP+7axneVwfbkQfobWcavzpMzy64iMKHCDuS7kHXMyV7YMapte2rhGkE4pdtayMSrEo7h667Nh2KTkiol8GoSqoZ2Xt5FzG7gWiD2hXz+SxNOUWuX4sELIwI= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 317a9de9-0928-4f66-b95a-08d6e39246e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 May 2019 17:31:11.1813 (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: DM6PR12MB3627 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable See below -----Original Message----- From: Kinney, Michael D =20 Sent: Tuesday, May 28, 2019 12:07 PM To: Kirkendall, Garrett ; devel@edk2.groups.io= ; Wu, Hao A ; Kinney, Michael D Cc: Ni, Ray ; Andrew Fish ; Laszlo Erse= k ; Leif Lindholm Subject: RE: Linux Kernel soft hangs if 8259 PIC is not configured by BIOS= : was (RE: [edk2-devel] [RFC][PATCH v1 0/1] PcAtChipsetPkg: Remove framewor= k modules) [CAUTION: External Email] Hi Garrett, Two thoughts on this issue: 1) Just because 8259 is not used by UEFI FW does not mean the 8259 HW shou= ld not be initialized into an OS compatible state. This init code could b= e part of the chipset/si init code without requiring the 8259 driver/prot= ocol. [Garrett:] The Linux Kernel only allocates "descriptors"/structures for In= terrupts 0-15, PIC or IOAPIC mode, if a legacy PIC is available and respond= s the expected way. The Kernel will initialize the PIC, but not until afte= r this initial probe of the PIC. If the PIC simply did not exist in the ha= rdware, these interrupts would not be allowed/allocated even for an IOAPIC.= I was hoping to not need to do anything with the legacy PIC since I had n= o plans to use it for this UEFI implementation. 2) The HPET driver in PcAtChipsetPkg can be configured to use IOAPIC or MS= I delivery for interrupts. Is there a way for Linux to also use MSI delivery instead of IOAPIC delivery? [Garrett:] This is a very early timer initialization sequence and the PIC= /IOAPIC will be fully initialized later. Since the PIC didn't respond corr= ectly, I don't think interrupts 0-15 would be allowed later. I'm not sure = if the kernel allows MSI for the HPET when everything is configured, I didn= 't go slogging through to figure out. Thanks, Mike > -----Original Message----- > From: Kirkendall, Garrett > [mailto:Garrett.Kirkendall@amd.com] > Sent: Tuesday, May 28, 2019 9:36 AM > To: devel@edk2.groups.io; Wu, Hao A > > Cc: Ni, Ray ; Andrew Fish ; Laszlo=20 > Ersek ; Leif Lindholm ;=20 > Kinney, Michael D > Subject: Linux Kernel soft hangs if 8259 PIC is not configured by=20 > BIOS: was (RE: [edk2-devel] [RFC][PATCH > v1 0/1] PcAtChipsetPkg: Remove framework modules) > > Since this change will be removing the 8259 PIC driver, I'll mention a= =20 > quirk I ran into in the Linux Kernel up through at least 5.0 (and I am= =20 > sure later, I just didn't verify): > > Does anyone have pull in the Linux Kernel world to get them to take=20 > this seriously? Hopefully someday soon end users will let legacy=20 > devices, like the PIC, die a long overdue and graceful death. > > I sent the following to the responsible Linux Kernel developers and=20 > quickly 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= =20 > because it is using IOAPIC. Hopefully, this provides enough=20 > information. > > Observed under Ubuntu Server Linux 18.04 LTS with kernel 4.15.0, and=20 > with kernel compiled from source tag > v5.0 > > Where it hangs: > Soft hang occurs in calibrate_APIC_clock(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/apic/apic.c#L805 > specific location of soft hang waiting for interrupts: > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/apic/apic.c#L854 > > > How it gets to the hang: > If 8259A PIC is not configured before kernel is launched, HPET IRQ 0=20 > registration fails because probe_8259A returns PIC as not available=20 > and therefore interrupt descriptors 0-15 are not allocated. This=20 > happens when BIOS does not configure 8259A PIC because it uses IOAPIC. > > This sequence prevents allocating interrupts 0-15 unless PIC is=20 > 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/blob/v5.0/kernel/irq/ > irqdesc.c#L512 > return legacy_pic->probe(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/apic/vector.c#L656 > default_legacy_pic.probe: > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/i8259.c#L418 > probe_8259A(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/i8259.c#L301 > interrupt 0-15 descriptors not allocated and prevents IOAPIC=20 > interrupts 0-15: > https://github.com/torvalds/linux/blob/v5.0/kernel/irq/ > irqdesc.c#L525 > > In this call is where init_8259A is called and PIC is initialized. > However, interrupt descriptors for 0-15 were not allocated in=20 > early_irq_init() sequence, so descriptors are not available later. > init_IRQ() : > https://github.com/torvalds/linux/blob/v5.0/init/main.c > #L643 > > This sequence tries to register the HPET to irq0, but > irq0 descriptor is not 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/linux/blob/v5.0/arch/x86/ke > rnel/time.c#L107 > x86_init.timers.timer_init(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/time.c#L92 > x86_init.timers.timer_init =3D hpet_time_init: > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/x86_init.c#L75 > setup_default_timer_irq(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/time.c#L83 > if (setup_irq(0, &irq0)): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/time.c#L78 > > This gets called at some point after the above sequences, I couldn't=20 > 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/ke > rnel/x86_init.c#L74 > > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/apic/apic.c#L961 > *** soft hang in calibrate_APIC_clock(): > https://github.com/torvalds/linux/blob/v5.0/arch/x86/ke > rnel/apic/apic.c#L854 > > ************************* > > GARRETT KIRKENDALL > SMTS Firmware Engineer | CTE > 7171 Southwest Parkway, Austin, TX 78735 USA > AMD facebook |=A0 amd.com > > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Wu, Hao= =20 > A via Groups.Io > Sent: Monday, May 27, 2019 1:37 AM > To: devel@edk2.groups.io > Cc: Hao A Wu ; Ray Ni ; Andrew=20 > Fish ; Laszlo Ersek ; Leif=20 > Lindholm ; Michael D Kinney=20 > > 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=20 > 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=20 > available at: > https://github.com/hwu25/edk2/tree/delete_framework > (https://github.com/hwu25/edk2/commit/84e58f89f6d03f9cc > 3399cced9d5d5529e06a416) > > > 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=20 > used after the removal of IntelFramework[Module]Pkg. > > Also, the unused (after the modules being removed) PCDs will be=20 > 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.un > i | 16 - > > PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259Ext > ra.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=20 > 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.un > i > delete mode 100644 > PcAtChipsetPkg/8259InterruptControllerDxe/Legacy8259Ext > ra.uni > delete mode 100644 > PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.uni > delete mode 100644 > PcAtChipsetPkg/IsaAcpiDxe/IsaAcpiExtra.uni > > -- > 2.12.0.windows.1 > > >=20