From nobody Sun Nov 24 21:23:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.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=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1720084784; cv=none; d=zohomail.com; s=zohoarc; b=CRZT1Zwr82jktHberNLNW//hVXPTkpsnbPugdhnyhp6ymonPyyjdjSruCU5h5qzmk9/NvcblyoElxlnyMTCPWkqMTmpFrIelN/q5Ps9DpkE1y42VtzvFSYrocvEunX35jDFtXpG8NEatgxxeiNE4nzpaoKqOV+xjijR8NRp2C5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1720084784; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=a0+ZIgmsay/kkOvlf5HIeb5CPZrKSQTR8rP8+33jucU=; b=S4Dkortnaq+pEP2FH9qOnBqIk8F9OA7GYZd3MR9kcSsnpfVQxnymGQ2NeJqJqd7cWDMbqeqXBVyfq4IFLyUK8Xqv4AVtt/9Rvo/9QMdTydqBW+uSJwatGIa/8zEkebveR5+2ggD1AHBEOBadwrqko+ySWJSm6cGh8giTpHTEA7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.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 1720084784813232.44317563145057; Thu, 4 Jul 2024 02:19:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPIc0-0006NC-7C; Thu, 04 Jul 2024 05:18:44 -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 1sPIbu-0006MK-Ea; Thu, 04 Jul 2024 05:18:38 -0400 Received: from mgamail.intel.com ([198.175.65.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPIbr-0001br-0q; Thu, 04 Jul 2024 05:18:37 -0400 Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2024 02:18:31 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa003.fm.intel.com with ESMTP; 04 Jul 2024 02:18:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1720084715; x=1751620715; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=2yWda5+RJ5YHltmBgTNQsmoOCifxWuqxZL3/wnZPkyo=; b=lmi0LTQ8FKeeAA07jXM2Pcci3CFZSV3rR6dheE8TIhFTJTSi6rmkfw8q 2+pz6lEfV7VPEhI7mjjeEeddV4O2lyKyam00oBuK4FpM4B3l64S/GdMgz lUE6HqTbA6uwu8eBSCKcMzxr80iv52h1QiqVcun38puqXdn0stAfdZoNF oQIOZIPRWCUtn4+A8jwCL7M1gGfSYhnYKI2RO6PMRrDnzy6UKzWJkLWY6 DCVPOzmI9DP23AExNx6T+odzbgDjbfq3/6+0IXGG1tfYmVUZKd09ZrrRN y692zW6S6s+V6+5KU0CZmCHQMrPuY5D4XZTvCe4CHCyODVh0zrNMKUNd6 A==; X-CSE-ConnectionGUID: /zi5M0lRTRCNrEC2DGVo1g== X-CSE-MsgGUID: 6x2jhHUdRQ6fKIzbYHeVjA== X-IronPort-AV: E=McAfee;i="6700,10204,11122"; a="17487617" X-IronPort-AV: E=Sophos;i="6.09,183,1716274800"; d="scan'208";a="17487617" X-CSE-ConnectionGUID: wKOGwyB6QpWVKu8euJf57Q== X-CSE-MsgGUID: f6mIF49JR16jMnM5i269TA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,183,1716274800"; d="scan'208";a="50863190" From: Zhao Liu To: Jonathan Cameron , Fan Ni Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org, Zhao Liu Subject: [PATCH] hw/cxl/cxl-host: Fix guest crash when getting cxl-fmw property Date: Thu, 4 Jul 2024 17:34:04 +0800 Message-Id: <20240704093404.1848132-1-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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: none client-ip=198.175.65.16; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=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 @intel.com) X-ZM-MESSAGEID: 1720084785800100001 Content-Type: text/plain; charset="utf-8" From: Zhao Liu Guest crashes (Segmentation fault) when getting cxl-fmw property via qmp: (QEMU) qom-get path=3Dmachine property=3Dcxl-fmw This issue is caused by accessing wrong callback (opaque) type in machine_get_cfmw(). cxl_machine_init() sets the callback as `CXLState *` type but machine_get_cfmw() treats the callback as `CXLFixedMemoryWindowOptionsList **`. Fix this error by casting opaque to `CXLState *` type in machine_get_cfmw(). Fixes: 03b39fcf64bc ("hw/cxl: Make the CXL fixed memory window setup a mach= ine parameter.") Signed-off-by: Zhao Liu Reviewed-by: Li Zhijian Reviewed-by: Xingtao Yao --- hw/cxl/cxl-host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index c5f5fcfd64d0..e9f2543c43c6 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -315,7 +315,8 @@ static void machine_set_cxl(Object *obj, Visitor *v, co= nst char *name, static void machine_get_cfmw(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { - CXLFixedMemoryWindowOptionsList **list =3D opaque; + CXLState *state =3D opaque; + CXLFixedMemoryWindowOptionsList **list =3D &state->cfmw_list; =20 visit_type_CXLFixedMemoryWindowOptionsList(v, name, list, errp); } --=20 2.34.1