From patchwork Wed Nov 9 16:14:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 622932 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp354905pvb; Wed, 9 Nov 2022 08:17:22 -0800 (PST) X-Google-Smtp-Source: AMsMyM7BlWRUuOLz+SLi8EbvDrvSCNwvjnzuriA+WdhtS5/vFfOK/QRmsTEyWikNKFUqeDbBNibz X-Received: by 2002:a37:6cc4:0:b0:6fa:50a1:ff75 with SMTP id h187-20020a376cc4000000b006fa50a1ff75mr31093346qkc.340.1668010641909; Wed, 09 Nov 2022 08:17:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668010641; cv=none; d=google.com; s=arc-20160816; b=pj9c4NUClmxe4dHZ8tzqNLJF/y9/3CkucCllSAPBTG1j++Ov3mSOkX/antTWPD4d5A +wGWjFOnSHauelrSi4NEr4OMaZwSEtBuO/BQc4zUJzkuWFw6yXiWHAY9AtolfFEK8MkW 2pIZAQu1MqY1XrCZswpEzqFGeoJXn4eGkDjaAJRRs9njrPHSXWwnJh172W28YN/NeqXv YPe5K7nXhJd9CwlHxzywLdq2d0H9E+GMm9d0h3Qkflyz9NrOyW0oLEWI9HipIbnHnvd8 7SMYPTOC8Z/ewVrwBcm3p8Xp+ZzlY/qE+Y9Po/byjT8RdP2eUVH0sZmxtPO/anc9dOis M+vg== 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:to:from :dkim-signature; bh=TkW7T5S7zm7opSYfPV3c9ibz6QYvnDa1N5Ybi4vqCbI=; b=sbBE6QLS1zMs3nI27PvMbhfDdYWjAq2rPANsfuGjVbUbUQPH0v2ry+Dl9f9nzU4Ja+ j7Tzruqo3zrXM7LuU/YRgwCBKUmKkmRDQf/kDt6JbyBNuPvKjJSvDUcwrWAy1j3ocGDK KN+txgOz9aEZFD8oF0jWmHpbXE0mfRiQ4vsNW0l5QdwCJ9xcLsq55l8jJ9NSRSYow7cz 4rYDoKy8hFX6Ovgelht5Q9KYoEOtb4H0Nqjzyz8RxDPUGZTwtspdoquKujZdLOiH6YkA UZJzXFIbC2S/2dEQ6KQvG55g2vIvizfUSpI2vBN2SN4JVfinnFa7hHQdxAROwmqAI85u eLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ww8G8SPu; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p7-20020ad45f47000000b004af9fdf84basi9011617qvg.111.2022.11.09.08.17.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Nov 2022 08:17:21 -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=@linaro.org header.s=google header.b=Ww8G8SPu; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osnjE-0001CX-Bk; Wed, 09 Nov 2022 11:15:04 -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 1osnjC-00019m-6c for qemu-devel@nongnu.org; Wed, 09 Nov 2022 11:15:02 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1osnj1-00078T-CA for qemu-devel@nongnu.org; Wed, 09 Nov 2022 11:15:01 -0500 Received: by mail-wr1-x430.google.com with SMTP id y16so26433643wrt.12 for ; Wed, 09 Nov 2022 08:14:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TkW7T5S7zm7opSYfPV3c9ibz6QYvnDa1N5Ybi4vqCbI=; b=Ww8G8SPu2ZcSeu389lYats1nfHf8H/jiGw+Y1AUKWgcF5FSFoATUL/+fnIKupfWtZ8 poG4POP/tgE5CTKFZxV49FNeL0kynclNzFBqtFkNI3Oz2NQAMdYbAp/JOztn8nic3d+1 fFqfXLGz5bZ3JBPWH9r+L1hhg+64TE4GC9rqVBa/oMruboGpipc8mIuj0tWtsww85Asg q9r6QsZUmYjCPBTwT7lEHxvqu418AfS9rIpRroIPp1ktviIOICmhpTfhw7wVvYgliWDu HFigr2yn4lYRqap0bEaFQNtNqQdkCM8Zsco+X6eTc/s/Zip/wkLkKKOYifdM6HE44FWc +dBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TkW7T5S7zm7opSYfPV3c9ibz6QYvnDa1N5Ybi4vqCbI=; b=syTd8DB0w3kQgnJT3slcCqyruoPdmmi89rFw3QPXHngbmdYO3+5yyrik4BpE4EQSkU XLqKAPJl1uK6cdHyFFVAwQS0dkmUOqSQLXzwxlly9hPTJvmgVdH3/IJ7gw6Dbcq4mxC1 CafU9hZqAeDTKQhWBvY91l38dcLAbcOcnj84Y199DVnpEkcRY+d/OUR6+PlQDoIdHl+W 11u5d0F0ojic/L6dtQBm53HD/wZNT9qzbZ91K/mIz+b8SVuQq49FpHh4EFmFo3qpAwQB +mLNbcrxiEPkHKOQzNl2qGjARO118j2AE1Lcmtrh+DzNIV8zRs6/56NQDs/CHeYk3trT n00g== X-Gm-Message-State: ACrzQf1fCEJOgGH9WPnSU13bl0AM5eEEJLzVGqHYn+BzBoV2DTsX8fJC J27pQsquLXAWRiiXa1BDMaX08FtEWXNUZw== X-Received: by 2002:adf:f687:0:b0:236:481f:83a6 with SMTP id v7-20020adff687000000b00236481f83a6mr39697164wrp.342.1668010488625; Wed, 09 Nov 2022 08:14:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id p15-20020adfce0f000000b0022cbf4cda62sm16209186wrn.27.2022.11.09.08.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 08:14:48 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-8.0 2/9] hw/arm: Convert TYPE_ARM_SMMUV3 to 3-phase reset Date: Wed, 9 Nov 2022 16:14:37 +0000 Message-Id: <20221109161444.3397405-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109161444.3397405-1-peter.maydell@linaro.org> References: <20221109161444.3397405-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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 autolearn=unavailable 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 TYPE_ARM_SMMUV3 device to 3-phase reset. The legacy reset method doesn't do anything that's invalid in the hold phase, so the conversion only requires changing it to a hold phase method, and using the 3-phase versions of the "save the parent reset method and chain to it" code. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé --- include/hw/arm/smmuv3.h | 2 +- hw/arm/smmuv3.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h index c641e60735e..f1921fdf9e7 100644 --- a/include/hw/arm/smmuv3.h +++ b/include/hw/arm/smmuv3.h @@ -77,7 +77,7 @@ struct SMMUv3Class { /*< public >*/ DeviceRealize parent_realize; - DeviceReset parent_reset; + ResettablePhases parent_phases; }; #define TYPE_ARM_SMMUV3 "arm-smmuv3" diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index daa80e9c7b6..955b89c8d59 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -1431,12 +1431,14 @@ static void smmu_init_irq(SMMUv3State *s, SysBusDevice *dev) } } -static void smmu_reset(DeviceState *dev) +static void smmu_reset_hold(Object *obj) { - SMMUv3State *s = ARM_SMMUV3(dev); + SMMUv3State *s = ARM_SMMUV3(obj); SMMUv3Class *c = ARM_SMMUV3_GET_CLASS(s); - c->parent_reset(dev); + if (c->parent_phases.hold) { + c->parent_phases.hold(obj); + } smmuv3_init_regs(s); } @@ -1520,10 +1522,12 @@ static void smmuv3_instance_init(Object *obj) static void smmuv3_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); SMMUv3Class *c = ARM_SMMUV3_CLASS(klass); dc->vmsd = &vmstate_smmuv3; - device_class_set_parent_reset(dc, smmu_reset, &c->parent_reset); + resettable_class_set_parent_phases(rc, NULL, smmu_reset_hold, NULL, + &c->parent_phases); c->parent_realize = dc->realize; dc->realize = smmu_realize; }