From patchwork Mon Dec 11 21:19:38 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: 752534 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1548237wrs; Mon, 11 Dec 2023 13:25:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeIieohPX7DYqXNj91sX1NH8Q3fbasudWuB1oqTVJlpXUFdcHJjneUAGvmIE75opsu0Kua X-Received: by 2002:a05:620a:7e5:b0:77f:36cb:49aa with SMTP id k5-20020a05620a07e500b0077f36cb49aamr5150709qkk.89.1702329954835; Mon, 11 Dec 2023 13:25:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702329954; cv=none; d=google.com; s=arc-20160816; b=UqZ50BYJZUVDdnGf9ZHXPQGpVO7IcAreneJZOF8/KDczWDip4rWRyN+bfSJq/aziLm 6Q71f1bhNVjoHy22PbeExNokCqBQ17Lg1KQwzLfA/9GS6R+1kngvRdhiJEMp9EQIq7HH 83Ok9/CrE9vtCz2vb0bFuxtIW+Z49dg5cUA/D6YUgw5RWR2xXewkaOmH5bPcuJaPMCfg 6W6yMPZuPtxi49+MHETAVcF/c7/HSRIuRzqabNUdWo+l2Rdn4HYLcQC8lV8KXL636YpW YsPVRKabWA+z/UHx27wAImJ7TOipN2U5bMU9bdxfNhpFJexiwxg+4Hys/OUpFFWfdp5u E3WQ== 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=+O6qsD4iSikKX7LlQ9zhnH8XNtR1+Zg+F3UQkLugJvM=; fh=6uA3yvXeN55FEhLQ+7xhayEyGzy+Y3z2qOYV5oRrcR8=; b=hHEfZPphrJnZoIgXwiJV9ldR2quZUYgvWBq2uuTGCCPX9tZ8N4bnLP6WXGxUWCNKjw TyTNvim7Td/KGj/u7Rbqdo8wpk10Rknf+N+SnD+XTNrbWI+9SBgomjIogsuUA6KtvX5G eWphZR38ee7tzON9kBN6b8Ib8F4Q67keU3smayhS72SHf36VSzt3Ep6OoH39WSXeH0at k57q0KMb8tJb/p61e3olOivlKdOVBVuBm2nuWpGs1o2CNFmOzlm0GOJh0LYVGPq5tGqM ZZRPByR9zDeaZBKN1k37pJWXOPZ8dAnX0sHWXxpqURQkUeABgprAJonAcDOZGP76RB/I doUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xjhepvAc; 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 d26-20020a05620a167a00b0077d6c574808si8838552qko.491.2023.12.11.13.25.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Dec 2023 13:25:54 -0800 (PST) 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=xjhepvAc; 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 1rCnhi-0000hx-Pm; Mon, 11 Dec 2023 16:20:42 -0500 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 1rCnhg-0000gj-88 for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:20:40 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rCnhM-0005CC-Nl for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:20:36 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3333b46f26aso4702582f8f.1 for ; Mon, 11 Dec 2023 13:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702329618; x=1702934418; 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=+O6qsD4iSikKX7LlQ9zhnH8XNtR1+Zg+F3UQkLugJvM=; b=xjhepvAcZyeTjITanX2UP/ql6SdyZHBfxcRYpFDCCwFrcIiS1g6UVzpcO6pm2LFJ8k EnJpjOsVK8Pfqn+Gv8YloNi1nVkiWgmgmPRSjyTqtk75r+2QTF7rXfU5SQWulO88yqJf +r1xtiGWBVu9KM/+cTA35W7DucBMJhuRmWh5fLplDpc0kWKa2msuCjqSUbJD9y72CR62 mRTPZpfE4y6b1tqMG3KkxKSGko6cKr8ynIcSxlinWZlOfx7fehmYxpvZgeVWZnUFVgXu E9koTyumZ11/MlBWtCOzJxpBVnAeOoTLdzrXsmhios/hfTHAStdLjVJjTXIF4TJCb/l4 dcZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702329618; x=1702934418; 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=+O6qsD4iSikKX7LlQ9zhnH8XNtR1+Zg+F3UQkLugJvM=; b=vIN0jQ+k/qDCunXUce3OYubq0OKtrBnkZpXjQbJnTTAMYb+e0OZ22of2uk2w6IUG98 HSzmANKO3jWR1orjQX4SzEclhpnLUMVA9Kpd8yRdlYTdWL2QCRUrulvC6fUvDCb6Tq9y Z9QpsyC8nuaILA6e6LVRv5mCvFYyEPR4ZIWfWrws+eoVhBqXRchmK7ElH5ebegkbwFbg x9ZhGuB0qlUV9bSYBWVVprYv5EDtR+nMroWlsfzjNaWMQWj3OWsLUMHAgota10k0trCb UNZ2gI0b4KQwoZMP5bRjtxi2VDtWrrJdjm2jnjzmrxe7Jfg1iNXaHvH8uYx9UA/Blgfq kIJw== X-Gm-Message-State: AOJu0Ywp0tCZyOPxhDkDeG/P0iWvcYTNhlQ3bSmCxuo4a5hauxBZqrDV M5tG9a9ac4kVuDyryn6IjkmUsXTFs3PCnNuWRYIdzQ== X-Received: by 2002:a5d:4d8e:0:b0:334:b24d:c18 with SMTP id b14-20020a5d4d8e000000b00334b24d0c18mr2975705wru.2.1702329617610; Mon, 11 Dec 2023 13:20:17 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id le9-20020a170907170900b00a1e2aa3d090sm5264476ejc.206.2023.12.11.13.20.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Dec 2023 13:20:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Peter Xu , Liu Zhiwei , Peter Maydell , Mark Cave-Ayland , Eduardo Habkost , qemu-arm@nongnu.org, Paolo Bonzini , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-riscv@nongnu.org, David Hildenbrand , Warner Losh , Claudio Fontana , Brian Cain , Daniel Henrique Barboza , Richard Henderson , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 01/24] exec: Include 'cpu.h' before validating CPUArchState placement Date: Mon, 11 Dec 2023 22:19:38 +0100 Message-ID: <20231211212003.21686-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211212003.21686-1-philmd@linaro.org> References: <20231211212003.21686-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 CPUArchState 'env' field is defined within the ArchCPU structure, so we need to include each target "cpu.h" header which defines it. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Warner Losh Reviewed-by: Warner Losh --- include/exec/cpu-all.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 5340907cfd..9a7b5737d3 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -411,10 +411,6 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr) /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -/* Validate correct placement of CPUArchState. */ -QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0); -QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState)); - /** * env_archcpu(env) * @env: The architecture environment @@ -437,4 +433,9 @@ static inline CPUState *env_cpu(CPUArchState *env) return (void *)env - sizeof(CPUState); } +/* Validate correct placement of CPUArchState. */ +#include "cpu.h" +QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0); +QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState)); + #endif /* CPU_ALL_H */