From patchwork Fri Jan 15 14:11:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 59859 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp570382lbb; Fri, 15 Jan 2016 06:12:50 -0800 (PST) X-Received: by 10.55.215.149 with SMTP id t21mr13257923qkt.33.1452867170383; Fri, 15 Jan 2016 06:12:50 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z69si13471970qhb.64.2016.01.15.06.12.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Jan 2016 06:12:50 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro.org Received: from localhost ([::1]:47089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK57R-0001pH-Pe for patch@linaro.org; Fri, 15 Jan 2016 09:12:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK56o-0001CP-Sd for qemu-devel@nongnu.org; Fri, 15 Jan 2016 09:12:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aK56k-00067x-Uw for qemu-devel@nongnu.org; Fri, 15 Jan 2016 09:12:10 -0500 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:33717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aK56k-00067a-OP for qemu-devel@nongnu.org; Fri, 15 Jan 2016 09:12:06 -0500 Received: by mail-pa0-x229.google.com with SMTP id cy9so395422736pac.0 for ; Fri, 15 Jan 2016 06:12:05 -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=HzYSyNbIHIM0LKwPS9UC0ZmtPGSDoxuinA4AemCmvPQ=; b=h8WTCozuTWY68wQZEugIfEclJU9pKe64R+L1OY46I/DyeUX3WsT80uymQ94jNNsTxU NKYXXECxY13+jnvigGVvjsZnongvh30ias31orLE6G/mdrc6jFQoe5yEalLEpZAKmNPN Oqw/P3LKEs6MhyQWJhRYbJxFSdWwcS1GOMTaY= 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=HzYSyNbIHIM0LKwPS9UC0ZmtPGSDoxuinA4AemCmvPQ=; b=JMtKEfHC3B720Lpf0SuFL/bTGgLmpW16l+KtbqLdG6gBstPjkrGeZ5aglgtWfmybGa c8H2sE0Q4pEar+vNAELKBZ8uXV/0VqeGy3aeir1ZPKA2trvZU7IRfPvSezBbrdEfSNk5 WqBbtADZc0DPtzO0+muHVugeZoe+qlHWNsWuOpjVSJMVkfKf8XDmHeyGrfGyrrwaT4rh J/bblzInURKSN5b0Rxq5XfZgrv06tW6uyGrVIpc8+goJQwPcod1S2TAaTn6O+SVC58eu 1CCh9Yf1XXurT4w7Xc7DyZQpsgT1iGXNrVnE+XMQfoiWNjvSjh+IbyxGEAqLfm4pSvdR DEGQ== X-Gm-Message-State: ALoCoQmxP7YBGv/gEYpO4Vkuixk7I4+Dme3fGG88WYubeM5q8cFgy6DKrWyDNej1fymd55h2HZcMgv4+buRv+8VB1l99LPEGOA== X-Received: by 10.66.237.66 with SMTP id va2mr15282882pac.87.1452867124698; Fri, 15 Jan 2016 06:12:04 -0800 (PST) Received: from localhost.localdomain ([39.183.91.190]) by smtp.gmail.com with ESMTPSA id v26sm15908392pfi.56.2016.01.15.06.12.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jan 2016 06:12:03 -0800 (PST) From: Shannon Zhao To: qemu-arm@nongnu.org Date: Fri, 15 Jan 2016 22:11:31 +0800 Message-Id: <1452867091-4023-1-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::229 Cc: peter.maydell@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@ml01.01.org, qemu-devel@nongnu.org, zhaoshenglong@huawei.com, lersek@redhat.com Subject: [Qemu-devel] [PATCH v3] ARM: Virt: Don't generate RTC ACPI device when using UEFI X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 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 the VM with UEFI, UEFI takes ownership of the RTC hardware. While UEFI can use libfdt to disable the RTC device node in the DTB that it passes to the OS, it cannot modify AML. Therefore, we won't generate the RTC ACPI device at all when using UEFI. Signed-off-by: Shannon Zhao Acked-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- V3: add comments to explain why it doesn't generate RTC ACPI device --- hw/arm/virt-acpi-build.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) -- 2.1.0 Reviewed-by: Andrew Jones diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 0caf5ce..0d5c635 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -94,23 +94,6 @@ static void acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap, aml_append(scope, dev); } -static void acpi_dsdt_add_rtc(Aml *scope, const MemMapEntry *rtc_memmap, - uint32_t rtc_irq) -{ - Aml *dev = aml_device("RTC0"); - aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0013"))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); - - Aml *crs = aml_resource_template(); - aml_append(crs, aml_memory32_fixed(rtc_memmap->base, - rtc_memmap->size, AML_READ_WRITE)); - aml_append(crs, - aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH, - AML_EXCLUSIVE, &rtc_irq, 1)); - aml_append(dev, aml_name_decl("_CRS", crs)); - aml_append(scope, dev); -} - static void acpi_dsdt_add_flash(Aml *scope, const MemMapEntry *flash_memmap) { Aml *dev, *crs; @@ -571,12 +554,15 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) /* Reserve space for header */ acpi_data_push(dsdt->buf, sizeof(AcpiTableHeader)); + /* When booting the VM with UEFI, UEFI takes ownership of the RTC hardware. + * While UEFI can use libfdt to disable the RTC device node in the DTB that + * it passes to the OS, it cannot modify AML. Therefore, we won't generate + * the RTC ACPI device at all when using UEFI. + */ scope = aml_scope("\\_SB"); acpi_dsdt_add_cpus(scope, guest_info->smp_cpus); acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); - acpi_dsdt_add_rtc(scope, &memmap[VIRT_RTC], - (irqmap[VIRT_RTC] + ARM_SPI_BASE)); acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]); acpi_dsdt_add_virtio(scope, &memmap[VIRT_MMIO], (irqmap[VIRT_MMIO] + ARM_SPI_BASE), NUM_VIRTIO_TRANSPORTS);