[PATCH 0/4] RISCVCPUConfig related cleanups

Daniel Henrique Barboza posted 4 patches 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230224174520.92490-1-dbarboza@ventanamicro.com
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>
target/riscv/csr.c | 90 +++++++++++++---------------------------------
1 file changed, 24 insertions(+), 66 deletions(-)
[PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Daniel Henrique Barboza 1 year, 2 months ago
Hi,

These cleanups were suggested by LIU Zhiwei during the review of the
RISCV_FEATURE_* cleanups, currently on version 7 [1].

These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.


[1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html

Daniel Henrique Barboza (4):
  target/riscv/csr.c: use env_archcpu() in ctr()
  target/riscv/csr.c: simplify mctr()
  target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
  target/riscv/csr.c: avoid env_archcpu() usages when reading
    RISCVCPUConfig

 target/riscv/csr.c | 90 +++++++++++++---------------------------------
 1 file changed, 24 insertions(+), 66 deletions(-)

-- 
2.39.2
Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Richard Henderson 1 year, 2 months ago
On 2/24/23 07:45, Daniel Henrique Barboza wrote:
> Hi,
> 
> These cleanups were suggested by LIU Zhiwei during the review of the
> RISCV_FEATURE_* cleanups, currently on version 7 [1].
> 
> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
> 
> 
> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
> 
> Daniel Henrique Barboza (4):
>    target/riscv/csr.c: use env_archcpu() in ctr()
>    target/riscv/csr.c: simplify mctr()
>    target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
>    target/riscv/csr.c: avoid env_archcpu() usages when reading
>      RISCVCPUConfig
> 
>   target/riscv/csr.c | 90 +++++++++++++---------------------------------
>   1 file changed, 24 insertions(+), 66 deletions(-)
> 

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Palmer Dabbelt 1 year, 1 month ago
On Fri, 24 Feb 2023 09:45:16 PST (-0800), dbarboza@ventanamicro.com wrote:
> Hi,
>
> These cleanups were suggested by LIU Zhiwei during the review of the
> RISCV_FEATURE_* cleanups, currently on version 7 [1].
>
> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
>
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
>
> Daniel Henrique Barboza (4):
>   target/riscv/csr.c: use env_archcpu() in ctr()
>   target/riscv/csr.c: simplify mctr()
>   target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
>   target/riscv/csr.c: avoid env_archcpu() usages when reading
>     RISCVCPUConfig
>
>  target/riscv/csr.c | 90 +++++++++++++---------------------------------
>  1 file changed, 24 insertions(+), 66 deletions(-)

I just based these on that patch, which landed as d4ea711704 
("target/riscv: introduce riscv_cpu_cfg()").  That resulted in a handful 
of merge conflicts, but everything looked pretty mechanical.  So it's 
queued up.

Thanks!
Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Bin Meng 1 year, 1 month ago
Hi Palmer,

On Thu, Mar 2, 2023 at 10:08 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> On Fri, 24 Feb 2023 09:45:16 PST (-0800), dbarboza@ventanamicro.com wrote:
> > Hi,
> >
> > These cleanups were suggested by LIU Zhiwei during the review of the
> > RISCV_FEATURE_* cleanups, currently on version 7 [1].
> >
> > These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
> > riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
> >
> >
> > [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
> >
> > Daniel Henrique Barboza (4):
> >   target/riscv/csr.c: use env_archcpu() in ctr()
> >   target/riscv/csr.c: simplify mctr()
> >   target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
> >   target/riscv/csr.c: avoid env_archcpu() usages when reading
> >     RISCVCPUConfig
> >
> >  target/riscv/csr.c | 90 +++++++++++++---------------------------------
> >  1 file changed, 24 insertions(+), 66 deletions(-)
>
> I just based these on that patch, which landed as d4ea711704
> ("target/riscv: introduce riscv_cpu_cfg()").  That resulted in a handful
> of merge conflicts, but everything looked pretty mechanical.  So it's
> queued up.
>

As Weiwei pointed out in
https://lore.kernel.org/qemu-devel/e40e75ff-37e0-94d3-e9e2-c159b0e2da68@iscas.ac.cn/,
patch#1 should be dropped.

But I see it was landed up in your tree @
https://github.com/palmer-dabbelt/qemu/commit/3c7d54f945f1b5b474ea35c0815a1618927c9384,
while my changes are already in tree @
https://github.com/palmer-dabbelt/qemu/commit/94e297071bc0a5965cc32c497a886f2cf9d32710.

Not sure why git doesn't figure that out ...

Regards,
Bin
Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Daniel Henrique Barboza 1 year, 1 month ago

On 3/1/23 23:24, Bin Meng wrote:
> Hi Palmer,
> 
> On Thu, Mar 2, 2023 at 10:08 AM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>>
>> On Fri, 24 Feb 2023 09:45:16 PST (-0800), dbarboza@ventanamicro.com wrote:
>>> Hi,
>>>
>>> These cleanups were suggested by LIU Zhiwei during the review of the
>>> RISCV_FEATURE_* cleanups, currently on version 7 [1].
>>>
>>> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
>>> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
>>>
>>>
>>> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
>>>
>>> Daniel Henrique Barboza (4):
>>>    target/riscv/csr.c: use env_archcpu() in ctr()
>>>    target/riscv/csr.c: simplify mctr()
>>>    target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
>>>    target/riscv/csr.c: avoid env_archcpu() usages when reading
>>>      RISCVCPUConfig
>>>
>>>   target/riscv/csr.c | 90 +++++++++++++---------------------------------
>>>   1 file changed, 24 insertions(+), 66 deletions(-)
>>
>> I just based these on that patch, which landed as d4ea711704
>> ("target/riscv: introduce riscv_cpu_cfg()").  That resulted in a handful
>> of merge conflicts, but everything looked pretty mechanical.  So it's
>> queued up.
>>
> 
> As Weiwei pointed out in
> https://lore.kernel.org/qemu-devel/e40e75ff-37e0-94d3-e9e2-c159b0e2da68@iscas.ac.cn/,
> patch#1 should be dropped.

Yeah, that's my bad. I should've send a v2 owithout patch 1 to avoid confusion.


Daniel

> 
> But I see it was landed up in your tree @
> https://github.com/palmer-dabbelt/qemu/commit/3c7d54f945f1b5b474ea35c0815a1618927c9384,
> while my changes are already in tree @
> https://github.com/palmer-dabbelt/qemu/commit/94e297071bc0a5965cc32c497a886f2cf9d32710.
> 
> Not sure why git doesn't figure that out ...
> 
> Regards,
> Bin

Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by liweiwei 1 year, 2 months ago
On 2023/2/25 01:45, Daniel Henrique Barboza wrote:
> Hi,
>
> These cleanups were suggested by LIU Zhiwei during the review of the
> RISCV_FEATURE_* cleanups, currently on version 7 [1].
>
> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
>
>
> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
>
> Daniel Henrique Barboza (4):
>    target/riscv/csr.c: use env_archcpu() in ctr()
>    target/riscv/csr.c: simplify mctr()
>    target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
>    target/riscv/csr.c: avoid env_archcpu() usages when reading
>      RISCVCPUConfig
>
>   target/riscv/csr.c | 90 +++++++++++++---------------------------------
>   1 file changed, 24 insertions(+), 66 deletions(-)
>
As  I suggested in another patch, cpu_get_cfg() can also be used in 
vector_helper.c.

Regards,

Weiwei Li


Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Daniel Henrique Barboza 1 year, 2 months ago

On 2/25/23 03:47, liweiwei wrote:
> 
> On 2023/2/25 01:45, Daniel Henrique Barboza wrote:
>> Hi,
>>
>> These cleanups were suggested by LIU Zhiwei during the review of the
>> RISCV_FEATURE_* cleanups, currently on version 7 [1].
>>
>> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
>> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.
>>
>>
>> [1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg06467.html
>>
>> Daniel Henrique Barboza (4):
>>    target/riscv/csr.c: use env_archcpu() in ctr()
>>    target/riscv/csr.c: simplify mctr()
>>    target/riscv/csr.c: use riscv_cpu_cfg() to avoid env_cpu() pointers
>>    target/riscv/csr.c: avoid env_archcpu() usages when reading
>>      RISCVCPUConfig
>>
>>   target/riscv/csr.c | 90 +++++++++++++---------------------------------
>>   1 file changed, 24 insertions(+), 66 deletions(-)
>>
> As  I suggested in another patch, cpu_get_cfg() can also be used in vector_helper.c.


I decided to do it in a separated series together with the vector_helper.c change
I did last week:


https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg07566.html


The vector_change I did prior eliminated some of the env_archcpu() we want to
avoid so makes sense to one after the other.


Thanks,


Daniel


> 
> Regards,
> 
> Weiwei Li
> 
> 

Re: [PATCH 0/4] RISCVCPUConfig related cleanups
Posted by Richard Henderson 1 year, 2 months ago
On 2/24/23 07:45, Daniel Henrique Barboza wrote:
> Hi,
> 
> These cleanups were suggested by LIU Zhiwei during the review of the
> RISCV_FEATURE_* cleanups, currently on version 7 [1].
> 
> These are dependent on the patch "[PATCH v7 01/10] target/riscv: introduce
> riscv_cpu_cfg()" from [1] because we use the riscv_cpu_cfg() API.

If you add

Based-on: <message-id>

to the cover letter, then patchew can stitch the two patch sets together in its git 
repository.


r~