From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447210; cv=none; d=zohomail.com; s=zohoarc; b=UcZQNc2wD+GCwx9gVsNZikHdFNwkqGoMooUrcNEgK52JAxEZfhE14ba5AHXEyMdodbn4X+Rc9ZCs/QkTEIleEUaw7YC1rMPIMnAGsZmzJosMkMQPcJlc2IPxy0Ap0mKZJABCeuqjBlqa/TlkiwcodRS0FCanx2SDm3KZGH0HXZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447210; 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=bh1Ygvjf3thbCoIyQaT6drGPTJ7aaC7sJHxAG4v81IE=; b=b9zdRE2qzvzaphyxNYmkuZVp0MdxNx1Qib9HIhpGIJoVRoazm6Dw4vymoFxf2Xa/yySjundOvxHKDRrBNgw5l6eKp0hf2Tz2i+solBcy9ucTauzHhsaEnRMa/KyK0tbwiAzNh9KPP3KsR2Uholjmfyup7JiwH29bPzGf/oeE0Bs= 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+importer2=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 SMTP id 1673447210777588.0742592262918; Wed, 11 Jan 2023 06:26:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc2g-0000St-6E; Wed, 11 Jan 2023 09:25:28 -0500 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 1pFc2X-0000SR-6L for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:25:17 -0500 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 1pFc2U-0007uj-Gt for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:25:15 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVJB6phRz67JpL; Wed, 11 Jan 2023 22:22:34 +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.2375.34; Wed, 11 Jan 2023 14:25:09 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 1/8] hw/mem/cxl_type3: Improve error handling in realize() Date: Wed, 11 Jan 2023 14:24:33 +0000 Message-ID: <20230111142440.24771-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447211335100004 Content-Type: text/plain; charset="utf-8" msix_init_exclusive_bar() can fail, so if it does cleanup the address space. Signed-off-by: Jonathan Cameron Reviewed-by: Ira Weiny --- hw/mem/cxl_type3.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index dae4fd89ca..252822bd82 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -401,7 +401,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **err= p) MemoryRegion *mr =3D ®s->component_registers; uint8_t *pci_conf =3D pci_dev->config; unsigned short msix_num =3D 1; - int i; + int i, rc; =20 if (!cxl_setup_memory(ct3d, errp)) { return; @@ -438,7 +438,10 @@ static void ct3_realize(PCIDevice *pci_dev, Error **er= rp) &ct3d->cxl_dstate.device_registers); =20 /* MSI(-X) Initailization */ - msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL); + rc =3D msix_init_exclusive_bar(pci_dev, msix_num, 4, NULL); + if (rc) { + goto err_address_space_free; + } for (i =3D 0; i < msix_num; i++) { msix_vector_use(pci_dev, i); } @@ -450,6 +453,11 @@ static void ct3_realize(PCIDevice *pci_dev, Error **er= rp) cxl_cstate->cdat.free_cdat_table =3D ct3_free_cdat_table; cxl_cstate->cdat.private =3D ct3d; cxl_doe_cdat_init(cxl_cstate, errp); + return; + +err_address_space_free: + address_space_destroy(&ct3d->hostmem_as); + return; } =20 static void ct3_exit(PCIDevice *pci_dev) --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447210; cv=none; d=zohomail.com; s=zohoarc; b=eszZluCqnsMnMnf2Pp3rhIOPmQ9aFJrClE1uPyB/mqotV/KUc3XG5w4HVuTKyuhms8uKr5qRZDmVHWhfWpk1GmGBhpYqNBbEuQoynt2BQQVmgmaynpz8KwBHG84OfhPoOd4C7TemYjfM/Kz3T10sXCeTCNAlXP1SLeMNgWBYLNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447210; 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=KL0okyAidjnQwZhUx0EmrInCuTaKz0i8urnIwpBC58o=; b=XOkLTPVnSyh23xthWP8/Xdqh0GJ+y3P8xf32XKdi9ntTDvCC60UC9QGsszwzPYCRWLOtIYLMjDyUvO/e4dkjxAveC8GdMszENQrQJNvvfIhg10isRM36eW8QxAhF0u28d3IBF0+N/5gjzisPjf29a7+1X4pL+Nr+PVEumjpAIUs= 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+importer2=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 SMTP id 1673447210623744.2172743956311; Wed, 11 Jan 2023 06:26:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc30-0000fX-LA; Wed, 11 Jan 2023 09:25:46 -0500 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 1pFc2y-0000ez-PP for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:25:44 -0500 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 1pFc2w-00082d-CB for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:25:44 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVJn11WBz67JpL; Wed, 11 Jan 2023 22:23:05 +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.2375.34; Wed, 11 Jan 2023 14:25:40 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 2/8] hw/pci-bridge/cxl_downstream: Fix type naming mismatch Date: Wed, 11 Jan 2023 14:24:34 +0000 Message-ID: <20230111142440.24771-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447211334100003 Content-Type: text/plain; charset="utf-8" Fix capitalization difference between struct name and typedef. Signed-off-by: Jonathan Cameron Reviewed-by: Ira Weiny Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-bridge/cxl_downstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-bridge/cxl_downstream.c b/hw/pci-bridge/cxl_downstream.c index 3d4e6b59cd..54f507318f 100644 --- a/hw/pci-bridge/cxl_downstream.c +++ b/hw/pci-bridge/cxl_downstream.c @@ -15,7 +15,7 @@ #include "hw/pci/pcie_port.h" #include "qapi/error.h" =20 -typedef struct CXLDownStreamPort { +typedef struct CXLDownstreamPort { /*< private >*/ PCIESlot parent_obj; =20 --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447218; cv=none; d=zohomail.com; s=zohoarc; b=ZMDzJyHmbcU2JTwtBzdzGyyZQnEJ3rCFQUgJWAPC0QOnNYDy7Cf8vfSK6jxa5SXLls3nmw1Z8lSjvm4DbqI6cYqXZ73OLgP1NqiNsDa2+Wsu32A8gOP3MnEgqbdzm2nuLS1BeRnG5N2c+nGRRWfKINiutni/2BqwUDA7JZHPKlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447218; 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=7UHpjT8mrlQP3EBtHMQkXxjZMhGOw7ZwqAZl9VWnAHM=; b=RQ5E/KYf92zXu/zlG+ICXXXWktXq5zpODqEoMKjgYrUvifCfmBeAgzLckqI6/JTYBhlnyK33iN1rFLc5ugBoedpDZGV8+UdSnzFPcpo5lN48cUpBs1sS5d/84Qjmejrc286KHDj/Z+LhQ7VECQ9iYx7Bx4EwAHnbSVHCbi13vq0= 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+importer2=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 SMTP id 1673447218967794.5626186081399; Wed, 11 Jan 2023 06:26:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc3U-0001Qj-JN; Wed, 11 Jan 2023 09:26:16 -0500 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 1pFc3S-0001QA-T8 for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:26:14 -0500 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 1pFc3Q-00089X-VR for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:26:14 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVNH1nsfz6HJLh; Wed, 11 Jan 2023 22:26:07 +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.2375.34; Wed, 11 Jan 2023 14:26:10 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 3/8] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL Date: Wed, 11 Jan 2023 14:24:35 +0000 Message-ID: <20230111142440.24771-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447219367100001 Content-Type: text/plain; charset="utf-8" From: Gregory Price Current code sets to STORAGE_EXPRESS and then overrides it. Signed-off-by: Gregory Price Reviewed-by: Davidlohr Bueso Signed-off-by: Jonathan Cameron Reviewed-by: Ira Weiny --- hw/mem/cxl_type3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 252822bd82..217a5e639b 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -408,7 +408,6 @@ static void ct3_realize(PCIDevice *pci_dev, Error **err= p) } =20 pci_config_set_prog_interface(pci_conf, 0x10); - pci_config_set_class(pci_conf, PCI_CLASS_MEMORY_CXL); =20 pcie_endpoint_cap_init(pci_dev, 0x80); if (ct3d->sn !=3D UI64_NULL) { @@ -627,7 +626,7 @@ static void ct3_class_init(ObjectClass *oc, void *data) =20 pc->realize =3D ct3_realize; pc->exit =3D ct3_exit; - pc->class_id =3D PCI_CLASS_STORAGE_EXPRESS; + pc->class_id =3D PCI_CLASS_MEMORY_CXL; pc->vendor_id =3D PCI_VENDOR_ID_INTEL; pc->device_id =3D 0xd93; /* LVF for now */ pc->revision =3D 1; --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447232; cv=none; d=zohomail.com; s=zohoarc; b=XUOnjOuhlAjG/uE5XNr9MDE3TwX5i1arWUg96Ck/xHZEDf1OaYH1Kw0fBeWTP7DRWJnYagw07wutxbIpySACXv7Rmd/9wYwcXhreZk75EJf4s1B3mth5Mt9ydI0Xj2TLOmkhL72s+8PAQVI6YuiJ4zuFAa/eV1j+59B1CDRqp/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447232; 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=6/91wPTbDsJVSvS+wwOZbGvI/mIh0e0VZaaL7QU2ztg=; b=UZUVpAHV8jujeQMSiaev9+4U3Y1+nCZyWUCMZkYoOrUzMHpyFRqacD1QrSpdwpSdACZqgwdJzvgRxskdDWw6UcoF3apu366tCmckg+TJc7xuCEU5bwE7RLh3t1Bfl/56Jjzjh4uUdpFL42Aa8mTzEzw2triW7BwNjK99di8psvY= 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+importer2=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 1673447232757599.9299798122519; Wed, 11 Jan 2023 06:27:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc3x-0001hN-V9; Wed, 11 Jan 2023 09:26:45 -0500 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 1pFc3w-0001h2-Ty for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:26:44 -0500 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 1pFc3v-0008MP-C3 for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:26:44 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVNs4ZX8z6J9Sb; Wed, 11 Jan 2023 22:26:37 +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.2375.34; Wed, 11 Jan 2023 14:26:41 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 4/8] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition Date: Wed, 11 Jan 2023 14:24:36 +0000 Message-ID: <20230111142440.24771-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447233490100001 Content-Type: text/plain; charset="utf-8" From: Gregory Price Remove usage of magic numbers when accessing capacity fields and replace with CXL_CAPACITY_MULTIPLIER, matching the kernel definition. Signed-off-by: Gregory Price Reviewed-by: Davidlohr Bueso Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index bc1bb18844..942de73bbc 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -14,6 +14,8 @@ #include "qemu/log.h" #include "qemu/uuid.h" =20 +#define CXL_CAPACITY_MULTIPLIER 0x10000000 /* SZ_256M */ + /* * How to add a new command, example. The command set FOO, with cmd BAR. * 1. Add the command set and cmd to the enum. @@ -138,7 +140,7 @@ static ret_code cmd_firmware_update_get_info(struct cxl= _cmd *cmd, } QEMU_PACKED *fw_info; QEMU_BUILD_BUG_ON(sizeof(*fw_info) !=3D 0x50); =20 - if (cxl_dstate->pmem_size < (256 << 20)) { + if (cxl_dstate->pmem_size < CXL_CAPACITY_MULTIPLIER) { return CXL_MBOX_INTERNAL_ERROR; } =20 @@ -283,7 +285,7 @@ static ret_code cmd_identify_memory_device(struct cxl_c= md *cmd, CXLType3Class *cvc =3D CXL_TYPE3_GET_CLASS(ct3d); uint64_t size =3D cxl_dstate->pmem_size; =20 - if (!QEMU_IS_ALIGNED(size, 256 << 20)) { + if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) { return CXL_MBOX_INTERNAL_ERROR; } =20 @@ -293,8 +295,8 @@ static ret_code cmd_identify_memory_device(struct cxl_c= md *cmd, /* PMEM only */ snprintf(id->fw_revision, 0x10, "BWFW VERSION %02d", 0); =20 - id->total_capacity =3D size / (256 << 20); - id->persistent_capacity =3D size / (256 << 20); + id->total_capacity =3D size / CXL_CAPACITY_MULTIPLIER; + id->persistent_capacity =3D size / CXL_CAPACITY_MULTIPLIER; id->lsa_size =3D cvc->get_lsa_size(ct3d); =20 *len =3D sizeof(*id); @@ -314,14 +316,14 @@ static ret_code cmd_ccls_get_partition_info(struct cx= l_cmd *cmd, QEMU_BUILD_BUG_ON(sizeof(*part_info) !=3D 0x20); uint64_t size =3D cxl_dstate->pmem_size; =20 - if (!QEMU_IS_ALIGNED(size, 256 << 20)) { + if (!QEMU_IS_ALIGNED(size, CXL_CAPACITY_MULTIPLIER)) { return CXL_MBOX_INTERNAL_ERROR; } =20 /* PMEM only */ part_info->active_vmem =3D 0; part_info->next_vmem =3D 0; - part_info->active_pmem =3D size / (256 << 20); + part_info->active_pmem =3D size / CXL_CAPACITY_MULTIPLIER; part_info->next_pmem =3D 0; =20 *len =3D sizeof(*part_info); --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447280; cv=none; d=zohomail.com; s=zohoarc; b=TmDOACz4A7itJ4qHoszj5PKkWwUPzL+63oOAn/rSoo1SlHqtg3dNINNJBUaMo2ArM/YEDe0Zb9LDPWPHTMIS3/ZNK9sUMpqOvskS7PlDEGG4SRKSTun6Tk9yKELjTWQI2ZLDCeE9PJEpQggEjLiwJYVt/+c1T056G5NFmcD0Bh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447280; 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=mTvI3NWFcz4xt3vnMCud1R/oqWQZoiIW+olblMPKCKU=; b=AwlJB2WJGCCiG6koRvCwjTLJOjU4qMKOwU4I2ALjS/tX6/P96iE/vl25+uGuRKmrfrXfKxGNbg9FsPpQiBOsuuNIVnBxJpiSMbKByWd4XBl8Jah1dBzpgfSinWDh494uBfqSufkZXHBV4BjOzWPYYZkBRmVBAwTywYr3DxUoHvg= 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+importer2=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 SMTP id 1673447280869808.6545809154123; Wed, 11 Jan 2023 06:28:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc4V-0001um-P6; Wed, 11 Jan 2023 09:27:19 -0500 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 1pFc4T-0001uV-LQ for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:27:17 -0500 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 1pFc4R-00008E-Rh for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:27:17 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVKB684Jz6J7B6; Wed, 11 Jan 2023 22:23:26 +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.2375.34; Wed, 11 Jan 2023 14:27:12 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 5/8] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge Date: Wed, 11 Jan 2023 14:24:37 +0000 Message-ID: <20230111142440.24771-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447281729100001 Content-Type: text/plain; charset="utf-8" Noticed as this prevents iASL disasembling the DSDT table. Signed-off-by: Jonathan Cameron Reviewed-by: Ira Weiny --- hw/i386/acpi-build.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 127c4e2d50..a584b62ae2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1482,7 +1482,6 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(pkg, aml_eisaid("PNP0A03")); aml_append(dev, aml_name_decl("_CID", pkg)); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(bus_num))); build_cxl_osc_method(dev); } else if (pci_bus_is_express(bus)) { aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"= ))); --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447301; cv=none; d=zohomail.com; s=zohoarc; b=QuxxKCP+hWjiFE4SxHa10Cz5yBMVHdY42al4gqyt879krcVwzqLDceGuGIHDnzsKDoiXjz4kKNX5Aut5yXUe+NU6rqhkMiWWmuCwcDN/rPvcyoHjNk7CwrTBi1c3axFc/idd+U9z8Z6+WqKvKgvv/yPnLuGK7QEvtmOY2qKcJO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447301; 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=hQLKcCHPfxZTBh07xvoceP3kcpYS+7gyNMfe2/ei/as=; b=B3tOIp4CoXl6Y5m+b9t7ZogdbdN7dG+RPMVeAq6ruhV9mioWW7nJrNHmix6lRCoxpzkBzwIa0DlmglyUX6pYlzqU1ZFKnL2tley8KknS3yH7s6Ya0jrENjf0UuYYMAIPE+K24TYUPz9BZ9uY2OKKF9YlS+Fh3scsNZsSY6Ni0Wk= 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+importer2=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 SMTP id 1673447301908737.3388675051415; Wed, 11 Jan 2023 06:28:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc4z-0002FQ-Ub; Wed, 11 Jan 2023 09:27:49 -0500 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 1pFc4x-0002F2-9v for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:27:47 -0500 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 1pFc4u-0000I2-Hc for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:27:46 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVQ25zwMz6J91l; Wed, 11 Jan 2023 22:27:38 +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.2375.34; Wed, 11 Jan 2023 14:27:42 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 6/8] qemu/bswap: Add const_le64() Date: Wed, 11 Jan 2023 14:24:38 +0000 Message-ID: <20230111142440.24771-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447303794100001 Content-Type: text/plain; charset="utf-8" From: Ira Weiny Gcc requires constant versions of cpu_to_le* calls. Add a 64 bit version. Reviewed-by: Peter Maydell Signed-off-by: Ira Weiny Signed-off-by: Jonathan Cameron Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/bswap.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 346d05f2aa..e1eca22f25 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -187,6 +187,15 @@ CPU_CONVERT(le, 64, uint64_t) * used to initialize static variables. */ #if HOST_BIG_ENDIAN +# define const_le64(_x) \ + ((((_x) & 0x00000000000000ffU) << 56) | \ + (((_x) & 0x000000000000ff00U) << 40) | \ + (((_x) & 0x0000000000ff0000U) << 24) | \ + (((_x) & 0x00000000ff000000U) << 8) | \ + (((_x) & 0x000000ff00000000U) >> 8) | \ + (((_x) & 0x0000ff0000000000U) >> 24) | \ + (((_x) & 0x00ff000000000000U) >> 40) | \ + (((_x) & 0xff00000000000000U) >> 56)) # define const_le32(_x) \ ((((_x) & 0x000000ffU) << 24) | \ (((_x) & 0x0000ff00U) << 8) | \ @@ -196,6 +205,7 @@ CPU_CONVERT(le, 64, uint64_t) ((((_x) & 0x00ff) << 8) | \ (((_x) & 0xff00) >> 8)) #else +# define const_le64(_x) (_x) # define const_le32(_x) (_x) # define const_le16(_x) (_x) #endif --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447727; cv=none; d=zohomail.com; s=zohoarc; b=DT4iMw8NIbULCrGHCU/b8um8uWjduThP0FKxYecO5Ze6g8wHcygg/5z7Muss9Mtxc3vMNL8lhlsXoYcsQe1a0M2S42JvtGRmglVR4DVnvZbIapeMEPsvSOJVZwA7QAX2NyYy8q1hhrKR4MLQNTYNNNd+oNZh/hdOOVrhXZ+IQNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447727; 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=PQqED76ffei7pkon7jqjAUdRIZ3YoeoXHGo9QwyG7JM=; b=gEtts1CbtGDIeWL32A7yDAia4l8r0zOKsBD77PhI7SYWj2Wk4lWTvae+96uw1u0X/bMjCriVSwvt7/G4fYfbbK0TCe+15pyUiEP2jc5WwkaPOY4DA5EMUSBqFvbXPYNxYSBD6CbEh6bXVIYktWS7NSkoAYKmODhbjvCej7GKQGw= 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+importer2=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 1673447727247309.71470657654356; Wed, 11 Jan 2023 06:35:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc5V-0002RG-FB; Wed, 11 Jan 2023 09:28:21 -0500 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 1pFc5T-0002Qk-CD for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:28:19 -0500 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 1pFc5R-0000R8-Cw for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:28:19 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVQg4Z2lz67wFS; Wed, 11 Jan 2023 22:28:11 +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.2375.34; Wed, 11 Jan 2023 14:28:13 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 7/8] qemu/uuid: Add UUID static initializer Date: Wed, 11 Jan 2023 14:24:39 +0000 Message-ID: <20230111142440.24771-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500003.china.huawei.com (7.191.162.67) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447729002100001 Content-Type: text/plain; charset="utf-8" From: Ira Weiny UUID's are defined as network byte order fields. No static initializer was available for UUID's in their standard big endian format. Define a big endian initializer for UUIDs. Signed-off-by: Ira Weiny Signed-off-by: Jonathan Cameron --- include/qemu/uuid.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h index 9925febfa5..dc40ee1fc9 100644 --- a/include/qemu/uuid.h +++ b/include/qemu/uuid.h @@ -61,6 +61,18 @@ typedef struct { (clock_seq_hi_and_reserved), (clock_seq_low), (node0), (node1), (node2= ),\ (node3), (node4), (node5) } =20 +/* Normal (network byte order) UUID */ +#define UUID(time_low, time_mid, time_hi_and_version, \ + clock_seq_hi_and_reserved, clock_seq_low, node0, node1, node2, \ + node3, node4, node5) \ + { ((time_low) >> 24) & 0xff, ((time_low) >> 16) & 0xff, \ + ((time_low) >> 8) & 0xff, (time_low) & 0xff, \ + ((time_mid) >> 8) & 0xff, (time_mid) & 0xff, \ + ((time_hi_and_version) >> 8) & 0xff, (time_hi_and_version) & 0xff, \ + (clock_seq_hi_and_reserved), (clock_seq_low), \ + (node0), (node1), (node2), (node3), (node4), (node5) \ + } + #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-" \ "%02hhx%02hhx-%02hhx%02hhx-" \ "%02hhx%02hhx-" \ --=20 2.37.2 From nobody Sat Apr 20 00:08:07 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1673447387; cv=none; d=zohomail.com; s=zohoarc; b=nz2LkQuylg0n7OIpqUODMsiXhqMP50PnAI5Q9irh2jzHSDH6Vx8YKEr5iJGvqiVjdcgNF0f2NMRtfNVixIAHuda/RCnnkv8yEWRz6ZdGdHf3IsQnfVnmVA+Br7XWbCPy7HbiDYtAJSAyhkdycCe7BYIuEnKC8YyzDAUnL42UWt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673447387; 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=rrYEpcR4P9lBPsso8yamCsJYigZKAz5faQhMQlQH6mw=; b=WM8gZ6Hc99QXIbMNqIVJsMauvMSt9dVBnT4QOCI5ouL4v3xKM4nZPLMZTwzFee9oWSF+VXq+JrG+HwT/0dknQtJ1+w2ouspXM30DoiHdwT6UluiwdXDsXUNEBY160ROX5vZiTTkEoRrXmog4dJLLFo+IcFcDx6xabeRmJO6ftUo= 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+importer2=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 1673447387478366.8703483246725; Wed, 11 Jan 2023 06:29:47 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFc62-0002mZ-U8; Wed, 11 Jan 2023 09:28:54 -0500 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 1pFc5y-0002mB-Or for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:28:50 -0500 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 1pFc5u-0000ch-Qb for qemu-devel@nongnu.org; Wed, 11 Jan 2023 09:28:49 -0500 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NsVLy1wqFz67bWy; Wed, 11 Jan 2023 22:24:58 +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.2375.34; Wed, 11 Jan 2023 14:28:43 +0000 To: , Michael Tsirkin CC: Ben Widawsky , , , Ira Weiny , Gregory Price Subject: [PATCH 8/8] hw/cxl/mailbox: Use new UUID network order define for cel_uuid Date: Wed, 11 Jan 2023 14:24:40 +0000 Message-ID: <20230111142440.24771-9-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> References: <20230111142440.24771-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) 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+importer2=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_H2=-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZM-MESSAGEID: 1673447388952100002 Content-Type: text/plain; charset="utf-8" From: Ira Weiny The cel_uuid was programatically generated previously because there was no static initializer for network order UUIDs. Use the new network order initializer for cel_uuid. Adjust cxl_initialize_mailbox() because it can't fail now. Update specification reference. Signed-off-by: Ira Weiny Signed-off-by: Jonathan Cameron Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/cxl/cxl-device-utils.c | 2 +- hw/cxl/cxl-mailbox-utils.c | 13 ++++++------- include/hw/cxl/cxl_device.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c index 83ce7a8270..4c5e88aaf5 100644 --- a/hw/cxl/cxl-device-utils.c +++ b/hw/cxl/cxl-device-utils.c @@ -267,5 +267,5 @@ void cxl_device_register_init_common(CXLDeviceState *cx= l_dstate) cxl_device_cap_init(cxl_dstate, MEMORY_DEVICE, 0x4000); memdev_reg_init_common(cxl_dstate); =20 - assert(cxl_initialize_mailbox(cxl_dstate) =3D=3D 0); + cxl_initialize_mailbox(cxl_dstate); } diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 942de73bbc..7ed344a754 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -192,7 +192,11 @@ static ret_code cmd_timestamp_set(struct cxl_cmd *cmd, return CXL_MBOX_SUCCESS; } =20 -static QemuUUID cel_uuid; +/* CXL 3.0 8.2.9.5.2.1 Command Effects Log (CEL) */ +static QemuUUID cel_uuid =3D { + .data =3D UUID(0x0da9c0b5, 0xbf41, 0x4b78, 0x8f, 0x79, + 0x96, 0xb1, 0x62, 0x3b, 0x3f, 0x17) +}; =20 /* 8.2.9.4.1 */ static ret_code cmd_logs_get_supported(struct cxl_cmd *cmd, @@ -457,11 +461,8 @@ void cxl_process_mailbox(CXLDeviceState *cxl_dstate) DOORBELL, 0); } =20 -int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate) +void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate) { - /* CXL 2.0: Table 169 Get Supported Logs Log Entry */ - const char *cel_uuidstr =3D "0da9c0b5-bf41-4b78-8f79-96b1623b3f17"; - for (int set =3D 0; set < 256; set++) { for (int cmd =3D 0; cmd < 256; cmd++) { if (cxl_cmd_set[set][cmd].handler) { @@ -475,6 +476,4 @@ int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate) } } } - - return qemu_uuid_parse(cel_uuidstr, &cel_uuid); } diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 250adf18b2..7e5ad65c1d 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -170,7 +170,7 @@ CXL_DEVICE_CAPABILITY_HEADER_REGISTER(MEMORY_DEVICE, CXL_DEVICE_CAP_HDR1_OFFSET + CXL_DEVICE_CAP_REG_SIZE * 2) =20 -int cxl_initialize_mailbox(CXLDeviceState *cxl_dstate); +void cxl_initialize_mailbox(CXLDeviceState *cxl_dstate); void cxl_process_mailbox(CXLDeviceState *cxl_dstate); =20 #define cxl_device_cap_init(dstate, reg, cap_id) = \ --=20 2.37.2