[libvirt PATCH 0/5] add loongarch support for libvirt

xianglai li posted 5 patches 4 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1702455593.git.lixianglai@loongson.cn
There is a newer version of this series
po/POTFILES                        |   1 +
src/conf/schemas/basictypes.rng    |   1 +
src/cpu/cpu.c                      |   2 +
src/cpu/cpu.h                      |   2 +
src/cpu/cpu_loongarch.c            | 742 +++++++++++++++++++++++++++++
src/cpu/cpu_loongarch.h            |  25 +
src/cpu/cpu_loongarch_data.h       |  37 ++
src/cpu/meson.build                |   1 +
src/cpu_map/index.xml              |   5 +
src/cpu_map/loongarch_la464.xml    |   6 +
src/cpu_map/loongarch_vendors.xml  |   3 +
src/cpu_map/meson.build            |   2 +
src/qemu/qemu.conf.in              |   3 +-
src/qemu/qemu_capabilities.c       |   6 +
src/qemu/qemu_conf.c               |   3 +-
src/qemu/qemu_domain.c             |  32 ++
src/qemu/qemu_domain.h             |   1 +
src/qemu/qemu_domain_address.c     |  55 +++
src/qemu/qemu_validate.c           |   2 +-
src/qemu/test_libvirtd_qemu.aug.in |   1 +
src/util/virarch.c                 |   4 +
src/util/virarch.h                 |   4 +
src/util/virhostcpu.c              |   4 +-
src/util/virsysinfo.c              |   5 +-
24 files changed, 940 insertions(+), 7 deletions(-)
create mode 100644 src/cpu/cpu_loongarch.c
create mode 100644 src/cpu/cpu_loongarch.h
create mode 100644 src/cpu/cpu_loongarch_data.h
create mode 100644 src/cpu_map/loongarch_la464.xml
create mode 100644 src/cpu_map/loongarch_vendors.xml
[libvirt PATCH 0/5] add loongarch support for libvirt
Posted by xianglai li 4 months, 2 weeks ago
From: lixianglai <lixianglai@loongson.cn>

Hello, Everyone:
  This patch series adds libvirt support for loongarch.Although the bios
path and name has not been officially integrated into qemu and we think
there are still many shortcomings, we try to push a version of patch to
the community according to the opinions of the community, hoping to
listen to everyone's opinions. Anyway we have a version of libvirt that
supports loongarch.

  You can also get libvirt's patch from the link below:
https://gitlab.com/lixianglai/libvirt
branch: loongarch

  Since the patch associated with loongarch has not yet been submitted to
the virt-manager community, we are providing a temporary patch with
loongarch for the time being patch's virt-manager, the open source work
of virt-manager adding loongarch will be followed up later or
synchronized with the open source libvirt.

  You can get the virt-manager code with loongarch patch from the link below:
https://github.com/loongson/virt-manager
branch: loongarch

  loongarch's virtual machine bios is not yet available in qemu, so you can get it from the following link
https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine
(Note: You should clone the repository using git instead of downloading the file via wget or you'll get xml)
We named the bios edk2-loongarch64-code.fd, edk2-loongarch64-vars.fd is used to store pflash images of non-volatile
variables.After installing qemu-system-loongarch64, you need to manually copy these two files to the /user/share/qemu
directory.

  Since there is no fedora operating system that supports the loongarch
architecture, you can find an iso that supports loongarch at the link
below for testing purposes:
  https://github.com/fedora-remix-loongarch/releases-info

  Well, if you have completed the above steps I think you can now install loongarch virtual machine,
you can install it through the virt-manager graphical interface, or install it through vrit-install,
here is an example of installing it using virt-install:
virt-install  \
--virt-type=qemu \
--name  loongarch-test \
--memory 4096 \
--vcpus=4 \
--arch=loongarch64 \
--boot cdrom \
--disk device=cdrom,bus=scsi,path=/root/livecd-fedora-mate-4.loongarch64.iso \
--disk path=/var/lib/libvirt/images/debian12-loongarch64.qcow2,size=10,format=qcow2,bus=scsi \
--network network=default \
--osinfo archlinux   \
--feature acpi=true \
--video=virtio  \
--graphics=vnc,listen=0.0.0.0 

lixianglai (5):
  Add loongarch cpu support
  Add loongarch cpu model and vendor info
  Config some capabilities for loongarch virt machine
  Implement the method of getting host info for loongarch
  Add bios path for loongarch

 po/POTFILES                        |   1 +
 src/conf/schemas/basictypes.rng    |   1 +
 src/cpu/cpu.c                      |   2 +
 src/cpu/cpu.h                      |   2 +
 src/cpu/cpu_loongarch.c            | 742 +++++++++++++++++++++++++++++
 src/cpu/cpu_loongarch.h            |  25 +
 src/cpu/cpu_loongarch_data.h       |  37 ++
 src/cpu/meson.build                |   1 +
 src/cpu_map/index.xml              |   5 +
 src/cpu_map/loongarch_la464.xml    |   6 +
 src/cpu_map/loongarch_vendors.xml  |   3 +
 src/cpu_map/meson.build            |   2 +
 src/qemu/qemu.conf.in              |   3 +-
 src/qemu/qemu_capabilities.c       |   6 +
 src/qemu/qemu_conf.c               |   3 +-
 src/qemu/qemu_domain.c             |  32 ++
 src/qemu/qemu_domain.h             |   1 +
 src/qemu/qemu_domain_address.c     |  55 +++
 src/qemu/qemu_validate.c           |   2 +-
 src/qemu/test_libvirtd_qemu.aug.in |   1 +
 src/util/virarch.c                 |   4 +
 src/util/virarch.h                 |   4 +
 src/util/virhostcpu.c              |   4 +-
 src/util/virsysinfo.c              |   5 +-
 24 files changed, 940 insertions(+), 7 deletions(-)
 create mode 100644 src/cpu/cpu_loongarch.c
 create mode 100644 src/cpu/cpu_loongarch.h
 create mode 100644 src/cpu/cpu_loongarch_data.h
 create mode 100644 src/cpu_map/loongarch_la464.xml
 create mode 100644 src/cpu_map/loongarch_vendors.xml

-- 
2.27.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH 0/5] add loongarch support for libvirt
Posted by Andrea Bolognani 4 months, 2 weeks ago
On Thu, Dec 14, 2023 at 02:08:44PM +0800, xianglai li wrote:
> Hello, Everyone:
>   This patch series adds libvirt support for loongarch.Although the bios
> path and name has not been officially integrated into qemu and we think
> there are still many shortcomings, we try to push a version of patch to
> the community according to the opinions of the community, hoping to
> listen to everyone's opinions.

Sharing your work earlier rather than later is definitely a good
approach when it comes to open source development, so I appreciate
you doing this :)

>   loongarch's virtual machine bios is not yet available in qemu, so you can get it from the following link
> https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine

Great to see that edk2 support has already been mainlined! An
excellent next step would be to get an edk2-loongarch64 package into
the various distros... Please consider working with the maintainers
for edk2 in Fedora to make that happen, as it would significantly
lower the barrier for interested people to get involved.

> (Note: You should clone the repository using git instead of downloading the file via wget or you'll get xml)
> We named the bios edk2-loongarch64-code.fd, edk2-loongarch64-vars.fd is used to store pflash images of non-volatile
> variables.After installing qemu-system-loongarch64, you need to manually copy these two files to the /user/share/qemu
> directory.

As I have implicitly pointed out in the comment to one of the
patches, these paths are not correct.

The /usr/share/qemu/ directory is owned by the QEMU package, and
other components should not drop their files in there. The exception
is the /usr/share/qemu/firmware/ directory, which is specifically
designed for interoperation.

The edk2 files should be installed to /usr/share/edk2/loongarch64/,
following the convention established by existing architectures. Once
the directory name already contains architecture information, you can
use shorter and less unique names for the files themselves.

>   Well, if you have completed the above steps I think you can now install loongarch virtual machine,
> you can install it through the virt-manager graphical interface, or install it through vrit-install,
> here is an example of installing it using virt-install:
>
> virt-install  \
> --virt-type=qemu \
> --name  loongarch-test \
> --memory 4096 \
> --vcpus=4 \
> --arch=loongarch64 \
> --boot cdrom \
> --disk device=cdrom,bus=scsi,path=/root/livecd-fedora-mate-4.loongarch64.iso \
> --disk path=/var/lib/libvirt/images/debian12-loongarch64.qcow2,size=10,format=qcow2,bus=scsi \
> --network network=default \
> --osinfo archlinux   \
> --feature acpi=true \

This looks a bit out of place: virt-install should automatically
enable the ACPI feature if it's advertised as available by libvirt.

Please take a look at virQEMUCapsInitGuestFromBinary() and consider
updating it so that ACPI support for loongarch is advertised.

> lixianglai (5):
>   Add loongarch cpu support
>   Add loongarch cpu model and vendor info
>   Config some capabilities for loongarch virt machine
>   Implement the method of getting host info for loongarch
>   Add bios path for loongarch

The information provided in the cover letter, including pointers to
the various not-yet-upstreamed changes and instructions on how to
test everything, is very much appreciated!

Unfortunately I didn't have enough time to take things for a spin, so
I've limited myself to a relatively quick review.

In addition to the comments that I've provided for the code that is
there, I need to point out what is *not* there: specifically, any
kind of test :)

Before this can be considered for inclusion, we need to have some
test coverage. It doesn't have to be incredibly exhaustive, but at
least the basics need to be addressed. If you look for files that
contain "riscv64" in their names in the tests/ directory you should
get a decent idea of what kind of coverage we will need.

That's all I have for now. I'll talk to you again in 2024 :)

-- 
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH 0/5] add loongarch support for libvirt
Posted by lixianglai 4 months, 2 weeks ago
Hi Andrea:


> On Thu, Dec 14, 2023 at 02:08:44PM +0800, xianglai li wrote:
>> Hello, Everyone:
>>    This patch series adds libvirt support for loongarch.Although the bios
>> path and name has not been officially integrated into qemu and we think
>> there are still many shortcomings, we try to push a version of patch to
>> the community according to the opinions of the community, hoping to
>> listen to everyone's opinions.
> Sharing your work earlier rather than later is definitely a good
> approach when it comes to open source development, so I appreciate
> you doing this :)


Thank you very much for your affirmation and encouragement!


>>    loongarch's virtual machine bios is not yet available in qemu, so you can get it from the following link
>> https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine
> Great to see that edk2 support has already been mainlined! An
> excellent next step would be to get an edk2-loongarch64 package into
> the various distros... Please consider working with the maintainers
> for edk2 in Fedora to make that happen, as it would significantly
> lower the barrier for interested people to get involved.


Yes, we will do that, currently the loongarch code is being moved from 
the edk2-platform directory to the edk2 directory,

I think after this work is completed, we will have the edk2 installation 
package.


>> (Note: You should clone the repository using git instead of downloading the file via wget or you'll get xml)
>> We named the bios edk2-loongarch64-code.fd, edk2-loongarch64-vars.fd is used to store pflash images of non-volatile
>> variables.After installing qemu-system-loongarch64, you need to manually copy these two files to the /user/share/qemu
>> directory.
> As I have implicitly pointed out in the comment to one of the
> patches, these paths are not correct.
>
> The /usr/share/qemu/ directory is owned by the QEMU package, and
> other components should not drop their files in there. The exception
> is the /usr/share/qemu/firmware/ directory, which is specifically
> designed for interoperation.
>
> The edk2 files should be installed to /usr/share/edk2/loongarch64/,
> following the convention established by existing architectures. Once
> the directory name already contains architecture information, you can
> use shorter and less unique names for the files themselves.


I think edk2-loongarch64-code.fd can be the loongarch bios that comes 
with the qemu package,

and then its installation path is  /usr/share/qemu which makes sense.

The future separately generated loongarch edk2 installation package 
installation path according to your suggestion can be

/usr/share/edk2/loongarch64, named then QEMU_EFI. Fd.


>
>>    Well, if you have completed the above steps I think you can now install loongarch virtual machine,
>> you can install it through the virt-manager graphical interface, or install it through vrit-install,
>> here is an example of installing it using virt-install:
>>
>> virt-install  \
>> --virt-type=qemu \
>> --name  loongarch-test \
>> --memory 4096 \
>> --vcpus=4 \
>> --arch=loongarch64 \
>> --boot cdrom \
>> --disk device=cdrom,bus=scsi,path=/root/livecd-fedora-mate-4.loongarch64.iso \
>> --disk path=/var/lib/libvirt/images/debian12-loongarch64.qcow2,size=10,format=qcow2,bus=scsi \
>> --network network=default \
>> --osinfo archlinux   \
>> --feature acpi=true \
> This looks a bit out of place: virt-install should automatically
> enable the ACPI feature if it's advertised as available by libvirt.
>
> Please take a look at virQEMUCapsInitGuestFromBinary() and consider
> updating it so that ACPI support for loongarch is advertised.


Ok, I'll fix that in the next version.


>> lixianglai (5):
>>    Add loongarch cpu support
>>    Add loongarch cpu model and vendor info
>>    Config some capabilities for loongarch virt machine
>>    Implement the method of getting host info for loongarch
>>    Add bios path for loongarch
> The information provided in the cover letter, including pointers to
> the various not-yet-upstreamed changes and instructions on how to
> test everything, is very much appreciated!
Ok, I will provide more detailed instructions on changes and testing in 
the next version.
>
> Unfortunately I didn't have enough time to take things for a spin, so
> I've limited myself to a relatively quick review.
>
> In addition to the comments that I've provided for the code that is
> there, I need to point out what is *not* there: specifically, any
> kind of test :)
>
> Before this can be considered for inclusion, we need to have some
> test coverage. It doesn't have to be incredibly exhaustive, but at
> least the basics need to be addressed. If you look for files that
> contain "riscv64" in their names in the tests/ directory you should
> get a decent idea of what kind of coverage we will need.


Ok, I will refer to the "riscv64" file in the tests directory to add 
loongarch64 related test cases.


>
> That's all I have for now. I'll talk to you again in 2024 :)
>
Ok, thank you very much for taking time out of your busy schedule to 
review these patches.


Wish you a merry Christmas in advance.


Thanks!

Xianglai.
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: Re: [libvirt PATCH 0/5] add loongarch support for libvirt
Posted by Andrea Bolognani 3 months, 4 weeks ago
On Mon, Dec 18, 2023 at 11:40:03AM +0800, lixianglai wrote:
> On Thu, Dec 14, 2023 at 02:08:44PM +0800, xianglai li wrote:
> > Great to see that edk2 support has already been mainlined! An
> > excellent next step would be to get an edk2-loongarch64 package into
> > the various distros... Please consider working with the maintainers
> > for edk2 in Fedora to make that happen, as it would significantly
> > lower the barrier for interested people to get involved.
>
> Yes, we will do that, currently the loongarch code is being moved from the
> edk2-platform directory to the edk2 directory,
>
> I think after this work is completed, we will have the edk2 installation
> package.

I'm not very familiar with how the edk2 repository is maintained, but
that sounds like a good plan. Presumably an edk2 release will have to
be tagged as well.

> > The /usr/share/qemu/ directory is owned by the QEMU package, and
> > other components should not drop their files in there. The exception
> > is the /usr/share/qemu/firmware/ directory, which is specifically
> > designed for interoperation.
> >
> > The edk2 files should be installed to /usr/share/edk2/loongarch64/,
> > following the convention established by existing architectures. Once
> > the directory name already contains architecture information, you can
> > use shorter and less unique names for the files themselves.
>
> I think edk2-loongarch64-code.fd can be the loongarch bios that comes with
> the qemu package,
>
> and then its installation path is  /usr/share/qemu which makes sense.

Yes, but distro packages usually strip those bits and rely on
firmware packages being installed separately instead.

It's just a minor point. As long as support is still being merged
into the various upstream projects, testing things out is always
going to be messy. It will naturally become smoother over time :)

> > The information provided in the cover letter, including pointers to
> > the various not-yet-upstreamed changes and instructions on how to
> > test everything, is very much appreciated!
>
> Ok, I will provide more detailed instructions on changes and testing in the
> next version.

Personally I think that the information related to testing that
you've provided in the cover letter is quite extensive, so don't feel
that you necessarily need to expand upon it.

-- 
Andrea Bolognani / Red Hat / Virtualization
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH 0/5] add loongarch support for libvirt
Posted by lixianglai 3 months, 4 weeks ago
Hi  Andrea :
> On Mon, Dec 18, 2023 at 11:40:03AM +0800, lixianglai wrote:
>> On Thu, Dec 14, 2023 at 02:08:44PM +0800, xianglai li wrote:
>>> Great to see that edk2 support has already been mainlined! An
>>> excellent next step would be to get an edk2-loongarch64 package into
>>> the various distros... Please consider working with the maintainers
>>> for edk2 in Fedora to make that happen, as it would significantly
>>> lower the barrier for interested people to get involved.
>> Yes, we will do that, currently the loongarch code is being moved from the
>> edk2-platform directory to the edk2 directory,
>>
>> I think after this work is completed, we will have the edk2 installation
>> package.
> I'm not very familiar with how the edk2 repository is maintained, but
> that sounds like a good plan. Presumably an edk2 release will have to
> be tagged as well.
>
>>> The /usr/share/qemu/ directory is owned by the QEMU package, and
>>> other components should not drop their files in there. The exception
>>> is the /usr/share/qemu/firmware/ directory, which is specifically
>>> designed for interoperation.
>>>
>>> The edk2 files should be installed to /usr/share/edk2/loongarch64/,
>>> following the convention established by existing architectures. Once
>>> the directory name already contains architecture information, you can
>>> use shorter and less unique names for the files themselves.
>> I think edk2-loongarch64-code.fd can be the loongarch bios that comes with
>> the qemu package,
>>
>> and then its installation path is  /usr/share/qemu which makes sense.
> Yes, but distro packages usually strip those bits and rely on
> firmware packages being installed separately instead.
>
> It's just a minor point. As long as support is still being merged
> into the various upstream projects, testing things out is always
> going to be messy. It will naturally become smoother over time :)
>
Ok, I see. Thank you very much!


>>> The information provided in the cover letter, including pointers to
>>> the various not-yet-upstreamed changes and instructions on how to
>>> test everything, is very much appreciated!
>> Ok, I will provide more detailed instructions on changes and testing in the
>> next version.
> Personally I think that the information related to testing that
> you've provided in the cover letter is quite extensive, so don't feel
> that you necessarily need to expand upon it.

Ok, I see. Thank you very much!

Thanks,

Xianglai.
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org