xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: JGross@suse.com
Cc: xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com,
	linux-kernel@vger.kernel.org, roger.pau@citrix.com
Subject: [PATCH v2 5/9] xen/pvh: Prevent PVH guests from using PIC, RTC and IOAPIC
Date: Thu, 26 Jan 2017 14:41:28 -0500	[thread overview]
Message-ID: <1485459692-23961-6-git-send-email-boris.ostrovsky@oracle.com> (raw)
In-Reply-To: <1485459692-23961-1-git-send-email-boris.ostrovsky@oracle.com>

Make sure they don't use these devices since they are not emulated
for unprivileged PVH guest.

Also don't initialize hypercall page for them in init_hvm_pv_info()
since this has already been done.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Changes in v2:
* Use cpuid_ebx() instead of cpuid()

 arch/x86/xen/enlighten.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c82fe14..6463382 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1791,20 +1791,32 @@ void __ref xen_hvm_init_shared_info(void)
 static void __init init_hvm_pv_info(void)
 {
 	int major, minor;
-	uint32_t eax, ebx, ecx, edx, pages, msr, base;
-	u64 pfn;
+	uint32_t eax, ebx, ecx, edx, msr, base;
 
 	base = xen_cpuid_base();
-	cpuid(base + 1, &eax, &ebx, &ecx, &edx);
+	eax = cpuid_eax(base + 1);
 
 	major = eax >> 16;
 	minor = eax & 0xffff;
 	printk(KERN_INFO "Xen version %d.%d.\n", major, minor);
 
-	cpuid(base + 2, &pages, &msr, &ecx, &edx);
+	xen_domain_type = XEN_HVM_DOMAIN;
 
-	pfn = __pa(hypercall_page);
-	wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
+	/* PVH set up hypercall page earlier in xen_prepare_pvh(). */
+	if (xen_pvh_domain()) {
+		pv_info.name = "Xen PVH";
+#ifdef CONFIG_ACPI
+		/* No PIC or IOAPIC */
+		acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
+#endif
+	} else {
+		u64 pfn;
+
+		pv_info.name = "Xen HVM";
+		msr = cpuid_ebx(base + 2);
+		pfn = __pa(hypercall_page);
+		wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
+	}
 
 	xen_setup_features();
 
@@ -1813,10 +1825,6 @@ static void __init init_hvm_pv_info(void)
 		this_cpu_write(xen_vcpu_id, ebx);
 	else
 		this_cpu_write(xen_vcpu_id, smp_processor_id());
-
-	pv_info.name = "Xen HVM";
-
-	xen_domain_type = XEN_HVM_DOMAIN;
 }
 #endif
 
@@ -1892,6 +1900,9 @@ static void __init xen_hvm_guest_init(void)
 
 	init_hvm_pv_info();
 
+	if (xen_pvh_domain())
+		x86_platform.legacy.rtc = 0;
+
 	xen_hvm_init_shared_info();
 
 	xen_panic_handler_init();
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-01-26 19:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 19:41 [PATCH v2 0/9] PVH v2 support (domU) Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 1/9] x86/boot/32: Convert the 32-bit pgtable setup code from assembly to C Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 2/9] xen/x86: Remove PVH support Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 3/9] xen/pvh: Import PVH-related Xen public interfaces Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 4/9] xen/pvh: Bootstrap PVH guest Boris Ostrovsky
2017-01-26 19:41 ` Boris Ostrovsky [this message]
2017-02-02 15:23   ` [PATCH v2 5/9] xen/pvh: Prevent PVH guests from using PIC, RTC and IOAPIC Juergen Gross
2017-02-02 15:35   ` Roger Pau Monné
     [not found]   ` <20170202153515.a3hznbofx4u4b3az@dhcp-3-221.uk.xensource.com>
2017-02-02 16:30     ` Boris Ostrovsky
     [not found]     ` <bcfdb3bc-e7df-9b1d-2066-1ff89b5e4620@oracle.com>
2017-02-02 16:40       ` Roger Pau Monné
     [not found]       ` <20170202164055.2nx7ypqw7esu3pzt@dhcp-3-221.uk.xensource.com>
2017-02-02 17:47         ` Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 6/9] xen/pvh: Initialize grant table for PVH guests Boris Ostrovsky
2017-01-27 15:38   ` Juergen Gross
2017-01-26 19:41 ` [PATCH v2 7/9] xen/pvh: PVH guests always have PV devices Boris Ostrovsky
2017-01-26 19:41 ` [PATCH v2 8/9] xen/pvh: Enable CPU hotplug Boris Ostrovsky
2017-01-27 15:36   ` Juergen Gross
2017-01-26 19:41 ` [PATCH v2 9/9] xen/pvh: Use Xen's emergency_restart op for PVH guests Boris Ostrovsky
2017-01-27 15:37   ` Juergen Gross
     [not found] ` <1485459692-23961-5-git-send-email-boris.ostrovsky@oracle.com>
2017-02-03  7:24   ` [PATCH v2 4/9] xen/pvh: Bootstrap PVH guest Juergen Gross
     [not found]   ` <2d9887fb-15ad-e665-bcd7-df69a93380a3@suse.com>
2017-02-03 16:20     ` Boris Ostrovsky
     [not found]     ` <0ca64861-0695-df0b-6b86-a41f3e170722@oracle.com>
2017-02-03 16:40       ` Juergen Gross
     [not found]       ` <4c700f8d-4188-7b5b-2eff-865fb96789f4@suse.com>
2017-02-03 18:05         ` Andrew Cooper

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=1485459692-23961-6-git-send-email-boris.ostrovsky@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JGross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).