From patchwork Tue Jan 7 00:56:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 307499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 60BE92C0096 for ; Tue, 7 Jan 2014 11:57:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756752AbaAGA4v (ORCPT ); Mon, 6 Jan 2014 19:56:51 -0500 Received: from mail-ie0-f169.google.com ([209.85.223.169]:37224 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757925AbaAGA4r (ORCPT ); Mon, 6 Jan 2014 19:56:47 -0500 Received: by mail-ie0-f169.google.com with SMTP id e14so19748243iej.28 for ; Mon, 06 Jan 2014 16:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=fZhgRc3iv2Wi0Yy2YZ7TY7coieixutyar4xDQA/Mpg0=; b=CCjb4nfno92bIAEwJt8koWWTJFjpsbt9tChnFWrajtlj2Clg+BV9Y155GOGvzCJ2sK lai99EvAwYKJsrf038wGAh/TE+jYllNwc6HiZba+CWa0zwU0zOKdRy2RONWbtU242t4f g0X2IQcDTBtKHn6PCwXSvtlwAEvgymOzsrHGx9lR1Jto4t4RxX9juqF/kh3pvTEe5NrK l0RTVRv8GOcV7ZiK4p6eVYauaZnhVFkAs2Vqv+cb+bMQ6JnOJmvnkbx2hn7OnyAAuDW5 pVjAjBAZUt7jrQoXhra0tYTkvvjLNAr/zjeqkJkRg0x7npYnZ8UAUwqT0gKgtUvebhRv Yr5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=fZhgRc3iv2Wi0Yy2YZ7TY7coieixutyar4xDQA/Mpg0=; b=NSnQu0Xts0MM0icg8fxUOa48Vrw4opAlSoYaR3oucyagtiob+bv1i8wk+A8W38ozPO 9j0inkq15JG35lFy7K1RUaA3NW4zhuE7cGEhWd8NwwO6GWaLvV1xi0lUmsp7wkrHEcy6 TwiwBJ1skzQ65uqBdNTD18R/bhbO73M5sesw+aoXVmbms07MSNrsDbM80tNuRqXxSZDV R4SaqZjf0oPuE8N4gZI8hECOltY3ERcpfySg/q9leNiO12ZpRCdRybNpgY3yFiu8/xbU u1nFPrQDBXWnQDHB/lKoUTpLNtj85ixTuNs1VrpVGWgojCyf+On+PnUdYi9gsJWoK5Qb NxAg== X-Gm-Message-State: ALoCoQnV0wdf7CPimUfONYLv1kCsJ2Hor0ZC/z6J28JvWmcpm8zrr4fQ2Y8j/NJGlMNhCkFSJZVurg3mfsF0ols8BdtTdYkGf8r3QNxpbbe6pytzfDQCOoq7IdVTekP6u7iZYjmly3vE8dL8XrA0ELu9mHQ+TueceYed53Xwp23iwzPPOYESbsBppS7ZIPgslVaLcYpY5kWHHBMPDJaJGja3VHnTkcJTgUPDSuJqfJ5VstFLJabb5gc= X-Received: by 10.43.19.66 with SMTP id qj2mr53121719icb.31.1389056206373; Mon, 06 Jan 2014 16:56:46 -0800 (PST) Received: from localhost ([172.29.127.26]) by mx.google.com with ESMTPSA id gc2sm903845igd.6.2014.01.06.16.56.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 16:56:45 -0800 (PST) Subject: [PATCH v7 13/15] PCI: Split out bridge window override of minimum allocation address To: linux-pci@vger.kernel.org, Daniel Vetter From: Bjorn Helgaas Cc: David Airlie , Yinghai Lu , Guo Chao , linux-kernel@vger.kernel.org Date: Mon, 06 Jan 2014 17:56:44 -0700 Message-ID: <20140107005644.10786.41340.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20140107005003.10786.85164.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20140107005003.10786.85164.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org pci_bus_alloc_resource() avoids allocating space below the "min" supplied by the caller (usually PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM). This is to protect badly documented motherboard resources. But if we're allocating space inside an already-configured PCI-PCI bridge window, we ignore "min". See 688d191821de ("pci: make bus resource start address override minimum IO address"). This patch moves the check to make it more visible and simplify future patches. No functional change. Signed-off-by: Bjorn Helgaas --- drivers/pci/bus.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index fc1b74013743..6f2f47a7b6c6 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -147,11 +147,18 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, !(res->flags & IORESOURCE_PREFETCH)) continue; + /* + * "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to + * protect badly documented motherboard resources, but if + * this is an already-configured bridge window, its start + * overrides "min". + */ + if (r->start) + min = r->start; + /* Ok, try it out.. */ - ret = allocate_resource(r, res, size, - r->start ? : min, - max, align, - alignf, alignf_data); + ret = allocate_resource(r, res, size, min, max, + align, alignf, alignf_data); if (ret == 0) break; }