Message ID | 20250205151950.25268-8-alucerop@amd.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | cxl: add type2 device basic support | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Guessing tree name failed - patch did not apply |
alucerop@ wrote: > From: Alejandro Lucero <alucerop@amd.com> [snip] > diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c > index 08705c39721d..4461cababf6a 100644 > --- a/drivers/cxl/core/pci.c > +++ b/drivers/cxl/core/pci.c > @@ -177,8 +177,9 @@ static int cxl_dvsec_mem_range_active(struct cxl_dev_state *cxlds, int id) > * Wait up to @media_ready_timeout for the device to report memory > * active. > */ > -int cxl_await_media_ready(struct cxl_dev_state *cxlds) > +int cxl_await_media_ready(struct cxl_memdev_state *cxlmds) > { > + struct cxl_dev_state *cxlds = &cxlmds->cxlds; I feel like I have missed something where suddenly cxl_memdev_state is the primary carrier of the CXL state for accelerators. Here, like in a previous patch, you simply turn mds into cxlds? > struct pci_dev *pdev = to_pci_dev(cxlds->dev); > int d = cxlds->cxl_dvsec; > int rc, i, hdm_count; > @@ -211,6 +212,14 @@ int cxl_await_media_ready(struct cxl_dev_state *cxlds) > } > EXPORT_SYMBOL_NS_GPL(cxl_await_media_ready, "CXL"); > > +void cxl_set_media_ready(struct cxl_memdev_state *cxlmds) > +{ > + struct cxl_dev_state *cxlds = &cxlmds->cxlds; And here same thing here? Ira [snip]
On 2/5/25 21:42, Ira Weiny wrote: > alucerop@ wrote: >> From: Alejandro Lucero <alucerop@amd.com> > [snip] > >> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c >> index 08705c39721d..4461cababf6a 100644 >> --- a/drivers/cxl/core/pci.c >> +++ b/drivers/cxl/core/pci.c >> @@ -177,8 +177,9 @@ static int cxl_dvsec_mem_range_active(struct cxl_dev_state *cxlds, int id) >> * Wait up to @media_ready_timeout for the device to report memory >> * active. >> */ >> -int cxl_await_media_ready(struct cxl_dev_state *cxlds) >> +int cxl_await_media_ready(struct cxl_memdev_state *cxlmds) >> { >> + struct cxl_dev_state *cxlds = &cxlmds->cxlds; > I feel like I have missed something where suddenly cxl_memdev_state is the > primary carrier of the CXL state for accelerators. Here, like in a > previous patch, you simply turn mds into cxlds? Yes. It is explained in the cover letter. I'm not allocating a cxl_dev_state anymore but a cxl_memdev_state which contains the other one. I did use original code from Dan and I did feel the structs required a new refactoring with the arrival of Type2 support. But I know have a better understanding of the code and structs, and there is no reason for allocating cxl_dev_state only for a Type2, since it is a memdev as well. It makes things simpler and cleaner. So the reference struct for all the accel API is now the cxl_memdev_state instead of cxl_dev_state. For allowing sharing of current code with Type2 needs, some functions are modified for receiving a cxl_memdev_state now, what I do not think it being problematic at all. I know this is a main change for a v10, but the DPA changes and some comments from Dan pushed me for this, what I had in my mind for a while. I hope it makes sense ... >> struct pci_dev *pdev = to_pci_dev(cxlds->dev); >> int d = cxlds->cxl_dvsec; >> int rc, i, hdm_count; >> @@ -211,6 +212,14 @@ int cxl_await_media_ready(struct cxl_dev_state *cxlds) >> } >> EXPORT_SYMBOL_NS_GPL(cxl_await_media_ready, "CXL"); >> >> +void cxl_set_media_ready(struct cxl_memdev_state *cxlmds) >> +{ >> + struct cxl_dev_state *cxlds = &cxlmds->cxlds; > And here same thing here? > > Ira > > [snip] >
diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 08705c39721d..4461cababf6a 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -177,8 +177,9 @@ static int cxl_dvsec_mem_range_active(struct cxl_dev_state *cxlds, int id) * Wait up to @media_ready_timeout for the device to report memory * active. */ -int cxl_await_media_ready(struct cxl_dev_state *cxlds) +int cxl_await_media_ready(struct cxl_memdev_state *cxlmds) { + struct cxl_dev_state *cxlds = &cxlmds->cxlds; struct pci_dev *pdev = to_pci_dev(cxlds->dev); int d = cxlds->cxl_dvsec; int rc, i, hdm_count; @@ -211,6 +212,14 @@ int cxl_await_media_ready(struct cxl_dev_state *cxlds) } EXPORT_SYMBOL_NS_GPL(cxl_await_media_ready, "CXL"); +void cxl_set_media_ready(struct cxl_memdev_state *cxlmds) +{ + struct cxl_dev_state *cxlds = &cxlmds->cxlds; + + cxlds->media_ready = true; +} +EXPORT_SYMBOL_NS_GPL(cxl_set_media_ready, "CXL"); + static int cxl_set_mem_enable(struct cxl_dev_state *cxlds, u16 val) { struct pci_dev *pdev = to_pci_dev(cxlds->dev); diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 62a459078ec3..ab8c23009b9d 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -840,7 +840,6 @@ enum { int cxl_internal_send_cmd(struct cxl_mailbox *cxl_mbox, struct cxl_mbox_cmd *cmd); int cxl_dev_state_identify(struct cxl_memdev_state *mds); -int cxl_await_media_ready(struct cxl_dev_state *cxlds); int cxl_enumerate_cmds(struct cxl_memdev_state *mds); int cxl_mem_dpa_fetch(struct cxl_memdev_state *mds, struct cxl_dpa_info *info); struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev, u64 serial, diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index cf0991c423d1..5fe5f7ff4fb1 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -12,6 +12,7 @@ #include <linux/aer.h> #include <linux/io.h> #include <cxl/mailbox.h> +#include <cxl/cxl.h> #include "cxlmem.h" #include "cxlpci.h" #include "cxl.h" @@ -922,7 +923,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (rc) return rc; - rc = cxl_await_media_ready(cxlds); + rc = cxl_await_media_ready(mds); if (rc == 0) cxlds->media_ready = true; else diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h index 17bf86993a41..955e58103df6 100644 --- a/include/cxl/cxl.h +++ b/include/cxl/cxl.h @@ -46,4 +46,6 @@ struct pci_dev; struct cxl_dev_state; int cxl_pci_accel_setup_regs(struct pci_dev *pdev, struct cxl_memdev_state *cxlmds, unsigned long *caps); +int cxl_await_media_ready(struct cxl_memdev_state *mds); +void cxl_set_media_ready(struct cxl_memdev_state *mds); #endif