Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7220604ybp; Wed, 16 Oct 2019 05:42:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIQFGK/JWmsh+ihN/h+or+lCs9wCO2IlL9yuMuak92u7JTU/LIvzCW4VB8ehYWUhLSAzEx X-Received: by 2002:a17:906:2c5b:: with SMTP id f27mr38655014ejh.239.1571229728637; Wed, 16 Oct 2019 05:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571229728; cv=none; d=google.com; s=arc-20160816; b=ScbHDYuUv5XqIAgleku+GzjfneoSXHgrPSnM6HFSP3WpyBraE5xJ/xeCruzdNnCAXb v6Vze/0eY1cGDERNFf276o82AXV4uilKJdWq0UnphDjaduWNQMgOmyuHoPeRQnO/ee2a leEYXyvpu0GBxdXTyklNro34EhB6LrEuexdQQJYJuVka7ffhs+tudq1qs+/DXWLVy7xy YnWFICyeCDvzqSFM4uDnEMFMrHHCKrNNg9ogcsl9CfnGJ6H9QP2np0SLoJbBsdlXygUA twQCtaW4OpRLw40F8MNV8pijbRdYLRpQohBQKH6rW9A+YIT7FofWD2mQQuo8ZUzWiZJl s+jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=dbC10TRrfPBUyeMnWH8Vb+0wzmMhognRE/KN4HkD7Vo=; b=BfOng6rme7ym/nYXjl7sHPh3knvz2QSFunQligKPH9K/Z2ATaXnJSijU9s5/7HxQHT iyTRhpKz+pxjBtUskFj/EpO80aPeOsvtWDHclm84veICbKRa+rPKNGVOfDkWFVtvLRyB LlbbHAm1tc84+nYxM8c50MqVC67V9jXZWRzk1+VKaRN0cd9GqMc37tSOM31hNsZ5KV6W RZRE83Owv2Ssovndy6SxP+6kLWTwbQCEgi0yU0FPLBUCEuyaK2vR5pkEB2SSjb6YEAJX scnB5gXaUSNh6i2n2TIPuWiAcSJF26jsqJlb3RbJyQa8zjyEr6WWPDfiDkAOv+ExYZsh u9yA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pw28si14917360ejb.43.2019.10.16.05.41.45; Wed, 16 Oct 2019 05:42:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391280AbfJPHvZ (ORCPT + 99 others); Wed, 16 Oct 2019 03:51:25 -0400 Received: from 8bytes.org ([81.169.241.247]:47726 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbfJPHvY (ORCPT ); Wed, 16 Oct 2019 03:51:24 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id BDA7845B; Wed, 16 Oct 2019 09:51:22 +0200 (CEST) Date: Wed, 16 Oct 2019 09:51:21 +0200 From: Joerg Roedel To: Yian Chen Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, David Woodhouse , Ashok Raj , Sohil Mehta , Tony Luck Subject: Re: [PATCH] iommu/vt-d: Check VT-d RMRR region in BIOS is reported as reserved Message-ID: <20191016075120.GB32232@8bytes.org> References: <20191015164932.18185-1-yian.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191015164932.18185-1-yian.chen@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, Oct 15, 2019 at 09:49:32AM -0700, Yian Chen wrote: > VT-d RMRR (Reserved Memory Region Reporting) regions are reserved > for device use only and should not be part of allocable memory pool of OS. > > BIOS e820_table reports complete memory map to OS, including OS usable > memory ranges and BIOS reserved memory ranges etc. > > x86 BIOS may not be trusted to include RMRR regions as reserved type > of memory in its e820 memory map, hence validate every RMRR entry > with the e820 memory map to make sure the RMRR regions will not be > used by OS for any other purposes. Are there real systems in the wild where this is a problem? > +static inline int __init > +arch_rmrr_sanity_check(struct acpi_dmar_reserved_memory *rmrr) > +{ > + u64 start = rmrr->base_address; > + u64 end = rmrr->end_address + 1; > + > + if (e820__mapped_all(start, end, 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); > + return -EFAULT; > +} Why -EFAULT, there is no fault involved? Usibg -EINVAL seems to be a better choice.