From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/3] add get/set irqchip ioctls for in kernel PIC live migration support Date: Wed, 25 Jul 2007 14:21:32 +0300 Message-ID: <46A7323C.4010308@qumranet.com> References: <37E52D09333DE2469A03574C88DBF40F048EA9@pdsmsx414.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: "He, Qing" Return-path: In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048EA9-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org 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 > Signed-off-by: Qing He > > > @@ -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? > + 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. > + 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. -- 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/