From patchwork Tue Feb 28 04:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 13154402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C8DDC64ED6 for ; Tue, 28 Feb 2023 04:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LRAMc8nub9JOtgUlw98lzelTCw1RDlJcBKDwcAirfQo=; b=mPVt/AnNYDm8hC w88Ru4oLE08lsyO0W+p5v4wLsWdgFW++uxS3S3vJhyZGZ6c3bhhEPKWjVlJStuvvpsJxA6WXoCwSg kI+qvQQ8cuBSSgV34ptbZIQgyw0Y3y+Oq8pUkU18W5+XMTN4FuTebnjOsRNQ6aWv7YzWa6z4GwxvT NusQxHlf6aT0bm9ox7XL8l3Oo94zCnQm9mThsxDpVJJlYrbpJFLRx9wrLStCAwpvY/dbKVPWQYmMX aJryB0MJXYtirbBM6Jboa66iJ3FD7iKew5fuCb/wEPchOSrwFjuv/I9EJgptOa0oJWhSnL5Os0Gwk QD4M1wpogLPQLv2+XHlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWrV6-00BzQl-IX; Tue, 28 Feb 2023 04:22:04 +0000 Received: from mail-mw2nam12on20718.outbound.protection.outlook.com ([2a01:111:f400:fe5a::718] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pWrV3-00BzP4-Fm for linux-arm-kernel@lists.infradead.org; Tue, 28 Feb 2023 04:22:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q3pBlyTOb5bw/BMTomNs6YXpP2wZ8XavqetmTxqOhGsydTepFzfPXqY/OIIutg5xVXOtucHU92LJkfS8h1I3dmSVtoLgZs+5WmIgbK9ZBjmc2LqD6cGhpCC+bnKzi9A+XPejkK25b75hWrIncC2UpRZGywqA++Ul5jMf8gW3/mnL2M8z/CtcNHYqs1PxDzbUzZOypzcqiNfPDnM4ElgyewogZ/yWHP0z8MdITq2a0P+IUo4CiY+gqfqGNH8ehn8iNBzidZjT8XihtVJvspx7SAwfDyETK0t5o+W73tWTgnoAbIaUjjkhN6iCVdcTzAnQQgm+LjvRTrytrc0CjKzroQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GBBkRKzy+PlDDJvhrSn3NLs8rAhPCSzRoj2g9kieCZc=; b=PAS+poi5P4iuS14odCpe+HzXFQcK5jSTo1iDVLO2LOJ8gcFl6SloKdcKRPmC+zXfd8ewuzT6YghhvQcN0g+Ekj4P/PtI1FXRnp7XmxysQkfQwj/idi/KPbLXN5e1ZDlnKPAmh9nSygdA12zGfl/OYKZdulf3VWBtUOuY2JmwsI/yttUR8qkRDf5kB1Hu7gzXoHKRNblGM1ZwBNKroV+0miUpiJ6IsF40746NvVUi704y3x31xqsr8DFTRVLgRKikzyYg6BbvgYGNwb+nzDR1hq3eD7FTVSJkkru61hJXO3PWAepfzdci4fq8aKXwiMzl2hyyP0qxp71XK2qtTCKT/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GBBkRKzy+PlDDJvhrSn3NLs8rAhPCSzRoj2g9kieCZc=; b=ZQcKhOuwtOneC/n00VoEKHy3/5Isga7PLIp7leXNd44likMYywumNnMAS99PPGvG9Gwn3WR768JLWMhM8Ln8KGRQxygDt/2GpxvKSBnooNJ5g9SXXhdpsmrZFpAViBGVYY//lwAZN7QESubsYCf2woVSscadQ/nQpEF3WqMomMg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) by DM6PR01MB4700.prod.exchangelabs.com (2603:10b6:5:65::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.25; Tue, 28 Feb 2023 04:21:52 +0000 Received: from DM8PR01MB6824.prod.exchangelabs.com ([fe80::fc8b:5e5e:a850:7f0a]) by DM8PR01MB6824.prod.exchangelabs.com ([fe80::fc8b:5e5e:a850:7f0a%6]) with mapi id 15.20.6134.029; Tue, 28 Feb 2023 04:21:52 +0000 From: Ganapatrao Kulkarni To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, joro@8bytes.org, bhelgaas@google.com, robin.murphy@arm.com, will@kernel.org Cc: jean-philippe@linaro.org, sathyanarayanan.kuppuswamy@linux.intel.com, darren@os.amperecomputing.com, scott@os.amperecomputing.com, gankulkarni@os.amperecomputing.com Subject: [PATCH v2 0/2] Add support to enable ATS on VFs independently Date: Mon, 27 Feb 2023 20:21:35 -0800 Message-Id: <20230228042137.1941024-1-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.38.1 X-ClientProxiedBy: CH0PR04CA0109.namprd04.prod.outlook.com (2603:10b6:610:75::24) To DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM8PR01MB6824:EE_|DM6PR01MB4700:EE_ X-MS-Office365-Filtering-Correlation-Id: e230a59f-f9d7-487c-3c90-08db19435157 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Flivy6uyTnreryHlem3s0F2ASsXlBFBaIa6Zw5aF0PYxDB6Fi9FjzxZJZJyHgod3CVgHMDERUdUF7Sy4DdikQEufZ8/8MyXW//qXtJSXndB5LXhZncrG+iXbrP/6ie8YvnZFYkxaCQP95dsN7uuZ+3XncIGjSAoOgBykPogjxq+IhwOiE4IBvFudP16TzjnL2mpl6cI1sGdWWt5kdp9sizlwEbzblPhV19PNAMmS+usPbsYzf7VoCAC7Ehp247fdcuf2UIHJpOHK8OEYWgk0BR/bvpaa20MPj2uCyFDVnR2di6L7CKKSxNDNb+3dJT4KlBf4lp4A2tZloXJlAkAROPGGYz4+Ioy6GFZ8AzoDxClXLulDQzKviQ2lpCRKhR6nwa29hEPV9ACFFz7eF6T8lPopE1YoohuW+g6yUzVPexXzl+0lRDkf9vH/jHaSBvEsceFlU7YdAbzPXQ42IwOyfSvVC+t2yehWZzptv+f8dz5cx6ywGJRo1aretvTa/dX8tHJ/fRM48UCTj9iDnPmLdFqMLg1i+DaI5aaYQGAjiJ0cVsMoM0JhUZ561BakVBCkmMlDEMLQHpJ0BdQs9bVJOcPbNuS4uu/O0ql0QMipn6HpCZ1qKQyjoLUviA87cDQsUdGZ4PwxHdDgyKQEY33kQNq4pBGvov8ow3tYpBvLaqap5ik6g/LxjXK5VMIsqdd5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR01MB6824.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(366004)(39850400004)(396003)(376002)(136003)(451199018)(966005)(86362001)(316002)(6486002)(186003)(4744005)(8676002)(7416002)(66946007)(41300700001)(66556008)(6512007)(4326008)(8936002)(478600001)(1076003)(2616005)(6666004)(26005)(5660300002)(107886003)(6506007)(66476007)(52116002)(38350700002)(2906002)(38100700002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bILgfdYN4pZGJKsfBlwL/uBqUP9YFDRgymHCTxvB4RXhK/sGwdA4KDhchjscMAthKEVIJXYsPXlEfHhReU6giW1VNUF/7yqATwI+2IIq9a9jZ5fVTqgwdY9peBTh8E64QGkGsbUY+4hynYiZHeBict0St87I7veTsWEy1GFzIsBPqhLBnpeDe5aOq9niCJOaTN9yUk9NAmFwBC9nRcajSS3lpX03TOXNzcu/tChvYYKh55kqqxyi03xgxA8ECQCKHSNqB3A98Rmu8u3GswjLOhI3jv8lNYUGDY1GCsa1B3q2ZS0yxfUpIhGf1BMo563APIwikfvqVmq6sQnjWFejg5689P/Tn4N5y20WudTcXqhB/oWJyGKVSUJ98UDw4iPE7hbdiye3bx4qni/pzgDMoU9E+9gOPLdikmV0ota+URR57EMZuSU3AicCyTnoDAQtnIIlobC9VPfCLVU8THtAJJFCx0q7Fam+FCOnEW85beNMqHmrvzhGwaaQLSwF+i7XsQ7zCrnzYV78V2yGI8xA/itsETg+nXFPvENHjWdjAdMcqSRTwJcFP4WXq9z+AdpLSeap2Xe3eFhnXELkK+X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Tenant-Network-Message-Id: e230a59f-f9d7-487c-3c90-08db19435157 X-MS-Exchange-CrossTenant-AuthSource: DM8PR01MB6824.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2023 04:21:52.4825 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GpYfIAlbMtfnJ4BQGJIZBfBTGX3DEViKHUIp9HRjwsT+3do7MEK+y0qgh4S9Tze00dWN6dNSlY0En8xq4WXS2rW2Rl7JcojY+f+p88MRe6JydRH4Pfn9ECcpaJnzO5zC X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB4700 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230227_202201_754272_7B836F96 X-CRM114-Status: UNSURE ( 8.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As discussed in [1], adding a helper function to configure the STU of an ATS capability. Function pci_ats_stu_configure() can be called to program the STU while enumerating the PF, to support scenarios like PF is not enabled with ATS, whereas VFs can enable it. In SMMU-V3 driver, calling pci_ats_stu_configure() to confgiure the STU while enumerating a PF in passthrough mode. [1] https://lore.kernel.org/linux-arm-kernel/20230221154624.GA3701506@bhelgaas/T/ v2: - Added dummy definition for pci_ats_stu_configure. - Changed STU configure to read modify write. Ganapatrao Kulkarni (2): PCI/ATS: Add a helper function to configure ATS STU of a PF. iommu/arm-smmu-v3: Configure STU of a PF if ATS is not enabled. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 25 +++++++++++++++- drivers/pci/ats.c | 33 +++++++++++++++++++-- include/linux/pci-ats.h | 3 ++ 3 files changed, 58 insertions(+), 3 deletions(-)