All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set
@ 2018-05-14 15:47 Tuomas Tynkkynen
  2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tuomas Tynkkynen @ 2018-05-14 15:47 UTC (permalink / raw)
  To: u-boot

Currently, qemu_arm_defconfig and qemu_arm64_defconfig only work with
the 'highmem=off' parameter passed to QEMU's virt machine. The reason is
that when 'highmem' is not disabled, QEMU appends 64-bit a memory
resource to the PCI controller's regions property in DT in addition to
the 32-bit PCI memory window in low memory. And the current DT parsing
code picks the last (thus the 64-bit one) memory resource, whose address
eventually gets silently truncated to 32 bits because
CONFIG_SYS_PCI_64BIT is not set, which obviously causes PCI to break.

Avoid this problem by ignoring memory regions whose addresses are above
the 32-bit boundary when CONFIG_SYS_PCI_64BIT is not set.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
 drivers/pci/pci-uclass.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 49be1ebdd7..1cd1e409e3 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -860,6 +860,13 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 		} else {
 			continue;
 		}
+
+		if (!IS_ENABLED(CONFIG_SYS_PCI_64BIT) &&
+		    type == PCI_REGION_MEM && upper_32_bits(pci_addr)) {
+			debug(" - beyond the 32-bit boundary, ignoring\n");
+			continue;
+		}
+
 		pos = -1;
 		for (i = 0; i < hose->region_count; i++) {
 			if (hose->regions[i].flags == type)
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table
  2018-05-14 15:47 [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Tuomas Tynkkynen
@ 2018-05-14 15:47 ` Tuomas Tynkkynen
  2018-05-14 19:51   ` Simon Glass
  2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
  2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Tuomas Tynkkynen @ 2018-05-14 15:47 UTC (permalink / raw)
  To: u-boot

Now that PCI devices work with highmem-enabled QEMU emulation, bump up
the RAM size in the MMU tables to gain access to the full 255 GB of RAM
potential instead of the puny 3 GB.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
 board/emulation/qemu-arm/qemu-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 6ec4200170..085cbbef99 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -28,7 +28,7 @@ static struct mm_region qemu_arm64_mem_map[] = {
 		/* RAM */
 		.virt = 0x40000000UL,
 		.phys = 0x40000000UL,
-		.size = 0xc0000000UL,
+		.size = 255UL * SZ_1G,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_INNER_SHARE
 	}, {
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references
  2018-05-14 15:47 [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Tuomas Tynkkynen
  2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
@ 2018-05-14 15:47 ` Tuomas Tynkkynen
  2018-05-14 19:51   ` Simon Glass
                     ` (2 more replies)
  2018-05-14 19:51 ` [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Simon Glass
  2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 3 replies; 10+ messages in thread
From: Tuomas Tynkkynen @ 2018-05-14 15:47 UTC (permalink / raw)
  To: u-boot

Now that U-Boot works fine with highmem enabled, there is no need to
tell users to disable highmem.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
---
 doc/README.qemu-arm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/doc/README.qemu-arm b/doc/README.qemu-arm
index 6f6f07d8bb..260165638a 100644
--- a/doc/README.qemu-arm
+++ b/doc/README.qemu-arm
@@ -39,13 +39,12 @@ Running U-Boot
 The minimal QEMU command line to get U-Boot up and running is:
 
 - For ARM:
-    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin
+    qemu-system-arm -machine virt -bios u-boot.bin
 
 - For AArch64:
-    qemu-system-aarch64 -machine virt,highmem=off -cpu cortex-a57 -bios u-boot.bin
+    qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
 
-The 'highmem=off' parameter to the 'virt' machine is required for PCI to work
-in U-Boot. Also, for some odd reason qemu-system-aarch64 needs to be explicitly
+Note that for some odd reason qemu-system-aarch64 needs to be explicitly
 told to use a 64-bit CPU or it will boot in 32-bit mode.
 
 Additional peripherals that have been tested to work in both U-Boot and Linux
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set
  2018-05-14 15:47 [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Tuomas Tynkkynen
  2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
  2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
@ 2018-05-14 19:51 ` Simon Glass
  2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2018-05-14 19:51 UTC (permalink / raw)
  To: u-boot

On 14 May 2018 at 09:47, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote:
> Currently, qemu_arm_defconfig and qemu_arm64_defconfig only work with
> the 'highmem=off' parameter passed to QEMU's virt machine. The reason is
> that when 'highmem' is not disabled, QEMU appends 64-bit a memory
> resource to the PCI controller's regions property in DT in addition to
> the 32-bit PCI memory window in low memory. And the current DT parsing
> code picks the last (thus the 64-bit one) memory resource, whose address
> eventually gets silently truncated to 32 bits because
> CONFIG_SYS_PCI_64BIT is not set, which obviously causes PCI to break.
>
> Avoid this problem by ignoring memory regions whose addresses are above
> the 32-bit boundary when CONFIG_SYS_PCI_64BIT is not set.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
>  drivers/pci/pci-uclass.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table
  2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
@ 2018-05-14 19:51   ` Simon Glass
  2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Glass @ 2018-05-14 19:51 UTC (permalink / raw)
  To: u-boot

On 14 May 2018 at 09:47, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote:
> Now that PCI devices work with highmem-enabled QEMU emulation, bump up
> the RAM size in the MMU tables to gain access to the full 255 GB of RAM
> potential instead of the puny 3 GB.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
>  board/emulation/qemu-arm/qemu-arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references
  2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
@ 2018-05-14 19:51   ` Simon Glass
  2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
  2018-09-04  6:22   ` [U-Boot] [PATCH " Jonathan Gray
  2 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2018-05-14 19:51 UTC (permalink / raw)
  To: u-boot

On 14 May 2018 at 09:47, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> wrote:
> Now that U-Boot works fine with highmem enabled, there is no need to
> tell users to disable highmem.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
>  doc/README.qemu-arm | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [U-Boot, 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set
  2018-05-14 15:47 [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Tuomas Tynkkynen
                   ` (2 preceding siblings ...)
  2018-05-14 19:51 ` [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Simon Glass
@ 2018-05-28 19:12 ` Tom Rini
  3 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-05-28 19:12 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 06:47:50PM +0300, Tuomas Tynkkynen wrote:

> Currently, qemu_arm_defconfig and qemu_arm64_defconfig only work with
> the 'highmem=off' parameter passed to QEMU's virt machine. The reason is
> that when 'highmem' is not disabled, QEMU appends 64-bit a memory
> resource to the PCI controller's regions property in DT in addition to
> the 32-bit PCI memory window in low memory. And the current DT parsing
> code picks the last (thus the 64-bit one) memory resource, whose address
> eventually gets silently truncated to 32 bits because
> CONFIG_SYS_PCI_64BIT is not set, which obviously causes PCI to break.
> 
> Avoid this problem by ignoring memory regions whose addresses are above
> the 32-bit boundary when CONFIG_SYS_PCI_64BIT is not set.
> 
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/14542215/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [U-Boot, 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table
  2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
  2018-05-14 19:51   ` Simon Glass
@ 2018-05-28 19:12   ` Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-05-28 19:12 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 06:47:51PM +0300, Tuomas Tynkkynen wrote:

> Now that PCI devices work with highmem-enabled QEMU emulation, bump up
> the RAM size in the MMU tables to gain access to the full 255 GB of RAM
> potential instead of the puny 3 GB.
> 
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/82c5d4c5/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [U-Boot, 3/3] doc: qemu-arm: Drop highmem=off references
  2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
  2018-05-14 19:51   ` Simon Glass
@ 2018-05-28 19:12   ` Tom Rini
  2018-09-04  6:22   ` [U-Boot] [PATCH " Jonathan Gray
  2 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2018-05-28 19:12 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 06:47:52PM +0300, Tuomas Tynkkynen wrote:

> Now that U-Boot works fine with highmem enabled, there is no need to
> tell users to disable highmem.
> 
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/dd557904/attachment.sig>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references
  2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
  2018-05-14 19:51   ` Simon Glass
  2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
@ 2018-09-04  6:22   ` Jonathan Gray
  2 siblings, 0 replies; 10+ messages in thread
From: Jonathan Gray @ 2018-09-04  6:22 UTC (permalink / raw)
  To: u-boot

On Mon, May 14, 2018 at 06:47:52PM +0300, Tuomas Tynkkynen wrote:
> Now that U-Boot works fine with highmem enabled, there is no need to
> tell users to disable highmem.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
> ---
>  doc/README.qemu-arm | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/doc/README.qemu-arm b/doc/README.qemu-arm
> index 6f6f07d8bb..260165638a 100644
> --- a/doc/README.qemu-arm
> +++ b/doc/README.qemu-arm
> @@ -39,13 +39,12 @@ Running U-Boot
>  The minimal QEMU command line to get U-Boot up and running is:
>
>  - For ARM:
> -    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin
> +    qemu-system-arm -machine virt -bios u-boot.bin
>
>  - For AArch64:
> -    qemu-system-aarch64 -machine virt,highmem=off -cpu cortex-a57 -bios u-boot.bin
> +    qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin
>
> -The 'highmem=off' parameter to the 'virt' machine is required for PCI to work
> -in U-Boot. Also, for some odd reason qemu-system-aarch64 needs to be explicitly
> +Note that for some odd reason qemu-system-aarch64 needs to be explicitly
>  told to use a 64-bit CPU or it will boot in 32-bit mode.
>
>  Additional peripherals that have been tested to work in both U-Boot and Linux

Something has changed as qemu 3.0 requires highmem=off again.
qemu 2.12.0 works without highmem=off.

$ qemu-system-aarch64 --version
QEMU emulator version 3.0.0
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
$ qemu-system-aarch64 -M virt -cpu cortex-a57 -bios u-boot.bin -serial stdio

U-Boot 2018.09-rc3 (Sep 04 2018 - 13:03:12 +1000)

DRAM:  128 MiB
In:    pl011 at 9000000
Out:   pl011 at 9000000
Err:   pl011 at 9000000
Net:   No ethernet found.
"Synchronous Abort" handler, esr 0x96000005
elr: 00000000000258e0 lr : 000000000002589c (reloc)
elr: 0000000047f978e0 lr : 0000000047f9789c
x0 : 000000401000000e x1 : 0000000000000000
x2 : 000000401000000e x3 : 0000000046e608c8
x4 : 0000004010000000 x5 : 0000000000000000
x6 : 0000000047f9889c x7 : 0000000000000002
x8 : 0000000000000003 x9 : 0000000000000004
x10: 0000000046e60de8 x11: 000000000000152c
x12: 0000000046e6089c x13: 0000000000001200
x14: 0000000046e6092c x15: 0000000046e60de8
x16: 0000000000000000 x17: 0000000000000000
x18: 0000000046f61de8 x19: 0000000046e60940
x20: 0000000000000000 x21: 0000000047fcc0a8
x22: 0000000046f62450 x23: 0000000047fcc680
x24: 000000000000ff00 x25: 0000000000000000
x26: 0000000047fcc000 x27: 0000000000000000
x28: 0000000000000000 x29: 0000000046e608a0

Resetting CPU ...

resetting ...

$ qemu-system-aarch64 -M virt,highmem=off -cpu cortex-a57 -bios u-boot.bin -serial stdio

U-Boot 2018.09-rc3 (Sep 04 2018 - 13:03:12 +1000)

DRAM:  128 MiB
In:    pl011 at 9000000
Out:   pl011 at 9000000
Err:   pl011 at 9000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
scanning bus for devices...

Device 0: unknown device
=> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-04  6:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 15:47 [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Tuomas Tynkkynen
2018-05-14 15:47 ` [U-Boot] [PATCH 2/3] ARM: qemu-arm: Bump RAM size in AArch64 MMU table Tuomas Tynkkynen
2018-05-14 19:51   ` Simon Glass
2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
2018-05-14 15:47 ` [U-Boot] [PATCH 3/3] doc: qemu-arm: Drop highmem=off references Tuomas Tynkkynen
2018-05-14 19:51   ` Simon Glass
2018-05-28 19:12   ` [U-Boot] [U-Boot, " Tom Rini
2018-09-04  6:22   ` [U-Boot] [PATCH " Jonathan Gray
2018-05-14 19:51 ` [U-Boot] [PATCH 1/3] PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Simon Glass
2018-05-28 19:12 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.