[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5971f28-8c94-44f7-a3ce-b3198a1591fb@amd.com>
Date: Mon, 17 Feb 2025 12:49:42 +0000
From: Alejandro Lucero Palau <alucerop@....com>
To: Alison Schofield <alison.schofield@...el.com>
Cc: 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, dave.jiang@...el.com
Subject: Re: [PATCH v10 01/26] cxl: make memdev creation type agnostic
On 2/13/25 03:57, Alison Schofield wrote:
> On Wed, Feb 05, 2025 at 03:19:25PM +0000, alucerop@....com wrote:
>> From: Alejandro Lucero <alucerop@....com>
>>
>> In preparation for Type2 support, change memdev creation making
>> type based on argument.
>>
>> Integrate initialization of dvsec and serial fields in the related
>> cxl_dev_state within same function creating the memdev.
>>
>> Move the code from mbox file to memdev file.
>>
>> Add new header files with type2 required definitions for memdev
>> state creation.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> ---
>> drivers/cxl/core/mbox.c | 20 --------------------
>> drivers/cxl/core/memdev.c | 23 +++++++++++++++++++++++
>> drivers/cxl/cxlmem.h | 18 +++---------------
>> drivers/cxl/cxlpci.h | 17 +----------------
>> drivers/cxl/pci.c | 16 +++++++++-------
>> include/cxl/cxl.h | 26 ++++++++++++++++++++++++++
>> include/cxl/pci.h | 23 +++++++++++++++++++++++
>> 7 files changed, 85 insertions(+), 58 deletions(-)
>> create mode 100644 include/cxl/cxl.h
>> create mode 100644 include/cxl/pci.h
>>
>> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
>> index 4d22bb731177..96155b8af535 100644
>> --- a/drivers/cxl/core/mbox.c
>> +++ b/drivers/cxl/core/mbox.c
>> @@ -1435,26 +1435,6 @@ int cxl_mailbox_init(struct cxl_mailbox *cxl_mbox, struct device *host)
>> }
>> EXPORT_SYMBOL_NS_GPL(cxl_mailbox_init, "CXL");
>>
>> -struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev)
>> -{
>> - struct cxl_memdev_state *mds;
>> -
>> - mds = devm_kzalloc(dev, sizeof(*mds), GFP_KERNEL);
>> - if (!mds) {
>> - dev_err(dev, "No memory available\n");
>> - return ERR_PTR(-ENOMEM);
>> - }
>> -
>> - mutex_init(&mds->event.log_lock);
>> - mds->cxlds.dev = dev;
>> - mds->cxlds.reg_map.host = dev;
>> - mds->cxlds.reg_map.resource = CXL_RESOURCE_NONE;
>> - mds->cxlds.type = CXL_DEVTYPE_CLASSMEM;
>> -
>> - return mds;
>> -}
>> -EXPORT_SYMBOL_NS_GPL(cxl_memdev_state_create, "CXL");
>> -
>> void __init cxl_mbox_init(void)
>> {
>> struct dentry *mbox_debugfs;
>> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
>> index 63c6c681125d..456d505f1bc8 100644
>> --- a/drivers/cxl/core/memdev.c
>> +++ b/drivers/cxl/core/memdev.c
>> @@ -632,6 +632,29 @@ static void detach_memdev(struct work_struct *work)
>>
>> static struct lock_class_key cxl_memdev_key;
>>
>> +struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev, u64 serial,
>> + u16 dvsec, enum cxl_devtype type)
>> +{
>> + struct cxl_memdev_state *mds;
>> +
>> + mds = devm_kzalloc(dev, sizeof(*mds), GFP_KERNEL);
>> + if (!mds) {
>> + dev_err(dev, "No memory available\n");
>> + return ERR_PTR(-ENOMEM);
>> + }
> I know you are only the 'mover' of the above code, but can
> you drop the dev_err message. OOM messages from the core are
> typically enough.
>
>
Sure. I'll do so.
Powered by blists - more mailing lists