Skip to contentSkip to conversation

hw/arm/virt: about the default gic-version in accelerated mode

question Auger Eric 4 participants 9 messages Jan 28, 2020

lore
Share & tools
lore

Auger Eric

author
#0 lore raw

Hi Peter,

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Thanks

Eric

#1 lore raw
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

thanks
-- PMM

#2 lore raw
Quoted 22 lines · * Peter Maydell ([email protected]) wrote:
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 4 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

I'm curious why; 'virt' is a versioned machine type, the whole point of versioned machine types is you're allowed to change the behaviour of
them between versions of qemu. If people want their command lines
to stay stable they can specify a version, i.e. -M virt-4.2 and know that it won't change.

Quoted 2 lines

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

Dave

Quoted 3 lines

thanks
-- PMM

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

author
#3 lore raw
In reply to Peter Maydell

Hi Peter,

Quoted 22 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 7 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

OK that's understood.

So I will just try to improve the above traces.

Thanks

Eric

Quoted 4 lines

thanks
-- PMM

#4 lore raw
In reply to Peter Maydell
Quoted 22 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 8 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

There is a case where we can probe without breaking backward compatibility. That case is kvm-enabled and no gic-version specified. The reason it would be safe to probe the GIC version is because unless the host was a gicv2 host, then that command line wouldn't have worked anyway. And, if it is a gicv2 host, then the probing will come to the same conclusion as the default and nothing will have changed.

Thanks,
drew

author
#5 lore raw

Hi Drew,

Quoted 32 lines · Andrew Jones
Quoted 22 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 8 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

Quoted 5 lines

There is a case where we can probe without breaking backward compatibility. That case is kvm-enabled and no gic-version specified. The reason it would be safe to probe the GIC version is because unless the host was a gicv2 host, then that command line wouldn't have worked anyway.

Except if the host GICv3 has a GICv2 compat (which is pretty unlikely)?

Eric

And, if it is a gicv2 host,

Quoted 7 lines

then the probing will come to the same conclusion as the default and nothing will have changed.

Thanks,
drew

#6 lore raw
Quoted 35 lines · Auger Eric

Hi Drew,

Quoted 32 lines · Andrew Jones
Quoted 30 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

Quoted 6 lines
Quoted 5 lines

There is a case where we can probe without breaking backward compatibility. That case is kvm-enabled and no gic-version specified. The reason it would be safe to probe the GIC version is because unless the host was a gicv2 host, then that command line wouldn't have worked anyway.

Except if the host GICv3 has a GICv2 compat (which is pretty unlikely)?

Is there a way to probe that? If so, and the setting up of gicv2 on a gicv3 host with the gicv2-compat is the same as setting up gicv2, then we can just choose gicv2 to keep the command line compatibility.

Thanks,
drew

author
#7 lore raw

Hi,

Quoted 41 lines · Andrew Jones
Quoted 40 lines · Auger Eric

Hi Drew,

Quoted 37 lines · Andrew Jones
Quoted 22 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 8 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

There is a case where we can probe without breaking backward compatibility. That case is kvm-enabled and no gic-version specified. The reason it would be safe to probe the GIC version is because unless the host was a gicv2 host, then that command line wouldn't have worked anyway.

Quoted 5 lines
Quoted 1 line

Except if the host GICv3 has a GICv2 compat (which is pretty unlikely)?

Is there a way to probe that? If so, and the setting up of gicv2 on a gicv3 host with the gicv2-compat is the same as setting up gicv2, then we can just choose gicv2 to keep the command line compatibility.

I think that if the host GICv3 is GICv2 compatible then you can create both a KVM_DEV_TYPE_ARM_VGIC_V2 device and a KVM_DEV_TYPE_ARM_VGIC_V3 device. Otherwise you can only create a KVM_DEV_TYPE_ARM_VGIC_V3 KVM device.

Thanks

Eric

Quoted 5 lines

Thanks,
drew

#8 lore raw
Quoted 44 lines · Auger Eric

Hi,

Quoted 41 lines · Andrew Jones
Quoted 40 lines · Auger Eric

Hi Drew,

Quoted 37 lines · Andrew Jones
Quoted 22 lines · Peter Maydell
Quoted 16 lines · Auger Eric

When arm virt machine is run in accelerated mode with "-cpu host -machine virt", the default gic version is 2.

I understand the rationale with TCG where we don't have MSI ITS emulation along with GICv3 so we need to choose GICv2 to get GICv2M functionality.

However in KVM mode, I would have expected to see the host GIC probed to set the same version on guest. Indeed most of our HW now have GICv3 without GICv2 compat mode so our default values lead to weird traces:

"
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
qemu-system-aarch64: failed to set irq for PMU
"

Quoted 4 lines

I would like to propose a patch to improve those errors and also suggest a hint. But I also wanted to know whether you would accept to change the default value with KVM and choose the host version instead of 2. For TCG we would keep v2.

Quoted 8 lines

As with the -cpu option, the default is there for command line backward compatibility primarily. Even if we had better support for MSI ITS emulation we'd still leave the default at GICv2.

If you want "do the best you can, regardless of accelerator" that is "-cpu max -machine gic-version=max".

There is a case where we can probe without breaking backward compatibility. That case is kvm-enabled and no gic-version specified. The reason it would be safe to probe the GIC version is because unless the host was a gicv2 host, then that command line wouldn't have worked anyway.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Except if the host GICv3 has a GICv2 compat (which is pretty unlikely)?

Is there a way to probe that? If so, and the setting up of gicv2 on a gicv3 host with the gicv2-compat is the same as setting up gicv2, then we can just choose gicv2 to keep the command line compatibility.

I think that if the host GICv3 is GICv2 compatible then you can create both a KVM_DEV_TYPE_ARM_VGIC_V2 device and a KVM_DEV_TYPE_ARM_VGIC_V3 device. Otherwise you can only create a KVM_DEV_TYPE_ARM_VGIC_V3 KVM device.

So it should be backward compatible to switch to probing. Just try gicv2 first. If it works, then use it.

Thanks,
drew