From: Keir Fraser <keir.xen@gmail.com>
To: Jan Beulich <JBeulich@suse.com>, xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] x86: allow Dom0 read-only access to IO-APICs
Date: Thu, 02 May 2013 07:55:02 +0100 [thread overview]
Message-ID: <CDA7CC56.512BB%keir.xen@gmail.com> (raw)
In-Reply-To: <5182245A02000078000D26B0@nat28.tlf.novell.com>
On 02/05/2013 07:31, "Jan Beulich" <JBeulich@suse.com> wrote:
> There are BIOSes that want to map the IO-APIC MMIO region from some
> ACPI method(s), and there is at least one BIOS flavor that wants to
> use this mapping to clear an RTE's mask bit. While we can't allow the
> latter, we can permit reads and simply drop write attempts, leveraging
> the already existing infrastructure introduced for dealing with AMD
> IOMMUs' representation as PCI devices.
>
> This fixes an interrupt setup problem on a system where _CRS evaluation
> involved the above described BIOS/ACPI behavior, and is expected to
> also deal with a boot time crash of pv-ops Linux upon encountering the
> same kind of system.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
mmio_ro_ranges is not specific to ioapic handling, so its initialisation
should probably not go to init_ioapic_mappings()? If it is x86 specific (for
now at least) then it could just go in __start_xen()?
-- Keir
> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -1114,7 +1114,7 @@ int __init construct_dom0(
> for ( i = 0; i < nr_ioapics; i++ )
> {
> mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
> - if ( smp_found_config )
> + if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
> rc |= iomem_deny_access(dom0, mfn, mfn);
> }
>
> --- a/xen/arch/x86/io_apic.c
> +++ b/xen/arch/x86/io_apic.c
> @@ -2468,6 +2468,9 @@ void __init init_ioapic_mappings(void)
> unsigned int i, idx = FIX_IO_APIC_BASE_0;
> union IO_APIC_reg_01 reg_01;
>
> + mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
> + RANGESETF_prettyprint_hex);
> +
> if ( smp_found_config )
> nr_irqs_gsi = 0;
> for ( i = 0; i < nr_ioapics; i++ )
> @@ -2507,6 +2510,11 @@ void __init init_ioapic_mappings(void)
> reg_01.raw = io_apic_read(i, 1);
> nr_ioapic_entries[i] = reg_01.bits.entries + 1;
> nr_irqs_gsi += nr_ioapic_entries[i];
> +
> + if ( rangeset_add_singleton(mmio_ro_ranges,
> + ioapic_phys >> PAGE_SHIFT) )
> + printk(KERN_ERR "Failed to mark IO-APIC page %lx
> read-only\n",
> + ioapic_phys);
> }
> }
>
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -105,8 +105,6 @@ void __init pt_pci_init(void)
> radix_tree_init(&pci_segments);
> if ( !alloc_pseg(0) )
> panic("Could not initialize PCI segment 0\n");
> - mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
> - RANGESETF_prettyprint_hex);
> }
>
> int __init pci_add_segment(u16 seg)
>
>
>
next prev parent reply other threads:[~2013-05-02 6:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-02 6:31 [PATCH] x86: allow Dom0 read-only access to IO-APICs Jan Beulich
2013-05-02 6:55 ` Keir Fraser [this message]
2013-05-02 7:03 ` Jan Beulich
2013-05-02 7:21 ` Keir Fraser
2013-05-02 8:00 ` [PATCH, v2] " Jan Beulich
2013-05-02 8:26 ` Keir Fraser
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=CDA7CC56.512BB%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=keir@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xen.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.