From patchwork Tue Oct 3 17:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 728750 Delivered-To: patch@linaro.org Received: by 2002:a5d:60c8:0:b0:31d:da82:a3b4 with SMTP id x8csp2260428wrt; Tue, 3 Oct 2023 10:33:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFm3jiTfUSO8AMl1QYpmSp8XIEYPapXLTUVXwra22FA7MqzGPmMCvoVZqShXoG3NHq4DNna X-Received: by 2002:a0c:b411:0:b0:658:8cc0:ddc3 with SMTP id u17-20020a0cb411000000b006588cc0ddc3mr10841qve.62.1696354381103; Tue, 03 Oct 2023 10:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696354381; cv=none; d=google.com; s=arc-20160816; b=BgrJTwwW8GyNYomeLQ7xsf4Q3Ke2ylmXC0HypXvDFjmDt/4f+mioXE9+1EEK676AVA LvN4dGtIoCJlP0WyHnnAPcn8kDlr9Yhgct1Tf42+McYRZ5RauKLnkmWlIn71iW4d7bk9 Q3iw+PwT/ahdS8TcEYkSl3rUFuSW8Myxq9ZOlvVTZDH1CYI5ZJ7BOxVGEXEuryIs9rRO ohkEn6NcukJUVmfOb8HGzNBWHMUhOfmFTeAmU0D2x0/ay/+QfYWPivrb1+3JtdYaAqtO l1rRAbHQsYLnk5S2pXyrdRnKSSFFwxhpJgrj2Kwi44UTzZNrRuFQi0jmPI0Hl+CTp3VZ cLQg== 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=i3wrIxgr2m5oHMVkH4v8wSAkRBNGt7xc6AFyiVFHwxo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=LEuhHOpsbdfg+EDoGfRt3cjGYHw4sNWwFQZcBsOHlDELG7aVsxVj/XoeYa0iGfVSeC QQeT6x1VR7uhfaayA6NZxmp2X/1mb8jpcl7siCG9GmTK7pGSL2kUpygHQq9W2UJc05i2 QyYsLDdHiUr09ijhRK03OVJPMpXCsGptRJYoPRo1Y6aKIKFlDSGGSAXqsgqaZEAGkey2 3i1aNrTTYeKgAtJ4U4CwnwHmM/gPboXotMcSlPxWNk+dbOeuNeGOBItBQORiLNHL5DzW 7qa0WzeN/4zr1XwxaNjppBle4FqmVyTlFO2+fvG8U9qstdFkG1Htl7YCs2OJjvaignyg 1ZRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZtoABmUt; 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 g7-20020a0cf087000000b0065af551572bsi694743qvk.495.2023.10.03.10.33.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Oct 2023 10:33:01 -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=ZtoABmUt; 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 1qnjEw-0008Lh-Ax; Tue, 03 Oct 2023 13:31:22 -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 1qnjEi-0008Fw-Rt for qemu-devel@nongnu.org; Tue, 03 Oct 2023 13:31:18 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnjEg-0007Ss-DU for qemu-devel@nongnu.org; Tue, 03 Oct 2023 13:31:08 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-57bb6a2481fso650103eaf.1 for ; Tue, 03 Oct 2023 10:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696354265; x=1696959065; 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=i3wrIxgr2m5oHMVkH4v8wSAkRBNGt7xc6AFyiVFHwxo=; b=ZtoABmUtIrXDFvVTVJsSXPZ8klkFsGAczdU7RZhe6k4uNKZH0vqbl0xuro4/inI+KL Mxm8zJiNuZwknkE0oah1jSnbq7bwi7CIOXKrYtSNvftEhyxmvrU9a91RfPW6wm0H9zTI h9Lg87TRUrw5pettygtkRk5VzOi3EfjSqKT6qnMciDaSpi/7SKHWRhVLS4l9Mrlub47h l9tPy80rBFlVdOOeDcwNULbqnD9EC5oqL3VlNEe4cknEMV82ZpThyEz7c/8/Gfny6+qH BG6qHtnEgo1YLEF2YK3F2yHR4+riy5YhKk3k7ATqydRxnOE8QE7Bw3X1Dv9CS/y4sG0/ W8yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696354265; x=1696959065; 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=i3wrIxgr2m5oHMVkH4v8wSAkRBNGt7xc6AFyiVFHwxo=; b=kAZxKcV+42NlLOrzbEMQNx4t13PpWSrGf48czUI0KSNiCRZf4ibjwtnN26fLX06kk3 9OGAfycjitMUv+ViFH1SscGD/jXNXsqphdyvy+Qcjd93jBeezJ+BEkWoElGmOwZi5DDn 2b2qZSMFsM+V1cu71PvObXDYXLdtiIEyU2Y6IPpiK5gpAfLRgxu6UQ3wx7SmxwERAe1J vjWc/E2TmqOklh7IvvXYaaDbidyPo5iIdpI9oprQo6ZErn4UdvGjrkgKLBnl7F/wL2gR kOSF6BKrS3xou6E9JVb7mduyN/ozDt0r8ZfS/RD8jrb9sc0UGtTABanxjWhhbxinE4zb I7RA== X-Gm-Message-State: AOJu0Yw3YaHdxKDELQuBaHKVjFBVi7HJJAYscKK1OoZRbhW8UxcabAyO QN2Uy9wWcZM0JSeiDymSzDbTEV7m9fxk17TdzMc= X-Received: by 2002:a05:6358:720c:b0:141:162:b0d8 with SMTP id h12-20020a056358720c00b001410162b0d8mr59585rwa.30.1696354265314; Tue, 03 Oct 2023 10:31:05 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id n7-20020aa78a47000000b00692c5b1a731sm1620195pfa.186.2023.10.03.10.31.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:31:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 10/47] qom: Propagate alignment through type system Date: Tue, 3 Oct 2023 10:30:15 -0700 Message-Id: <20231003173052.1601813-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231003173052.1601813-1-richard.henderson@linaro.org> References: <20231003173052.1601813-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2f.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. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- 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. */