[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v5 30/36] spapr: check for KVM IRQ device activation
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [PATCH v5 30/36] spapr: check for KVM IRQ device activation |
Date: |
Fri, 16 Nov 2018 11:57:23 +0100 |
The KVM IRQ device activation will depend on the interrupt mode chosen
at CAS time by the machine and some methods used at reset or by the
migration need to be protected.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/spapr_xive_kvm.c | 5 +++++
hw/intc/xics_kvm.c | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index 176083c37d61..b9fee4ea240f 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -656,6 +656,11 @@ static int spapr_xive_kvm_pre_save(sPAPRXive *xive)
int i;
int ret = 0;
+ /* The KVM XIVE device is not in use */
+ if (xive->fd == -1) {
+ return 0;
+ }
+
/* Quiesce the sources, to stop the flow of event notifications */
for (i = 0; i < xsrc->nr_irqs; i++) {
/*
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 9662e208fa81..eabc901a4556 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -58,6 +58,11 @@ static void icp_get_kvm_state(ICPState *icp)
uint64_t state;
int ret;
+ /* The KVM XICS device is not in use */
+ if (kernel_xics_fd == -1) {
+ return;
+ }
+
/* ICP for this CPU thread is not in use, exiting */
if (!icp->cs) {
return;
@@ -94,6 +99,11 @@ static int icp_set_kvm_state(ICPState *icp, int version_id)
uint64_t state;
int ret;
+ /* The KVM XICS device is not in use */
+ if (kernel_xics_fd == -1) {
+ return 0;
+ }
+
/* ICP for this CPU thread is not in use, exiting */
if (!icp->cs) {
return 0;
@@ -209,6 +219,11 @@ static void ics_get_kvm_state(ICSState *ics)
uint64_t state;
int i;
+ /* The KVM XICS device is not in use */
+ if (kernel_xics_fd == -1) {
+ return;
+ }
+
for (i = 0; i < ics->nr_irqs; i++) {
ICSIRQState *irq = &ics->irqs[i];
@@ -268,6 +283,11 @@ static int ics_set_kvm_state(ICSState *ics, int version_id)
int i;
Error *local_err = NULL;
+ /* The KVM XICS device is not in use */
+ if (kernel_xics_fd == -1) {
+ return 0;
+ }
+
for (i = 0; i < ics->nr_irqs; i++) {
ICSIRQState *irq = &ics->irqs[i];
int ret;
--
2.17.2
- [Qemu-ppc] [PATCH v5 31/36] spapr/xive: export the spapr_xive_kvm_init() routine, (continued)
- [Qemu-ppc] [PATCH v5 31/36] spapr/xive: export the spapr_xive_kvm_init() routine, Cédric Le Goater, 2018/11/16
- [Qemu-ppc] [PATCH v5 34/36] spapr: add KVM support to the 'dual' machine, Cédric Le Goater, 2018/11/16
- [Qemu-ppc] [PATCH v5 33/36] spapr: introduce routines to delete the KVM IRQ device, Cédric Le Goater, 2018/11/16
- [Qemu-ppc] [PATCH v5 26/36] spapr: add a 'pseries-3.1-dual' machine type, Cédric Le Goater, 2018/11/16
- [Qemu-ppc] [PATCH v5 35/36] ppc: externalize ppc_get_vcpu_by_pir(), Cédric Le Goater, 2018/11/16
- [Qemu-ppc] [PATCH v5 30/36] spapr: check for KVM IRQ device activation,
Cédric Le Goater <=
- [Qemu-ppc] [PATCH v5 36/36] ppc/pnv: add XIVE support, Cédric Le Goater, 2018/11/16