From patchwork Tue Mar 11 17:42:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 3813621 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F198EBF540 for ; Tue, 11 Mar 2014 17:45:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B0A9201F0 for ; Tue, 11 Mar 2014 17:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 58C90201D5 for ; Tue, 11 Mar 2014 17:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755063AbaCKRmr (ORCPT ); Tue, 11 Mar 2014 13:42:47 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:42668 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755053AbaCKRmp (ORCPT ); Tue, 11 Mar 2014 13:42:45 -0400 Received: by mail-ig0-f173.google.com with SMTP id t19so11904417igi.0 for ; Tue, 11 Mar 2014 10:42:44 -0700 (PDT) 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=NC1d1lmRwQvwxAN8WsEjG6qvKDEWpMm38fFWfdPazeQ=; b=RGBzfyD8xu56krAAKeupoB0DUH4dFtOpqZ7N+okDb9q52f0WOcquU8xShGWAB1gcoM VpWHFOk5llJ3cN8E/CO97mQWtNgbqUnwNDg6EXQJ43MUS+LftU9L3uC0YWWYIadRwVYY bfbD9yfrzX8/HL9ruxDIdnLgl7yT75vHWQQhjpgPP6br8aBFshN+xmWcu4N6y6K5kmeL DsjRm1NUqgi4/qW7V1Y+d8w3J5cOxqbiez5mQbjdo0IirbGNoEXy/ArHzaPzsy7A2C43 ovXGwJKE+kBp34ZkUzRMsa8tYQsNuGPruWwz32fmmE8UIeQJbAVlj3UIA/VuDca9dLBu YWtw== 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=NC1d1lmRwQvwxAN8WsEjG6qvKDEWpMm38fFWfdPazeQ=; b=Gs0CbHgF158aH4fMQPjU3hKP9ksZvhha7x3k5YlIsaVFDFPjuWKbhyLLpsdrg0+5ji MtJzcZifeEQpi6UL6vWLxpy6Ere5PHw5rTU1FqdKY2RejTTBEeHnqoaaWsN/nXf5KUmF RpQ0jlI273pjRpSHoblKoasxIdM9czupN68VjnLxq7kGxhgvzP0kNVNwCfEHnYrK7pte LzdbfaneKnl1hsLECbJsevlNFGMyLM+93jlR7dMomgK8yFwFJeqBXY3d5GO315MbIpvC tMxtvQhEpBzbVjMW2lfLLy6Yar2NXzHY02EBQF5/33N7AvGb26ug4RjiIwDGlXD40tvw nKIg== X-Gm-Message-State: ALoCoQkrYWbSBDeZ/aUo/WGbdcmrlVlaErZ+dXu4TgVN2FhibSlUzzehXBMyaUCDARXNFy15fdGJtsx0x78eOsqT9Z1aKmiTRhErEFSS3U1Jb76X414haedbx0YMVpuuZFE1xUKiw/B77ofPjmTzBz2oQIX5kMOFpKf632GDrF1n8iDefXtigwgJu9MFnaPuVU0ScSmbA2GFqVedo76BduTGVnKthMl+4iF0oYsR9QrqXdrpeY2hE8g= X-Received: by 10.43.65.145 with SMTP id xm17mr34690324icb.35.1394559764785; Tue, 11 Mar 2014 10:42:44 -0700 (PDT) Received: from localhost ([172.16.50.109]) by mx.google.com with ESMTPSA id v5sm50772733igb.0.2014.03.11.10.42.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 11 Mar 2014 10:42:44 -0700 (PDT) Subject: [PATCH 1/5] PCI: Don't check resource_size() in pci_bus_alloc_resource() To: linux-pci@vger.kernel.org From: Bjorn Helgaas Cc: Paul Bolle , Yinghai Lu , linux-kernel@vger.kernel.org Date: Tue, 11 Mar 2014 11:42:43 -0600 Message-ID: <20140311174243.23084.77689.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <20140311173556.23084.57635.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <20140311173556.23084.57635.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 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Paul reported that after f75b99d5a77d ("PCI: Enforce bus address limits in resource allocation") on a 32-bit kernel (CONFIG_PHYS_ADDR_T_64BIT not set), intel-gtt complained "can't ioremap flush page - no chipset flushing". In addition, other PCI resource allocations, e.g., for bridge windows, failed. This happens because we incorrectly skip bus resources of [mem 0x00000000-0xffffffff] because we think they are of size zero. When resource_size_t is 32 bits wide, resource_size() on [mem 0x00000000-0xffffffff] returns 0 because (r->end - r->start + 1) overflows. Therefore, we can't use "resource_size() == 0" to decide that allocation from this resource will fail. allocate_resource() should fail anyway if it can't satisfy the address constraints, so we should just depend on that. A [mem 0x00000000-0xffffffff] bus resource is obviously not really valid, but we do fall back to it as a default when we don't have information about host bridge apertures. Link: https://bugzilla.kernel.org/show_bug.cgi?id=71611 Fixes: f75b99d5a77d PCI: Enforce bus address limits in resource allocation Reported-and-tested-by: Paul Bolle Signed-off-by: Bjorn Helgaas --- drivers/pci/bus.c | 2 -- 1 file changed, 2 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 00660cc502c5..38901665c770 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -162,8 +162,6 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, avail = *r; pci_clip_resource_to_region(bus, &avail, region); - if (!resource_size(&avail)) - continue; /* * "min" is typically PCIBIOS_MIN_IO or PCIBIOS_MIN_MEM to