> -----Original Message-----
> From: Alex Williamson <[email protected]>
> Sent: Friday, August 28, 2026 2:28 AM
> To: Manish Honap <[email protected]>
> Cc: [email protected]; Ankit Agrawal <[email protected]>; [email protected];
> [email protected]; [email protected]; Srirangan Madhavan
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Yishai Hadas
> <[email protected]>; Shameer Kolothum Thodi
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; Neo Jia
> <[email protected]>; Krishnakant Jaju <[email protected]>; Vikram Sethi
> <[email protected]>; Zhi Wang <[email protected]>; linux-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; [email protected]
> Subject: Re: [PATCH v4 10/27] vfio/cxl: Reject unsupported decoder topologies
> at bind
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, 13 Aug 2026 15:06:14 +0530
> <[email protected]> wrote:
> 
> > From: Manish Honap <[email protected]>
> >
> > The guest drives a single virtual decoder whose memory maps 1:1, so a
> > device with more than one HDM decoder, or an interleaved one, cannot
> > be represented. Turn that assumption into an explicit refusal at bind
> > rather than a silent misprogramming later.
> >
> > Signed-off-by: Manish Honap <[email protected]>
> > ---
> >  drivers/vfio/pci/cxl/vfio_cxl_core.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >
> > diff --git a/drivers/vfio/pci/cxl/vfio_cxl_core.c
> > b/drivers/vfio/pci/cxl/vfio_cxl_core.c
> > index 125e11354a46..7edc53b25576 100644
> > --- a/drivers/vfio/pci/cxl/vfio_cxl_core.c
> > +++ b/drivers/vfio/pci/cxl/vfio_cxl_core.c
> > @@ -36,10 +36,30 @@ static int vfio_cxl_init_device(struct
> vfio_pci_core_device *vdev)
> >       if (!pdev->hdm)
> >               return -EPROBE_DEFER;
> >
> > +     /* The guest drives one virtual decoder; multiple are unsupported. */
> > +     if (pdev->hdm->decoder_count != 1)
> > +             return -EOPNOTSUPP;
> > +
> >       hdm_size = range_len(&pdev->hdm->settings[0].hpa_range);
> >       if (!hdm_size)
> >               return -ENXIO;
> >
> > +     /* Interleaved decoders are unsupported. */
> > +     if (pdev->hdm->settings[0].interleave_ways != 1)
> > +             return -EOPNOTSUPP;
> > +
> > +     /*
> > +      * The guest drives resets through the CXL Device DVSEC and polls the
> > +      * shadow for completion. If the host cannot service a function-scoped
> > +      * CXL reset (no reset DVSEC, a multifunction device, or no HDM reset
> > +      * support), that guest request could never complete, so refuse the
> > +      * device rather than advertise a reset the guest would poll on 
> > forever.
> > +      */
> > +     if (!cxl_reset_capable(pdev)) {
> > +             pci_err(pdev, "vfio-cxl: Unsupported device: host cannot 
> > service a
> CXL reset request\n");
> > +             return -EOPNOTSUPP;
> > +     }
> 
> Why does this particular error deserve such a high priority log while we 
> silently
> fail the other two cases added here?
> 
> These don't seem particularly noteworthy to split into a separate patch versus
> rolling them into the previous.  I'd probably also group the easily testable
> EOPNOTSUPP errors before we actually start evaluating things like the
> hdm_size.  Thanks,
> 

Okay, I will fold this into the previous patch and make the log levels 
consistent.

I will also re-order the EOPNOTSUPP checks before evaluating hdm_size as 
suggested.

Manish

> Alex
> 
> > +
> >       dvsec = pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_CXL,
> >                                         PCI_DVSEC_CXL_DEVICE);
> >       serial = pci_get_dsn(pdev);


Reply via email to