[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/15] s390x: adapter routes error handling
From: |
Cornelia Huck |
Subject: |
[PULL 04/15] s390x: adapter routes error handling |
Date: |
Mon, 27 Jan 2020 13:20:05 +0100 |
If the kernel irqchip has been disabled, we don't want the
{add,release}_adapter_routes routines to call any kvm_irqchip_*
interfaces, as they may rely on an irqchip actually having been
created. Just take a quick exit in that case instead. If you are
trying to use irqfd without a kernel irqchip, we will fail with
an error.
Also initialize routes->gsi[] with -1 in the virtio-ccw handling,
to make sure we don't trip over other errors, either. (Nobody
else uses the gsi array in that structure.)
Fixes: d426d9fba8ea ("s390x/virtio-ccw: wire up irq routing and irqfds")
Reviewed-by: Thomas Huth <address@hidden>
Acked-by: Christian Borntraeger <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/intc/s390_flic_kvm.c | 8 ++++++++
hw/s390x/virtio-ccw.c | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 2e1e70c61d5b..a306b26faa07 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -331,6 +331,10 @@ static int kvm_s390_add_adapter_routes(S390FLICState *fs,
int ret, i;
uint64_t ind_offset = routes->adapter.ind_offset;
+ if (!kvm_gsi_routing_enabled()) {
+ return -ENOSYS;
+ }
+
for (i = 0; i < routes->num_routes; i++) {
ret = kvm_irqchip_add_adapter_route(kvm_state, &routes->adapter);
if (ret < 0) {
@@ -358,6 +362,10 @@ static void kvm_s390_release_adapter_routes(S390FLICState
*fs,
{
int i;
+ if (!kvm_gsi_routing_enabled()) {
+ return;
+ }
+
for (i = 0; i < routes->num_routes; i++) {
if (routes->gsi[i] >= 0) {
kvm_irqchip_release_virq(kvm_state, routes->gsi[i]);
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 6580ce5907dd..13f57e7b67f1 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -697,6 +697,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev,
Error **errp)
CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
SubchDev *sch;
Error *err = NULL;
+ int i;
sch = css_create_sch(ccw_dev->devno, errp);
if (!sch) {
@@ -717,6 +718,9 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev,
Error **errp)
ccw_dev->sch = sch;
dev->indicators = NULL;
dev->revision = -1;
+ for (i = 0; i < ADAPTER_ROUTES_MAX_GSI; i++) {
+ dev->routes.gsi[i] = -1;
+ }
css_sch_build_virtual_schib(sch, 0, VIRTIO_CCW_CHPID_TYPE);
trace_virtio_ccw_new_device(
--
2.21.1
- [PULL 00/15] s390x update, Cornelia Huck, 2020/01/27
- [PULL 01/15] s390x/sclp.c: remove unneeded label in sclp_service_call(), Cornelia Huck, 2020/01/27
- [PULL 02/15] intc/s390_flic_kvm.c: remove unneeded label in kvm_flic_load(), Cornelia Huck, 2020/01/27
- [PULL 03/15] s390x/event-facility.c: remove unneeded labels, Cornelia Huck, 2020/01/27
- [PULL 04/15] s390x: adapter routes error handling,
Cornelia Huck <=
- [PULL 05/15] s390x/event-facility: fix error propagation, Cornelia Huck, 2020/01/27
- [PULL 06/15] target/s390x: Remove duplicated ifdef macro, Cornelia Huck, 2020/01/27
- [PULL 07/15] docs/devel: fix stable process doc formatting, Cornelia Huck, 2020/01/27
- [PULL 09/15] target/s390x: Move struct DisasFields definition earlier, Cornelia Huck, 2020/01/27
- [PULL 08/15] target/s390x/kvm: Enable adapter interruption suppression again, Cornelia Huck, 2020/01/27
- [PULL 10/15] target/s390x: Remove DisasFields argument from callbacks, Cornelia Huck, 2020/01/27
- [PULL 12/15] target/s390x: Move DisasFields into DisasContext, Cornelia Huck, 2020/01/27
- [PULL 14/15] hw/s390x: Add a more verbose comment about get_machine_class() and the wrappers, Cornelia Huck, 2020/01/27
- [PULL 13/15] target/s390x: Remove DisasFields argument from extract_insn, Cornelia Huck, 2020/01/27
- [PULL 15/15] s390x: sigp: Fix sense running reporting, Cornelia Huck, 2020/01/27