From patchwork Fri Jul 14 16:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13313825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CB6EEB64DC for ; Fri, 14 Jul 2023 16:06:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.563700.881105 (Exim 4.92) (envelope-from ) id 1qKLIT-0003PH-Rj; Fri, 14 Jul 2023 16:05:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 563700.881105; Fri, 14 Jul 2023 16:05:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qKLIT-0003PA-P8; Fri, 14 Jul 2023 16:05:33 +0000 Received: by outflank-mailman (input) for mailman id 563700; Fri, 14 Jul 2023 16:05:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qKLIS-0003P4-69 for xen-devel@lists.xenproject.org; Fri, 14 Jul 2023 16:05:32 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3fbd6038-2260-11ee-8611-37d641c3527e; Fri, 14 Jul 2023 18:05:29 +0200 (CEST) Received: from mail-mw2nam10lp2106.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.106]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Jul 2023 12:05:26 -0400 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) by SJ0PR03MB6438.namprd03.prod.outlook.com (2603:10b6:a03:396::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Fri, 14 Jul 2023 16:05:23 +0000 Received: from SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::e14d:fb6d:9e52:1524]) by SJ0PR03MB6423.namprd03.prod.outlook.com ([fe80::e14d:fb6d:9e52:1524%4]) with mapi id 15.20.6588.024; Fri, 14 Jul 2023 16:05:22 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3fbd6038-2260-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1689350729; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=8lGIoVSmbQI3geIM7K6Dw264tZPPYS+3vpWdBhSRTXQ=; b=WL5DnF3IVWt0QQXj2kM/aAYukuHw/bbL6zyPKpHvWRugtP67JBIPEukw vm2GJzLyPbzDVBmz9BlTDBZHLgX5MiWzI1Ypo/J4xDsvIoLxmamDJ5gZL dRGR/fyCj2hsDG1bErz1FWiG2RATatPPbTHF6ecFEjNDyuFh/XZuAyn5a w=; X-IronPort-RemoteIP: 104.47.55.106 X-IronPort-MID: 116129626 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:/sAoCqrSOYlCzPfFZOdsVEj32AteBmI+ZBIvgKrLsJaIsI4StFCzt garIBmDMvbeZjP3Kt12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a8CkcCv7o9gsSeKhBJZhukzwv0a9py X-IronPort-AV: E=Sophos;i="6.01,205,1684814400"; d="scan'208";a="116129626" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SbJRsZ1iWIKMEs6Hzs1m99fFoRs8lsvKI5UkquTFzrXGqpnStfi+Tp6uXFco+o4fwccjbcm0KNiq9C73tNxXaYm2cDdLDgzv2blvkVj2PV5W48GjT2oAnz1szoK6tsFwY1HypMC64usRa5hp/bwvgkvKuIn6+mAjAJ59150h4MeB4d5FoBEtsMQj12XpkDbeztyp+pfLLZ/9YJuRsloN2Pc37fEDYU+m2hlluNswJ9IAnwPwgptvg52XWSFyp9AiCXMtWn7mLYsboOfQpZQ9dbCbxOx0JACZAFdN32ewo/zC99Yi1C6YggrK0D/8lDJSQjRlytV0EEuzjUkx5c39nw== 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=U0HISuVX845kGAG0SnJ2bfw4WW7gmh3amQHJcMNwxgY=; b=Y1MKUdRewjpzoatITmVojdMZMhayWZn5vGWjIM8EV72P73XquaH8e+DCkX+WKbK28WpH/GtD4/KNsNdJMZ4fG1dIRSednL5r2kCrrDWjKU7+WKw4IhNHA3P3CN3SKiC0N4gLrKA+OoNttGqU4rOkULrvxBdXQqtI/4TzZ1GNAbGvKiytHm3vgv7Y9JADt/idv9ddjkSII5UWQ2FKrTy6PR/EZRCpyYUd2CNZ2WAvEbdey/AYY8cu47xjAWBPGZKZIBRhggiLFt0rQ6vj/H+Zd9Od4GsBAJmoM+Hv8s5dELXg0+2nL64y5WEkSeD23/Z2B0+aVLECRMczhIOmstsJxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U0HISuVX845kGAG0SnJ2bfw4WW7gmh3amQHJcMNwxgY=; b=Oxfdk0Ff7FNZYinozYlzdIU6l9y1p8I6FlijUcqqDf827tKxSsqUoAd3cFKd3IK1JZdIzD4ZKuB9rfJLQkEkMVLGh0a0lFu6h1T0eHReR118L0tt+90FCX2yzDpjhqGDPMt62+3cPnUlctsiDY8h7+680OhHaxjRzdUwdlKAoRo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v2] x86/ioapic: sanitize IO-APIC pins before enabling lapic LVTERR/ESR Date: Fri, 14 Jul 2023 18:03:14 +0200 Message-ID: <20230714160314.71379-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.41.0 X-ClientProxiedBy: LO6P123CA0050.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:310::6) To SJ0PR03MB6423.namprd03.prod.outlook.com (2603:10b6:a03:38d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR03MB6423:EE_|SJ0PR03MB6438:EE_ X-MS-Office365-Filtering-Correlation-Id: ae3b6e55-3f9f-404e-9053-08db848420af X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zxhYJlJ0wX5nHxR+WP0OaxosPNpO7oEOlYZvXcve82C3o0788jTOox7SEB+kAE5xi+0hsYOFS27EVux/KL9i+fygMd17Ymb4EsqpKoDe/hd7fl9qEPY26EbUDOttP9yvcf5msMJGdUr7H024sPa2gJI5obLQFHvPH8wVwR+6rtXK/f93bumatr/NMWXjEL6wfcqAvkkC89/hrdSX0u1mzPxvfSJGs00RONsA27K5AbTSniQzNJBEBm5hh2HmTZ7/vQ5h/uUUarC/CIfGega1NtRoI/sFUr1jSkyicagm0QWH9pY+miieBzqIEpaw9MMKX2qoEqh/mqu4vZYJc0R1VAja/FDTrB83HLd27C4Tah4lVwInhGKqlT0qAF/krzxiuDO4rozox7jaczTF4LoMcIOwrDvIGSWIqgTCPJHl99RXU+774VWqAOjgCAPKFmHShfs+K42yf3179u/ga27iPsqsbVGDh3v6Q1bbgSFVtCBa5jkMccn2XC7QYUFRas82elWP7lHZwUO22zDJtcQX4KMS1OG9axIKe0H9L4ArCPu2K3EHD+C1aPtcNCOdEMwM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR03MB6423.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(366004)(451199021)(186003)(1076003)(26005)(478600001)(6512007)(2906002)(2616005)(83380400001)(4326008)(41300700001)(66556008)(6916009)(316002)(5660300002)(66476007)(66946007)(8936002)(8676002)(6486002)(6666004)(54906003)(36756003)(6506007)(82960400001)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XxfoaJXvkNJb8Txw/5O0mMutuuJS?= =?utf-8?q?mkoKnSQ8GKr7hUjRAc3fXaBrHa6pmFEpsrggh73dEGfhdvhXjwG5QnmrvH6ZbDM2I?= =?utf-8?q?zpKGlKm79ScudiQMUxRuLf5sRlyu18bA6qwmLIuwT1DRp2lxEfAbVXoX6BAu55rbq?= =?utf-8?q?GTgCpTT5G5u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g0f2VbbntI73OuEyYLZgK6ESuAKJOF2ZhXBTmQ4iIn3Q9H4k15OspQ/C3cZ/xQ/vKIRL5qVBtC5XjcP4RN3gRL0iJ4ZJT+jv2QEVv3LEScHbXYkcPUXkn1jWxUKbUXv7bdgOg/Mk7ztmEKU//5yFvJKXeGT2fSLhVvIEC7yyvWF9dw7e5AvXw/TFQeQs7gdjTgyXQV8AZqVx/RFrBt4/pTpOGIKASQS3Gh0JQtiVppd4UV33vlYTknn/Haqm4pPw4un84bBEruTiVo66P0YZIkHnJy5BsOUvqPABF0UV00BS/tCdP6YyzlKVkcxRC788GITm9SbxS4iThwMXsbYGwQVG8L+HxtOv1JtcmALJfl+MhTO8OHyVYOVcftCQ9MHeLaqJqMVJU9AVZ5pJk/eDp7qaDASjma6psGPEzkUAyNjNowoVvqUz2UoQNVIUuq88cED65cZMansp00gJOfxV7gR4iD4r+ X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae3b6e55-3f9f-404e-9053-08db848420af X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6423.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2023 16:05:22.4905 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OMvpMDBPfO0NzD1w1YeRu8oKdaLyp7wkfPvSBJxqErLh0es6BjDmpbVpJn6orSlBGE1jVwG1bm5B2/VecZrCyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR03MB6438 The current logic to init the local APIC and the IO-APIC does init the local APIC LVTERR/ESR before doing any sanitation on the IO-APIC pin configuration. It's already noted on enable_IO_APIC() that Xen shouldn't trust the IO-APIC being empty at bootup. At XenServer we have a system where the IO-APIC 0 is handed to Xen with pin 0 unmasked, set to Fixed delivery mode, edge triggered and with a vector of 0 (all fields of the RTE are zeroed). Once the local APIC LVTERR/ESR is enabled periodic injections from such pin cause the local APIC to in turn inject periodic error vectors: APIC error on CPU0: 00(40), Received illegal vector APIC error on CPU0: 40(40), Received illegal vector APIC error on CPU0: 40(40), Received illegal vector APIC error on CPU0: 40(40), Received illegal vector APIC error on CPU0: 40(40), Received illegal vector APIC error on CPU0: 40(40), Received illegal vector That prevents Xen from booting. Move the masking of the IO-APIC pins ahead of the setup of the local APIC. This has the side effect of also moving the detection of the pin where the i8259 is connected, as such detection must be done before masking any pins. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich --- Changes since v1: - Remove the smp_found_config from APIC_init_uniprocessor(). - Adjust commit message. - Move the IO-APIC sanitize call just ahead of setup_local_APIC(). - Keep the enable_IO_APIC() function name. --- xen/arch/x86/apic.c | 4 ++++ xen/arch/x86/include/asm/irq.h | 1 + xen/arch/x86/io_apic.c | 4 +--- xen/arch/x86/smpboot.c | 5 +++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index f71474d47dd1..cf1d012841e6 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1491,6 +1491,10 @@ int __init APIC_init_uniprocessor (void) physids_clear(phys_cpu_present_map); physid_set(boot_cpu_physical_apicid, phys_cpu_present_map); + if ( !skip_ioapic_setup && nr_ioapics ) + /* Sanitize the IO-APIC pins before enabling the lapic LVTERR/ESR. */ + enable_IO_APIC(); + setup_local_APIC(true); if (nmi_watchdog == NMI_LOCAL_APIC) diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h index 424b0e1af8f4..3f95dd39b7b9 100644 --- a/xen/arch/x86/include/asm/irq.h +++ b/xen/arch/x86/include/asm/irq.h @@ -118,6 +118,7 @@ bool bogus_8259A_irq(unsigned int irq); int i8259A_suspend(void); int i8259A_resume(void); +void enable_IO_APIC(void); void setup_IO_APIC(void); void disable_IO_APIC(void); void setup_ioapic_dest(void); diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 9b8a972cf570..25a08b1ea6c6 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -1273,7 +1273,7 @@ static void cf_check _print_IO_APIC_keyhandler(unsigned char key) __print_IO_APIC(0); } -static void __init enable_IO_APIC(void) +void __init enable_IO_APIC(void) { int i8259_apic, i8259_pin; int i, apic; @@ -2067,8 +2067,6 @@ static void __init ioapic_pm_state_alloc(void) void __init setup_IO_APIC(void) { - enable_IO_APIC(); - if (acpi_ioapic) io_apic_irqs = ~0; /* all IRQs go through IOAPIC */ else diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index cf9bb220f90d..3a1a659082c6 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -1224,6 +1224,11 @@ void __init smp_prepare_cpus(void) verify_local_APIC(); connect_bsp_APIC(); + + if ( !skip_ioapic_setup && nr_ioapics ) + /* Sanitize the IO-APIC pins before enabling the lapic LVTERR/ESR. */ + enable_IO_APIC(); + setup_local_APIC(true); if ( !skip_ioapic_setup && nr_ioapics )