[PATCH] KVM: PPC: Book3S HV: check for XIVE device before executing the XICS hcalls
Cédric Le Goater
clg at kaod.org
Mon Dec 4 18:58:30 AEDT 2017
On 12/04/2017 02:04 AM, Paul Mackerras wrote:
> On Mon, Nov 27, 2017 at 08:30:17AM +0100, Cédric Le Goater wrote:
>> When QEMU is started with the option kernel_irqchip=òff, the kvm XICS
>> hcalls are being used even though a kvm XICS device has not been
>> created on the host, resulting quickly in a failure and a broken
>> guest.
>>
>> The test checking if there is a XIVE device in the VM before executing
>> the XICS hcalls is missing from the recent XICS-over-XIVE glue.
>>
>> Signed-off-by: Cédric Le Goater <clg at kaod.org>
>
> I think this is fixing the same bug that commit 00bb6ae50062 ("KVM:
> PPC: Book3S HV: Don't call real-mode XICS hypercall handlers if not
> enabled", 2017-10-26) addresses.
>
> Do you think this patch is needed in addition to 00bb6ae50062?
No. I think 00bb6ae50062 is fine.
It is a bit redundant for P8 systems because the XICS device
availability in the VM is already tested in the xics_rm_h_* hcalls
with :
struct kvmppc_xics *xics = vcpu->kvm->arch.xics;
if (!xics || !xics->real_mode)
return H_TOO_HARD;
But, as the XICS-over-XIVE glue also assigns the VCPU 'arch.irq_type'
field to KVMPPC_IRQ_XICS, we can use the macro kvmppc_xics_enabled()
for both backend in the top level hcalls.
Letting each backend decide whether H_TOO_HARD should be returned
might be more precise. I think we will clarify that when XIVE
exploitation mode support is added to KVM.
Thanks,
C.
More information about the Linuxppc-dev
mailing list