From patchwork Thu Jul 27 19:54:39 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: 127133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1331746vqo; Thu, 27 Jul 2023 12:57:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlGqJQ/0Oq0gNDeJHB/+PseujZ+TZNbXpPO4yNR9vaFOTtPkXaMmEacB9FqzUiw1xCSJajF+ X-Received: by 2002:a17:906:3299:b0:994:13c3:2f89 with SMTP id 25-20020a170906329900b0099413c32f89mr411029ejw.27.1690487828109; Thu, 27 Jul 2023 12:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690487828; cv=none; d=google.com; s=arc-20160816; b=Ev6LFRztlHkbfVF1hwE6h7VBmY2ephEVlrCBVvOPvwT3FPHwMgYoacKsooNNow4L+Q MCTPqoZ+glBrsKUDzIjwOqDUs7hIkQQ5d6v4BiKbC+/rlkfy3RQqprjw9MJvkyW6aLol uLeemSbFQdLU3Dcl/jQTXQIE7q2Rbo0YHqJYahZwB7wR8PFt1owv4SoMf3tlbspZCQh5 Lxllaa5BV0prf8kqy+fckcmZ4wuiOtskSHXX6nTBtdo6LWa8GAWysB16D/PEJS67bi3o 2c46wcC+gJOFSNzoQl0rPDF3ZPIX6zxep7yD/dbNojKY4l8z58weQ4b2XgX+iH/Tb6qc 9V0w== 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=74cerE47LViHpGSOEG683htQjcSrM81CVEYVeue49d8=; fh=y8tS7hHyMnVm4J/EG8JBk7xmqgMCnIiFB1dTM3zggRY=; b=B0t/Lft+uzQ7Ah8ZCA9LZmw/ne5pgcv3kY1Wx97sKHyuNndONLBkSeX7wNB2rNCSq/ iLKrKep8F10BPeiSTFJQ677zKNa4xxwjfAcDuuc2T/FQos90kokytdgOvLRYLzgldsOO pN7eC9Tf4tZsJC1aCdd3QrL9oRdbiBsZnUqc5u1UZi/VGy4tg5I7Kr5hFvHJnVvlk6Lj XkjZPKTzDFN3QGE+ypZB2SkvsRt42Yr6F+F3mMrjci30z28dW1Fp84HwZsdUeOv5l+aS /o+idmw8GWGndkqaGSyOOCodFDyFdjrzWRFH5G+UDDZSiy7Dj5spo+kBexKrWWPOeD7q T5jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UUTklpCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a170906079300b0099279b2cdd8si1443785ejc.831.2023.07.27.12.56.12; Thu, 27 Jul 2023 12:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=UUTklpCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232360AbjG0TzI (ORCPT + 99 others); Thu, 27 Jul 2023 15:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231701AbjG0Ty7 (ORCPT ); Thu, 27 Jul 2023 15:54:59 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 57A3E30CA; Thu, 27 Jul 2023 12:54:57 -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 C58042383ECB; Thu, 27 Jul 2023 12:54:56 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C58042383ECB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1690487696; bh=74cerE47LViHpGSOEG683htQjcSrM81CVEYVeue49d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UUTklpCArQXKpCTvY9tpDIQL+I3r4jExFcVxpN5srxuHmYdiVB31RKS6i05a6FdFe g0V9JBNV1eD513ONcQ5kT2idJWi3Tn6NrHDYh2IqxfeodBh+7+cHZUZRacShzqBTMK u7l29JWMHeFkFQYL6oQv0ZgLmT16RLYFW4+X4+98= 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: mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@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 04/15] asm-generic/mshyperv: Introduce hv_recommend_using_aeoi() Date: Thu, 27 Jul 2023 12:54:39 -0700 Message-Id: <1690487690-2428-5-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772604964703311105 X-GMAIL-MSGID: 1772604964703311105 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 bffd15ce06f3..a897951634af 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -217,17 +217,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 447e7ebe67ee..90fcbb95f1ee 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -77,6 +77,19 @@ extern u64 hv_do_hypercall(u64 control, void *inputaddr, void *outputaddr); extern u64 hv_do_fast_hypercall8(u16 control, u64 input8); extern bool hv_isolation_type_snp(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) {