From patchwork Fri Aug 30 14:58:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 824012 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c1:0:b0:367:895a:4699 with SMTP id p1csp823867wrs; Fri, 30 Aug 2024 07:59:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV4RIzBGBNTOz+ZQggrUXZSWC6Gk+lTSe301M+lPHy4ldK2DZzarRxIuYZ1wbIGFytnyzBrAg==@linaro.org X-Google-Smtp-Source: AGHT+IH3ZaTMQv9++PhZ8BEVKO10gEZYYSoPcOneIP6wZxMp04W/cOvRVt+izoDMTpBC4FRSvfMu X-Received: by 2002:a05:6214:498d:b0:6bd:698f:440f with SMTP id 6a1803df08f44-6c33e5e7e63mr87318436d6.4.1725029995730; Fri, 30 Aug 2024 07:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725029995; cv=none; d=google.com; s=arc-20160816; b=vA8VrJ7GGb+pZS2hBF69F8JVN5tKYXR0Fid5sNP40tyymKL8Ze9yTrdz4BDgoX+IdF gKJaNQ5v4fTZKtHfR2LBFG21w1WHMNTUZ1uu4EhTLggoPqaC7HiqtcWyH/5GG86aFFPf er2Vje2m86PDi8ST303agkK849UXRxtfrGySgIKRLLAtvq3gvjSPM2LYA1NDK5+E9QXU SLNHG1Vjo6t/QTXPjbFQDRuCPAQCZpCfKj5f1RWU13DoE58HeuW570Zl8lZXc5Dc0TGb dwa/2Z+YdVPdLl96O/hwK970wsEbb5AzXg6lCI0OP8vabCU8dMQLCv3ZsJASHp6BCWkv H/vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o+Su5X1w6A/5pz13eH5ngXgPfWm3ZLisgHu2KQunXaE=; fh=aZP5QcqmVCTfLe93cJ47kfqkp9RGJPPxVVJ3kRoWYP4=; b=hB6q3QZaQcXlBr4QB5xphMlu9jvkJQD4YndwgfuNLaGF8pnfy5hceRWiL+ylF9TRWF WOWAmZIgh4mE+7lQOE5aYzahieQpanGUhm5NG1QO1NqX2pLg3/1XsSCltvrRwOGa2Wci 4RJAU3thR9hrzkhQTzvC8+pZoTypgq2Xx97z5o1V9QVPuguCBG2qhJQK+6cWtglgw44S X6MoW+BWZGmJTVmvycunaUzxHKN/q2rTKak5JKOQPhUxILS8OoWINJfB1s1rbuDqU5Vs 9NcZn+AtI1gDFwjAjQPcgorLKhKXj1S6hcAhL+kkQj5gRtbTX0mzUzHTxMcWc/AQeZT/ UzRg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E5bWNi44; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6c340daf020si40634206d6.478.2024.08.30.07.59.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Aug 2024 07:59:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E5bWNi44; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sk34x-0004z8-1F; Fri, 30 Aug 2024 10:58:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sk34t-0004mr-IB for qemu-devel@nongnu.org; Fri, 30 Aug 2024 10:58:19 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sk34q-0004Zx-Ra for qemu-devel@nongnu.org; Fri, 30 Aug 2024 10:58:19 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4280c55e488so11807055e9.0 for ; Fri, 30 Aug 2024 07:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725029895; x=1725634695; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o+Su5X1w6A/5pz13eH5ngXgPfWm3ZLisgHu2KQunXaE=; b=E5bWNi44dSchAWBTj9YkiEz3s0eCRqUkcrxr79NEuqK6nDZyHCcFnFjpfqT9NtF0U6 LlDmjYvHIDsEZsQ9H9vj7qHF5fJajOutPHzS6J/jdWwdO4UbkmeiwAy7hG/sv3j+kKyv AmaOv6kUeVmUULrWSS0joE0nvivW+nQgHlw4sEEZZF5HQUtbSf/xV0fK5l8fvw1WcN9d QWHuWplKnXEWsKDKKu1E9A75C6Hzv53hGtS+JdvPdYu65Noi5cbkf5K/cWvva9beyZV+ yRQSPmSsIlHgfXsQ1sApBel8U4ko7iibHiTmvi1WstDE5avLe8H6a84lF2QOObRasmHT xr3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725029895; x=1725634695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o+Su5X1w6A/5pz13eH5ngXgPfWm3ZLisgHu2KQunXaE=; b=OZspdEryhecRplRqZoCnNaDgR7Zv1Io5IiTnvjPx4NZPXT/xS7jE8h/Y1pl64W7pL+ rLpdRvdbKj/Fxv5AG61X/RoZ9Hm7XO9PZkp53uqUnRGrGLohgXWFRH7R4ROpacvzy8U1 uh4mZ26d4LPI0h+JBs51Zkl4wJV0ZDHkN5TOsALmYdTq3Yxok7+WPYVV8/lCes4FzTHT eeuC5phYqyLXBTSwbOqsQl5iQDAvt0pUju7HJmAQuU67PUgqrnp+LbbwlzxPe2IAc3fM yOqDbWJGyeVXvnvWa8/DDP1UuqdC0aw8uU79ii87KRuz1Sn0A24uXZ8SoAmkzuRUV9Fo arMw== X-Gm-Message-State: AOJu0Yy7M3Qxc969QQVcoB1FKdCldXrbq6DQVCkYWvQr1J7t6abVXhfN 4aesk06osgf6dp5PeVSrzJPXrqCfpmTNTawQ5U3ZoeE9fPVEaGOfIpF7Wso1HTyX9UaVi4/pwlf F X-Received: by 2002:a05:600c:46d0:b0:428:b4a:7001 with SMTP id 5b1f17b1804b1-42bb4e9ee1dmr39540225e9.15.1725029895243; Fri, 30 Aug 2024 07:58:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6da24bbsm49022345e9.0.2024.08.30.07.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 07:58:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Thomas Huth , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , David Hildenbrand , Ilya Leoshkevich , Cornelia Huck , Halil Pasic , Eric Farman , Christian Borntraeger , Nico Boehr , Nina Schoetterl-Glausch Subject: [PATCH v2 02/11] hw/s390/virtio-ccw: Convert to three-phase reset Date: Fri, 30 Aug 2024 15:58:03 +0100 Message-Id: <20240830145812.1967042-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240830145812.1967042-1-peter.maydell@linaro.org> References: <20240830145812.1967042-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Convert the virtio-ccw code to three-phase reset. This allows us to remove a call to device_class_set_parent_reset(), replacing it with the three-phase equivalent resettable_class_set_parent_phases(). Removing all the device_class_set_parent_reset() uses will allow us to remove some of the glue code that interworks between three-phase and legacy reset. This is a simple conversion, with no behavioural changes. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Nina Schoetterl-Glausch Acked-by: Thomas Huth Reviewed-by: Richard Henderson --- hw/s390x/virtio-ccw.h | 2 +- hw/s390x/virtio-ccw.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index fac186c8f64..c7a830a1944 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -57,7 +57,7 @@ struct VirtIOCCWDeviceClass { CCWDeviceClass parent_class; void (*realize)(VirtioCcwDevice *dev, Error **errp); void (*unrealize)(VirtioCcwDevice *dev); - void (*parent_reset)(DeviceState *dev); + ResettablePhases parent_phases; }; /* Performance improves when virtqueue kick processing is decoupled from the diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index b4676909dd6..96747318d2a 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -913,14 +913,15 @@ static void virtio_ccw_notify(DeviceState *d, uint16_t vector) } } -static void virtio_ccw_reset(DeviceState *d) +static void virtio_ccw_reset_hold(Object *obj, ResetType type) { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); + VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(obj); VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_GET_CLASS(dev); virtio_ccw_reset_virtio(dev); - if (vdc->parent_reset) { - vdc->parent_reset(d); + + if (vdc->parent_phases.hold) { + vdc->parent_phases.hold(obj, type); } } @@ -1233,11 +1234,13 @@ static void virtio_ccw_device_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); CCWDeviceClass *k = CCW_DEVICE_CLASS(dc); VirtIOCCWDeviceClass *vdc = VIRTIO_CCW_DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); k->unplug = virtio_ccw_busdev_unplug; dc->realize = virtio_ccw_busdev_realize; dc->unrealize = virtio_ccw_busdev_unrealize; - device_class_set_parent_reset(dc, virtio_ccw_reset, &vdc->parent_reset); + resettable_class_set_parent_phases(rc, NULL, virtio_ccw_reset_hold, NULL, + &vdc->parent_phases); } static const TypeInfo virtio_ccw_device_info = {