Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1325885rwl; Fri, 7 Apr 2023 13:59:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2v8BStzpltVqv3MKn5809WPWnHukPLUclG6s1LmTJOWh+aY+ElNc1WLpS7/GRI/VywaVw X-Received: by 2002:a17:90b:4b8e:b0:23f:e165:3452 with SMTP id lr14-20020a17090b4b8e00b0023fe1653452mr293870pjb.0.1680901175472; Fri, 07 Apr 2023 13:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680901175; cv=none; d=google.com; s=arc-20160816; b=f6jNYrM8uoSrQ+qH+QSRCS0AgyPt7TSsw0wOZzZ35LTCVgScOFCyalirrLI5ZCPbZS J4bcQaJOkKZquHK8WSwj3ouMf5daSD+mrsg09wiV7eWgZereZef+prF+Sk9u7Vzpbxaq 6HSuSOb5Tm4BF0AC3tyXulQTb+O8JHz9w7aLHwVmNsAtjepWeXDDMhmJ3M8YKSJi6gMx 3vCvZvxDSnRlGUZNEr9zWRL4uwpG8fzE2aCKvySl7zjRKqgbWhVlME5plfuLejH82AIz VRI/rXUp2zJ+Vi4/u+A6U3x0nXB2ehHrdQITXy+GEwphLTMdmwjyP0Lf4EkpkOF/21q3 lUnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:from:subject :dkim-signature:dkim-filter; bh=32mhPLCSnFqlWC0muL7q44icEI++yknNcaEQIU1ZLvE=; b=ieBYNp8/jZkoXz7xu385xDsHok2359WDuYU2yGtRSa6MuZAwxUBUOWjTLJfXdAgG04 XvpRlT09eJaDwKu0STDZS1DZ4mSgQofzPZeTMCnfPNsYtE5dE2TW7w3XqM4RBqHoesDF BvsFHBwZbczXDSzZS08ybUHaW7B2GWiYWASZRw9awq2weY+VLWPezhdCt1rqox/ZbTqt TggzmeNuaL9m7E84acgOshZ4HNFk3ajQHDNCw+C8Z4yPbDiOcIQJJq6xDOOB4OvY4TeP l9ommDd/OpaCaV52IXf3ValoGioYnGL4XZLxD309xswawP3aObaho0V8opPKEwpqgAL8 vR0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=rLRQUe03; 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 u11-20020a6540cb000000b00513234112a5si4132279pgp.881.2023.04.07.13.59.24; Fri, 07 Apr 2023 13:59:35 -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=rLRQUe03; 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 S230437AbjDGU6X (ORCPT + 99 others); Fri, 7 Apr 2023 16:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbjDGU6T (ORCPT ); Fri, 7 Apr 2023 16:58:19 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45E1AC17E; Fri, 7 Apr 2023 13:58:17 -0700 (PDT) Received: from skinsburskii.localdomain (unknown [131.107.1.229]) by linux.microsoft.com (Postfix) with ESMTPSA id AE674213B634; Fri, 7 Apr 2023 13:58:16 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AE674213B634 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680901096; bh=32mhPLCSnFqlWC0muL7q44icEI++yknNcaEQIU1ZLvE=; h=Subject:From:Cc:Date:In-Reply-To:References:From; b=rLRQUe03PQBMKbXvSZ/VJWDxgdc9PySimsj3H5+d3DxKwZjzOd7WeHSUUetID2zxh nayWNjg4p5Co3J52iHGyG4JgzQm14NIt/oJhXv8wMvDRwEzY6CKH3KWd94mThdmOxA wVJYjO39KNVcye7uCLbs6BOrthe+MQi/hGzv8c+c= Subject: [PATCH 2/2] PCI: hv: Deal with nested MSHV setup From: Stanislav Kinsburskii Cc: Stanislav Kinsburskii , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 06 Apr 2023 09:33:24 -0700 Message-ID: <168079879905.14175.16212926378045082102.stgit@skinsburskii.localdomain> In-Reply-To: <168079806973.14175.17999267023207421381.stgit@skinsburskii.localdomain> References: <168079806973.14175.17999267023207421381.stgit@skinsburskii.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-16.2 required=5.0 tests=DATE_IN_PAST_24_48, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH, MISSING_HEADERS,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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stanislav Kinsburskii Running Microsoft hypervisor as nested (i.e., on top of another Microsoft hypervisor) imposes a different requirement for the PCI-hyperv controller. In this setup, the interrupt will first come to the nested (L1) hypervisor from the hypervisor, running on bare metal (L0), and then the L1 hypervisor will deliver the interrupt to the appropriate CPU of the nested root partition. Thus, instead of issuing the RETARGET hypercall to the L0 hypervisor, MAP_DEVICE_INTERRUPT hypercall should be issued to the L1 hypervisor to complete the interrupt setup. Signed-off-by: Stanislav Kinsburskii CC: "K. Y. Srinivasan" CC: Haiyang Zhang CC: Wei Liu CC: Dexuan Cui CC: Lorenzo Pieralisi CC: "Krzysztof WilczyƄski" CC: Rob Herring CC: Bjorn Helgaas CC: linux-hyperv@vger.kernel.org CC: linux-pci@vger.kernel.org CC: linux-kernel@vger.kernel.org --- drivers/pci/controller/pci-hyperv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index f33370b75628..61bee8babad4 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1570,7 +1570,16 @@ static void hv_irq_mask(struct irq_data *data) static void hv_irq_unmask(struct irq_data *data) { - hv_arch_irq_unmask(data); + if (hv_nested && hv_root_partition) + /* + * In case of the nested root partition, the nested hypervisor + * is taking care of interrupt remapping and thus the + * MAP_DEVICE_INTERRUPT hypercall is required instead of the + * RETARGET_INTERRUPT one. + */ + (void)hv_map_msi_interrupt(data, NULL); + else + hv_arch_irq_unmask(data); if (data->parent_data->chip->irq_unmask) irq_chip_unmask_parent(data);