Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp49201lfv; Tue, 12 Apr 2022 16:49:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwVVs3QAQ4G+/soQhyjM2oyCIZekP62eqk8BM5t7A63uKixiqqwZIdDiJBVTiLmHkLONAt X-Received: by 2002:a17:902:c94d:b0:158:4e50:7a32 with SMTP id i13-20020a170902c94d00b001584e507a32mr15903706pla.163.1649807397793; Tue, 12 Apr 2022 16:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649807397; cv=none; d=google.com; s=arc-20160816; b=rc4EF0QtR0bLukXHl9SeQ0/ulP5x5nSViFCMMMErwtZICn1YUTJFDv5pZmSXhuUf0N GELfmf1pEM7KyeBRB2NtR0I5uUXnuerZARs25gp9daSSzgi6yjOkT1n0LxBsK67LO7YQ PAZ9mZL2OL/zvpGmTUDzlJSjlRjuNDAFwJ53T9UzgodGgcog8y48LUSflHbpj9SswD2g 1zBdHTD1NqaMA0i/Y1sH9t6KO0MhbddPfT2WuulvGYicvGLxacKRD9/fPn8QjsU/KSEf YQ91BsfqDzt1cxg3K0Px77MMSmZrSv3tfsvgbouwg2Pb5svYJefrYae8ON+p1Fqw7GLn ZsGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yqoB7cYv0kxyD6VAhUk1RPiQtFKpfEZtLhAhhc5teB0=; b=d/HWvAwQRATKU6myM8imVmhV24x4K5uDDm4DOmuBFApn1gtz8nELqiJONX+c/s+OcD ooGY0pXgXsoThC6pMj0Ej4P1IVoUhyn54VvUEe9tPMyPfB6K8lz47wWGgJMxRjL5hSI8 Kg4sKrvdSrQ8Jc6oIOvVBM5m3mvLPGzT70daMjOosACCa+6s6+pZ2R5A3tNxP8x0oTrw iFn9m+8wbX7NGAJV/59UMoXsZvKOt/ruXhmMadNw9n59COXnUSLErGgvlDd+AdSV4DGS aPEViMIJ2HVJ7eXc40fNQXUTqSO58HL+7b67KM9t3CBBK7eliagUsWAg73sOFbUa11c6 TUXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=FuGpmisN; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z11-20020a170902cccb00b0015826677457si12780818ple.354.2022.04.12.16.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:49:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=FuGpmisN; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B9F3212F141; Tue, 12 Apr 2022 14:42:48 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354127AbiDLTew (ORCPT + 99 others); Tue, 12 Apr 2022 15:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244085AbiDLTev (ORCPT ); Tue, 12 Apr 2022 15:34:51 -0400 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC4549CAE; Tue, 12 Apr 2022 12:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1649791953; x=1681327953; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=yqoB7cYv0kxyD6VAhUk1RPiQtFKpfEZtLhAhhc5teB0=; b=FuGpmisN04XO933OU7s1BefVJB6ugr0n1G+gr6dF+Tf/7Hvg2u6heSxh lpQknFuxibrUn3t1H1n/5FNfE/+69LyJfC8VH7rEIq3ySL5tjbWVIRqgg iuq4ZjWKiF/h0DwXHAg2YWvy+x3ZS07jqXH8oFWAgg4533RhdufX/lp/L 4=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 12 Apr 2022 12:32:33 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2022 12:32:32 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 12 Apr 2022 12:32:32 -0700 Received: from [10.226.58.18] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 12 Apr 2022 12:32:30 -0700 Message-ID: <98bee89c-608b-79a2-d796-4a2b260cf927@quicinc.com> Date: Tue, 12 Apr 2022 13:32:29 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] PCI: hv: Fix multi-MSI to allow more than one MSI vector Content-Language: en-US To: , , , , , , , , , CC: , , , References: <1649772991-10285-1-git-send-email-quic_jhugo@quicinc.com> From: Jeffrey Hugo In-Reply-To: <1649772991-10285-1-git-send-email-quic_jhugo@quicinc.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE 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 On 4/12/2022 8:16 AM, Jeffrey Hugo wrote: > If the allocation of multiple MSI vectors for multi-MSI fails in the core > PCI framework, the framework will retry the allocation as a single MSI > vector, assuming that meets the min_vecs specified by the requesting > driver. > > Hyper-V advertises that multi-MSI is supported, but reuses the VECTOR > domain to implement that for x86. The VECTOR domain does not support > multi-MSI, so the alloc will always fail and fallback to a single MSI > allocation. > > In short, Hyper-V advertises a capability it does not implement. > > Hyper-V can support multi-MSI because it coordinates with the hypervisor > to map the MSIs in the IOMMU's interrupt remapper, which is something the > VECTOR domain does not have. Therefore the fix is simple - copy what the > x86 IOMMU drivers (AMD/Intel-IR) do by removing > X86_IRQ_ALLOC_CONTIGUOUS_VECTORS after calling the VECTOR domain's > pci_msi_prepare(). > > Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs") > Signed-off-by: Jeffrey Hugo > --- > 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 d270a204..41be63e 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -614,7 +614,16 @@ static void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, > static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, > int nvec, msi_alloc_info_t *info) > { > - return pci_msi_prepare(domain, dev, nvec, info); > + int ret = pci_msi_prepare(domain, dev, nvec, info); > + > + /* > + * By using the interrupt remapper in the hypervisor IOMMU, contiguous > + * CPU vectors in not needed for multi-MSI I just noticed that "in" should be "is". > + */ > + if (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI) > + info->flags &= ~X86_IRQ_ALLOC_CONTIGUOUS_VECTORS; > + > + return ret; > } > > /**