On Thu, 17 Sep 2026 00:05:30 +0530
<[email protected]> wrote:

> From: Manish Honap <[email protected]>
> 
> devm_cxl_probe_mem() maps the component registers through the CXL core,
> which by default claims each HDM and RAS sub-block. That collides with
> the full-BAR request vfio-pci-core makes when the guest opens the device.
> 
> After the component registers are discovered, declare the containing BAR
> owned with cxl_reg_map_add_owned_resource(). The core then ioremaps the
> sub-blocks without requesting them, so vfio-pci-core owns the whole BAR
> and the requests do not collide.
> 
> Assisted-by: LLM
> Signed-off-by: Manish Honap <[email protected]>
> ---
>  drivers/vfio/pci/cxl/vfio_cxl_core.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/vfio/pci/cxl/vfio_cxl_core.c 
> b/drivers/vfio/pci/cxl/vfio_cxl_core.c
> index 0d92e6a409c1..5c8a63833a43 100644
> --- a/drivers/vfio/pci/cxl/vfio_cxl_core.c
> +++ b/drivers/vfio/pci/cxl/vfio_cxl_core.c
> @@ -89,6 +89,15 @@ static int vfio_cxl_init_device(struct 
> vfio_pci_core_device *vdev)
>               goto err;
>       }
>  
> +     /*
> +      * vfio-pci-core requests the whole component-register BAR when the
> +      * guest opens the device. Declare that BAR owned so the CXL core
> +      * ioremaps the HDM and RAS sub-blocks without claiming them, and the
> +      * full-BAR request does not collide.
> +      */
> +     cxl_reg_map_add_owned_resource(&cxl->cxlds.reg_map,
> +                                    pci_resource_n(pdev, 
> pdev->hdm->hdm_bar));
> +

The result of this operation is setting a singleton "owned" pointer to
this resource, whereas the name suggests it's adding the resource to
some set of owned resources.  Is "set" really the more idiomatic verb
for this than "add"?  Thanks,

Alex

>       if (!cxl->cxlds.reg_map.component_map.hdm_decoder.valid) {
>               pci_err(pdev, "vfio-cxl: HDM decoder registers not found\n");
>               ret = -ENODEV;


Reply via email to