>-----Original Message-----
>From: Avi Kivity [mailto:[EMAIL PROTECTED]
>Sent: 2007年7月25日 19:22
>To: He, Qing
>Cc: kvm-devel
>Subject: Re: [kvm-devel] [PATCH 2/3] add get/set irqchip ioctls for in kernel
>PIC live
>migration support
>
>He, Qing wrote:
>> This patch adds two new ioctls to dump and write kernel irqchips for
>> save/restore and live migration. PIC s/r and l/m is implemented in this
>> patch.
>>
>> Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>
>> Signed-off-by: Qing He <[EMAIL PROTECTED]>
>>
>>
>> @@ -2902,6 +2949,39 @@ static long kvm_vm_ioctl(struct file *filp,
>> }
>> break;
>> }
>> + case KVM_GET_IRQCHIP: {
>> + /* 0: PIC master, 1: PIC slave, 2: IOAPIC */
>> + struct kvm_irqchip chip;
>> +
>> + r = -EFAULT;
>> + if (copy_from_user(&chip, argp, sizeof chip))
>> + goto out;
>> + if (irqchip_in_kernel(kvm)) {
>> + r = kvm_vm_ioctl_get_irqchip(kvm, &chip);
>> + if (r)
>> + goto out;
>> + r = -EFAULT;
>> + if (copy_to_user(argp, &chip, sizeof chip))
>> + goto out;
>> + r = 0;
>> + }
>>
>
>We should return something other than EFAULT if !irqchip_in_kernel().
>Maybe ENXIO?
ENXIO is OK.
>
>> + break;
>> + }
>> + case KVM_SET_IRQCHIP: {
>> + /* 0: PIC master, 1: PIC slave, 2: IOAPIC */
>> + struct kvm_irqchip chip;
>> +
>> + r = -EFAULT;
>> + if (copy_from_user(&chip, argp, sizeof chip))
>> + goto out;
>> + if (irqchip_in_kernel(kvm)) {
>> + r = kvm_vm_ioctl_set_irqchip(kvm, &chip);
>> + if (r)
>> + goto out;
>> + r = 0;
>> + }
>>
>
>Same here.
>
>> + break;
>> + }
>> default:
>> ;
>> }
>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>> index 49d8124..1b49a7a 100644
>> --- a/include/linux/kvm.h
>> +++ b/include/linux/kvm.h
>> @@ -45,6 +45,38 @@ struct kvm_irq_level {
>> __u32 level;
>> };
>>
>> +
>> +struct kvm_irqchip {
>> + __u32 chip_id;
>>
>Add 32-bits of padding here in case the union needs to be 64-bit aligned
>in the future.
Yeah, it's my fault. I missed the padding here.
>
>> + union {
>> + struct kvm_ioctl_pic pic;
>>
>
>Reserve some space here so that other members can be added to the union
>without changing the ioctl number.
I checked the kvm_ioapic structure, if IOAPIC_NUM_PINS==24, at least 216 bytes
is required (within the union). If reserving space is for possible future
expansion, how much space do you think is appropriate?
>
>
>--
>Do not meddle in the internals of kernels, for they are subtle and quick to
>panic.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel