From patchwork Wed Mar 15 12:10:30 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: 13175751 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28408C61DA4 for ; Wed, 15 Mar 2023 12:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231343AbjCOMKy (ORCPT ); Wed, 15 Mar 2023 08:10:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231143AbjCOMKx (ORCPT ); Wed, 15 Mar 2023 08:10:53 -0400 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2FB86780B; Wed, 15 Mar 2023 05:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1678882249; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=aqkVxyu9mb2CIcFjBgNSXExcR5FLmw8gCXy/rXJj/54=; b=Hftgd/QFtfcFJ4kLZsNBIpfs1tuyWzWJwQmI2shEbia0YtLYkzwg0FNk uqVQS6vQ4zKQjMiifpvJmIzPFUvXv9vbALY+RrY6OAiG3jt1oAMArS1YN FRHKvViw7fPGLqhJStXtvfBrtUsHxbCO6ADZETgSk/3XM6yWynVDnsNwc c=; X-IronPort-RemoteIP: 104.47.73.44 X-IronPort-MID: 99744542 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $R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57uFiBva/ swZNMaQzRhbFurkbUHqHZU7KFkLKT03AM7woskPKuqbeFI6RCcmFuPbxq4nd8p9haNJm+zU/ 3a7HEhF1F74gn6BIgKPApx+VI7SsV9EhSpTFUQR0ZyAgRDPva7HAH8jSqYK IronPort-HdrOrdr: A9a23:gCa/ia5SxqiHt5l3wAPXwOXXdLJyesId70hD6qkRc20uTiX8ra vFoB1173PJYUkqKRQdcLy7VZVoOEmskaKduLNhWotKPzOWw1dAUrsN0WKK+VSJJ8SZzJ8k6U 4JSdkGNDSaNzdHZKjBgTVRBL4bsbq6GdiT5ds2OE0dLz2DXctbnmFENjo= X-IronPort-AV: E=Sophos;i="5.98,262,1673931600"; d="scan'208";a="99744542" Received: from mail-dm6nam04lp2044.outbound.protection.outlook.com (HELO NAM04-DM6-obe.outbound.protection.outlook.com) ([104.47.73.44]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 15 Mar 2023 08:10:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WT2h/FhWyybNcqT5n38ZNK+X/8EOSRJpyVN+Sqrmyqmn40X5kWkfgd7rBYrSuRQ44oNJrsG/yG2YYx8ybcalj2A6UXUB0XPD1R6j7eHYd89nofm/Q1oNnu815ZnzUil+Bhr/rFIGbgVwHPw+bXkBJDjkUZXt4HA8O3KE6wTm5+YUmI36g+/Tt51H7qQ8tykHu4LuCgstAxCN2pY03vDS9Bf4UnSPX4iLTjdPowiKhDXP4XizCtWyXcr7QuYg2BqOx4j3QjwXfUOwmlqrTMaV8hzq+ODDb0a0kRPt7YJ1V4BOYi7WFqd0iAl+VIp4UFLIxzjWRdcSfvpHSpp3lP1Q4w== 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=m5e4zN1sBKK/gJ5Rl1MgO3iQPc7bxKnquNyN2vp5zIs=; b=XhuPyu7FAUdzP2+cBZGPhodPBLPUfn7NzQBoWD7JCsnpG+VOdVwQxAYgIZitdWW7HPOF0HAuA4/UQtAKd1Q+P0Ok5ad6znsdLUnllYlWRvKOJ0YVraeFh7TLQu4j/F4Jw/LZU+Mod37lp2+dqpThG7FGp/iT4xGKw6JxpC9ni2tAyWEzo6lNUobtH6pXRA1PZ9ufUFNhuTbNArn1hgPwltxqqGDR5GccLXEsjXdwOtxfFdoquOc13eHFoh5EfKp+1Ish7W5f0xhmky84krIMRSP+/KK0OAP0hAtz4HGDv/WrlnRNHd80jFvL9ycw1VM05aQv7QkQKva+CCrjVXHs1w== 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=m5e4zN1sBKK/gJ5Rl1MgO3iQPc7bxKnquNyN2vp5zIs=; b=JZvcmDMbeAlSKkOv14IBID7RzSaBilGOSewnZDBC631ZI1NX1iO+xNY98w+jTUIHcT0Gzb8lrb8PNlZqnHQ9BoI7UKMYPqUAHEjtDQIsHE4KIu+XuHI8Hby6SdpHQBsuN/52bdAVuChPOou/3EbD3Xe3aKxhtvIFBscVtdONL8k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; Received: from PH0PR03MB6368.namprd03.prod.outlook.com (2603:10b6:510:aa::21) by SJ0PR03MB6777.namprd03.prod.outlook.com (2603:10b6:a03:40c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.24; Wed, 15 Mar 2023 12:10:40 +0000 Received: from PH0PR03MB6368.namprd03.prod.outlook.com ([fe80::4fdc:e60c:b790:d034]) by PH0PR03MB6368.namprd03.prod.outlook.com ([fe80::4fdc:e60c:b790:d034%5]) with mapi id 15.20.6178.019; Wed, 15 Mar 2023 12:10:39 +0000 From: Roger Pau Monne To: linux-kernel@vger.kernel.org Cc: xen-devel@lists.xenproject.org, Roger Pau Monne , Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Venkatesh Pallipadi , Alex Chiang , linux-acpi@vger.kernel.org Subject: [PATCH v2] acpi/processor: fix evaluating _PDC method when running as Xen dom0 Date: Wed, 15 Mar 2023 13:10:30 +0100 Message-Id: <20230315121031.22450-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: LO4P123CA0564.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:33b::17) To PH0PR03MB6368.namprd03.prod.outlook.com (2603:10b6:510:aa::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR03MB6368:EE_|SJ0PR03MB6777:EE_ X-MS-Office365-Filtering-Correlation-Id: 0723d817-1ddf-4442-e3ca-08db254e4ac0 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: azroRDWnbs3O+AEmwVxmTzyMKKsSbUBV6omBTjpa3SVM6N5HrQCnp9KyR0JEi+U4XWBKZUoGZjO6xIoaoM4lAciNcu+WPx0mjWOJeafu378AaJOv3t55LJ/k5DF02HlEpwPkf/LnDzjgOqVvNfKKqR0k7DKOjQnLT2i8C79XYN+1Jzvc3gknjx/Atm9tDCDr0Usb6cXhZMaQ8MIvytb8ZWhR0uwUvJ/vyD0Stigb0lcpAGoarlDu3ji/OI6EOuG0tcd2qPi6kdTTsmeU8dKhOEQXKEj9qyjpnSfyesWRrMRhKmpBKj6ZUSzqlfOxXAipc/o4XbEGzskFQFusglNOYDiE/xvPVwbUwYEkS8d+MfGaglGqRklI1I5YoLeISvznUmV/Q8zj2T0N5SDk/W/k2NaNpsOtkn+VAk3Bf0Utf7sT8rvU4agKJbTdyeZoCWCkjn9ARMSDDpEbBs6wQ1SoD4GkO675otLrm0Km6/jHUnAlKgke3vVY1Qlg0+5RW39kf1ErrltGqwS+fbYfbF4ttox3z+R7tNzQ1Fo/0YAHabqoINdEe+Gm3TIdasU4z9pHdfNhz5OjhTTqzvowZVtmxfjppwN9LlL75nG6QAyfQlieFqPedVCbHQbEGvst7SXew7vkOZApthNerrruqiQXyw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR03MB6368.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(396003)(346002)(136003)(366004)(39860400002)(451199018)(36756003)(5660300002)(7416002)(83380400001)(66556008)(478600001)(26005)(1076003)(2616005)(6512007)(186003)(6666004)(6486002)(6506007)(4326008)(8676002)(6916009)(41300700001)(8936002)(66946007)(54906003)(86362001)(66476007)(316002)(38100700002)(82960400001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5TJaf/1O8k/GrIEO9H7+3Ray77FF?= =?utf-8?q?tA4Lnu3p2fUYJPuLW5tF4Z392d/tAkjTtUkfI87mM0rWPVjhmv0pU8kvTRYh9xs6Y?= =?utf-8?q?81HynypASzeK8byXtUBzoA130f8zdeEvmX60zW3DtvPNlkSwksNtoRdLz6FVlJYuR?= =?utf-8?q?4VXm6wEIFED7XKTbTPbRi0reU8sBI49GfA5oZ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61YY6S1OdW/Dsi9v9rt0dqYtdQ58?= =?utf-8?q?TDxcrvoDySci4tkti3FwB2pilpbxcHqrPlcOEpvbNnPA/E2/R2k0OrP1A5gTcZ5zi?= =?utf-8?q?8MNfejyH8hiJh01EAJuAAO6JtbhtRdVMxpCuAHx9TVq2Hazw1Oc5XBBkYF2k2AYPH?= =?utf-8?q?OXh0ihHRWH/v0jWSeLDE02GAla+Eu6+Lp2b5DQId8D5djj1SzE40ray2PM29mq17f?= =?utf-8?q?IszuZ4L6jLBKBR43FKo458f1VzyAjSuER5je7wsq/4to8rxf3OLjLJHKt1XSHCVh4?= =?utf-8?q?1wzjq9ia8F8GIB6M425MtJJUsWWav6Ug8V8NShe1gCjvTpf3j+VpXGgr/CaWgtsfi?= =?utf-8?q?uDkNJKKCK1cOTs2E9JRcVMXAC7m48QjdbVLS2niY3LBCx8dTrLxjgKOkIUP9UfsKh?= =?utf-8?q?JMvQZR0T2JDB0AFHIxsH+o7rnncK6Payn/q9Sb1P4Fv+Fxzk9dwkTCnqB60Nsbt7A?= =?utf-8?q?/Ex6iL/JkdsJDUXn1WywcMNm6hutelIeAg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?utf-8?q?i4Hp1XJekGl9AqgX?= =?utf-8?q?ZsKBSYRCNYDBbqMx7/+0iajcdg0QkjzrzB11WNO5pndT8sx8R1pT4aHZiBN7Ug7xh?= =?utf-8?q?2H/RByJ5lthomwi+VKhbLBEjZKNPV/T4j7xrqFT8MMDCTOV4yT3MovYzYz5Y29Nku?= =?utf-8?q?7Y330YN0EQcJLuAKsuZCjwFXV9BbXnwT8vzJFZhlqYXVUrDLnqTk0arKDcgXSXzqH?= =?utf-8?q?nlwgSkeqDCULKRsC8IlnSB0ioOHt8IhdifrynuxP4Gngh6/fq0RKNj+OvoEphTwbr?= =?utf-8?q?B51d5RzlxK2DPd2FxW03JVt6greKp9cmlz2DG7LFwhvQO5dvGUMgZB1II7eWjG1hd?= =?utf-8?q?i0Wf6iiFu8mRztUOBSSW1kllScdpf/QH42gBDiVclptn+NclPOLDnWnjADsiyS3Z1?= =?utf-8?q?3Ouz07cEmdntQCznXAyEKET4s1tzDk5kGOc4JmZPUoEInFDQZLYjMUb0h1JSZJuuK?= =?utf-8?q?YZlzpey0yq27QDzQqIOb4nB/sR3dj3PHJpGZ+/CElZh7h76wbtb7xQmIugbOJuFq7?= =?utf-8?q?bJeeFU3ZsglSWvtJNHJ76OPBRAh3E7A7pM6io0SJCgD9sF/q1ABWvEuyxSTNA3OK4?= =?utf-8?q?LSiGFqruwkkg+xg+LsMWPnP3S0JMxl7zWxpO6XLtyuiIESaBob9osGnfiGapmSvBt?= =?utf-8?q?csouYHZh1bQLyj6L9XDogFSf4HoMm9KawJKS5hVJ1Q9AhXterhWky5yThLqGei9ZD?= =?utf-8?q?CDQ7NfiQo9GilwauxznCGNm+IoYRY+8BTxG5EB3sJZzCQx+K34kacr1QLAWRo7QXz?= =?utf-8?q?kZI18QM6UFZSbJ1HLZuUFydFHNb4Rlxj67/tW9GrtZId2Rpge2Km9RBlpmUD82NSM?= =?utf-8?q?5QLj/xXoY0rz+7ksY+kIaQ8iEtByPDGzAbcemEFxLPfc3GcgaELjiLN00XEwWYQdd?= =?utf-8?q?ywlNd1Hb3R+Q+nRoVO/nQbXWNzJPk+ZQl9BeODmRv2YkyteYCCWzB0LOfTQlxPSof?= =?utf-8?q?+7CUMQhRBPOreCmpDj0WXIHbnJQGWWwmsr5+f1RJlkX/1oNYN4XLG1sykv9b0l3E5?= =?utf-8?q?Xdt2uor6rhxvD4uo+lXFr9VyRorPqmeELXBKtJpT9FVJtRvZU+V0LhXLkscABjgYQ?= =?utf-8?q?u78naOEHfc=3D?= X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0723d817-1ddf-4442-e3ca-08db254e4ac0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR03MB6368.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2023 12:10:39.7371 (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: 4hHgAi1j4o6fzzbbBx9CY5v/J5IsRVEr8uKDT2t+dDld3d5nRsSJvbGS2qHNqzxlRWWDikNr2i6LRch4Gm+BbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR03MB6777 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In ACPI systems, the OS can direct power management, as opposed to the firmware. This OS-directed Power Management is called OSPM. Part of telling the firmware that the OS going to direct power management is making ACPI "_PDC" (Processor Driver Capabilities) calls. These _PDC methods must be evaluated for every processor object. If these _PDC calls are not completed for every processor it can lead to inconsistency and later failures in things like the CPU frequency driver. In a Xen system, the dom0 kernel is responsible for system-wide power management. The dom0 kernel is in charge of OSPM. However, the number of CPUs available to dom0 can be different than the number of CPUs physically present on the system. This leads to a problem: the dom0 kernel needs to evaluate _PDC for all the processors, but it can't always see them. In dom0 kernels, ignore the existing ACPI method for determining if a processor is physically present because it might not be accurate. Instead, ask the hypervisor for this information. Fix this by introducing a custom function to use when running as Xen dom0 in order to check whether a processor object matches a CPU that's online. This ensures that _PDC method gets evaluated for all physically online CPUs, regardless of the number of CPUs made available to dom0. Fixes: 5d554a7bb064 ('ACPI: processor: add internal processor_physically_present()') Signed-off-by: Roger Pau Monné --- Changes since v1: - Reword commit message. --- arch/x86/include/asm/xen/hypervisor.h | 10 ++++++++++ arch/x86/xen/enlighten.c | 27 +++++++++++++++++++++++++++ drivers/acpi/processor_pdc.c | 11 +++++++++++ 3 files changed, 48 insertions(+) diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 5fc35f889cd1..f14e39bce2cb 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h @@ -63,4 +63,14 @@ void __init xen_pvh_init(struct boot_params *boot_params); void __init mem_map_via_hcall(struct boot_params *boot_params_p); #endif +#ifdef CONFIG_XEN_DOM0 +bool __init xen_processor_present(uint32_t acpi_id); +#else +static inline bool xen_processor_present(uint32_t acpi_id) +{ + BUG(); + return false; +} +#endif + #endif /* _ASM_X86_XEN_HYPERVISOR_H */ diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index b8db2148c07d..d4c44361a26c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -346,3 +346,30 @@ void xen_arch_unregister_cpu(int num) } EXPORT_SYMBOL(xen_arch_unregister_cpu); #endif + +#ifdef CONFIG_XEN_DOM0 +bool __init xen_processor_present(uint32_t acpi_id) +{ + unsigned int i, maxid; + struct xen_platform_op op = { + .cmd = XENPF_get_cpuinfo, + .interface_version = XENPF_INTERFACE_VERSION, + }; + int ret = HYPERVISOR_platform_op(&op); + + if (ret) + return false; + + maxid = op.u.pcpu_info.max_present; + for (i = 0; i <= maxid; i++) { + op.u.pcpu_info.xen_cpuid = i; + ret = HYPERVISOR_platform_op(&op); + if (ret) + continue; + if (op.u.pcpu_info.acpi_id == acpi_id) + return op.u.pcpu_info.flags & XEN_PCPU_FLAGS_ONLINE; + } + + return false; +} +#endif diff --git a/drivers/acpi/processor_pdc.c b/drivers/acpi/processor_pdc.c index 8c3f82c9fff3..18fb04523f93 100644 --- a/drivers/acpi/processor_pdc.c +++ b/drivers/acpi/processor_pdc.c @@ -14,6 +14,8 @@ #include #include +#include + #include "internal.h" static bool __init processor_physically_present(acpi_handle handle) @@ -47,6 +49,15 @@ static bool __init processor_physically_present(acpi_handle handle) return false; } + if (xen_initial_domain()) + /* + * When running as a Xen dom0 the number of processors Linux + * sees can be different from the real number of processors on + * the system, and we still need to execute _PDC for all of + * them. + */ + return xen_processor_present(acpi_id); + type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; cpuid = acpi_get_cpuid(handle, type, acpi_id);