Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4326377pxj; Tue, 8 Jun 2021 11:34:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMlKQ3Tt4FPq0sdAAZoWIBRkV2mFXiJrYSCS9/NZsGjtBjRKlgug+N9qSk3gdlkMSkviCR X-Received: by 2002:a05:6402:b17:: with SMTP id bm23mr26851932edb.236.1623177255060; Tue, 08 Jun 2021 11:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623177255; cv=none; d=google.com; s=arc-20160816; b=GypPdAztjWiRumkVGXQgxwVRbE/Iar6RX61zkyPkyU3lqFXYKqU8pfW12pLzdsTJls IRzhdbljAJR7O8Qf5MBsNzIFTdDCYCxHEu8+QQYc8xTpB24Sx7aE6coug7UzY3Citad1 +ipuOpSaoZTg/rvO3ibeS+g5EVMsOVhX/8ufyUn8XmbHxeGaPo3DDecxfq8t9hq/vB65 4awSHPMUWnWr7gA8B1kdUI8varIDmldynUHNyYnjR0ahPg3/otQyorF+xsDPb5IiToUi EhRCit1+17nt7GexPT/x2yBuUSz008X2K0Jb7Mucg3WvEz3N79ulIe+wZJRCFgqdZP9K SwNw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Qsf1uQZQuJPZTNsafhZLXkGrJ7iMA5D96tBOYmfg28=; b=GxogbhvfIcjdmPgQNPNDF+H4NzKdOoTG0l6d73KKPsgS8YpRs3g8w0HpePGBzQuHMe VaVJqNlhHzT9U+TCh1199mI5/coUG1N6ZodblOh4+jX3mLU3HP4p/0iB0I+JxOWALcIA onQaCiqtE+u71R48Yc05r854V8q4hMMdHPYr5Jp0di4+3VDle1dnN6Wo+GBga0vW/Lc8 WjbvvD122izywDdtiNEDn05ynAHZR71ag6zqCSO0Z/rEVdoUNK0GxTnTtYiKoce7YGDY 5RAbiRRpSwq7KFd+uiXNKV8WqlZABEw3GiOJ+pXPsO5ktEi03EfI1Uy2TmvgwEp22LT2 zgzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QC4JxbQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si357247edw.427.2021.06.08.11.33.51; Tue, 08 Jun 2021 11:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QC4JxbQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234060AbhFHSdh (ORCPT + 99 others); Tue, 8 Jun 2021 14:33:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:57466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234221AbhFHSc3 (ORCPT ); Tue, 8 Jun 2021 14:32:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7D66613D3; Tue, 8 Jun 2021 18:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177020; bh=xVMsWp26lw0ReF/0QrK6B1Ds64/IDcKJGNXPTJopo9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QC4JxbQKs6pDyo5FvBS/IWFytvPvxR4LGW0qLc15+7qgbNzspN4AWsFTJcK9Musqv fIou9m1qofLsAudNzGwjbc6cULQsSjCG+talNrtOaJrFn7uoY0qa0ZpNfyQkJEcZGV z+ntY/dyiCEMQ0iQ81RQ/Y10uGjqXX9xBEewQ1kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Beulich , Boris Ostrovsky , Juergen Gross Subject: [PATCH 4.9 29/29] xen-pciback: redo VF placement in the virtual topology Date: Tue, 8 Jun 2021 20:27:23 +0200 Message-Id: <20210608175928.763231955@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175927.821075974@linuxfoundation.org> References: <20210608175927.821075974@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Beulich The commit referenced below was incomplete: It merely affected what would get written to the vdev- xenstore node. The guest would still find the function at the original function number as long as __xen_pcibk_get_pci_dev() wouldn't be in sync. The same goes for AER wrt __xen_pcibk_get_pcifront_dev(). Undo overriding the function to zero and instead make sure that VFs at function zero remain alone in their slot. This has the added benefit of improving overall capacity, considering that there's only a total of 32 slots available right now (PCI segment and bus can both only ever be zero at present). This is upstream commit 4ba50e7c423c29639878c00573288869aa627068. Fixes: 8a5248fe10b1 ("xen PV passthru: assign SR-IOV virtual functions to separate virtual slots") Signed-off-by: Jan Beulich Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/8def783b-404c-3452-196d-3f3fd4d72c9e@suse.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xen-pciback/vpci.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c @@ -68,7 +68,7 @@ static int __xen_pcibk_add_pci_dev(struc struct pci_dev *dev, int devid, publish_pci_dev_cb publish_cb) { - int err = 0, slot, func = -1; + int err = 0, slot, func = PCI_FUNC(dev->devfn); struct pci_dev_entry *t, *dev_entry; struct vpci_dev_data *vpci_dev = pdev->pci_dev_data; @@ -93,23 +93,26 @@ static int __xen_pcibk_add_pci_dev(struc /* * Keep multi-function devices together on the virtual PCI bus, except - * virtual functions. + * that we want to keep virtual functions at func 0 on their own. They + * aren't multi-function devices and hence their presence at func 0 + * may cause guests to not scan the other functions. */ - if (!dev->is_virtfn) { + if (!dev->is_virtfn || func) { for (slot = 0; slot < PCI_SLOT_MAX; slot++) { if (list_empty(&vpci_dev->dev_list[slot])) continue; t = list_entry(list_first(&vpci_dev->dev_list[slot]), struct pci_dev_entry, list); + if (t->dev->is_virtfn && !PCI_FUNC(t->dev->devfn)) + continue; if (match_slot(dev, t->dev)) { pr_info("vpci: %s: assign to virtual slot %d func %d\n", pci_name(dev), slot, - PCI_FUNC(dev->devfn)); + func); list_add_tail(&dev_entry->list, &vpci_dev->dev_list[slot]); - func = PCI_FUNC(dev->devfn); goto unlock; } } @@ -122,7 +125,6 @@ static int __xen_pcibk_add_pci_dev(struc pci_name(dev), slot); list_add_tail(&dev_entry->list, &vpci_dev->dev_list[slot]); - func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); goto unlock; } }