From patchwork Thu Aug 1 09:13:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816033 Delivered-To: patch@linaro.org Received: by 2002:a5d:4acf:0:b0:367:895a:4699 with SMTP id y15csp1094390wrs; Thu, 1 Aug 2024 02:14:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX1H+sWq2VkYbUDWi6i9NSMvjUNDAHq/doKsMEP4hERcBEX5nBBKgyuIAqrBmS4/fM61YGCN9GUb5Tpk+h6QZco X-Google-Smtp-Source: AGHT+IFLFnfXI9Rq9T26+B15oJ3pHAhj3ckk40BzNjbO9UEbTbnfeB4F/LWZxpZfQvhnNj9OV6MC X-Received: by 2002:a05:6358:108:b0:1ac:f3df:3be1 with SMTP id e5c5f4694b2df-1af2ed2726emr275088755d.4.1722503648693; Thu, 01 Aug 2024 02:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722503648; cv=none; d=google.com; s=arc-20160816; b=Fxh/9JSz3S9k+JN8y3/8kG9P4ZrAMsr8Ul30J6b3igHjzNkQ9tOX/llxUgwuYfSMuL wB7G91Azi54oOBm5M2V84lUvYLd/ReHpLvTenWuWS3fVPd2B7Q0JaPAHYUDmhcX7S7in vh0WEGGn2aceW43KTWyYoBDRiOxhx2x8bw5uaP0wGSm2WardnkufeUB6gBfzpCBZlbHa qlUl/5bjhEhqTEQyYeVVZf0lPQxYXx+R3pCl1KJ9Qglwp5jQX5kfO287GPbtxoRuk0y4 l5yX9xxkSo1s2EFeY6cjvOKN13kVILvhjLhkftywQ8cL94oBBC8bFCdAwzJ5UttirXMj BSCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=VBO+j2SR1ZsWcanf9TAJdGUloHo2mhXLXHkhbDgN34A=; fh=chpn9rOfago3JEo58cPtVpgDiZb6KVxLpSs96iqCu7k=; b=HZSw0wCgySFxcCi06nsbN9TrKpTC2ifqGbAWxMaFXmkERVQkMAQD0Hng+EBgMBU2Ns hblFPyT78gbVn/Th9k0UBDQfjuj6o6L51EXEGbisKjIYdRgZCKOlGTvESwi7bStd/Lrf kXx1oXIEUTB0USQbEliyxLEwILgdGYOaKs44aDrgVThYfAjxo9zb+hz1d5y1bhMR+/au xIIQ23J2TwPWjGzcjo3RiYwCxVKGLfW6tfhoQc6iv1LJpCb3AewH/eZbAbgsGLkw7Jyd pFbVXQLTCboEbjOzJ4M3ora2QyaRohrZRkzklQFOPJ3t+a3PBaxp2NFUKWupyV1i14oz ZePw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TLbQoLqM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6bb3fad4768si171998896d6.457.2024.08.01.02.14.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Aug 2024 02:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TLbQoLqM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZRsT-0005uz-2G; Thu, 01 Aug 2024 05:13:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sZRsR-0005h8-2y for qemu-devel@nongnu.org; Thu, 01 Aug 2024 05:13:39 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sZRsP-0007lX-E9 for qemu-devel@nongnu.org; Thu, 01 Aug 2024 05:13:38 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a7d26c2297eso825197066b.2 for ; Thu, 01 Aug 2024 02:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722503615; x=1723108415; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VBO+j2SR1ZsWcanf9TAJdGUloHo2mhXLXHkhbDgN34A=; b=TLbQoLqMq3J9BMfps2Qx5V7khyiN2OT7u8vPRD/Nzv61UexWXj1/crb5RYa/D9AL8l v0AvrbkkFUTrLec7Llmp/8FHHvIp2N/uQF0/V6X4K9nSI7iAVtwQwOD4KxjQK97sQt6U Kk4lgMDJjeQbbgVyW0B2ytvqzVL/mwMGbuqAfEMJ4N3CTHNOD8jxb5mA9DUitG5MSHXT hbEbkSEHZgbs40dn7SQEa00bun1h2mI4KkH9ej7WNf2ztZOPLAz6abyxdrzyk0o/CQea EMF7+HsuuzLtI/XTho6h2zz9RsVuYpdejuMzzr0U2ixxCw7mA5ZZwltWOcZN8iNUdmAo +rVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722503615; x=1723108415; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VBO+j2SR1ZsWcanf9TAJdGUloHo2mhXLXHkhbDgN34A=; b=Pm6+npM4GCdFgzWjbHLTBn+v4R/h8ScbUsaDsuVjUHdRRxRUXGEQM1v/N2yN/mfXbB RwtfLZrOtgkGdfk/8QR02a4nhaMknLh7lyeMfPEKF16kbii+o5cqijPycadQVnD/HZ+D /JlmnBzBvAoa+FIwJXqq9klSPtxAFW2GQM1Mn8ow12bew6rLgfruQhwctlEIHlVW6NON hJr1HSXX84HEPmNLxV0X5anmdxRJM0B8OfJOFE/P/FMP9NbrDZFAVot81+vQu6tHAq9z 2Ppc3CsyvbTRmJ0mEGR7OcIXLwvYeo7XkFjqD9zm8mI+YlLmArUeHxdu0ov5F8lVdZrJ ZrnA== X-Gm-Message-State: AOJu0YxhBLnimNrONAO5j126nfSOv4U7IpGjW2g2fnj9nvbtqmyQrsrn ZPaqr0CWvGfuEjA1iu5AUhlD0nSOSmIxwQhaYhpmp/vRxrdMXbRuudBorOF2QhdA+9PJrbMpneb r X-Received: by 2002:a17:907:8dcf:b0:a7a:a5ae:11bd with SMTP id a640c23a62f3a-a7daf9c9045mr129556266b.67.1722503615301; Thu, 01 Aug 2024 02:13:35 -0700 (PDT) Received: from m1x-phil.lan ([176.176.130.148]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acab23f21sm869694266b.37.2024.08.01.02.13.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 01 Aug 2024 02:13:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: "Michael S . Tsirkin" , Aurelien Jarno , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH-for-9.1] hw/pci-host/gt64120: Set PCI base address register write mask Date: Thu, 1 Aug 2024 11:13:32 +0200 Message-ID: <20240801091332.49256-1-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 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-0x14000007] 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é --- hw/pci-host/gt64120.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/gt64120.c b/hw/pci-host/gt64120.c index e02efc9e2e..0b00e98e0a 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,28 @@ 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, 0xfffff009); + pci_set_long(d->wmask + PCI_BASE_ADDRESS_1, 0xfffff009); + pci_set_long(d->wmask + PCI_BASE_ADDRESS_2, 0xfffff009); + pci_set_long(d->wmask + PCI_BASE_ADDRESS_3, 0xfffff009); + pci_set_long(d->wmask + PCI_BASE_ADDRESS_4, 0xfffff009); + pci_set_long(d->wmask + PCI_BASE_ADDRESS_5, 0xfffff009); + 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); }