RE: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-10 Thread Avri Altman
> +static bool ufshpb_test_ppn_dirty(struct ufshpb_lu *hpb, int rgn_idx, > + int srgn_idx, int srgn_offset, int cnt) > +{ > + struct ufshpb_region *rgn; > + struct ufshpb_subregion *srgn; > + int bitmap_len = hpb->entries_per_srgn; > + int

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-09 Thread Can Guo
On 2021-02-09 22:21, Bean Huo wrote: On Tue, 2021-02-09 at 13:25 +, Avri Altman wrote: > > > > > > + put_unaligned_be64(ppn, [6]); > > > > > > You are assuming the HPB entries read out by "HPB Read Buffer" > > > cmd > > > are > > > in Little > > > Endian, which is why you are using

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-09 Thread Bean Huo
On Tue, 2021-02-09 at 13:25 +, Avri Altman wrote: > > > > > > > > > + put_unaligned_be64(ppn, [6]); > > > > > > > > You are assuming the HPB entries read out by "HPB Read Buffer" > > > > cmd > > > > are > > > > in Little > > > > Endian, which is why you are using put_unaligned_be64

RE: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-09 Thread Avri Altman
> > > > > > + put_unaligned_be64(ppn, [6]); > > > > > > You are assuming the HPB entries read out by "HPB Read Buffer" cmd > > > are > > > in Little > > > Endian, which is why you are using put_unaligned_be64 here. However, > > > this assumption > > > is not right for all the other flash

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-08 Thread Can Guo
On 2021-02-08 16:16, Bean Huo wrote: On Fri, 2021-02-05 at 11:29 +0800, Can Guo wrote: > + return ppn_table[offset]; > +} > + > +static void > +ufshpb_get_pos_from_lpn(struct ufshpb_lu *hpb, unsigned long lpn, > int > *rgn_idx, > + int *srgn_idx, int *offset) > +{ > +

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-08 Thread Bean Huo
On Fri, 2021-02-05 at 11:29 +0800, Can Guo wrote: > > + return ppn_table[offset]; > > +} > > + > > +static void > > +ufshpb_get_pos_from_lpn(struct ufshpb_lu *hpb, unsigned long lpn, > > int > > *rgn_idx, > > + int *srgn_idx, int *offset) > > +{ > > + int rgn_offset; >

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-07 Thread Bean Huo
On Sun, 2021-02-07 at 15:36 +0800, Can Guo wrote: > > > > Thanks, I tested Daejun's patchset before, it is also ok (I don't > > know > > which version patchset). maybe we can keep current implementation > > as > > default, then if there is conflict, and submit the quirk. > > > > Yeah, you've

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-06 Thread Can Guo
On 2021-02-05 23:08, Bean Huo wrote: On Fri, 2021-02-05 at 14:06 +, Avri Altman wrote: > > > + put_unaligned_be64(ppn, [6]); > > > > You are assuming the HPB entries read out by "HPB Read Buffer" > > cmd > > are > > in Little > > Endian, which is why you are using put_unaligned_be64

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-05 Thread Bean Huo
On Fri, 2021-02-05 at 14:06 +, Avri Altman wrote: > > > > + put_unaligned_be64(ppn, [6]); > > > > > > You are assuming the HPB entries read out by "HPB Read Buffer" > > > cmd > > > are > > > in Little > > > Endian, which is why you are using put_unaligned_be64 here. > > > However, > > >

RE: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-05 Thread Avri Altman
> > > + put_unaligned_be64(ppn, [6]); > > > > You are assuming the HPB entries read out by "HPB Read Buffer" cmd > > are > > in Little > > Endian, which is why you are using put_unaligned_be64 here. However, > > this assumption > > is not right for all the other flash vendors - HPB entries

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-05 Thread Bean Huo
On Fri, 2021-02-05 at 11:29 +0800, Can Guo wrote: > > + *rgn_idx = lpn >> hpb->entries_per_rgn_shift; > > + rgn_offset = lpn & hpb->entries_per_rgn_mask; > > + *srgn_idx = rgn_offset >> hpb->entries_per_srgn_shift; > > + *offset = rgn_offset & hpb->entries_per_srgn_mask; > > +} > >

Re: [PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-02-04 Thread Can Guo
On 2021-01-29 13:30, Daejun Park wrote: This patch changes the read I/O to the HPB read I/O. If the logical address of the read I/O belongs to active sub-region, the HPB driver modifies the read I/O command to HPB read. It modifies the UPIU command of UFS instead of modifying the existing

[PATCH v19 3/3] scsi: ufs: Prepare HPB read for cached sub-region

2021-01-28 Thread Daejun Park
This patch changes the read I/O to the HPB read I/O. If the logical address of the read I/O belongs to active sub-region, the HPB driver modifies the read I/O command to HPB read. It modifies the UPIU command of UFS instead of modifying the existing SCSI command. In the HPB version 1.0, the