From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] x86: wrap kexec feature with CONFIG_KEXEC Date: Thu, 27 Aug 2015 16:27:19 +0100 Message-ID: <55DF2C57.8030100@citrix.com> References: <1440686870-19104-1-git-send-email-jonathan.creekmore@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 1ZUz5I-00071f-Pi for xen-devel@lists.xenproject.org; Thu, 27 Aug 2015 15:27:24 +0000 In-Reply-To: <1440686870-19104-1-git-send-email-jonathan.creekmore@gmail.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: Jonathan Creekmore , xen-devel@lists.xenproject.org Cc: andrew.cooper3@citrix.com, keir@xen.org, david.vrabel@citrix.com, jbeulich@suse.com List-Id: xen-devel@lists.xenproject.org On 27/08/15 15:47, Jonathan Creekmore wrote: > Add the appropriate #if checks around the kexec code in the x86 codebase > so that the feature can actually be turned off by the flag instead of > always required to be enabled on x86. What's your use case for this? I think you should consider providing empty stub functions for !KEXEC instead of all the #ifdefs. > --- a/xen/drivers/passthrough/vtd/dmar.h > +++ b/xen/drivers/passthrough/vtd/dmar.h > @@ -108,6 +108,7 @@ struct acpi_atsr_unit *acpi_find_matched_atsr_unit(const struct pci_dev *); > > #define DMAR_OPERATION_TIMEOUT MILLISECS(1000) > > +#ifdef CONFIG_KEXEC > #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ > do { \ > s_time_t start_time = NOW(); \ > @@ -125,6 +126,22 @@ do { \ > cpu_relax(); \ > } \ > } while (0) > +#else > +#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ > +do { \ > + s_time_t start_time = NOW(); \ > + while (1) { \ > + sts = op(iommu->reg, offset); \ > + if ( cond ) \ > + break; \ > + if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) { \ > + panic("%s:%d:%s: DMAR hardware is malfunctional", \ > + __FILE__, __LINE__, __func__); \ > + } \ > + cpu_relax(); \ > + } \ > +} while (0) > +#endif This is particular might be best done by making kexecing a static const variable equal to 0 in the !KEXEC case. > --- a/xen/include/asm-x86/config.h > +++ b/xen/include/asm-x86/config.h > @@ -1,6 +1,6 @@ > /****************************************************************************** > * config.h > - * > + * > * A Linux-style configuration list. > */ Stray whitespace change. David