Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1467125imk; Mon, 4 Jul 2022 03:48:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ukw/U5A0n5O1OPO4JJwZFycyieFZpRP9SqZnZeh60roZznWyPa3Y6asGbMBz0FbhTruPuf X-Received: by 2002:a17:903:41d2:b0:16a:2cc4:4824 with SMTP id u18-20020a17090341d200b0016a2cc44824mr35222739ple.112.1656931698177; Mon, 04 Jul 2022 03:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656931698; cv=none; d=google.com; s=arc-20160816; b=aIauC/vZEZ5zUDoP8jwLNZmcjwrZUhmq42cg9ouRoWhjrg3gqYPv6yp1iFjj2fl8JK wh4KKU/wfcu0+m+1dEfS2T3B00dJVbzya5gGqswcKIxTiXKDnsDmyECEFwfdvGp8jisK gGzRdPtFmR62uhOm1rwmWqlCkz2awbdiat8uP/GSSzTCoElQLKzPMwsU4j1iGrXCxC4n od6wNyHHdf/b3StpzXcCYhJkT8BCs8O2DDY9d/GZCRT3hLoS9A1ON0UokK+VTAha4BG9 25yN5NKbmqEpdtLwI2sA9aSpNt5aUOlTkmadB3NIEJju9zhEEjxABF9gDybU8CSa8+iO n/+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=gWFBuWbJfk0BQjO5Hr2ifCdFY41f+x0DBs8bne6Djqk=; b=GIAwn6pPurTAhcligbHXnqk7dKpNJHxMlfY8/RGqlpjXkIudJQyABW7P3wOJ7lOCCC PyY21Khet2Wm46xH8WzfMp6Kq5xOjQ0PhveAnrBMenQjaK8shUnC2xhUZouV6YClD7/H EnZSr0XVeQ89AcYctuX6PQ+r0WQU0M1IsMRv1KMC32W4o4qhm+gTQsYwB/gyLVhZtTS1 L6uKZmO8pB3eersazL/k3UmLZsrjp++owueSH1nGmGRSgsps22Dt4ZCvcGUqwHzCULu1 +wDOBM9ERn5Qz96rkWmwEgfYjFO6EXvf0rsQ+I8BOrFvnqlL1RdN+45ZD10Ikkpuovc9 B1KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a630b48000000b0040d33bb274bsi40514768pgl.321.2022.07.04.03.48.06; Mon, 04 Jul 2022 03:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233346AbiGDKjd (ORCPT + 99 others); Mon, 4 Jul 2022 06:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbiGDKj3 (ORCPT ); Mon, 4 Jul 2022 06:39:29 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5327CDFF6 for ; Mon, 4 Jul 2022 03:39:28 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 65A3BD6E; Mon, 4 Jul 2022 03:39:28 -0700 (PDT) Received: from [10.57.86.91] (unknown [10.57.86.91]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EA66F3F792; Mon, 4 Jul 2022 03:39:25 -0700 (PDT) Message-ID: <99632b76-3039-34a5-7615-b25e716e2621@arm.com> Date: Mon, 4 Jul 2022 11:39:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [RFC PATCH 3/3] iommu/vt-d: Show region type in arch_rmrr_sanity_check() Content-Language: en-GB To: Aaron Tomlin , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, joro@8bytes.org, will@kernel.org, dwmw2@infradead.org, baolu.lu@linux.intel.com, hpa@zytor.com Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, atomlin@atomlin.com References: <20220611204859.234975-1-atomlin@redhat.com> <20220611204859.234975-3-atomlin@redhat.com> From: Robin Murphy In-Reply-To: <20220611204859.234975-3-atomlin@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-06-11 21:48, Aaron Tomlin wrote: > This patch will attempt to describe the region type in the event > that a given RMRR entry is not within a reserved region. Hmm, is this useful information for the user? You'd hope the firmware vendor knows the memory map already, but either way, is it particularly likely that anyone would be noticing and caring about this warning in a context where they couldn't just scroll further up the log and cross-reference the full memory map listing? If so, it might be worth clarifying what that use-case is, since as it stands there doesn't seem to be much justification for the "why" here. > Signed-off-by: Aaron Tomlin > --- > arch/x86/include/asm/iommu.h | 9 ++++++--- > arch/x86/kernel/e820.c | 5 +++-- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h > index bf1ed2ddc74b..d21366644520 100644 > --- a/arch/x86/include/asm/iommu.h > +++ b/arch/x86/include/asm/iommu.h > @@ -17,12 +17,15 @@ arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) > { > u64 start = rmrr->base_address; > u64 end = rmrr->end_address + 1; > + struct e820_entry *entry; > > - if (e820__mapped_all(start, end, E820_TYPE_RESERVED)) > + entry = __e820__mapped_all(start, end, 0); > + > + if (entry && entry->type == E820_TYPE_RESERVED) > return 0; > > - pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n", > - start, end - 1); > + pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%s: %#018Lx-%#018Lx], contact BIOS vendor for fixes\n", > + e820_type_to_string(entry), start, end - 1); > return -EINVAL; > } > > diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c > index 95b994cf80cd..165e9a444bb9 100644 > --- a/arch/x86/kernel/e820.c > +++ b/arch/x86/kernel/e820.c > @@ -1073,7 +1073,7 @@ void __init e820__finish_early_params(void) > > const char *__init e820_type_to_string(struct e820_entry *entry) > { > - switch (entry->type) { > + switch (entry && entry->type) { Have you tested this for anything other than E820_TYPE_RAM? I think sufficiently up-to-date compilers should warn you here anyway. Robin. > case E820_TYPE_RESERVED_KERN: /* Fall-through: */ > case E820_TYPE_RAM: return "System RAM"; > case E820_TYPE_ACPI: return "ACPI Tables"; > @@ -1083,8 +1083,9 @@ const char *__init e820_type_to_string(struct e820_entry *entry) > case E820_TYPE_PMEM: return "Persistent Memory"; > case E820_TYPE_RESERVED: return "Reserved"; > case E820_TYPE_SOFT_RESERVED: return "Soft Reserved"; > - default: return "Unknown E820 type"; > + default: break; > } > + return "Unknown E820 type"; > } > > static unsigned long __init e820_type_to_iomem_type(struct e820_entry *entry)