From patchwork Mon Sep 18 10:17:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 724145 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1601069wro; Mon, 18 Sep 2023 03:18:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVEDd9FpZbIoKlHbPQ1sDReZUbiX1kMho+HNilhtt6UU4MlQav68EgP2q4u4NEO/wwaA83 X-Received: by 2002:ac8:6ec3:0:b0:412:30bc:1d70 with SMTP id f3-20020ac86ec3000000b0041230bc1d70mr8007406qtv.14.1695032315876; Mon, 18 Sep 2023 03:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695032315; cv=none; d=google.com; s=arc-20160816; b=ro5tT2OfrUxoidRLJcecqQpBpH98a1Ke4/aMR9IDfZdHEg+H92TR54SUS+OuuoiBKW xa5k8c9WjreVyESammOJpyzEz1CXtAktw0rnUV9X7J9XK4qOMbweNWVzNS+izdRQ/y2x 0R9z7AzlKxzpU7ybrXWxIVF1/nRaVEzxeNK1QI0N6ToLi82Ai+94aqd9covJwlGdHu6q O0fmVd9Ppps7ftPVhcXkMtTyNSV/PFo/3uFu6Q1RXnSqAghfZJle5zWKAdVQ6Ji52d2i bPdv/pDnhWOprS0aoWeYgdMpA/VMRHNegHdDQ4vINPI2v2qbjFfwtiKRUlqIHAnqSnSz ptng== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=OeLfLl3LjSe+flyYRXHJoPyc020uZocilUJMKnQncFo=; fh=9n/Cm2KnMX6Qk7SoVbKt4LcEa/gSBuZo6NwnCSpbrp4=; b=PGaxyAUcCg30/HC3Fwcu9ljOxpfrkwItP8g+IhJzIzGkyf6eO4iZ/BjFR/mlu2V/uw pUVBcH7KwMVZ00OPSmeNbTjNAsldYcL6dMehvS7OQlDPLbtpebOg0wCCkXrZL8LHlHnX TntVoFDnu6TrppYvLlVKcA+nx7iRor/oWoCCbCFTq7fht6liAJBbMMwnsSoNIJdDmL3o icZlWM++MjH/Afqg43uHHgTh+VgyoKEN1SLb+PzpdmKpUas6uSxe9XN4EDzXyaHikOtV +0S2BDy3nVtezEoM/xca7PY+sC55phWS0u9PIpoBAkRfwqmC7rWMxMujw9y8fkHn1IZf WqwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DNhXxsTg; 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 p18-20020a05622a13d200b003f6b4bf422esi5905546qtk.257.2023.09.18.03.18.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 03:18:35 -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=DNhXxsTg; 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 1qiBKB-0006HP-FF; Mon, 18 Sep 2023 06:17:51 -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 1qiBK6-0006Gn-Jw for qemu-devel@nongnu.org; Mon, 18 Sep 2023 06:17:47 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiBK2-0006n0-G4 for qemu-devel@nongnu.org; Mon, 18 Sep 2023 06:17:45 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-404539209ffso44268615e9.0 for ; Mon, 18 Sep 2023 03:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695032260; x=1695637060; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OeLfLl3LjSe+flyYRXHJoPyc020uZocilUJMKnQncFo=; b=DNhXxsTgrxi5pjnJ17NCrhNfsmlSSTmwZc7O/RJ0DZVKBIt0MrSi/cjhztg5PDR/mf NLCggOY0g8Do6FXADQ5uxxCgLtrGYJxwF91o9VEOF/w9Ql8EqJXaD7TcxRJspKhJIIj4 799jyniOJmMNpY1ZlYLSVKsGoJYqGiidp/IhvyKeqdyZ7KlFtJkikFfCYoCX18G5Jx9Q SsGNA1jBg73jRZ3IlZ1TmTDMugwOhMGVO4dAr9HjT/HthjboEGvliKSmcBXKe0VgSVpY ZxHykH4ZcFuc2s+vgkxaISDAZ6H+2UBZtIWCSMTrd7zX+tS2q9hDeBC73fAvprRoY4jC K/JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695032260; x=1695637060; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OeLfLl3LjSe+flyYRXHJoPyc020uZocilUJMKnQncFo=; b=TDfVG3cDvPmmAd0FZvi8Igd38WpQLjExoFOV4Cm+QPs2r8ys9kR78tHwwHscibG726 MgE+GGcacakIVE+THeyTxssTb1goTzSKTLnrhNpUHYt39ajMoWNP0Smen3msSVioHQ6f WTpB3TBxwyR8Po2CBDWk0OuCybBzxNT9H3pRWr5z5pQ0jTZGiUlp5k0JPY6tdH4JkzB2 pL8/2eSI+oyWxzf34QDNLAZiuFB7hRZDmhIyNJyo7mfxFqpntJXXOLwaOWS3tDEKGDEk oTbhPYXEbYjVTEUwNuZvG3jLhHvG/uydEE8RstvqZa4mk0RlT8i0KlH7aKzfjbp6t83Y drFA== X-Gm-Message-State: AOJu0YwuKuPW8sfLXOeN+14nNaEj/2j9xW2SlCt9AApjlWZlZRDf/XrE RtOVppU0TmwyGulPP/xX+Z8LE5k8bgePK+hU1ZotSg== X-Received: by 2002:a7b:c84e:0:b0:401:7d3b:ccaf with SMTP id c14-20020a7bc84e000000b004017d3bccafmr6649664wml.4.1695032260467; Mon, 18 Sep 2023 03:17:40 -0700 (PDT) Received: from localhost.localdomain (5.red-88-29-175.dynamicip.rima-tde.net. [88.29.175.5]) by smtp.gmail.com with ESMTPSA id y19-20020a05600c20d300b003feeb082a9fsm11960178wmm.3.2023.09.18.03.17.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 03:17:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , "Daniel P . Berrange" , Eduardo Habkost , Alistair Francis , Paolo Bonzini , Anton Johansson , "Edgar E . Iglesias" , Markus Armbruster , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?C=C3=A9dri?= =?utf-8?q?c_Le_Goater?= , Mark Cave-Ayland , Bernhard Beschow , Peter Maydell , Alessandro Di Federico , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 0/2] qdev: Ensure devices are fully realized when calling DeviceReset handler Date: Mon, 18 Sep 2023 12:17:34 +0200 Message-ID: <20230918101736.23905-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 In the process of clarifying QOM/QDev design, we want to enforce the QDev state machine, in particular RESET can only happens *after* REALIZE. Besides CPUs (which are still particular), the only case I noticed is in a non-QDev type (OMAP MMC) accessing a QDev one (SD/MMC card). The first patch first handle the OMAP MMC case doing minor surgery (passing a 'realized' state to omap_mmc_reset(), the function doing reset out of normal QDev RESET tree propagation). The second patch add an assertion in QDev core code, in order to avoid further devices being added out of (QDev) order. Please review, Phil. Philippe Mathieu-Daudé (2): hw/sd/omap_mmc: Do not reset SDCard until being fully realized qdev: Ensure devices are fully realized when calling DeviceReset handler include/hw/arm/omap.h | 2 +- hw/arm/omap1.c | 2 +- hw/arm/omap2.c | 2 +- hw/core/qdev.c | 3 +++ hw/sd/omap_mmc.c | 21 ++++++++++++--------- 5 files changed, 18 insertions(+), 12 deletions(-)