From patchwork Thu Oct 10 10:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 13829903 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A7BE1C0DC5; Thu, 10 Oct 2024 10:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.16 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728556341; cv=fail; b=Pj9C+i4PTqCPS5L0qBs/vZjVx86q2hW4p9D++KqVoaTunawgiK4EpyLAGP67stmpb1/ptpMoGS1VZYJaNB1SpDR0yhXGH24eIWzRRxigfcqqJnUkM4EXlr9ClRMefXOvonVAH0aIPnmnCxbrRoUs3dorBW8Cbc0GW2PKyF97lOs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728556341; c=relaxed/simple; bh=k6FuSgJWVlJs5J+Zi67ZM/VutGM78ik5XQLGqbORcgA=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=JspWvAlrOCX4F5MovA6jX72IW2s6+iboqrlhrzb9FPMwfB+8rQM8yrh/jdCvvA0ukpOlhTt9eNU3j6gE0ykvXqfE0UpGppBmdnUd0WWqoXPAwkHih1WZu1Lf6PM6lAHadi4M7hWQh8bmamf539hPUPwwUwA7bOh1sE9qq2oU0yM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Lki1WKg4; arc=fail smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Lki1WKg4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728556339; x=1760092339; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=k6FuSgJWVlJs5J+Zi67ZM/VutGM78ik5XQLGqbORcgA=; b=Lki1WKg4YbAxOxAAxOb+HFT7vjmzJvBHFAiZcZmtWI0dz8jPlBucqKMO gmn4oHqlBnliPvhs3R063AWGiFigfHZVX3bJjJNxEFpFtI1mtuo5/zDqU QzPieBRPh7RtgtJ5vocJuEvQec+VZ5s0Kpzez7jgALFzOvnz1eZ6zK9WH BNpOfqgNqcOlfHZncc1OzKShP3qrzIYB1Vgh2bOBtK7xr+UVEOc8AjDnF T+VQW0hyIqj4JjFp5TrcoZ0AUZRYvDX5xgUfdAqrPakJAPKvrGY4CsGd4 oSlGUROErPJlYXIyioX4dGt0tSIGIpi5I17EC2Trbykv0PodkoTRR15Np w==; X-CSE-ConnectionGUID: 1pcz+KzPQWeE2jYl/q5fwg== X-CSE-MsgGUID: F1C1KDYyRACwyi1R4WGkuw== X-IronPort-AV: E=McAfee;i="6700,10204,11220"; a="15528398" X-IronPort-AV: E=Sophos;i="6.11,192,1725346800"; d="scan'208";a="15528398" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2024 03:32:15 -0700 X-CSE-ConnectionGUID: +3KnJhDtTaO3E7zouqqKhA== X-CSE-MsgGUID: D6QkxObdS4GiQZ4UU+/BBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,192,1725346800"; d="scan'208";a="76464891" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa010.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Oct 2024 03:32:15 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 10 Oct 2024 03:32:14 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 10 Oct 2024 03:32:13 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.46) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 10 Oct 2024 03:32:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MDfEkx+KNivMn7VT8cy43oycw3urHabRJvHHjIqHQZcFWXWOB/+qZvXp8TpJd6pwuH8qHdmUYyPqdKAFvnodTWO0OO9aqt3fssGc4cXQ1baCQh5ki/em6yEru5I5bIhUYYFdYy7W497bqtlYYkEbVLB2zkZydJBYZac2Pc78NWsyP6g8L/QVlC7WwqMkruZWrJLXpCiZThjzNENMFycMmBUfAi0akN62yBFy6jHyyKUXV8wt/HvxVSJ024JFmVYhe2o4QTSwqLcAX716Pre8N88f6EnANJZ4c1ded8LA8TCEoBnCGl1wwQO0j9bwDv3cziUwCTLgBo8y3CX12FMSLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kDvImW3k0R7R4nAXhPF9Yp/GPKvJHSPSpaJ+oYpQBRw=; b=Ino5gc9mda++ZDMXk4j7suGdpveyNTf8l7k6ZbOKDjX25/GJRMCKPruAbt2k7G5P5SBD85AMsOCBXdkn4sGAzPUdpo7hCvu7PmcxyLAZ+VcAWp198z9tSzgcL+Vub8ylFsL70eXNim269pn/3qvEvKdYb9ukaUExqbAmh/jRD3B6GsILYl/Nr7/2cye/w0hQXBPz6ELd6/eFUK1kyA4oOt6vZ4A+oVHEp63Mh400ebFnhSIUUFmdhYTQlos0Tm/jxOahtVoygS+27/WTH6Rqqvt2MEnzOrdGU/E+fzs9cMNneWZkCsmuwd3lDR9UKgnLo0AK9mMUsv7hE8m5WbfYKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MN6PR11MB8103.namprd11.prod.outlook.com (2603:10b6:208:473::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Thu, 10 Oct 2024 10:32:11 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::927a:9c08:26f7:5b39%5]) with mapi id 15.20.8048.013; Thu, 10 Oct 2024 10:32:10 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: , , , , "Bjorn Helgaas" , =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , =?utf-8?q?Ilpo_J=C3=A4rvi?= =?utf-8?q?nen?= CC: Rodrigo Vivi , Michal Wajdeczko , Lucas De Marchi , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Matt Roper , =?utf-8?q?Micha=C5=82_Winiarski?= Subject: [PATCH v3 0/5] PCI: VF resizable BAR Date: Thu, 10 Oct 2024 12:31:58 +0200 Message-ID: <20241010103203.382898-1-michal.winiarski@intel.com> X-Mailer: git-send-email 2.47.0 X-ClientProxiedBy: MI1P293CA0005.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:2::12) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5373:EE_|MN6PR11MB8103:EE_ X-MS-Office365-Filtering-Correlation-Id: 0acfb7d7-f78a-4ace-c0e0-08dce916cc4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?FcBOvli3OMv6PLzKybwiccUPQEmerTI?= =?utf-8?q?jgMlOPys75PCeVKGUmnEnXF3WgSrkV5ssA1nWvWDSnK34iJM9tqbblJ1YzrVy8Q+2?= =?utf-8?q?yMVzE7B7HEbWJMRFGe8mPA0s5dY2JkD0luQMs2LkK9REXqzIb9W7x5wuSoLCsgJpW?= =?utf-8?q?aHBOmch98LXmSDR0W6Mpmz+Bd+1MO6VsMAxGEc04K10s4+JxIxwlY1Io+FKWNE7xX?= =?utf-8?q?ZTnBlkl1RYOdGRX2sSN537QC2371nEjsd6O0nAgLsWsVNnc/tG46cUND4kZOfGwUA?= =?utf-8?q?7O5BRoKV3LyoN02WSrnK8UZTqt+ZQI0ESPeTHupFBzMnR6smZlWcikYZ6AhwbVT9S?= =?utf-8?q?xz/u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2JQ4u41FbB45V7aWcXbVZB+31mUvlGWDCA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB5373.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Q0kVkoIU6dACrNIagp2hjNj4pg92?= =?utf-8?q?Dv1wkG6GTpkUmKh++vXeP+EYXAcw2ME+jVFIHxmvfTUs2Ix8rmdDwpYXVu4yCiZ6x?= =?utf-8?q?lo1Y9S/h8ImLdhZwSRQgjt9ikKmIb1znIwKqXstfA+aZOuQLnw8SpOKfZFDgVYDEB?= =?utf-8?q?Z5S9EvH5byROl0W7OFFzl2HbSYXd93VQ1Ejbka92QvLtk90+ziqB7TmexVNvyR0DM?= =?utf-8?q?zgo2H7TK9JxQC6ysp7b2euu/eUWSy8202DS0HpA/VyCzFaed6Wp5i83nl0QxH1nJ3?= =?utf-8?q?ei/M7xNctLuc51QpbT+Fp+AAoLjxIDUm8Ny5XxZ7+5AKY2e5csnuYE0LG5mMjMQxd?= =?utf-8?q?2ivCpB1sQ7BtnBB2Wd3HU2i171mL10fxPnIjz6Ids2H/OntZsoEKmoyOVbQSwzoi4?= =?utf-8?q?vIthq0LrMz+JVoiBdoL61GmxLVgGXlRZ37eewqCeDxJBSm0sfi3XGyrcl3XkaM11z?= =?utf-8?q?4j7EQGgaFPO4uadW5GtLR68lwsBanhNQD8fxyghRg4y4WKmt25LiWdIFu9XKTde6P?= =?utf-8?q?INvYApLXc7vHfTDm+xz+52dXXcR+Ii1EAfpPoYOsyHlJLXJFf5Gbn9NHKBxOL90jy?= =?utf-8?q?imha8Fyw2ZayeXeN31TEkqHnzwP//vVQNivWN+Cwg2lkSDsLh1fZyI3DSeUcLjn8W?= =?utf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A8pv1gZKz/OgkL4oUAM+ekiZQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0acfb7d7-f78a-4ace-c0e0-08dce916cc4f X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 10:32:10.7268 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Sizvt1wMGAIaDkYoX73Xa71JbtdcqdK3A/Uu8v918ebvSdq/XN4Gh/28l0s3kaYhAvwOTR8tmvckDO4gXfS2FN1spLtGwYWuTqChP5SfqRI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR11MB8103 X-OriginatorOrg: intel.com Hi, Resurrecting an old series [1], now that we have an in-tree user for it. For regular BAR, drivers can use pci_resize_resource to resize it to the desired size provided that it is supported by the hardware, which the driver can query using pci_rebar_get_possible_sizes. This series expands the API to work with IOV BAR as well. It also adds the additional API to allow extending the VF BAR within the original resource boundary. Thanks, -Michał [1] https://lore.kernel.org/all/20211215141626.3090807-1-michal.winiarski@intel.com/ v1 -> v2: - Add pci_iov_resource_extend() and usage in Xe driver - Reduce the number of ifdefs (Christian) - Drop patch 2/2 from v1 (Christian) - Add a helper to avoid upsetting static analysis tools (Krzysztof) v2 -> v3: - Extract introducing pci_resource_is_iov to separate commit and use it elsewhere in PCI subsystem (Christian) - Extract restoring VF rebar state to separate commit (Christian) - Reorganize memory decoding check (Christian) - Don't use dev_WARN (Ilpo) - Fix build without CONFIG_PCI_IOV (CI) Michał Winiarski (5): PCI/IOV: Restore VF resizable BAR state after reset PCI: Add a helper to identify IOV resources PCI: Allow IOV resources to be resized in pci_resize_resource PCI/IOV: Allow extending VF BAR within original resource boundary drm/xe/pf: Extend the VF LMEM BAR drivers/gpu/drm/xe/regs/xe_bars.h | 1 + drivers/gpu/drm/xe/xe_sriov_pf.c | 8 ++ drivers/pci/iov.c | 141 +++++++++++++++++++++++++++++- drivers/pci/pci.c | 9 +- drivers/pci/pci.h | 27 +++++- drivers/pci/setup-bus.c | 5 +- drivers/pci/setup-res.c | 37 ++++++-- include/linux/pci.h | 3 + include/uapi/linux/pci_regs.h | 1 + 9 files changed, 213 insertions(+), 19 deletions(-)