All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@xensource.com>
To: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Virtualization Mailing List <virtualization@lists.osdl.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] paravirt: helper to disable all IO space
Date: Tue, 05 Jun 2007 18:38:09 -0700	[thread overview]
Message-ID: <46661001.5090406@xensource.com> (raw)
In-Reply-To: <46660CB2.60409@xensource.com>

Jeremy Fitzhardinge wrote:
> In a virtual environment, device drivers such as legacy IDE will waste
> quite a lot of time probing for their devices which will never appear.
> This helper function allows a paravirt implementation to lay claim to
> the whole iomem and ioport space, thereby disabling all device drivers
> trying to claim IO resources.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r 83c67f9402b5 arch/i386/kernel/paravirt.c
> --- a/arch/i386/kernel/paravirt.c	Tue Jun 05 17:41:04 2007 -0700
> +++ b/arch/i386/kernel/paravirt.c	Tue Jun 05 18:17:29 2007 -0700
> @@ -227,6 +227,39 @@ static int __init print_banner(void)
>  	return 0;
>  }
>  core_initcall(print_banner);
> +
> +static struct resource reserve_ioports = {
> +	.start = 0,
> +	.end = IO_SPACE_LIMIT,
> +	.name = "paravirt-ioport",
> +	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
> +};
> +
> +static struct resource reserve_iomem = {
> +	.start = 0,
> +	.end = -1,
> +	.name = "paravirt-iomem",
> +	.flags = IORESOURCE_MEM | IORESOURCE_BUSY,
> +};
> +
> +/*
> + * Reserve the whole legacy IO space to prevent any legacy drivers
> + * from wasting time probing for their hardware.  This is a fairly
> + * brute-force approach to disabling all non-virtual drivers.
> + * 
> + * Note that this must be called very early to have any effect.
> + */
> +int paravirt_disable_iospace(void)
> +{
> +	int ret = 0;
> +
> +	ret = request_resource(&ioport_resource, &reserve_ioports);
> +	if (ret == 0)
> +		ret = request_resource(&iomem_resource, &reserve_iomem);
> +
> +	return ret;
> +}
> +
>  
>  struct paravirt_ops paravirt_ops = {
>  	.name = "bare hardware",
> diff -r 83c67f9402b5 arch/i386/xen/setup.c
> --- a/arch/i386/xen/setup.c	Tue Jun 05 17:41:04 2007 -0700
> +++ b/arch/i386/xen/setup.c	Tue Jun 05 18:17:29 2007 -0700
>   

Oops.  This was supposed to be in the corresponding Xen patch.

    J

WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Fitzhardinge <jeremy@xensource.com>
To: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] paravirt: helper to disable all IO space
Date: Tue, 05 Jun 2007 18:38:09 -0700	[thread overview]
Message-ID: <46661001.5090406@xensource.com> (raw)
In-Reply-To: <46660CB2.60409@xensource.com>

Jeremy Fitzhardinge wrote:
> In a virtual environment, device drivers such as legacy IDE will waste
> quite a lot of time probing for their devices which will never appear.
> This helper function allows a paravirt implementation to lay claim to
> the whole iomem and ioport space, thereby disabling all device drivers
> trying to claim IO resources.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
>
> diff -r 83c67f9402b5 arch/i386/kernel/paravirt.c
> --- a/arch/i386/kernel/paravirt.c	Tue Jun 05 17:41:04 2007 -0700
> +++ b/arch/i386/kernel/paravirt.c	Tue Jun 05 18:17:29 2007 -0700
> @@ -227,6 +227,39 @@ static int __init print_banner(void)
>  	return 0;
>  }
>  core_initcall(print_banner);
> +
> +static struct resource reserve_ioports = {
> +	.start = 0,
> +	.end = IO_SPACE_LIMIT,
> +	.name = "paravirt-ioport",
> +	.flags = IORESOURCE_IO | IORESOURCE_BUSY,
> +};
> +
> +static struct resource reserve_iomem = {
> +	.start = 0,
> +	.end = -1,
> +	.name = "paravirt-iomem",
> +	.flags = IORESOURCE_MEM | IORESOURCE_BUSY,
> +};
> +
> +/*
> + * Reserve the whole legacy IO space to prevent any legacy drivers
> + * from wasting time probing for their hardware.  This is a fairly
> + * brute-force approach to disabling all non-virtual drivers.
> + * 
> + * Note that this must be called very early to have any effect.
> + */
> +int paravirt_disable_iospace(void)
> +{
> +	int ret = 0;
> +
> +	ret = request_resource(&ioport_resource, &reserve_ioports);
> +	if (ret == 0)
> +		ret = request_resource(&iomem_resource, &reserve_iomem);
> +
> +	return ret;
> +}
> +
>  
>  struct paravirt_ops paravirt_ops = {
>  	.name = "bare hardware",
> diff -r 83c67f9402b5 arch/i386/xen/setup.c
> --- a/arch/i386/xen/setup.c	Tue Jun 05 17:41:04 2007 -0700
> +++ b/arch/i386/xen/setup.c	Tue Jun 05 18:17:29 2007 -0700
>   

Oops.  This was supposed to be in the corresponding Xen patch.

    J

  reply	other threads:[~2007-06-06  1:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06  1:24 [PATCH] paravirt: helper to disable all IO space Jeremy Fitzhardinge
2007-06-06  1:24 ` Jeremy Fitzhardinge
2007-06-06  1:38 ` Jeremy Fitzhardinge [this message]
2007-06-06  1:38   ` Jeremy Fitzhardinge

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=46661001.5090406@xensource.com \
    --to=jeremy@xensource.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.