Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5844704rwl; Tue, 4 Apr 2023 04:40:19 -0700 (PDT) X-Google-Smtp-Source: AKy350Z1sF3a2uShQBkn4TEf97zDYPk45HAlk+DGmqihjxQGFAhOy3XPwEMDUj8FyH4LUenPNq0F X-Received: by 2002:aa7:de1a:0:b0:502:1f0d:140b with SMTP id h26-20020aa7de1a000000b005021f0d140bmr2161505edv.11.1680608419232; Tue, 04 Apr 2023 04:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680608419; cv=none; d=google.com; s=arc-20160816; b=sRddWMj3FGFiKXXgzxYNeWUydV5ucOi02oW0BIu9dc0bxyINmf4MPvno+NNr9Nw+FC 5ZtMAYpNTK1x7QQtqoFLDnhB0X1ysOiEU18eou8H9zbkTfv1YDM8ysZF+SzXZZjbhGMz 9E82yw59uZTP+X81Nmk5s8F5Y+1aoVRPSZhRoe11QyuugRsrVBWWohPtNQDw6sVR8N0e N91s0JKBoYM/ljjD97eYIzv6bMC64jsCUHYQlpFIGo5Oiz2qlG/AaXfTnzIFQZ8yl3Rx NR+zgQuDydZ4AYngr0qPweN7B4ezu2kDfKI8pC/dzHCWhI7VQAYC3tjFhrBi6EUuZ595 T/bw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020aa7d282000000b005024aa3e836si10968396edq.394.2023.04.04.04.39.52; Tue, 04 Apr 2023 04:40:19 -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 S234066AbjDDLgg (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 Content-Transfer-Encoding: 8bit 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 In case of nested MSHV, retargeting interrupt hypercall should be sent to L0 hypervisor instead of L1 hypervisor. Signed-off-by: Jinank Jain --- 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); -- 2.34.1