From patchwork Mon Mar 14 01:42:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 63778 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2230228lbc; Sun, 13 Mar 2016 18:42:56 -0700 (PDT) X-Received: by 10.140.102.85 with SMTP id v79mr27342002qge.39.1457919776355; Sun, 13 Mar 2016 18:42:56 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r96si19561974qkh.51.2016.03.13.18.42.56 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 13 Mar 2016 18:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:38513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afHX5-0007o6-Ta for patch@linaro.org; Sun, 13 Mar 2016 21:42:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afHWh-0007Wq-1T for qemu-devel@nongnu.org; Sun, 13 Mar 2016 21:42:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afHWc-0001Hm-14 for qemu-devel@nongnu.org; Sun, 13 Mar 2016 21:42:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afHWb-0001Hi-SI for qemu-devel@nongnu.org; Sun, 13 Mar 2016 21:42:25 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 7F5A0248 for ; Mon, 14 Mar 2016 01:42:25 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com ([10.3.113.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2E1gNFa019109; Sun, 13 Mar 2016 21:42:24 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Mon, 14 Mar 2016 02:42:19 +0100 Message-Id: <1457919739-18437-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Marcel Apfelbaum , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] hw/i386/acpi-build: place qword descriptors in bridge _CRS's when needed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In build_crs(), the calculation & merging of the ranges already happens in 64-bit, but the entry boundaries are silently truncated to 32-bit in the call to aml_dword_memory(). Use aml_qword_memory() when necessary -- this fixes 64-bit BARs behind PXBs. Cc: Marcel Apfelbaum Cc: Michael S. Tsirkin Signed-off-by: Laszlo Ersek --- hw/i386/acpi-build.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) -- 1.8.3.1 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b88800883944..3157cc36db98 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -938,13 +938,25 @@ static Aml *build_crs(PCIHostState *host, crs_range_merge(host_mem_ranges); for (i = 0; i < host_mem_ranges->len; i++) { + Aml *mem; + uint64_t length; + entry = g_ptr_array_index(host_mem_ranges, i); - aml_append(crs, - aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, - AML_MAX_FIXED, AML_NON_CACHEABLE, - AML_READ_WRITE, - 0, entry->base, entry->limit, 0, - entry->limit - entry->base + 1)); + length = entry->limit - entry->base + 1; + if (entry->limit <= UINT32_MAX && length <= UINT32_MAX) { + mem = aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, + AML_MAX_FIXED, AML_NON_CACHEABLE, + AML_READ_WRITE, + 0, entry->base, entry->limit, 0, + length); + } else { + mem = aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, + AML_MAX_FIXED, AML_NON_CACHEABLE, + AML_READ_WRITE, + 0, entry->base, entry->limit, 0, + length); + } + aml_append(crs, mem); crs_range_insert(mem_ranges, entry->base, entry->limit); } g_ptr_array_free(host_mem_ranges, true);