From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73AE9244669 for ; Tue, 13 May 2025 11:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747134932; cv=none; b=RFQozbWnCG4HgYZ1BY9ZHb5+wk6od07pH8/tOW19WAKPs6Wsl4Tx97jaoQ18naqZ0bBDD48qlGIV5MfUfP5cLMTMvQGDt1CF3keZYJxpgRbjy1o5oW1NG8c0s/McNXSQO9xNHppIJOGXazLSE/yDXQ/eiNJ8tDKcdNuC4K8Kx88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747134932; c=relaxed/simple; bh=QrlUL6ksvmHFzyBFbponr1B6MIoULBZBLeJlHSYQf8I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hULxJVWtnNPbo75dEmcwuFxBEUTZCR4BW0IJLAxYAVqHr0puqFR0aOxx6Qy9Ur7VHWSled98FAIBD3ZuAjPJIC4fpQPE3u0xjtnhhBYXRU+fvEfLZC2Dm4Zy8/5+CZXd4WREA44d5CTvcE46DXhxWYGM+bgst1jI/JdnySmBDGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4ZxYm15Khsz6GD81; Tue, 13 May 2025 19:14:57 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 1854E1402A5; Tue, 13 May 2025 19:15:28 +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; Tue, 13 May 2025 13:15:27 +0200 From: Jonathan Cameron To: , Fan Ni , Peter Maydell , CC: , , , Yuquan Wang , Itaru Kitayama , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v13 1/5] hw/cxl-host: Add an index field to CXLFixedMemoryWindow Date: Tue, 13 May 2025 12:14:51 +0100 Message-ID: <20250513111455.128266-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250513111455.128266-1-Jonathan.Cameron@huawei.com> References: <20250513111455.128266-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml100012.china.huawei.com (7.191.174.184) To frapeml500008.china.huawei.com (7.182.85.71) 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 that address map and ACPI table entries are predictable. Signed-off-by: Jonathan Cameron --- 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; 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 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state, CXLFixedMemoryWindowOptions *object, - Error **errp) + int index, Error **errp) { ERRP_GUARD(); g_autofree CXLFixedWindow *fw = g_malloc0(sizeof(*fw)); strList *target; int i; + fw->index = index; + for (target = object->targets; target; target = target->next) { fw->num_targets++; } @@ -325,14 +327,15 @@ static void machine_set_cfmw(Object *obj, Visitor *v, const char *name, CXLState *state = opaque; CXLFixedMemoryWindowOptionsList *cfmw_list = NULL; CXLFixedMemoryWindowOptionsList *it; + int index; visit_type_CXLFixedMemoryWindowOptionsList(v, name, &cfmw_list, errp); if (!cfmw_list) { return; } - for (it = cfmw_list; it; it = it->next) { - cxl_fixed_memory_window_config(state, it->value, errp); + for (it = cfmw_list, index = 0; it; it = it->next, index++) { + cxl_fixed_memory_window_config(state, it->value, index, errp); } state->cfmw_list = cfmw_list; } -- 2.43.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zg8tmja5ljk3lje4ms43mwaa.icoremail.net (zg8tmja5ljk3lje4ms43mwaa.icoremail.net [209.97.181.73]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BDE3426738D for ; Fri, 8 Aug 2025 08:30:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.97.181.73 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754641846; cv=fail; b=AJ6u71PoaQOsd54Q5Y03K3gf41N7j5Xthlgkdn4H1dn1eEraUL2T5rrEhuczKHHmH9atmuDM9bJUruuWMS4rWoD3hgCCnNULM7j/AWP8/lH0c2xQJxP/UyanfQPxnn8d57Zxlfp61QlHnvBs0fuPGkRThExV5b9PkTfE3qPrWbM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754641846; c=relaxed/simple; bh=5tZtZ6TTDllXZWoZC+wUemuOh6vqC6H4nQkg4HovwIY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version:MIME-Version; b=T4apmb6GOZFuK56bB7gGm1Y+enevkr72yYhsgLFsz8rSSSIqUuowZsnD6otYGqwzgC26/LtpnEIBYPRZi8ODcaqEDvQl1L5i0XwK0NkOeQeCw7hrBR/xSHCQAwNeJf7OLf7AHcktUASOeimJcRiMzpe+xh13GxJTmy6hz14LqP4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=phytium.com.cn; spf=pass smtp.mailfrom=phytium.com.cn; arc=fail smtp.client-ip=209.97.181.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=phytium.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=phytium.com.cn Received: from prodtpl.icoremail.net (unknown [10.12.1.20]) by hzbj-icmmx-7 (Coremail) with SMTP id AQAAfwBnOhKntZVoOPuSBQ--.18S2; Fri, 08 Aug 2025 16:30:31 +0800 (CST) Received: from phytium.com.cn (unknown [218.76.62.144]) by mail (Coremail) with SMTP id AQAAfwBH0gmNtZVoag0NAA--.18908S11; Fri, 08 Aug 2025 16:30:26 +0800 (CST) From: wangyuquan To: tangtao1634@phytium.com.cn, qemu-devel@nongnu.org, Fan Ni , Peter Maydell , mst@redhat.com Cc: Jonathan Cameron , linux-cxl@vger.kernel.org, linuxarm@huawei.com, qemu-arm@nongnu.org, Yuquan Wang , Itaru Kitayama , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v13 1/5] hw/cxl-host: Add an index field to CXLFixedMemoryWindow Date: Fri, 8 Aug 2025 16:29:57 +0800 Message-ID: <20250513111455.128266-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250513111455.128266-1-Jonathan.Cameron@huawei.com> References: <20250513111455.128266-1-Jonathan.Cameron@huawei.com> Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 14086646 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73AE9244669 for ; Tue, 13 May 2025 11:15:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747134932; cv=none; b=RFQozbWnCG4HgYZ1BY9ZHb5+wk6od07pH8/tOW19WAKPs6Wsl4Tx97jaoQ18naqZ0bBDD48qlGIV5MfUfP5cLMTMvQGDt1CF3keZYJxpgRbjy1o5oW1NG8c0s/McNXSQO9xNHppIJOGXazLSE/yDXQ/eiNJ8tDKcdNuC4K8Kx88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747134932; c=relaxed/simple; bh=QrlUL6ksvmHFzyBFbponr1B6MIoULBZBLeJlHSYQf8I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hULxJVWtnNPbo75dEmcwuFxBEUTZCR4BW0IJLAxYAVqHr0puqFR0aOxx6Qy9Ur7VHWSled98FAIBD3ZuAjPJIC4fpQPE3u0xjtnhhBYXRU+fvEfLZC2Dm4Zy8/5+CZXd4WREA44d5CTvcE46DXhxWYGM+bgst1jI/JdnySmBDGI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4ZxYm15Khsz6GD81; Tue, 13 May 2025 19:14:57 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 1854E1402A5; Tue, 13 May 2025 19:15:28 +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; Tue, 13 May 2025 13:15:27 +0200 X-Mailer: git-send-email 2.43.0 Precedence: bulk MIME-Version: 1.0 X-ClientProxiedBy: lhrpeml100012.china.huawei.com (7.191.174.184) To frapeml500008.china.huawei.com (7.182.85.71) Content-Transfer-Encoding: 8bit X-CM-TRANSID:AQAAfwBH0gmNtZVoag0NAA--.18908S11 X-CM-SenderInfo: 5zdqw5pxtxt0arstlqxsk13x1xpou0fpof0/1tbiAQAQAWiU-30C6wAEsD Authentication-Results: hzbj-icmmx-7; spf=neutral smtp.mail=wangyuquan 1236@phytium.com.cn; X-Coremail-Antispam: 1Uk129KBjvJXoW7ur43Cw4DtFWDXw1UZFyDGFg_yoW8Cw1kpF 4kurW2gF18GrZYkF40qa9rtwn5Ww4DWFsxCrZxuwn5A3WUtrW7tFnxKa9rAa48CrZ5KF1r GF1S9rn0qa1UtrUanT9S1TB71UUUUUJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj DUYxn0WfASr-VFAU7a7-sFnT9fnUUIcSsGvfJ3UbIYCTnIWIevJa73UjIFyTuYvj4RJUUU UUUUU Message-ID: <20250808082957.vHpYIyTubuONPz03XR98J28_t6LuSw1hbl-LfyBpNRA@z> From: Jonathan Cameron 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 that address map and ACPI table entries are predictable. Signed-off-by: Jonathan Cameron --- 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; 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 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state, CXLFixedMemoryWindowOptions *object, - Error **errp) + int index, Error **errp) { ERRP_GUARD(); g_autofree CXLFixedWindow *fw = g_malloc0(sizeof(*fw)); strList *target; int i; + fw->index = index; + for (target = object->targets; target; target = target->next) { fw->num_targets++; } @@ -325,14 +327,15 @@ static void machine_set_cfmw(Object *obj, Visitor *v, const char *name, CXLState *state = opaque; CXLFixedMemoryWindowOptionsList *cfmw_list = NULL; CXLFixedMemoryWindowOptionsList *it; + int index; visit_type_CXLFixedMemoryWindowOptionsList(v, name, &cfmw_list, errp); if (!cfmw_list) { return; } - for (it = cfmw_list; it; it = it->next) { - cxl_fixed_memory_window_config(state, it->value, errp); + for (it = cfmw_list, index = 0; it; it = it->next, index++) { + cxl_fixed_memory_window_config(state, it->value, index, errp); } state->cfmw_list = cfmw_list; }