diff mbox

[v3] ARM: Virt: Don't generate RTC ACPI device when using UEFI

Message ID 1452867091-4023-1-git-send-email-shannon.zhao@linaro.org
State Superseded
Headers show

Commit Message

Shannon Zhao Jan. 15, 2016, 2:11 p.m. UTC
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 <shannon.zhao@linaro.org>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

---
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

Comments

Andrew Jones Jan. 15, 2016, 2:18 p.m. UTC | #1
On Fri, Jan 15, 2016 at 10:11:31PM +0800, Shannon Zhao wrote:
> 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 <shannon.zhao@linaro.org>

> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

> ---

> 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(-)

> 

> 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);

> -- 

> 2.1.0

> 

>


Reviewed-by: Andrew Jones <drjones@redhat.com>
Peter Maydell Jan. 15, 2016, 2:53 p.m. UTC | #2
On 15 January 2016 at 14:11, Shannon Zhao <shannon.zhao@linaro.org> wrote:
> 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 <shannon.zhao@linaro.org>

> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

> ---

> V3: add comments to explain why it doesn't generate RTC ACPI device




Applied to target-arm.next, thanks.

-- PMM
diff mbox

Patch

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);