lib: Move acpi header and implementation to lib
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/23 lib: Move acpi header and implementation to lib
This change is in preparation of using ACPI in arm64 systems booting with EFI.
---
x86/Makefile.common | 2 +-
lib/x86/asm/setup.h | 2 +-
lib/{x86 => }/acpi.h | 4 ++--
lib/{x86 => }/acpi.c | 0
x86/s3.c | 2 +-
x86/vmexit.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
rename lib/{x86 => }/acpi.h (99%)
rename lib/{x86 => }/acpi.c (100%)x86/Makefile.common +1 -1
@@ -2,6 +2,7 @@ all: directories test_cases +cflatobjs += lib/acpi.o cflatobjs += lib/pci.o cflatobjs += lib/pci-edu.o cflatobjs += lib/alloc.o
@@ -18,7 +19,6 @@ cflatobjs += lib/x86/apic.o cflatobjs += lib/x86/atomic.o cflatobjs += lib/x86/desc.o cflatobjs += lib/x86/isr.o -cflatobjs += lib/x86/acpi.o cflatobjs += lib/x86/stack.o cflatobjs += lib/x86/fault_test.o cflatobjs += lib/x86/delay.o
lib/x86/asm/setup.h +1 -1
@@ -4,7 +4,7 @@unsigned long setup_tss (u8 *stacktop);#ifdef CONFIG_EFI -#include "x86/acpi.h" +#include "acpi.h" #include "x86/apic.h" #include "x86/processor.h" #include "x86/smp.h"
lib/acpi.h renamed from lib/x86/acpi.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _X86_ACPI_H_ -#define _X86_ACPI_H_ +#ifndef _ACPI_H_ +#define _ACPI_H_#include "libcflat.h"
lib/acpi.c renamed from lib/x86/acpi.c +0 -0
x86/s3.c +1 -1
@@ -1,5 +1,5 @@#include "libcflat.h" -#include "x86/acpi.h" +#include "acpi.h" #include "asm/io.h" static u32 *find_resume_vector_addr (void )
x86/vmexit.c +1 -1
@@ -1,9 +1,9 @@ +#include "acpi.h" #include "libcflat.h" #include "smp.h" #include "pci.h" #include "x86/vm.h" #include "x86/desc.h" -#include "x86/acpi.h" #include "x86/apic.h" #include "x86/isr.h"
Signature · 1 line
2.25.1
PATCH 2/23 lib: Ensure all struct definition for ACPI tables are packed
In reply to a message not in the archiveAll ACPI table definitions are provided with precise definitions of field sizes and offsets, make sure that no compiler optimization can interfere with the memory layout of the corresponding structs.
--- lib/acpi.h | 11 ++++++++--- x86/s3.c | 16 ++++------------ 2 files changed, 12 insertions(+), 15 deletions(-)
lib/acpi.h +8 -3
@@ -3,6 +3,11 @@#include "libcflat.h" +/* +* All tables and structures must be byte-packed to match the ACPI +* specification, since the tables are provided by the system BIOS +*/ +#define ACPI_SIGNATURE (c1, c2, c3, c4) \ ((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24))
@@ -44,12 +49,12 @@ struct rsdp_descriptor { /* Root System Descriptor Pointer */struct acpi_table {ACPI_TABLE_HEADER_DEF char data[0]; -}; +} __attribute__ ((packed));struct rsdt_descriptor_rev1 {ACPI_TABLE_HEADER_DEF u32 table_offset_entry[0]; -}; +} __attribute__ ((packed));;struct fadt_descriptor_rev1 {
@@ -104,7 +109,7 @@ struct facs_descriptor_rev1 u32 S4bios_f : 1; /* Indicates if S4BIOS support is present */ u32 reserved1 : 31; /* Must be 0 */u8 reserved3 [40 ];/* Reserved - must be zero */ -}; +} __attribute__ ((packed));void set_efi_rsdp (struct rsdp_descriptor *rsdp);void *find_acpi_table_addr (u32 sig);
x86/s3.c +4 -12
@@ -2,15 +2,6 @@#include "acpi.h" #include "asm/io.h" -static u32 *find_resume_vector_addr (void ) -{ -struct facs_descriptor_rev1 *facs =find_acpi_table_addr (FACS_SIGNATURE ); -if (!facs) -return 0 ; -printf ("FACS is at %p\n" , facs); -return &facs->firmware_waking_vector; -} -#define RTC_SECONDS_ALARM 1#define RTC_MINUTES_ALARM 3#define RTC_HOURS_ALARM 5
@@ -40,12 +31,13 @@ extern char resume_start, resume_end;int main (int argc,char **argv) {struct fadt_descriptor_rev1 *fadt =find_acpi_table_addr (FACP_SIGNATURE ); -volatile u32 *resume_vector_ptr =find_resume_vector_addr (); +struct facs_descriptor_rev1 *facs =find_acpi_table_addr (FACS_SIGNATURE );char *addr, *resume_vec = (void *)0x1000 ; - *resume_vector_ptr = (u32 )(ulong )resume_vec; + facs->firmware_waking_vector = (u32 )(ulong )resume_vec; -printf ("resume vector addr is %p\n" , resume_vector_ptr); +printf ("FACS is at %p\n" , facs); +printf ("resume vector addr is %p\n" , &facs->firmware_waking_vector);for (addr = &resume_start; addr < &resume_end; addr++) *resume_vec++ = *addr;printf ("copy resume code from %p\n" , &resume_start);
Signature · 1 line
2.25.1
PATCH 4/23 lib: Extend the definition of the ACPI table FADT
In reply to a message not in the archiveThis change add more fields in the APCI table FADT to allow for the discovery of the PSCI conduit in arm64 systems. The definition for FADT is similar to the one in include/acpi/actbl.h in Linux.
--- lib/acpi.h | 35 ++++++++++++++++++++++++++++++----- lib/acpi.c | 2 +- x86/s3.c | 2 +- x86/vmexit.c | 2 +- 4 files changed, 33 insertions(+), 8 deletions(-)
lib/acpi.h +30 -5
@@ -62,7 +62,15 @@ struct acpi_table_xsdt {u64 table_offset_entry[1 ]; } __attribute__ ((packed)); -struct fadt_descriptor_rev1 +struct acpi_generic_address { +u8 space_id;/* Address space where struct or register exists */ +u8 bit_width;/* Size in bits of given register */ +u8 bit_offset;/* Bit offset within the register */ +u8 access_width;/* Minimum Access size (ACPI 3.0) */ +u64 address;/* 64-bit address of struct or register */ +} __attribute__ ((packed)); + +struct acpi_table_fadt {ACPI_TABLE_HEADER_DEF /* ACPI common table header */ u32 firmware_ctrl; /* Physical address of FACS */
@@ -100,10 +108,27 @@ struct fadt_descriptor_rev1u8 day_alrm;/* Index to day-of-month alarm in RTC CMOS RAM */ u8 mon_alrm;/* Index to month-of-year alarm in RTC CMOS RAM */ u8 century;/* Index to century in RTC CMOS RAM */ -u8 reserved4;/* Reserved */ -u8 reserved4a;/* Reserved */ -u8 reserved4b;/* Reserved */ -}; +u16 boot_flags;/* IA-PC Boot Architecture Flags (see below for individual flags) */ +u8 reserved;/* Reserved, must be zero */ +u32 flags;/* Miscellaneous flag bits (see below for individual flags) */ +struct acpi_generic_address reset_register;/* 64-bit address of the Reset register */ +u8 reset_value;/* Value to write to the reset_register port to reset the system */ +u16 arm_boot_flags;/* ARM-Specific Boot Flags (see below for individual flags) (ACPI 5.1) */ +u8 minor_revision;/* FADT Minor Revision (ACPI 5.1) */ +u64 Xfacs;/* 64-bit physical address of FACS */ +u64 Xdsdt;/* 64-bit physical address of DSDT */ +struct acpi_generic_address xpm1a_event_block;/* 64-bit Extended Power Mgt 1a Event Reg Blk address */ +struct acpi_generic_address xpm1b_event_block;/* 64-bit Extended Power Mgt 1b Event Reg Blk address */ +struct acpi_generic_address xpm1a_control_block;/* 64-bit Extended Power Mgt 1a Control Reg Blk address */ +struct acpi_generic_address xpm1b_control_block;/* 64-bit Extended Power Mgt 1b Control Reg Blk address */ +struct acpi_generic_address xpm2_control_block;/* 64-bit Extended Power Mgt 2 Control Reg Blk address */ +struct acpi_generic_address xpm_timer_block;/* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ +struct acpi_generic_address xgpe0_block;/* 64-bit Extended General Purpose Event 0 Reg Blk address */ +struct acpi_generic_address xgpe1_block;/* 64-bit Extended General Purpose Event 1 Reg Blk address */ +struct acpi_generic_address sleep_control;/* 64-bit Sleep Control register (ACPI 5.0) */ +struct acpi_generic_address sleep_status;/* 64-bit Sleep Status register (ACPI 5.0) */ +u64 hypervisor_id;/* Hypervisor Vendor ID (ACPI 6.0) */ +} __attribute__ ((packed));struct facs_descriptor_rev1 {
lib/acpi.c +1 -1
@@ -46,7 +46,7 @@ void* find_acpi_table_addr(u32 sig)/* FACS is special... */ if (sig ==FACS_SIGNATURE ) { -struct fadt_descriptor_rev1 *fadt; +struct acpi_table_fadt *fadt; fadt =find_acpi_table_addr (FACP_SIGNATURE );if (!fadt) {return NULL ;
x86/s3.c +1 -1
@@ -30,7 +30,7 @@ extern char resume_start, resume_end;int main (int argc,char **argv) { -struct fadt_descriptor_rev1 *fadt =find_acpi_table_addr (FACP_SIGNATURE ); +struct acpi_table_fadt *fadt =find_acpi_table_addr (FACP_SIGNATURE );struct facs_descriptor_rev1 *facs =find_acpi_table_addr (FACS_SIGNATURE );char *addr, *resume_vec = (void *)0x1000 ;
x86/vmexit.c +1 -1
@@ -206,7 +206,7 @@ int pm_tmr_blk;static void inl_pmtimer (void ) {if (!pm_tmr_blk) { -struct fadt_descriptor_rev1 *fadt; +struct acpi_table_fadt *fadt; fadt =find_acpi_table_addr (FACP_SIGNATURE ); pm_tmr_blk = fadt->pm_tmr_blk;
Signature · 1 line
2.25.1
PATCH 5/23 arm/arm64: Add support for setting up the PSCI conduit through ACPI
In reply to a message not in the archiveIn systems with ACPI support and when a DT is not provided, we can use the FADT to discover whether PSCI calls need to use smc or hvc calls. This change implements this but retains the default behavior; we check if a valid DT is provided, if not, we try to setup the PSCI conduit using ACPI.
--- arm/Makefile.common | 1 + lib/acpi.h | 5 +++++ lib/arm/psci.c | 23 ++++++++++++++++++++++- lib/devicetree.c | 2 +- 4 files changed, 29 insertions(+), 2 deletions(-)
arm/Makefile.common +1 -0
@@ -38,6 +38,7 @@ cflatobjs += lib/alloc_page.o cflatobjs += lib/vmalloc.o cflatobjs += lib/alloc.o cflatobjs += lib/devicetree.o +cflatobjs += lib/acpi.o cflatobjs += lib/pci.o cflatobjs += lib/pci-host-generic.o cflatobjs += lib/pci-testdev.o
lib/acpi.h +5 -0
@@ -130,6 +130,11 @@ struct acpi_table_fadtu64 hypervisor_id;/* Hypervisor Vendor ID (ACPI 6.0) */ } __attribute__ ((packed)); +/* Masks for FADT ARM Boot Architecture Flags (arm_boot_flags) ACPI 5.1 */ + +#define ACPI_FADT_PSCI_COMPLIANT (1)/* 00: [V5+] PSCI 0.2+ is implemented */ +#define ACPI_FADT_PSCI_USE_HVC (1<<1)/* 01: [V5+] HVC must be used instead of SMC as the PSCI conduit */ +struct facs_descriptor_rev1 {u32 signature;/* ACPI Signature */
lib/arm/psci.c +22 -1
@@ -6,6 +6,7 @@* * This work is licensed under the terms of the GNU LGPL, version 2. */ +#include <acpi.h> #include <devicetree.h> #include <asm/psci.h> #include <asm/setup.h>
@@ -56,7 +57,7 @@ void psci_system_off(void)printf ("CPU%d unable to do system off (error = %d)\n" ,smp_processor_id (), err); } -void psci_set_conduit (void ) +static void psci_set_conduit_fdt (void ) {const void *fdt =dt_fdt ();const struct fdt_property *method;
@@ -75,3 +76,23 @@ void psci_set_conduit(void)else assert_msg (false,"Unknown PSCI conduit: %s" , method->data); } + +static void psci_set_conduit_acpi (void ) +{ +struct acpi_table_fadt *fadt =find_acpi_table_addr (FACP_SIGNATURE ); +assert_msg (fadt,"Unable to find ACPI FADT" ); +assert_msg (fadt->arm_boot_flags &ACPI_FADT_PSCI_COMPLIANT , +"PSCI is not supported in this platfrom" ); +if (fadt->arm_boot_flags &ACPI_FADT_PSCI_USE_HVC ) + psci_invoke = psci_invoke_hvc; +else + psci_invoke = psci_invoke_smc; +} + +void psci_set_conduit (void ) +{ +if (dt_available ()) +psci_set_conduit_fdt (); +else +psci_set_conduit_acpi (); +}
lib/devicetree.c +1 -1
@@ -16,7 +16,7 @@ const void *dt_fdt(void)bool dt_available (void ) { -return fdt_check_header (fdt) ==0 ; +return fdt &&fdt_check_header (fdt) ==0 ; }int dt_get_nr_cells (int fdtnode,u32 *nr_address_cells,u32 *nr_size_cells)
Signature · 1 line
2.25.1
PATCH 6/23 arm/arm64: Add support for discovering the UART through ACPI
In reply to a message not in the archiveIn systems with ACPI support and when a DT is not provided, we can use the SPCR to discover the serial port address range. This change implements this but retains the default behavior; we check if a valid DT is provided, if not, we try to discover the UART using ACPI.
--- lib/acpi.h | 25 +++++++++++++++++++++++++ lib/arm/io.c | 21 +++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-)
lib/acpi.h +25 -0
@@ -16,6 +16,7 @@#define XSDT_SIGNATURE ACPI_SIGNATURE('X','S','D','T')#define FACP_SIGNATURE ACPI_SIGNATURE('F','A','C','P')#define FACS_SIGNATURE ACPI_SIGNATURE('F','A','C','S') +#define SPCR_SIGNATURE ACPI_SIGNATURE('S','P','C','R')#define ACPI_SIGNATURE_8BYTE (c1, c2, c3, c4, c5, c6, c7, c8) \
@@ -147,6 +148,30 @@ struct facs_descriptor_rev1u8 reserved3 [40 ];/* Reserved - must be zero */ } __attribute__ ((packed)); +struct spcr_descriptor { +ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ +u8 reserved[3 ]; +struct acpi_generic_address serial_port; +u8 interrupt_type; +u8 pc_interrupt; +u32 interrupt; +u8 baud_rate; +u8 parity; +u8 stop_bits; +u8 flow_control; +u8 terminal_type; +u8 reserved1; +u16 pci_device_id; +u16 pci_vendor_id; +u8 pci_bus; +u8 pci_device; +u8 pci_function; +u32 pci_flags; +u8 pci_segment; +u32 reserved2; +} __attribute__ ((packed)); +void set_efi_rsdp (struct rsdp_descriptor *rsdp);void *find_acpi_table_addr (u32 sig);
lib/arm/io.c +19 -2
@@ -8,6 +8,7 @@* * This work is licensed under the terms of the GNU LGPL, version 2. */ +#include <acpi.h> #include <libcflat.h> #include <devicetree.h> #include <chr-testdev.h>
@@ -29,7 +30,7 @@ static struct spinlock uart_lock;#define UART_EARLY_BASE (u8 *)(unsigned long)CONFIG_UART_EARLY_BASEstatic volatile u8 *uart0_base =UART_EARLY_BASE ; -static void uart0_init (void ) +static void uart0_init_fdt (void ) {/* * kvm-unit-tests uses the uart only for output. Both uart models have
@@ -73,9 +74,25 @@ static void uart0_init(void) } } +static void uart0_init_acpi (void ) +{ +struct spcr_descriptor *spcr =find_acpi_table_addr (SPCR_SIGNATURE ); +assert_msg (spcr,"Unable to find ACPI SPCR" ); + uart0_base =ioremap (spcr->serial_port.address, spcr->serial_port.bit_width); + +if (uart0_base !=UART_EARLY_BASE ) { +printf ("WARNING: early print support may not work. " +"Found uart at %p, but early base is %p.\n" , + uart0_base,UART_EARLY_BASE ); + } +} +void io_init (void ) { -uart0_init (); +if (dt_available ()) +uart0_init_fdt (); +else +uart0_init_acpi ();chr_testdev_init (); }
Signature · 1 line
2.25.1
PATCH 7/23 arm/arm64: Add support for timer initialization through ACPI
In reply to a message not in the archiveFor systems with ACPI support, we can discover timers through the ACPI GTDT table. This change implements the code to discover timers through the GTDT and adds ACPI support in timer_save_state. This change retains the default behavior; we check if a valid DT is provided, if not, we try to discover timers using ACPI.
--- arm/Makefile.common | 1 + lib/arm/asm/timer.h | 2 ++ lib/acpi.h | 18 ++++++++++++ lib/arm/setup.c | 39 ------------------------ lib/arm/timer.c | 72 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+), 39 deletions(-) create mode 100644 lib/arm/timer.c
arm/Makefile.common +1 -0
@@ -53,6 +53,7 @@ cflatobjs += lib/arm/psci.o cflatobjs += lib/arm/smp.o cflatobjs += lib/arm/delay.o cflatobjs += lib/arm/gic.o lib/arm/gic-v2.o lib/arm/gic-v3.o +cflatobjs += lib/arm/timer.o OBJDIRS += lib/arm
lib/arm/asm/timer.h +2 -0
@@ -27,5 +27,7 @@ extern struct timer_state __timer_state;#define TIMER_PTIMER_IRQ (__timer_state.ptimer.irq)#define TIMER_VTIMER_IRQ (__timer_state.vtimer.irq) +void timer_save_state (void ); +#endif /* !__ASSEMBLY__ */ #endif /* _ASMARM_TIMER_H_ */
lib/acpi.h +18 -0
@@ -17,6 +17,7 @@#define FACP_SIGNATURE ACPI_SIGNATURE('F','A','C','P')#define FACS_SIGNATURE ACPI_SIGNATURE('F','A','C','S')#define SPCR_SIGNATURE ACPI_SIGNATURE('S','P','C','R') +#define GTDT_SIGNATURE ACPI_SIGNATURE('G','T','D','T')#define ACPI_SIGNATURE_8BYTE (c1, c2, c3, c4, c5, c6, c7, c8) \
@@ -172,6 +173,23 @@ struct spcr_descriptor {u32 reserved2; } __attribute__ ((packed)); +struct acpi_table_gtdt { +ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u64 counter_block_addresss; +u32 reserved; +u32 secure_el1_interrupt; +u32 secure_el1_flags; +u32 non_secure_el1_interrupt; +u32 non_secure_el1_flags; +u32 virtual_timer_interrupt; +u32 virtual_timer_flags; +u32 non_secure_el2_interrupt; +u32 non_secure_el2_flags; +u64 counter_read_block_address; +u32 platform_timer_count; +u32 platform_timer_offset; +} __attribute__ ((packed)); +void set_efi_rsdp (struct rsdp_descriptor *rsdp);void *find_acpi_table_addr (u32 sig);
lib/arm/setup.c +0 -39
@@ -35,8 +35,6 @@extern unsigned long etext; -struct timer_state __timer_state; -char *initrd;u32 initrd_size;
@@ -199,43 +197,6 @@ static void mem_init(phys_addr_t freemem_start)page_alloc_ops_enable (); } -static void timer_save_state (void ) -{ -const struct fdt_property *prop; -const void *fdt =dt_fdt (); -int node, len; -u32 *data; - - node =fdt_node_offset_by_compatible (fdt,-1 ,"arm,armv8-timer" ); -assert (node >=0 || node == -FDT_ERR_NOTFOUND ); - -if (node == -FDT_ERR_NOTFOUND ) { - __timer_state.ptimer.irq =-1 ; - __timer_state.vtimer.irq =-1 ; -return ; - } - -/* -* From Linux devicetree timer binding documentation -* -* interrupts <type irq flags>: -* secure timer irq -* non-secure timer irq (ptimer) -* virtual timer irq (vtimer) -* hypervisor timer irq -*/ - prop =fdt_get_property (fdt, node,"interrupts" , &len); -assert (prop && len == (4 *3 *sizeof (u32))); - - data = (u32 *)prop->data; -assert (fdt32_to_cpu (data[3 ]) ==1 /* PPI */ ); - __timer_state.ptimer.irq =fdt32_to_cpu (data[4 ]); - __timer_state.ptimer.irq_flags =fdt32_to_cpu (data[5 ]); -assert (fdt32_to_cpu (data[6 ]) ==1 /* PPI */ ); - __timer_state.vtimer.irq =fdt32_to_cpu (data[7 ]); - __timer_state.vtimer.irq_flags =fdt32_to_cpu (data[8 ]); -} -void setup (const void *fdt,phys_addr_t freemem_start) {void *freemem;
lib/arm/timer.c new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 8/23 arm/arm64: Add support for cpu initialization through ACPI
In reply to a message not in the archiveIn systems with ACPI support and when a DT is not provided, we can use the MADTs to discover the number of CPUs and their corresponding MIDR. This change implements this but retains the default behavior; we check if a valid DT is provided, if not, we try to discover the cores in the system using ACPI.
--- lib/acpi.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/acpi.c | 21 ++++++++++++++++ lib/arm/setup.c | 25 ++++++++++++++++--- 3 files changed, 107 insertions(+), 3 deletions(-)
lib/acpi.h +64 -0
@@ -16,6 +16,7 @@#define XSDT_SIGNATURE ACPI_SIGNATURE('X','S','D','T')#define FACP_SIGNATURE ACPI_SIGNATURE('F','A','C','P')#define FACS_SIGNATURE ACPI_SIGNATURE('F','A','C','S') +#define MADT_SIGNATURE ACPI_SIGNATURE('A','P','I','C')#define SPCR_SIGNATURE ACPI_SIGNATURE('S','P','C','R')#define GTDT_SIGNATURE ACPI_SIGNATURE('G','T','D','T')
@@ -149,6 +150,67 @@ struct facs_descriptor_rev1u8 reserved3 [40 ];/* Reserved - must be zero */ } __attribute__ ((packed)); +struct acpi_table_madt { +ACPI_TABLE_HEADER_DEF /* ACPI common table header */ + u32 address; /* Physical address of local APIC */ +u32 flags; +} __attribute__ ((packed)); + +struct acpi_subtable_header { +u8 type; +u8 length; +} __attribute__ ((packed)); + +typedef int (*acpi_table_handler )(struct acpi_subtable_header *header); + +/* 11: Generic interrupt - GICC (ACPI 5.0 + ACPI 6.0 + ACPI 6.3 changes) */ + +struct acpi_madt_generic_interrupt { +u8 type; +u8 length; +u16 reserved;/* reserved - must be zero */ +u32 cpu_interface_number; +u32 uid; +u32 flags; +u32 parking_version; +u32 performance_interrupt; +u64 parked_address; +u64 base_address; +u64 gicv_base_address; +u64 gich_base_address; +u32 vgic_interrupt; +u64 gicr_base_address; +u64 arm_mpidr; +u8 efficiency_class; +u8 reserved2[1 ]; +u16 spe_interrupt;/* ACPI 6.3 */ +} __attribute__ ((packed)); + +/* Values for MADT subtable type in struct acpi_subtable_header */ + +enum acpi_madt_type { +ACPI_MADT_TYPE_LOCAL_APIC =0 , +ACPI_MADT_TYPE_IO_APIC =1 , +ACPI_MADT_TYPE_INTERRUPT_OVERRIDE =2 , +ACPI_MADT_TYPE_NMI_SOURCE =3 , +ACPI_MADT_TYPE_LOCAL_APIC_NMI =4 , +ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE =5 , +ACPI_MADT_TYPE_IO_SAPIC =6 , +ACPI_MADT_TYPE_LOCAL_SAPIC =7 , +ACPI_MADT_TYPE_INTERRUPT_SOURCE =8 , +ACPI_MADT_TYPE_LOCAL_X2APIC =9 , +ACPI_MADT_TYPE_LOCAL_X2APIC_NMI =10 , +ACPI_MADT_TYPE_GENERIC_INTERRUPT =11 , +ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR =12 , +ACPI_MADT_TYPE_GENERIC_MSI_FRAME =13 , +ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR =14 , +ACPI_MADT_TYPE_GENERIC_TRANSLATOR =15 , +ACPI_MADT_TYPE_RESERVED =16 /* 16 and greater are reserved */ +}; + +/* MADT Local APIC flags */ +#define ACPI_MADT_ENABLED (1)/* 00: Processor is usable if set */ +struct spcr_descriptor {ACPI_TABLE_HEADER_DEF /* ACPI common table header */ u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
@@ -192,5 +254,7 @@ struct acpi_table_gtdt {void set_efi_rsdp (struct rsdp_descriptor *rsdp);void *find_acpi_table_addr (u32 sig); +void acpi_table_parse_madt (enum acpi_madt_type mtype, +acpi_table_handler handler);#endif
lib/acpi.c +21 -0
@@ -102,3 +102,24 @@ void* find_acpi_table_addr(u32 sig)return NULL ; } + +void acpi_table_parse_madt (enum acpi_madt_type mtype, +acpi_table_handler handler) +{ +struct acpi_table_madt *madt; +void *end; + + madt =find_acpi_table_addr (MADT_SIGNATURE ); +assert (madt); + +struct acpi_subtable_header *header = + (void *)(ulong )madt +sizeof (struct acpi_table_madt ); + end = (void *)((ulong )madt + madt->length); + +while ((void *)header < end) { +if (header->type == mtype) { +handler (header); + } + header = (void *)(ulong )header + header->length; + } +}
lib/arm/setup.c +22 -3
@@ -13,6 +13,7 @@#include <libcflat.h> #include <libfdt/libfdt.h> #include <devicetree.h> +#include <acpi.h> #include <alloc.h> #include <alloc_phys.h> #include <alloc_page.h>
@@ -55,7 +56,7 @@ int mpidr_to_cpu(uint64_t mpidr)return -1 ; } -static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused) +static void cpu_set_fdt(int fdtnode __unused, u64 regval, void *info __unused) {int cpu = nr_cpus++;
@@ -65,13 +66,31 @@ static void cpu_set(int fdtnode __unused, u64 regval, void *info __unused)set_cpu_present (cpu, true); } +static int cpu_set_acpi (struct acpi_subtable_header *header) +{ +int cpu = nr_cpus++; +struct acpi_madt_generic_interrupt *gicc = (void *)header; + +assert_msg (cpu <NR_CPUS ,"Number cpus exceeds maximum supported (%d)." ,NR_CPUS ); + + cpus[cpu] = gicc->arm_mpidr; +set_cpu_present (cpu, true); + +return 0 ; +} +static void cpu_init (void ) {int ret; nr_cpus =0 ; - ret =dt_for_each_cpu_node (cpu_set,NULL ); -assert (ret ==0 ); +if (dt_available ()) { + ret =dt_for_each_cpu_node (cpu_set_fdt,NULL ); +assert (ret ==0 ); + }else +acpi_table_parse_madt (ACPI_MADT_TYPE_GENERIC_INTERRUPT , + cpu_set_acpi); +set_cpu_online (0 , true); }
Signature · 1 line
2.25.1
PATCH 12/23 arm/arm64: mmu_disable: Clean and invalidate before disabling
In reply to a message not in the archiveFrom: Andrew Jones <[email protected]>
The commit message of commit 410b3bf09e76 ("arm/arm64: Perform dcache clean + invalidate after turning MMU off") justifies cleaning and invalidating the dcache after disabling the MMU by saying it's nice not to rely on the current page tables and that it should still work (per the spec), as long as there's an identity map in the current tables. Doing the invalidation after also somewhat helped with reenabling the MMU without seeing stale data, but the real problem with reenabling was because the cache needs to be disabled with the MMU, but it wasn't.
Since we have to trust/validate that the current page tables have an identity map anyway, then there's no harm in doing the clean and invalidate first (it feels a little better to do so, anyway, considering the cache maintenance instructions take virtual addresses). Then, also disable the cache with the MMU to avoid problems when reenabling. We invalidate the Icache and disable that too for good measure. And, a final TLB invalidation ensures we're crystal clean when we return from asm_mmu_disable().
--- arm/cstart.S | 28 +++++++++++++++++++++------- arm/cstart64.S | 21 ++++++++++++++++----- 2 files changed, 37 insertions(+), 12 deletions(-)
arm/cstart.S +21 -7
@@ -179,6 +179,7 @@ halt: .globl asm_mmu_enable asm_mmu_enable: /* TLBIALL */ + mov r2, #0 mcr p15, 0, r2, c8, c7, 0 dsb nsh
@@ -211,12 +212,7 @@ asm_mmu_enable: .globl asm_mmu_disable asm_mmu_disable: - /* SCTLR */ - mrc p15, 0, r0, c1, c0, 0 - bic r0, #CR_M - mcr p15, 0, r0, c1, c0, 0 - isb - + /* Clean + invalidate the entire memory */ ldr r0, =__phys_offset ldr r0, [r0] ldr r1, =__phys_end
@@ -224,7 +220,25 @@ asm_mmu_disable: sub r1, r1, r0 dcache_by_line_op dccimvac, sy, r0, r1, r2, r3 - mov pc, lr + /* Invalidate Icache */ + mov r0, #0 + mcr p15, 0, r0, c7, c5, 0 + isb + + /* Disable cache, Icache and MMU */ + mrc p15, 0, r0, c1, c0, 0 + bic r0, #CR_C + bic r0, #CR_I + bic r0, #CR_M + mcr p15, 0, r0, c1, c0, 0 + isb + + /* Invalidate TLB */ + mov r0, #0 + mcr p15, 0, r0, c8, c7, 0 + dsb nsh + + mov pc, lr /* * Vectors
arm/cstart64.S +16 -5
@@ -246,11 +246,6 @@ asm_mmu_enable: .globl asm_mmu_disable asm_mmu_disable: - mrs x0, sctlr_el1 - bic x0, x0, SCTLR_EL1_M - msr sctlr_el1, x0 - isb - /* Clean + invalidate the entire memory */ adrp x0, __phys_offset ldr x0, [x0, :lo12:__phys_offset]
@@ -259,6 +254,22 @@ asm_mmu_disable: sub x1, x1, x0 dcache_by_line_op civac, sy, x0, x1, x2, x3 + /* Invalidate Icache */ + ic iallu + isb + + /* Disable cache, Icache and MMU */ + mrs x0, sctlr_el1 + bic x0, x0, SCTLR_EL1_C + bic x0, x0, SCTLR_EL1_I + bic x0, x0, SCTLR_EL1_M + msr sctlr_el1, x0 + isb + + /* Invalidate TLB */ + tlbi vmalle1 + dsb nsh + ret /*
Signature · 1 line
2.25.1
PATCH 13/23 arm/arm64: Rename etext to _etext
In reply to a message not in the archiveFrom: Andrew Jones <[email protected]>
Rename etext to the more popular _etext allowing different linker scripts to more easily be used.
--- lib/arm/setup.c | 4 ++-- arm/flat.lds | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/arm/setup.c +2 -2
@@ -34,7 +34,7 @@#define NR_EXTRA_MEM_REGIONS 16#define NR_INITIAL_MEM_REGIONS (MAX_DT_MEM_REGIONS + NR_EXTRA_MEM_REGIONS) -extern unsigned long etext; +extern unsigned long _etext;char *initrd;u32 initrd_size;
@@ -140,7 +140,7 @@ unsigned int mem_region_get_flags(phys_addr_t paddr)static void mem_regions_add_assumed (void ) { -phys_addr_t code_end = (phys_addr_t )(unsigned long )&etext; +phys_addr_t code_end = (phys_addr_t )(unsigned long )&_etext;struct mem_region *r; r =mem_region_find (code_end -1 );
arm/flat.lds +1 -1
@@ -27,7 +27,7 @@ SECTIONS PROVIDE(_text = .); .text : { *(.init) *(.text) *(.text.*) } . = ALIGN(64K); - PROVIDE(etext = .); + PROVIDE(_etext = .); PROVIDE(reloc_start = .); .rela.dyn : { *(.rela.dyn) }
Signature · 1 line
2.25.1
PATCH 15/23 arm64: Add a new type of memory type flag MR_F_RESERVED
In reply to a message not in the archiveFrom: Andrew Jones <[email protected]>
This will be used by future change to add PTE entries for special EFI memory regions.
--- lib/arm/asm/setup.h | 1 + lib/arm/mmu.c | 4 ++++ 2 files changed, 5 insertions(+)
lib/arm/asm/setup.h +1 -0
@@ -15,6 +15,7 @@ extern int nr_cpus;#define MR_F_IO (1U << 0)#define MR_F_CODE (1U << 1) +#define MR_F_RESERVED (1U << 2)#define MR_F_UNKNOWN (1U << 31)struct mem_region {
lib/arm/mmu.c +4 -0
@@ -174,6 +174,10 @@ void *setup_mmu(phys_addr_t phys_end, void *unused)for (r = mem_regions; r->end; ++r) {if (r->flags &MR_F_IO ) {continue ; + }else if (r->flags &MR_F_RESERVED ) { +/* Reserved pages need to be writable for whatever reserved them */ +mmu_set_range_ptes (mmu_idmap, r->start, r->start, r->end, +__pgprot (PTE_WBWA )); }else if (r->flags &MR_F_CODE ) {/* armv8 requires code shared between EL1 and EL0 to be read-only */ mmu_set_range_ptes(mmu_idmap, r->start, r->start, r->end,
Signature · 1 line
2.25.1
PATCH 16/23 arm/arm64: Add a setup sequence for systems that boot through EFI
In reply to a message not in the archiveThis change implements an alternative setup sequence for the system when we are booting through EFI. The memory map is discovered through EFI boot services and devices through ACPI.
This change is based on a change initially proposed by Andrew Jones <[email protected]>
--- lib/linux/efi.h | 1 + lib/arm/asm/setup.h | 2 + lib/arm/setup.c | 179 +++++++++++++++++++++++++++++++++++++++++++- arm/cstart.S | 1 + arm/cstart64.S | 1 + 5 files changed, 182 insertions(+), 2 deletions(-)
lib/linux/efi.h +1 -0
@@ -63,6 +63,7 @@ typedef guid_t efi_guid_t; (c) & 0xff, ((c) >> 8) & 0xff, d } }#define ACPI_TABLE_GUID EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) +#define ACPI_20_TABLE_GUID EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81)#define LOADED_IMAGE_PROTOCOL_GUID EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
lib/arm/asm/setup.h +2 -0
@@ -5,6 +5,7 @@* * This work is licensed under the terms of the GNU LGPL, version 2. */ +#include <efi.h> #include <libcflat.h> #include <asm/page.h> #include <asm/pgtable-hwdef.h>
@@ -37,5 +38,6 @@ extern unsigned int mem_region_get_flags(phys_addr_t paddr);#define SMP_CACHE_BYTES L1_CACHE_BYTESvoid setup (const void *fdt,phys_addr_t freemem_start); +efi_status_t setup_efi (efi_bootinfo_t *efi_bootinfo);#endif /* _ASMARM_SETUP_H_ */
lib/arm/setup.c +177 -2
194 lines not on this page · raw message
arm/cstart.S +1 -0
@@ -256,6 +256,7 @@ asm_mmu_disable: * * Input r0 is the stack top, which is the exception stacks base */ +.globl exceptions_init exceptions_init: mrc p15, 0, r2, c1, c0, 0 @ read SCTLR bic r2, #CR_V @ SCTLR.V := 0
arm/cstart64.S +1 -0
@@ -276,6 +276,7 @@ asm_mmu_disable: * Vectors */ +.globl exceptions_init exceptions_init: adrp x4, vector_table add x4, x4, :lo12:vector_table
Signature · 1 line
2.25.1
PATCH 17/23 arm64: Copy code from GNU-EFI
In reply to a message not in the archiveThis change adds unmodified dependencies that we need from GNU-EFI in order to build arm64 EFI apps.
GNU-EFI sources from https://git.code.sf.net/p/gnu-efi/code v3.0.14
--- arm/efi/elf_aarch64_efi.lds | 63 +++++++++++++++++ arm/efi/crt0-efi-aarch64.S | 130 ++++++++++++++++++++++++++++++++++++ arm/efi/reloc_aarch64.c | 97 +++++++++++++++++++++++++++ 3 files changed, 290 insertions(+) create mode 100644 arm/efi/elf_aarch64_efi.lds create mode 100644 arm/efi/crt0-efi-aarch64.S create mode 100644 arm/efi/reloc_aarch64.c
arm/efi/elf_aarch64_efi.lds new file +63 -0
@@ -0,0 +1,63 @@ +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") +OUTPUT_ARCH(aarch64) +ENTRY(_start) +SECTIONS +{ + .text 0x0 : { + _text = .; + *(.text.head) + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.srodata) + *(.rodata*) + . = ALIGN(16); + } + _etext = .; + _text_size = . - _text; + .dynamic : { *(.dynamic) } + .data : ALIGN(4096) + { + _data = .; + *(.sdata) + *(.data) + *(.data1) + *(.data.*) + *(.got.plt) + *(.got) + + /* the EFI loader doesn't seem to like a .bss section, so we stick + it all into .data: */ + . = ALIGN(16); + _bss = .; + *(.sbss) + *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + . = ALIGN(16); + _bss_end = .; + } + + .rela.dyn : { *(.rela.dyn) } + .rela.plt : { *(.rela.plt) } + .rela.got : { *(.rela.got) } + .rela.data : { *(.rela.data) *(.rela.data*) } + . = ALIGN(512); + _edata = .; + _data_size = . - _data; + + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + . = ALIGN(4096); + .note.gnu.build-id : { *(.note.gnu.build-id) } + /DISCARD/ : + { + *(.rel.reloc) + *(.eh_frame) + *(.note.GNU-stack) + } + .comment 0 : { *(.comment) } +}
arm/efi/crt0-efi-aarch64.S new file +130 -0
130 lines not on this page · raw message
arm/efi/reloc_aarch64.c new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 18/23 arm64: Change GNU-EFI imported file to use defined types
In reply to a message not in the archive--- arm/efi/reloc_aarch64.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
arm/efi/reloc_aarch64.c +3 -6
@@ -34,14 +34,11 @@SUCH DAMAGE. */ -#include <efi.h> -#include <efilib.h> - +#include "efi.h" #include <elf.h> -EFI_STATUS _relocate (long ldbase,Elf64_Dyn *dyn, - EFI_HANDLE image EFI_UNUSED, - EFI_SYSTEM_TABLE *systab EFI_UNUSED) +efi_status_t _relocate (long ldbase,Elf64_Dyn *dyn,efi_handle_t image, +efi_system_table_t *sys_tab) {long relsz =0 , relent =0 ;Elf64_Rela *rel =0 ;
Signature · 1 line
2.25.1
PATCH 19/23 arm64: Use code from the gnu-efi when booting with EFI
In reply to a message not in the archivearm/efi/crt0-efi-aarch64.S defines the header and the handover sequence from EFI to a efi_main. This change includes the whole file in arm/cstart64.S when we compile with EFI support.
In addition, we change the handover code in arm/efi/crt0-efi-aarch64.S to align the stack pointer. This alignment is necessary because we make assumptions about cpu0's stack alignment and most importantly we place its thread_info at the bottom of this stack.
--- arm/cstart64.S | 6 ++++++ arm/efi/crt0-efi-aarch64.S | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
arm/cstart64.S +6 -0
@@ -15,6 +15,10 @@ #include <asm/thread_info.h> #include <asm/sysreg.h> +#ifdef CONFIG_EFI +#include "efi/crt0-efi-aarch64.S" +#else + .macro zero_range, tmp1, tmp2 9998: cmp \tmp1, \tmp2 b.eq 9997f
@@ -107,6 +111,8 @@ start: bl exit b halt +#endif + .text /*
arm/efi/crt0-efi-aarch64.S +15 -2
@@ -111,10 +111,19 @@ section_table: .align 12 _start: - stp x29, x30, [sp, #-32]! + stp x29, x30, [sp, #-16]! + + // Align sp; this is necessary due to way we store cpu0's thread_info mov x29, sp + and x29, x29, #THREAD_MASK + mov x30, sp + mov sp, x29 + str x30, [sp, #-32]! + + mov x29, sp stp x0, x1, [sp, #16] + mov x2, x0 mov x3, x1 adr x0, ImageBase
@@ -126,5 +135,9 @@ _start: ldp x0, x1, [sp, #16] bl efi_main -0: ldp x29, x30, [sp], #32 + // Restore sp + ldr x30, [sp] + mov sp, x30 + +0: ldp x29, x30, [sp], #16 ret
Signature · 1 line
2.25.1
PATCH 20/23 lib: Avoid external dependency in libelf
In reply to a message not in the archiveThere is just a small number of definitions we need from uapi/linux/elf.h and asm/elf.h and the relocation code is self-contained.
--- arm/efi/reloc_aarch64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arm/efi/reloc_aarch64.c +1 -2
@@ -34,8 +34,7 @@SUCH DAMAGE. */ -#include "efi.h" -#include <elf.h> +#include <efi.h> efi_status_t _relocate (long ldbase,Elf64_Dyn *dyn,efi_handle_t image,efi_system_table_t *sys_tab)
Signature · 1 line
2.25.1
PATCH 21/23 x86: Move x86_64-specific EFI CFLAGS to x86_64 Makefile
In reply to a message not in the archiveCompiler flag -macculate-outgoing-args is only needed by the x86_64 ABI. Move it to the relevant Makefile.
--- Makefile | 4 ---- x86/Makefile.x86_64 | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-)
Makefile +0 -4
@@ -40,14 +40,10 @@ OBJDIRS += $(LIBFDT_objdir) # EFI App ifeq ($(CONFIG_EFI),y) -EFI_ARCH = x86_64 EFI_CFLAGS := -DCONFIG_EFI # The following CFLAGS and LDFLAGS come from: # - GNU-EFI/Makefile.defaults # - GNU-EFI/apps/Makefile -# Function calls must include the number of arguments passed to the functions -# More details: https://wiki.osdev.org/GNU-EFI -EFI_CFLAGS += -maccumulate-outgoing-args # GCC defines wchar to be 32 bits, but EFI expects 16 bits EFI_CFLAGS += -fshort-wchar # EFI applications use PIC as they are loaded to dynamic addresses, not a fixed
x86/Makefile.x86_64 +4 -0
@@ -2,6 +2,10 @@ cstart.o = $(TEST_DIR)/cstart64.o bits = 64 ldarch = elf64-x86-64 ifeq ($(CONFIG_EFI),y) +# Function calls must include the number of arguments passed to the functions +# More details: https://wiki.osdev.org/GNU-EFI +CFLAGS += -maccumulate-outgoing-args + exe = efi bin = so FORMAT = efi-app-x86_64
Signature · 1 line
2.25.1
PATCH 22/23 arm64: Add support for efi in Makefile
In reply to a message not in the archiveUsers can now build kvm-unit-tests as efi apps by supplying an extra argument when invoking configure:
$> ./configure --enable-efi
This patch is based on an earlier version by
Andrew Jones <[email protected]>
--- configure | 15 ++++++++++++--- arm/Makefile.arm | 6 ++++++ arm/Makefile.arm64 | 18 ++++++++++++++---- arm/Makefile.common | 45 ++++++++++++++++++++++++++++++++++----------- 4 files changed, 66 insertions(+), 18 deletions(-)
configure +12 -3
@@ -195,14 +195,19 @@ else fi fi -if [ "$efi" ] && [ "$arch" != "x86_64" ]; then +if [ "$efi" ] && [ "$arch" != "x86_64" ] && [ "$arch" != "arm64" ]; then echo "--[enable|disable]-efi is not supported for $arch" usage fi if [ -z "$page_size" ]; then - [ "$arch" = "arm64" ] && page_size="65536" - [ "$arch" = "arm" ] && page_size="4096" + if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then + page_size="4096" + elif [ "$arch" = "arm64" ]; then + page_size="65536" + elif [ "$arch" = "arm" ]; then + page_size="4096" + fi else if [ "$arch" != "arm64" ]; then echo "--page-size is not supported for $arch"
@@ -217,6 +222,10 @@ else echo "arm64 doesn't support page size of $page_size" usage fi + if [ "$efi" = 'y' ] && [ "$page_size" != "4096" ]; then + echo "efi must use 4K pages" + exit 1 + fi fi [ -z "$processor" ] && processor="$arch"
arm/Makefile.arm +6 -0
@@ -7,6 +7,10 @@ bits = 32 ldarch = elf32-littlearm machine = -marm -mfpu=vfp +ifeq ($(CONFIG_EFI),y) +$(error Cannot build arm32 tests as EFI apps) +endif + # stack.o relies on frame pointers. KEEP_FRAME_POINTER := y
@@ -32,6 +36,8 @@ cflatobjs += lib/arm/stack.o cflatobjs += lib/ldiv32.o cflatobjs += lib/arm/ldivmod.o +exe = flat + # arm specific tests tests =
arm/Makefile.arm64 +14 -4
@@ -27,11 +27,21 @@ cflatobjs += lib/arm64/gic-v3-its.o lib/arm64/gic-v3-its-cmd.o OBJDIRS += lib/arm64 +ifeq ($(CONFIG_EFI),y) +# avoid jump tables before all relocations have been processed +arm/efi/reloc_aarch64.o: CFLAGS += -fno-jump-tables +cflatobjs += arm/efi/reloc_aarch64.o + +exe = efi +else +exe = flat +endif + # arm64 specific tests -tests = $(TEST_DIR)/timer.flat -tests += $(TEST_DIR)/micro-bench.flat -tests += $(TEST_DIR)/cache.flat -tests += $(TEST_DIR)/debug.flat +tests = $(TEST_DIR)/timer.$(exe) +tests += $(TEST_DIR)/micro-bench.$(exe) +tests += $(TEST_DIR)/cache.$(exe) +tests += $(TEST_DIR)/debug.$(exe) include $(SRCDIR)/$(TEST_DIR)/Makefile.common
arm/Makefile.common +34 -11
73 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 23/23 arm64: Add an efi/run script
In reply to a message not in the archiveThis change adds a efi/run script inspired by the one in x86. This script will setup a folder with the test compiled as an EFI app and a startup.nsh script. The script launches QEMU providing an image with EDKII and the path to the folder with the test which is executed automatically.
For example:
$> ./arm/efi/run ./arm/selftest.efi setup smp=2 mem=256
--- scripts/runtime.bash | 14 +++++----- arm/efi/run | 61 ++++++++++++++++++++++++++++++++++++++++++++ arm/run | 8 ++++-- arm/Makefile.common | 1 + arm/dummy.c | 4 +++ 5 files changed, 78 insertions(+), 10 deletions(-) create mode 100755 arm/efi/run create mode 100644 arm/dummy.c
scripts/runtime.bash +6 -8
@@ -131,14 +131,12 @@ function run() fi last_line=$(premature_failure > >(tail -1)) && { - skip=true - if [ "${CONFIG_EFI}" == "y" ] && [[ "${last_line}" =~ "enabling apic" ]]; then - skip=false - fi - if [ ${skip} == true ]; then - print_result "SKIP" $testname "" "$last_line" - return 77 - fi + if [ "${CONFIG_EFI}" == "y" ] && [ "${ARCH}" = x86_64 ]; then + if ! [[ "${last_line}" =~ "enabling apic" ]]; then + print_result "SKIP" $testname "" "$last_line" + return 77 + fi + fi } cmdline=$(get_cmdline $kernel)
arm/efi/run new file +61 -0
61 lines not on this page · raw message
arm/run +6 -2
@@ -67,7 +67,11 @@ fi A="-accel $ACCEL" command="$qemu -nodefaults $M $A -cpu $processor $chr_testdev $pci_testdev" -command+=" -display none -serial stdio -kernel" +command+=" -display none -serial stdio" command="$(migration_cmd) $(timeout_cmd) $command" -run_qemu $command "$@" +if [ "$EFI_RUN" = "y" ]; then + ENVIRON_DEFAULT=n run_qemu $command "$@" +else + run_qemu $command -kernel "$@" +fi
arm/Makefile.common +1 -0
@@ -12,6 +12,7 @@ tests-common += $(TEST_DIR)/gic.$(exe) tests-common += $(TEST_DIR)/psci.$(exe) tests-common += $(TEST_DIR)/sieve.$(exe) tests-common += $(TEST_DIR)/pl031.$(exe) +tests-common += $(TEST_DIR)/dummy.$(exe) tests-all = $(tests-common) $(tests) all: directories $(tests-all)
arm/dummy.c new file +4 -0
@@ -0,0 +1,4 @@ +int main (int argc,char **argv) +{ +return 0 ; +}
Signature · 1 line
2.25.1