From patchwork Tue Apr 4 11:35:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinank Jain X-Patchwork-Id: 79032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2963563vqo; Tue, 4 Apr 2023 04:54:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCQZoVm8BphmukSCNADCspc41R10DjmYTSgYg6iO8FP/7yfcypAhhHlETGaE+3tgsdJuLs X-Received: by 2002:a05:6a20:4a30:b0:e0:316a:d62c with SMTP id fr48-20020a056a204a3000b000e0316ad62cmr2068718pzb.60.1680609279035; Tue, 04 Apr 2023 04:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680609279; cv=none; d=google.com; s=arc-20160816; b=L2E6C4j5cUFKNpr58ap429yzzkId1YpzCQqGdlJqXLLCotWedLY7DN1heTKSHwrUec G2U1o6k33Ca6VHyg9MkgchR8hSacXZV1c58RGm+vXJTMJX4AYAXJtyd5VbgcFzp77AHg yx0Dbtf2CS4acE61WjDIfILmu9D97WSf/B3tvb2LqYX8T5yzbjMpBmtiw+b8ENeKHNLc AC0QDT4O9vtTtAx8CD9Kw+UL3GHLH786Fsl57jwjFE73YW0N+xiw4NWH5Er1kiCUeCjo DjV6tpAyQFRxbmwf15+mizLEZZBYKn1JTQqzhNNXLXe2mnx9/UEn9ih2zdQDLa2hbKjo GtgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=Xb9yuM7R3oQ9NGgUVXpfb5wLOmXOn+CR7TrZ/4l7qqo=; b=xw7+TSQICuOfxvPOky5+gnhO+R4R9YHX+1QUuzfKF8k/aa+BTg7w2uMvh/c7ADOXTM 8VJV6GxblSV1lieEJP4jTDgw20AKWUl/zlnkSwo3FKHZflyAytfyD+arnkR7X9G63a6c dwPnftkZ/98CmEafybWIM22hdTZ7vSGI9fLqBZr0hicRb1/AK6j4e/dKZDIySZLMrxOb HUzlxHNlrh/LvmblSVxF2AjID/rTpUNIcirLq5bDmAaDAe1rO6Da/UwjS3x7khGbqAOb rCGTtv9UMWR6tRQ0MrerCVAh1buTGXDqNRN2C7vwP1b8dY9kXt7MEALPTzItIp3y2ko+ bNcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=rvQv8Wqi; 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 d23-20020a631d57000000b0050f692470fasi10184127pgm.301.2023.04.04.04.54.24; Tue, 04 Apr 2023 04:54:39 -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=rvQv8Wqi; 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 S234000AbjDDLgg (ORCPT + 99 others); Tue, 4 Apr 2023 07:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234159AbjDDLgd (ORCPT ); Tue, 4 Apr 2023 07:36:33 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 383A3420E; Tue, 4 Apr 2023 04:35:58 -0700 (PDT) Received: from jinankjain-dranzer.zrrkmle5drku1h0apvxbr2u2ee.ix.internal.cloudapp.net (unknown [20.188.121.5]) by linux.microsoft.com (Postfix) with ESMTPSA id C077B209A868; Tue, 4 Apr 2023 04:35:48 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C077B209A868 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680608151; bh=Xb9yuM7R3oQ9NGgUVXpfb5wLOmXOn+CR7TrZ/4l7qqo=; h=From:To:Cc:Subject:Date:From; b=rvQv8WqiXyc1xM/K7HQGFRvxtzOHIyOVnKmRSnqnIOxAKKv6T29e8EON04+yt5ZaF 3N62HcinnlpAAR5QpC+f4/4OrNNEI9EY3DV+B5eHHff8BmMmkKVevFiynlQwTwbojB SgXazHdLuIXX+CG0FCK6LPvFcZys+/7LgXU4CPl0= From: Jinank Jain To: jinankjain@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com Cc: linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, nunodasneves@linux.microsoft.com Subject: [PATCH] PCI: hv: Use nested hypercall for retargeting interrupts Date: Tue, 4 Apr 2023 11:35:46 +0000 Message-Id: <20230404113546.856813-1-jinankjain@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-17.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762246555544006605?= X-GMAIL-MSGID: =?utf-8?q?1762246555544006605?= In case of nested MSHV, retargeting interrupt hypercall should be sent to L0 hypervisor instead of L1 hypervisor. Signed-off-by: Jinank Jain Reviewed-by: Nuno Das Neves --- drivers/pci/controller/pci-hyperv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index f33370b75628..2123f632ecf7 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -704,8 +704,14 @@ static void hv_arch_irq_unmask(struct irq_data *data) } } - res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17), - params, NULL); + if (hv_nested) + res = hv_do_nested_hypercall(HVCALL_RETARGET_INTERRUPT | + (var_size << 17), + params, NULL); + else + res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | + (var_size << 17), + params, NULL); exit_unlock: spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags);