[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250331183350.GF185681@horms.kernel.org>
Date: Mon, 31 Mar 2025 19:33:50 +0100
From: Simon Horman <horms@...nel.org>
To: alejandro.lucero-palau@....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, Alejandro Lucero <alucerop@....com>,
Ben Cheatham <benjamin.cheatham@....com>
Subject: Re: [PATCH v12 05/23] cxl: add function for type2 cxl regs setup
On Mon, Mar 31, 2025 at 03:45:37PM +0100, alejandro.lucero-palau@....com wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> Create a new function for a type2 device initialising
> cxl_dev_state struct regarding cxl regs setup and mapping.
>
> Export the capabilities found for checking them against the
> expected ones by the driver.
>
> Signed-off-by: Alejandro Lucero <alucerop@....com>
> Reviewed-by: Ben Cheatham <benjamin.cheatham@....com>
> ---
> drivers/cxl/core/pci.c | 52 ++++++++++++++++++++++++++++++++++++++++++
> include/cxl/cxl.h | 5 ++++
> 2 files changed, 57 insertions(+)
>
> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index 05399292209a..e48320e16a4f 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
> @@ -1095,6 +1095,58 @@ int cxl_pci_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type,
> }
> EXPORT_SYMBOL_NS_GPL(cxl_pci_setup_regs, "CXL");
>
> +static int cxl_pci_setup_memdev_regs(struct pci_dev *pdev,
> + struct cxl_dev_state *cxlds,
> + unsigned long *caps)
> +{
> + struct cxl_register_map map;
> + int rc;
> +
> + rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_MEMDEV, &map, caps);
> + /*
> + * This call can return -ENODEV if regs not found. This is not an error
> + * for Type2 since these regs are not mandatory. If they do exist then
> + * mapping them should not fail. If they should exist, it is with driver
> + * calling cxl_pci_check_caps where the problem should be found.
> + */
> + if (rc == -ENODEV)
> + return 0;
> +
> + if (rc)
> + return rc;
> +
> + return cxl_map_device_regs(&map, &cxlds->regs.device_regs);
> +}
> +
> +int cxl_pci_accel_setup_regs(struct pci_dev *pdev, struct cxl_dev_state *cxlds,
> + unsigned long *caps)
nit: the indentation of the line above is not quite aligned
to the inside of the opening parentheses on the previous line.
There is one space too many.
...
Powered by blists - more mailing lists