From patchwork Tue Feb 24 08:39:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 5870661 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7D0BABF440 for ; Tue, 24 Feb 2015 08:39:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD29F2063C for ; Tue, 24 Feb 2015 08:39:44 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0B3620653 for ; Tue, 24 Feb 2015 08:39:43 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C328E811E9; Tue, 24 Feb 2015 00:39:43 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9D36B811E9 for ; Tue, 24 Feb 2015 00:39:42 -0800 (PST) Received: by mail-wi0-f171.google.com with SMTP id ex7so3077249wid.4 for ; Tue, 24 Feb 2015 00:39:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=mGb2OpuKDkwgVVg5wtB5JYmgp80JHMel/vP2g76fhzs=; b=kyA75WdCXWIqw0aJYMyRZyxeP4lXHCJUSRUuXYsGQaK7BUvQDyJyWX+9PKCEj90Ae7 Ior6UIsLskugIeib80FDUfnn9nIydSDFxWMjhQIhjMjDzqLGlnfw8BlRfYt1Djwo7JuO c+HtlTpA54/X/LGQGjU6xPjrDzViTMJGg8VpIwxGV4DNmnwjkVNO/2tS65YNLWIHcKzu eLNeV1er1XMmhPFqTIVnrCe1Kigf8NsvLkCZsjPnoXJIaxRLE8lwwvV+FRr7cC6RALwU Mxy982L+N1+1CBWd2XlJl+4W1qGzRNcfxa20Zt4OTUKbDSrcyR4/Xjh6wvTp/2oZrxn1 ZxFg== X-Gm-Message-State: ALoCoQnRtA9kS1L7ql3L/LfJkean/m2h3yXM6LnpqYoFPiZ4KG7C8glbmO2d2q3NhGQ64CCLV6Rt X-Received: by 10.194.9.98 with SMTP id y2mr30834537wja.85.1424767181134; Tue, 24 Feb 2015 00:39:41 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id dz6sm12740190wib.0.2015.02.24.00.39.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 00:39:40 -0800 (PST) Message-ID: <54EC38CA.6050607@plexistor.com> Date: Tue, 24 Feb 2015 10:39:38 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Ingo Molnar References: <54EB1D33.3050107@plexistor.com> <54EB206E.4010009@plexistor.com> In-Reply-To: Cc: Andrew Morton , linux-nvdimm , X86 ML , linux-kernel , Andy Lutomirski , Christoph Hellwig , Thomas Gleixner , "H. Peter Anvin" , Linus Torvalds , Vivek Goyal Subject: [Linux-nvdimm] [PATCH 2/3 v3] resource: Add new flag IORESOURCE_MEM_WARN X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Resource providers set this flag if they want that request_region_XXX will print a warning in dmesg if this particular resource is locked by a driver. Thous acting as a Protocol Police about experimental devices that did not pass a comity approval. The Only user of this flag is x86/kernel/e820.c that wants to WARN about UNKNOWN memory types. Signed-off-by: Boaz Harrosh --- arch/x86/kernel/e820.c | 3 +++ include/linux/ioport.h | 2 +- kernel/resource.c | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 1a8a1c3..105bb37 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -961,6 +961,9 @@ void __init e820_reserve_resources(void) res->flags = IORESOURCE_MEM; + if (_is_unknown_type(e820.map[i].type)) + res->flags |= IORESOURCE_MEM_WARN; + /* * don't register the region that could be conflicted with * pci device BAR resource and insert them later in diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 2c525022..183af93 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -90,6 +90,7 @@ struct resource { #define IORESOURCE_MEM_32BIT (3<<3) #define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */ #define IORESOURCE_MEM_EXPANSIONROM (1<<6) +#define IORESOURCE_MEM_WARN (1<<7) /* WARN if requested by driver */ /* PnP I/O specific bits (IORESOURCE_BITS) */ #define IORESOURCE_IO_16BIT_ADDR (1<<0) @@ -255,6 +256,5 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2) return (r1->start <= r2->end && r1->end >= r2->start); } - #endif /* __ASSEMBLY__ */ #endif /* _LINUX_IOPORT_H */ diff --git a/kernel/resource.c b/kernel/resource.c index 19f2357..fca23ff 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -1075,8 +1075,13 @@ struct resource * __request_region(struct resource *parent, break; if (conflict != parent) { parent = conflict; - if (!(conflict->flags & IORESOURCE_BUSY)) + if (!(conflict->flags & IORESOURCE_BUSY)) { + if (conflict->flags & IORESOURCE_MEM_WARN) + pr_warn("request unknown region [mem %#010llx-%#010llx] %s\n", + conflict->start, conflict->end, + conflict->name); continue; + } } if (conflict->flags & flags & IORESOURCE_MUXED) { add_wait_queue(&muxed_resource_wait, &wait);