Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932135AbdCFMGc (ORCPT ); Mon, 6 Mar 2017 07:06:32 -0500 Received: from mail-sn1nam02on0075.outbound.protection.outlook.com ([104.47.36.75]:30551 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932079AbdCFMGW (ORCPT ); Mon, 6 Mar 2017 07:06:22 -0500 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Subject: Re: [PATCH 1/5] PCI: add resizeable BAR infrastructure v2 To: , , , , References: <1488800428-2854-1-git-send-email-deathsimple@vodafone.de> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Mon, 6 Mar 2017 12:50:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1488800428-2854-1-git-send-email-deathsimple@vodafone.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [2a02:908:1251:7981:3c93:f909:1459:48ad] X-ClientProxiedBy: AM4PR0802CA0015.eurprd08.prod.outlook.com (10.172.214.25) To CY4PR12MB1301.namprd12.prod.outlook.com (10.168.168.138) X-MS-Office365-Filtering-Correlation-Id: edebe610-4146-4626-01d9-08d46486f7fb X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:CY4PR12MB1301; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1301;3:Bg7vTyPKqBOkl7JWUx6bjuqwO+Kb+54eeBM8NLI4wixtuNaVgrmbr0CRHw1UybJN5i6iOLwB3VfyttlmUuIlMOGGCCcLhl5xhqDQXACvdKX/G6vuPG3d+3OjntiFYM73TVSQ2VHUHPhu/9XAMOnhQmmne5tBhDmuso1QrzLm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Lf1863fWu6XurnhJXMibJd81S69VSCnmnRsftwv5oYWBFUEwKIvRzMrFn9j8aVl0T4CzANpSkVhW8MnNRdHMvG6Cy5J43Ulbp9sNcbhnIM2j8vNF1DcVJQNL34JLJkeGuE2+GRJ816YTkAOObeCyOmwmvUOpVv/xvpquoU64Nmdv89JMhsY4T7fQg7sez4y9Jcr+O5ZOVsZErYACuvA00DPvI594U7U3RqtUB5jKTXzbdwvrFBrukKO+xBWEW4+kx+Q1/95wmynxdt1iBB4K5A/VRMPy/u00N8rTmHICkZbJxw210xo8nUX1oprhotiXzc8gyWFT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123558025)(20161123562025)(6072148);SRVR:CY4PR12MB1301;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1301; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1301;4:XlXZ8b89G8wtdIHEOebrVMsNMi/vyXuKLThGVNXT2Cqe6NJ/693pv0AEficVg1bTFRLf/3kq2XqV8pwVUIOkJAyyFrYqQzJktnoQKnrZumO/j302dMmo9pMAB+PmW03kNiUvZ/Vv6lNUTBN1tloSjcFNMU7TL6QNzUrUdng1gIMLVw5FWahk3NvZ7kXwTz78BhPZzMyAynedtoK9woMWz6OTi/YIKOS/Sje+bZRiwy1KkJM88+DfWDJNrpXDKIx+Ug4b2vB2v6Z7CC8KAi0UEIobI2JHMmSb8dLTSE8ot8nKvJPGw8hlC+GzGxB6GTjBuhabvFHvs1hjI/7XWSocw/awi+ZOH9R1+6WF9jcZQZ4VqXng4FFUU0vkkEwoT1bydAcEWzaHqCCNCHWBsCoAaEpU5ktN6DZWRhAmi9MKq/bGr63SiWNnoMIRx0vigUz3DR7wEk010rCipuCT6kZ/ZjWkjiuBUJzX1It8S96g4dNYdp1fHpCHZ0FZGWWd5ynfiKQA3zqQWVF37iTLCAxXxy8+88qJEXkGy2ZTMqvmT6zO5RFv6ToSRAUfXiiAgPU6iyEchKf20EUUtsY7tCjorX9Oul+QK1wb1007FbF9U910zCrqE8LJ27VfGouqUNSu8uqdomML/06Kl3NiM218y6g0IKoaU9ie5lIBehOj42E= X-Forefront-PRVS: 0238AEEDB0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(39860400002)(39850400002)(81166006)(65956001)(76176999)(8676002)(2201001)(54356999)(305945005)(50986999)(53936002)(189998001)(31696002)(86362001)(7736002)(36756003)(6246003)(38730400002)(4001350100001)(42186005)(83506001)(6306002)(23676002)(6666003)(5660300001)(6486002)(47776003)(2950100002)(65806001)(2906002)(229853002)(2870700001)(92566002)(25786008)(33646002)(6116002)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1301;H:[IPv6:2a02:908:1251:7981:3c93:f909:1459:48ad];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMzAxOzIzOjR4b0RSeFR0S0dsbTJseUJoYmxYeGZZR2dG?= =?utf-8?B?MzJ2MDUzL0RVZy90S3NLMVlQMXAwYWI0MWMrOVJ4eXV1SUpubTIxZGtSTkRM?= =?utf-8?B?Q3pKLzlmckFIUFVvZ09HSTkyelRZNzNYdmVXT2UySjFRM3MvNmlqdXBqdTJs?= =?utf-8?B?b2VXZFUyME5DS3VWMjdVeEtGTDY3NUF1bk5qMjR3QXFadjN6dUFiU1dXN2tk?= =?utf-8?B?QVpnMG1zNzB1U2FDamtqRUl0S29xd2VMQ2J6SDR5S0ZTRHNubmRMTzA1bXZ5?= =?utf-8?B?K3JsY3VCYlJPa00wdUNnYUFLRUI2aktaMC9KZ1B5NFI0SUtJenpJZmtDdWsx?= =?utf-8?B?U3VRbWF6clg5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 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1301;7:EbnAIG4jM4vaiaAtt/RZCwX4VYcZ2HKO+LNcxTKFsEGl7im1t5QMtDrZi0mPdLwXmAKJopAFpnjCX/y6H8CjU3PSEUEBHNPNPJ9WEM1tKCpK7lmRZnZcm43N5HZEXg2T568M0HH5UEseqx05cWY6qkdQm/LhUHaO1JqqkxPC9PWBBY2eSVRuuz5J25H836ZNVEDXAOJI59f7luhEVBbKfSftTDDGgn3EKCtWxczGcSbdr9HjSy49nE6ujbWfGC5TVyS+Mha7x6FZfuFsdzGPlJC3O0i07eGcYb4eUUf2zkKpCS9uj4JNTptSy4+jP3J9uYCABYHZsyyn4SlHJ+3jfw==;20:jAPbpL0ti/RxZH9y6geOuzRzq3OKQ1H/INQL4YgAIx6YkaTxkKnmV+pTv4tdgbcHtL0W2vcYoDWdxiMfM4VcoDISEsjGI/aijkZjL7QBMj1XuAAncmeGtSc61TidR9HORkeG7Y7B9jxk8fStVfMTmKo6VRzcO5yWyvNNW9o8x+ypNtwxx0QD/ByRsIJ/CRnDy0cRtnQcKJhLfn+gClXT1OKP1i0IDaFGn6TG/3ufRk9MVNv6rlqEdWjadXDUMkdJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2017 11:50:20.4161 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1301 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6751 Lines: 204 Sorry I've hit enter to soon. This set of patches tries to implement support for resizeable BARs including an example of how the AMD GFX device driver can make use of it to gain full CPU access to the VRAM on the hardware. Patch #1 is just the second version of the basic RBAR support I've send out more than a year ago. Patch #2 adds functionality to resize a single resource of a device by only touching parts of the PCIe tree which we can be sure are save to modify. Patch #3 adds a quirk for AMD Kaveri/Kabini APUs which adds another 64GB BAR on bootup to make sure we have enough address space assigned to the root hub. Patch #4 & #5 then uses the new functionality to resize the BAR of recent AMD GPUs to allow the CPU full access to the memory behind it. Please comment and review. Thanks, Christian. Am 06.03.2017 um 12:40 schrieb Christian König: > From: Christian König > > Just the defines and helper functions to read the possible sizes of a BAR and > update it's size. > > See https://pcisig.com/sites/default/files/specification_documents/ECN_Resizable-BAR_24Apr2008.pdf. > > v2: provide read helper as well > > Signed-off-by: Christian König > --- > drivers/pci/pci.c | 115 ++++++++++++++++++++++++++++++++++++++++++ > include/linux/pci.h | 3 ++ > include/uapi/linux/pci_regs.h | 7 +++ > 3 files changed, 125 insertions(+) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index ba34907..9658aa7 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -2944,6 +2944,121 @@ bool pci_acs_path_enabled(struct pci_dev *start, > } > > /** > + * pci_rbar_get_sizes - get possible sizes for BAR > + * @dev: PCI device > + * @bar: BAR to query > + * > + * Get the possible sizes of a resizeable BAR as bitmask defined in the spec > + * (bit 0=1MB, bit 19=512GB). Returns 0 if BAR isn't resizeable. > + */ > +u32 pci_rbar_get_sizes(struct pci_dev *pdev, int bar) > +{ > + int pos, nbars; > + u32 ctrl, cap; > + int i; > + > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); > + if (!pos) > + return 0x0; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT; > + > + for (i = 0; i < nbars; ++i, pos += 8) { > + int bar_idx; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + bar_idx = (ctrl & PCI_REBAR_CTRL_BAR_IDX_MASK) >> > + PCI_REBAR_CTRL_BAR_IDX_SHIFT; > + if (bar_idx != bar) > + continue; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); > + return (cap & PCI_REBAR_CTRL_SIZES_MASK) >> > + PCI_REBAR_CTRL_SIZES_SHIFT; > + } > + > + return 0x0; > +} > + > +/** > + * pci_rbar_get_size - get the current size of a BAR > + * @dev: PCI device > + * @bar: BAR to set size to > + * > + * Read the size of a BAR from the resizeable BAR config. > + * Returns size if found or negativ error code. > + */ > +int pci_rbar_get_size(struct pci_dev *pdev, int bar) > +{ > + int pos, nbars; > + u32 ctrl; > + int i; > + > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); > + if (!pos) > + return -ENOTSUPP; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT; > + > + for (i = 0; i < nbars; ++i, pos += 8) { > + int bar_idx; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + bar_idx = (ctrl & PCI_REBAR_CTRL_BAR_IDX_MASK) >> > + PCI_REBAR_CTRL_BAR_IDX_SHIFT; > + if (bar_idx != bar) > + continue; > + > + return (ctrl & PCI_REBAR_CTRL_BAR_SIZE_MASK) >> > + PCI_REBAR_CTRL_BAR_SIZE_SHIFT; > + } > + > + return -ENOENT; > +} > + > +/** > + * pci_rbar_set_size - set a new size for a BAR > + * @dev: PCI device > + * @bar: BAR to set size to > + * @size: new size as defined in the spec. > + * > + * Set the new size of a BAR as defined in the spec (0=1MB, 19=512GB). > + * Returns true if resizing was successful, false otherwise. > + */ > +bool pci_rbar_set_size(struct pci_dev *pdev, int bar, int size) > +{ > + int pos, nbars; > + u32 ctrl; > + int i; > + > + pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_REBAR); > + if (!pos) > + return false; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + nbars = (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIFT; > + > + for (i = 0; i < nbars; ++i, pos += 8) { > + int bar_idx; > + > + pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); > + bar_idx = (ctrl & PCI_REBAR_CTRL_BAR_IDX_MASK) >> > + PCI_REBAR_CTRL_BAR_IDX_SHIFT; > + if (bar_idx != bar) > + continue; > + > + ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE_MASK; > + ctrl |= size << PCI_REBAR_CTRL_BAR_SIZE_SHIFT; > + pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); > + return true; > + } > + > + return false; > +} > + > +/** > * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge > * @dev: the PCI device > * @pin: the INTx pin (1=INTA, 2=INTB, 3=INTC, 4=INTD) > diff --git a/include/linux/pci.h b/include/linux/pci.h > index a38772a..9f26ca4 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1946,6 +1946,9 @@ void pci_request_acs(void); > bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); > bool pci_acs_path_enabled(struct pci_dev *start, > struct pci_dev *end, u16 acs_flags); > +u32 pci_rbar_get_sizes(struct pci_dev *pdev, int bar); > +int pci_rbar_get_size(struct pci_dev *pdev, int bar); > +bool pci_rbar_set_size(struct pci_dev *pdev, int bar, int size); > > #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ > #define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT) > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h > index e5a2e68..6de29d6 100644 > --- a/include/uapi/linux/pci_regs.h > +++ b/include/uapi/linux/pci_regs.h > @@ -932,9 +932,16 @@ > #define PCI_SATA_SIZEOF_LONG 16 > > /* Resizable BARs */ > +#define PCI_REBAR_CAP 4 /* capability register */ > +#define PCI_REBAR_CTRL_SIZES_MASK (0xFFFFF << 4) /* mask for sizes */ > +#define PCI_REBAR_CTRL_SIZES_SHIFT 4 /* shift for sizes */ > #define PCI_REBAR_CTRL 8 /* control register */ > +#define PCI_REBAR_CTRL_BAR_IDX_MASK (7 << 0) /* mask for bar index */ > +#define PCI_REBAR_CTRL_BAR_IDX_SHIFT 0 /* shift for bar index */ > #define PCI_REBAR_CTRL_NBAR_MASK (7 << 5) /* mask for # bars */ > #define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # bars */ > +#define PCI_REBAR_CTRL_BAR_SIZE_MASK (0x1F << 8) /* mask for bar size */ > +#define PCI_REBAR_CTRL_BAR_SIZE_SHIFT 8 /* shift for bar size */ > > /* Dynamic Power Allocation */ > #define PCI_DPA_CAP 4 /* capability register */