From patchwork Tue Oct 27 13:53:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 312154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5D08C55178 for ; Tue, 27 Oct 2020 17:02:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DD2C20725 for ; Tue, 27 Oct 2020 17:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818154; bh=BrzE6FuA9rcWBhFxOTzzLu3ZkxPjMnXxY6yoS+GALEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yW7+kegJRnuuXEqzQUqV8WJHQx5kTjbxTWd06LnsOKO4IFC7rDY3REhyeu1jGPPmZ Xk+0EGUfdLpR3vN0iYLE6Pd+Nz1hM95/tvKjKDd4spDlfVxfS00WqAxw60Wer2W/GH Xl/JyNeKALE6RhO97a4ITuzo6XEgcCn6wZJtv2Zk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1815461AbgJ0RC3 (ORCPT ); Tue, 27 Oct 2020 13:02:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793729AbgJ0PID (ORCPT ); Tue, 27 Oct 2020 11:08:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 96321206E5; Tue, 27 Oct 2020 15:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811281; bh=BrzE6FuA9rcWBhFxOTzzLu3ZkxPjMnXxY6yoS+GALEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7bH3h4JiUuo5NkArCqK9g8qa2fuMcdesobM9wNcbRNEwx7FOGXzgapwt+KfgBkgx FrUPy8W4IFeplDMaE5B7wuhcZjT1NgQfXXiSqFIuWlKtqXd8v0/YOfKsfiaK6ALDPT DJTfX1AyxNIZkAk7Q9ndb5tREOP2ya2BZ5cyhb5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Rosato , Niklas Schnelle , Pierre Morel , Alex Williamson , Sasha Levin Subject: [PATCH 5.8 437/633] s390/pci: Mark all VFs as not implementing PCI_COMMAND_MEMORY Date: Tue, 27 Oct 2020 14:53:00 +0100 Message-Id: <20201027135543.221876826@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matthew Rosato [ Upstream commit 08b6e22b850c28b6032da1e4d767a33116e23dfb ] For s390 we can have VFs that are passed-through without the associated PF. Firmware provides an emulation layer to allow these devices to operate independently, but is missing emulation of the Memory Space Enable bit. For these as well as linked VFs, set no_command_memory which specifies these devices do not implement PCI_COMMAND_MEMORY. Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory") Signed-off-by: Matthew Rosato Reviewed-by: Niklas Schnelle Reviewed-by: Pierre Morel Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- arch/s390/pci/pci_bus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/s390/pci/pci_bus.c b/arch/s390/pci/pci_bus.c index 5967f30141563..c93486a9989bc 100644 --- a/arch/s390/pci/pci_bus.c +++ b/arch/s390/pci/pci_bus.c @@ -197,9 +197,10 @@ void pcibios_bus_add_device(struct pci_dev *pdev) * With pdev->no_vf_scan the common PCI probing code does not * perform PF/VF linking. */ - if (zdev->vfn) + if (zdev->vfn) { zpci_bus_setup_virtfn(zdev->zbus, pdev, zdev->vfn); - + pdev->no_command_memory = 1; + } } static int zpci_bus_add_device(struct zpci_bus *zbus, struct zpci_dev *zdev)