From patchwork Thu Sep 14 02:44:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 722515 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp168613wro; Wed, 13 Sep 2023 19:46:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEb2OfrSLDKFkXKmBb2EBlQ0aVTiVyaslkiyZYXFYQdI7US3LHlloIzwlNTAJ0gddilNYZD X-Received: by 2002:ac8:5a87:0:b0:410:7ba7:3815 with SMTP id c7-20020ac85a87000000b004107ba73815mr4684938qtc.35.1694659571176; Wed, 13 Sep 2023 19:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694659571; cv=none; d=google.com; s=arc-20160816; b=fjWFb8LXvPS1RtcyBgxIJx9VOjebD/4Yqt4zOSsG6aQG2mKl/9PoqgqXg4rqGcIM+7 Rw2zbGad8e+uqCSozvUVS9d8lqB3zwxykpJif+yk2RR+UsUzCbpIr2T6WF+sucfBhpCB 6wSwYHDW/cs+uTtC1drlv1UO+ztgcQd/YCxAyEbWTbEWa/fn4Az5olm06PUTnxcu2MAu 9lTDlaBaBDA7QCKVPVqOW6366eP4Tc6qNxj3OOaEL2CRSOt/FsJ4Zc/IdodY3c+vtm73 luvQAwiftos3KY8G0cfoXd4WOiDoFVoJ0XBjYAOFR5FnKZsvOMfg8JpbtOvkknnaPJ6U kyuw== 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=gAwhqBbS3A7jmg0vWZ/EipKlE7I93weu4iFN2PEsO7Y=; fh=hDn/fDAvdH8as8KUfuhQfhp9TjOOsPx8dCoE4FbO+Y4=; b=Mz0Bi97M+rbXXBI+OE+b266kj5hN0zaQEhUMVNKV3+o9NJyMCeBAo6+1jMntN9rszr h37gG9C6jFU86TsS+Ws8FA5IDieOofQ7xPuf9Z4v+UFl76Bd0NCGvF760pnhX+2gV0ZD ObwNCH/HXxVEMfANUxBq6XozOZxrAk7uTpBbTR9S0YTsmNdyx0B1oaQExJtjZeBMjUpe LIHU4dLxR5QGyZ+2qfLtTVFitJaLpF44RpQ8YtJF3AMaE38xwJT9j29m0vyG5rRGABDD +KuW4RTZOwhEw6zCoRXq9TQJShvnTQNN2QSZUC2qyosNOH3u54f6WBzfnu7xeOsY/yI1 zhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rxGQoRaO; 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 c13-20020a05622a024d00b004136c87135csi386416qtx.478.2023.09.13.19.46.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2023 19:46:11 -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=rxGQoRaO; 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 1qgcLT-0000aO-WB; Wed, 13 Sep 2023 22:44:44 -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 1qgcLT-0000Zx-3G for qemu-devel@nongnu.org; Wed, 13 Sep 2023 22:44:43 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgcLR-0000ez-6k for qemu-devel@nongnu.org; Wed, 13 Sep 2023 22:44:42 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-577a98f78b2so324896a12.3 for ; Wed, 13 Sep 2023 19:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694659479; x=1695264279; 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=gAwhqBbS3A7jmg0vWZ/EipKlE7I93weu4iFN2PEsO7Y=; b=rxGQoRaOpyE5ItWGs8mwxVZ44RLq7XzDkROFIy6h52CdiIg2J2KnD1Gaol9MpYywnY 6zAG77KRsTAVRbS1SE/IkInoBb0pegGxnx/H0WRtxkdDJaC5aUp34Ye0UObGYPK96dPn oik4/7eu23iH2woM3DgwfIaAjraMdbNopiDMfBue1J0bq70svoyhhw79gNvQcaUaIRNS G/BeoL/jYwfoxXZB2h1XSB/53N3B8ogLBTy8pYQZjs7aUEpx5bZxgU/STMFUOqJXtfYW cE9CIM9HQrq8LGLakGDBSjXsur0OHFzk22VatJNWFheNOR7FvDTvTF0c4WYoFzamG679 4onQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694659479; x=1695264279; 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=gAwhqBbS3A7jmg0vWZ/EipKlE7I93weu4iFN2PEsO7Y=; b=SMEdqiZIQ3vdvIcJw21TrVe9QzBey8XIcAiy3hfObXwdtrlkfzZdtQIIj1YY2ciplD KUB9CJxN4Cc/Z1jETxPL8yeqKUP0Eay7oBINPj//fUjmtJbmBVMT2t51u2a2a3KAwF6d U3zobXV7mL/FKEvciW9LwXZRV0DEYzntLvgxOd8hnDraUnns+/ylWxeJ5rk1+cRetE/2 oET8Tj357GrfBMcg2/aIUhK7iCwqI2mbFVaWhMJW9U3K2e3F0R4EYugf1UxVPBes1e4z oZtKXKidm9U+bxau4e222FQ9cR51GQR9Y1maY/ebhla2I8kJyCtVKtFpp4bfVLsac9uW kKTQ== X-Gm-Message-State: AOJu0Yx7mJvMJsLZeA3iVH1udi5DnT1Bqh1EMM86o2q3K/IbZ5J+yIX1 araCIFoSmYER8Jgxl1iwfKAKqkHLlcRvQdNiMGs= X-Received: by 2002:a05:6a20:a111:b0:14e:3ba7:2933 with SMTP id q17-20020a056a20a11100b0014e3ba72933mr4585116pzk.54.1694659479725; Wed, 13 Sep 2023 19:44:39 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x24-20020a170902b41800b001bbdf32f011sm304336plr.269.2023.09.13.19.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:44:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: anjo@rev.ng, ale@rev.ng, philmd@linaro.org Subject: [PATCH v2 03/24] qom: Propagate alignment through type system Date: Wed, 13 Sep 2023 19:44:14 -0700 Message-Id: <20230914024435.1381329-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914024435.1381329-1-richard.henderson@linaro.org> References: <20230914024435.1381329-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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=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 Propagate alignment just like size. This is required in order to get the correct alignment on most cpu subclasses where the size and alignment is only specified for the base cpu type. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- qom/object.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qom/object.c b/qom/object.c index e25f1e96db..8557fe8e4e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -220,6 +220,19 @@ static size_t type_object_get_size(TypeImpl *ti) return 0; } +static size_t type_object_get_align(TypeImpl *ti) +{ + if (ti->instance_align) { + return ti->instance_align; + } + + if (type_has_parent(ti)) { + return type_object_get_align(type_get_parent(ti)); + } + + return 0; +} + size_t object_type_get_instance_size(const char *typename) { TypeImpl *type = type_get_by_name(typename); @@ -293,6 +306,7 @@ static void type_initialize(TypeImpl *ti) ti->class_size = type_class_get_size(ti); ti->instance_size = type_object_get_size(ti); + ti->instance_align = type_object_get_align(ti); /* Any type with zero instance_size is implicitly abstract. * This means interface types are all abstract. */