From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753320AbbHER56 (ORCPT ); Wed, 5 Aug 2015 13:57:58 -0400 Received: from foss.arm.com ([217.140.101.70]:35232 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751867AbbHER55 (ORCPT ); Wed, 5 Aug 2015 13:57:57 -0400 Date: Wed, 5 Aug 2015 18:57:53 +0100 From: Catalin Marinas To: Marc Zyngier Cc: Will Deacon , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: Re: [PATCH 07/13] arm64: KVM: VHE: Patch out use of HVC Message-ID: <20150805175752.GF24073@e104818-lin.cambridge.arm.com> References: <1436372356-30410-1-git-send-email-marc.zyngier@arm.com> <1436372356-30410-8-git-send-email-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436372356-30410-8-git-send-email-marc.zyngier@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 08, 2015 at 05:19:10PM +0100, Marc Zyngier wrote: > --- /dev/null > +++ b/arch/arm64/kvm/vhe-macros.h > @@ -0,0 +1,36 @@ > +/* > + * Copyright (C) 2015 - ARM Ltd > + * Author: Marc Zyngier > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program. If not, see . > + */ > + > +#ifndef __ARM64_VHE_MACROS_H__ > +#define __ARM64_VHE_MACROS_H__ > + > +#include > +#include > + > +#ifdef __ASSEMBLY__ > + > +/* Hack to allow stringification of macros... */ > +#define __S__(a,args...) __stringify(a, ##args) > +#define _S_(a,args...) __S__(a, args) > + > +.macro ifnvhe nonvhe vhe > + alternative_insn "\nonvhe", "\vhe", ARM64_HAS_VIRT_HOST_EXTN > +.endm I always found the alternative_insn tricks hard to read but with Daniel's patch queued in -next it gets slightly better. If you are not targeting 4.3, could you do something like (untested): .macro vhe_if_not alternative_if_not ARM64_HAS_VIRT_HOST_EXTN .endm .macro vhe_else alternative_else CONFIG_ARM64_VHE .endm .macro vhe_endif alternative_endif CONFIG_ARM64_VHE .endm The kvm_call_hyp, for example, would become: ENTRY(kvm_call_hyp) vhe_if_not hvc #0 ret vhe_else nop push lr, xzr vhe_endif Or you can even ignore defining new vhe_* macros altogether and just use "alternative_if_not ARM64_HAS_VIRT_HOST_EXTN" directly (more to type) but you may be able to avoid a vhe-macros.h file. -- Catalin