From nobody Sat Nov 15 16:38:23 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1750868444; cv=none; d=zohomail.com; s=zohoarc; b=ho+qiPRoeZaqflgMt+jlR5xvMZ2ElZfkuBnG4yI606eYkWCNoat0uHEx1zyo6QhyJ54r/oRw/50GT6I6FLPndn9AyQVpVIu0RYrPNkFqIdTZZ2mr6tVjHQVgHfYBySQjqCwrf3bU3m8Z9i4pxSzq63BOebnJkCYKUtW1aIzqahM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750868444; 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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=8hB+xHU/yzfqHTWTU+eqdXiiQtqygR92l3vx8sLiNwQ=; b=ZWr7SXSXViGKZSpvtKqcA9YmShd6Oz3Ab2fs07Pub48YniWIm2TGBdNuTrQsV82p6ajldB9Edjm4UJqnm4mUQXAyPHBVLu0ad8P0yROQ4jao6eKw6aRlpRh7cWLIHqKQVNgYSHV2lsYFDgrLfiXi6nb42uq48AmSPN/ke89hoek= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 175086844417068.99127742488179; Wed, 25 Jun 2025 09:20:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uUSr6-0007vj-6O; Wed, 25 Jun 2025 12:20:12 -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 1uUSqx-0007kv-DG; Wed, 25 Jun 2025 12:20:05 -0400 Received: from [185.176.79.56] (helo=frasgout.his.huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uUSqv-0005wE-H6; Wed, 25 Jun 2025 12:20:02 -0400 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4bS6V34vJfz6DJfs; Thu, 26 Jun 2025 00:19:55 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 5F3A51402F7; Thu, 26 Jun 2025 00:19:59 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 25 Jun 2025 18:19:58 +0200 To: , Fan Ni , Peter Maydell , , Zhijian Li , Itaru Kitayama CC: , , , Yuquan Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH qemu v16 1/5] hw/cxl-host: Add an index field to CXLFixedMemoryWindow Date: Wed, 25 Jun 2025 17:19:22 +0100 Message-ID: <20250625161926.549812-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250625161926.549812-1-Jonathan.Cameron@huawei.com> References: <20250625161926.549812-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To frapeml500008.china.huawei.com (7.182.85.71) X-Host-Lookup-Failed: Reverse DNS lookup failed for 185.176.79.56 (deferred) 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=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, RDNS_NONE=0.793, 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: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1750868445217116600 Content-Type: text/plain; charset="utf-8" To enable these to be found in a fixed order, that order needs to be known. This will later be used to sort a list of these structures so that address map and ACPI table entries are predictable. Tested-by: Li Zhijian Reviewed-by: Li Zhijian Reviewed-by: Fan Ni Signed-off-by: Jonathan Cameron Reviewed-by: Eric Auger --- v16: Tested tag --- include/hw/cxl/cxl.h | 1 + hw/cxl/cxl-host.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h index 75e47b6864..b2bcce7ed6 100644 --- a/include/hw/cxl/cxl.h +++ b/include/hw/cxl/cxl.h @@ -27,6 +27,7 @@ typedef struct PXBCXLDev PXBCXLDev; =20 typedef struct CXLFixedWindow { + int index; uint64_t size; char **targets; PXBCXLDev *target_hbs[16]; diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index e010163174..b7aa429ddf 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -24,13 +24,15 @@ =20 static void cxl_fixed_memory_window_config(CXLState *cxl_state, CXLFixedMemoryWindowOptions *ob= ject, - Error **errp) + int index, Error **errp) { ERRP_GUARD(); g_autofree CXLFixedWindow *fw =3D g_malloc0(sizeof(*fw)); strList *target; int i; =20 + fw->index =3D index; + for (target =3D object->targets; target; target =3D target->next) { fw->num_targets++; } @@ -325,14 +327,15 @@ static void machine_set_cfmw(Object *obj, Visitor *v,= const char *name, CXLState *state =3D opaque; CXLFixedMemoryWindowOptionsList *cfmw_list =3D NULL; CXLFixedMemoryWindowOptionsList *it; + int index; =20 visit_type_CXLFixedMemoryWindowOptionsList(v, name, &cfmw_list, errp); if (!cfmw_list) { return; } =20 - for (it =3D cfmw_list; it; it =3D it->next) { - cxl_fixed_memory_window_config(state, it->value, errp); + for (it =3D cfmw_list, index =3D 0; it; it =3D it->next, index++) { + cxl_fixed_memory_window_config(state, it->value, index, errp); } state->cfmw_list =3D cfmw_list; } --=20 2.48.1