Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2958625rdb; Fri, 22 Sep 2023 13:19:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzOaWZeFrMVPBGiEKCCsRjR3qQr0lsmHzI7hTgelFKM5IUgZ1K8nYhxioUiObmbfEkKC06 X-Received: by 2002:a05:6a00:230b:b0:68f:f0bb:7de1 with SMTP id h11-20020a056a00230b00b0068ff0bb7de1mr539525pfh.11.1695413998363; Fri, 22 Sep 2023 13:19:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695413998; cv=none; d=google.com; s=arc-20160816; b=nSC4N46eVF+o4r2ZG3FZv1uXWKKAkADpxyC263d7l+zjBW+0bFR3MV04ASffChUByC UiIcCgi5xllsZWHzyjAnoUvM3x6h54MaowtCzA1xqX4tZvyUmwR3M7jamwfNJroq8O9S zbTf/LjpZBSoiFgDkb2mnYO/5Pfhqdz9fNhQUARAvtIHohJIzvM0BrOSAE5t9C2HcRO/ lbdQiz5Ia2EauXEhvcIhK+n//9FNIydzav7N+AdxlJOnYewxhqj6Ujlt2pG3c8GtoOdc 6VcdAw1EoyALPgDewHHEkFRq6SofPnd6heWLd1SZTLyf2E6SJaJX/Otnn16f9G3hxeAz 0Ylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=dfoMypJARztEgdSmA6KZIVZXyE/m4b6YXjIgD6I/ur0=; fh=rrENblR9DW+P8f8MSnFC4QkpxyTeAbSNxgPLVTXlWGs=; b=AZ+sTAElmtGPTN+S8KzTSxtqdFHyXy3nqSRATDi9c9b304ryI8Y1dsL6B+Dxxuu6gF 7YPIMqIBpHDwopLNExcXGx85D2hz36htPCFPrFNJrV9m0unJxi7libv0FeY9JMuzKNgr nU7VTd5jc3kqQGsbgQjUDZutT/IAse2EwK314dNY9LqMlXmts/Op+s5ygIEjBp2UhCba NNSp4yrcLb4vIoqoGQk7qbudnvRagU6zeA0Ffq+0lWunuo/MknC0p8BmBB9NKX0oRa+a RTNiKDuWARR8jViXHGI3xa/791l/A0CbKVLftxYm8YtzUOw6LbtkVvHzdktypGwBkIBP wMWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ps57tq9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q18-20020a056a0002b200b0069023c19351si4192071pfs.154.2023.09.22.13.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 13:19:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ps57tq9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1353D84C41CE; Fri, 22 Sep 2023 11:38:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233618AbjIVSi5 (ORCPT + 99 others); Fri, 22 Sep 2023 14:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbjIVSis (ORCPT ); Fri, 22 Sep 2023 14:38:48 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA949C1; Fri, 22 Sep 2023 11:38:41 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 479C4212C5D4; Fri, 22 Sep 2023 11:38:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 479C4212C5D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695407921; bh=dfoMypJARztEgdSmA6KZIVZXyE/m4b6YXjIgD6I/ur0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ps57tq9WonqWdITkRBV4pWWuJi2FmAU2kLkjpIyja9TuGcXcYO/IbmT/smJxq2JCA c7gdwQ5wk5xUifnA/TmVn15+0fHIxST5QGeuoQE2sazsBgAPOXALjePf89oEWiMBXJ u6bCRqASeNzGfUPyuwgwKAHSLYuoeb1qmCdQ9bHk= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org Cc: patches@lists.linux.dev, mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, gregkh@linuxfoundation.org, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com Subject: [PATCH v3 04/15] asm-generic/mshyperv: Introduce hv_recommend_using_aeoi() Date: Fri, 22 Sep 2023 11:38:24 -0700 Message-Id: <1695407915-12216-5-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 11:38:59 -0700 (PDT) Factor out logic for determining if we should set the auto eoi flag in SINT register. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- drivers/hv/hv.c | 12 +----------- include/asm-generic/mshyperv.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 5ea104c61fa7..d7869205dcbe 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -315,17 +315,7 @@ void hv_synic_enable_regs(unsigned int cpu) shared_sint.vector = vmbus_interrupt; shared_sint.masked = false; - - /* - * On architectures where Hyper-V doesn't support AEOI (e.g., ARM64), - * it doesn't provide a recommendation flag and AEOI must be disabled. - */ -#ifdef HV_DEPRECATING_AEOI_RECOMMENDED - shared_sint.auto_eoi = - !(ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED); -#else - shared_sint.auto_eoi = 0; -#endif + shared_sint.auto_eoi = hv_recommend_using_aeoi(); hv_set_register(HV_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64); diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index e16557523b6e..c9e166d73fca 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -82,6 +82,19 @@ extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); bool hv_isolation_type_snp(void); bool hv_isolation_type_tdx(void); +/* + * On architectures where Hyper-V doesn't support AEOI (e.g., ARM64), + * it doesn't provide a recommendation flag and AEOI must be disabled. + */ +static inline bool hv_recommend_using_aeoi(void) +{ +#ifdef HV_DEPRECATING_AEOI_RECOMMENDED + return !(ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED); +#else + return false; +#endif +} + /* Helper functions that provide a consistent pattern for checking Hyper-V hypercall status. */ static inline int hv_result(u64 status) { -- 2.25.1