From nobody Sat Nov 15 20:35:38 2025 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=quarantine dis=none) header.from=adacore.com ARC-Seal: i=1; a=rsa-sha256; t=1748249787; cv=none; d=zohomail.com; s=zohoarc; b=HeS0aaSFfM6MfSmk+nFpxXXA9pppNCWdT5NflQ0mqCFFDy4CES4IyMaNHGLpkdrdh3+qqbUWAf7neN4AElOwbigLPrA6xb6BmDB8GVgseZqcbOuYjzbOwNwN1Ux9NG21wAATylJkzCSBHZBTXPme0vF5DdNmGyuZ5/80djQzlGg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748249787; 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=g+yP9a/uVH74kLVGGvEGM7JayHygTFaXLhgBOX+A4es=; b=bU973cVFDUvqmF0w8fYlGQYEwiGDbiLAaftd3gY/4RUzezQEflgos0VRxqrD+zufJ46o+7G7EDthNHV8aeJKeXj3MfZbW1gmx0uvPesYOlkRKGV945X5KOhxCS29Zx/43b9M8vL6AyGsCtrsvwnAMIrrIDMhKkIWG0n3N6BwY7k= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748249787642761.0112438607716; Mon, 26 May 2025 01:56:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uJTca-0004U1-8o; Mon, 26 May 2025 04:55:51 -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 1uJTcL-0004Re-8M for qemu-devel@nongnu.org; Mon, 26 May 2025 04:55:33 -0400 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 1uJTcI-00082x-RD for qemu-devel@nongnu.org; Mon, 26 May 2025 04:55:32 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3a4dba2c767so294282f8f.1 for ; Mon, 26 May 2025 01:55:30 -0700 (PDT) Received: from chigot-Dell.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-447f23bfd54sm238911675e9.17.2025.05.26.01.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 May 2025 01:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1748249729; x=1748854529; 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=g+yP9a/uVH74kLVGGvEGM7JayHygTFaXLhgBOX+A4es=; b=LJlLW1Fd8gDmeuHgY1x4X2r7hCQ/QM3U/SSpW+5jdIY86kUN85zJVXXEh+4hqaJpe/ abDSH+mst0oviazV4juM8NBKuFr8tkpJRWQWo6n70PDZFc9tJuc2Et0UW0MX7I6ul0sE wkIdeLE6AanLjF+cfGR2MkqSvLK8IfTH0cPsthN80w4bR2ZBE3T1xxkOOj1+ijeued/i KeuI0T7GLpYN2/HPbTg5Zhlb3+qsdfX2MU8Hg+a44a4U1hMxmlVP/6E25lMfjtiEuyFk s/sxWSmEfm/pbSB8C98752jeoIZ46M1K1nqnvalhgBnPvlKBaKtLmWHTJfHX7JL+2Uw3 7T2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748249729; x=1748854529; 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=g+yP9a/uVH74kLVGGvEGM7JayHygTFaXLhgBOX+A4es=; b=iA9pEKCVas4YF0H48jQoAA0sdACp/kYcgL2KEhWwvngMr6r9vfKe33M62NyxOU+wlk ZYm/BhAbiXtoFK7Ypq4yDWmgpsIKXs9mj+D3RPmU8Kzkex9TJV22qQSxUBdxsb5t6fAN yr+lVfIkzZxdi37Qpifpq1y9F/WWxDE9Iz0ALxBwq23hSf3itVQLSJ//nEH1z86V4/m6 44gDsmCULsDzMu6oZtVg8cub5S29OLWQ/H01uJJTn+kD1uqOYiQB/MExAzeNph5+nxu6 a4jOjLiT3pCQAk0IfVClFuQAsJaNMWjuQLBpY2sUp9dm7rskhHIcO3PBTVnmSRsBQZh3 AMbA== X-Gm-Message-State: AOJu0YxhhCbp1gat5TizrOR4hg6ok3wESOzIb4YfVm672bY8yZB3mb8J 7am0DlclCFZVEso1AX/mkoCud0oi1W18ADE20qjat7p9U+zp2fC24ymaBgkmVOt7ZA+IJ5Zq1ue Mkts= X-Gm-Gg: ASbGncueQGR9eWDWLuA9xi+q0gb/lpzRgOXRfAHazx9+EA7ojN3LFheP6G6LZtBJIyG WlyaG0li+p4FAcGGUSE9dB2AjkgLyqpD5wYGR/2SNqDzRqz/iJGAScHsOF4G7zkeXeENU4i2Qop GrvR4gmbAluLBYnYuMjdpFMhGNuie/cQadmXiOIow5jg5LTTCaq7gabWBYTYKUa5ihapKMOzWHT +ReDpO7cu+zSXXtJPIs4AIOLt42YyjwPRIBZn+AFYuNIYikjsBkYc3mn66QyMPt0yhKJu2Oneem lhhzXuqDmjUaWoMxC640EkG7mewV+yVoerWl4QZqknh101gis5ZmE7ythy588WUb2oM6qpdx7ZL fMzgbpO90mkETxfld86JnNu5Jafhe9MQPVFyfGFiMvqRA65N1 X-Google-Smtp-Source: AGHT+IEen6/hOBkf8S82eHLxUE7jzmDqnS5MqqcRX9Onr/Vp4jcwYZiQeSIdN/OVLozcwmASEuFujw== X-Received: by 2002:a05:6000:1ac8:b0:3a3:6f35:55e3 with SMTP id ffacd0b85a97d-3a4c14f798amr10911540f8f.7.1748249728955; Mon, 26 May 2025 01:55:28 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org, edgar.iglesias@gmail.com, alistair@alistair23.me, Frederic Konrad , =?UTF-8?q?Cl=C3=A9ment=20Chigot?= Subject: [PATCH v2 2/4] hw/intc/arm_gic: introduce a first-cpu-index property Date: Mon, 26 May 2025 10:55:21 +0200 Message-Id: <20250526085523.809003-3-chigot@adacore.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250526085523.809003-1-chigot@adacore.com> References: <20250526085523.809003-1-chigot@adacore.com> 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::42d; envelope-from=chigot@adacore.com; 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, 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 @adacore.com) X-ZM-MESSAGEID: 1748249789363116600 From: Frederic Konrad This introduces a first-cpu-index property to the arm-gic, as some SOCs could have two separate GIC (ie: the zynqmp). Signed-off-by: Cl=C3=A9ment Chigot Reviewed-by: Peter Maydell --- hw/intc/arm_gic.c | 2 +- hw/intc/arm_gic_common.c | 1 + include/hw/intc/arm_gic.h | 2 ++ include/hw/intc/arm_gic_common.h | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index d18bef40fc..899f133363 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -59,7 +59,7 @@ static const uint8_t gic_id_gicv2[] =3D { static inline int gic_get_current_cpu(GICState *s) { if (!qtest_enabled() && s->num_cpu > 1) { - return current_cpu->cpu_index; + return current_cpu->cpu_index - s->first_cpu_index; } return 0; } diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 0f0c48d89a..ed5be05645 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -350,6 +350,7 @@ static void arm_gic_common_linux_init(ARMLinuxBootIf *o= bj, =20 static const Property arm_gic_common_properties[] =3D { DEFINE_PROP_UINT32("num-cpu", GICState, num_cpu, 1), + DEFINE_PROP_UINT32("first-cpu-index", GICState, first_cpu_index, 0), DEFINE_PROP_UINT32("num-irq", GICState, num_irq, 32), /* Revision can be 1 or 2 for GIC architecture specification * versions 1 or 2, or 0 to indicate the legacy 11MPCore GIC. diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h index 48f6a51a70..6faccf8ef6 100644 --- a/include/hw/intc/arm_gic.h +++ b/include/hw/intc/arm_gic.h @@ -27,6 +27,8 @@ * implement the security extensions * + QOM property "has-virtualization-extensions": set true if the GIC sh= ould * implement the virtualization extensions + * + QOM property "first-cpu-index": index of the first cpu attached to t= he + * GIC. * + unnamed GPIO inputs: (where P is number of SPIs, i.e. num-irq - 32) * [0..P-1] SPIs * [P..P+31] PPIs for CPU 0 diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_com= mon.h index 97fea4102d..93a3cc2bf8 100644 --- a/include/hw/intc/arm_gic_common.h +++ b/include/hw/intc/arm_gic_common.h @@ -129,6 +129,8 @@ struct GICState { uint32_t num_lrs; =20 uint32_t num_cpu; + /* cpu_index of the first CPU, attached to this GIC. */ + uint32_t first_cpu_index; =20 MemoryRegion iomem; /* Distributor */ /* This is just so we can have an opaque pointer which identifies --=20 2.34.1