From nobody Wed Nov 27 23:38:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1696871776; cv=none; d=zohomail.com; s=zohoarc; b=afozKuHK75v8YeeUhxQhZeKch12z193n6mJ8LJXnx0gPfRBoJlEzMm2rSyj7n21uk5C+xz1JIAUl8tYJMmbC8JVjNC3eY2Rz45ZOSXUQKuh0qiKwhfdXrU2hL+5/s+qyUq9trMlrE04n3SXvBeVwKfx2guQdRQjlzuEWRCQrHS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696871776; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PeZLMWVBcIq2AL5jS2WYOBrnjRfadpnh5KEt1PKPozs=; b=iNwV6iCcBF1w8c+PcsHsySQZT3bN2lTYKJuqPV/e6pwqZIg7AAkBOHL/2GMFi7WFw1yZ+fZXMbeaWDPJPHvPR3xtS/A8fOkc7XKQRvwvlsIKGFi27GcNQvlGEK2VHMz+G07aIUQCsA4ueW8/6vOUcJN8cqs+YuNgCWLVDvTUdVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696871776349632.0949012104497; Mon, 9 Oct 2023 10:16:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qptqj-0004IG-QG; Mon, 09 Oct 2023 13:15:21 -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 1qptqf-0004H2-7M for qemu-devel@nongnu.org; Mon, 09 Oct 2023 13:15:19 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qptqa-0001Qd-BF for qemu-devel@nongnu.org; Mon, 09 Oct 2023 13:15:16 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-536b39daec1so8146484a12.2 for ; Mon, 09 Oct 2023 10:15:04 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id u5-20020aa7d545000000b00534e791296bsm6339002edr.37.2023.10.09.10.15.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 10:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696871703; x=1697476503; 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=PeZLMWVBcIq2AL5jS2WYOBrnjRfadpnh5KEt1PKPozs=; b=wkROtT7EuYRh2NoUjFNlTIsB1I2wklm+gYjvOQCSqT1NRWkUZnZgvg+CFgWxVouIwP RUhdVNVhbwobcBQrmEAL5mQiDq89A8HxcxDsypEf8+GJzJzxwaYbhT1ovR6hQC1CzLyn BY9sed9w4RrWSgBKh7Xyp1Wcoub9FdhRdqBAad2mvW/r801vZtiJDRvGW+9d0T/w+R8I UP4iYkOFHZTXxxrpMXzjxJMAJm9soSrtFMrlkJEo7UpU7c3s2mgFL72DzpPmEIEfuwGd SjAQbtncvEQBHYLCLfQLAFM3QXoxDPpLO/TrMvB6nH6dKmM0Ff9VuSwfDl5yjJyQXtgy /Mxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696871703; x=1697476503; 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=PeZLMWVBcIq2AL5jS2WYOBrnjRfadpnh5KEt1PKPozs=; b=bmarJEZrWG8607Sv4WR2UbUXs4deogrBA76Mdg126IejOSBKuos4LXuMfLLVTwn0pl GMFsQcX97tXXuC2kWpAn0KIHg+wvh44cAA3JXviTt940Ys3wsuY6u/iD4xNPmp9oMzuw 6nzSIfmkgbViesexgQ0vlxgKzzcpbzoVPl97JaT5AU4Zso2ZNDH6TuexVf2GAy3jkmR1 UdXeeXEvDrpY8pTu9YEE3Q48Lc4Fn780doKigJBveL1Sg5z28kY/fpFxN5ln6IHmCcgV Oy0RGxAL4PtZV0jKiNihGnvXHhkGeSTo4Ln4oOlB2oEcjuKsC/b3YaSjypsr6YVHAsFb aXXg== X-Gm-Message-State: AOJu0Yw+X2kE5nBwXcreI8gJkdlEEWEddr9A5IMxnu6j46P8hAetXyNG ekwLU3YGqi1dJCWmWOKQUyyDQvmVdJVNbDmxM6Q= X-Google-Smtp-Source: AGHT+IERpTp4GJSMyxMDnOGVGwLGUhGLXeSpgxwVaNHDny0rDLELHcvdNPAE6nXCnxaqU6PbtKIcKQ== X-Received: by 2002:a05:6402:389:b0:530:8897:f0e9 with SMTP id o9-20020a056402038900b005308897f0e9mr13757593edv.21.1696871703530; Mon, 09 Oct 2023 10:15:03 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aleksandar Rikalo , Aurelien Jarno , Jiaxun Yang , Richard Henderson , Huacai Chen Subject: [PATCH 3/3] hw/misc/mips_itu: Make MIPSITUState target agnostic Date: Mon, 9 Oct 2023 19:14:43 +0200 Message-ID: <20231009171443.12145-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009171443.12145-1-philmd@linaro.org> References: <20231009171443.12145-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1696871777116100001 When prototyping a heterogenous machine including the ITU, we get: include/hw/misc/mips_itu.h:76:5: error: unknown type name 'MIPSCPU' MIPSCPU *cpu0; ^ MIPSCPU is declared in the target specific "cpu.h" header, but we don't want to include it, because "cpu.h" is target specific and its inclusion taints all files including "mips_itu.h", which become target specific too. We can however use the 'ArchCPU *' type in the public header. By keeping the TYPE_MIPS_CPU QOM type check in the link property declaration, QOM core code will still check the property is a correct MIPS CPU. TYPE_MIPS_ITU is still built per-(MIPS)target, but its header can now be included by other targets. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/misc/mips_itu.h | 2 +- hw/misc/mips_itu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h index a413789151..5caed6cc36 100644 --- a/include/hw/misc/mips_itu.h +++ b/include/hw/misc/mips_itu.h @@ -73,7 +73,7 @@ struct MIPSITUState { =20 /* SAAR */ uint64_t *saar; - MIPSCPU *cpu0; + ArchCPU *cpu0; }; =20 /* Get ITC Configuration Tag memory region. */ diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index 0eda302db4..5a83ccc4e8 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -532,7 +532,7 @@ static void mips_itu_realize(DeviceState *dev, Error **= errp) return; } =20 - env =3D &s->cpu0->env; + env =3D &MIPS_CPU(s->cpu0)->env; if (env->saarp) { s->saar =3D env->CP0_SAAR; } @@ -563,7 +563,7 @@ static Property mips_itu_properties[] =3D { ITC_FIFO_NUM_MAX), DEFINE_PROP_UINT32("num-semaphores", MIPSITUState, num_semaphores, ITC_SEMAPH_NUM_MAX), - DEFINE_PROP_LINK("cpu[0]", MIPSITUState, cpu0, TYPE_MIPS_CPU, MIPSCPU = *), + DEFINE_PROP_LINK("cpu[0]", MIPSITUState, cpu0, TYPE_MIPS_CPU, ArchCPU = *), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.41.0