Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp7720pxk; Wed, 2 Sep 2020 12:49:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz06cL36A1rij7uf3Qpd1Sf7Yc2x9v4rupFLL5+bFTtdQ3dGXVu7ncvvLOzXnUoYR+AwTVt X-Received: by 2002:a17:906:aac7:: with SMTP id kt7mr1661984ejb.548.1599076174830; Wed, 02 Sep 2020 12:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599076174; cv=none; d=google.com; s=arc-20160816; b=q6tkmf8+e0GwWVlRmERrMmQzbftuP0E4mkCp/06sXOQFnZnrmzhJ8IRkosYQ5DjCva 1XzOXSqu9rKJtMr7Tgn+MPf0JVnJT9IMBQycXSccS/NqeBOBrWhOGt6u319vcz4+ORHb 0HC/S2yJHymLpa6xf9Gcnn4rYkwtpB2EPI0d00IHytHPaEiralF+BCPYql6hYjgGOSNK cLZjUHtrWeBJVNL+1q3As28+F+IbKQ0LPnYW1Y6jELsEF8pzk8xYd9CRCDxVid3Cs5P6 HrEzrAQQa20Ya112qNcoP/wt3SFtpy1qOsjgRwMtiKzdE0MiQzmSC76ZdS4DFH5rEa4c 9waA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3++UIndG1m1KM9xZicSr0DVbIof7t1DVHs7Tsd9oytE=; b=QeLEEQxl85qCM9K+A7yEff1svUILceZuGBTISMSwl1qKQUabjmWodlvg2Ip8hV842i 7DcpDx9pp+ywbpLMJcwdOEVKQaJpL4l1EiP4TGNxEerf0mA7ch5CCkqGyy58a5GuMDa2 J5s5dFLygqXd9kHOBzOWo7cb0Q3D7ClvqgOxzy832xumaUY/FOaNd51+XeGM6yRQD1E7 Gg0zTaSPhSX4xXQvnD3v2xuCYTS7DiepjNDXDO1FvljxWlamsC529ZuEwKulNzj//jJK mhAaHp3OZ2IONKCLW6qDS+w3pC+8wtEuWjn26n8CxHuM94EBN0CsAOpOSMQMq+TrbNPY NGGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=bf62Hpk9; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si378580ejj.381.2020.09.02.12.49.11; Wed, 02 Sep 2020 12:49:34 -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=@ibm.com header.s=pp1 header.b=bf62Hpk9; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726490AbgIBTq4 (ORCPT + 99 others); Wed, 2 Sep 2020 15:46:56 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37260 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgIBTqy (ORCPT ); Wed, 2 Sep 2020 15:46:54 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 082JgPHx042469; Wed, 2 Sep 2020 15:46:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=3++UIndG1m1KM9xZicSr0DVbIof7t1DVHs7Tsd9oytE=; b=bf62Hpk9JRVtlwLb0KoRpdEItjn6x1+I9PpvwvmPCTrL5SMAM0MK7HHOr7WbGzI5vHWP ObLkDKhqjjkmrClDJsikByG8ysSteRzJmpD6fLCB4ev/jQzBZBec5z/WcvPuBzrMgiAe SFtNOIAWbJzOmACz6UrbuSVafi7dFfvOgxIMNEX6pDAnu+UIH5abObLhbxNYGl6OC8ng sgmknhQMU7Y8TCZ/g6j553PRVpDMkxvYAxjGStMiyRxEGZBPEcV58gcdYOg/oL6lwJaA jQyfdP27iTaWrI48fRuP7+rSkaBJjzduOOPyTI8g6htx5NPnyToaPF7tdURDHzaHxtU7 7g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33ahsfg4kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Sep 2020 15:46:47 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 082Jklcn056649; Wed, 2 Sep 2020 15:46:47 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 33ahsfg4k4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Sep 2020 15:46:47 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 082JgoD1006123; Wed, 2 Sep 2020 19:46:46 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma03wdc.us.ibm.com with ESMTP id 337en9jdq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Sep 2020 19:46:46 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 082JkjX13212272 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Sep 2020 19:46:45 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BAEE2805A; Wed, 2 Sep 2020 19:46:45 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0F0828059; Wed, 2 Sep 2020 19:46:43 +0000 (GMT) Received: from oc4221205838.ibm.com (unknown [9.163.10.164]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 2 Sep 2020 19:46:43 +0000 (GMT) From: Matthew Rosato To: alex.williamson@redhat.com, bhelgaas@google.com Cc: schnelle@linux.ibm.com, pmorel@linux.ibm.com, mpe@ellerman.id.au, oohall@gmail.com, cohuck@redhat.com, kevin.tian@intel.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 1/3] PCI/IOV: Mark VFs as not implementing MSE bit Date: Wed, 2 Sep 2020 15:46:34 -0400 Message-Id: <1599075996-9826-2-git-send-email-mjrosato@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1599075996-9826-1-git-send-email-mjrosato@linux.ibm.com> References: <1599075996-9826-1-git-send-email-mjrosato@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-02_14:2020-09-02,2020-09-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 clxscore=1011 lowpriorityscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009020178 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Per the PCIe spec, VFs cannot implement the MSE bit AKA PCI_COMMAND_MEMORY, and it must be hard-wired to 0. Use a dev_flags bit to signify this requirement. Signed-off-by: Matthew Rosato --- drivers/pci/iov.c | 1 + include/linux/pci.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index b37e08c..2bec77c 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->dev_flags |= PCI_DEV_FLAGS_FORCE_COMMAND_MEM; if (id == 0) pci_read_vf_config_common(virtfn); diff --git a/include/linux/pci.h b/include/linux/pci.h index 8355306..9316cce 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -227,6 +227,8 @@ enum pci_dev_flags { PCI_DEV_FLAGS_NO_FLR_RESET = (__force pci_dev_flags_t) (1 << 10), /* Don't use Relaxed Ordering for TLPs directed at this device */ PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11), + /* Device does not implement PCI_COMMAND_MEMORY (e.g. a VF) */ + PCI_DEV_FLAGS_FORCE_COMMAND_MEM = (__force pci_dev_flags_t) (1 << 12), }; enum pci_irq_reroute_variant { -- 1.8.3.1