From patchwork Thu Jul 20 01:43:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shesha Bhushan Sreenivasamurthy X-Patchwork-Id: 13319702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5CDEC001B0 for ; Thu, 20 Jul 2023 01:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229685AbjGTBnj (ORCPT ); Wed, 19 Jul 2023 21:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjGTBni (ORCPT ); Wed, 19 Jul 2023 21:43:38 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1510E1739 for ; Wed, 19 Jul 2023 18:43:37 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36JGGus4001794 for ; Wed, 19 Jul 2023 18:43:36 -0700 Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2175.outbound.protection.outlook.com [104.47.73.175]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rxj62a5bc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jul 2023 18:43:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XaWzW9spwVWfEgA4SkNYw30bkmJRyCx8UjnF1NKa9X8x3B0z/iG9nIjZN+3FANN+fmu2DwUAK/6QlgfFSjDe0HwXpPj3UEVtboZCDXhnMuLxNMNdRaUCag+QSgTXeegmNVhxx3rTy7icoHJzjEzbNPOVIUDDlfUM7Nb0dS+JsibOpLDfQggwyf1KGxrzpDLcAVkgn9xbrfEu2FD6YKn8xPkeJFO9PYGPDiVRThxgULHpYCsGLtzzEZlNvQlMf2oNb1NbvZmw/6dD53XjBQxrlYd2tJZbYZwO85CXE+1Cvtu1VDO6NK8MftdUD1YaNF6Y1/fm5+fpoctGNks4S96qMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pej6ylWrikE24Yxeyz+dAUPAqa4rPS5xm8yKXEoHBNU=; b=MdJpjXljWBW7si0mhlaFuDqIoJGzg5hXa1gzSgZ1Evhy79x47WizHGh3k23mbhUwpKRGrrJRtT0Z99sJKpiNucrMLR947Rl30Mv8VJ/SE31GduskaTCLEUun3TDCvPJ1laA+3WIHeq5FAYNacRdQ2l9SMD59zf+8Xhdr+Tf8yT5rk6A8Mo0v11TMbUcUtLYVX2APD5ZrkSagn2s6iCVMkXf1+WOR2Gmg8RzIZ/VvFapaEAUoDok1YtA1QaAFYps9jOkk4/3WjaemFmfPpbPDGVtKlc5nt6IBcGgFKP4rtR+i141DgoDjUPhhqSBx/VxatUyC+t7ZUU7VwJDXaRB0pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pej6ylWrikE24Yxeyz+dAUPAqa4rPS5xm8yKXEoHBNU=; b=Qpz8HmT0r91ZpRVLr4cdX8499GvnqsfnThNL4IJXpmOySJXR8RpyG1ymXccxdLfk5cAaoqd6qQuJLkO05rb8KL8K1QV1nsc1xnInFEUA+l5sIzMmeHlTvCvoy7DqneLcaiX0VdS/zp/RNHapmSKl0k6i9v4Ri2ejsv1e9F3/QHU= Received: from DM6PR18MB2844.namprd18.prod.outlook.com (2603:10b6:5:16f::29) by MW4PR18MB5181.namprd18.prod.outlook.com (2603:10b6:303:1b4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Thu, 20 Jul 2023 01:43:34 +0000 Received: from DM6PR18MB2844.namprd18.prod.outlook.com ([fe80::1f9f:7a1:807e:6141]) by DM6PR18MB2844.namprd18.prod.outlook.com ([fe80::1f9f:7a1:807e:6141%5]) with mapi id 15.20.6609.022; Thu, 20 Jul 2023 01:43:34 +0000 From: Shesha Bhushan Sreenivasamurthy To: "linux-cxl@vger.kernel.org" Subject: DCD region base address Thread-Topic: DCD region base address Thread-Index: AQHZuqnZkDv72afMtEeOHX1a65KePg== Date: Thu, 20 Jul 2023 01:43:34 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR18MB2844:EE_|MW4PR18MB5181:EE_ x-ms-office365-filtering-correlation-id: ade98cf0-b871-47f8-d523-08db88c2babc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EonNWGENo0KDGxCJMa6q6XVDXa05oAyT7agzuxySMyPpaDvCZA+nGfMNV3JaCBljFFkpb4jR4nTOGSeu+CIqSTNY8aRoeFA0g0KO/3QgOHlYtEcr4nt0TPxvbF4VffSDbBwjLE68hkUu7a8nh+Qi+5dBWexxqhDL/0DQGuuJVEEjVQDWq4KxfEgeVk8JacKgydtnyNn0SXC9mMY7iQmOmGhPcYicpfFZJhQsj5raNws9L9/eUjXuEaAIfY4Z5He08fnNB/84c3gRlO+SQtqkhRd8x48/Z/MJs56OLpQn501TLIRcr15+kvVWyGkBbOpAQuaoN1M3XCN1vSrwvHGK0GURye7bLQmrnHgUMdQ35LLTqPg55uyC8XhjFsmoMIwE/lBV/lPpAelo0KHgJT2HUDkR9h7hG+Ei5rn95MEe8jNO3QlXgsPDpqt3AQdb9ARsefYVXLBTEdJ3HsVhFQHIhHiHh5fXHcc5MQJCj3UfjibVncFci7myeLgAQW1WON4qkf96m9u+/iJbWGfw7cStMebsF5rKFuzurACNsF1D2AYPQce16ayJJXisBiEPqGJYJgNrMiItvK9YuslFPy9HAFiADoe+mo1ENarhvAaSqIpK6xvKSyV+VtjD4mYeIJhv x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR18MB2844.namprd18.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(136003)(396003)(376002)(366004)(451199021)(2906002)(316002)(38070700005)(41300700001)(52536014)(8936002)(8676002)(5660300002)(86362001)(33656002)(55016003)(478600001)(6506007)(122000001)(186003)(9686003)(71200400001)(3480700007)(26005)(7696005)(38100700002)(66946007)(76116006)(91956017)(64756008)(6916009)(66446008)(66476007)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?7ytRkmdHq3MYe4qIo5WqMeQVGNib?= =?utf-8?q?ZYGq8SFV6crTNfi05m+Nd7Obi666007g5FwhxIRxAP8hi4GZ5BgYSMzqXOsf/qmbu?= =?utf-8?q?5nehYWedySiwczO9c2X9znaTwW4XYcSW33bp/IldDXBj2dNzUTPfqhRJUfOB6OjOs?= =?utf-8?q?ZDCKBwTEwwGzZSMoulICAUe0AQ7x08OLk6dNtyEOm4e44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fVdH6?= =?utf-8?q?yhjJt6rYuK91v4S+WRLiFEhHtUht1LQS5k7ltcHsM57XMLafIilVlURGSa4MZ+DDC?= =?utf-8?q?VnVX0PfMgTZSHiDSUt3XtK7fX/Tt6UBfvCe/nlRjYFoQpskE9uM+6qkrVQBAqWavq?= =?utf-8?q?seZoT19I50t2vx/cGmG7flXDjB8ii8/dQAiiQ7knK+Xun1+w8ddLAFQ3T2N3//rsi?= =?utf-8?q?W6cNv2znHG2u01UohWudoHTHKaW9X15glM2bDWEbycs87uQfZRUurPIdpmHlPGT6G?= =?utf-8?q?TFbyF4UaB9CurasBPA8CMAy1YVJKcPkrOOAOdKFlGwSQLWa+KW6evDpgg8adsOq0J?= =?utf-8?q?66fiP5eMmpHRTW079hiaf4ebSFF3V1gh8xfr0sZ/rLRSakZ2iVuWXbk490ci5dcDS?= =?utf-8?q?6anHcFVeH9/teilJQ37RL3rLzMUBclV6cDr6bYPfUzN2flBAv7B2dEhIgSkpNMWJC?= =?utf-8?q?HFCqCsy+02AZ?= MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR18MB2844.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ade98cf0-b871-47f8-d523-08db88c2babc X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2023 01:43:34.0685 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nvwDqOpPRLQAo5MchwlvbS7Yvgl/SfwRRZhJIVv6eErcEmcJPibEdKbgXeL8EOnti+Qd3dhQRsihxI+crufsXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR18MB5181 X-Proofpoint-GUID: uBWPMX6nmEYBP8ymFCSeF7avge2RpmT_ X-Proofpoint-ORIG-GUID: uBWPMX6nmEYBP8ymFCSeF7avge2RpmT_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-19_16,2023-07-19_01,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Hello All, I am adding FM-API support to add DCD extents in QEMU. The current code is not making sense to me.  According to CXL3.0 spec (Table 8-126), region_base should be the DPA and not the size, decode_length is the total region length which is used to program HDM decoders, region_len is the usable length meaning as extents are added the region_len increases up to a max of decode_length. So should be 0 before we add any extents.  This is what it should look like in my opinion. Am I correct ? --- hw/mem/cxl_type3_old.c    2023-07-19 18:18:54.211748475 -0700 +++ hw/mem/cxl_type3.c  2023-07-19 18:27:13.468602825 -0700 @@ -747,10 +747,10 @@  static int cxl_create_toy_regions(CXLType3Dev *ct3d)  {       int i; -     uint64_t region_base = ct3d->hostvmem?ct3d->hostvmem->size -           :ct3d->hostpmem->size; -     uint64_t region_len = 1024*1024*1024; -     uint64_t decode_len = 4; /* 4*256MB */ +    MemoryRegion *mr = host_memory_backend_get_memory(ct3d->dc.host_dc); +    uint64_t region_base = (uint64_t)memory_region_get_ram_ptr(mr); +     uint64_t region_len = 0; +     uint64_t decode_len = ct3d->dc.host_dc->size / ct3d->dc.num_regions / (256*1024*1024);       uint64_t blk_size = 2*1024*1024;       struct CXLDCD_Region *region;