From patchwork Fri Jul 14 09:45:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 788247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x879S4p10z9s7m for ; Fri, 14 Jul 2017 19:46:04 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3x879S1v75zDql4 for ; Fri, 14 Jul 2017 19:46:04 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x879N01DRzDqg2 for ; Fri, 14 Jul 2017 19:46:00 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4576D8046A; Fri, 14 Jul 2017 09:45:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4576D8046A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4576D8046A Received: from thh440s.str.redhat.com (dhcp-200-180.str.redhat.com [10.33.200.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id E74405C892; Fri, 14 Jul 2017 09:45:54 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Fri, 14 Jul 2017 11:45:54 +0200 Message-Id: <1500025554-15602-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 14 Jul 2017 09:45:56 +0000 (UTC) Subject: [SLOF] [PATCH] pci: Avoid 32-bit prefetchable memory area if possible X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" PCI bridges can only have one prefetchable memory area. If we are already using 64-bit prefetchable memory regions, we can not use a dedicated 32-bit prefetchable memory region anymore. In that case the 32-bit BARs should all be located in the 32-bit non- prefetchable memory space instead. Signed-off-by: Thomas Huth --- board-qemu/slof/pci-phb.fs | 16 +++++++++++----- slof/fs/pci-properties.fs | 7 ++++++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/board-qemu/slof/pci-phb.fs b/board-qemu/slof/pci-phb.fs index b7bf9cf..926efba 100644 --- a/board-qemu/slof/pci-phb.fs +++ b/board-qemu/slof/pci-phb.fs @@ -253,12 +253,9 @@ setup-puid THEN ENDOF 2000000 OF \ 32-bit memory space? - decode-64 pci-next-mem ! \ Decode mem base address + decode-64 dup >r pci-next-mmio ! \ Decode base address decode-64 drop \ Forget the parent address - decode-64 2 / dup >r \ Decode and calc size/2 - pci-next-mem @ + dup pci-max-mem ! \ and calc max mem address - dup pci-next-mmio ! \ which is the same as MMIO base - r> + pci-max-mmio ! \ calc max MMIO address + decode-64 r> + pci-max-mmio ! \ calc max MMIO address ENDOF 3000000 OF \ 64-bit memory space? decode-64 dup >r pci-next-mem64 ! @@ -270,6 +267,15 @@ setup-puid ( prop-addr prop-len ) 2drop + \ If we do not have 64-bit prefetchable memory, split the 32-bit space: + pci-next-mem64 @ 0= IF + pci-next-mmio @ pci-next-mem ! \ Start of 32-bit prefetchable + pci-max-mmio @ pci-next-mmio @ - 2 / \ Calculate new size + pci-next-mmio @ + \ The middle of the area + dup pci-max-mem ! + pci-next-mmio ! + THEN + phb-debug? IF ." pci-next-io = " pci-next-io @ . cr ." pci-max-io = " pci-max-io @ . cr diff --git a/slof/fs/pci-properties.fs b/slof/fs/pci-properties.fs index b7bb534..6f8f013 100644 --- a/slof/fs/pci-properties.fs +++ b/slof/fs/pci-properties.fs @@ -159,7 +159,12 @@ \ Setup a prefetchable 32bit BAR and return its size : assign-mem32-bar ( bar-addr -- 4 ) dup pci-bar-size-mem32 \ fetch size - pci-next-mem \ var to change + \ Do we have a dedicated 32-bit prefetchable area? If not, use MMIO + pci-next-mem @ IF + pci-next-mem + ELSE + pci-next-mmio + THEN assign-bar-value32 \ and set it all ;