From patchwork Fri Sep 22 18:38:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Das Neves X-Patchwork-Id: 143614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5817634vqi; Fri, 22 Sep 2023 12:26:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8d5J38pykoe4g0lDJo+rRhwf+rLru90WRWuvxRDkkeYSyhk32tzBZeCBsoXvSMbBGm9il X-Received: by 2002:a05:6a20:100f:b0:151:35ad:f327 with SMTP id gs15-20020a056a20100f00b0015135adf327mr498409pzc.17.1695410800034; Fri, 22 Sep 2023 12:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695410800; cv=none; d=google.com; s=arc-20160816; b=QMHxUjW/61Bv8CiQ0I4F5zSx9m/loxi2+QctJl5XJo9dAbiBCVAiw6CTYGiOvzmF7Q uVo5LQWuYBgwBj9oh/aPh04bwCxr9bMb9Uji8bNL04pfDPXa9P+wtPuH6lrYjB6tyrxG 6UJbKnH4SZoXHDfxzGyqd33ugWBHYholAAKzCeUhfXs8RnwR3yvj8QDZvZVcePCS8HJr H/G0la+CDk63mjYIfi5NB7vyit0wa22GB/mvkmAx75Vga0uZSq4LsaCjup7oO5PzvZLd 20x3SxtUukvkO+J6mnzxZ9GPYQeBA5WwNVAbVCb2p1jqUbcE55kmUYA9Jc/ieI10xbv1 oZuQ== 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 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id k33-20020a634b61000000b00578c9144919si4537077pgl.254.2023.09.22.12.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 12:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; 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 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id D54E482B6734; Fri, 22 Sep 2023 11:39:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233621AbjIVSi5 (ORCPT + 28 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=-8.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 11:39:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777767075015212898 X-GMAIL-MSGID: 1777767075015212898 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) {