From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:907:2c4d:b0:94e:1233:1117 with SMTP id hf13csp439179ejc; Tue, 11 Apr 2023 04:49:33 -0700 (PDT) X-Google-Smtp-Source: AKy350atTh6+esHD4kqa6eiFjjvXctZjdMQ4u+ln1tUji5e7MaDKtgBJ/aJjfRbzf75laPNfzruB X-Received: by 2002:ac8:5ac9:0:b0:3d5:500a:4809 with SMTP id d9-20020ac85ac9000000b003d5500a4809mr22589319qtd.26.1681213772303; Tue, 11 Apr 2023 04:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681213772; cv=none; d=google.com; s=arc-20160816; b=SjAc1QyWGRBcH1PujPMc9Jnx09A43jCGF2Ni1i4g2iIuLfoAkup/Y1VZ53vm80Q/G4 zCRLVUNLYNMnxsfCNS5nCgJ5AKgSzxDO5wyXz0YV7SeKgnc0Bp56ZFzETQT1YAR48DQ3 PcN52MCSM++RDMnZwj4aB+KFb4EcnUZykwhSr4HzSl3AggBOxua6bI+Y9oxTj5rk1T4O WnOH1jbpsUHuKdLIvS2x6IjK4hXshaRZ1CdrqFDeG6zkrHeDvScsQ8De4Ob5FOkw9Jww t6zoxndy5gW1mAmhOTMqswX8cxVHG3LcdvQBkqdmPaZvBtpg0SG3saMGz11dttJqZzXi y6qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IsQyc95o8bd+OcnbSy5PFUoAsdLax7/Na5qep9DeBzA=; b=CjelRbqxspX+VTfrY/jHgo8f1Wd2ihrGzplHatUzDxLhExYZ6A8AgB9cgrjF70eQB0 Mix/4hxVu4P2p3JybeJ0nM+Uslm1CXSmMVw6mjA5bwBm/2NHHcq62gfgZyRMG7ELjOCB gWhTKABgiq5dZTPd5GHJyJfBReshyZJqZBrWTsFglJeVrbOWjyZjj+6G+hegftLmmSSG mJQ4H7jYcRLdP4+nzE9hMn8ysSlarAP635Fa7ERRMmOgmvXkZ5gmhU/+Oa1pcD02TxMG UmkmoWbn0DPgHUZUzVo0505RhFl1g6ivIfD16T1+6vRzoLZyj9oxLfrCaf6PuU5t09pe fEFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=fjKFjpqk; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s81-20020a37a954000000b00746a8eb3715si8776768qke.11.2023.04.11.04.49.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Apr 2023 04:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=fjKFjpqk; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmCUw-0006fD-8P; Tue, 11 Apr 2023 07:49:18 -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 1pmCUs-0006bm-9b; Tue, 11 Apr 2023 07:49:15 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmCUq-0007xr-AA; Tue, 11 Apr 2023 07:49:13 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 39-20020a9d04aa000000b006a1370e214aso1969907otm.11; Tue, 11 Apr 2023 04:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681213750; x=1683805750; h=in-reply-to:content-disposition:mime-version:references:reply-to :message-id:subject:cc:to:from:date:sender:from:to:cc:subject:date :message-id:reply-to; bh=IsQyc95o8bd+OcnbSy5PFUoAsdLax7/Na5qep9DeBzA=; b=fjKFjpqk2JIn23C9/CQ01lfb6BSSjZWOAM5eVdNlCnv+q2P9Q9NEbKWoPfYmgtIsEp 6D3wk+j36ZdREzwbBRLPZbg+CdjB8Hxooymy/oiPzkocZemazghFWRcpmd5oXalsYFmi x1mBZkJ1kG/eD+oxFcNKYKggEP58eOH+9GO+3AN9w6GbADxGtOAFJ56wQMtDFfMJ9p+I 6msx0ciACRQmoC7iZoxD/uLW/FwEudPxbJHi46xCZrtkHVrzw1SHXxdR5Zu0B9mBK452 e1jv4QquJIuWg2I/SYd83zu5enFH1GxPqaT+yyxIVBQgqw9HFrr+MSyT4jj26oo+v6ly /hqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681213750; x=1683805750; h=in-reply-to:content-disposition:mime-version:references:reply-to :message-id:subject:cc:to:from:date:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IsQyc95o8bd+OcnbSy5PFUoAsdLax7/Na5qep9DeBzA=; b=2ox+30ohrKu8djAt8b2GTdKEaPwMQEa7yOmIHCUUCqi6IGaUMh75tEGlKipn7ZXTZE 02tUn/CXsn/V0WVKijGCiieoUs7VYpWTRKmuF2bbQhvbL0klQoijbQEtXmW2J6WSiHL5 3J6QcdCemKbTixZiSTpxzmdBGx8bbV+a3kFIde6FeBZftRw4do7rqf76dBbKMKumsnlW QI6BSRrFijLm9Pq9BoC5QJcdUw0WSe8SFjZkYzP8ucWxgGwd6WUaloyfPQPA3+JSXpFJ i+WjsSdB6GByEbcvO5SNVLYV8pgX79DmYTO2E4Pdb9O/wgGn5r+2l1ePna75zFweYGo2 D26A== X-Gm-Message-State: AAQBX9ePYD4RW4BkVY1YgppGE4vu/mLLoLyZTt12ASR4h5P7I9M1IrFO QIX2bf2kyyuznULidiPyTg== X-Received: by 2002:a05:6830:12c8:b0:6a1:37f1:9863 with SMTP id a8-20020a05683012c800b006a137f19863mr5698389otq.11.1681213750376; Tue, 11 Apr 2023 04:49:10 -0700 (PDT) Received: from serve.minyard.net ([47.184.185.84]) by smtp.gmail.com with ESMTPSA id b14-20020a056830104e00b0069457b86060sm5407387otp.47.2023.04.11.04.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 04:49:09 -0700 (PDT) Received: from minyard.net (unknown [IPv6:2001:470:b8f6:1b:b8e9:4170:b6dc:61ca]) by serve.minyard.net (Postfix) with ESMTPSA id 8F32A1800BB; Tue, 11 Apr 2023 11:49:08 +0000 (UTC) Date: Tue, 11 Apr 2023 06:49:07 -0500 From: Corey Minyard To: Peter Maydell Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qianfan Zhao , Thomas Huth , Strahinja Jankovic Subject: Re: [for-8.0] hw/i2c/allwinner-i2c: Fix subclassing of TYPE_AW_I2C_SUN6I Message-ID: References: <20230411103106.3992862-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230411103106.3992862-1-peter.maydell@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=tcminyard@gmail.com; helo=mail-ot1-x32f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: minyard@acm.org Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: 5iWHxBMYRLjn On Tue, Apr 11, 2023 at 11:31:06AM +0100, Peter Maydell wrote: > In commit 8461bfdca9c we added the TYPE_AW_I2C_SUN6I, which is a > minor variant of the TYPE_AW_I2C device. However, we didn't quite > get the class hierarchy right. We made the new TYPE_AW_I2C_SUN6I a > subclass of TYPE_SYS_BUS_DEVICE, which means that you can't validly > use a pointer to this object via the AW_I2C() cast macro, which > insists on having something that is an instance of TYPE_AW_I2C or > some subclass of that type. > > This only causes a problem if QOM cast macro debugging is enabled; > that is supposed to be on by default, but a mistake in the meson > conversion in commit c55cf6ab03f4c meant that it ended up disabled by > default, and we didn't catch this bug. > > Fix the problem by arranging the classes in the same way we do for > TYPE_PL011 and TYPE_PL011_LUMINARY in hw/char/pl011.c -- make the > variant class be a subclass of the "normal" version of the device. > > This was reported in > https://gitlab.com/qemu-project/qemu/-/issues/1586 but this fix alone > isn't sufficient, as there is a separate cast-related issue in the > CXL code in pci_expander_bridge.c. > > Signed-off-by: Peter Maydell Looks correct ot me. Reviewed-by: Corey Minyard > --- > hw/i2c/allwinner-i2c.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/hw/i2c/allwinner-i2c.c b/hw/i2c/allwinner-i2c.c > index f24c3ac6f0c..9e8efa1d63f 100644 > --- a/hw/i2c/allwinner-i2c.c > +++ b/hw/i2c/allwinner-i2c.c > @@ -466,10 +466,8 @@ static void allwinner_i2c_sun6i_init(Object *obj) > > static const TypeInfo allwinner_i2c_sun6i_type_info = { > .name = TYPE_AW_I2C_SUN6I, > - .parent = TYPE_SYS_BUS_DEVICE, > - .instance_size = sizeof(AWI2CState), > + .parent = TYPE_AW_I2C, > .instance_init = allwinner_i2c_sun6i_init, > - .class_init = allwinner_i2c_class_init, > }; > > static void allwinner_i2c_register_types(void) > -- > 2.34.1 > >