Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp954879pxp; Wed, 16 Mar 2022 22:32:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz42w62ufLMjI2Gsa1C8Oa2iOedUmpCVeI12cS8+I8mWauGiVaoCIkmvkBdAf/jAdlPE4CP X-Received: by 2002:a17:903:2c7:b0:151:a932:f1f0 with SMTP id s7-20020a17090302c700b00151a932f1f0mr2980638plk.130.1647495150847; Wed, 16 Mar 2022 22:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647495150; cv=none; d=google.com; s=arc-20160816; b=fUy6OJPEuucrj5XHbrTLpZ41CK9qnsIdE6hnXG7ofMxyU0tyDVqj3YFEdASsTaelS1 1xYB1YwxN88YUUyGV8QyTOmRYrpvskss4gkTFHHlW76aZ9hvEtMrd49bWpjLXFPUsuyF nfjszXMWw6N+ScpymbKNJDnsOhvN63MeOBzI7i4XJGuMZW1MH+9R1Mp8AaKHdAT4GSya KhqzcfXBGYgMEjJ+AG0/+4vzbzPydVqUb7/3spcDB/Bw8TGvP1cZoHeQFT3X812KAbhc GofLFB8aB+/XmlKf2Nj4GuIV8XXdMig6C1/sHDwh6PCsnZBk+4M0yzxFIhg2ZqANwaA6 eY6Q== 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=OG8gdtoYvch+rkRP/V1ixlMO3BosF6EEcyXX0H1ZUow=; b=Afo29CIMgF4kqO3VrPdTurwQ+Y0VmhQfDtPeyQjalLb6NqcEIf3xIp+1QZlSU1ixxA jd/LsEMiSZCs0Gy4QczppHffXDRBXe/Jalk+/GbnLOTKDi36aWLEgOLJAgyrPJJDPp7s rP1SfP1erEvxulHEchx86cr0V6lOxr2NVRh3G/vzS9vGlAQXrUXwjeKjcErx1YdMIdki Dl680hlrylQEZLcgC5oUcXuYSYhxaBx0M0RS4pueA5Mkmp3LQm2/xpDjvXRrcA2vViQl TjMxQioWIeDTtvbvNuSmIm1vZKEycJU9U77zsza4ZQd9jc8U6z9UNOaXIJdw1ttdlPZL Pxkw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 35-20020a631463000000b003820705eb26si619121pgu.593.2022.03.16.22.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:32:30 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 14E4B26D109; Wed, 16 Mar 2022 21:34:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357496AbiCPSK4 (ORCPT + 99 others); Wed, 16 Mar 2022 14:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239661AbiCPSKz (ORCPT ); Wed, 16 Mar 2022 14:10:55 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 307D3527E0; Wed, 16 Mar 2022 11:09:40 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 382DE92009C; Wed, 16 Mar 2022 19:09:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 30B8992009B; Wed, 16 Mar 2022 18:09:38 +0000 (GMT) Date: Wed, 16 Mar 2022 18:09:38 +0000 (GMT) From: "Maciej W. Rozycki" To: Dmitry Osipenko cc: Nikolai Zhubr , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Arnd Bergmann , Michal Necasek , x86@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/4] x86/PCI: Add $IRT PIRQ routing table support 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Mar 2022, Dmitry Osipenko wrote: > > Handle the $IRT PCI IRQ Routing Table format used by AMI for its BCP > > (BIOS Configuration Program) external tool meant for tweaking BIOS > > structures without the need to rebuild it from sources[1]. > > > > The $IRT format has been invented by AMI before Microsoft has come up > > with its $PIR format and a $IRT table is therefore there in some systems > > that lack a $PIR table, such as the DataExpert EXP8449 mainboard based > > on the ALi FinALi 486 chipset (M1489/M1487), which predates DMI 2.0 and > > cannot therefore be easily identified at run time. > > > > Unlike with the $PIR format there is no alignment guarantee as to the > > placement of the $IRT table, so scan the whole BIOS area bytewise. [...] > This patch broke crosvm using recent linux-next. The "ir = (struct > irt_routing_table *)addr;" contains invalid pointer. Any ideas why? This specific pointer refers to the BIOS area being iterated over: for (addr = (u8 *)__va(0xf0000); addr < (u8 *)__va(0x100000); addr++) { and it is conceptually not new code in that a similar piece as below: for (addr = (u8 *)__va(0xf0000); addr < (u8 *)__va(0x100000); addr += 16) { used to be there before my change and even now it is executed earlier on in `pirq_find_routing_table'. > PCI: Probing PCI hardware > BUG: unable to handle page fault for address: ffffed1000020000 > #PF: supervisor read access in kernel mode > #PF: error_code(0x0000) - not-present page > PGD 12fff4067 P4D 12fff4067 PUD 12fff3067 PMD 12fff2067 PTE 0 > Oops: 0000 [#1] PREEMPT SMP KASAN > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.17.0-rc7-next-20220310+ #226 > Hardware name: ChromiumOS crosvm, BIOS 0 > RIP: 0010:kasan_check_range+0xe6/0x1a0 > Code: 00 74 ee 48 89 c2 b8 01 00 00 00 48 85 d2 75 5d 5b 41 5c 41 5d 5d > c3 48 85 d2 74 63 4c 01 e2 eb 09 48 83 c0 01 48 39 d0 74 55 <80> 38 00 > 74 f2 eb d2 41 bd 08 00 00 00 45 29 dd 4b 8d 54 25 00 eb Thank you for your report and apologies for the trouble. I don't know what a "ChromiumOS crosvm" is, but the mention of "Chromium" indicates to me it is something reasonably recent that should be using ACPI rather than legacy PCI IRQ routing, and even then it should be using the standardised $PIR format rather than AMI's proprietary $IRT one. I am more than surprised this code is active for x86-64 even, as this is solely i386 legacy. In any case we need to debug this and possibly work around somehow as this BIOS is likely giving us rubbish information. Unfortunately without access to your Linux build tree along with debug information I can do very little. The faulting piece of code is as follows: 21: 48 83 c0 01 add $0x1,%rax 25: 48 39 d0 cmp %rdx,%rax 28: 74 55 je 7f 2a: 80 38 00 cmpb $0x0,(%rax) 2d: 74 f2 je 21 -- with the CMPB at 2a being the offender and further information required as to what RAX holds at the moment. So as the first approximation I would like to see what your BIOS actually tells Linux. Would you therefore please try the following debug patch, boot with the `debug' kernel parameter and send me the resulting bootstrap log? Maciej --- arch/x86/include/asm/pci_x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) linux-x86-pci-debug.diff Index: linux-macro/arch/x86/include/asm/pci_x86.h =================================================================== --- linux-macro.orig/arch/x86/include/asm/pci_x86.h +++ linux-macro/arch/x86/include/asm/pci_x86.h @@ -7,7 +7,7 @@ #include -#undef DEBUG +#define DEBUG 1 #ifdef DEBUG #define DBG(fmt, ...) printk(fmt, ##__VA_ARGS__)