early PV on HVM
Subsystems (5)
PATCH 1/1 early PV on HVM
From: Sheng Yang <[email protected]>
this patch:
- adds a xen_guest_init hook in setup.c right after kvm_guest_init;
- initializes basic pv on hvm features in xen_guest_init;
--- arch/x86/kernel/apic/io_apic.c | 2 +- arch/x86/kernel/setup.c | 2 + arch/x86/xen/enlighten.c | 87 +++++++++++++++++++++++++++++++++++++ drivers/input/xen-kbdfront.c | 2 +- drivers/video/xen-fbfront.c | 2 +- drivers/xen/events.c | 2 + drivers/xen/xenbus/xenbus_probe.c | 17 ++++++- include/xen/xen.h | 2 + 8 files changed, 110 insertions(+), 6 deletions(-)
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -3565,7 +3565,7 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)if (type ==PCI_CAP_ID_MSI && nvec >1 )return 1 ; -if (xen_domain ()) +if (xen_pv_domain ())return xen_pci_setup_msi_irqs (dev, nvec, type); node =dev_to_node (&dev->dev);
arch/x86/kernel/setup.c +2 -0
@@ -49,6 +49,7 @@#include <asm/pci-direct.h> #include <linux/init_ohci1394_dma.h> #include <linux/kvm_para.h> +#include <xen/xen.h> #include <linux/errno.h> #include <linux/kernel.h>
@@ -1010,6 +1011,7 @@ void __init setup_arch(char **cmdline_p)probe_nr_irqs_gsi ();kvm_guest_init (); +xen_guest_init ();e820_reserve_resources ();e820_mark_nosave_regions (max_low_pfn);
arch/x86/xen/enlighten.c +87 -0
96 lines not on this page · raw message
drivers/input/xen-kbdfront.c +1 -1
@@ -340,7 +340,7 @@ static struct xenbus_driver xenkbd_driver = {static int __init xenkbd_init (void ) { -if (!xen_domain ()) +if (!xen_domain () ||xen_hvm_domain ())return -ENODEV ;/* Nothing to do if running in dom0. */
drivers/video/xen-fbfront.c +1 -1
@@ -685,7 +685,7 @@ static struct xenbus_driver xenfb_driver = {static int __init xenfb_init (void ) { -if (!xen_domain ()) +if (!xen_domain () ||xen_hvm_domain ())return -ENODEV ;/* Nothing to do if running in dom0. */
drivers/xen/events.c +2 -0
@@ -603,6 +603,7 @@ out:return irq; } +#ifdef CONFIG_PCI_XEN #ifdef CONFIG_PCI_MSI int xen_destroy_irq(int irq) {
@@ -696,6 +697,7 @@ out:return irq; }#endif +#endif int xen_vector_from_irq (unsigned irq) {
drivers/xen/xenbus/xenbus_probe.c +14 -3
@@ -55,6 +55,8 @@#include <xen/events.h> #include <xen/page.h> +#include <xen/hvm.h> +#include "xenbus_comms.h" #include "xenbus_probe.h"
@@ -708,10 +710,19 @@ static int __init xenbus_probe_init(void) xen_store_interface =mfn_to_virt (xen_store_mfn); }else { xenstored_ready =1 ; - xen_store_evtchn = xen_start_info->store_evtchn; - xen_store_mfn = xen_start_info->store_mfn; +if (xen_hvm_domain ()) { + xen_store_evtchn = +hvm_get_parameter (HVM_PARAM_STORE_EVTCHN ); + xen_store_mfn = +hvm_get_parameter (HVM_PARAM_STORE_PFN ); + xen_store_interface = +ioremap (xen_store_mfn <<PAGE_SHIFT ,PAGE_SIZE ); + }else { + xen_store_evtchn = xen_start_info->store_evtchn; + xen_store_mfn = xen_start_info->store_mfn; + xen_store_interface =mfn_to_virt (xen_store_mfn); + } } - xen_store_interface =mfn_to_virt (xen_store_mfn);/* Initialize the interface to xenstore. */ err =xs_init ();
include/xen/xen.h +2 -0
@@ -9,8 +9,10 @@ enum xen_domain_type {#ifdef CONFIG_XEN extern enum xen_domain_type xen_domain_type; +extern void xen_guest_init (void );#else #define xen_domain_type XEN_NATIVE +#define xen_guest_init () do { } while (0)#endif #define xen_domain () (xen_domain_type != XEN_NATIVE)
Signature · 1 line
1.5.4.3
Quoted 8 lines · Stefano Stabellini
From: Sheng Yang <[email protected]>
this patch:
- adds a
xen_guest_inithook insetup.cright afterkvm_guest_init;- initializes basic pv on hvm features in
xen_guest_init;
Looks mostly OK, except:
Quoted 17 lines
drivers/xen/xenbus/xenbus_probe.c +2
-0@@ -55,6 +55,8 @@#include <xen/events.h> #include <xen/page.h> +#include <xen/hvm.h> +#include "xenbus_comms.h" #include "xenbus_probe.h" @@ -708,10 +710,19 @@ static int __init xenbus_probe_init(void) xen_store_interface =mfn_to_virt (xen_store_mfn); }else { xenstored_ready =1 ;
drivers/xen/xenbus/xenbus_probe.c static int __init xenbus_probe_init(void) · line 720
Quoted 10 lines
drivers/xen/xenbus/xenbus_probe.c +7
-2- xen_store_evtchn = xen_start_info->store_evtchn; - xen_store_mfn = xen_start_info->store_mfn; +if (xen_hvm_domain ()) { + xen_store_evtchn = +hvm_get_parameter (HVM_PARAM_STORE_EVTCHN ); + xen_store_mfn = +hvm_get_parameter (HVM_PARAM_STORE_PFN ); + xen_store_interface = +ioremap (xen_store_mfn <<PAGE_SHIFT ,PAGE_SIZE );
I think I'd prefer to see these wrap 80 cols than be line-broken like this.
Quoted 15 lines
drivers/xen/xenbus/xenbus_probe.c +5
-1+ }else { + xen_store_evtchn = xen_start_info->store_evtchn; + xen_store_mfn = xen_start_info->store_mfn; + xen_store_interface =mfn_to_virt (xen_store_mfn); + } } - xen_store_interface =mfn_to_virt (xen_store_mfn);/* Initialize the interface to xenstore. */ drivers/xen/xenbus/xenbus_probe.c +0
-0err =xs_init ();include/xen/xen.h +0
-0
include/xen/xen.h enum xen_domain_type { · line 17
Quoted 9 lines
include/xen/xen.h +2
-0@@ -9,8 +9,10 @@ enum xen_domain_type {#ifdef CONFIG_XEN extern enum xen_domain_type xen_domain_type; +extern void xen_guest_init (void );#else #define xen_domain_type XEN_NATIVE +#define xen_guest_init () do { } while (0)#endif
This isn't an appropriate header for this. Something under arch/x86/include/asm would be better.
J
Quoted 25 lines · Jeremy Fitzhardinge
Quoted 8 lines · Stefano Stabellini
From: Sheng Yang <[email protected]>
this patch:
- adds a
xen_guest_inithook insetup.cright afterkvm_guest_init;- initializes basic pv on hvm features in
xen_guest_init;Looks mostly OK, except:
Quoted 13 lines
drivers/xen/xenbus/xenbus_probe.c +2
-0@@ -55,6 +55,8 @@#include <xen/events.h> #include <xen/page.h> +#include <xen/hvm.h> +#include "xenbus_comms.h" #include "xenbus_probe.h"
Quoted 16 lines
Quoted 4 lines
drivers/xen/xenbus/xenbus_probe.c +0
-0@@ -708,10 +710,19 @@ static int __init xenbus_probe_init(void) xen_store_interface =mfn_to_virt (xen_store_mfn); }else { xenstored_ready =1 ;drivers/xen/xenbus/xenbus_probe.c static int __init xenbus_probe_init(void) · line 720
Quoted 10 lines
drivers/xen/xenbus/xenbus_probe.c +7
-2- xen_store_evtchn = xen_start_info->store_evtchn; - xen_store_mfn = xen_start_info->store_mfn; +if (xen_hvm_domain ()) { + xen_store_evtchn = +hvm_get_parameter (HVM_PARAM_STORE_EVTCHN ); + xen_store_mfn = +hvm_get_parameter (HVM_PARAM_STORE_PFN ); + xen_store_interface = +ioremap (xen_store_mfn <<PAGE_SHIFT ,PAGE_SIZE );I think I'd prefer to see these wrap 80 cols than be line-broken like this.
Ok
Quoted 17 lines
Quoted 17 lines
drivers/xen/xenbus/xenbus_probe.c +5
-1+ }else { + xen_store_evtchn = xen_start_info->store_evtchn; + xen_store_mfn = xen_start_info->store_mfn; + xen_store_interface =mfn_to_virt (xen_store_mfn); + } } - xen_store_interface =mfn_to_virt (xen_store_mfn);/* Initialize the interface to xenstore. */ drivers/xen/xenbus/xenbus_probe.c +0
-0err =xs_init ();include/xen/xen.h +0
-0@@ -9,8 +9,10 @@ enum xen_domain_type {
Quoted 12 lines
include/xen/xen.h enum xen_domain_type { · line 17
Quoted 8 lines
include/xen/xen.h +2
-0#ifdef CONFIG_XEN extern enum xen_domain_type xen_domain_type; +extern void xen_guest_init (void );#else #define xen_domain_type XEN_NATIVE +#define xen_guest_init () do { } while (0)#endif This isn't an appropriate header for this. Something under
arch/x86/include/asmwould be better.
I moved it to arch/x86/include/asm/xen/xen.h, is that OK?
Quoted 2 lines · Stefano Stabellini
I moved it to
arch/x86/include/asm/xen/xen.h, is that OK?
Do you mean asm/xen/hypervisor.h? Looks fine.
J