From patchwork Wed Sep 18 09:19:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergiy Kibrik X-Patchwork-Id: 13806728 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 A983ECCD191 for ; Wed, 18 Sep 2024 09:19:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.800204.1210101 (Exim 4.92) (envelope-from ) id 1sqqqE-0008Ry-8k; Wed, 18 Sep 2024 09:19:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 800204.1210101; Wed, 18 Sep 2024 09:19:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sqqqE-0008Rr-62; Wed, 18 Sep 2024 09:19:18 +0000 Received: by outflank-mailman (input) for mailman id 800204; Wed, 18 Sep 2024 09:19:17 +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 1sqqqC-0008Rj-U4 for xen-devel@lists.xenproject.org; Wed, 18 Sep 2024 09:19:17 +0000 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 122c7e04-759f-11ef-99a2-01e77a169b0f; Wed, 18 Sep 2024 11:19:14 +0200 (CEST) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 4CED72AB66; Wed, 18 Sep 2024 05:19:13 -0400 (EDT) (envelope-from sakib@darkstar.site) Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 450452AB65; Wed, 18 Sep 2024 05:19:13 -0400 (EDT) (envelope-from sakib@darkstar.site) Received: from localhost (unknown [185.130.54.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 6BBC02AB64; Wed, 18 Sep 2024 05:19:11 -0400 (EDT) (envelope-from sakib@darkstar.site) 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: 122c7e04-759f-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=sasl; bh=53smXasWd1kdsCxJozw3baFujpwna0GJ4sddX+8FhMw=; b=kRWi rD0wnWY36abD8De65J12QiJsQSjOKBH/9pnRnIKD68qz+5HLmA5ImBYLr3DVaVMI vO8ekBng6YLLGgXg+9nPQTcwKYxRMYugbPusJilL6id8Gtt40jKSR6D0Gh28wl01 ttNmVWerSEz6gJ1PBeaGHEK2kDBaZyvM8mrokR4= From: Sergiy Kibrik To: xen-devel@lists.xenproject.org Cc: Sergiy Kibrik , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Jan Beulich Subject: [XEN PATCH v2] x86/mwait-idle: add dependency on general Intel CPU support Date: Wed, 18 Sep 2024 12:19:09 +0300 Message-Id: <20240918091909.1201170-1-Sergiy_Kibrik@epam.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Pobox-Relay-ID: 10D7833E-759F-11EF-BE9A-2BAEEB2EC81B-90055647!pb-smtp1.pobox.com Currently mwait_idle driver in Xen only implements support for Intel CPUs. Thus in order to reduce dead code in non-Intel build configurations it can be made explicitly dependant on CONFIG_INTEL option. Signed-off-by: Sergiy Kibrik CC: Jan Beulich Acked-by: Jan Beulich --- v1 patch here: https://lore.kernel.org/xen-devel/20240905160058.493057-1-Sergiy_Kibrik@epam.com/ changes in v2: - stub returns -ENODEV --- xen/arch/x86/cpu/Makefile | 2 +- xen/arch/x86/include/asm/cpuidle.h | 7 +++++++ xen/arch/x86/include/asm/mwait.h | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/cpu/Makefile b/xen/arch/x86/cpu/Makefile index eafce5f204..7cfe28b7ec 100644 --- a/xen/arch/x86/cpu/Makefile +++ b/xen/arch/x86/cpu/Makefile @@ -8,7 +8,7 @@ obj-y += common.o obj-y += hygon.o obj-y += intel.o obj-y += intel_cacheinfo.o -obj-y += mwait-idle.o +obj-$(CONFIG_INTEL) += mwait-idle.o obj-y += shanghai.o obj-y += vpmu.o obj-$(CONFIG_AMD) += vpmu_amd.o diff --git a/xen/arch/x86/include/asm/cpuidle.h b/xen/arch/x86/include/asm/cpuidle.h index 707b3e948d..3a6b73142b 100644 --- a/xen/arch/x86/include/asm/cpuidle.h +++ b/xen/arch/x86/include/asm/cpuidle.h @@ -15,7 +15,14 @@ extern void (*lapic_timer_on)(void); extern uint64_t (*cpuidle_get_tick)(void); +#ifdef CONFIG_INTEL int mwait_idle_init(struct notifier_block *nfb); +#else +static inline int mwait_idle_init(struct notifier_block *nfb) +{ + return -ENODEV; +} +#endif int cpuidle_init_cpu(unsigned int cpu); void cf_check default_dead_idle(void); void cf_check acpi_dead_idle(void); diff --git a/xen/arch/x86/include/asm/mwait.h b/xen/arch/x86/include/asm/mwait.h index 9298f987c4..000a692f6d 100644 --- a/xen/arch/x86/include/asm/mwait.h +++ b/xen/arch/x86/include/asm/mwait.h @@ -14,6 +14,13 @@ #define MWAIT_ECX_INTERRUPT_BREAK 0x1 void mwait_idle_with_hints(unsigned int eax, unsigned int ecx); +#ifdef CONFIG_INTEL bool mwait_pc10_supported(void); +#else +static inline bool mwait_pc10_supported(void) +{ + return false; +} +#endif #endif /* __ASM_X86_MWAIT_H__ */