[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b94407d9-6ae0-4b71-a8ec-2cf3ba612b36@amd.com>
Date: Mon, 14 Apr 2025 14:52:23 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Dave Jiang <dave.jiang@...el.com>, alejandro.lucero-palau@....com,
linux-cxl@...r.kernel.org, netdev@...r.kernel.org, dan.j.williams@...el.com,
edward.cree@....com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, edumazet@...gle.com
Subject: Re: [PATCH v12 18/23] cxl: allow region creation by type2 drivers
On 4/12/25 00:18, Dave Jiang wrote:
>
> On 3/31/25 7:45 AM, alejandro.lucero-palau@....com wrote:
snip
>> +
>> + down_read(&cxl_dpa_rwsem);
>> + rc = cxl_region_attach(cxlr, cxled, 0);> + up_read(&cxl_dpa_rwsem);
>> +> + if (rc)
>> + goto err;
> scoped_guard(rwsem_read, &cxl_dpa_rwsem) {
> rc = cxl_region_attach(cxlr, cxled, 0);
> if (rc)
> goto err;
> }
>
OK.
>
>> +
>> + rc = cxl_region_decode_commit(cxlr);
>> + if (rc)
>> + goto err;
>> +
>> + p->state = CXL_CONFIG_COMMIT;
>> +
>> + return cxlr;
>> +err:
>> + drop_region(cxlr);
>> + return ERR_PTR(rc);
>> +}
>> +
>> +/**
>> + * cxl_create_region - Establish a region given an endpoint decoder
>> + * @cxlrd: root decoder to allocate HPA
>> + * @cxled: endpoint decoder with reserved DPA capacity
>> + * @ways: interleave ways required
>> + *
>> + * Returns a fully formed region in the commit state and attached to the
>> + * cxl_region driver.
>> + */
>> +struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
>> + struct cxl_endpoint_decoder *cxled, int ways)
>> +{
>> + struct cxl_region *cxlr;
>> +
>> + mutex_lock(&cxlrd->range_lock);
>> + cxlr = __construct_new_region(cxlrd, cxled, ways);> + mutex_unlock(&cxlrd->range_lock);
>> +
>> + if (IS_ERR(cxlr))
>> + return cxlr;
> scoped_guard(mutex, &cxlrd->range_lock) {
> cxlr = __construct_new_region(cxlrd, cxled, ways);
> if (IS_ERR(cxlr))
> return cxlr;
> }
>
> DJ
OK.
Thanks
Powered by blists - more mailing lists