From patchwork Mon Feb 27 11:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 656958 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2300821wrb; Mon, 27 Feb 2023 03:41:23 -0800 (PST) X-Google-Smtp-Source: AK7set9KbX21Kq9MAFS7m+PHQiHMpXCGFaN8CRRPkgr3GuSxdkLNj7foP/5PlfthhI9cIzJ7lWr1 X-Received: by 2002:a05:6214:27c4:b0:56e:fe7b:8bbf with SMTP id ge4-20020a05621427c400b0056efe7b8bbfmr49471621qvb.46.1677498083178; Mon, 27 Feb 2023 03:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677498083; cv=none; d=google.com; s=arc-20160816; b=GdGbxWe8xmOELG39qE5rfYEYcOLpZwXAipp8RsrFdCcO4dasUkTD+l+c1fB+uQPMHw QJOYICPDx4dL/6UrxmGE8AhM6NpronWEw/LostnvY7U35muFU7SN5tozpNwrJqpgYX3i 5UQzCwSrgb1Xnd0XKIcYxFBkNovd3Dj6SjjvBAWFQFArBytjvATlyx/+FbLaiLNkGAdv q5QmDOKQgJnTqFdrYvJhqIRYr0pY1PAcjfGLy3bwnyseq02YrOJq5HoyZEtbiH8/w3Lk 7yDNzedyftRBRI9IzUzMtFRSYyIPw7TOvFLhOCAv+y39tEa75g2oLZ6hthaycJ/gKL0F u84Q== 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=aO3EBuZP2ABmdi0vBlEipdhvCOE2f/2c5NmCr4yWzzE=; b=CCKz9lqw/U+TywHDf0nyLq7NwF0zCIoVit5gmK07kYJEvIHLZa6C4fmACbVCikWJxS pzRI5xbOCG9lRzrP9Ka3FlyVspbU0a652damH/wYYGVsE8viwa5HZHgaV7v3InE+RZaW y1ZQm0iVVVRuVXVxs6ggsUf127JCGG+WujFtKULlcyhsMFruUHXNh4zLD6TFzDNYp9M9 nVEZw5LBaVpmgXwFAvOtSCtlwmJSoHo2hjLbgvFaGV0KyklxD63lds48Rox1FQxRkkKZ 3KPS4SAJWIh5dIf1uf1KAbhp6aJarecPX3fpSr7bTqZ2H4kl0hYeLMXfp7iwcHOOrqu7 Ifvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NIj5qutH; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f6-20020a0ccc86000000b0056eac3deec7si6018196qvl.398.2023.02.27.03.41.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 03:41:23 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=NIj5qutH; 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=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWboC-0005W3-0r; Mon, 27 Feb 2023 06:36:44 -0500 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 1pWbo9-0005UO-9U for qemu-devel@nongnu.org; Mon, 27 Feb 2023 06:36:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWbo7-0005fL-Ha for qemu-devel@nongnu.org; Mon, 27 Feb 2023 06:36:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677497795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aO3EBuZP2ABmdi0vBlEipdhvCOE2f/2c5NmCr4yWzzE=; b=NIj5qutHob3FV2bhnKcM45xRTYCxMUy/o3D+R3gc/3GPNdAmg0AqoK2Svi0PSZUx6edYjj CnfEk6AbzoVg56aAVEVxByjnr7L55YfB06MyZTY5l+09AZ0IhpDHfMZ0s5kHLmQVCoetW4 kI7SPxGetApJUWBsQ0Ms6cr5yV4tfQA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-4CsjKjLZNQKgl1PqBDmo3Q-1; Mon, 27 Feb 2023 06:36:32 -0500 X-MC-Unique: 4CsjKjLZNQKgl1PqBDmo3Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 183013C0E445; Mon, 27 Feb 2023 11:36:32 +0000 (UTC) Received: from thuth.com (unknown [10.45.227.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F88D1121314; Mon, 27 Feb 2023 11:36:31 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eric Farman Subject: [PULL 07/33] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Date: Mon, 27 Feb 2023 12:35:55 +0100 Message-Id: <20230227113621.58468-8-thuth@redhat.com> In-Reply-To: <20230227113621.58468-1-thuth@redhat.com> References: <20230227113621.58468-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 From: Philippe Mathieu-Daudé Use the VFIO_CCW() QOM type-checking macro to avoid DO_UPCAST(). Reviewed-by: Eric Farman Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20230213170145.45666-7-philmd@linaro.org> Signed-off-by: Thomas Huth --- hw/vfio/ccw.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index cd66b66742..1e2fce83b0 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -76,8 +76,7 @@ struct VFIODeviceOps vfio_ccw_ops = { static IOInstEnding vfio_ccw_handle_request(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_io_region *region = vcdev->io_region; int ret; @@ -125,8 +124,7 @@ again: static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); SCHIB *schib = &sch->curr_status; struct ccw_schib_region *region = vcdev->schib_region; SCHIB *s; @@ -170,8 +168,7 @@ static IOInstEnding vfio_ccw_handle_store(SubchDev *sch) static int vfio_ccw_handle_clear(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -210,8 +207,7 @@ again: static int vfio_ccw_handle_halt(SubchDev *sch) { - S390CCWDevice *cdev = sch->driver_data; - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data); struct ccw_cmd_region *region = vcdev->async_cmd_region; int ret; @@ -251,8 +247,7 @@ again: static void vfio_ccw_reset(DeviceState *dev) { - S390CCWDevice *cdev = S390_CCW_DEVICE(dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(dev); ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET); } @@ -656,7 +651,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp) { VFIOGroup *group; S390CCWDevice *cdev = S390_CCW_DEVICE(dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); Error *err = NULL; @@ -727,7 +722,7 @@ out_err_propagate: static void vfio_ccw_unrealize(DeviceState *dev) { S390CCWDevice *cdev = S390_CCW_DEVICE(dev); - VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev); + VFIOCCWDevice *vcdev = VFIO_CCW(cdev); S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev); VFIOGroup *group = vcdev->vdev.group;