From patchwork Sat Sep 16 21:40:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1835604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GU7et89v; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rp4PC2HNSz1ynX for ; Sun, 17 Sep 2023 07:45:51 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhd2k-00054Y-5H; Sat, 16 Sep 2023 17:41:34 -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 1qhd2g-00053n-PX for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:30 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhd2f-0000Pu-9B for qemu-devel@nongnu.org; Sat, 16 Sep 2023 17:41:30 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a88ef953adso2225756b6e.0 for ; Sat, 16 Sep 2023 14:41:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694900488; x=1695505288; 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=GU7et89vQoNgQXej9+v+sycADnrLUqdz6cEuULq923fa/Suf5HHK3SR0m3Sm58M9AZ ncuDOmsJV3zbGaKYfUlw4G3y3tohWuNywY57Ps5+CNLlOyawCWFp6o8w9No3ZWPCcZaq spwTw7/Z9UIbmtiq2GCs3jB72LldprzUBgI7uT4RxUeNjEGvr957Fkny9HW8jFi3+d6u omuTaSjb4oItUSqXskhtTD46SLFQT/9mQ9ZeQ3YPJJVV0/cqRAwRos2Rrl0AO/Yg031i CFlfE4CkX0+/Vl4GTqN9Sk23DYOivY1FFkhbKYpm1mGY6HS7xmXkn6GYE1F+1u+EFbwi fTiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694900488; x=1695505288; 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=NgNgN9azCh/pvYP96xp/QTH98ezXmvW22Fyjc8LT2JVG1shxz/a84GUlyulLAlrqja U+yuRv/KLb6H/3mG6FUjYLlMFeMdpqx7Mv+apq77XDgmGxlZkNP//wwg5mxZNEHyOpXa NCxWC75dOmG50DWIASitvrXLv9ukFjglKcTViCFdU8YMuHDY6x/sRYWPnxZYfJdZa2/h sf4nEAr4nh9JjkScpd5/mC+aVa97HFRnxWNMWfM5wkvZciYVy6XWAbUo4/OXLuGYlUGz yEbjYyUvD9BFs94kM0eYoq2f7NW4TeyTfKHcx5adnMWTwy2Hq6SCSBnCwlix748GJ0aq K9sg== X-Gm-Message-State: AOJu0Yx1voF9TVBHXe8XPDe+x+mHfIZIy53qprotWc+SYx/GSppy6k60 XP3sze1JEtn5pktWa8Hxg/n5mzpjJMnnjh4TlIM= X-Google-Smtp-Source: AGHT+IHpIsUeX0tfLcrOYHX7LdBPICenQ7KnkwDxe3btiFqtI3XPVN465PHmMYQcadyuJ0zt9sRpkQ== X-Received: by 2002:a05:6870:b4a6:b0:1bf:9fa2:bf8e with SMTP id y38-20020a056870b4a600b001bf9fa2bf8emr6918969oap.1.1694900488113; Sat, 16 Sep 2023 14:41:28 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id n21-20020aa79055000000b0068fde95aa93sm4871708pfo.135.2023.09.16.14.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 14:41:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org, anjo@rev.ng Subject: [PATCH v3 03/39] qom: Propagate alignment through type system Date: Sat, 16 Sep 2023 14:40:47 -0700 Message-Id: <20230916214123.525796-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916214123.525796-1-richard.henderson@linaro.org> References: <20230916214123.525796-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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. */