From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v7 12/32] xen/x86: add bitmap of enabled emulated devices Date: Wed, 14 Oct 2015 21:48:41 -0400 Message-ID: <561F05F9.5090807@oracle.com> References: <1443800943-17668-1-git-send-email-roger.pau@citrix.com> <1443800943-17668-13-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZmXf3-0007gY-UW for xen-devel@lists.xenproject.org; Thu, 15 Oct 2015 01:48:54 +0000 In-Reply-To: <1443800943-17668-13-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne , xen-devel@lists.xenproject.org Cc: Wei Liu , Ian Campbell , Stefano Stabellini , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich List-Id: xen-devel@lists.xenproject.org On 10/02/2015 11:48 AM, Roger Pau Monne wrote: > Introduce a bitmap in x86 xen_arch_domainconfig that allows enabling or > disabling specific devices emulated inside of Xen for HVM guests. > ... > diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h > index 2ecc9c9..c97a9b4 100644 > --- a/xen/include/public/arch-x86/xen.h > +++ b/xen/include/public/arch-x86/xen.h > @@ -268,7 +268,28 @@ typedef struct arch_shared_info arch_shared_info_t; > * XEN_DOMCTL_INTERFACE_VERSION. > */ > struct xen_arch_domainconfig { > - char dummy; > +#define _XEN_X86_EMU_LAPIC 0 > +#define XEN_X86_EMU_LAPIC (1U<<_XEN_X86_EMU_LAPIC) > +#define _XEN_X86_EMU_HPET 1 > +#define XEN_X86_EMU_HPET (1U<<_XEN_X86_EMU_HPET) > +#define _XEN_X86_EMU_PMTIMER 2 > +#define XEN_X86_EMU_PMTIMER (1U<<_XEN_X86_EMU_PMTIMER) > +#define _XEN_X86_EMU_RTC 3 > +#define XEN_X86_EMU_RTC (1U<<_XEN_X86_EMU_RTC) > +#define _XEN_X86_EMU_IOAPIC 4 > +#define XEN_X86_EMU_IOAPIC (1U<<_XEN_X86_EMU_IOAPIC) > +#define _XEN_X86_EMU_PIC 5 > +#define XEN_X86_EMU_PIC (1U<<_XEN_X86_EMU_PIC) > +#define _XEN_X86_EMU_VGA 6 > +#define XEN_X86_EMU_VGA (1U<<_XEN_X86_EMU_VGA) > +#define _XEN_X86_EMU_IOMMU 7 > +#define XEN_X86_EMU_IOMMU (1U<<_XEN_X86_EMU_IOMMU) What about PIT? Should we (initially) disable it as well? I (by mistake) enabled it in my guest and crashed the hypervisor due to unprotected access to vlapic in pt_update_irq(). I started fixing it but then realized that perhaps we shouldn't have PIT at all. Which did solve my problems. (Regardless of whether we have PIT we should probably guard vlapic_accept_pit_interrupt() in pit_irq_masked() with has_vlapic()) -boris > + > +#define XEN_X86_EMU_ALL (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET | \ > + XEN_X86_EMU_PMTIMER | XEN_X86_EMU_RTC | \ > + XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC | \ > + XEN_X86_EMU_VGA | XEN_X86_EMU_IOMMU) > + uint32_t emulation_flags; > }; > #endif >