Re: [PATCH 14/46] cxl/hdm: Enumerate allocated DPA

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

 



...

> > > +static int __cxl_dpa_reserve(struct cxl_endpoint_decoder *cxled,
> > > +			     resource_size_t base, resource_size_t len,
> > > +			     resource_size_t skip)
> > > +{
> > > +	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> > > +	struct cxl_port *port = cxled_to_port(cxled);
> > > +	struct cxl_dev_state *cxlds = cxlmd->cxlds;
> > > +	struct device *dev = &port->dev;
> > > +	struct resource *res;
> > > +
> > > +	lockdep_assert_held_write(&cxl_dpa_rwsem);
> > > +
> > > +	if (!len)
> > > +		return 0;
> > > +
> > > +	if (cxled->dpa_res) {
> > > +		dev_dbg(dev, "decoder%d.%d: existing allocation %pr assigned\n",
> > > +			port->id, cxled->cxld.id, cxled->dpa_res);
> > > +		return -EBUSY;
> > > +	}
> > > +
> > > +	if (skip) {
> > > +		res = __request_region(&cxlds->dpa_res, base - skip, skip,
> > > +				       dev_name(dev), 0);  
> > 
> > 
> > Interface that uses a backwards definition of skip as what to skip before
> > the base parameter is a little odd can we rename base parameter to something
> > like 'current_top' then have base = current_top + skip?  current_top naming
> > not great though...  
> 
> How about just name it "skipped" instead of "skip"? As the parameter is
> how many bytes were skipped to allow a new allocation to start at base.

Works for me (guessing you long since went with this given how far behind I am!)

Thanks,

Jonathan



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux