qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>
Subject: [PULL 25/28] hw/pci-host/gt64120: Set PCI base address register write mask
Date: Tue,  6 Aug 2024 14:51:53 +0200	[thread overview]
Message-ID: <20240806125157.91185-26-philmd@linaro.org> (raw)
In-Reply-To: <20240806125157.91185-1-philmd@linaro.org>

When booting Linux we see:

  PCI host bridge to bus 0000:00
  pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff]
  pci_bus 0000:00: root bus resource [io  0x1000-0x1fffff]
  pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
  pci 0000:00:00.0: [11ab:4620] type 00 class 0x060000
  pci 0000:00:00.0: [Firmware Bug]: reg 0x14: invalid BAR (can't size)
  pci 0000:00:00.0: [Firmware Bug]: reg 0x18: invalid BAR (can't size)
  pci 0000:00:00.0: [Firmware Bug]: reg 0x1c: invalid BAR (can't size)
  pci 0000:00:00.0: [Firmware Bug]: reg 0x20: invalid BAR (can't size)
  pci 0000:00:00.0: [Firmware Bug]: reg 0x24: invalid BAR (can't size)

This is due to missing base address register write mask.
Add it to get:

  PCI host bridge to bus 0000:00
  pci_bus 0000:00: root bus resource [mem 0x10000000-0x17ffffff]
  pci_bus 0000:00: root bus resource [io  0x1000-0x1fffff]
  pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
  pci 0000:00:00.0: [11ab:4620] type 00 class 0x060000
  pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x00000fff pref]
  pci 0000:00:00.0: reg 0x14: [mem 0x01000000-0x01000fff pref]
  pci 0000:00:00.0: reg 0x18: [mem 0x1c000000-0x1c000fff]
  pci 0000:00:00.0: reg 0x1c: [mem 0x1f000000-0x1f000fff]
  pci 0000:00:00.0: reg 0x20: [mem 0x1be00000-0x1be00fff]
  pci 0000:00:00.0: reg 0x24: [io  0x14000000-0x14000fff]

Since this device is only used by MIPS machines which aren't
versioned, we don't need to update migration compat machinery.

Mention the datasheet referenced. Remove the "Malta assumptions
ahead" comment since the reset values from the datasheet are used.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20240802213122.86852-2-philmd@linaro.org>
---
 hw/pci-host/gt64120.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c
index e02efc9e2e..573d2619ee 100644
--- a/hw/pci-host/gt64120.c
+++ b/hw/pci-host/gt64120.c
@@ -1,6 +1,8 @@
 /*
  * QEMU GT64120 PCI host
  *
+ * (Datasheet GT-64120 Rev 1.4 from Sep 14, 1999)
+ *
  * Copyright (c) 2006,2007 Aurelien Jarno
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1213,17 +1215,27 @@ static void gt64120_realize(DeviceState *dev, Error **errp)
 
 static void gt64120_pci_realize(PCIDevice *d, Error **errp)
 {
-    /* FIXME: Malta specific hw assumptions ahead */
+    /* Values from chapter 17.16 "PCI Configuration" */
+
     pci_set_word(d->config + PCI_COMMAND, 0);
     pci_set_word(d->config + PCI_STATUS,
                  PCI_STATUS_FAST_BACK | PCI_STATUS_DEVSEL_MEDIUM);
     pci_config_set_prog_interface(d->config, 0);
+
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_0, 0xfffff008); /* SCS[1:0] */
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_1, 0xfffff008); /* SCS[3:2] */
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_2, 0xfffff008); /* CS[2:0] */
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_3, 0xfffff008); /* CS[3], BootCS */
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_4, 0xfffff000); /* ISD MMIO */
+    pci_set_long(d->wmask + PCI_BASE_ADDRESS_5, 0xfffff001); /* ISD I/O */
+
     pci_set_long(d->config + PCI_BASE_ADDRESS_0, 0x00000008);
     pci_set_long(d->config + PCI_BASE_ADDRESS_1, 0x01000008);
     pci_set_long(d->config + PCI_BASE_ADDRESS_2, 0x1c000000);
     pci_set_long(d->config + PCI_BASE_ADDRESS_3, 0x1f000000);
     pci_set_long(d->config + PCI_BASE_ADDRESS_4, 0x14000000);
     pci_set_long(d->config + PCI_BASE_ADDRESS_5, 0x14000001);
+
     pci_set_byte(d->config + 0x3d, 0x01);
 }
 
-- 
2.45.2



  parent reply	other threads:[~2024-08-06 12:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 12:51 [PULL 00/28] Misc HW & UI patches for 2024-08-06 Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 01/28] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState Philippe Mathieu-Daudé
2024-08-07  7:14   ` maobibo
2024-08-07  7:24     ` Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 02/28] hw/intc/loongson_ipi: Extract loongson_ipi_common_realize() Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 03/28] hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 04/28] hw/intc/loongson_ipi: Move common definitions to loongson_ipi_common.h Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 05/28] hw/intc/loongson_ipi: Move IPICore::mmio_mem to LoongsonIPIState Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 06/28] hw/intc/loongson_ipi: Move IPICore structure to loongson_ipi_common.h Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 07/28] hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data() Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 08/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 09/28] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::cpu_by_arch_id handler Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 10/28] hw/intc/loongson_ipi: Expose loongson_ipi_core_read/write helpers Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 11/28] hw/intc/loongson_ipi: Move common code to loongson_ipi_common.c Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 12/28] hw/intc/loongarch_ipi: Add loongarch IPI support Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 13/28] hw/loongarch/virt: Replace Loongson IPI with LoongArch IPI Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 14/28] hw/intc/loongson_ipi: Restrict to MIPS Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 15/28] hw/sd/sdcard: Explicit dummy byte value Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 16/28] hw/sd/sdcard: Do not abort when reading DAT lines on invalid cmd state Philippe Mathieu-Daudé
2024-08-11  7:41   ` Michael Tokarev
2024-08-06 12:51 ` [PULL 17/28] hw/sd/sdhci: Reset @data_count index on invalid ADMA transfers Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 18/28] hw/block/pflash_cfi01: Don't decrement pfl->counter below 0 Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 19/28] hw/ide/atapi: Be explicit that assigning to s->lcyl truncates Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 20/28] hw/block/fdc-isa: Assert that isa_fdc_get_drive_max_chs() found something Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 21/28] hw/ide/pci: Remove dead code from bmdma_prepare_buf() Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 22/28] hw/display/virtio-gpu: Improve "opengl is not available" error message Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 23/28] system/vl.c: Expand OpenGL related errors Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 24/28] ui/console: Note in '-display help' that some backends support suboptions Philippe Mathieu-Daudé
2024-08-06 12:51 ` Philippe Mathieu-Daudé [this message]
2024-08-06 12:51 ` [PULL 26/28] hw/pci-host/gt64120: Reset config registers during RESET phase Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 27/28] docs/specs/pci-ids: Add missing devices Philippe Mathieu-Daudé
2024-08-06 12:51 ` [PULL 28/28] docs/specs/pci-ids: Fix markup Philippe Mathieu-Daudé
2024-08-06 21:08 ` [PULL 00/28] Misc HW & UI patches for 2024-08-06 Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240806125157.91185-26-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).