Re: [PATCH RFC v3 6/6] cxl/memdev: Register for and process CPER events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Smita Koralahalli wrote:
> On 11/1/2023 2:11 PM, Ira Weiny wrote:
> 

[snip]

> > +#define CXL_EVENT_HDR_FLAGS_REC_SEVERITY GENMASK(1, 0)
> > +static int cxl_cper_event_call(struct notifier_block *nb, unsigned long action,
> > +			       void *data)
> > +{
> > +	struct cxl_cper_notifier_data *nd = data;
> > +	struct cper_cxl_event_devid *device_id = &nd->rec->hdr.device_id;
> > +	enum cxl_event_log_type log_type;
> > +	struct cxl_memdev_state *mds;
> > +	struct cxl_dev_state *cxlds;
> > +	struct pci_dev *pdev;
> > +	unsigned int devfn;
> > +	u32 hdr_flags;
> > +
> > +	mds = container_of(nb, struct cxl_memdev_state, cxl_cper_nb);
> > +
> > +	/* PCI_DEVFN() would require 2 extra bit shifts; skip those */
> > +	devfn = (device_id->slot_num & 0xfff8) | (device_id->func_num & 0x07);
> 
> devfn = PCI_DEVFN(device_id->device_num, device_id->func_num) should 
> also work correct?

Device num is the slot number right shifted?  If so then yes.  I'm not an
expert on the PCIe nomenclature.

> 
> > +	pdev = pci_get_domain_bus_and_slot(device_id->segment_num,
> > +					   device_id->bus_num, devfn);
> > +	cxlds = pci_get_drvdata(pdev);
> > +	if (cxlds != &mds->cxlds) {
> 
> Do we need a error message here?

No, it is just that this event is not for this device.  Another device
will process it.  Or if there is no driver loaded for the device it will
be ignored.  (Same as would happen if the events were coming through the
log because the driver is not monitoring the log.)

Ira



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux