From patchwork Fri Mar 11 02:53:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 63752 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp794902lbc; Thu, 10 Mar 2016 18:53:46 -0800 (PST) X-Received: by 10.66.65.228 with SMTP id a4mr8502139pat.4.1457664826772; Thu, 10 Mar 2016 18:53:46 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id tw2si159888pab.238.2016.03.10.18.53.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Mar 2016 18:53:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6A4501A1F5F; Thu, 10 Mar 2016 18:54:01 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6A3E71A1EF8 for ; Thu, 10 Mar 2016 18:54:00 -0800 (PST) Received: by mail-pa0-x231.google.com with SMTP id td3so54825894pab.2 for ; Thu, 10 Mar 2016 18:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pfbusxAsdYA5s9MfMoFlMO0mdjDS495EYl1ApeDjx3M=; b=fcbZKrUSFzWAbPjR2PqgYYrREy1ryUq8DSg1Y3bmngtqpzcJFX9lxIo/g7NNQhlUq+ 7wWbiQE8Xh1IbFt+TKlv4WYgqGUljl3+nnb4xnPVcdHMineSX46xRYi+DlYG44txzMch YJclnBCt1/0XE0ZbemSKL2ozL+P0ujCfEv17k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pfbusxAsdYA5s9MfMoFlMO0mdjDS495EYl1ApeDjx3M=; b=d5iDWNKTVTZyt0X0yjaq1XW9ptq6Pm2z1w1jKYV0qvLTXtXknD52cg1ABoNdsHV+Pq TqU48Tou1Z9UcEexK3bHJS+sk2ew3/LApOkgYRIsVGoQcxCtqlj3TJ7Zu5Nw8nrbg2Gb Ya+/Wx8l2Z6stp3jrzBiIUwdomWWpfSsIzJUWf8a6n9bTjdIQSBtGjuOIFPttdoyznQB Izp4PLQn88w5OqdHxKYW9YlkP7dxPs5RBZbVThbUKbYtcsu3cpwiBd0WZOIUWAndzbTx SXJ84XGlpsD7SedL8hivdoCpSIoVSJ7w3hU+AL0FdmFJqmec1slrikFgA1dBG4Qpm2v+ 5tPg== X-Gm-Message-State: AD7BkJJ2dzdPS/ENWukjemDi1+lrYnkqqmOFqQEAnuNkKcOxUZb8VVWsSBSSBogPvrnynUeS X-Received: by 10.66.62.169 with SMTP id z9mr9885828par.139.1457664824927; Thu, 10 Mar 2016 18:53:44 -0800 (PST) Received: from ards-macbook-pro.cgcwfunction (110-170-137-253.static.asianet.co.th. [110.170.137.253]) by smtp.gmail.com with ESMTPSA id n68sm8506289pfj.46.2016.03.10.18.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Mar 2016 18:53:43 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Date: Fri, 11 Mar 2016 09:53:38 +0700 Message-Id: <1457664818-12175-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: Ard Biesheuvel Subject: [edk2] [PATCH] ArmVirtPkg/VirtFdtDxe: set /chosen/linux, pci-probe-only to 1 in DTB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Unlike Linux on x86, which typically honors the PCI configuration performed by the firmware, Linux on ARM assumes that the PCI subsystem needs to be configured from scratch. This is not entirely unreasonable given the historical background of embedded systems using very basic bootloaders, but is no longer tenable with Linux on arm64 moving to UEFI and ACPI in the server space. For this reason, PCI support in the arm64 kernel running under ACPI is likely to move to the x86 model of honoring the PCI configuration done by the firmware. So let's align with that in our DT based configuration as well, and set the /chosen/linux,pci-probe-only property to 1 in the Device Tree before we hand it to the OS. In case we are exposing an emulated VGA PCI device to the guest, which may subsequently get exposed via the Graphics Output protocol and driven as an efifb by the OS, this ensures the PCI resource allocations for the framebuffer are not overridden, since that would cause the framebuffer to stop working. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c index 74f80d1d2b78..36484a0bbb7e 100644 --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c @@ -286,6 +286,7 @@ InitializeVirtFdtDxe ( VOID *DeviceTreeBase; INT32 Node, Prev; INT32 RtcNode; + INT32 ChosenNode; EFI_STATUS Status; CONST CHAR8 *Type; INT32 Len; @@ -356,8 +357,28 @@ InitializeVirtFdtDxe ( ASSERT (Len == 2 * sizeof (UINT64)); Status = ProcessPciHost (DeviceTreeBase, Node, RegProp); ASSERT_EFI_ERROR (Status); - break; + // + // Set the /chosen/linux,pci-probe-only property to 1, so that the PCI + // setup we will perform in the firmware is honored by the Linux OS, + // rather than torn down and done from scratch. This is generally a more + // sensible approach, and aligns with what ACPI based OSes do in general. + // + // In case we are exposing an emulated VGA PCI device to the guest, which + // may subsequently get exposed via the Graphics Output protocol and + // driven as an efifb by Linux, we need this setting to prevent the + // framebuffer from becoming unresponsive. + // + ChosenNode = fdt_path_offset (DeviceTreeBase, "/chosen"); + if (ChosenNode < 0) { + ChosenNode = fdt_add_subnode (DeviceTreeBase, 0, "/chosen"); + } + if (ChosenNode < 0) { + DEBUG ((EFI_D_WARN, "Failed to set /chosen/linux,pci-probe-only property")); + break; + } + fdt_setprop_u32 (DeviceTreeBase, ChosenNode, "linux,pci-probe-only", 1); + break; case PropertyTypeFwCfg: ASSERT (Len == 2 * sizeof (UINT64));