From nobody Fri May 17 09:18:49 2024 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=1695049444; cv=none; d=zohomail.com; s=zohoarc; b=Yn5xuBGEHvY31DBSl5aRbWcagWC9W04ENd80UR7lsa1f/0ZTEOfvlST1wMVggFk+T0lSksi7QdPtVF4zfdMWfZBmDwG4alj3zK5aZHFiRj67x4lCSbmvbRdevSKCZNl3pjzUElm4UnwbCJsN2U7tGqL29oczTvuko0gW2CFYTdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695049444; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ifw9lhDnX2xoQofQcHbs2+RXi8ri7CgtGTslzuaNjjY=; b=DPLx7FGvxfkbPF9Esv521zqP12cZcG+KtnPxzRPbcqpUKCp1MPUTtBTwhgCmRPNIJ3VyCVoXYRqIwmGAgF7BcxMFa1Mojl/3ftGTRohDgNHpSbtZ3VaZpbXB5WI2RSwG94dFwGwnFCt8ZBIGnHHZpQTy5r4m0mExy8kcB2h5TeA= 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 1695049444068526.472294185684; Mon, 18 Sep 2023 08:04:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiFmk-0006ep-B9; Mon, 18 Sep 2023 11:03:38 -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 1qiFmh-0006ZM-Qd for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:03:35 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiFmf-00073k-Sq for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:03:35 -0400 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rq7Kn1S4mz6HJpS; Mon, 18 Sep 2023 23:01:33 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 16:03:29 +0100 To: Michael Tokarev , , Michael Tsirkin , Fan Ni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= CC: , Peter Maydell , Yuquan Wang Subject: [PATCH 1/3] hw/cxl: Fix out of bound array access Date: Mon, 18 Sep 2023 16:02:57 +0100 Message-ID: <20230918150259.11165-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> References: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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, 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: 1695049444840100003 Content-Type: text/plain; charset="utf-8" From: Dmitry Frolov According to cxl_interleave_ways_enc(), fw->num_targets is allowed to be up to 16. This also corresponds to CXL r3.0 spec. So, the fw->target_hbs[] array is iterated from 0 to 15. But it is staticaly declared of length 8. Thus, out of bound array access may occur. Fixes: c28db9e000 ("hw/pci-bridge: Make PCIe and CXL PXB Devices inherit fr= om TYPE_PXB_DEV") Signed-off-by: Dmitry Frolov Reviewed-by: Michael Tokarev Link: https://lore.kernel.org/r/20230913101055.754709-1-frolov@swemel.ru Cc: qemu-stable@nongnu.org Signed-off-by: Jonathan Cameron --- include/hw/cxl/cxl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h index 56c9e7676e..4944725849 100644 --- a/include/hw/cxl/cxl.h +++ b/include/hw/cxl/cxl.h @@ -29,7 +29,7 @@ typedef struct PXBCXLDev PXBCXLDev; typedef struct CXLFixedWindow { uint64_t size; char **targets; - PXBCXLDev *target_hbs[8]; + PXBCXLDev *target_hbs[16]; uint8_t num_targets; uint8_t enc_int_ways; uint8_t enc_int_gran; --=20 2.39.2 From nobody Fri May 17 09:18:49 2024 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=1695049542; cv=none; d=zohomail.com; s=zohoarc; b=HMQUkaygAWUDvBbbcy4PR0rHr2/K+56XsfJCbEKqpS9N1km4p1qhEnlvPBW0qPK020azdv4XKlcXre4aBN1ruoA3lZgo1ZWrJFi0acXK/K/PHJ62fSgOqI7uh5ZBf6kNmqN7/OpzGxx1KacwBgbeBAqcmlUnOvNwk97FZ2aYrFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695049542; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7kr1mBvimTZcyGH6DJJYwx3x9VwRmA0d3HPMk/1CoIU=; b=da6gQid+jBftAcDewa1b7+CPxfxg3gOdbX37CsCzpfvORJJI521BvWhjWw1hCNs3FTBsT31nhMIrD7KJkMvIjFYPsAa/HcN+p4q3uFnulJOE5LS+IKsDK3PsDHmqodKDCQJ1cYyR1DWxC1/NPUDgnVWsDEpaWg4LTGbH/ZWAWq8= 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 1695049542811256.1624420394013; Mon, 18 Sep 2023 08:05:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiFnI-0008Io-Jc; Mon, 18 Sep 2023 11:04:13 -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 1qiFnC-00084w-An for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:04:06 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiFn9-0007At-Gz for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:04:04 -0400 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rq7H61tcHz6J7tN; Mon, 18 Sep 2023 22:59:14 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 16:04:00 +0100 To: Michael Tokarev , , Michael Tsirkin , Fan Ni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= CC: , Peter Maydell , Yuquan Wang Subject: [PATCH 2/3] hw/mem/cxl_type3: Add missing copyright and license notice Date: Mon, 18 Sep 2023 16:02:58 +0100 Message-ID: <20230918150259.11165-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> References: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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, 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: 1695049545488100007 This has been missing from the start. Assume it should match with cxl/cxl-component-utils.c as both were part of early postings from Ben. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Jonathan Cameron Acked-by: Dave Jiang Acked-by: Ira Weiny Reviewed-by: Fan Ni --- hw/mem/cxl_type3.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index c5855d4e7d..ad3f0f6a9d 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1,3 +1,12 @@ +/* + * CXL Type 3 (memory expander) device + * + * Copyright(C) 2020 Intel Corporation. + * + * This work is licensed under the terms of the GNU GPL, version 2. See the + * COPYING file in the top-level directory. + */ + #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" --=20 2.39.2 From nobody Fri May 17 09:18:49 2024 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=1695049595; cv=none; d=zohomail.com; s=zohoarc; b=WCJpP5fy/xFzREdPvteLLiBbpTqNdRmjlQHRIU3UsZa5BLqZ3o300vo2Qh2RddlOJttsUfbxRUK38mzLt/IGgA+DALOajXQ3i5LL5EfiqOaMBb7S0aduo/SHzKWXvtxaOukbeMd4/RcloSCfXI2UVSPCKsv8v/2FhssnFOlpyt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695049595; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=+8Kh8YMST0egyeBXsytuBv5YxMbfYKv/MXgExKpbN0c=; b=DULOroqxyZIBYgjeMBen3Jfg069qTer8AXKm/4ZKwUIJ7ve9nHoBDTYgtASsn1NKZkXMmQBSfmrBZFLpr01CB/hkW+kso24zTxbsfobkXJpseoWK+Wl1XXa8ThMhEDP3j0EwND3zXKdbTNGpHUrzdhemlXjMLOhDMeqTukuBQU8= 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 1695049595869679.4541985042731; Mon, 18 Sep 2023 08:06:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiFnk-00010o-KY; Mon, 18 Sep 2023 11:04:40 -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 1qiFni-0000wO-IC for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:04:38 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiFnd-0007Ew-V9 for qemu-devel@nongnu.org; Mon, 18 Sep 2023 11:04:38 -0400 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Rq7NF6rD3z6K6g3; Mon, 18 Sep 2023 23:03:41 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 16:04:30 +0100 To: Michael Tokarev , , Michael Tsirkin , Fan Ni , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= CC: , Peter Maydell , Yuquan Wang Subject: [PATCH 3/3] docs/cxl: Cleanout some more aarch64 examples. Date: Mon, 18 Sep 2023 16:02:59 +0100 Message-ID: <20230918150259.11165-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> References: <20230918150259.11165-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected 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: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 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, 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: 1695049596868100001 Content-Type: text/plain; charset="utf-8" These crossed with the previous fix to get rid of examples using aarch64 for which support is not yet upstream. Signed-off-by: Jonathan Cameron Reviewed-by: Fan Ni --- docs/system/devices/cxl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/system/devices/cxl.rst b/docs/system/devices/cxl.rst index b742120657..6ab5f72473 100644 --- a/docs/system/devices/cxl.rst +++ b/docs/system/devices/cxl.rst @@ -313,7 +313,7 @@ A very simple setup with just one directly attached CXL= Type 3 Persistent Memory =20 A very simple setup with just one directly attached CXL Type 3 Volatile Me= mory device:: =20 - qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... -object memory-backend-ram,id=3Dvmem0,share=3Don,size=3D256M \ -device pxb-cxl,bus_nr=3D12,bus=3Dpcie.0,id=3Dcxl.1 \ @@ -323,7 +323,7 @@ A very simple setup with just one directly attached CXL= Type 3 Volatile Memory d =20 The same volatile setup may optionally include an LSA region:: =20 - qemu-system-aarch64 -M virt,gic-version=3D3,cxl=3Don -m 4g,maxmem=3D8G,s= lots=3D8 -cpu max \ + qemu-system-x86_64 -M q35,cxl=3Don -m 4G,maxmem=3D8G,slots=3D8 -smp 4 \ ... -object memory-backend-ram,id=3Dvmem0,share=3Don,size=3D256M \ -object memory-backend-file,id=3Dcxl-lsa0,share=3Don,mem-path=3D/tmp/lsa= .raw,size=3D256M \ --=20 2.39.2