Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4318251ybi; Mon, 27 May 2019 15:57:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOUQRbe+E0j7r++xZGqSNLTWp4gnzDX2F0xB8hUsF32mmgiRxq5Jh3cTBjcSjoNiUx/Rvq X-Received: by 2002:a17:90a:22d0:: with SMTP id s74mr1300206pjc.3.1558997850730; Mon, 27 May 2019 15:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558997850; cv=none; d=google.com; s=arc-20160816; b=OyHh81xKVFaYJMAXNPLEUQl7XhfXVoxgho87tQ50dH/ZaetQszWu6Z2LUZsB4xsu4M sq0FKsLBCAlVP0xfKEwJiDZrVkCqLOuBBfkGR+tGjpqgAry5DTANPDvkozyG2cJPiDnu hWd819q3T9I1gOWS+KhzdXzw+BfCmTtsCHXF+fA/NqEALxMInYXBDICvqfvK0pSwVK1t 6iVA1kO/1RgD9SOZ4JaklhHuYm3cuuC5Pp+iTntnQyVPAHrx9lyWf7Yvv3+TeMLNtXD6 7kW/piszjkYiLHlUTCpW9b26ORJT3LpZkmgKBx4WJxqkH7l5JqnZOYMzBypFhiRe69wj OmvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3zuMlI6Bs/aP1oyJY+RmQVzEM1PNWkyrrD/xpVdXskQ=; b=d/TJge2YrCdSDbNejjRaL/vJcgUnDqzUG/N+HBqPIt/3mKSfTdkYYx/Oz9I3/5tBnE BgVzNnEFOToRh5dnPwQ4PsuDotKjfgIS3NwkimvxZVqeP3n4uvMnA0nICDTQpitCegug +D5dBfum+iHSVT2ja84z+EkYPqCiH8BHZ/qE5fdfsKaETGRWHWKfXI205NtNtSUwmpbV Df9N01YbQkJRhg5mGbl1YVsenFOVyYoygQqD4L7szPVT3NHi1hmc2BCYBR5+S2lpoKNK rG5z+cMu+gRgTzsUloiGE3CXCsBBhd60q5QunfGc+7TRGQ5EKl/1fDbFK0FtbggeP0rY BiZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@anastas.io header.s=mail header.b=KYnxCoTK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=anastas.io Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si19898967pfa.206.2019.05.27.15.57.15; Mon, 27 May 2019 15:57:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@anastas.io header.s=mail header.b=KYnxCoTK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=anastas.io Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbfE0Wz3 (ORCPT + 99 others); Mon, 27 May 2019 18:55:29 -0400 Received: from alpha.anastas.io ([104.248.188.109]:50915 "EHLO alpha.anastas.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbfE0Wz3 (ORCPT ); Mon, 27 May 2019 18:55:29 -0400 Received: from authenticated-user (alpha.anastas.io [104.248.188.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alpha.anastas.io (Postfix) with ESMTPSA id A62387F8EF; Mon, 27 May 2019 17:55:27 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=anastas.io; s=mail; t=1558997728; bh=Fkmg//rw0SZv0cbWNfledPODm9FWrb76L5Rv9PgTLBY=; h=From:To:Cc:Subject:Date:From; b=KYnxCoTKhTuTLyhPQ9l7D0X2LQ1u9/v9EF6WIjyAIkGsxZapfKdJfCpKuzldE9/tV 4R3gruWPlNmAWyW2HDhIwadCiXQ8ZuZWcEHfZ2O0Eu0FC5/1CMb72muXchdDkApBTn +dSD3EsJxF/uk8LU8FNzBOKp03olHpsMHRbNEBbRjWuhXAnxKa/XH1g88+woGtTm2K i2BEWoeceJ/18T8pi9UBuSzYOP52bNSlukwMM6N35d5PV5+5Xw4hnPAnfYT1t3TfSv BdPyDgZ3Qe/Wf3VRiIuZc8RHmxNUN78giREcHNxNCyogASoHwzMugE37WnzBnq7c+X mcEW2jKASskmA== From: Shawn Anastasio To: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: bhelgaas@google.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, sbobroff@linux.ibm.com, xyjxie@linux.vnet.ibm.com, rppt@linux.ibm.com, linux-kernel@vger.kernel.org Subject: [RESEND PATCH 0/3] Allow custom PCI resource alignment on pseries Date: Mon, 27 May 2019 17:55:18 -0500 Message-Id: <20190527225521.5884-1-shawn@anastas.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello all, This patch set implements support for user-specified PCI resource alignment on the pseries platform for hotplugged PCI devices. Currently on pseries, PCI resource alignments specified with the pci=resource_alignment commandline argument are ignored, since the firmware is in charge of managing the PCI resources. In the case of hotplugged devices, though, the kernel is in charge of configuring the resources and should obey alignment requirements. The current behavior of ignoring the alignment for hotplugged devices results in sub-page BARs landing between page boundaries and becoming un-mappable from userspace via the VFIO framework. This issue was observed on a pseries KVM guest with hotplugged ivshmem devices. With these changes, users can specify an appropriate pci=resource_alignment argument on boot for devices they wish to use with VFIO. In the future, this could be extended to provide page-aligned resources by default for hotplugged devices, similar to what is done on powernv by commit 382746376993 ("powerpc/powernv: Override pcibios_default_alignment() to force PCI devices to be page aligned"). Feedback is appreciated. Thanks, Shawn Shawn Anastasio (3): PCI: Introduce pcibios_ignore_alignment_request powerpc/64: Enable pcibios_after_init hook on ppc64 powerpc/pseries: Allow user-specified PCI resource alignment after init arch/powerpc/include/asm/machdep.h | 6 ++++-- arch/powerpc/kernel/pci-common.c | 9 +++++++++ arch/powerpc/kernel/pci_64.c | 4 ++++ arch/powerpc/platforms/pseries/setup.c | 22 ++++++++++++++++++++++ drivers/pci/pci.c | 9 +++++++-- 5 files changed, 46 insertions(+), 4 deletions(-) -- 2.20.1