Skip to contentSkip to conversation

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

PATCH Superseded Shannon Zhao 5 participants 7 messages Jan 13, 2016 – Jan 15, 2016

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: Virt: Don't generate RTC ACPI device when using UEFI

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.

---
v2: just totally don't generate the RTC ACPI device when using UEFI

---
 hw/arm/virt-acpi-build.c | 19 -------------------
 1 file changed, 19 deletions(-)
hw/arm/virt-acpi-build.c +0 -19
index 0caf5ce..ac568a3 100644
@@ -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;
@@ -575,8 +558,6 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
     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);
Signature · 1 line
2.1.0
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Shannon Zhao

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.

---

Quoted 45 lines

v2: just totally don't generate the RTC ACPI device when using UEFI

---
 hw/arm/virt-acpi-build.c | 19 -------------------
 1 file changed, 19 deletions(-)
hw/arm/virt-acpi-build.c +0 -20
index 0caf5ce..ac568a3 100644
@@ -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;
@@ -575,8 +558,6 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
     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 on v2 1/1
#2 lore raw
In reply to Shannon Zhao
Quoted 42 lines · Shannon Zhao

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.

---
v2: just totally don't generate the RTC ACPI device when using UEFI

---
 hw/arm/virt-acpi-build.c | 19 -------------------
 1 file changed, 19 deletions(-)
hw/arm/virt-acpi-build.c +0 -17
index 0caf5ce..ac568a3 100644
@@ -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;

hw/arm/virt-acpi-build.c build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) · line 563

Quoted 8 lines
hw/arm/virt-acpi-build.c +0 -2
@@ -575,8 +558,6 @@ build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
     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);
#3 lore raw
In reply to Shannon Zhao
Quoted 4 lines · Shannon Zhao

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.

I think a condensed comment similar to this commit message would be nice in build_dsdt, or somewhere. We have a policy for mach-virt of generating ACPI for everything we generate DT. It'd be good if we documented all the divergences in order to avoid confusion. I won't insist though.

Thanks,
drew

#4 lore raw
Quoted 10 lines · Andrew Jones
Quoted 4 lines · Shannon Zhao

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.

I think a condensed comment similar to this commit message would be nice in build_dsdt, or somewhere. We have a policy for mach-virt of generating ACPI for everything we generate DT. It'd be good if we documented all the divergences in order to avoid confusion. [...]

Good idea!

Thanks
Laszlo

Reviewed-by
#5 lore raw
Quoted 7 lines · Laszlo Ersek
Quoted 6 lines · Andrew Jones
Quoted 4 lines · Shannon Zhao

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.

Quoted 6 lines
Quoted 4 lines

I think a condensed comment similar to this commit message would be nice in build_dsdt, or somewhere. We have a policy for mach-virt of generating ACPI for everything we generate DT. It'd be good if we documented all the divergences in order to avoid confusion. [...]

Good idea!

I'm happy with the code in this patch, so you can add my

Shannon, I'm assuming you're planning a v3 with the comment that Andrew and Laszlo suggest.

thanks
-- PMM

#6 lore raw
Quoted 8 lines · Peter Maydell
Quoted 7 lines · Laszlo Ersek
Quoted 7 lines · Andrew Jones
Quoted 6 lines
Quoted 6 lines · Shannon Zhao
Quoted 4 lines
Quoted 4 lines

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.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

I think a condensed comment similar to this commit message would be nice in build_dsdt, or somewhere. We have a policy for mach-virt of generating ACPI for everything we generate DT. It'd be good if we documented all the divergences in order to avoid confusion. [...]

Good idea!

I'm happy with the code in this patch, so you can add my

Sorry, missed this. I've sent the v3.

Quoted 2 lines

Shannon, I'm assuming you're planning a v3 with the comment that Andrew and Laszlo suggest.

Signature · 1 line
Shannon