Skip to contentSkip to conversation

PSCI v0.2 support for KVM ARM/ARM64

RFC PATCH Superseded Pranavkumar Sawargaonkar 3 participants 12 messages May 5, 2014 – May 6, 2014

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover PSCI v0.2 support for KVM ARM/ARM64

This patchset adds the QEMU side changes for providing PSCI v0.2 to VM.

ChangeLog:

V4:
- Rebase this patch against v11 patchset for in-kernel PSCI v0.2 emulation
(http://www.spinics.net/lists/kvm-arm/msg09182.html)
- Used PSCI 0.2 DT bindings for linux kernel.
(http://www.spinics.net/lists/arm-kernel/msg326044.html).

V3:
- Rebase this patchset against v8 patchset for in-kernel PSCI v0.2 emulation
(http://www.spinics.net/lists/kvm-arm/msg08780.html)
- Added common kvm_arm_vcpu_init() function for kvm arm and kvm arm64

V2:
- Rebase this patchset against v6 patchset for in-kernel PSCI v0.2 emulation
(http://www.spinics.net/lists/arm-kernel/msg319037.html)
- Handle KVM_EXIT_SYSTEM_EVENT in kvm-all.c:kvm_cpu_exec()
- Drop change in kvm_arm_get_host_cpu_features()
- Improve comments and description of kvm_arch_reset_vcpu() implementation

V1:
- Initial RFC patchset

Pranavkumar Sawargaonkar (6):
linux-headers: Update KVM headers from linux-3.16-rc1
kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT
target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it
target-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64
target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64

 hw/arm/virt.c                 |   16 +++++---
 kvm-all.c                     |   16 ++++++++
 linux-headers/asm-arm/kvm.h   |   10 +++--
 linux-headers/asm-arm64/kvm.h |   10 +++--
 linux-headers/linux/kvm.h     |   27 ++++++++++++-
 linux-headers/linux/psci.h    |   90 +++++++++++++++++++++++++++++++++++++++++
 target-arm/kvm.c              |   23 +++++++++++
 target-arm/kvm32.c            |   15 ++-----
 target-arm/kvm64.c            |   23 ++++++-----
 target-arm/kvm_arm.h          |   14 +++++++
 10 files changed, 206 insertions(+), 38 deletions(-)
 create mode 100644 linux-headers/linux/psci.h
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH v4 1/6 linux-headers: Update KVM headers from linux-3.16-rc1

Syncup KVM related linux headers from linux-3.16-rc1

---
 linux-headers/asm-arm/kvm.h   |   10 +++--
 linux-headers/asm-arm64/kvm.h |   10 +++--
 linux-headers/linux/kvm.h     |   27 ++++++++++++-
 linux-headers/linux/psci.h    |   90 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 128 insertions(+), 9 deletions(-)
 create mode 100644 linux-headers/linux/psci.h
linux-headers/asm-arm/kvm.h +6 -4
index ef0c878..e6ebdd3 100644
@@ -20,6 +20,7 @@
 #define __ARM_KVM_H__
 
 #include <linux/types.h>
+#include <linux/psci.h>
 #include <asm/ptrace.h>
 
 #define __KVM_HAVE_GUEST_DEBUG
@@ -83,6 +84,7 @@ struct kvm_regs {
 #define KVM_VGIC_V2_CPU_SIZE		0x2000
 
 #define KVM_ARM_VCPU_POWER_OFF		0 /* CPU is started in OFF state */
+#define KVM_ARM_VCPU_PSCI_0_2		1 /* CPU uses PSCI v0.2 */
 
 struct kvm_vcpu_init {
 	__u32 target;
@@ -201,9 +203,9 @@ struct kvm_arch_memory_slot {
 #define KVM_PSCI_FN_CPU_ON		KVM_PSCI_FN(2)
 #define KVM_PSCI_FN_MIGRATE		KVM_PSCI_FN(3)
 
-#define KVM_PSCI_RET_SUCCESS		0
-#define KVM_PSCI_RET_NI			((unsigned long)-1)
-#define KVM_PSCI_RET_INVAL		((unsigned long)-2)
-#define KVM_PSCI_RET_DENIED		((unsigned long)-3)
+#define KVM_PSCI_RET_SUCCESS		PSCI_RET_SUCCESS
+#define KVM_PSCI_RET_NI			PSCI_RET_NOT_SUPPORTED
+#define KVM_PSCI_RET_INVAL		PSCI_RET_INVALID_PARAMS
+#define KVM_PSCI_RET_DENIED		PSCI_RET_DENIED
 
 #endif /* __ARM_KVM_H__ */
linux-headers/asm-arm64/kvm.h +6 -4
index eaf54a3..e6471da 100644
@@ -31,6 +31,7 @@
 #define KVM_NR_SPSR	5
 
 #ifndef __ASSEMBLY__
+#include <linux/psci.h>
 #include <asm/types.h>
 #include <asm/ptrace.h>
 
@@ -77,6 +78,7 @@ struct kvm_regs {
 
 #define KVM_ARM_VCPU_POWER_OFF		0 /* CPU is started in OFF state */
 #define KVM_ARM_VCPU_EL1_32BIT		1 /* CPU running a 32bit VM */
+#define KVM_ARM_VCPU_PSCI_0_2		2 /* CPU uses PSCI v0.2 */
 
 struct kvm_vcpu_init {
 	__u32 target;
@@ -186,10 +188,10 @@ struct kvm_arch_memory_slot {
 #define KVM_PSCI_FN_CPU_ON		KVM_PSCI_FN(2)
 #define KVM_PSCI_FN_MIGRATE		KVM_PSCI_FN(3)
 
-#define KVM_PSCI_RET_SUCCESS		0
-#define KVM_PSCI_RET_NI			((unsigned long)-1)
-#define KVM_PSCI_RET_INVAL		((unsigned long)-2)
-#define KVM_PSCI_RET_DENIED		((unsigned long)-3)
+#define KVM_PSCI_RET_SUCCESS		PSCI_RET_SUCCESS
+#define KVM_PSCI_RET_NI			PSCI_RET_NOT_SUPPORTED
+#define KVM_PSCI_RET_INVAL		PSCI_RET_INVALID_PARAMS
+#define KVM_PSCI_RET_DENIED		PSCI_RET_DENIED
 
 #endif
 
linux-headers/linux/kvm.h +26 -1
index e27a4b3..1371821 100644
@@ -8,7 +8,6 @@
  */
 
 #include <linux/types.h>
-
 #include <linux/ioctl.h>
 #include <asm/kvm.h>
 
@@ -171,6 +170,7 @@ struct kvm_pit_config {
 #define KVM_EXIT_WATCHDOG         21
 #define KVM_EXIT_S390_TSCH        22
 #define KVM_EXIT_EPR              23
+#define KVM_EXIT_SYSTEM_EVENT     24
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 /* Emulate instruction failed. */
@@ -301,6 +301,13 @@ struct kvm_run {
 		struct {
 			__u32 epr;
 		} epr;
+		/* KVM_EXIT_SYSTEM_EVENT */
+		struct {
+#define KVM_SYSTEM_EVENT_SHUTDOWN       1
+#define KVM_SYSTEM_EVENT_RESET          2
+			__u32 type;
+			__u64 flags;
+		} system_event;
 		/* Fix the size of the union. */
 		char padding[256];
 	};
@@ -740,6 +747,10 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_SPAPR_MULTITCE 94
 #define KVM_CAP_EXT_EMUL_CPUID 95
 #define KVM_CAP_HYPERV_TIME 96
+#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
+#define KVM_CAP_ENABLE_CAP_VM 98
+#define KVM_CAP_S390_IRQCHIP 99
+#define KVM_CAP_ARM_PSCI_0_2 100
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -755,9 +766,18 @@ struct kvm_irq_routing_msi {
 	__u32 pad;
 };
 
+struct kvm_irq_routing_s390_adapter {
+	__u64 ind_addr;
+	__u64 summary_addr;
+	__u64 ind_offset;
+	__u32 summary_offset;
+	__u32 adapter_id;
+};
+
 /* gsi routing entry types */
 #define KVM_IRQ_ROUTING_IRQCHIP 1
 #define KVM_IRQ_ROUTING_MSI 2
+#define KVM_IRQ_ROUTING_S390_ADAPTER 3
 
 struct kvm_irq_routing_entry {
 	__u32 gsi;
@@ -767,6 +787,7 @@ struct kvm_irq_routing_entry {
 	union {
 		struct kvm_irq_routing_irqchip irqchip;
 		struct kvm_irq_routing_msi msi;
+		struct kvm_irq_routing_s390_adapter adapter;
 		__u32 pad[8];
 	} u;
 };
@@ -1075,6 +1096,10 @@ struct kvm_s390_ucas_mapping {
 /* Available with KVM_CAP_DEBUGREGS */
 #define KVM_GET_DEBUGREGS         _IOR(KVMIO,  0xa1, struct kvm_debugregs)
 #define KVM_SET_DEBUGREGS         _IOW(KVMIO,  0xa2, struct kvm_debugregs)
+/*
+ * vcpu version available with KVM_ENABLE_CAP
+ * vm version available with KVM_CAP_ENABLE_CAP_VM
+ */
 #define KVM_ENABLE_CAP            _IOW(KVMIO,  0xa3, struct kvm_enable_cap)
 /* Available with KVM_CAP_XSAVE */
 #define KVM_GET_XSAVE		  _IOR(KVMIO,  0xa4, struct kvm_xsave)
linux-headers/linux/psci.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [Qemu-devel] [RFC PATCH V4 1/6] linux-headers: Update KVM headers from linux-3.16-rc1

Quoted 9 lines · Pranavkumar Sawargaonkar

Syncup KVM related linux headers from linux-3.16-rc1

---
 linux-headers/asm-arm/kvm.h   |   10 +++--
 linux-headers/asm-arm64/kvm.h |   10 +++--
 linux-headers/linux/kvm.h     |   27 ++++++++++++-
 linux-headers/linux/psci.h    |   90 +++++++++++++++++++++++++++++++++++++++++

psci.h is a new file, so the update-linux-headers.sh needs to be updated so that it gets sync'd. (You are using the script to generate this patch, right? :-))

thanks
-- PMM

#3 lore raw

RFC PATCH v4 2/6 kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT

In reply to Pranavkumar Sawargaonkar

In-kernel PSCI v0.2 emulation of KVM ARM/ARM64 forwards SYSTEM_OFF and SYSTEM_RESET function calls to QEMU using KVM_EXIT_SYSTEM_EVENT exit reason.

This patch updates kvm_cpu_exec() to handle KVM_SYSTEM_EVENT_SHUTDOWN and KVM_SYSTEM_EVENT_RESET system-level events from QEMU-side.

---
 kvm-all.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
kvm-all.c +16 -0
index 82a9119..9335c50 100644
@@ -1724,6 +1724,22 @@ int kvm_cpu_exec(CPUState *cpu)
         case KVM_EXIT_INTERNAL_ERROR:
             ret = kvm_handle_internal_error(cpu, run);
             break;
+        case KVM_EXIT_SYSTEM_EVENT:
+            switch (run->system_event.type) {
+            case KVM_SYSTEM_EVENT_SHUTDOWN:
+                qemu_system_shutdown_request();
+                ret = EXCP_INTERRUPT;
+                break;
+            case KVM_SYSTEM_EVENT_RESET:
+                qemu_system_reset_request();
+                ret = EXCP_INTERRUPT;
+                break;
+            default:
+                DPRINTF("kvm_arch_handle_exit\n");
+                ret = kvm_arch_handle_exit(cpu, run);
+                break;
+            }
+            break;
         default:
             DPRINTF("kvm_arch_handle_exit\n");
             ret = kvm_arch_handle_exit(cpu, run);
Signature · 1 line
1.7.9.5
#4 lore raw

RFC PATCH v4 3/6 target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible

In reply to Pranavkumar Sawargaonkar

Latest linux kernel supports in-kernel emulation of PSCI v0.2 but to enable it we need to select KVM_ARM_VCPU_PSCI_0_2 feature using KVM_ARM_VCPU_INIT ioctl.

Also, we can use KVM_ARM_VCPU_PSCI_0_2 feature for VCPU only when linux kernel has KVM_CAP_ARM_PSCI_0_2 capability.

This patch updates kvm_arch_init_vcpu() to enable KVM_ARM_VCPU_PSCI_0_2 feature for VCPU when KVM ARM/ARM64 has KVM_CAP_ARM_PSCI_0_2 capability.

---
 target-arm/kvm32.c |    5 ++++-
 target-arm/kvm64.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
target-arm/kvm32.c +4 -1
index a690d99..cd9ac03 100644
@@ -182,7 +182,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
     init.target = cpu->kvm_target;
     memset(init.features, 0, sizeof(init.features));
     if (cpu->start_powered_off) {
-        init.features[0] = 1 << KVM_ARM_VCPU_POWER_OFF;
+        init.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF;
+    }
+    if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
+        init.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
     }
     ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init);
     if (ret) {
target-arm/kvm64.c +4 -1
index e115879..bc6cd74 100644
@@ -90,7 +90,10 @@ int kvm_arch_init_vcpu(CPUState *cs)
     init.target = cpu->kvm_target;
     memset(init.features, 0, sizeof(init.features));
     if (cpu->start_powered_off) {
-        init.features[0] = 1 << KVM_ARM_VCPU_POWER_OFF;
+        init.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF;
+    }
+    if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
+        init.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
     }
     ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init);
 
Signature · 1 line
1.7.9.5
#5 lore raw

RFC PATCH v4 4/6 hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

In reply to Pranavkumar Sawargaonkar

If we have in-kernel emulation of PSCI v0.2 for KVM ARM/ARM64 then we enable PSCI v0.2 for each VCPU at the time of VCPU init hence we need to provide PSCI v0.2 compatible string via generated DTB.

This patch updates generated DTB to have PSCI v0.2 compatible string when we have in-kernel emulation PSCI v0.2 for KVM ARM/ARM64.

---
 hw/arm/virt.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
hw/arm/virt.c +10 -6
index 2bbc931..e4ae8ba 100644
@@ -185,13 +185,17 @@ static void create_fdt(VirtBoardInfo *vbi)
     /* No PSCI for TCG yet */
     if (kvm_enabled()) {
         qemu_fdt_add_subnode(fdt, "/psci");
-        qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
-        qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
+        if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
+            qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci-0.2");
+        } else {
+            qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
                                   PSCI_FN_CPU_SUSPEND);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", PSCI_FN_CPU_OFF);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", PSCI_FN_CPU_ON);
-        qemu_fdt_setprop_cell(fdt, "/psci", "migrate", PSCI_FN_MIGRATE);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", PSCI_FN_CPU_OFF);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", PSCI_FN_CPU_ON);
+            qemu_fdt_setprop_cell(fdt, "/psci", "migrate", PSCI_FN_MIGRATE);
+        }
+        qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
     }
 }
 
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Quoted 4 lines · Pranavkumar Sawargaonkar

If we have in-kernel emulation of PSCI v0.2 for KVM ARM/ARM64 then we enable PSCI v0.2 for each VCPU at the time of VCPU init hence we need to provide PSCI v0.2 compatible string via generated DTB.

Quoted 8 lines

This patch updates generated DTB to have PSCI v0.2 compatible string when we have in-kernel emulation PSCI v0.2 for KVM ARM/ARM64.

---
 hw/arm/virt.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

This does not compile for me:

CC aarch64-softmmu/hw/arm/virt.o
hw/arm/virt.c: In function ‘create_fdt’:
hw/arm/virt.c:186:44: error: ‘KVM_CAP_ARM_PSCI_0_2’ undeclared (first use in this function)

         if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
                                            ^
Quoted 6 lines
hw/arm/virt.c +0 -0
index 2bbc931..e4ae8ba 100644

hw/arm/virt.c static void create_fdt(VirtBoardInfo *vbi) · line 191

Quoted 10 lines
hw/arm/virt.c +4 -3
@@ -185,13 +185,17 @@ static void create_fdt(VirtBoardInfo *vbi)
     /* No PSCI for TCG yet */
     if (kvm_enabled()) {
         qemu_fdt_add_subnode(fdt, "/psci");
-        qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
-        qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
+        if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
+            qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci-0.2");
+        } else {
+            qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");

As I mentioned in the last version, this is wrong. You may have an old guest kernel that only supports PSCI 0.1. You need to support either PSCI 0.1 only OR both PSCI 0.2 and 0.1.

Rob

Quoted 16 lines
hw/arm/virt.c +6 -4
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
                                   PSCI_FN_CPU_SUSPEND);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", PSCI_FN_CPU_OFF);
-        qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", PSCI_FN_CPU_ON);
-        qemu_fdt_setprop_cell(fdt, "/psci", "migrate", PSCI_FN_MIGRATE);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", PSCI_FN_CPU_OFF);
+            qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", PSCI_FN_CPU_ON);
+            qemu_fdt_setprop_cell(fdt, "/psci", "migrate", PSCI_FN_MIGRATE);
+        }
+        qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
     }
 }
 
--

1.7.9.5

#7 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Quoted 15 lines · Rob Herring
Quoted 4 lines · Pranavkumar Sawargaonkar

If we have in-kernel emulation of PSCI v0.2 for KVM ARM/ARM64 then we enable PSCI v0.2 for each VCPU at the time of VCPU init hence we need to provide PSCI v0.2 compatible string via generated DTB.

Quoted 8 lines

This patch updates generated DTB to have PSCI v0.2 compatible string when we have in-kernel emulation PSCI v0.2 for KVM ARM/ARM64.

---
 hw/arm/virt.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
Quoted 8 lines

This does not compile for me:

CC aarch64-softmmu/hw/arm/virt.o
hw/arm/virt.c: In function ‘create_fdt’:
hw/arm/virt.c:186:44: error: ‘KVM_CAP_ARM_PSCI_0_2’ undeclared (first use in this function)

         if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
                                            ^

Note that I am building for system emulation, not KVM which may explain the difference (I assume it actually builds for you).

Rob

#8 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Quoted 10 lines · Rob Herring
Quoted 8 lines · Rob Herring

This does not compile for me:

CC aarch64-softmmu/hw/arm/virt.o
hw/arm/virt.c: In function ‘create_fdt’:
hw/arm/virt.c:186:44: error: ‘KVM_CAP_ARM_PSCI_0_2’ undeclared (first use in this function)

         if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
                                            ^
Quoted 2 lines

Note that I am building for system emulation, not KVM which may explain the difference (I assume it actually builds for you).

Yes, you can't use the kernel header constants here, you need to use the QEMU_ variants that kvm-consts.h provides.

thanks
-- PMM

#9 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Hi Rob, Peter,

Quoted 11 lines · Peter Maydell
Quoted 10 lines · Rob Herring
Quoted 8 lines · Rob Herring

This does not compile for me:

CC aarch64-softmmu/hw/arm/virt.o
hw/arm/virt.c: In function ‘create_fdt’:
hw/arm/virt.c:186:44: error: ‘KVM_CAP_ARM_PSCI_0_2’ undeclared (first use in this function)

         if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
                                            ^
Quoted 3 lines
Quoted 2 lines

Note that I am building for system emulation, not KVM which may explain the difference (I assume it actually builds for you).

Yes actually it builds for me since i am building KVM.

Quoted 2 lines

Yes, you can't use the kernel header constants here, you need to use the QEMU_ variants that kvm-consts.h provides.

Sure I will do use QEMU_ variants in next patch so that it builds for non KVM case also.

Quoted 3 lines

thanks
-- PMM

Thanks,
Pranav

#10 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Quoted 17 lines · Pranavkumar Sawargaonkar

Hi Rob, Peter,

Quoted 11 lines · Peter Maydell
Quoted 10 lines · Rob Herring
Quoted 8 lines · Rob Herring

This does not compile for me:

CC aarch64-softmmu/hw/arm/virt.o
hw/arm/virt.c: In function ‘create_fdt’:
hw/arm/virt.c:186:44: error: ‘KVM_CAP_ARM_PSCI_0_2’ undeclared (first use in this function)

         if (kvm_check_extension(kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
                                            ^
Quoted 3 lines
Quoted 2 lines

Note that I am building for system emulation, not KVM which may explain the difference (I assume it actually builds for you).

Quoted 7 lines

Yes actually it builds for me since i am building KVM.

Quoted 2 lines

Yes, you can't use the kernel header constants here, you need to use the QEMU_ variants that kvm-consts.h provides.

Sure I will do use QEMU_ variants in next patch so that it builds for non KVM case also.

We created the psci.h header to be a common header to define the ABI. It has no linux dependency other than that is the master copy ATM. Can we just copy the header to a non-Linux location rather than creating duplicate QEMU_ prefixed defines?

Rob

#11 lore raw

Re: [Qemu-devel] [RFC PATCH V4 4/6] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it

Quoted 4 lines · Rob Herring

We created the psci.h header to be a common header to define the ABI. It has no linux dependency other than that is the master copy ATM. Can we just copy the header to a non-Linux location rather than creating duplicate QEMU_ prefixed defines?

Can we guarantee that the kernel headers won't fail to compile if we include both QEMU's copy of the psci.h header and the one the kernel has?

thanks
-- PMM