public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "He, Qing" <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
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	[thread overview]
Message-ID: <46A7323C.4010308@qumranet.com> (raw)
In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048EA9-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.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 <eddie.dong-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Qing He <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
>
> @@ -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/

  parent reply	other threads:[~2007-07-25 11:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 10:09 [PATCH 2/3] add get/set irqchip ioctls for in kernel PIC live migration support He, Qing
     [not found] ` <37E52D09333DE2469A03574C88DBF40F048EA9-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-25 11:21   ` Avi Kivity [this message]
     [not found]     ` <46A7323C.4010308-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-26  3:15       ` He, Qing
     [not found]         ` <37E52D09333DE2469A03574C88DBF40F048EAE-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-26  5:09           ` Avi Kivity
2007-07-26  5:43       ` He, Qing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46A7323C.4010308@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox