From patchwork Sun Feb 10 06:52:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Knut Omang X-Patchwork-Id: 10804657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C6D8922 for ; Sun, 10 Feb 2019 06:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E831298D7 for ; Sun, 10 Feb 2019 06:55:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 527922993F; Sun, 10 Feb 2019 06:55:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EB9829927 for ; Sun, 10 Feb 2019 06:55:07 +0000 (UTC) Received: from localhost ([127.0.0.1]:55681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsj18-0007oT-Ns for patchwork-qemu-devel@patchwork.kernel.org; Sun, 10 Feb 2019 01:55:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gsizp-0006s3-AU for qemu-devel@nongnu.org; Sun, 10 Feb 2019 01:53:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gsizl-0000G7-GF for qemu-devel@nongnu.org; Sun, 10 Feb 2019 01:53:43 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gsizh-0000A7-E2 for qemu-devel@nongnu.org; Sun, 10 Feb 2019 01:53:38 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1A6opUb140567; Sun, 10 Feb 2019 06:53:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=4uLWNydmPf4aZWMQnKPEKF4I+TmnMVyPbXe608G0PUU=; b=26OJ8bpSBcTkAPODsBno0oWYQmxrkPbF4IwWcIc29i+TIXMUVtw92/EjWuG0HOc8ZIK9 UMWpxViutZzZzqBBB50PSiXywlSpOfdy2DoGd9Cha8LhxhVyqR0rBRQrhPEP4RtwzkPb z/VroEDmE2H9qlvVgFVkNEyrS19LY5Xx2cq9o4Uj5LQlScv4Fqi6ULSgrQci0+D1vEdu Sfm6x4EEIXcsMQAd38XFwnZK5uT26A3WrFl9bKIR2w2o/MmgY0o18iHxv3McJ+dvSPnS 2XSAUdkdwJ3FSy5ZKxx6U8fXPkZ4697goU8DK2nSfDUk1mC14jrE5nigF/bfIkXpNWTN aQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2qhredhtd7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Feb 2019 06:53:20 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x1A6rIsq002504 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Feb 2019 06:53:19 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1A6rHo2023958; Sun, 10 Feb 2019 06:53:17 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 10 Feb 2019 06:53:17 +0000 From: Knut Omang To: qemu-devel@nongnu.org Date: Sun, 10 Feb 2019 07:52:58 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9162 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=905 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902100052 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH v3 0/2] pcie: Add simple ACS "support" to the generic PCIe root port X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S . Tsirkin" , Tal Attaly , Knut Omang , Alex Williamson , Elijah Shakkour , Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These two patches together implements a PCIe capability config space header for Access Control Services (ACS) for the new Qemu specific generic root port. ACS support in the associated root port is a prerequisite to be able to pass individual functions of a device populating the port through to an L2 guest from an unmodified kernel. Without this, the IOMMU group the device belongs to will also include the root port itself, and all functions the device provides. It is necessary to support SR/IOV where the primary purpose is to be able to share out individual VFs to different guests, which will not be permitted by VFIO or the Windows Hyper-V equivalent unless ACS is supported by the root port. These patches can also be found as part of an updated version of my SR/IOV emulation patch set at https://github.com/knuto/qemu/tree/sriov_patches_v11 The patches' basic operation with VFIO and iommu groups have been tested with the above patch set and a rebased version of an in progress igb ethernet device, which needs some more care before I can let it go out. Changes from v2: ---------------- - rebased to the latest qemu master Incorporated further feedback from Alex: - Make sure slot/downstream capability bits are only set for slots. - Make acs reset callback do nothing if no acs capability exists - Set correct acs version - div simplification Changes from v1: ---------------- Incorporated feedback from Alex Williamson: - Make commit messages reflect a more correct understanding of how this affects VFIO operation. - Implemented the CTRL register properly (reset callback + making non-implemented capabilities RO, default value 0) - removed the egress ctrl vector parameter to the init function - Fixed some whitespace issues Knut Omang (2): pcie: Add a simple PCIe ACS (Access Control Services) helper function gen_pcie_root_port: Add ACS (Access Control Services) capability hw/pci-bridge/gen_pcie_root_port.c | 4 ++++ hw/pci-bridge/pcie_root_port.c | 4 ++++ hw/pci/pcie.c | 29 +++++++++++++++++++++++++++++ include/hw/pci/pcie.h | 6 ++++++ include/hw/pci/pcie_port.h | 1 + include/hw/pci/pcie_regs.h | 4 ++++ 6 files changed, 48 insertions(+) base-commit: e47f81b617684c4546af286d307b69014a83538a