* [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag
@ 2015-10-19 10:23 Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 1/2] pc: Require xen when initializing xenfv machine Stefano Stabellini
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stefano Stabellini @ 2015-10-19 10:23 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, Stefano Stabellini
The following changes since commit aedc8806172dd1ae904f04169ee3b19fce1d7893:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging (2015-10-19 10:06:56 +0100)
are available in the git repository at:
git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/2015-10-19-tag
for you to fetch changes up to dbb7405d8caad0814ceddd568cb49f163a847561:
xen-platform: Ensure xen is enabled when initializing (2015-10-19 10:16:01 +0000)
----------------------------------------------------------------
Xen 2015-10-19
----------------------------------------------------------------
Eduardo Habkost (2):
pc: Require xen when initializing xenfv machine
xen-platform: Ensure xen is enabled when initializing
hw/i386/pc_piix.c | 5 +++++
hw/i386/xen/xen_platform.c | 3 +++
2 files changed, 8 insertions(+)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/2] pc: Require xen when initializing xenfv machine
2015-10-19 10:23 [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Stefano Stabellini
@ 2015-10-19 10:23 ` Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing Stefano Stabellini
2015-10-19 11:48 ` [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Stefano Stabellini @ 2015-10-19 10:23 UTC (permalink / raw)
To: peter.maydell; +Cc: qemu-devel, Eduardo Habkost, Stefano Stabellini
From: Eduardo Habkost <ehabkost@redhat.com>
Without this check, the xen-platform device will crash on reset
if using the accel option with anything other than xen (e.g.
"-machine xenfv,accel=kvm").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
hw/i386/pc_piix.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ae7bbeb..a91cc3d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -434,6 +434,11 @@ static void pc_xen_hvm_init(MachineState *machine)
{
PCIBus *bus;
+ if (!xen_enabled()) {
+ error_report("xenfv machine requires the xen accelerator");
+ exit(1);
+ }
+
pc_xen_hvm_init_pci(machine);
bus = pci_find_primary_bus();
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing
2015-10-19 10:23 [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 1/2] pc: Require xen when initializing xenfv machine Stefano Stabellini
@ 2015-10-19 10:23 ` Stefano Stabellini
2015-10-19 10:48 ` Paolo Bonzini
2015-10-19 11:48 ` [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Peter Maydell
2 siblings, 1 reply; 6+ messages in thread
From: Stefano Stabellini @ 2015-10-19 10:23 UTC (permalink / raw)
To: peter.maydell; +Cc: qemu-devel, Eduardo Habkost, Stefano Stabellini
From: Eduardo Habkost <ehabkost@redhat.com>
The xen-platform code crashes on reset if the xen backend is not
initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform
won't be created without initializing the xen backend.
The assert can't be triggered by the user because the device is not
hotpluggable, and the only code creating it (at pc_xen_hvm_init())
already checks xen_enabled().
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
hw/i386/xen/xen_platform.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index ee45f03..8682c42 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -387,6 +387,9 @@ static int xen_platform_initfn(PCIDevice *dev)
PCIXenPlatformState *d = XEN_PLATFORM(dev);
uint8_t *pci_conf;
+ /* Device will crash on reset if xen is not initialized */
+ assert(xen_enabled());
+
pci_conf = dev->config;
pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing
2015-10-19 10:23 ` [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing Stefano Stabellini
@ 2015-10-19 10:48 ` Paolo Bonzini
2015-10-19 18:31 ` Eduardo Habkost
0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2015-10-19 10:48 UTC (permalink / raw)
To: Stefano Stabellini, peter.maydell; +Cc: qemu-devel, Eduardo Habkost
On 19/10/2015 12:23, Stefano Stabellini wrote:
> The xen-platform code crashes on reset if the xen backend is not
> initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform
> won't be created without initializing the xen backend.
>
> The assert can't be triggered by the user because the device is not
> hotpluggable, and the only code creating it (at pc_xen_hvm_init())
> already checks xen_enabled().
The device is not hotpluggable, but it is accessible with -device. This
is by design because IIUC, we want -M xenfv to be phased out in favor of
the PC machines plus -device xen-platform.
Thus, k->init should be changed to k->realize instead. I guess it can
be done on top of this pull request, so I'm not blocking it.
Paolo
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> ---
> hw/i386/xen/xen_platform.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
> index ee45f03..8682c42 100644
> --- a/hw/i386/xen/xen_platform.c
> +++ b/hw/i386/xen/xen_platform.c
> @@ -387,6 +387,9 @@ static int xen_platform_initfn(PCIDevice *dev)
> PCIXenPlatformState *d = XEN_PLATFORM(dev);
> uint8_t *pci_conf;
>
> + /* Device will crash on reset if xen is not initialized */
> + assert(xen_enabled());
> +
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag
2015-10-19 10:23 [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 1/2] pc: Require xen when initializing xenfv machine Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing Stefano Stabellini
@ 2015-10-19 11:48 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-10-19 11:48 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: QEMU Developers
On 19 October 2015 at 11:23, Stefano Stabellini
<stefano.stabellini@eu.citrix.com> wrote:
> The following changes since commit aedc8806172dd1ae904f04169ee3b19fce1d7893:
>
> Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging (2015-10-19 10:06:56 +0100)
>
> are available in the git repository at:
>
>
> git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/2015-10-19-tag
>
> for you to fetch changes up to dbb7405d8caad0814ceddd568cb49f163a847561:
>
> xen-platform: Ensure xen is enabled when initializing (2015-10-19 10:16:01 +0000)
>
> ----------------------------------------------------------------
> Xen 2015-10-19
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing
2015-10-19 10:48 ` Paolo Bonzini
@ 2015-10-19 18:31 ` Eduardo Habkost
0 siblings, 0 replies; 6+ messages in thread
From: Eduardo Habkost @ 2015-10-19 18:31 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: peter.maydell, qemu-devel, Stefano Stabellini
On Mon, Oct 19, 2015 at 12:48:11PM +0200, Paolo Bonzini wrote:
>
>
> On 19/10/2015 12:23, Stefano Stabellini wrote:
> > The xen-platform code crashes on reset if the xen backend is not
> > initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform
> > won't be created without initializing the xen backend.
> >
> > The assert can't be triggered by the user because the device is not
> > hotpluggable, and the only code creating it (at pc_xen_hvm_init())
> > already checks xen_enabled().
>
> The device is not hotpluggable, but it is accessible with -device. This
> is by design because IIUC, we want -M xenfv to be phased out in favor of
> the PC machines plus -device xen-platform.
Oops, that means the assert() needs to be replaced with proper error
reporting. I will do it.
>
> Thus, k->init should be changed to k->realize instead. I guess it can
> be done on top of this pull request, so I'm not blocking it.
xen_platform_initfn() is PCIDeviceClass::init, which is called from
realize.
--
Eduardo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-19 18:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 10:23 [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 1/2] pc: Require xen when initializing xenfv machine Stefano Stabellini
2015-10-19 10:23 ` [Qemu-devel] [PULL 2/2] xen-platform: Ensure xen is enabled when initializing Stefano Stabellini
2015-10-19 10:48 ` Paolo Bonzini
2015-10-19 18:31 ` Eduardo Habkost
2015-10-19 11:48 ` [Qemu-devel] [PULL 0/2] Xen 2015-10-19-tag Peter Maydell
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).