lkml.org 
[lkml]   [2021]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: RE: [PATCH v21 3/4] scsi: ufs: Prepare HPB read for cached sub-region
From
Date
> +static u64 ufshpb_get_ppn(struct ufshpb_lu *hpb,
> > + struct ufshpb_map_ctx *mctx, int pos, int *error)
> > +{
> > + u64 *ppn_table;
> > + struct page *page;
> > + int index, offset;
> > +
> > + index = pos / (PAGE_SIZE / HPB_ENTRY_SIZE);
> > + offset = pos % (PAGE_SIZE / HPB_ENTRY_SIZE);
> > +
> > + page = mctx->m_page[index];
> > + if (unlikely(!page)) {
> > + *error = -ENOMEM;
> > + dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> > + "error. cannot find page in mctx\n");
> > + return 0;
> > + }
> > +
> > + ppn_table = page_address(page);
> > + if (unlikely(!ppn_table)) {
> > + *error = -ENOMEM;
> > + dev_err(&hpb->sdev_ufs_lu->sdev_dev,
> > + "error. cannot get ppn_table\n");
> > + return 0;
> > + }
> > +
> > + return ppn_table[offset];
> How about memcpy here as well?
> This way it is clear that the host is not manipulating the physical addresses in any way,
> And you won't need to invent the new ufshpb_fill_ppn_from_page.
>
I changed the code to use ufshpb_fill_ppn_from_page() because it is more
genenal for use than ufshpb_get_ppn(). And I fixed to use memcpy for
setting cdb of HPB read.

Thanks,
Daejun

\
 
 \ /
  Last update: 2021-02-22 09:22    [W:0.082 / U:17.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site