From patchwork Tue Oct 27 13:52:58 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: 307234 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 B266BC55178 for ; Tue, 27 Oct 2020 17:02:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63B3F22281 for ; Tue, 27 Oct 2020 17:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603818128; bh=ioN8SjQ1dFIQceqdVFeNAj/70KdTxlSPJglqQVWuGZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k1GwypyAsYKAPqsIJxb2bmsFw3nJrYsMTkm8xhQqTFyJaB2AF5LXj9l67X76YOBRo chqgTzmxvu5tstcwW4vVivxJJwWhyHQuKlvqgbKSCSjL1U+bMfSYrvvnae2Xhqvd0v 7IbjQAep6MC7YbXEUA+5OB4hyXRUXOCxPV0dEEcs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1793785AbgJ0PIR (ORCPT ); Tue, 27 Oct 2020 11:08:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:42900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793709AbgJ0PH5 (ORCPT ); Tue, 27 Oct 2020 11:07:57 -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 DFCD7206F4; Tue, 27 Oct 2020 15:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811275; bh=ioN8SjQ1dFIQceqdVFeNAj/70KdTxlSPJglqQVWuGZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwgP0klYdPdFKW6bSaO3whRKYOLfiXkR2SmqEERgykjg6fGYAF9ss/BQn1wAK00Be duxtxf1JFWR0ta6yOZHlz8HZvTdWF/b6F0OunBILReQAD9O7gv3H12qLHUyMpOvt1D TXKijqMCvpvfXVc0JwicYGHnn0T07Vu2BMlkvvz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Rosato , Bjorn Helgaas , Alex Williamson , Sasha Levin Subject: [PATCH 5.8 435/633] PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY Date: Tue, 27 Oct 2020 14:52:58 +0100 Message-Id: <20201027135543.127074008@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 12856e7acde4702b7c3238c15fcba86ff6aa507f ] For VFs, the Memory Space Enable bit in the Command Register is hard-wired to 0. Add a new bit to signify devices where the Command Register Memory Space Enable bit does not control the device's response to MMIO accesses. Fixes: abafbc551fdd ("vfio-pci: Invalidate mmaps and block MMIO access on disabled memory") Signed-off-by: Matthew Rosato Acked-by: Bjorn Helgaas Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin --- drivers/pci/iov.c | 1 + include/linux/pci.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b37e08c4f9d1a..4afd4ee4f7f04 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c @@ -180,6 +180,7 @@ int pci_iov_add_virtfn(struct pci_dev *dev, int id) virtfn->device = iov->vf_device; virtfn->is_virtfn = 1; virtfn->physfn = pci_dev_get(dev); + virtfn->no_command_memory = 1; if (id == 0) pci_read_vf_config_common(virtfn); diff --git a/include/linux/pci.h b/include/linux/pci.h index 34c1c4f45288f..1bc3c020672fd 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -439,6 +439,7 @@ struct pci_dev { unsigned int is_probed:1; /* Device probing in progress */ unsigned int link_active_reporting:1;/* Device capable of reporting link active */ unsigned int no_vf_scan:1; /* Don't scan for VFs after IOV enablement */ + unsigned int no_command_memory:1; /* No PCI_COMMAND_MEMORY */ pci_dev_flags_t dev_flags; atomic_t enable_cnt; /* pci_enable_device has been called */