From patchwork Thu Feb 6 13:31:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11368441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB6CD92A for ; Thu, 6 Feb 2020 13:32:05 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97ABB217BA for ; Thu, 6 Feb 2020 13:32:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97ABB217BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izhFB-0003Yw-2u; Thu, 06 Feb 2020 13:30:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izhFA-0003Yr-Fo for xen-devel@lists.xenproject.org; Thu, 06 Feb 2020 13:30:56 +0000 X-Inumbo-ID: e70c6d44-48e4-11ea-841d-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e70c6d44-48e4-11ea-841d-bc764e2007e4; Thu, 06 Feb 2020 13:30:55 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1672DAD79; Thu, 6 Feb 2020 13:30:54 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <6ef37772-81da-dfd0-01e7-c83998b2c2c4@suse.com> Message-ID: <68fb9767-3104-3f0b-d052-20df7603e1e9@suse.com> Date: Thu, 6 Feb 2020 14:31:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <6ef37772-81da-dfd0-01e7-c83998b2c2c4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 1/2] VT-d: check all of an RMRR for being E820-reserved X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Checking just the first and last page is not sufficient (and redundant for single-page regions). As we don't need to care about IA64 anymore, use an x86-specific function to get this done without looping over each individual page. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Reviewed-by: Kevin Tian --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "dmar.h" #include "iommu.h" @@ -632,14 +633,11 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea * not properly represented in the system memory map and * inform the user */ - if ( (!page_is_ram_type(paddr_to_pfn(base_addr), RAM_TYPE_RESERVED)) || - (!page_is_ram_type(paddr_to_pfn(end_addr), RAM_TYPE_RESERVED)) ) - { + if ( !e820_all_mapped(base_addr, end_addr + 1, RAM_TYPE_RESERVED) ) printk(XENLOG_WARNING VTDPREFIX " RMRR address range %"PRIx64"..%"PRIx64" not in reserved memory;" " need \"iommu_inclusive_mapping=1\"?\n", base_addr, end_addr); - } rmrru = xzalloc(struct acpi_rmrr_unit); if ( !rmrru ) From patchwork Thu Feb 6 13:31:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11368443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 664A092A for ; Thu, 6 Feb 2020 13:32:12 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D176217BA for ; Thu, 6 Feb 2020 13:32:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D176217BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izhFZ-0003bz-Kr; Thu, 06 Feb 2020 13:31:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1izhFY-0003bk-Ar for xen-devel@lists.xenproject.org; Thu, 06 Feb 2020 13:31:20 +0000 X-Inumbo-ID: f547cdfe-48e4-11ea-841d-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f547cdfe-48e4-11ea-841d-bc764e2007e4; Thu, 06 Feb 2020 13:31:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 17B73B162; Thu, 6 Feb 2020 13:31:19 +0000 (UTC) From: Jan Beulich To: "xen-devel@lists.xenproject.org" References: <6ef37772-81da-dfd0-01e7-c83998b2c2c4@suse.com> Message-ID: Date: Thu, 6 Feb 2020 14:31:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <6ef37772-81da-dfd0-01e7-c83998b2c2c4@suse.com> Content-Language: en-US Subject: [Xen-devel] [PATCH 2/2] VT-d: adjust logging of RMRRs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Consistently use [,] range representation, shrink leading double blanks to a single one, and slightly adjust text in some cases. Signed-off-by: Jan Beulich Reviewed-by: Kevin Tian --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -561,7 +561,7 @@ static int register_one_rmrr(struct acpi { dprintk(XENLOG_WARNING VTDPREFIX, " Non-existent device (%04x:%02x:%02x.%u) is reported" - " in RMRR (%"PRIx64", %"PRIx64")'s scope!\n", + " in RMRR [%"PRIx64",%"PRIx64")]'s scope!\n", rmrru->segment, b, d, f, rmrru->base_address, rmrru->end_address); ignore = true; @@ -577,8 +577,8 @@ static int register_one_rmrr(struct acpi if ( ignore ) { dprintk(XENLOG_WARNING VTDPREFIX, - " Ignore the RMRR (%"PRIx64", %"PRIx64") due to " - "devices under its scope are not PCI discoverable!\n", + " Ignore RMRR [%"PRIx64",%"PRIx64"] as no device" + " under its scope is PCI discoverable!\n", rmrru->base_address, rmrru->end_address); scope_devices_free(&rmrru->scope); xfree(rmrru); @@ -586,7 +586,7 @@ static int register_one_rmrr(struct acpi else if ( rmrru->base_address > rmrru->end_address ) { dprintk(XENLOG_WARNING VTDPREFIX, - " The RMRR (%"PRIx64", %"PRIx64") is incorrect!\n", + " RMRR [%"PRIx64",%"PRIx64"] is incorrect!\n", rmrru->base_address, rmrru->end_address); scope_devices_free(&rmrru->scope); xfree(rmrru); @@ -595,8 +595,7 @@ static int register_one_rmrr(struct acpi else { if ( iommu_verbose ) - dprintk(VTDPREFIX, - " RMRR region: base_addr %"PRIx64" end_addr %"PRIx64"\n", + dprintk(VTDPREFIX, " RMRR: [%"PRIx64",%"PRIx64"]\n", rmrru->base_address, rmrru->end_address); acpi_register_rmrr_unit(rmrru); } @@ -635,7 +634,7 @@ acpi_parse_one_rmrr(struct acpi_dmar_hea */ if ( !e820_all_mapped(base_addr, end_addr + 1, RAM_TYPE_RESERVED) ) printk(XENLOG_WARNING VTDPREFIX - " RMRR address range %"PRIx64"..%"PRIx64" not in reserved memory;" + " RMRR [%"PRIx64",%"PRIx64"] not in reserved memory;" " need \"iommu_inclusive_mapping=1\"?\n", base_addr, end_addr);